summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/commands/modernize-brief.md
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-11-06 00:54:48 +0000
committerClaude <noreply@anthropic.com>2026-11-06 00:54:48 +0000
commit7aba3deae3ff17d032c37e07d2929d1426b34278 (patch)
tree9c482f9acda1599bd2f9bed95a6a46b75e634e80 /plugins/code-modernization/commands/modernize-brief.md
parent5472f5f56e0070feeeb464318b316714fe3e9105 (diff)
parentb8331dd69ab3e132bbf8cd6e89b5d8c1747e21b1 (diff)
Merge remote-tracking branch 'origin/main' into add-plugin/xcodeadd-plugin/xcode
Diffstat (limited to 'plugins/code-modernization/commands/modernize-brief.md')
-rw-r--r--plugins/code-modernization/commands/modernize-brief.md277
1 files changed, 119 insertions, 158 deletions
diff --git a/plugins/code-modernization/commands/modernize-brief.md b/plugins/code-modernization/commands/modernize-brief.md
index 1871ce17..fb9a8f76 100644
--- a/plugins/code-modernization/commands/modernize-brief.md
+++ b/plugins/code-modernization/commands/modernize-brief.md
@@ -1,170 +1,131 @@
---
-description: Generate a phased Modernization Brief — the approved plan that transformation agents will execute against
-argument-hint: <system-dir> [target-stack]
+description: Write the phased Modernization Brief — the plan a steering committee approves and the build commands execute against
+argument-hint: <system> [target-stack]
+arguments: system target_stack
---
-Synthesize everything in `analysis/$1/` into a **Modernization Brief** — the
-single document a steering committee approves and engineering executes.
-
-Target stack: `$2` (if blank, recommend one based on the assessment findings).
-
-Read `analysis/$1/ASSESSMENT.md`, `analysis/$1/topology.json` (plus the
-`.mmd` files alongside it — do NOT read `TOPOLOGY.html`, it's an
-interactive viewer with the data minified inside), and
-`analysis/$1/BUSINESS_RULES.md` first. If any are missing, say so and
-stop — they come from `/modernize-assess`, `/modernize-map`, and
-`/modernize-extract-rules` respectively. Run those first.
-
-Two more inputs are conditional:
-
-- **`analysis/$1/PREFLIGHT.md`** — read it if it exists. It records two
- things nothing else has: the human's answers to `/modernize-preflight`
- Check 0 (scope, whether they can build and run tests locally and how
- long CI takes, bespoke build infrastructure, prior attempts, what is
- off-limits) and the Check 6 **scope boundary** — whether `legacy/$1` is
- a slice of a larger codebase, and what *outside* it depends on code
- *inside* it. Both constrain this plan more than anything derivable from
- the source. Never override an answer the human gave there with a guess.
-- **`analysis/$1/DELTA_CATALOG.md`** — **required** whenever the target
- (`$2`, or your recommendation) is a newer version of the *same* stack.
- A same-stack uplift's phase order is decided by its version deltas, not
- by the topology alone — most of all by whether the **existing test suite
- can even execute on the target runtime**. Phasing an uplift without the
- catalog is planning blind; it is exactly how a test-framework migration
- ends up scheduled last when it must come first. If the catalog is
- missing, produce it *before* phasing — run `/modernize-uplift $1
- <source> $2` through its Step 3 (the delta-catalog step), or spawn the
- **version-delta-analyst** agent directly — then return here. Do not
- guess at the deltas.
-
-**Staleness check:** compare modification times. If any input is newer
-than an existing `MODERNIZATION_BRIEF.md`, the brief is being justifiably
-regenerated; but if an existing brief is newer than all inputs and the
-user re-ran this command anyway, ask what changed. Either way, note the
-input timestamps in the brief's header so reviewers can see what it was
-built from.
+Synthesize everything in `analysis/$system/` into a **Modernization Brief**: the single
+document a steering committee approves and engineering executes. Target stack:
+`$target_stack` (if blank, the one in `analysis/$system/INTENT.md`, else recommend one from the assessment).
+
+Read `ASSESSMENT.md`, `topology.json` (and the `.mmd` files beside it; never read
+`TOPOLOGY.html`, it is a viewer with the data minified inside) in `analysis/$system/` first,
+and `BUSINESS_RULES.md` too unless this is a same-technology **uplift** (the intent or the assessment
+says so): an uplift keeps the code, so its Behavior Contract is the recorded baseline and `extract-rules`
+can wait. If a required file is missing, say so and stop: they come from `assess`, `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
+ means `transform`, a rebuild on a new architecture means `reimagine`. Without it, the assessment's pattern decides.
+- **`PREFLIGHT.md`**, if it exists. It holds two things nothing else has: the human's answers
+ to preflight Check 0 (scope, local build and test, bespoke build infrastructure, prior
+ attempts, what is off limits) and the Check 6 **scope boundary** (whether the source is a
+ slice of a larger codebase, and what outside it depends on code inside it). Both constrain
+ this plan more than anything derivable from the source. Never override a human's answer with
+ a guess.
+- **`DELTA_CATALOG.md`**, **required** when the target is a newer version of the *same* stack.
+ 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) 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
+changed. Note the input timestamps in the brief's header.
## The Brief
-Write `analysis/$1/MODERNIZATION_BRIEF.md`:
-
-### 1. Objective
-One paragraph: from what, to what, why now.
-
-### 2. Target Architecture
-Mermaid C4 Container diagram of the *end state*. Name every service, data
-store, and integration. Below it, a table mapping legacy component → target
-component(s).
-
-### 3. Phased Sequence
-Break the work into 3-6 phases. Order by **strangler-fig** for a cross-stack
-rewrite (lowest-risk, fewest-dependencies first), or **build-graph leaf-first**
-for a same-stack uplift (libraries before the apps that depend on them).
-
-For an **uplift**, leaf-first has three overrides, and getting them wrong is
-the most common way an uplift plan fails. Apply them *here*, at planning
-time. `/modernize-uplift` Step 1 re-applies the same rules at execution
-time (its list also names multi-targeting — the *technique* that satisfies
-override 3's first option), and an approved order and a re-derived one must
-never disagree — which is exactly what deciding the order without these
-would produce:
-
-1. **The test harness is not a leaf — it is a prerequisite.** Nothing
- migrated can be validated until the tests that validate it run on the
- target. If `DELTA_CATALOG.md` shows the test framework or its runner
- does not support the target runtime (NUnit 2 or MSTest v1 on modern
- .NET, JUnit 4 without the vintage engine, `nose` on Python 3, …), then
- migrating the test framework is **Phase 1 by itself**, before any
- production code moves.
-2. **Dependency deltas that every consumer shares force a coordinated
- cut** (a major-version bump of an ORM, a namespace move like
- `javax`→`jakarta`). These cannot be done leaf-first incrementally —
- every consumer changes together — so they get their own cross-cutting
- phase.
-3. **Shared nodes with consumers *outside* the scope** (PREFLIGHT.md's
- scope-boundary check) need an explicit, recorded decision in whichever
- phase touches them: keep them buildable for both old and new consumers
- through the transition (multi-targeting, publishing for both versions,
- a parallel artifact), expand the scope to include the consumers, or
- accept and schedule the break. Never silently migrate a shared node in
- place and break every consumer nobody was looking at.
-
-Name the per-phase execution command: `/modernize-transform` (cross-stack
-module rewrite), `/modernize-reimagine` (greenfield rebuild), or
-`/modernize-uplift` (same-stack version bump — when the target is a newer
-version of the *same* stack, this is the path, not transform). For each phase:
-- Scope (which legacy modules, which target services)
-- Entry criteria (what must be true to start)
-- Exit criteria (what tests/metrics prove it's done)
-- Relative scale (T-shirt size — S/M/L/XL — anchored to the phase's share
- of the assessment's COCOMO complexity index. This ranks phases by size
- against each other; it is **not** a duration. Do **not** state
- person-months, weeks, calendar dates, or a delivery estimate — agentic
- transformation does not follow the human-team productivity curves those
- units assume, so any time figure here would be misleading.)
-- Risk level + top 2 risks + mitigation
-
-The named execution command **reads this brief** and treats its phase's
-scope, entry criteria, and exit criteria as binding gates. So write entry
-criteria as *checkable preconditions* ("baseline recorded in
-`analysis/$1/BASELINE.md`", "pilot playbook approved"), not aspirations —
-and tell the approver they steer execution by editing this file. An edited
-entry criterion is honored; a note in a chat is not.
-
-Render the phases as a Mermaid `flowchart LR` showing **sequence and
-dependencies** (Phase 1 → Phase 2 → …, with branches where phases are
-independent). Do **not** use a `gantt` chart — gantt encodes calendar
-durations, and this plan deliberately makes no time claims.
-
-**Phase 1 is a pilot, and this brief is a hypothesis.** Whenever a phase's
-units share one execution recipe (an uplift over many projects, a transform
-over many similar modules), name **one representative unit** as that
-phase's own first slice. For an uplift, `/modernize-uplift` Step 5a
-*enforces* this — it will not fan out without a pilot and its playbook; for
-the other execution commands the pilot lives here, written into that
-phase's **entry criteria**, which they read as a gate. A reviewer should
-see it in this document either way. Say explicitly in §3 that what the pilot
-surfaces (a delta the analysis missed, a prerequisite that reorders the
-phases, an environment fact nobody wrote down) is *expected* to revise
-this brief, and that a regenerated brief after the pilot is the normal
-path, not a correction. Legacy systems hide their surprises in the build
-and the runtime, not in the source; no amount of reading substitutes for
-one unit taken all the way through.
-
-### 4. Business Walkthroughs
-For each persona flow in `analysis/$1/topology.json` (`flows` — produced
-by `/modernize-map`), a short narrative table: persona, what happens in
-business language, which legacy modules implement it today, and which
-phase from §3 replaces each. This is the section non-technical approvers
-actually read — it connects "Phase 2" to "what happens when a customer
-files a claim". If topology.json has no flows, derive 2–3 walkthroughs
-from the entry points and say they need SME confirmation.
-
-### 5. Behavior Contract
-List the **P0 rules** from BUSINESS_RULES.md (the ones tagged `Priority: P0` —
-money, regulatory, data integrity) that MUST be proven equivalent before any
-phase ships. These become the regression suite. Flag any P0 rule with
-Confidence < High as a blocker requiring SME confirmation before its phase
-starts.
-
-### 6. Validation Strategy
-State which combination applies: characterization tests, contract tests,
-parallel-run / dual-execution diff, property-based tests, manual UAT.
-Justify per phase.
-
-### 7. Open Questions
-Anything requiring human/SME decision before Phase 1 starts. Each as a
-checkbox the approver must tick.
-
-### 8. Approval Block
+Write `analysis/$system/MODERNIZATION_BRIEF.md` with these sections.
+
+**1. Objective.** One paragraph: from what, to what, why now.
+
+**2. Target Architecture.** A Mermaid C4 Container diagram of the end state naming every service,
+data store and integration, then a table mapping each legacy component to its target component(s).
+
+**3. Phased Sequence.** 3–6 phases, ordered by **strangler fig** for a cross-stack rewrite
+(lowest risk and fewest dependencies first) or **build-graph leaf-first** for an uplift
+(libraries before the apps that use them). For an uplift, three overrides decide whether the
+plan works; the uplift command re-applies them at execution, and the two must never disagree:
+
+1. **The test harness is a prerequisite, not a leaf.** If the catalog shows the test framework or
+ runner does not support the target (NUnit 2 or MSTest v1 on modern .NET, JUnit 4 without the
+ vintage engine, `nose` on Python 3), migrating it is **Phase 1 by itself**.
+2. **A dependency delta every consumer shares forces a coordinated cut** (an ORM major version,
+ `javax` to `jakarta`): it gets its own cross-cutting phase, not an incremental leaf-first one.
+3. **A shared node with consumers outside the scope** (from the preflight boundary check) needs an
+ explicit decision in the phase that touches it: keep it buildable for old and new consumers
+ (multi-targeting, publishing both), widen the scope to include the consumers, or schedule the
+ break. Never silently migrate it in place.
+
+Write every phase in this exact shape, because the build commands and the progress pane read it:
+
+```
+#### Phase N — <name>
+Command: /code-modernization:modernize-transform | -uplift | -reimagine (exactly one)
+Modules: <module ids exactly as in topology.json, comma separated>
+Scale: S | M | L | XL
+Risk: <level>; <top 2 risks and mitigations>
+Entry criteria:
+- [ ] <a condition that can be checked>
+Exit criteria:
+- [ ] <a condition that can be checked>
+```
+
+- `transform` is a cross-stack module rewrite, `reimagine` a greenfield rebuild, and `uplift` a
+ same-stack version bump (when the target is a newer version of the same stack, it is the path, not
+ `transform`).
+- **Scale** is a T-shirt size anchored to the phase's share of the assessment's complexity index. It
+ ranks phases against each other and is **not** a duration: state no person-months, weeks, dates or
+ delivery estimate (agentic work does not follow human-team productivity).
+- **Criteria are conditions, never states.** "All P0 rules in Phase 1 proven equivalent" is a
+ criterion; "P0 rules proven" is a claim. Make entry criteria *checkable preconditions* ("baseline
+ recorded in `analysis/$system/BASELINE.md`", "pilot playbook approved"). The build commands read the
+ brief and treat them as binding, and they may tick a box or add a note but never reword a criterion:
+ a proposed change goes on a `Proposed revision:` line for the approver. Tell the approver they steer
+ execution by editing this file: an edited criterion is honored, a chat message is not.
+- Draw the phases as a Mermaid `flowchart LR` of **sequence and dependencies**, never a `gantt`
+ (that encodes durations this plan deliberately does not claim).
+- **Phase 1 is a pilot, and this brief is a hypothesis.** When a phase's units share one recipe (an
+ uplift over many projects, a transform over many similar modules), name one representative unit as
+ its first slice in the entry criteria. Say in §3 that what the pilot surfaces (a delta the analysis
+ missed, a prerequisite that reorders the phases, an environment fact nobody wrote down) is *expected*
+ to revise the brief, and that regenerating it after the pilot is the normal path. Legacy systems hide
+ their surprises in the build and the runtime, not the source.
+
+**4. Business Walkthroughs.** For each persona flow in `topology.json` (`flows`), a short table:
+persona, what happens in business language, which legacy modules implement it, and which phase
+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` (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. For an uplift
+with no rules file, the contract is the baseline: `analysis/$system/BASELINE.md` and the result files it points to,
+which the new version must reproduce.
+
+**6. Validation Strategy.** Which combination applies, per phase: characterization tests, contract
+tests, dual-execution diff, property-based tests, manual UAT.
+
+**7. Open Questions.** Everything needing a human decision before Phase 1, each a checkbox the
+approver ticks.
+
+**8. Approval Block**
+
```
Approved by: ________________ Date: __________
Approval covers: Phase 1 only | Full plan
```
-## Present
+## Finish
-Present a summary of the brief and **stop — write nothing further until
-the user explicitly approves** (use plan mode if the session supports
-it). This gate is the human-in-the-loop control point; "no objection" is
-not approval.
+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). Present a summary of the brief and **stop: write nothing further until the user
+explicitly approves** (use plan mode if the session supports it). This is the human control point, and
+"no objection" is not approval. After approval, the next step is Phase 1's command.