0014 — Task plan and checkpoints¶
- Status: Implemented (step 11.7, unreleased). Shipped behaviour: SPEC; tools: MCP tools → Plan.
- Size: ~2 agent-days (model, migration and service ~0.75; hooks, todo and reminders ~0.5; MCP, board and docs ~0.75).
Problem¶
An agent should always work by a plan the owner can see. A report at the end of a stage says what
happened, not what was meant to happen, and nothing shows a drift while the work goes on. Claude
Code keeps its own todo list, but it lives inside one context, disappears with /clear and is not
something the owner accepted.
Model¶
- Plan on the task: ordered
plan_steprows (title, "what and why" markdown, statuspending/in_progress/done/blocked). A done step is a checkpoint:done_at, a link (a report of the task or a PR URL), a one-line outcome and a conformance line, eitheras plannedordeviation: <why>(required for done). Deviations are highlighted on the card and in the Plan tab. - Plan status on the task row: none (no steps),
draft,accepted(with who and when). The owner accepts on the board, the coordinator withplan_accept. A change of the step titles or their order turns an accepted plan back to draft; status changes and "what and why" edits do not. - History: every plan write adds a
plan_revisionrow with the whole plan as JSON, the author and a reason; the board shows them with the diff of the titles. - Task size: an optional
sizefield (S/M/L), editable like the other fields; the first report whose first line names a size sets it when the task has none. - Second layer, never merged: the agent's Claude Code todo (
session_todo, per relaybay session and Claude Code id) shows under the current plan step as "now doing: …" with the list collapsed. A task with no plan steps shows the todo marked "Agent's plan, not accepted".
Rules¶
A new requirement kind in the rules document: {"kind": "plan_accepted", "unless_size": ["S"]},
in the default stage_requirements.dev. A task of unknown size needs the plan. warn mode adds a
warning to the move (a draft plan: "the plan is not accepted yet"); strict refuses it. A move to
dev with neither plan steps nor a todo also adds a soft hint: "write down what you are going to do
(todo or 2-3 steps with plan_set)".
Hooks¶
- Todo capture. Checked live on Claude Code 2.1.309: the todo tools are off by default (desktop
and CLI); with the env
CLAUDE_CODE_ENABLE_TODO_TOOLS=1they areTaskCreate(tool_inputsubject,description,activeForm; tool_response{"task": {"id", "subject"}}) andTaskUpdate(tool_inputtaskId,status; tool_response withstatusChange: {from, to}). Older builds useTodoWritewith the whole list (todos: [{content, status, activeForm}]). relaybay reads all three fromPostToolUse, before the activity coalescing, so no change is lost; unknown shapes are ignored and sizes capped (50 items, 200 characters). A new Claude Code id (after/clear) starts a fresh list; a list written before the agent linked its hook session moves with the exact link. - Reminder. For an exactly linked session (
cc_exact) and its bound open tasks: the current step (N/M, title, "what and why") and the todo item in progress go intoadditionalContextonSessionStart, after a todo change and everyplan_reminder_everytool events (default 30), never the same text twice in a row (a newSessionStartis a new context). Owner comments in the same answer keep the rest of the 8000-character budget.
API¶
plan_get(task), plan_set(task, steps, reason?) (replace semantics like review_steps_set:
step N keeps status and checkpoint while its title stays), plan_step_update(task, step, status,
outcome?, link?, conformance?), plan_accept(task); task_update gains size. Events
plan.set, plan.step_updated, plan.accepted, session.todo_updated.
Decided by default¶
- relaybay setup does not write
CLAUDE_CODE_ENABLE_TODO_TOOLS: it is the user's choice and easy to add or remove in Claude Code's settings. - Plan writes that change nothing (same titles and details, same status and checkpoint) are not kept as revisions.
- Leaving
doneclears the checkpoint; marking a done step done again (a new outcome or conformance) keeps itsdone_at. - A plan step's text is
detailsinplan_set, as inreview_steps_set. - A link is a report of the same task (
12,#12,report:12, stored asreport:12) or an http(s) URL; anything else is refused. - Agents do not accept plans;
plan_acceptis meant for the coordinator. - Reminders count
PostToolUseevents only;0turns the periodic reminder off. - The card shows the plan, not the todo; the todo is in the Plan tab.
Living plan (0.7)¶
On a real task the plan was 3/3 done in draft while rework went on by the owner's decisions: the plan could not grow without losing its acceptance and nobody was told to add a step. The plan is a map of where the work goes and where it is, for the owner and the agent, all the way.
plan_step_add(task, title, details?, reason)appends a pending step. The plan's status stays as it is; on an accepted plan the step carriesadded_after_acceptance_at,added_byandadded_reason(migration0022), shown in the Plan tab and in the history diff as+ 4. title (added after acceptance). Aplan_revisionwith the reason andplan.step_added.reasonis required.plan_setkeeps its rule: changed titles or order make a draft.- Server instruction 11: a change or an addition after a report is a new step with
plan_step_add(or the step back toin_progress), the stage back to dev,progressandnext_stepupdated. - The stage follows the plan.
plan_step_add, andplan_step_updatetaking a done step back toin_progress, on a task inreviewortestmove it todevin the same transaction with the stage noterework: <reason>(a reopened step:rework: <its title>) and the usualtask.stage_changed; the answer says<key> moved from review back to dev (rework: …).. When aplan_step_updatemakes every step done on a task indevthat has review steps, the answer addsHint: all steps done and the review checklist is set: move the task to review (task_set_stage).Nothing moves to review by itself. - Closed-plan warning. On a task whose plan steps are all done and a report came strictly
after the plan closed (the newer of the newest
done_atand the newest plan revision, so aplan_setdropping the last open step closes it too),report_addaddsWarning (rules): the plan is closed (N/N done) while work goes on: add a step with plan_step_add or reopen one.when the state ischangedin any open stage (code changed after the plan closed, e.g. rework in review) orverifiedindev; atask_update/task_patchchangingprogressadds it only indev, behind the same gate. The closing report and the closing progress never warn. A warning instrictmode too, never a refusal. The reminder and the session-start context sayPlan of <key> (<state>): the plan is closed (N/N done) …only for a task indev; other stages keep "all N steps done".plan_step_addon adonetask is refused ("reopen it (task_set_stage) before adding steps"); onliveit is allowed and the answer says the step does not move the task. - Draft hint. A task in
devwhose plan is a draft and whose newest plan revision is at leastplan_draft_hint_hoursold (default 1,0off):portfolio_digest,project_digestandtask_contextend withHint: <key>'s plan is a draft for N h: accept it (plan_accept) or ask for changes.only when the caller is a coordinator session (named incoordinators, checked before the call links its hook session);project_snapshothas no caller identity and never carries it. Oldest first, at most five lines, then…and N more drafts.; the query finds only those tasks. The card's Plan badge showsdraft · N h. Never a line for the agent.
Decided by default:
- Only a step added to an accepted plan is marked; on a draft plan (or a task without a plan,
which then gets a draft)
plan_step_addis a plain append with the reason in the history. - A step renamed by
plan_setloses its mark, like its checkpoint. - The automatic move back to
devruns no stage rules (the plan's own write decides it) and does not mention the pulse. - The rework and all-done lines are MCP answer notes, not rule warnings; the closed-plan warning is a note too, so the owner's board form never shows it.
- The all-done hint comes only from the update that closes the plan (a done step marked done again says nothing).
- N in the draft hint is whole hours, rounded down; the hint lines are appended at the end of the digest text, after its budget.
- "After the plan closed" is strictly later: a report in the same millisecond as the closing write does not count.
Todo capture on Claude Code 2.1.318 (checked live with CLAUDE_CODE_ENABLE_TODO_TOOLS=1):
TaskCreate and TaskUpdate (status with or without activeForm) are recorded and "Now doing"
shows under the current step; the parser needed no change. Known limit: the forwarder gives up
after 0.3 s per network step and stays silent, so a dropped hook loses that todo change until the
next one (seen once: a status-only TaskUpdate about 30 s after the create stayed pending until
the next update).
Risks¶
| Risk | Mitigation |
|---|---|
| Todo tool payloads change between Claude Code builds | Defensive parsing, unknown shapes ignored, both generations supported |
| Reminders crowd the agent's context | Only on start, todo change and every N tools; never the same text twice; capped length |
| The plan turns into ceremony for small tasks | S tasks need no accepted plan; the todo counts as the agent's plan |