diff options
| author | Morgan Lunt <morganl@anthropic.com> | 2026-09-24 20:15:45 -0700 |
|---|---|---|
| committer | Morgan Lunt <morganl@anthropic.com> | 2026-09-24 20:15:45 -0700 |
| commit | 696904602b2bdf3e0ddd07ae1221f9eb3e3b8e62 (patch) | |
| tree | 9888e8e8a4465f5886dcfa1087702d691178acb1 /plugins/code-modernization/commands | |
| parent | cafefb304bde4070c6c0877528ee49c1252eff85 (diff) | |
code-modernization: rate rules by what the system is for, and make live runs finish
Two problems from running the commands on real repositories:
- The P0 definition was money- and regulation-shaped, so a music-library
tool got no P0 rules and its behavior contract came out empty. P0 now
means the system's core purpose depends on the rule, or a wrong result is
costly or irreversible (money, legal, data integrity, security or safety,
or the central calculation or decision the system exists to perform).
- Citations came back as lists of ranges, and the rule renderer numbered
RULE-NNN in a different order from the document. Each rule now cites one
range and the numbers read in sequence.
Commands that start subagents now say to run them in the foreground and
wait, because a headless session ends when the model stops talking even if
it said it was waiting for a background agent.
Diffstat (limited to 'plugins/code-modernization/commands')
8 files changed, 16 insertions, 14 deletions
diff --git a/plugins/code-modernization/commands/modernize-assess.md b/plugins/code-modernization/commands/modernize-assess.md index c9fc9b07..7f280347 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. +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. --- diff --git a/plugins/code-modernization/commands/modernize-brief.md b/plugins/code-modernization/commands/modernize-brief.md index f74204dc..5e567540 100644 --- a/plugins/code-modernization/commands/modernize-brief.md +++ b/plugins/code-modernization/commands/modernize-brief.md @@ -23,8 +23,9 @@ in `analysis/$system/` first. If any is missing, say so and stop: they come from An uplift's phase order is decided by its version deltas, above all by whether the existing tests can even run on the target runtime; phasing without the catalog is planning blind. If it is missing, produce it first (`/code-modernization:modernize-uplift $system <source> $target_stack` - through its delta-catalog step, or the **version-delta-analyst** agent), then return. Do not - guess at deltas. + through its delta-catalog step, or the **version-delta-analyst** agent) and **wait for its result**: + never end your turn while an agent is still running, and never write the brief before the catalog + exists. Do not guess at deltas. **Staleness.** If an input is newer than an existing `MODERNIZATION_BRIEF.md`, regenerating is justified. If the brief is newer than every input and the user re-ran this anyway, ask what @@ -94,8 +95,8 @@ persona, what happens in business language, which legacy modules implement it, a replaces each. This is the section non-technical approvers read. With no flows, derive 2–3 from the entry points and mark them as needing SME confirmation. -**5. Behavior Contract.** The **P0 rules** from `BUSINESS_RULES.md` (money, regulatory, data -integrity) that MUST be proven equivalent before any phase ships: they become the regression suite. +**5. Behavior Contract.** The **P0 rules** from `BUSINESS_RULES.md` (the ones the system's core purpose +depends on, or that are costly if wrong) that MUST be proven equivalent before any phase ships: they become the regression suite. Flag any P0 rule below High confidence as a blocker needing SME confirmation before its phase starts. **6. Validation Strategy.** Which combination applies, per phase: characterization tests, contract diff --git a/plugins/code-modernization/commands/modernize-extract-rules.md b/plugins/code-modernization/commands/modernize-extract-rules.md index 89e27188..7c405d57 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. +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. ## Method A — Workflow (preferred when the Workflow tool is available) @@ -121,7 +121,7 @@ them, location) in this format: ### RULE-NNN: <plain-English name> **Category:** Calculation | Validation | Lifecycle | Policy **Priority:** P0 | P1 | P2 -**Source:** `path/to/file.ext:line-line` (path relative to legacy/$system) +**Source:** `path/to/file.ext:line-line` (ONE range, path relative to legacy/$system) **Plain English:** One sentence a business analyst would recognize. **Specification:** Given <precondition> @@ -134,8 +134,9 @@ them, location) in this format: ``` Headings are exactly `### RULE-NNN: <name>`, numbered in sequence: later commands find rules by -that pattern. **P0** if the rule moves money, enforces a regulatory requirement or guards data -integrity (P0 below High confidence needs an SME); **P2** for display and convenience; else +that pattern. **P0** if the system's core purpose depends on the rule or a wrong result is costly or irreversible +(it moves money, enforces a legal or regulatory requirement, guards data integrity, security or safety, +or is the central calculation or decision the system exists to perform; P0 below High confidence needs an SME); **P2** for display and convenience; else **P1**. The brief's behavior contract is built from the P0 rules. Start the file with a summary table (ID, name, category, priority, source, confidence) and end it with a **Rules requiring SME confirmation** section listing each Medium and Low rule with its question. diff --git a/plugins/code-modernization/commands/modernize-harden.md b/plugins/code-modernization/commands/modernize-harden.md index b9e3c17f..bab2716c 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. +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. 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 ac546e90..2ea7ec95 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. +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. ## Start from what already exists diff --git a/plugins/code-modernization/commands/modernize-reimagine.md b/plugins/code-modernization/commands/modernize-reimagine.md index acd91f22..65f324f0 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. 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. +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. **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 diff --git a/plugins/code-modernization/commands/modernize-transform.md b/plugins/code-modernization/commands/modernize-transform.md index c9ef517c..2ef8b946 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. **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. 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 `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. Say which you picked. diff --git a/plugins/code-modernization/commands/modernize-uplift.md b/plugins/code-modernization/commands/modernize-uplift.md index 57fe2cc8..2e976a4a 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 **legacy/$system_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. +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. 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 |
