Repository navigation
F: redraft the current plan through lane D (draft requests, POST /api/plan/drafts) #124
Description
Problem
A review can get suggestions from Claude (#117), but cannot ask for a whole new plan. E2's prepareDraft can draft the next revision of an existing plan, and the planning provider runs draft mode. But no endpoint, Store lifecycle or E3 path exists for drafts. A plan changes as a whole only by import.
Goal
POST /api/plan/drafts asks Claude for a complete next revision of the review's current plan, from the GitHub issue and optional feedback. The result is kept as a durable request. It becomes the next revision only when the user applies it.
Decided 2026-10-04: redraft the current plan, not create a new task from an issue. A new task from an issue needs task creation outside today's one-review-per-server model, and should start with a design pass.
Work
-
Store (schema v11, after F: publish a finished task's pull request in production (#103) #110's v10). Add
requests.mode('suggest' | 'draft'; existing rows are suggestions).beginSuggestionstakes the mode.completeSuggestionschecks the reply by mode. A draft must be a v1 plan at revision n+1 for the plan's issue.getSuggestionsreturns the mode.- A new
applyDraft(identity, id, context)imports a ready draft that is still bound to the current revision and snapshot as revision n+1, through the same checks as import, then marks it consumed. applySuggestionrefuses a draft, andapplyDraftrefuses a suggestion.
-
E3.
SuggestionCoordinator.start(input, mode). Draft mode prepares withprepareDraftat revision n+1, and its stale checks compare the base revision. One active planning invocation per plan, shared by both modes. -
Server. Recorded routes:
POST /api/plan/drafts, which starts a draft like a suggestion: replay first, then read the issue, then the budget and shutdown rules from F: wire the planning provider into the server (suggestions through lane D) #117;GET /api/plan/drafts/:id;POST /api/plan/drafts/:id/cancel;POST /api/plan/drafts/:id/apply.
Suggestion routes refuse draft IDs, and draft routes refuse suggestion IDs.
-
Docs. The runner-lifecycle planning API table, and planning-acceptance.
Out of scope
- UI: lane G's planning screen.
- A first plan for a new task from an issue (see above).
- Recording a real Claude draft for the draft API. The E4 draft recording already validates through E2.
Acceptance
- A draft started against revision n and snapshot s is applied as revision n+1. A replayed apply is refused, and a draft made stale by a revision or snapshot change is refused.
- Draft and suggestion IDs cannot be used on each other's routes.
- A database at v9 or v10 migrates to v11, and its existing requests read as suggestions.
- Server tests with a stand-in provider; E4's recorded Claude draft replays through the draft path.
Follows #117. Depends on #110 for the schema version order.
🤖 Generated with Claude Code
Activity
F: address independent review on plan drafts (#124)
F: address review round 1 on plan drafts (#124)
F: address review round 2 on plan drafts (#124)
F: address review round 3 on plan drafts (#124)
F: address review round 4 on plan drafts (#124)
F: address review round 5 on plan drafts (#124)
F: address review round 6 on plan drafts (#124)
F: redraft the current plan through lane D (#124) (#125)