Skip to content

feat: add a decision review page and optional feature loop capabilities - #12

Open
brewdente wants to merge 23 commits into
mainfrom
feat/plan-impl-improvements
Open

brewdente wants to merge 23 commits into
mainfrom
feat/plan-impl-improvements

Conversation

@brewdente

@brewdente brewdente commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds a decision review page where a person settles the plan's main engineering choices before the build.
  • Adds optional loop features that stay off until a repository turns them on.
  • Adds a hygiene command that runs the repository's own lint and format tools.
🤖 Details
  • The optional features are a quality pass, approved patterns, architecture rules, a shape map, a design check and maintenance rounds.
  • The decision review is the one feature that is on by default, and "decisions": false turns it off. Intended.
  • The page shows only when a decision is required or recommended, so the plan stays the only stop.
  • The page shows each recommended answer with a diagram, and it has a dark mode button.
  • Build agents get each decision as one line, so decisions do not count toward the plan size warning.
  • Only a person promotes a learned pattern, and only a rule a person approved can block a build.
  • Plugin commands now work when the plugin folder is a symlink, as in a local install.
  • The Codex plugin gets the same scripts and rules.

Validation

  • All scenario suites pass, and 442 of 442 mutations are caught.
  • The decision page rendered from a real plan in both themes.
  • Check the theme button on a published claude.ai page.

Claude Code usage

Day Model In Out Cache R Cache W Total Cost
2026-11-18 claude-fable-5-2 634 574.1K 50.8M 2.4M 53.8M $67.26
2026-11-18 claude-opus-5-5 88 136.6K 3.7M 468.8K 4.3M $5.82
2026-11-19 claude-fable-5-2 508 430.9K 45.0M 1.9M 47.3M $56.02
2026-11-20 claude-fable-5-2 300 213.5K 26.2M 688.4K 27.1M $24.80
2026-11-23 claude-opus-5-5 1.2K 717.9K 116.1M 2.0M 118.9M $53.71
2026-11-23 claude-fable-5-2 98 47.5K 10.3M 407.1K 10.7M $10.47
2026-11-24 claude-opus-5-5 290 87.3K 21.5M 616.5K 22.2M $10.98
2026-11-28 claude-opus-5-5 20 5.6K 1.2M 107.8K 1.3M $1.22
2026-11-30 claude-opus-5-5 82 22.6K 5.9M 148.8K 6.1M $2.82
2026-12-02 claude-opus-5-5 118 36.1K 11.1M 391.6K 11.5M $6.08
TOTAL 3.4K 2.3M 291.9M 9.1M 303.3M $239.18

Estimated API-equivalent cost, not a billed charge.

…he status pane

The pane now names every step the feature loop can be on. A run that waits
for approval of the design contract says so. A run whose tests pass but whose
running feature was never exercised reads "not checked" instead of "finished".
The contract check, the live-check setup and the per-batch commit each show
under their own role name.

The pane no longer falls back to sampling the run record for an agent it
cannot observe (`samples` and `tails` are removed). A run that starts with a
plan revision or a design revision is recognised as this plugin's run.
The loop used to stop and print long chat text. A reviewer who did not write
the work could not find the overview, and each comment had to be typed back.

`review-page.mjs` renders one self-contained page from a run's saved documents
for each kind of stop: the design contract, the plan, and what a batch built.
Every page has the same format: an overview first, the detail below it, a
comment box on any item, and one action that sends all the comments back.
The change page groups changes by purpose, shows each departure from the plan,
and lists every test with a checkbox to exclude it.

The page works from a local file with no network, so the Codex adapter ships
the same script. Its answer goes back through the artifact database when the
page is published, with Copy and Download as fallbacks.
…hanged files

`/masterdevs:hygiene` (`$masterdevs-hygiene` on Codex) runs the lint, format,
type and complexity tools a repository already trusts, on the files a change
touched. It brings no rules of its own. Tools are listed in
`.masterdevs/hygiene.json`; without that file no tool runs, and the command
lists the candidates it found instead of guessing one.

It reports first. It applies only the fixes a tool makes by itself, and
proposes everything else. It never changes business logic. A test file that
loses an assertion or gains a skip during fixing is reported as a failure.

The default scope is the changed files, as whole files; `all` checks the whole
repository. A built-in estimate of complexity and function length names the
functions over a threshold plus a small repeatable sample, so a reviewer reads
those instead of every function.
…and report "passed" only when proven

The feature loop gains three things a user reads, and stops wasting time in
four places.

What the user reads
- A design contract, as a separate stop before planning, when the feature
  changes a table, an API, a message, a query, an algorithm, a flow, a
  dependency or a UI surface. It states each changed shape in full, how time
  grows with data volume, and what happens on a failure or two requests at
  once. Performance, scale and security follow stated defaults, and the
  contract lists only the departures. The plan is then checked against it.
- The plan document itself. Each agent's result is saved once as JSON and the
  review page is rendered from it, so no agent writes a second readable copy.
  Each step lists the tests it adds and what each one protects.
- A change review after each build: changes grouped by purpose, the reason
  for each, each departure from the plan, and every test with the engineer's
  estimate of its value.

Batches
- The Architect can divide a large plan into batches. The user approves the
  split with the plan. Each batch is built, verified and committed on its
  own, and the next one starts while the user reviews the previous one.
- A review comment either reworks the reviewed batch (a new commit) or changes
  the batches still to come. A comment marked "stop" halts the work in flight.
- Review comments on the contract or the plan go back to the Architect, who
  returns the complete revised document.

Fixes from the usage review
- "passed" now means the running feature was exercised. Tests alone give
  "not-proven". What the live check needs is shown at the plan gate and
  prepared before the build starts.
- A database that is down, a missing credential or a hung suite stops the run
  as an environment problem. It is no longer sent to an engineer as a defect.
- Every open question carries a recommended answer. Only a question whose
  answers lead to different plans stops the run.
- The build call passes a short manifest, and agents read the plan from its
  file. The 5-minute heartbeat and the background flag are gone; the status
  pane is the status.

Also: the reviewer always lists every form a value can take and finds every
sibling path of a changed rule; new code follows the repository's own rules
and conventions; the refactor step runs the repository's tools and the
reviewer reads only the functions they flag plus a sample; Verify measures
the contract's growth statements at two data volumes where it can.

`run-artifacts.mjs` copies each agent's result out of the run record at no
model cost and reports where the planning time went. The Codex adapter follows
the same protocol through its loop document and role skills.
A defect that reaches the user got past every step of the loop, and until now
the Playbook could not see it. `/masterdevs:playbook` (`$masterdevs-playbook`
on Codex) can now record one: what went wrong, its type, and the step that
should have caught it.

`playbook.mjs --record-escape` adds one line to `escapes.jsonl`, and `--status`
shows where bugs got through, by step and by type. A step whose count keeps
growing is the step to improve.

A record can carry the one lesson that would have caught the bug. The lesson
is staged, never written to a promoted lane directly. Because the person
recording it confirmed its wording, it does not wait for a second sighting:
the promotion that runs at the start of the next feature loads it.

The Playbook script gets its own model-free suite and its own mutations.
… the new suites in CI

The READMEs and the Codex guide now describe the three documents a user reads
(design contract, plan, change review), batch builds, the "not-proven" outcome
and the hygiene command. The heartbeat section is removed, because the status
pane is the status.

CI and the contributor guide now run five suites that had no CI step: the
status pane model, saved run documents, the review page, the hygiene runner
and the Playbook script.
…op, and the first step named Research

Each stop (design, plan, change review) now starts with a short summary
in the session, and the reader proceeds or asks for the page. The page
is one document for the worktree: each design, plan, change review and
revision is a new tab, and earlier tabs stay read-only with what was
sent back. The answer from the page is read before words in chat, and
an answer for an earlier tab is refused.

Planning does less repeated work: a claim that is proved wrong corrects
only the steps that depend on it, the design agent saves notes on what
it read and the plan agent starts from them, and a plan that follows an
agreed design does not write the overview again.

The first step of the loop is named Research in place of Refine, and
the command is /masterdevs:research (Codex: $masterdevs-research).
Records of older runs that say Refine are still read.
Too many human review documents had been added to the feature loop. Remove
the design contract stop, the build in batches, and the review pages (the
summary before each stop, the one review document with tabs, the answer
gate, the change record, and the review link in the status pane). The plan
gate is a short preview in chat again: approve, edit, or reject.

Kept from the same work: the Research name, "passed" only when the running
feature was checked, environment problems reported as such, recommended
answers, a local fix when a claim is wrong, the plan summary and test plan,
each result saved once with a small manifest, the hygiene command, the new
status pane, and the reviewer and engineer rules.

Two mutation checks lost their scenarios with the design stop; two checks
were added so they are caught again (176/176).
A repository can now turn on extra loop capabilities one at a time. With no
configuration, the loop runs exactly as before.

- One config file in the target repository (`.masterdevs/harness.json`):
  one flag for each capability (all off), and a list of protected files.
  Unknown keys are refused.
- Each run keeps `execution.json` in its run directory: the starting revision,
  its status, and checkpoints. A run that is `not-proven` is recorded as
  needing attention, never as completed.
- After the build, a check lists each protected file the build changed that
  no approved plan step names. `.masterdevs/` is always protected, and the
  engineer is told to leave these files alone.
- Versioned record shapes (execution, evidence, verification). A run with
  missing evidence never reads as passed.
- `hygiene.mjs` now uses the shared git, glob and scope helpers in
  `harness.mjs` instead of its own copies.

New suite: `scripts/harness-scenarios.mjs` (9 scenarios, 10 mutations).
Design note: `docs/HARNESS.md`.
… in small, checked batches

When a repository turns on `quality`, the loop replaces Polish with an
independent quality check. With the flag off, the loop is unchanged.

- A reviewer that did not write the code scores it against a short rubric
  (`references/quality.md`) and lists findings. It sees the approved intent
  and plan, never the implementer's own notes.
- Findings are grouped by root cause. Each cause is worked once. Fixes that
  would change a public interface, schema, money rule or permission go to
  you instead of being made.
- Fixes go in batches of up to 3. A second reviewer checks each batch. A
  batch that is not accepted is put back exactly as it was
  (`harness.mjs restore`), with no commits.
- At most 2 evaluation rounds and 6 batches; 2 failed batches in a row stop it.
- `/masterdevs:review fix` runs the same pass on code you already wrote.

14 loop scenarios and 16 mutations added.
… and only a person promotes learned knowledge

A repository can keep its own approved ways of solving recurring problems
in `.masterdevs/patterns/`, one JSON file each, committed with its code.
With the `patterns` flag off, the loop is unchanged.

- Only a person approves a pattern (`patterns.mjs status … --by`). How
  often the code does something is never approval: discovery writes
  proposals only. A new version starts again at proposed.
- The Architect finds the few patterns that apply and pins each at its
  version in the plan. Any departure from a mandatory rule is shown at the
  plan stop for you to decide. A later change to a pattern is reported
  (`patterns.mjs pins`), never silently applied to an approved plan.
- The engineer keeps the pinned rules. The reviewer and the quality check
  cite the pattern and rule when code departs from one.
- An exception is scoped, approved, tied to one version, and expires.
  Repeated exceptions to one pattern prompt you to reconsider it.
- `patterns.mjs validate` finds broken references, renamed symbols,
  expired exceptions and impossible status changes.
- The Playbook no longer promotes on its own. A candidate seen twice is
  only proposed; `playbook.mjs --promote` moves just the entries you name
  with `--only "<title>"`. Each feature run says how many wait for you.

Codex follows the same rules. 6 pattern scenarios, 5 loop scenarios,
3 Playbook scenarios, 29 new mutations.
…ly rules a person approved can block

A repository can now describe an engineering rule as a command it already
runs (a linter rule, an import check, a test) in `.masterdevs/rules/<id>.json`.
`scripts/fitness.mjs` runs those rules on the changed files and reports one
result per rule.

- A rule blocks only when an approved pattern makes it a required
  constraint. That pattern gives the owner, the approval and the
  exceptions. Every other rule only gives advice.
- Old violations that a person accepted (`fitness.mjs baseline --by`) do
  not block. A new violation does. A critical rule has no accepted
  violations.
- A required rule whose tool is missing or crashes is never "passed".
- With `fitness` on, every agent that changes code runs the rules before
  it returns, Verify reports a failed required rule as a failure, and the
  feature skill runs them once more after the build. Codex does the same.
- The command runner moved from `hygiene.mjs` into `harness.mjs` so both
  scripts share it.

Scenarios: 8 harness, 4 loop. Mutations: 257/257 caught.
…n one page before the build

The Architect now lists the few choices that matter in the plan (where data
lives, how a refund changes a total), each with options, evidence, diagrams
and a recommendation. Routine details are not asked. `scripts/decisions.mjs`
keeps their state, and the plan gate shows them on one review page.

- The page shows one question at a time, foundations first. A reviewer can
  approve, choose another option, add constraints, ask a question, delegate,
  defer or reject. A draft or a comment approves nothing.
- Only a named person answers (`--by`). An answer given to an older version
  of a decision is refused.
- When the plan changes an answered choice, that answer and every answer
  that rests on it are marked "changed — look again".
- Contradictions stop the build: circular dependencies, a missing
  dependency, a settled choice on a rejected one, and options that cannot
  be built together.
- The build does not start while a required decision is open. The engineer
  and the reviewer get the chosen options and constraints.
- Diagrams are Mermaid, built from structured parts. Codex gets a
  standalone page with a "Copy answers" fallback.
- Off by default (`capabilities.decisions`).
…he code's shape, grouped by purpose and ranked by risk

With `structure` turned on, the repository's own extractor tools read the code before and after the build, each in a clean copy. The change is compared part by part and link by link, and grouped into review units (one per plan step, then by the links between parts). Each unit has its risk, diagrams, and the source line of every claim. Risk follows consequence, not size: a removed response field, a new required input or a change outside the plan is high; tests and renames are low.

- `structure.mjs` writes `structure.json`, a review page and `structure.md` for a pull request. It says which files no extractor covers and which links are inferred.
- The reviewer agent reads the units, high risk first.
- The decision page and the new page share one page shell, `page.mjs`.
… before anyone calls it done

After the build, the plan's approved decisions and the pinned patterns become checkable requirements.
The repository's own rules settle what they can; a fresh reviewer judges the rest by reading the code,
never the implementer's notes. Safe fixes go to the checked quality batches. Every other deviation,
anything it could not verify, and every consequential change no plan step names goes to a person.
Not enough evidence is reported as `insufficient`, never as conformance.

- `conformance.mjs` (`prepare`, `record`, `status`, `feedback`) and `references/conformance.md`, shared
  with Codex; `requirement/1` and `conformance/1` contracts
- Conform step in `feature-loop.js` after Polish, before Quality, behind `capabilities.conformance`
- Results keep their history, say which requirements a later change reopened, and render a review page
- 12 conformance scenarios, loop scenarios, 28 + loop mutations; docs and CI
…d change at a time, without flooding reviewers

A repository that turns on `maintenance` gets `/masterdevs:maintain` (`$masterdevs-maintain` on Codex).
Scans keep an inventory of debt with evidence, one item per cause. Each round fixes the most valuable
low-risk item with the existing quality pass, on its own branch, and checks it against the latest target
before a person reviews it. High-risk debt becomes a proposal for a person, never an unattended edit.
A round pauses while reviewers are busy, during a freeze, or past its budget. It also skips files that
active feature branches change, and stops for a person on reworked or repeatedly rejected changes.

- `maintenance.mjs` (`scope`, `ingest`, `next`, `settle`, `ready`, `record`, `describe`, `health`), shared
  with Codex; `debt/1` contract; limits in the target repository's `.masterdevs/maintenance.json`
- The quality-only loop call takes `files` (code as it stands) and `focus` (one deficiency); findings may
  carry `effort`
- 12 maintenance scenarios, a loop scenario, 48 + 3 mutations; docs and CI
… question with its recommended answer and Approve or Change

The old page opened every field, hid the answers in a nine-item dropdown, and had three ways to navigate and three send buttons. Now a box at the top says whether anything blocks the build and what to press. Each question shows its recommended answer in plain words, with Approve and Change; reasons, options and diagrams fold under it. Settled decisions and the plan summary sit in closed sections, the summary rendered as formatted text. One button sends; "Approve all remaining" never approves a question a person must decide. The answers format (`answers/1`) is unchanged.

- `page.mjs`: a small escaped Markdown renderer (`inline`, `markdown`); a failed send copies the answers.
- `decisions-page.mjs`: `openOf`, `approveRest` and `payloadOf` run in the page and in the tests.
- The Codex parity check skips the `.DS_Store` files macOS Finder writes.
…tions say their effect before their code names

Only one decision in eight on a real plan had a diagram, and it was folded away. The architect is now told to draw every decision that changes how data or calls move, or how the code is laid out: always the recommended option, and today or another option when the difference is easier to see beside it. Each option's summary starts with what it does in plain words and puts code names after, with no sentence limit.

- The page draws the recommended option's diagram under its answer, before Approve and Change; today's and other options' diagrams fold into the details.
- `shows` must be "current" or an option id. A diagram that names neither still shows, untagged, when the recommendation has none.
- Same rules in the Codex instructions. Loop and page scenarios and 5 mutations.
…n in the diagram title

The architect now titles its diagrams "Recommended: …", and the page added its own "Recommended:" in front, so the diagram under each answer read "Recommended: Recommended: …". The label above the answer already says it, so the diagram title drops any leading "Recommended:". The grey "Approved" beside the "Approved ✓" button is gone too.

- One new scenario check and one mutation.
…ed off

Before, a repository got the decision review at the plan stop only when its
`.masterdevs/harness.json` turned it on. Now it is on by default, and
`"decisions": false` in that file turns it off. Every other capability stays
off until a repository turns it on.

The review adds no new stop and only a short list of choices to the plan, so
it does not need a repository to opt in. `ON_BY_DEFAULT` in `harness.mjs`
holds the flags with this default, and an explicit `false` still wins.
… symlink

The installed plugin runs from a symlinked folder. Four commands (`harness`,
`decisions`, `fitness`, `patterns`) compared their real path with the
symlinked path, saw a mismatch, and printed nothing with exit 0. The feature
loop then ran with no capabilities, so the decision review never appeared.

All eight shared commands now use one check, `startedDirectly` in
`harness.mjs`, which compares real paths on both sides. Both feature skills
now stop when the config prints nothing, instead of going on with an empty
`capabilities` object. A scenario runs every command through a symlink.
… mode

Each review page (decisions, structure, conformance) opens in the viewer's
own theme and now has a "Dark mode" / "Light mode" button at the top. The
choice is kept in that browser, and the label follows a theme the host sets.

A standalone page also draws its diagrams again in the new colors. Each
diagram is drawn off-page under its own name and kept per theme
(`DRAW_CLIENT` in `page.mjs`), because redrawing in place mixed diagrams.
…nger trip the plan size warning

The review page used to appear only when a decision blocked the build, so a
plan with only recommended choices listed them in chat, without diagrams or
options. Now the page shows whenever a decision is required or recommended,
or two answers conflict; it is skipped only when every decision is settled
by a pattern or is for information.

The plan size warning counted the decisions' review detail (options,
diagrams, evidence), so most plans with decisions passed the 48,000
character limit and the planner suggested cutting them. Build agents get each
decision as one line (`decisionLines`), so `decisions` is no longer counted,
and the planner is told not to cut it to fit.
@brewdente
brewdente marked this pull request as ready for review December 2, 2026 22:54
@brewdente
brewdente requested a review from a team December 2, 2026 22:54
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