# The project focus

A milestone, an epic or a release the project works through now: `tkt next` stays inside it.

## The project focus

One package (a milestone, an epic or a [release](#plan-release-focus)) the project works through now. `tkt focus set golive` sets it for everyone (`.aitodo/config.yaml`); `tkt next` stays inside it.

```console
$ tkt focus set golive
```

- Your own focus: `AITODO_FOCUS` or `tkt next --focus X` (flag > env > project); `--all` ignores it.
- The focus's tickets: `tkt focus --tickets` or `tkt ticket list --focus` (a milestone: its tickets; an epic: its children).
- The focus's tree: `tkt tree --focus` (`--watch` reads the focus again on every redraw, so it follows `tkt focus set`).
- Nothing startable in it: it says why (`emptyReason`) and never falls back to other tickets.

### Details

- Loop: `tkt next --claim --assignee <you> --json` until exit 1.
- Groups refused (`tkt next --group`). Stored `focus: {kind, id}` (a server-store `write`).
- Outside the focus (no member, no member waits on it): info `OUTSIDE_FOCUS`, a claim warning, never a refusal.

- Without `tkt next --milestone`, `--group`, `--epic` the focus scopes (`scope: {kind, id, source}`); `--epic E`: an epic's children. `emptyReason`: done, blocked, claimed, mixed; `outsideBlockers`.

- `tkt focus [--json]`: effective focus, `done/total`, next ticket, outside blockers; `tkt focus clear` removes it.
- `tkt focus --tickets --live` adds the live state in another worktree, and its `--json` rows the claim (`claim`: assignee, branch, worktree, age, `here`, `stale`).

## A release as the focus

The [focus](#plan-focus) can be a release: `tkt focus release nov` (the same: `tkt focus set release:nov`; your own: `AITODO_FOCUS=release:nov` or `tkt next --focus release:nov`). Its members are every ticket the release reaches: its milestones' tickets, everything under its epics, and its direct members. A ticket that ships with it gets no `OUTSIDE_FOCUS`. `tkt next`, `tkt focus --tickets` and `tkt tree --focus` work from them; a shipped release is a complete focus.

```console
$ tkt focus release nov
```

### Details

- The `release:` prefix is needed: a release id looks like a milestone id, so `tkt focus set nov` looks for a milestone or an epic (the refusal names `tkt focus release nov`). Stored `focus: {kind: release, id}`. REST: `PATCH /v1/workspace/config` `{"focus": "release:nov"}`; `GET /v1/tickets:next` follows it.

## Commands on this page

- [`tkt focus`](/en/docs/reference/commands/milestone.md#tkt-focus): The milestone, epic or release the project works through now: tkt next stays inside it
- [`tkt focus set`](/en/docs/reference/commands/milestone.md#tkt-focus-set): Set the project focus: a milestone or an epic (not a group: use tkt next --group). tkt next then stays inside it for everyone; AITODO\_FOCUS overrides it for one caller
- [`tkt focus clear`](/en/docs/reference/commands/milestone.md#tkt-focus-clear): Remove the project focus: tkt next ranks the whole store again
- [`tkt focus release`](/en/docs/reference/commands/milestone.md#tkt-focus-release): Set the project focus to a release: every ticket its milestones, epics and direct members reach

## Related

- Hint · info: [`OUTSIDE_FOCUS`](/en/docs/reference/hints.md#OUTSIDE_FOCUS): The ticket is outside the project focus; never blocks
- Env var: [`AITODO_FOCUS`](/en/docs/reference/env.md#AITODO_FOCUS): Your own focus (a milestone, an epic or release:\<id\>) for tkt next; beats the project focus
- Config key: [`focus`](/en/docs/reference/config.md#focus): The project focus: the milestone, epic or release tkt next stays inside
