Area lifecycle and task-queue state
An area’s objective and its task queue answer different questions. The area
stays open until someone explicitly closes it, whereas its queue is empty,
ready, blocked, or exhausted. Finishing the current task bundle exhausts
the queue without closing the objective.
Area lifecycle is also separate from task status (open or done) and Git
operations, and slice progress is always derived from tasks.
Durable record
Section titled “Durable record”area.toml stores the lifecycle in one field:
lifecycle = "open"The only valid values are open and closed. zdev area create writes
lifecycle = "open". Older area.toml files that omit the field read as
open without migration, and the next close or reopen writes the field
explicitly. Unknown values or unknown fields fail validation.
The shared area validator enforces closed => no open tasks. Because
zdev check, status, goal, and task selection all run that validator, a
hand-edited closed record with open tasks fails rather than hiding or selecting
those tasks.
In TOML and JSON, the field name is lifecycle (labeled Lifecycle in human
output). Queue projections use the JSON field queue and the human label
Queue, with four values:
empty: the area has no task records;ready: at least one open task is ready (blocked tasks may also exist);blocked: open tasks exist, but none is ready;exhausted: at least one task exists and every task is done.
Dependency validation rejects missing blockers and cycles, so within a single
area every chain of open tasks reaches a ready task. A queue becomes blocked
only when every open task waits, directly or transitively, on a task in another
area that is not done in the current checkout. Zdev lists each wait as
<task> blocked by <id> (<area>: <status>), and JSON includes
cross_area_waits, an array of {task, blocker} objects omitted when empty.
Each task object with such a blocker also carries cross_area_blockers.
State matrix
Section titled “State matrix”| Lifecycle | Zero tasks (empty) |
Ready work (ready) |
Blocked-only work (blocked) |
All tasks done (exhausted) |
|---|---|---|---|---|
open |
Valid. The objective remains open for a first bundle. | Valid. Selection may return the first ready task. | Valid. Every open task waits on another area; selection returns no task and lists the waits. | Valid. The objective remains open for another reviewed bundle or an explicit close. |
closed |
Valid. Explicitly closing an empty objective is allowed. | Invalid record combination; close and task creation prevent it, and validation rejects it. | Invalid record combination; close prevents it, and validation rejects it. | Valid. The objective is explicitly closed. |
Task counts never change lifecycle. Closing an empty area records an explicit
decision that the objective needs no queued implementation, rather than
creating an abandoned task or a third lifecycle state.
Commands and mutation gates
Section titled “Commands and mutation gates”The public commands are:
zdev area close <area>zdev area reopen <area>Neither command takes flags, reason fields, or summaries, and neither modifies
tasks. Both acquire the zdev state lock, validate project relationships along
with the target area’s brief, slices, tasks, and generated index, and require
branch_status.task_work.safe = true. A stale-but-safe link is allowed and
returns its rebase advisory. A wrong branch, detached HEAD, active Git
operation, missing branch or anchor, invalid ancestry, or nonlinear child
history blocks the mutation; ordinary staged, unstaged, or untracked files do
not. On change, the command atomically rewrites only the target area.toml.
area close accepts empty and exhausted queues and rejects any open task
(ready or blocked) before writing:
Cannot close area <area>: <count> tasks are open. Complete them or keep the area openWhen open tasks in the area block tasks in other areas, the refusal lists each pair:
Cannot close area <area>: <count> tasks are open. Complete them or keep the area open. Open tasks block other areas: <task> blocks <dependent> (<dependent-area>)There is no override flag; area close succeeds only once every open task in
the area is done.
On a state change, human output is Closed area <area>. JSON contains
schema_version: 1, status: "closed", area, lifecycle: "closed", the
complete branch_status, and advisory (a string or null). Closing an
already closed area succeeds without writing: human output is
Area <area> is already closed, and JSON sets status to "unchanged".
area reopen changes only the area lifecycle without reopening tasks. On a
change, human output is Reopened area <area> and JSON uses status: "open"
and lifecycle: "open". Reopening an already open area succeeds without
writing, printing Area <area> is already open and setting JSON status to
"unchanged". Any stale advisory follows the human status on a new line and
appears once in JSON.
Read and selection vocabulary
Section titled “Read and selection vocabulary”Successful read output always reports lifecycle and queue separately alongside the task, count, slice, branch-status, advisory, and path objects.
zdev goal <area>
Section titled “zdev goal <area>”The human header has this exact layout:
Area: <tag> — <title>Lifecycle: <open|closed>Queue: <empty|ready|blocked|exhausted>Objective:<objective>Counts: <total> total; <open> open; <ready> ready; <blocked> blocked; <done> doneWhen ready, output continues with the task, slice, done-when, validation, and native-goal sections. The four no-work messages are:
The open area has no tasks. Create and approve a task, or close the area.Every open task waits on another area. Work here becomes ready when these blockers are done: <task> blocked by <id> (<area>: <status>)The open area's task queue is exhausted. Add approved work, reopen a task, or close the area.The area is closed. Reopen it before adding or selecting work.They correspond to open/empty, open/blocked, open/exhausted, and
either closed queue. Closed output still reports whether its queue is empty
or exhausted in the header, and every human result ends with one newline.
Goal JSON reports lifecycle and queue separately instead of collapsing them
into one status field. In deterministic key order, it contains schema_version,
area, lifecycle, queue, counts, and task, with native_goal
following task only for ready. The area object contains tag, title,
objective, and path. For empty, blocked, exhausted, and closed
projections, task is null and native_goal is omitted; a blocked
projection adds cross_area_waits. Neither complete nor a done count implies
that the area objective is closed.
zdev next <area>
Section titled “zdev next <area>”Area-specific next JSON reports lifecycle and queue separately. Ready and
open no-work results include branch_status and advisory, pairing open
with ready, empty, blocked, or exhausted. Closed results pair closed
with the actual queue and contain exactly schema_version, area,
lifecycle, queue, and task (null), omitting branch_status and
advisory.
Ready human output prefixes the task text with these lines, followed by one blank line:
Area: <area>Lifecycle: openQueue: readyThe four no-work human messages are:
No tasks are recorded in open area <area>. Add approved tasks or run `zdev area close <area>`Every open task in area <area> waits on another area. Work here becomes ready when these blockers are done: <task> blocked by <id> (<area>: <status>)The task queue is exhausted in open area <area>. Add approved tasks, reopen a task, or run `zdev area close <area>`Area <area> is closed. Run `zdev area reopen <area>` before adding or selecting workAn open area must pass the task-work branch gate before selection, even when
the queue is empty or exhausted. For a closed area, zdev next loads and
validates project and area metadata, relationships, the brief, slices, task
records, and the generated index, then returns the closed result before any Git
or task-work branch check. Observing closure therefore requires neither
task_work.safe nor task_work.structurally_safe, and works on another
branch, on detached HEAD, or during an unrelated Git operation. Mutation gates
stay intact: zdev area reopen <area> still requires task_work.safe, so an
off-branch caller must switch to the area’s branch first. Invalid records or
task graphs fail before projection.
When <area> is omitted, an explicit project default selects that area even if
it is closed, returning its area-specific result. Without a default, inference
considers only open areas: one open area is selected even when empty or
exhausted, while multiple open areas require naming one explicitly. If no area
is open, inference fails with
No area is open. Run \zdev area reopen ` before selecting work`.
zdev next --any
Section titled “zdev next --any”Project-wide JSON reports selection as "ready", "none", or "unsafe". A
ready result includes the selected open area’s lifecycle: "open" and
queue: "ready". Every result includes closed_areas, a tag-sorted JSON array
of area-tag strings (for example [] or ["alpha", "zeta"], never objects,
branches, or diagnostics). Closed areas are excluded before branch diagnostics,
candidate ranking, and unsafe-open-work checks.
A ready human result prefixes the task, area, branch, and skipped-area text
with Selection: ready and one blank line. A none result adds reason in
JSON: "no-ready-open-area" when open areas exist and "no-open-area" when
every area is closed (reason is omitted for ready and unsafe).
When open areas exist but none has ready work, the result uses
selection: "none", task: null, and:
No open area has ready work. Open task queues are empty or exhaustedWhen every area is closed, it prints:
No area is open. Run `zdev area reopen <area>` before selecting workStructurally unsafe open work returns selection: "unsafe", the skipped
diagnostics, and the No safe task is ready human message, keeping unsafe
states distinct from queue exhaustion. A ready area still wins even if other
open areas are unsafe or exhausted.
Whenever closed_areas is nonempty, human output appends one final line:
Excluded closed areas: <comma-separated tags in tag order>That line is omitted when closed_areas is empty. An all-closed result looks
like:
No area is open. Run `zdev area reopen <area>` before selecting workExcluded closed areas: alpha, zetazdev status [<area>]
Section titled “zdev status [<area>]”Selected-area human output starts with these lines before slice and branch diagnostics:
<title>Lifecycle: <open|closed>Queue: <empty|ready|blocked|exhausted>Counts: <total> total; <ready> ready; <blocked> blocked; <done> doneSelected JSON includes top-level lifecycle and queue, and the embedded area
metadata carries lifecycle as well. Project-wide human output prints the
project header and lists each area as
<tag>: <open|closed>, <empty|ready|blocked|exhausted>; <branch> -> <relationship> [<diagnostics>].
Each project-wide JSON area summary contains tag, title, lifecycle,
queue, total, ready, blocked, done, and branch_status. Status
includes closed areas and diagnoses their branches normally.
Other operations
Section titled “Other operations”zdev tasks reviewmay review a bundle for a closed area because it updates only the untracked current review in Git administrative state, leaving.zdev, the worktree, index, refs, and lifecycle untouched.zdev tasks import(with or without--commit) rejects a closed area before writing:Cannot add tasks to closed area <area>. Run \zdev area reopen ` first`. It never reopens the area implicitly.zdev task reopenrejects a closed area before changing the task:Cannot reopen task <task> in closed area <area>. Run \zdev area reopen ` first`. Listing and showing tasks still work, and task completion cannot happen in a valid closed area because every task is already done.generalis an ordinary area. A standing general area usually stays open across exhausted queues, closing and reopening only through the standard commands and gates.- Parent and child lifecycle values are independent. Closing a parent neither closes its children nor stops its branch from acting as their effective base, so an open child of a closed parent stays selectable while its branch link is safe. Closing a child leaves its parent unchanged. Parent assignment and managed rebases rely on records and branches rather than lifecycle.
- Slices have no lifecycle and do not affect area closure.
- After valid preflight evidence, the implement route returns a successful
no-work result for
open/empty,open/exhausted, orclosedwithout starting a worker. Explicit verify always requires anopen/readygoal matching its requested task ID; for any no-work goal it starts no verifier and returnsBLOCKER zdev-verify. Validated closed goals are classified before status, Git, and task-work checks, while open states run the full status, goal, and Git-baseline gates.