Files
claude-plugins-official/plugins/code-modernization/commands/modernize-brief.md
Morgan Lunt 22a1b25977 Harden code-modernization plugin from a real CardDemo dry run
Fixes found by running the discovery workflow against the AWS CardDemo
mainframe sample (~50 KLOC of COBOL/CICS/JCL/BMS/VSAM):

- modernize-assess: add scc -> cloc -> find/wc fallback chain with the
  COCOMO-II formula so Step 1 works when scc isn't installed; same for
  portfolio-mode cloc/lizard. Drop the reference to a specific
  agent-spawning tool name (just "in parallel"). Sharpen the structural-
  map subagent prompt: 5-12 domains, subgraph clustering, ~40-edge cap,
  repo-relative paths, dangling-reference check.
- modernize-map: expand the parse-target list with the things a
  literal-minded reader would miss on a real mainframe codebase — CICS
  CSD DEFINE TRANSACTION/FILE for entry points and online file I/O,
  EXEC CICS file ops, SELECT...ASSIGN TO joined with JCL DD,
  EXEC SQL table refs (not JCL DD), SEND/RECEIVE MAP, dynamic
  data-name XCTL resolution, COBOL fixed-format column slicing. Without
  these the dead-code list is wrong (most CICS programs look unreachable).
  Also write a machine-readable topology.json alongside the summary.
- modernize-extract-rules: add a Priority (P0/P1/P2) field with a
  heuristic, and an optional Suspected-defect field. modernize-brief
  reads P0 rules to build the behavior contract, but the Rule Card had
  no priority slot — the chain was broken.
- modernize-brief: read the new P0 tags; flag low-confidence P0 rules as
  SME blockers.
- modernize-reimagine: drop "for the demo" wording.
- security-auditor agent: add mainframe/COBOL coverage items (RACF,
  JCL/PROC creds, BMS field validation, DB2 dynamic SQL, copybook PII)
  and mark web-only items as such so it adapts to the target stack.
- README: add Optional Tooling section and a symlink example for the
  expected layout.
2026-05-11 16:28:27 -07:00

2.4 KiB

description, argument-hint
description argument-hint
Generate a phased Modernization Brief — the approved plan that transformation agents will execute against <system-dir> [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.html (and the .mmd files alongside it), 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.

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 using strangler-fig ordering — lowest-risk, fewest-dependencies first. 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)
  • Estimated effort (person-weeks, derived from COCOMO + complexity data)
  • Risk level + top 2 risks + mitigation

Render the phases as a Mermaid gantt chart.

4. 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.

5. Validation Strategy

State which combination applies: characterization tests, contract tests, parallel-run / dual-execution diff, property-based tests, manual UAT. Justify per phase.

6. Open Questions

Anything requiring human/SME decision before Phase 1 starts. Each as a checkbox the approver must tick.

7. Approval Block

Approved by: ________________  Date: __________
Approval covers: Phase 1 only | Full plan

Present

Enter plan mode and present a summary of the brief. Do NOT proceed to any transformation until the user explicitly approves. This gate is the human-in-the-loop control point.