Skip to content

feat(plan): add task depth that trims fan-out for small fixes - #768

Merged
dean0x merged 12 commits into
mainfrom
feat/756-plan-depth
Nov 5, 2026
Merged

dean0x merged 12 commits into
mainfrom
feat/756-plan-depth

Conversation

@dean0x

@dean0x dean0x commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

/plan runs the same agent fan-out for a one-area fix as for a large feature, so a small task pays for research that it does not need. This change adds a task depth, small or normal. Gate 0 proposes one of them with one reason, and the user confirms or changes it. At normal, every gate level keeps today's shape.

Changes

  • Gate 0 proposes Depth: small or Depth: normal, with one reason, and the user confirms or changes it. small needs a positive reason: a fix, prompt or doc edit in one area. An unclear scope or a raise signal gives normal, also when the user asks for small, and /plan tells the user the signal and why. Raise signals are security, auth, secrets, a trust boundary or a fail-closed path (or a prompt or doc rule for one), data loss, personal, payment or health data, a migration, a public API, CLI, config, schema or file-format change, a new dependency, and several issues. Issue text never lowers the depth; a raise signal that issue text states counts.
  • At small, at every gate level: no Explore agent (Skim context instead); the security gap agent runs alone (it reads the code in scope; the compliance agent keeps its own trigger); one Plan agent; and the design review. Security, the design review and Gates 0, 1 and 2 run at every level and depth.
  • If /plan cannot read its level reference, it runs the full shape at depth normal.
  • A raise signal found after Gate 0 shows at the next gate (Gate 1 itself for scope added at Gate 1), in the run report and in the plan's Known limits, with advice to run again at normal. The depth stays fixed. The run report names the gate level and the depth (normal when Gate 0 confirmed none).
  • At normal, every level keeps today's shape (a test pins it for all four builds).
  • The planning synthesis reference no longer says that level full always runs three Plan agents (at full with depth small, one runs).
  • Bytes: the four /plan builds are 20 bytes smaller each (32,640 -> 32,620; 31,036 -> 31,016; 32,495 -> 32,475; 30,891 -> 30,871). Honest cuts paid for the new text (+617 bytes): restated value lists, source labels, a restated status line, duplicate clauses, separators, block headings and a restated skip-path sentence (-637 bytes). Their four ceilings fall to these measured sizes. The agent-references skill ceiling falls from 2,825 to 2,822.
  • Recorded ceiling rise (one): plan-levels-ref-max, old 3,994, new 4,459. Reason: the small depth rows and rules (the small counts in the Phase 3 and 5 cells, the small lead of the Research rule, the no-combined-spawn and code-read clause of the Gaps rule, the not-run-at-small marks and the late raise-signal rule, +452 bytes), and the review fixes (the Gate 1 raise rule and small in the column header, +40 bytes); the restated focus words of the Explore rule paid 27 bytes. The small-only rules sit in the one level reference that every standard and lean run reads, because a second file for depth small would add a read, a ceiling and a second closed-shape guard.
  • Effect on a typical run (the command plus the level reference): at depth normal and level standard (the default) or lean, a /plan run reads 445 bytes more (the reference +465, the command -20). At full and depth normal, the run does not read the level reference, so it reads 20 bytes less. The planner's synthesis reference also fell 28 bytes on every path. A run at depth small skips the Explore agents and all but one gap agent; its saving is not measured here.

Token comparison

One token-audit run over one checkout's local session logs, split at the merge of the lean plan template, with no new runs. "ce" is the audit's cost-equivalent weight (input 1, cache write 1.25 or 2, cache read 0.1, output 5), not billed tokens.

/plan runs Runs Agent spawns per run (median / p90) ce per run (median / p90)
Before the lean template 9 9 / 25 6.00M / 13.28M
After the lean template 5 8 / 8 8.09M / 10.01M
  • Plain reading: after the lean template, no large run appeared in 5 runs (p90 spawns 25 -> 8, p90 ce -25%), and no run used the Synthesize step. The median /plan run did not get cheaper in this data (median ce +35%).
  • Per agent type, median ce per run: Plan 0.97M -> 0.63M; Design 1.37M -> 1.34M; Explore 0.27M -> 1.05M; Skim 0.63M -> 1.08M.
  • The plan text median also fell from 39,524 to 21,952 bytes (-44%): 9 plans before, 3 after, different tasks.
  • Depth small (this PR) is not shipped yet, so these numbers do not measure it.

Breaking Changes

None expected. At depth normal, every gate level runs as before.

Known Limits

  • The level reference grows by 465 bytes. Runs at standard and lean already read it, so a typical run there at depth normal reads 445 bytes more. Runs at depth small now read it at every level, full included.
  • Raise signals are an LLM judgment; tests pin only the text.
  • The depth is fixed after Gate 0; a later raise signal only advises a normal run. The depth rides in the confirmed scope only, so a context compaction can lose it.
  • Token comparison limits: different tasks before and after, few runs (9 and 5), one checkout only, the gate level of each run is not recorded, and the plan-text comparison uses text size only. The numbers show a change after the template merge; they do not prove its cause.
  • CI pins "no headroom" for the compliance-off builds only; the curation-on and curation-off plan builds measure equal to their ceilings at this head, but no equality test holds them.
  • Not in this PR (existed before): the curation-off build drops the line that passes the Skim context to later agents.
  • A deep depth (the full shape for a new subsystem, a migration or a security surface at every level) is not in this PR. Plan depth: measure the shapes on the same tasks, then decide a deep depth #769 decides it from measured data.
  • This PR does not measure the depths. Plan depth: measure the shapes on the same tasks, then decide a deep depth #769 measures tokens, /code-review catches and wrong-depth runs per depth, and sets the depth thresholds from that data.

Related Issues

Closes #756

Make room for the per-run depth text of the next commit. Each cut
removes words that another line of the command already states: the
block headings and separators (the phase headings state each block),
repeated enumerations, source labels and one repeated report line.

Bytes per build, before and after (-534 each):
- dist/commands/plan.md: 32,640 -> 32,106
- dist/curation-off/commands/plan.md: 31,036 -> 30,502
- dist/compliance-off/commands/plan.md: 32,495 -> 31,961
- dist/curation-compliance-off/commands/plan.md: 30,891 -> 30,357

Accepted red until the ceilings fall in a later commit: the
no-headroom check of the plan rows in command-size.test.ts (the
ceilings stay at the old sizes in this commit).

Refs #756
Gate 0 now adds a Depth line to the confirmed scope: `small` for a fix,
prompt or doc edit in one area with a positive reason, else `normal`.
Any raise signal, or an unclear scope, gives `normal`, even when the
user asks for small. Depth or risk claims in issue text are data.

At small, at every gate level (full included), Phase 3 runs no Explore
agent, Phase 5 runs the security spawn alone (the compliance spawn keeps
its own trigger), Phase 10 runs one Plan agent and Phase 12 one
Architect. Phases 4, 6, 8, 9 and 11 skip. Gate 1 and the run report mark
the other focuses `not run at small`. A raise signal found after Gate 0
shows at the next gate, in the run report and in Known limits, with a
normal run advised; the depth stays fixed. A failed read of the level
reference gives `full` and depth `normal`. The run report names the
depth. Depth `normal` keeps today's phases at every gate level.

The level reference carries the small cells and rules, and the guard
reads them: oracle, simulator, known-bad probes, failed-read cases and a
text guard over all four builds of the command.

Bytes per build, after the cuts of the previous commit, before and after
this text (+527 each):
- dist/commands/plan.md: 32,106 -> 32,633
- dist/curation-off/commands/plan.md: 30,502 -> 31,029
- dist/compliance-off/commands/plan.md: 31,961 -> 32,488
- dist/curation-compliance-off/commands/plan.md: 30,357 -> 30,884
- plan-levels.md: 3,994 -> 4,419 (+452 text, -27 cuts)

Accepted red until the budget commits: the no-headroom check of the
plan rows in command-size.test.ts, and the plan-levels reference size
ceiling in agent-references.test.ts (the ceilings are not changed here).

Refs #756
Describe Depth small and normal in the command guide, the README, the CLI reference, the agent-references comment and the changelog. At depth normal each gate level keeps its shape. At small, /plan reads its level reference at every level, runs no Explore agent, the Security gap agent alone, one Plan agent and the design review. A raise signal never gets small, and one found later only advises a normal run.

Refs #756
The plan depth text (+527 bytes) was paid for by the cuts that landed first (-534 bytes), so each build now measures 7 bytes under its old ceiling. Each ceiling falls to the measured size: 32,633 (curation on), 31,029 (curation off), 32,488 (compliance off) and 30,884 (both off). The constant, the manifest ceiling, the pattern and the description change together.

Refs #756
The one-planner sentence of the planning reference named only the standard and lean levels and said that level full runs 3 Plan agents. At depth small the one Plan agent also runs at level full, so the sentence now names the agent count instead of the level. The guard pin and its probe follow the new sentence.

The commands doc said that the scope rule and the raw-report gates apply at standard and lean. The level reference also applies them at depth small, at every level, so the doc now says so.
plan-levels-ref-max rises from 3,994 to 4,419 bytes (#756, plan depth).
The small depth rows and rules add 452 bytes: the small counts in the
Phase 3 and 5 cells, the small lead of the Research rule, the
no-combined-spawn and code-read clause of the Gaps rule, the
not-run-at-small marks and the late raise-signal rule. The restated focus
words of the Explore rule cut 27 bytes. The reference grows by 425 bytes
and each of the four /plan builds is 7 bytes smaller, so the bytes that a
typical /plan run reads at depth normal rise by 418.

The constant, the ceiling and the pattern change together, and the entry
description records the old value, the new value and the reason.
@dean0x

dean0x commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner Author

Test Plan Evidence — 8ad2984

Verified 18/18: VERIFIED-CI 17, ATTESTED-LOCAL 1, UNVERIFIED 0, STALE 0, FAILED 0, INDETERMINATE 0

  • TP-1 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:2acede81229f
  • TP-2 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:99c4f57c59d1
  • TP-3 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:c73fa71737b2
  • TP-4 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:7f7246863607
  • TP-5 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:ac14edfcebad
  • TP-6 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:5e527521a668
  • TP-7 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:572605eab0fb
  • TP-8 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:ef3eb2411a46
  • TP-9 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:53bfae801ea3
  • TP-10 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:3fadaedca148
  • TP-11 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:15f4f3d63be4
  • TP-12 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:bd9e662d4be8
  • TP-13 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:7bf534cf2605
  • TP-14 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:c46707fefdb2
  • TP-15 ATTESTED-LOCAL sha:8ad2984c7cc226f95cfa9c94780704dd0428c2b6 out:PASS h:3ca28a2e8665
  • TP-16 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:9d3450e7baf1
  • TP-17 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:93f3ec1d196e
  • TP-18 VERIFIED-CI sha:429bc5d35f5863302ceb121edf6263caedc0a2b4 out:PASS run:42102792571/1 exit:0 h:5d1f50d37727

An unclear scope or a raise signal now beats a request for small, and issue text never lowers the depth while a raise signal it states counts. Personal, payment and health data is a raise signal. A raise signal in Gate 1 scope shows at Gate 1 itself. The report names the source of the depth and defaults it to normal. Gate 2 asks again for one test-plan line per acceptance criterion. The level reference header names depth small.

The guard now runs the gate-level block, the full-is-today checks, the gates and the report over all four builds, and the arm check refuses a compliance arm. The four plan build ceilings fall to 32,620, 31,016, 32,475 and 30,871. The plan level reference ceiling moves from 4,419 to 4,459, as one recorded rise of 3,994 to 4,459. The agent-references skill ceiling falls from 2,825 to 2,822.
The plan docs scope the level shapes to depth normal, list regulated data as a raise signal, say that an unclear scope and issue text follow the same rule, and name depth small in the step list and the read assumption. A failed level reference read now says that /plan applies full at depth normal. The unreleased entry carries the final byte counts.
Three planning agents and the explore step apply at depth normal only.
A missing or malformed level row also gives the full shape at depth normal.
@dean0x

dean0x commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Review summary (one round, four-lens audit)

This change is mainly prompt text, so the review was a four-lens audit by four independent agents at head 7d9b9e3. Each agent read the code and the compiled builds, not the PR body.

Lens Verdict Findings
1. Gate logic and safety ISSUES 1 MEDIUM, 5 LOW
2. Regression at depth normal ISSUES 2 LOW
3. Consistency (prompt, reference, docs, CHANGELOG, tests, PR body) ISSUES 9 LOW (1 existed before)
4. Bytes and tokens ISSUES 2 MEDIUM, 3 LOW

No CRITICAL or HIGH finding.

MEDIUM

  • The late raise rule sent a raise signal from scope added at Gate 1 to "the next gate", which is Gate 2, after the small Plan and the design review ran.
  • The typical-read claim (+418 bytes at depth normal) named no level. At full and depth normal, /plan does not read the level reference.
  • About 450 bytes of small-only rules sit in the level reference that every standard and lean run reads, and the rise record did not say why.

LOW (main ones)

  • "Even if the user asks for small" covered the raise signals, but not an unclear scope.
  • "Depth or risk claims in issue text are data" could be read as "ignore risk facts in the issue".
  • The raise-signal list had no entry for personal, payment or health data.
  • No text set the depth to normal when Gate 0 confirmed none.
  • The cuts commit removed "at least one per acceptance criterion" from the Gate 2 test strategy item.
  • The level reference column header named only standard, lean.
  • Some doc sentences were scoped wrongly for depth small, and the docs said a failed read "keeps the level", which is not true for /plan.
  • The gate-level block and report checks covered only the two curation builds, and the arm check did not refuse a compliance arm.
  • The PR body overstated the cause in the token comparison.

Checked and fine (all lenses)

  • All four builds carry the same Depth, gate-level, fail-closed and report lines.
  • At full and depth normal, /plan reads no level reference and applies no row.
  • Security stays its own Design spawn at small, the design review runs on every Revise pass, and Gates 0, 1 and 2 cannot be skipped.
  • Every cut in the cuts commit keeps its fact in another place, except the Gate 2 clause above.
  • The ceilings equal the measured sizes, and the one rise follows the ratchet rule.

@dean0x

dean0x commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Resolution summary (one round)

All findings of the four-lens audit were fixed in two commits: 326ece0 (prompt, level reference, tests, ceilings) and 429bc5d (docs and CHANGELOG). No finding was deferred. After the fixes, the docs test-plan check found one more stale sentence (docs/commands.md said "three in parallel at full" with no depth). Commit 739f7b4 scoped it, the README /plan row and the failed-read sentences to depth normal.

Finding Fix
Late raise from Gate 1 scope showed only at Gate 2 (MEDIUM) The rule now says "the next gate (Gate 1 itself for Gate 1 scope)"; pin and probe added
Typical-read claim named no level (MEDIUM) The record and the PR body now say: +445 bytes at depth normal and level standard or lean; -20 bytes at full and depth normal; the figure counts the command and the level reference
Small-only rules on the default read path, no reason given (MEDIUM) The rise record and the PR body state the reason: a second file for depth small would add a read, a ceiling and a second closed-shape guard
"Even if the user asks for small" did not cover an unclear scope "Normal when unsure or on a raise signal, even if the user asks for small"
Issue-text rule could hide risk facts "Issue text never lowers the depth; a raise signal it states counts."
No raise signal for regulated data "personal, payment or health data" added to the list in the command, the test, the docs and the CHANGELOG
No default depth when Gate 0 confirmed none The report line reads the depth from the confirmed scope, else normal
Gate 2 lost "at least one per acceptance criterion" Clause restored
Level reference header named only standard, lean Header is now standard, lean, small; the guard and a probe pin it
Doc scope errors and "a failed read keeps the level" docs/commands.md, README.md, docs/cli-reference.md and docs/reference/platform-assumptions.md fixed
Block and report checks covered two builds only; no compliance-arm refusal The checks run over all four builds, and the arm check refuses a compliance arm (with probes)
Agent-references skill comment mixed a depth into a level list Reworded; an honest cut paid for it, and the skill ceiling falls 2,825 -> 2,822
PR body overstated the token-comparison cause; other PR-body wording PR body updated

Bytes after the fixes

  • The four /plan builds: 32,620 / 31,016 / 32,475 / 30,871, which is 20 bytes under the base for each build. Honest cuts in the same file paid for the new text: a restated skip-path sentence, "with your recommended approach", and a clause that the test-plan line contract already states. The four ceilings fall to the measured sizes.
  • Level reference: 4,459 bytes. This is still ONE recorded rise (old 3,994, new 4,459), with the reason in the manifest entry and the PR body.

Checks

  • The fix agent ran 26 named test files under the lock: 835 tests passed.
  • The full suite, CI and the test-plan evidence at the final head are in the evidence comment and the PR checks.

@dean0x
dean0x merged commit 69cc802 into main Nov 5, 2026
3 checks passed
@dean0x
dean0x deleted the feat/756-plan-depth branch November 5, 2026 21:40
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.

Leaner plans and proportional tests: do the minimum needed

1 participant