summaryrefslogtreecommitdiff
path: root/plugins/code-modernization
diff options
context:
space:
mode:
authorMorgan Lunt <morganl@anthropic.com>2026-09-24 21:01:36 -0700
committerMorgan Lunt <morganl@anthropic.com>2026-09-24 21:01:36 -0700
commit0c186cf8c54bdf925cb2572e871ec16d04aa8425 (patch)
treeb0e6fc47714312dd21a2d1b977c5dde1c6a8011a /plugins/code-modernization
parent2efd715aeb081a965df3b2c871706c3577210e98 (diff)
code-modernization: people's verdicts on rules reach the build, and safer baselines
A reviewer's "this rule is wrong" never reached the plan or the rewrite: the pane wrote a review ledger that no command read, and without the pane there was no way to write one. /code-modernization:modernize-review asks about the rules that need judgement (P0 rules with a defect, an SME question or less than High confidence) in a pop-up, or takes verdicts typed in the request, and writes the same RULE_REVIEWS.json/.md with an optional note. brief, transform, reimagine and the test engineer read it: a rule marked wrong is not an oracle and a P0 rule under discussion blocks. Running the old system to record a baseline is now limited to the local machine or a test environment the person named; production or third-party services, new accounts and real data are off limits unless the approved plan names them, a token in a recorded response is replaced before anything is saved, and every command stops the servers it started. Also: the front door asks in two pop-ups within the four-option limit, every command points a missing-code user to /modernize <name> --source <path>, the status inventory and next-step order include review and verify, the assessment says what Rehost and Replace mean, preflight notes the Windows python name, and the plugin and marketplace descriptions match what it does.
Diffstat (limited to 'plugins/code-modernization')
-rw-r--r--plugins/code-modernization/.claude-plugin/plugin.json2
-rw-r--r--plugins/code-modernization/agents/test-engineer.md16
-rw-r--r--plugins/code-modernization/commands/modernize-assess.md2
-rw-r--r--plugins/code-modernization/commands/modernize-brief.md6
-rw-r--r--plugins/code-modernization/commands/modernize-extract-rules.md4
-rw-r--r--plugins/code-modernization/commands/modernize-harden.md2
-rw-r--r--plugins/code-modernization/commands/modernize-map.md2
-rw-r--r--plugins/code-modernization/commands/modernize-preflight.md2
-rw-r--r--plugins/code-modernization/commands/modernize-reimagine.md4
-rw-r--r--plugins/code-modernization/commands/modernize-review.md35
-rw-r--r--plugins/code-modernization/commands/modernize-status.md9
-rw-r--r--plugins/code-modernization/commands/modernize-transform.md11
-rw-r--r--plugins/code-modernization/commands/modernize-uplift.md4
-rw-r--r--plugins/code-modernization/commands/modernize.md29
14 files changed, 101 insertions, 27 deletions
diff --git a/plugins/code-modernization/.claude-plugin/plugin.json b/plugins/code-modernization/.claude-plugin/plugin.json
index 274d539d..8646aee2 100644
--- a/plugins/code-modernization/.claude-plugin/plugin.json
+++ b/plugins/code-modernization/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "code-modernization",
- "description": "Modernize legacy codebases (COBOL, legacy Java/C++/.NET, monolith web apps) with a structured preflight / assess / map / extract-rules / brief / (reimagine | transform | uplift) / harden / status workflow. Cross-stack rewrites, greenfield reimagining, and same-stack version uplifts (e.g. .NET Framework → .NET 8); an interactive topology viewer; an optional live progress pane (early access); specialist agents; and optional dynamic-workflow orchestration with adversarial verification.",
+ "description": "Guided modernization for any legacy codebase: start with /modernize, get an assessment, an interactive map, the business rules mined from the code, and a plan you approve, then an upgrade, a rewrite or a rebuild with independent proof that the new code behaves like the old. Includes security hardening, a one-page report, specialist agents, and an optional live progress pane (early access).",
"author": {
"name": "Anthropic",
"email": "support@anthropic.com"
diff --git a/plugins/code-modernization/agents/test-engineer.md b/plugins/code-modernization/agents/test-engineer.md
index 2583831f..247d2a55 100644
--- a/plugins/code-modernization/agents/test-engineer.md
+++ b/plugins/code-modernization/agents/test-engineer.md
@@ -17,6 +17,11 @@ someone thinks it should do) so that a rewrite can be proven equivalent.
- **Concrete over abstract.** Every test has literal input values and literal
expected outputs. No "should calculate correctly" — instead "given balance
1250.00 and APR 18.5%, returns 19.27".
+- **Name the rule each test pins.** When `analysis/<system>/BUSINESS_RULES.md`
+ exists, each test or golden case names the `RULE-NNN` id(s) it pins, in its
+ display name, in its method name where a hyphen is not allowed
+ (`rule017_emptyInput`), or in a one-line comment. `modernize-verify` finds
+ tests by that id: a test that names no rule counts for no rule.
- **Cover the edges the legacy covers.** Read the legacy code's branches.
Every IF/EVALUATE/switch arm gets at least one test case. Boundary values
(zero, negative, max, empty) get explicit cases.
@@ -37,6 +42,12 @@ someone thinks it should do) so that a rewrite can be proven equivalent.
comparison), confirm at least one test goes red, and restore it. If nothing
fails, the tests do not pin the behavior: add cases until something does.
+## Human verdicts on rules
+
+If `analysis/<system>/RULE_REVIEWS.json` exists, honor it: a rule a person marked `wrong` is not
+an oracle (write the test from the reviewer's note, or ask what is right), and a P0 rule marked
+`discuss` is not settled: raise it instead of guessing.
+
## Secret handling (mandatory)
Never copy credential-like literals — passwords, API keys, tokens,
@@ -45,6 +56,11 @@ the deliverable codebase and get committed. Substitute clearly-fake values
of the same shape and length and note the substitution in a comment.
Anything a test genuinely needs live (e.g. a real database connection for
a dual-run harness) is read from an environment variable, never inlined.
+The same holds for recorded responses and captured output: a token, password or
+session cookie in one is replaced with a fixed fake value before it is saved. Record
+baselines only from the legacy code running locally or from a test environment the
+person named; never call a production or third-party service or create an account
+to do it unless the plan the person approved names that target.
## Output
diff --git a/plugins/code-modernization/commands/modernize-assess.md b/plugins/code-modernization/commands/modernize-assess.md
index e02f5625..c787f3b3 100644
--- a/plugins/code-modernization/commands/modernize-assess.md
+++ b/plugins/code-modernization/commands/modernize-assess.md
@@ -9,7 +9,7 @@ directory that follows. Otherwise run **Single-system mode** on `$system`, the
first token. Flags go after it (`<system> --show-secrets`): a flag in first place
would be read as the system name.
-The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
+The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. If `legacy/$system` does not exist, stop and say so: nothing can run without the code, so the fix is `/code-modernization:modernize $system --source <path to the code>`. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
---
diff --git a/plugins/code-modernization/commands/modernize-brief.md b/plugins/code-modernization/commands/modernize-brief.md
index b9a9299e..86dff44a 100644
--- a/plugins/code-modernization/commands/modernize-brief.md
+++ b/plugins/code-modernization/commands/modernize-brief.md
@@ -11,8 +11,12 @@ document a steering committee approves and engineering executes. Target stack:
Read `ASSESSMENT.md`, `topology.json` (and the `.mmd` files beside it; never read
`TOPOLOGY.html`, it is a viewer with the data minified inside) and `BUSINESS_RULES.md`
in `analysis/$system/` first. If any is missing, say so and stop: they come from `assess`,
-`map` and `extract-rules`, which run first. Three more inputs are conditional:
+`map` and `extract-rules`, which run first. Four more inputs are conditional:
+- **`RULE_REVIEWS.json` / `RULE_REVIEWS.md`**, if they exist (written by `/code-modernization:modernize-review`):
+ a person's verdicts on individual rules. Never put a rule marked `wrong` or `discuss` in the Behavior
+ Contract as settled behavior: list each in section 7 as an open question with the reviewer's note, and
+ block the phase that covers its module on it. A `confirmed` rule counts as confirmed by a person.
- **`INTENT.md`**, if it exists (written by `/code-modernization:modernize`): what the person wants (goal, target,
what must stay true). It is the objective of this plan; never override it with a guess. Its goal decides each
phase's build command: a newer version of the same technology means `uplift`, a rewrite in another technology
diff --git a/plugins/code-modernization/commands/modernize-extract-rules.md b/plugins/code-modernization/commands/modernize-extract-rules.md
index e1a79740..271c6776 100644
--- a/plugins/code-modernization/commands/modernize-extract-rules.md
+++ b/plugins/code-modernization/commands/modernize-extract-rules.md
@@ -10,7 +10,7 @@ engineers about to retire. If a module pattern was given (`$module_pattern`), fo
there; otherwise cover the whole system. Prioritize calculation, validation, eligibility
and state-transition logic over plumbing.
-The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
+The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. If `legacy/$system` does not exist, stop and say so: nothing can run without the code, so the fix is `/code-modernization:modernize $system --source <path to the code>`. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
## Method A — Workflow (preferred when the Workflow tool is available)
@@ -147,4 +147,4 @@ confirmation** section listing each Medium and Low rule with its question.
Report: total rules, breakdown by category, how many need SME review, and (Method A) how many
candidates the referees rejected: that number is the quality the verification bought. Refresh the
-report: `python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_report.py" $system` (a convenience: if it fails or `python3` is missing, say so in one line and carry on). The next step is `/code-modernization:modernize-brief $system <target-stack>`.
+report: `python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_report.py" $system` (a convenience: if it fails or `python3` is missing, say so in one line and carry on). The next step is `/code-modernization:modernize-review $system` when rules are flagged for a person (P0 rules with a suspected defect, an SME question or less than High confidence: give the count), then `/code-modernization:modernize-brief $system <target-stack>`; with none flagged, go straight to the brief.
diff --git a/plugins/code-modernization/commands/modernize-harden.md b/plugins/code-modernization/commands/modernize-harden.md
index 6267391a..c2ea38e4 100644
--- a/plugins/code-modernization/commands/modernize-harden.md
+++ b/plugins/code-modernization/commands/modernize-harden.md
@@ -7,7 +7,7 @@ arguments: system
Run a **security hardening pass** on the legacy system: find vulnerabilities, rank them, and produce a
reviewable patch for the critical ones. `$system` is the first argument; flags go after it
(`<system> --show-secrets`), since a flag in first place would be read as the system name.
-The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
+The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. If `legacy/$system` does not exist, stop and say so: nothing can run without the code, so the fix is `/code-modernization:modernize $system --source <path to the code>`. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
This command never edits `legacy/$system`: it writes findings and a proposed patch to `analysis/$system/`, and the
user reviews and applies (or not).
diff --git a/plugins/code-modernization/commands/modernize-map.md b/plugins/code-modernization/commands/modernize-map.md
index 2ea7ec95..973b17c1 100644
--- a/plugins/code-modernization/commands/modernize-map.md
+++ b/plugins/code-modernization/commands/modernize-map.md
@@ -8,7 +8,7 @@ Build a **dependency and topology map** of the system and render it as an
interactive page. The assessment found the domains; this goes one level down:
how do the *pieces* connect? It is the map an engineer needs before touching anything.
-The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
+The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. If `legacy/$system` does not exist, stop and say so: nothing can run without the code, so the fix is `/code-modernization:modernize $system --source <path to the code>`. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
## Start from what already exists
diff --git a/plugins/code-modernization/commands/modernize-preflight.md b/plugins/code-modernization/commands/modernize-preflight.md
index c628059b..aba9d739 100644
--- a/plugins/code-modernization/commands/modernize-preflight.md
+++ b/plugins/code-modernization/commands/modernize-preflight.md
@@ -76,7 +76,7 @@ Check availability (`command -v`), version and what degrades without it:
| Tool | Used by | Without it |
|---|---|---|
| `scc` (or `cloc`) | assess | LOC and complexity fall back to `find` + `wc`; the COCOMO index gets coarser |
-| `python3` | map, report | dependency scripts and the HTML report can't run |
+| `python3` (3.8 or newer; on Windows it may be `python` or `py -3`: use whichever runs Python 3 wherever a command says `python3`) | map, extract-rules, verify, report | the dependency scripts, the shard builder, the proof scripts and the HTML report can't run |
| `lizard` | assess --portfolio | complexity is estimated from decision-keyword counts |
Give the platform's install one-liner for anything missing.
diff --git a/plugins/code-modernization/commands/modernize-reimagine.md b/plugins/code-modernization/commands/modernize-reimagine.md
index 7fa08883..a6b527db 100644
--- a/plugins/code-modernization/commands/modernize-reimagine.md
+++ b/plugins/code-modernization/commands/modernize-reimagine.md
@@ -6,7 +6,7 @@ arguments: system
The first token of `$ARGUMENTS` is the system name (`$system`); **everything after it is the target
vision**, usually several words, so do not truncate it (with none, use the one in `analysis/$system/INTENT.md`). Below, `<vision>` means that whole remainder.
-The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
+The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. If `legacy/$system` does not exist, stop and say so: nothing can run without the code, so the fix is `/code-modernization:modernize $system --source <path to the code>`. Run every subagent in the foreground and wait for its result: never end your turn while one is still running. Stop any server or other process you started (a legacy app on a local port, a watcher) before you finish, and say you did.
**Reimagine** the system as: <vision>. This is not a port but a rebuild from extracted intent: the legacy
system is the *specification source*, not the structural template. The command orchestrates a team of
@@ -20,7 +20,7 @@ around it. If no phase matches, stop and ask which phase this is.
## Phase A — Specification mining
-Reuse what discovery already produced: `BUSINESS_RULES.md`, `DATA_OBJECTS.md`, `topology.json` and
+Reuse what discovery already produced (honoring `RULE_REVIEWS.json`: a rule marked `wrong` is not part of the spec as written, and a P0 rule marked `discuss` is a question for the architecture checkpoint): `BUSINESS_RULES.md`, `DATA_OBJECTS.md`, `topology.json` and
`ASSESSMENT.md` in `analysis/$system/`. Spawn concurrently (and tell the user all are running) only the
agents whose input is missing:
diff --git a/plugins/code-modernization/commands/modernize-review.md b/plugins/code-modernization/commands/modernize-review.md
new file mode 100644
index 00000000..fec44883
--- /dev/null
+++ b/plugins/code-modernization/commands/modernize-review.md
@@ -0,0 +1,35 @@
+---
+description: Confirm or correct the business rules that need a person's judgement; the plan and the build read your answers
+argument-hint: <system> [flagged|p0|all]
+arguments: system scope
+---
+
+Ask a person to decide the business rules in `analysis/$system/BUSINESS_RULES.md` that depend on judgement, and record each answer so the plan and the build honor it. Agents mined the rules and a second agent checked every citation, but only someone who knows the business can say whether a rule is *right*: whether a truncation is intended or a defect, whether a threshold is still the policy. This command asks in a pop-up and never edits `BUSINESS_RULES.md`.
+
+## 1 — Choose the rules
+
+Read `BUSINESS_RULES.md` (each card has `### RULE-NNN`, Priority, Confidence, and sometimes a suspected defect or an SME question) and, if it exists, `analysis/$system/RULE_REVIEWS.json`; rules already decided are skipped, and you say how many. `$scope` picks the rest:
+
+- **flagged** (the default): P0 rules that have a suspected defect, an SME question or less than High confidence, plus any rule the brief's open questions name.
+- **p0**: every P0 rule. **all**: every rule.
+
+Say how many rules will be asked (about a minute per ten). If none is left, say so and give the next command.
+
+## 2 — Ask
+
+Use the AskUserQuestion tool, never chat text, up to four rules per call. One question per rule: its id as the header; the title, the plain-English statement, its Given/When/Then in one line, the cited lines (`file:line`) and the suspected defect or SME question if it has one as the question; and three options: **Right** (the rule is correct and wanted), **Wrong, or not wanted** (it misdescribes the code, or the code does this today but should not), **Not sure** (needs a discussion). The person can type a note instead of choosing: what is right, or the question that needs answering. Keep it, in their words. Stop when they say to. Verdicts the person already typed in the request (`RULE-004 wrong: it truncates on purpose`) are recorded as given, with no pop-up for those rules. Without the tool and without typed verdicts (a headless run) do not guess: leave every rule unreviewed and say so.
+
+## 3 — Record
+
+Merge the answers into `analysis/$system/RULE_REVIEWS.json`, the same file the live progress pane's review deck writes:
+
+```json
+{ "system": "<name>", "version": 1, "reviews": {
+ "RULE-004": { "verdict": "confirmed", "at": "<ISO time>", "title": "<the rule's title>", "note": "<their words, optional>" } } }
+```
+
+`verdict` is `confirmed` (Right), `wrong` (Wrong, or not wanted) or `discuss` (Not sure). Change an earlier entry only when a new answer replaces it. Write `analysis/$system/RULE_REVIEWS.md` from it: a short paragraph, then a table `Rule | Verdict | When | Title | Note`, sorted by rule number. Refresh the report (`python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_report.py" $system`, a convenience: if it fails or `python3` is missing, say so in one line and carry on).
+
+## 4 — What happens next
+
+Tell the person, in three lines: rules marked wrong or needing discussion are not settled; `brief` lists them as open questions and never builds a Behavior Contract on them; `transform` and `reimagine` will not pin a wrong rule as the oracle and stop on a P0 rule still under discussion. Then the next command: `/code-modernization:modernize-brief $system` (run it again if the brief exists and any rule changed), or the brief's next build command when the plan is already approved.
diff --git a/plugins/code-modernization/commands/modernize-status.md b/plugins/code-modernization/commands/modernize-status.md
index 04ff05a0..ea3bd6f5 100644
--- a/plugins/code-modernization/commands/modernize-status.md
+++ b/plugins/code-modernization/commands/modernize-status.md
@@ -21,12 +21,14 @@ presence and modification time:
| assess | `ASSESSMENT.md`, `ARCHITECTURE.mmd` |
| map | `topology.json`, `TOPOLOGY.html`, `*.mmd`, `extract_topology.*` |
| extract-rules | `BUSINESS_RULES.md`, `DATA_OBJECTS.md` |
+| review | `RULE_REVIEWS.json`: how many flagged rules a person has decided (confirmed, wrong, needs discussion), and how many are still open |
| brief | `MODERNIZATION_BRIEF.md` (is the approval block signed?) |
| harden | `SECURITY_FINDINGS.md`, `security_remediation.patch` |
| uplift | `DELTA_CATALOG.md`, `BASELINE.md`, `PLAYBOOK.md` (no playbook means the pilot has not happened, so the fan-out must not), `modernized/$system-uplifted/UPLIFT_NOTES.md` (per unit: builds on target? baseline reproduced?) |
| transform | each `modernized/$system/<module>/`: tests present? `TRANSFORMATION_NOTES.md` present (its completion marker)? |
| reimagine | `modernized/$system-reimagined/`: per-service acceptance tests, and the `CLAUDE.md` handoff (its completion marker; it does not write `TRANSFORMATION_NOTES.md`) |
| equivalence | `EQUIVALENCE.json`: cases executed, same, differs (any differing or missing case, or zero executed, is a failure) |
+| verify | `VERIFICATION.md` (written by `/code-modernization:modernize-verify`): the verdict per built module (PROVEN, PARTLY PROVEN or NOT PROVEN) and whether a person has signed it. A built module with no `VERIFICATION.md`, or one older than the module's code or tests, is **not proven yet** |
## 2 — Stale
@@ -47,8 +49,9 @@ recommend rotation and history scrubbing.
End with three lines:
-- **Where you are:** the furthest completed stage and how much it covers ("mapped 100%, 2 of 14 modules transformed").
+- **Where you are:** the furthest completed stage and how much it covers ("mapped 100%, 2 of 14 modules transformed, 1 proven").
- **What is stale:** or "nothing".
- **Next command:** the single most useful next step as the exact command line to paste, with a one-line reason.
- The order is preflight, assess, map, extract-rules, brief (needs approval), then the brief's Phase 1 command
- (`transform`, `uplift` or `reimagine`), then `harden`.
+ The order is preflight, assess, map, extract-rules, review (when rules are flagged for a person), brief (needs approval), then the brief's Phase 1 command
+ (`transform`, `uplift` or `reimagine`), then `verify` for what was built, then `harden`. Never call a
+ built module done until `verify` says PROVEN and a person has signed it: put `verify` ahead of building the next module.
diff --git a/plugins/code-modernization/commands/modernize-transform.md b/plugins/code-modernization/commands/modernize-transform.md
index 78f4f100..d3a1fb69 100644
--- a/plugins/code-modernization/commands/modernize-transform.md
+++ b/plugins/code-modernization/commands/modernize-transform.md
@@ -8,7 +8,7 @@ Transform module **`$module`** of `$system` into **$target_stack**, with proof o
equivalence. This is one vertical slice of the strangler fig; output goes to
`modernized/$system/$module/`.
-The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running. **If `$module` or `$target_stack` is empty**, read
+The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. If `legacy/$system` does not exist, stop and say so: nothing can run without the code, so the fix is `/code-modernization:modernize $system --source <path to the code>`. Run every subagent in the foreground and wait for its result: never end your turn while one is still running. Stop any server or other process you started (a legacy app on a local port, a watcher) before you finish, and say you did. **If `$module` or `$target_stack` is empty**, read
`analysis/$system/MODERNIZATION_BRIEF.md`: take the target stack it names, and the first module of
the earliest phase whose `Command:` is `transform` that has no
`modernized/$system/<module>/TRANSFORMATION_NOTES.md` yet (with no brief, the target in `INTENT.md`). Say which you picked.
@@ -27,12 +27,19 @@ against **recorded traces and golden-master fixtures** (real production outputs,
SME-confirmed examples). Say so in the plan and in `TRANSFORMATION_NOTES.md` ("equivalence is
trace-based; legacy was not executable here"), so reviewers know how strong the proof is.
+**Run the old system only where it is safe.** Record baselines from the legacy code running on this
+machine, or against a test environment the person named. Never call a production or third-party
+service, register an account, or send or change real data to record a baseline unless the person
+approved that exact target in the plan (say which calls, and which of them write). A token, password
+or session cookie in a recorded response is a secret: replace it with a fixed fake value before
+anything is saved, and never print it.
+
**The brief is binding.** If `MODERNIZATION_BRIEF.md` exists, find the phase whose `Command:` is this
one and whose `Modules:` include `$module`, and treat its scope, entry criteria, exit criteria and any
edits the user made as binding. An unmet entry criterion is the next step: meet it, never re-plan
around it. If no phase covers `$module`, stop and ask which phase this is.
-Read the module's source and the rules in `BUSINESS_RULES.md` that reference it. Then present the
+Read the module's source and the rules in `BUSINESS_RULES.md` that reference it, and any verdicts on them in `analysis/$system/RULE_REVIEWS.json`: a rule marked `wrong` is not pinned as the oracle (use the reviewer's note for what is right, and if the note does not say, ask), and a P0 rule marked `discuss` is a question to settle at this plan gate before any code. Then present the
plan and **stop: write no code until the user explicitly approves** (plan mode if available): which
source files are in scope, the target structure, which rules and behaviors it implements, how you will
prove equivalence, and anything ambiguous that needs a human decision now.
diff --git a/plugins/code-modernization/commands/modernize-uplift.md b/plugins/code-modernization/commands/modernize-uplift.md
index a3d67cce..8ee655b5 100644
--- a/plugins/code-modernization/commands/modernize-uplift.md
+++ b/plugins/code-modernization/commands/modernize-uplift.md
@@ -5,7 +5,7 @@ arguments: system source_version target_version project_pattern
---
Uplift `$system` from **$source_version** to **$target_version**: same stack, newer version.
-The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running.
+The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. If `legacy/$system` does not exist, stop and say so: nothing can run without the code, so the fix is `/code-modernization:modernize $system --source <path to the code>`. Run every subagent in the foreground and wait for its result: never end your turn while one is still running. Stop any server or other process you started (a legacy app on a local port, a watcher) before you finish, and say you did.
This is **not** `transform`, which extracts intent and rewrites idiomatically. Here the code is good
and only needs to run on a newer runtime. **Preserve structure and make the smallest diffs that compile
@@ -234,6 +234,8 @@ passes is a behavior change to adjudicate (intended fix or accident). Triage **e
unexplained changes block the project. **Report `tests executed: N` for each leg**: a leg that executed
zero tests, or skipped its cases, proved nothing. Where outputs (not just pass/fail) can be compared, use
`python3 "${CLAUDE_PLUGIN_ROOT}/scripts/compare.py"` as `transform` does, and let the script decide.
+The independent re-check is `/code-modernization:modernize-verify $system`: it re-runs the suite, diffs it against
+`BASELINE.md` with `scripts/baseline_diff.py`, and gives one verdict.
## Step 7 — UPLIFT_NOTES
diff --git a/plugins/code-modernization/commands/modernize.md b/plugins/code-modernization/commands/modernize.md
index 9440ae58..5e0e91b2 100644
--- a/plugins/code-modernization/commands/modernize.md
+++ b/plugins/code-modernization/commands/modernize.md
@@ -22,19 +22,26 @@ The code is `legacy/$system` (a copy, or a symlink to where it really lives). If
`--source <path>`, use that path. Pick a short name for it (letters, digits, `-` and `_`) if none was given. Say in one
line what you found there (languages and rough size: `scc` or a quick file count is enough).
-## 3 — Ask what they want (one pop-up, at most three questions)
+## 3 — Ask what they want (two short pop-ups at most)
Use the AskUserQuestion tool, never chat text; without it (a headless run) pick the defaults and record them as open
-items. Give each question plain options and let them type their own.
+items. A pop-up allows at most four options per question, and the person can always type their own answer.
-1. **What do you want to do with it?** Options: *Move to a newer version of the same technology* (for example .NET
- Framework to .NET 8, Java 8 to 17, Python 2 to 3), *Rewrite it in a different technology, one piece at a time, while
- the old system keeps running*, *Rebuild it from scratch on a new architecture*, *Just understand it first: map it and
- list what it does*, *I'm not sure: recommend one after a quick look*.
-2. **What should it become?** Only for a version move (from which version to which), a rewrite (the target language or
- framework) or a rebuild (a sentence about the goal). Offer common choices for the code's stack, and "Other".
-3. **What must stay true?** Options (pick any): *The old system keeps running during the move*, *Behavior must match
- exactly, including known quirks*, *Fix known bugs as we go*, *A security review comes first*, *Nothing else*.
+**Pop-up 1, two questions:**
+
+1. **What do you want to do with it?** *Move to a newer version of the same technology* (for example .NET Framework to
+ .NET 8, Java 8 to 17, Python 2 to 3), *Rewrite it in a different technology, one piece at a time, while the old system
+ keeps running*, *Rebuild it from scratch on a new architecture*, *Understand it first: map it and list what it does*
+ (also the right choice when they are not sure: the assessment then recommends one of the other three).
+2. **What must stay true?** Pick any: *The old system keeps running during the move*, *Behavior must match exactly,
+ including known quirks*, *Fix known bugs as we go*, *A security review comes first*. Choosing none means nothing
+ special.
+
+**Pop-up 2, one question, only after the first answer and never for "understand it first":** *What should it become?*
+Tailor it to what you found in step 2: for a version move, the newest supported versions of the code's stack ("Java
+21", "Java 17"); for a rewrite, two or three common target technologies for this kind of code; for a rebuild, the
+architecture options that fit (a REST API with a separate front end, a few services, a modular monolith). The person
+can type any other target.
## 4 — Write it down once
@@ -45,7 +52,7 @@ is asked twice: `brief` takes its target stack from it and never overrides it wi
## 5 — Show the road
In at most eight lines, tailored to their goal, list the commands they will run in order (`preflight`, `assess`, `map`,
-`extract-rules`, `brief`, then `uplift`, `transform` or `reimagine`, then `verify` and `harden`), one line each on what they get
+`extract-rules`, `review` when rules are flagged for a person, `brief`, then `uplift`, `transform` or `reimagine`, then `verify` and `harden`), one line each on what they get
and where a person decides. For "understand it first" stop after `brief`. For "not sure", run `preflight` and `assess`
first and let the assessment's recommended pattern pick the road. Name the two places a human decides (approving the brief,
accepting each difference the proof finds) so nothing surprises them.