Closing
pocket-closing reconciles task verdicts with the execution log, advances only passing phases, appends closeout.md, and closes the plan when you ask.
pocket-closing is the closing stage of the pipeline. It reconciles task verdicts against the execution log, advances only a passing phase, and appends a readable record to closeout.md. It never re-reviews or overrides a verdict.
Core principle: Current verdicts decide. No current clean verdict, no phase advance.
When to use it
- You explicitly request phase or plan closeout (by invoking the skill, or via an end-to-end request that includes closing).
- A phase-level pass has completed and every task is passing.
When not to use it:
- A task is failing, blocked, or missing a current verdict: resume development first.
- Nobody asked for closeout. A passing verdict alone is not authorization: development deliberately stops at
REVIEW.
How to invoke it
/pocketto:pocket-closing <plan_dir>
/pocketto:pocket-closing docs/pocket/plans/2026-06-01-jwt-refresh/execution-plan/phase-2.mdHow it works
- Preflight: resolve the plan directory and the next
REVIEWtarget fromlog.json(canonical phase identity:phase-${order}). All checks run before any state change; a failed check leaves state untouched and names the recovery route. - Reconcile verdicts: every reviewable task (status
DONEwith adone_sha) is matched toreviews/<task_id>-review.json. A mandatory freshness check requires the review'sreviewed_shato equal the task's latest owned SHA. A correction committed after review makes the verdict stale and blocks the close. - Gate:
| Verdict | Result |
|---|---|
all REVIEW_PASS | Phase passes the gate |
REVIEW_FAIL | CLOSE_BLOCKED: failing tasks' fix_instructions printed verbatim |
REVIEW_BLOCKED (auditor-unavailable) | CLOSE_BLOCKED: the exact capability/access needed is reported |
REVIEW_BLOCKED (escalation) | CLOSE_BLOCKED: escalation instructions printed |
| stale or missing review | CLOSE_BLOCKED: re-run the phase-level pass |
- Advance: the phase moves to
DONEat the phase level only (never--task: taskdone_shavalues must not move):
npx -y pocketto-pi log update <plan_dir> <phase_file> DONE --json --contract 3- Record: one append-only section per phase is added to
closeout.mdunder a canonical marker (<!-- pocket-closeout:phase-${order} -->), built fromlog.json, current verdicts, and the phase notes. - Close: when the target phase was the last one:
npx -y pocketto-pi log close <plan_dir> --json --contract 3This verifies every phase is DONE, sets the header status, and atomically records the plan-closed lifecycle event. A non-zero exit with PHASES_NOT_DONE is the normal mid-pipeline state: the phase advanced, the plan continues (PHASE_ADVANCED).
Stacked plans
When log.json records phase_branches.mode == "stacked", the last phase's stacked handoff runs before log close:
npx -y pocketto-pi log handoff <plan_dir> <phase_file> --json --contract 3Handoff commits the plan artifacts and the phase-closed event, and returns next_actions[] entries (for example a pending lifecycle drain) that are executed exactly as given. log handoff after log close fails with LIFECYCLE_BAD_STATE. Handoff comes first for the last phase.
Output states
| State | Meaning |
|---|---|
CLOSED | All phases DONE; final closeout section written |
PHASE_ADVANCED | The target phase advanced; the plan continues |
NEXT_PHASE_READY | Nothing advanced; the next phase is WAITING and ready for development |
CLOSE_BLOCKED | Preflight failed, or a verdict is missing, stale, failing, or blocked |
ALREADY_CLOSED | Header already DONE; missing closeout sections were restored |
Constraints
- Never accepts a missing or stale verdict; never re-reviews code; never marks a task
DONEor touches adone_sha. - All state transitions go through
pocketto-pi log:log.jsonis never hand-edited. - Every
CLOSE_BLOCKEDstates what failed, why, and the next recovery action.
Related documentation
Development
pocket-development runs an approved plan task by task: subagents implement under Pocket Packets, read-only reviewers audit, and each phase ends in a pass.
Approval gates
Every point where the Pocketto pipeline stops for your approval, plus the independent review gates that stop for a reviewer who is not the author.