Skip to content

Plan a phase and approve its plans by digest - #308

Merged
crenshawdev merged 65 commits into
mainfrom
gladia
Nov 1, 2026
Merged

crenshawdev merged 65 commits into
mainfrom
gladia

Conversation

@crenshawdev

Copy link
Copy Markdown
Owner

Build 4 T9. A session can now plan a phase, from committing its stories through to an approved plan whose number is never reused. Every step that commits anything is approved by the owner at the terminal, by digest. Nothing checks or executes a plan yet, that's T10 and Build 5.

What changed:

  • phase-plan on baley_apply takes a phase and an ordered list of stories. When the list changes the phase's stories, it drafts a phase edit with a recorded continuation and issues no order. baley scope approve on that digest rechecks the selection, commits the stories and issues the one planner work order in one transaction, and prints its id. The session's next phase-plan is handed that same order once, and another phase-plan while it's pending is refused planner-order-pending. ADR 0050 records the decision.
  • The planner order is recorded on the new phase/<n> stream and binds the phase, its committed stories with their current truths, the capacity and the evidence items of the phase's approved plans.
  • plan-submit records a plan draft that survives a restart, judged by T8's judge against the phase as it stands, and opens its question set. It answers with the plan's size against planning.phase_capacity and refuses over-capacity when the phase would go over. A new submit makes the earlier draft stale and abandons its set.
  • When a plan's question set closes with a recommendation rejected, the session gets a planner revision order. baley plan approve <digest> refuses unknown-draft, stale-draft, draft-approved, question-open, answer-not-applied and phase-not-active in that order, judges the plan again, and records plan.approved with the next plan number.
  • plan-replace replaces an approved plan. Its approval records plan.approved under a new number and plan.replaced naming the old number and both digests, and the old plan's map stays readable. Numbers come from the highest ever assigned, so none is reused.
  • plan-read on baley_query, baley plan show and document (new phase and plan kinds) read a phase's approved plans with their evidence maps in plan-number order. Readiness against current truth versions is worked out at read time and never stored.
  • New phase_plan, plan and evidence_map views raise the view set to 14, and the backlog view gains each story's size. New settings planning.phase_capacity and workflow.test_command; a plan with no test command is approved without a suite.
  • bal-plan is served with its help row and stub.
  • Designs 0001 to 0005, 0010, 0012 and 0014, the C4 model and the roadmap match the code. The roadmap shows T8 merged and T9 in progress.

How it was verified: a second model reviewed the plan and every plan's diff, and the fixes are in this PR. Each acceptance check has a recorded failing run, before its behavior was built or with it broken. All 4,224 workspace tests, clippy and fmt pass. cargo deny ran its bans, licenses and sources checks offline with Cargo.lock unchanged, and CI runs the advisories. baley serve, driven over stdio in a throwaway home, ran every success criterion against the real binary, including the commitment approval at the terminal, which no test drives end to end.

Known limits: the plan checker is T10, and design 0005 section 12 holds its open question, the checker's revision order collides with the one live planner order. Phase completion is Build 5, so until then a project with an approved plan can't plan another phase. plan-replace's admitted-plan refusal reads false until Build 5 admits plans to execution. A multi-part document read can join parts read at different moments, that's #307.

Plan approval, replacement and the planning continuation each need a
record on the phase's stream before any recording can be built. The
approval carries the evidence map inline and the plan body only as its
record reference, so the map view rebuilds from events alone.
…ted plan

A plan draft is recorded as scope.submitted of kind plan, its digest over
the plan alone, so the judged plan keeps its submitted object and only an
accepted plan gives a draft. Replacements name the plan they replace in
the body and share the phase's one draft line.
An approval needs one answer whatever rule would fire first, so the
draft, its staleness, an earlier approval, open questions and rejected
answers are judged in a fixed order. A deferral keeps the recommended
answer and is never refused as a rejection.
A replacement may only name a plan in force at the digest it was approved
at, and never an admitted one. The new plan is then judged with the old
plan's tasks and evidence items gone from the phase, so capacity and item
conflicts count the phase as it will stand.
…d stale order

A replacement binding with a member beyond plan and digest read back the
same as one without it, though its digest differed, so the approval judge
could reach its expect on two drafts it saw as equal. The reader now
refuses such a binding. New cases pin that a replacement's digest covers
the replaced digest and that the stale path names goal ahead of tasks.
The phase_plan view is what the approval transaction reads for the next
plan number and what phase-plan reads to find another active phase, so it
refuses a reused number and keeps a replaced plan's binding.
Plan submit needs the set to abandon, the approval needs the draft's set,
and phase-plan needs the continuation without scanning events, so the
phase's planning state holds them and hands one order to a session once.
The plan view keeps a replaced plan's binding readable under its old
number and sees no draft or purge, so an unapproved plan never appears and
removing a draft body never removes an approved record.
Plan reads and the plan judge both need an approved plan's items exactly
as approved, so the view keeps the inline map whole, never a draft's, and
one reading turns a document into the items the judge takes.
… types and stale markers

The phase size sum could panic or wrap on an accepted size, so settle now
refuses a total past u64. Tests now cover approving a replaced plan's number
again, the projector's handled event types, and followed markers stale in
only the edit or only the order.
Planning reads planning.phase_capacity to refuse a plan over capacity, and approval reads workflow.test_command as the suite, so both enter the schema with value kinds the read, config set and config show handle.
The phase-plan call and the commitment approval need one rule for a selection's readiness and one order of paths, so a reorder is drafted, a pending planner order is never doubled and an approved order is handed over once. The submit's phase-not-active judgement sits beside it.
A story's size is the tasks of the approved plans in force that serve it, so the backlog keeps those plans per story and a replacement takes off exactly the replaced plan's tasks. The view moves to version 4.
The planning commands record plan events into the phase_plan, plan and evidence_map views, so the store must know the four events and the three views, and the set rises to 14 so an older binary reads a planned project as read-only rather than misreading it.
…ection

The order test listed its story faults in rule order, so judging each
story in turn through every rule would still pass. A missing story after
an unrefined one now has to answer no-such-story.
A planner order binds the phase, the stories being committed with their
current truths, the description, the capacity when set and the items of
the plans in force, and a revision adds its draft and answers. The
planner's text names the approved plans' items, so it serves version 2.
A planner order takes the subject phase/<n> and is recorded on that
phase's stream, and its issue and any retry declare that no other planner
order of the phase is pending, so a phase has one live planner order.
A phase edit that commits a new selection is recorded with the planning
continuation its approval follows, in one transaction that also observes
what the caller read, so an approvable edit never lacks its continuation.
Every other caller records exactly what it did before.
The order a commitment approval issued is handed over by recording
plan.continuation_followed and answering with the order's receipt, the
launch sentence shared with the issue, so the session launches it as a
fresh order. An order failed or answered since it was read is refused.
… followed

The hand-over judged nothing in the documents it observed, so a failed
or answered order could be handed to a session as live, and a second
hand-over reached the store and came back ledger-unavailable from the
projector. The read now refuses work-order-not-pending for an order
that is not pending, and planner-order-pending for one whose latest
continuation is followed or names another edit or order.
A phase-plan call is judged before admission over the readiness facts
and the phase's planning state, recording nothing on a refusal, then
drafts a changed selection with its continuation, issues a planning or
due revision order, or hands over an approved order. Every recording
observes what the check read, and an empty active index is declared
absent so a phase made active since makes the call ledger-busy.
Approving a phase edit that a phase's latest continuation names now
rechecks the selection's readiness and refuses beside a pending planner
order before the scope judgement, then records the stories and the
continuation's planner order in one transaction. A rerun is refused
draft-approved naming the order the approval issued.
When the approved draft is a commitment, baley scope approve records
Claude Code's effective policy in its policy step, routes the planner
order with Claude Code's accepted model names, and prints a line naming
the order the session's phase-plan launches. Every other approval keeps
its hostless policy step and its output.
A session asks for a phase's planner with phase-plan, appended after
story-questions-submit so no earlier spelling moves. Every refusal comes
before checkout admission and records nothing, and a retry of the same
call replays from its record while a reorder of the stories is another
request. The help text goes to version 4 because phase-plan takes
instruction. Tests that pinned the end of the apply baseline now check
each spelling against its neighbours, so an appended spelling leaves them
alone.
The hand-over observed only its own phase_plan and work_order documents,
so a phase made active or a selected story's truths emptied between the
check and the run let the order through where a fresh check refuses it.
It now observes the check's documents and declares its active-index
absence beside its own.
A changed selection's draft observed the check's documents but not its
absences, so a phase made active between the check and the run left the
edit and its continuation recorded instead of ledger-busy. The planning
continuation now carries the absences and the recording declares them.
A changed selection was answered with members built outside the
transaction, while a replay of the same request is answered from the
record, which held only the submission receipt. The recorded receipt now
carries the phase, the selection and the preview and approve commands,
and the call answers with it, so both answers come from one record.
Every refusal naming a work order printed the line saying a session's
phase-plan launches it, including a planner-order-pending refusal whose
order this approval did not issue and which that call is refused beside.
Only a commitment's receipt and a draft-approved refusal name the order
the approval issued.
A plan answers a live or answered planner order of its own phase, is
refused while another phase is active, and is judged by the plan judge
over facts read from the views, recording nothing. PlanRefusal gains
details so a refused session knows what each refusal is about.
A checked plan is stored as a record payload behind one scope.submitted
of kind plan, so the planner order reads answered, and the phase's
earlier draft's set is abandoned as the new set opens in the same
transaction, keeping one draft per phase. The decision observes the
check's reads, so a phase made active since is ledger-busy.
A revision order took the phase's committed stories from one read and its
inputs from a second, keeping only the second read's documents. A phase
edit approved between the two was issued for the old selection. The
readiness read's documents are now observed too, so that issue is
ledger-busy.
A replacement request sent again once its draft is approved must replay
its recorded receipt, which holds only while serve_submit keeps its
checks inside the check a replay skips. The test drives serve_submit
with the capacity's settings read taking its process as a seam, so no
program starts.
plan-read and baley plan show need one read of a phase's approved plans in
plan-number order, replaced ones included, with readiness worked out from the
current truths each time so a revised truth shows at once.
A session reads a phase's approved plans with their evidence maps and
readiness through the same read the owner's command prints, recording
nothing, so plan-read leaves the retired list in the place it always held.
The owner reads what a session reads through plan-read: each plan's number,
digest, state and readiness, then each evidence item with its truth version
and a check's level, so a plan made stale by a revised truth is visible.
A plan draft is approved only by baley plan approve, so scope approve refuses
its digest naming that command instead of reporting a damaged ledger, and
scope preview prints the plan with what it replaces and how to approve it.
Every plan in the evidence-map check carried plan 1's items, so a reader
fetching plan 1's map key for every plan still passed. Plan 2 now holds
e1 alone and the replacement holds e1 with e3, a unit check of t2 where
plan 1's e2 checks it at the integration level, and each plan's exact
map is asserted.
A session needs one served instruction that walks it from the phase's
committed stories to the plan the owner approves at the terminal. The text
now names the operation shapes, receipts and refusals the planning work
built, including the changed-selection draft, plan-replace, ready and the
revision order, and the approved plans read back. Its help row and stub
join the served set, and the tests that used bal-plan as the unserved
instruction use bal-review.
The document read names plan and phase identities, and the planning task
lists them. A phase answers with the roadmap's view of it and every plan
approved in it, and a plan with its evidence map, both through the read
plan-read and baley plan show use, so a draft is never answered. A missing
phase is no-such-phase and a plan number never approved is no-such-plan.
Every plan lookup in the test asked for phase 1, so a plan read that
ignored the phase asked would still pass. The test now looks up a phase
the roadmap does not hold through the plan kind, and plan 1 of two
phases holding it under different digests.
A phase plan's changed stories are a scope change only the owner may
approve, and its planner must not start on an unapproved commitment.
The record states why the approval also issues the planner's order.
phase plan drafts a changed selection as a phase edit with a planning
continuation, and its approval rechecks the selection and issues the
planner's order. The design said this was still to come.
phase plan, plan submit, plan approve, plan replace and plan read are
served, with the plan records, the planning views and the two settings.
The design still described them as a later build's.
Phase planning added three views, four plan events, planner orders on
the phase stream and two document kinds, and raised the view set to 14.
The ledger design now lists them as projected.
The plan gate issues the checker's revision order before the draft's
scope.submitted answers the planner order, which collides with a
phase's one live planner order. The checker is Build 4 T10's, so the
conflict is recorded as its open question rather than redesigned, and
the refused re-check row names T10 alone.
judge_commitment checks a due hand-over before it refuses a pending
planner order, but the figure refused planner-order-pending ahead of
the branch that hands that order over. The readiness refusals stay
first and the pending-order refusal now sits only where no hand-over
is due.
bal-plan sends a plan draft's question set through bal-rounds, but the
Stubs table described the relay as story-only. A plan set starts at the
round read, since plan-submit opened it, and its close returns to
bal-plan with ready or the revision order.
The schema now holds planning.phase_capacity and workflow.test_command
with their first readers, and three new callers route the planner's
orders, one of them the terminal approval routed for Claude Code.
bal-plan is served with its stub, phase-plan takes instruction, the
document read gains the phase and plan kinds, and the owner approves
plans and commitments at the terminal, so the host interface says so.
… model

The composer now issues the phase planner's planning and revision orders
on phase/<n>, so its work order rows and component text say which
orders exist, what they carry and what the planner returns.
T8 merged as #306 and this branch builds T9, so the opening, the Build 4
text, its table and the figure's classes say so, with T9's paragraph
and the view set raised to 14.
The two planning settings moved the guard settings' lines in the
standard schema, so the GRD-R5 row now names the schema function
instead of a line range that no longer points at them.
…gn 0012

The relay's served text submits analyzer questions with
story-questions-submit only for a story's set. A plan draft's set is
already open from plan-submit or plan-replace and starts at the round
read, as design 0005 says.
A plan draft's set issues the planner's revision order only when an
answer rejected a recommended answer and no other planner order of the
phase is pending, and a close on the recommendations answers ready. The
analyzer's drafting order at a set's close is held back the same way by
a pending analyzer order of the story.
The binary declares view set 14, raised by the phase_plan, plan and
evidence_map views beside the backlog view's version 4, while these
passages still said 13. A binary built before Build 4 T7 or T9 is also
fenced by the truth and plan events it does not know.
The command line now serves baley plan approve and baley plan show, so
the build inventory names them, and says plan drafts come only from a
session and plans are approved only here.
The planning views raised the view set the binary declares to 14, and
SUP-R1 still named 13.
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@crenshawdev
crenshawdev merged commit 7586682 into main Nov 1, 2026
7 checks passed
@crenshawdev
crenshawdev deleted the gladia branch November 1, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant