From 7f32c351b1ca499db9b79c8571c160119618a039 Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Tue, 10 Nov 2026 12:46:18 -0800 Subject: [PATCH] Offer a final review of the removals at the end of the Dead Code skill, run in the same session AI Assisted --- .agents-docs/AGENTS-architecture-console.md | 2 +- .agents-docs/AGENTS-architecture-install.md | 4 +-- .../AGENTS-architecture-skill-scripts.md | 6 ++--- install.js | 11 ++++++-- scripts/test-console-wire-budgets.mjs | 2 +- scripts/test-script-dead-code.mjs | 16 ++++++++++++ scripts/test-skill-test-runs.mjs | 3 ++- src/plan2code-dead-code.md | 25 ++++++++++++++++--- src/shared-references/review-in-build.md | 2 +- src/shared-references/test-runs.md | 2 +- src/web-console/building-review.md | 5 +++- src/web-console/notes/dead-code.md | 4 +++ 12 files changed, 65 insertions(+), 17 deletions(-) diff --git a/.agents-docs/AGENTS-architecture-console.md b/.agents-docs/AGENTS-architecture-console.md index e71c6fd..14682c8 100644 --- a/.agents-docs/AGENTS-architecture-console.md +++ b/.agents-docs/AGENTS-architecture-console.md @@ -5,7 +5,7 @@ The web console is split by area: this file (the server, the CLI and the agent c ## Web Console -Optional local browser UI shipped with **every** skill. Source lives in `src/web-console/` and is fanned into each skill by an `additionalReferences: [{ source: 'web-console', target: 'web-console' }]` entry in `SOURCE_PROMPTS`, landing at `skills//references/web-console/`. The bare `plan2code` skill is the hub: it opens the console as `--workflow dashboard`, the page draws the skill menu itself (from each `SKILLS` entry's `card` in `public/skills.js`, through `SKILL_CATALOG` in `public/answers.js`, kept in sync with the install set by a test), and a card click reaches the agent as a `{ "i": "__launch", "skill": ..., "workflow": ... }` send — the dashboard then **resumes its own session** under the launched skill's workflow (`open --resume --workflow ` restates `workflow`/`title`/`specDir` on the live server) and runs that skill's file. `plan2code-review` now has a console of its own AND still runs inside builds on the page (a `review` verdict on Implementation's sign-off card, the **Review it now** button on a finished quick task, or Finalize's Step 2.5 final review, offered on every run), so `plan2code-3-implement`, `plan2code-quick-task` and `plan2code-4-finalize` also carry `review.md`, the review references and `review-scope.mjs`, the same way `implement-review` does. `CONSOLE_WORKFLOWS` in `public/answers.js`, built from the same `SKILLS` list, decides whether a copied hand-off asks the next session for the console. +Optional local browser UI shipped with **every** skill. Source lives in `src/web-console/` and is fanned into each skill by an `additionalReferences: [{ source: 'web-console', target: 'web-console' }]` entry in `SOURCE_PROMPTS`, landing at `skills//references/web-console/`. The bare `plan2code` skill is the hub: it opens the console as `--workflow dashboard`, the page draws the skill menu itself (from each `SKILLS` entry's `card` in `public/skills.js`, through `SKILL_CATALOG` in `public/answers.js`, kept in sync with the install set by a test), and a card click reaches the agent as a `{ "i": "__launch", "skill": ..., "workflow": ... }` send — the dashboard then **resumes its own session** under the launched skill's workflow (`open --resume --workflow ` restates `workflow`/`title`/`specDir` on the live server) and runs that skill's file. `plan2code-review` now has a console of its own AND still runs inside builds on the page (a `review` verdict on Implementation's sign-off card, the **Review it now** button on a finished quick task, Finalize's Step 2.5 final review, offered on every run, or Dead Code's Step 7.5 final review of its removals), so `plan2code-3-implement`, `plan2code-quick-task`, `plan2code-4-finalize` and `plan2code-dead-code` also carry `review.md`, the review references and `review-scope.mjs`, the same way `implement-review` does. `CONSOLE_WORKFLOWS` in `public/answers.js`, built from the same `SKILLS` list, decides whether a copied hand-off asks the next session for the console. | File | Role | |---|---| diff --git a/.agents-docs/AGENTS-architecture-install.md b/.agents-docs/AGENTS-architecture-install.md index 94b6bf3..9f35537 100644 --- a/.agents-docs/AGENTS-architecture-install.md +++ b/.agents-docs/AGENTS-architecture-install.md @@ -18,7 +18,7 @@ plan2code/ │ ├── shared-references/ # Reference files shared across skills │ │ ├── building-habits.md # Find the cause, test first, pin behavior (quick-task, implement, implement-review, test) │ │ ├── helper-strength.md # How strong a model and how much effort each helper gets (init, init-update, pathfinder, plan, revise-plan, document, quick-task, implement, implement-review, review, finalize, xray, diagnose, pr-prep, test) -│ │ └── test-runs.md # Choosing what tests to run: targeted per task and phase, full suite only where the plan puts it (document, implement, implement-review, quick-task, review, finalize, pr-prep, test) +│ │ └── test-runs.md # Choosing what tests to run: targeted per task and phase, full suite only where the plan puts it (document, implement, implement-review, quick-task, review, finalize, pr-prep, test, dead-code) │ ├── plan2code-review-references/ # Reference files for review skill │ │ ├── verification-protocol.md # Deep verification + confidence calibration │ │ ├── dimensions.md # 11 dimensions with detailed checklists @@ -145,7 +145,7 @@ plan2code/ | `plan2code-diagnose.md` | diagnose | Find a bug's cause under the find-the-cause-first habit (`references/building-habits.md`) and write it up as `specs//DIAGNOSIS-.md` without fixing it, then offer Quick Task to fix it, or Plan when the fix is big. The dashboard scan reports such a folder as spec state `diagnosed` ("Bug diagnosed"), which lights Quick Task (suggested) and Plan. Once Quick Task marks the diagnosis `Fixed` (nothing past it in the folder) the state is `fixed` ("Bug fixed"): no pipeline card lights, the picker never pre-selects it, and Quick Task offers to archive it with `specs.mjs archive` | | `plan2code-pr-prep.md` | pr-prep | Get a branch ready for review: pick the checks its changes need from the project's `## Test map` (or its config files), let the person trim the plan, run it, give Ready, Ready with notes or Not ready, and write a PR description to copy (following the repo's template) with the create-a-PR link; offers to save `PR-READINESS-.md` into the branch's spec folder; never commits, pushes or opens the PR | | `plan2code-test.md` | test | Write missing tests: ask where to look, find source files no test covers (matching, plus real coverage when the project already has a coverage tool, offered first), show a plan opening with how this project writes tests, then write and run unit and integration tests; escalates past 8 source files, 8 new test files or 2 runners to a PLAN-DRAFT for Plan, hands a real bug to Diagnose, never changes source code | -| `plan2code-dead-code.md` | dead-code | Find unused code and dead code: use the project's own dead-code tools, one per language that has files (Knip, vulture, cargo check and others), or search by itself, check every item for callers across the project (`references/caller-search.md`), label each Safe to remove, Check first or Warning, remove only what the person picks, then run the tests and build and put back anything that breaks them; never commits, never installs a tool. Scripts: `dead-code.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs` | +| `plan2code-dead-code.md` | dead-code | Find unused code and dead code: use the project's own dead-code tools, one per language that has files (Knip, vulture, cargo check and others), or search by itself, check every item for callers across the project (`references/caller-search.md`), label each Safe to remove, Check first or Warning, remove only what the person picks, then run the tests and build and put back anything that breaks them, then offer a final review of the removals in the same session (Step 7.5, recommended yes; ships `review.md`, `review-in-build.md`, `test-runs.md` and the review references, as Finalize does); never commits, never installs a tool. Scripts: `dead-code.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs`, `specs.mjs`, `commit-msg.mjs`, `review-scope.mjs` | | `plan2code-changelog.md` | changelog | Check the CHANGELOG version against the default branch, suggest editable entries for new work, keep `package.json` aligned, offer to commit the result through Git | | `plan2code-git.md` | git | Branches, pull (with conflict help), push, publish and commits (clear message, suggested splits) on the web console's git board, or plain instructions in the terminal (`switch to main`, `commit and push`); asks before every push, publish and delete | diff --git a/.agents-docs/AGENTS-architecture-skill-scripts.md b/.agents-docs/AGENTS-architecture-skill-scripts.md index f206f35..b77672c 100644 --- a/.agents-docs/AGENTS-architecture-skill-scripts.md +++ b/.agents-docs/AGENTS-architecture-skill-scripts.md @@ -14,9 +14,9 @@ Anything a workflow step decides with one correct answer (parsing a spec's check | Script | Skills | Does | |---|---|---| -| `specs.mjs` | plan, revise-plan, document, implement, implement-review, review, quick-task, finalize, handoff, diagnose | `list` / `status` (the dashboard state, Phase Checklist, groups, task markers, numbering, the implement selection verdict, consistency checks) / `check` / `check-draft` / `metrics` / `mark` / `tick` / `archive`. `list` imports `scanProject()` from the bundled `web-console/scan.mjs`, and `status` calls `deriveSpecState()` and `pickPhaseFiles()` from `web-console/spec-files.mjs`, the one rule the scan also uses, so the dashboard and the skills never disagree on a spec's state (a phase with only blocked tasks left stays `building`, and `finalizeReady` lights Finalize once each has a written reason). `mark` writes the phase file's Status line on every move (`--to in-progress` too). `check`'s format rules (no Status line, a checkbox under Notes, a task pointing at a line number, a bare `[!]`) warn, and fail only a spec whose overview.md carries ``. `archive` that has to copy removes the source only once every file name and size at the target matches (`PLAN2CODE_ARCHIVE_FAULT` is its test seam) | -| `commit-msg.mjs` | implement(-review), review, quick-task, finalize, init-update, git | The `` / `AI Assisted` commit command (two `-m` flags), with an optional `git add -- ` from `--files`. There is no add-everything option: `--add-all` was retired, and `scripts/test-script-git.mjs` fails if it returns anywhere in `src/` | -| `review-scope.mjs` | review, implement(-review), quick-task, finalize, pr-prep, test | Review Mode's git fallback: files, lines, doc share, base branch | +| `specs.mjs` | plan, revise-plan, document, implement, implement-review, review, quick-task, finalize, handoff, diagnose, dead-code | `list` / `status` (the dashboard state, Phase Checklist, groups, task markers, numbering, the implement selection verdict, consistency checks) / `check` / `check-draft` / `metrics` / `mark` / `tick` / `archive`. `list` imports `scanProject()` from the bundled `web-console/scan.mjs`, and `status` calls `deriveSpecState()` and `pickPhaseFiles()` from `web-console/spec-files.mjs`, the one rule the scan also uses, so the dashboard and the skills never disagree on a spec's state (a phase with only blocked tasks left stays `building`, and `finalizeReady` lights Finalize once each has a written reason). `mark` writes the phase file's Status line on every move (`--to in-progress` too). `check`'s format rules (no Status line, a checkbox under Notes, a task pointing at a line number, a bare `[!]`) warn, and fail only a spec whose overview.md carries ``. `archive` that has to copy removes the source only once every file name and size at the target matches (`PLAN2CODE_ARCHIVE_FAULT` is its test seam) | +| `commit-msg.mjs` | implement(-review), review, quick-task, finalize, init-update, git, dead-code | The `` / `AI Assisted` commit command (two `-m` flags), with an optional `git add -- ` from `--files`. There is no add-everything option: `--add-all` was retired, and `scripts/test-script-git.mjs` fails if it returns anywhere in `src/` | +| `review-scope.mjs` | review, implement(-review), quick-task, finalize, pr-prep, test, dead-code | Review Mode's git fallback: files, lines, doc share, base branch | | `glob.mjs` | init, init-update, implement(-review), quick-task, finalize, pr-prep, test, dead-code | The glob subset (`**`, `*`, `?`, `{a,b}`) as a RegExp, and forward-slash path normalizing; imported by `test-map.mjs` and `test-match.mjs` | | `test-map.mjs` | init, init-update, implement(-review), quick-task, finalize, pr-prep, test, dead-code | `read` / `write` the project test map (one `\| Area \| Paths \| Run \| Shared \|` table under `## Test map` in `AGENTS.md`, or behind one link to `.agents-docs/`); every line outside the table stays byte-identical | | `test-match.mjs` | implement(-review), quick-task, finalize, pr-prep, test | `covers` (changed files to the map rows and tests that cover them, plus shared-ground hints), `gaps` (source files no test covers, ranked by recent change) and `nearest` (existing tests to read for style) | diff --git a/install.js b/install.js index ed42a6d..e2d2f06 100644 --- a/install.js +++ b/install.js @@ -397,11 +397,18 @@ const SOURCE_PROMPTS = [ // Shown to the agent in place of the generic header text: when the skill fits and its command. skillDescription: "Use when you want unused code paths and dead code in your project found, labeled by how safe each is to remove, and removed only where you pick. Run it as /plan2code-dead-code.", isUtility: true, - scripts: ['test-map.mjs', 'glob.mjs', 'test-commands.mjs', 'run-check.mjs'], + // review.md rides along for Step 7.5's final review of the removals, which + // runs in the same session, as Finalize's Step 2.5 does, with the scripts + // review.md names. + scripts: ['test-map.mjs', 'glob.mjs', 'test-commands.mjs', 'run-check.mjs', 'specs.mjs', 'commit-msg.mjs', 'review-scope.mjs'], additionalReferences: [ { source: 'web-console', target: 'web-console' }, { source: 'plan2code-dead-code-references/caller-search.md', target: 'caller-search.md' }, - { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' } + { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }, + { source: 'shared-references/test-runs.md', target: 'test-runs.md' }, + { source: 'shared-references/review-in-build.md', target: 'review-in-build.md' }, + { source: 'plan2code-review.md', target: 'review.md' }, + { source: 'plan2code-review-references' } ] }, { diff --git a/scripts/test-console-wire-budgets.mjs b/scripts/test-console-wire-budgets.mjs index cf7d004..a98752c 100644 --- a/scripts/test-console-wire-budgets.mjs +++ b/scripts/test-console-wire-budgets.mjs @@ -29,7 +29,7 @@ export const BUDGETS = { // Each topic file under notes/, read when its workflow starts. notes: { "changelog.md": 1400, - "dead-code.md": 4250, + "dead-code.md": 4900, "diagnose.md": 2700, "document.md": 400, "finalize.md": 2000, diff --git a/scripts/test-script-dead-code.mjs b/scripts/test-script-dead-code.mjs index f13233c..bf351c0 100644 --- a/scripts/test-script-dead-code.mjs +++ b/scripts/test-script-dead-code.mjs @@ -1225,3 +1225,19 @@ test("run: each tail line is capped at 400 characters", () => { assert.equal(r.json.tail.length, 1); assert.equal(r.json.tail[0].length, 400); }); + +/* ---------------------------------------------------- the final review */ + +test("the built skill ships the Review files its Step 7.5 final review reads", () => { + const refs = path.join(SKILLS, "plan2code-dead-code", "references"); + for (const file of ["review.md", "review-in-build.md", "test-runs.md", "reviewer-brief.md", "verification-protocol.md", "dimensions.md", "false-positives.md", "session-end.md"]) { + assert.ok(fs.existsSync(path.join(refs, file)), `references/${file} is missing from plan2code-dead-code`); + } + // review.md runs these from . + for (const script of ["specs.mjs", "commit-msg.mjs", "review-scope.mjs"]) { + assert.ok(fs.existsSync(path.join(SKILLS, "plan2code-dead-code", "scripts", script)), `scripts/${script} is missing from plan2code-dead-code`); + } + const skill = fs.readFileSync(path.join(SKILLS, "plan2code-dead-code", "SKILL.md"), "utf8"); + assert.match(skill, /### Step 7\.5: Final review/); + for (const ref of ["references/review.md", "references/review-in-build.md"]) assert.ok(skill.includes(ref), `SKILL.md names ${ref}`); +}); diff --git a/scripts/test-skill-test-runs.mjs b/scripts/test-skill-test-runs.mjs index a53207a..2756411 100644 --- a/scripts/test-skill-test-runs.mjs +++ b/scripts/test-skill-test-runs.mjs @@ -47,7 +47,7 @@ test("Document writes Targeted, Quick checks and Full suite lines and reads test assert.match(doc, /no Full Suite row: ask/); }); -test("test-runs.md ships in the eight skills that run, write or offer tests, and in no other", () => { +test("test-runs.md ships in the nine skills that run, write or offer tests, and in no other", () => { // npm test has just built skills/; a direct run builds it so the check never reads a stale tree. if (process.env.npm_lifecycle_event !== "test") { execFileSync(process.execPath, [path.join(ROOT, "install.js"), "--build-skills"], { stdio: "ignore" }); @@ -59,6 +59,7 @@ test("test-runs.md ships in the eight skills that run, write or offer tests, and "plan2code-3-implement", "plan2code-3-implement-review", "plan2code-4-finalize", + "plan2code-dead-code", "plan2code-pr-prep", "plan2code-quick-task", "plan2code-review", diff --git a/src/plan2code-dead-code.md b/src/plan2code-dead-code.md index a7e751b..0532120 100644 --- a/src/plan2code-dead-code.md +++ b/src/plan2code-dead-code.md @@ -4,7 +4,7 @@ Start all DEAD CODE MODE responses with '💀 [DEAD CODE]' ## Role -Finds unused code paths and dead code in the person's own project. Shows each finding with its evidence and a label that says how safe it is to remove, removes only the findings the person picks, then runs the project's tests and build. **Never commits, pushes or stages**, never installs an outside tool, and does no code review of its own (that is the Review skill's job). +Finds unused code paths and dead code in the person's own project. Shows each finding with its evidence and a label that says how safe it is to remove, removes only the findings the person picks, then runs the project's tests and build and offers a final review of the removals (Step 7.5, the Review skill's own prompt, run in this session). **Never commits, pushes or stages**, and never installs an outside tool. ## Interface @@ -33,13 +33,14 @@ Read `./AGENTS.md` when it exists: its commands, its `## Test map` and anything - `references/caller-search.md`: what to search besides the plain name, per language group. Read it before Step 4. - `references/helper-strength.md`: helper strength and effort. +- `references/review.md` and `references/review-in-build.md`: the Review skill and how it runs inside this session. Read them only on a yes to Step 7.5. ## Rules - Follow `./AGENTS.md` when it exists. - **Never** run `git commit`, `git push`, `git add` or `git stash`. Read-only git is fine. The changes stay unstaged for the person to look at. - **Never install anything**: no `npm install`, `pip install`, `cargo install`, `go install` or download of a tool. A tool the project already has may be run. -- **Write only** code removals, `.plan2code-dead-code/keep.md`, and, on a yes, the saved report and the `.gitignore` line. +- **Write only** code removals, the Step 7.5 review fixes the person picks, `.plan2code-dead-code/keep.md`, and, on a yes, the saved report and the `.gitignore` line. - **Nothing is removed before the person picks it.** Nothing is pre-ticked. - **Silence is not proof.** A finding reaches Safe only when a tool listed it and the caller search agrees. - **Never partial without saying so.** A narrowed or stopped run says what was and was not checked, and is never called complete. @@ -126,9 +127,25 @@ Nothing picked → skip to Step 8. Nothing is staged or committed at any point. +### Step 7.5: Final review (offered) + +**Objective:** an independent safety pass over what was just removed, before the report. A caller search can miss a use, and a removal can leave a dangling import, a stale comment or docs that still name the item. + +When at least one pick ended `removed`, always offer it: "Run a final review of the removals before the report? (yes / no)", with its size (files, ~lines removed). **Recommend yes**, and say why in one line: the removals have passed the checks, and this is the last look before you commit. The person may skip. Nothing removed: no offer. Skipped: record `skipped (your choice)` and go to Step 8. + +On yes, read `references/review.md` and run it as `references/review-in-build.md` says, with these overrides: + +- Skip Review Mode's Interface section: this session's console or terminal choice stands. +- **Scope (decided, never asked):** the files this run changed or deleted (every `backup` run's files whose pick ended `removed`), plus the files that imported or named a removed item. Other working-tree changes stay out. +- **Focus:** what removal breaks: a remaining caller (by name, in a string, config, test or doc), a dangling import or export, a now-unused helper the removal exposed, and comments or docs that still name the item. Never re-litigate a pick: a finding that the code was live is a fix (put it back), not a debate. +- **Putting back:** `restore --run --files `, then `--verify`, puts back the whole file as it was before the run, so every other removal and fix in that file goes too: name them to the person first, and mark each such pick `kept` (put back by the review). +- The helper rule, the fix choice (`H` / `A` / `S 1,3`, or none) and the Post-Fix Flow are Review Mode's. Before applying fixes, `backup` the files they touch as a new run. After fixes, rerun Step 7's checks once through `run-check.mjs`; on a fail, `restore` that run (`--verify`), rerun the checks, and record the fixes as open. + +Record one outcome for Step 8: `N found, M fixed, K open`, `skipped (your choice)` or `not offered (nothing removed)`. Zero findings: say so with the dimension coverage. An open Critical: say so plainly and offer the put-back above. + ### Step 8: Report, keep list and finish -**Report.** Always show it on the page (in the terminal, as a table): the headline says complete or narrowed (or stopped), the scope, the method and tool or tools, how many the keep list hid, how many were dropped, then each finding with its label, source, rule id, the reason for any Warning and its outcome (`removed`, `kept`, `skipped`, `failed: ...`), and whether removal was unchecked. +**Report.** Always show it on the page (in the terminal, as a table): the headline says complete or narrowed (or stopped), the scope, the method and tool or tools, how many the keep list hid, how many were dropped, then each finding with its label, source, rule id, the reason for any Warning and its outcome (`removed`, `kept`, `skipped`, `failed: ...`), whether removal was unchecked, and the final review's outcome (Step 7.5) with any open finding and its file. Offer three things, each acted on only on a yes: @@ -142,7 +159,7 @@ On "stop", "cancel" or similar during a run: confirm. With removals on disk and ## Session End -Work summary: the scope and whether it was narrowed, the method and tool or tools, how many findings by label, how many were hidden by the keep list or dropped for a caller, what was removed, put back (with why) or left, whether removal was checked, and any file written (the report, `keep.md`, `.gitignore`). +Work summary: the scope and whether it was narrowed, the method and tool or tools, how many findings by label, how many were hidden by the keep list or dropped for a caller, what was removed, put back (with why) or left, whether removal was checked, the final review's outcome (or that it was skipped), and any file written (the report, `keep.md`, `.gitignore`). **Next step**, as the closing line: "Review the unstaged changes and commit them, with `keep.md`, using `/plan2code-git`." Nothing removed and no keep-list change: "Nothing to commit." diff --git a/src/shared-references/review-in-build.md b/src/shared-references/review-in-build.md index 497d52c..ea956fe 100644 --- a/src/shared-references/review-in-build.md +++ b/src/shared-references/review-in-build.md @@ -1,5 +1,5 @@ # Review Inside a Build -> Read by Review, Implement, Implement + Review and Quick Task when a review runs inside a build: before a phase is signed off, or after a quick task is built. Never invoked as a skill. The web console's `building-review.md` adds only what the page does differently. +> Read by Review, Implement, Implement + Review, Quick Task, Finalize and Dead Code when a review runs inside a session: before a phase is signed off, after a quick task is built, or as a final review (Finalize's Step 2.5, Dead Code's Step 7.5, whose own steps replace "Back to the build"). Never invoked as a skill. The web console's `building-review.md` adds only what the page does differently. Run Review Mode (`references/review.md`, or this skill's own SKILL.md in Review) with these rules. They win over Review Mode's own scope questions, completion and session-end steps. diff --git a/src/shared-references/test-runs.md b/src/shared-references/test-runs.md index 97daba6..cac70d6 100644 --- a/src/shared-references/test-runs.md +++ b/src/shared-references/test-runs.md @@ -1,5 +1,5 @@ # Choosing what to run -> Read by Document, Implement, Implement + Review, Quick Task, Review, Finalize, PR Prep and Test before they write, run or offer tests. Never invoked as a skill. +> Read by Document, Implement, Implement + Review, Quick Task, Review, Finalize, PR Prep, Test and Dead Code (its final review's fixes) before they write, run or offer tests. Never invoked as a skill. ## Three tiers diff --git a/src/web-console/building-review.md b/src/web-console/building-review.md index 85b4e88..40f387b 100644 --- a/src/web-console/building-review.md +++ b/src/web-console/building-review.md @@ -1,11 +1,12 @@ # The Review, Mid-Session -The console points here on `__review`, or on a `review` card answered with a verdict. Part of the build contract (`building.md`). The same focused review runs from four doors: +The console points here on `__review`, or on a `review` card answered with a verdict. Part of the build contract (`building.md`). The same focused review runs from five doors: - **`implement`:** the `review` verdict on the sign-off card, before anything is approved. A note sent with it is focus for the review. Settle the card in the post that goes back to work: `{"settle":true,"headline":{"stage":"Reviewing Phase 3","cleared":0,"total":0},"run":{"event":"review","id":"review"},"agent":{"status":"working","activity":"Reviewing the 7 files this phase changed","quietMinutes":15}}` - **`quick-task`:** the **Review it now** button on the finished screen (`finish.review`), arriving as `__review`. Take it up with the same post minus `settle`, plus `"finish":null`. - **`implement-review`:** Stage 2 (`notes/implement.md`). - **`finalize`:** a yes on Step 2.5's "Run a final review" card (`notes/finalize.md`). Settle the card in the post that takes the review up, as for `implement`, with `"stage":"Final review"`. Scope is the whole feature's change set (Step 2.5), not one phase. +- **`dead-code`:** a yes on Step 7.5's "Run a final review" card (`notes/dead-code.md`). Settle it as for `finalize`, with `"stage":"Final review"`. Scope is the removals and the files that named a removed item (Step 7.5). Either way the post that takes the review up carries `"run":{"event":"review","id":"review"}`: the review runs inside this session, so no launch scores it. Never also resume under `--workflow review`, or it counts twice. @@ -50,6 +51,8 @@ In loop mode the way out is the `loopOutcome` post, not a sign-off. **`finalize`: the closing gate, then Step 3.** With fixes made, post the same "Check the fixes" `review` item as Quick Task (below). When it clears (or with nothing fixed), settle it in the post that starts Step 3, which carries the review outcome into the summary and every open finding into Known Limitations. No finish here; the `review` doc stays as a tab. +**`dead-code`: the same closing gate, then Step 8.** As `finalize`, but the post that settles it starts Step 8's report, which carries the review outcome and every open finding. + **`quick-task`: the closing gate, then the finish.** Post a `review` item "Check the fixes": `doc:"review"`, `"nothingYet":false`, verdicts `approve` ("The fixes look right") and `changes`, token `approved` / `needs changes`. When it clears, settle it in the same post as the new finish, posted without `review` and with `dashboard:true`; keep waiting for its buttons, `stop` only on `__done`. The finish: - `headline`: "The review is done" diff --git a/src/web-console/notes/dead-code.md b/src/web-console/notes/dead-code.md index 217b38b..cc276f7 100644 --- a/src/web-console/notes/dead-code.md +++ b/src/web-console/notes/dead-code.md @@ -26,6 +26,10 @@ With no test map: one `confirm` listing each command and the folder it runs in, One progress post per check, no `--wait`, its `activity` naming the check and `quietMinutes` sized to its timeout (600 s is 10 minutes, plus a margin). Run the `chat` check between checks, as a build does. +## Final review + +Once Step 7 ends with at least one pick `removed` (Step 7.5): `confirm` "Run a final review", `--wait`, `"yesLabel":"Review it","noLabel":"Skip it"`, files and ~lines removed in `body` with the one-line reason to say yes. Yes: read `/building-review.md`, the `dead-code` door. + ## The report and the offers Doc `report`: one `md` block, the headline first (Complete, Narrowed or Stopped), then scope, method and tools, the hidden and dropped counts, and the findings table with each outcome. Then each offer as a `confirm`, `--wait`, `"doc":"report"`: "Save the report" (naming `.plan2code-dead-code/reports/DEAD-CODE-.md`), "Keep these findings" (the reasons asked as a `text` card after a yes), and on first save ".gitignore line".