summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/commands
AgeCommit message (Collapse)Author
2026-09-25code-modernization: rename the pane's rule review command to ↵Morgan Lunt
/modernize-review-pane The pane's bare /modernize-review took the name of the plugin's own review command, so typing the short form in a pane-enabled session opened the pane's cards instead of the pop-up review. The pane's version is now /modernize-review-pane, and /modernize-review always runs the plugin command. Both still write the same review file.
2026-09-25code-modernization: a rule is tested only if a test that ran backs itMorgan Lunt
A rule named only by a skipped or pending test no longer counts as covered. It is listed as "named, not run" and fails the rules check. A test-only folder is listed as tooling and gets no verdict. The verify command tries malformed records only when the person asked for exact behavior, so a proof loop has an end. The report parses rule headings and fields in linear time, and the report and pane show the new status.
2026-09-24code-modernization: approve a difference once per inputMorgan Lunt
An independent check of a rewritten batch job found differences on two new inputs of one family (a blank numeric field the rewrite rejects on purpose and the old program reads as zero). Each input has several output files, so accepting the deviation meant three or four hand-written entries per input. A top-level "approvedInputs": {"F23": "reason"} in a cases file now approves every case that shares that input label. A reason is still required (blank approves nothing), a case's own reason wins, a missing file is never turned into a pass, and the result still lists the difference as approved.
2026-09-24code-modernization: an uplift is not proven by a typed baseline or edited testsMorgan Lunt
Three ways a same-technology uplift could come out PROVEN too easily: - The baseline came from a table someone typed. It now counts as measured only when the script can read per-test results (JUnit or TRX XML, a runner log with a summary line, or per-test JSON) from analysis/<system>/baseline/ or a "Recorded:" line of BASELINE.md; a counts-only file is ignored, two measured sources that disagree are a gap, and the typed table must match what was measured. - Tests edited during the uplift passed unnoticed. The pack now compares the legacy and working-copy test files (by walking files only) and lists what was added, removed or changed; a removed file, more than a quarter of the files changed, or no legacy tests to compare with is a gap, and it says plainly that weakened assertions cannot be detected. - A silent behavioral change with no test at its site. Each Behavioral-silent delta in the catalog must have a test file naming its site file, or the module is at most PARTLY PROVEN. The report's Proof section shows the three new checks, and an uplift pack that lacks any of them reads as PARTLY PROVEN. 214 script tests pass.
2026-09-24code-modernization: fold the same rule found in several files into oneMorgan Lunt
A numeric library implemented in C, in a C++ header and in a fixed-point variant produced three "twiddle factor" rules, two "generic butterfly" rules and two "factorization" rules, because the referee's duplicate key is the file plus the rule's name. The plan and the review then carry noise. After verification, one small agent per 150 rules lists the groups that describe the same behavior implemented in more than one place, told to merge only what would be implemented and tested as one thing. The kept rule cites every place (the renderer shows them as "Also cited") and takes the highest priority of its group; overlapping, out-of-range or self-merging groups are ignored, and the rule list is fenced as untrusted data. The count is reported as stats.consolidated.
2026-09-24code-modernization: safer, more general version upliftsMorgan Lunt
Found by reading the commands as an engineer with a large Java 8 system: - The baseline suite was run "on legacy/<system>", which writes build output into the source. It now runs on a scratch copy, its result files or log are kept under analysis/<system>/baseline/ and named in BASELINE.md, and a typed table alone no longer counts as a measured baseline. - The working copy no longer carries the source repository's history, keeps files that look like credentials or production settings out of its first commit and lists them for a person, and moves that history to its own new local repository. - Migration tools (OpenRewrite and the like) run on a scratch copy, never in the source, since a dry run still builds and downloads. - A move spanning several versions or two things at once (a JDK and a framework) is split into hops that each build and test green. - Tests are not run against a database or service the configuration names until the person says it is a local or throwaway instance. - The silent-behavior hunt now names the usual traps for Java, Python, Node and PHP as well as .NET (locale data, default charset, ORM mappings, property binding, str/bytes). - The brief no longer requires business rules for a same-technology uplift: the recorded baseline is its behavior contract, so extract-rules can wait.
2026-09-24code-modernization: screenshots for the README, and where a person decidesMorgan Lunt
Adds the pictures the README and the pane docs use: three of the report (the at-a-glance view when the proof passes, the same view when an independent check finds a difference the development cases missed, and the proof tab) and ten of the live pane, drawn by the pane's own code from finished runs. The report pictures come from real runs; the pane's fleet and x-ray views and its GIF use scripted agent activity, and the review and sign-off pictures use sample text, all said so in the pane's README. The front door names every place a person decides and moves the security scan first when the person asked for it, and status points a new user to the front door instead of straight to preflight.
2026-09-24code-modernization: people's verdicts on rules reach the build, and safer ↵Morgan Lunt
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.
2026-09-24code-modernization: an independent proof step with one verdict per moduleMorgan Lunt
/code-modernization:modernize-verify re-checks a finished build instead of trusting the notes it left behind, and a script (not the model) computes one verdict per module: PROVEN, PARTLY PROVEN or NOT PROVEN, with the rules written into the output. The pack re-reads the tests' own result files or a saved runner log (counts the command merely reported never count), traces every P0 business rule to a test that names it, judges the old and new outputs again with compare.py, then runs at least ten inputs that development did not use on both systems. It requires a recorded canary that turned tests red, checks that the legacy source was not touched (by file times: no process runs in the analyzed tree), and lists every human criterion as waiting for a person. For an uplift it diffs the fresh results against the recorded baseline. Verdicts are never carried over from an earlier run. The report gains a Proof section that recomputes each verdict from the same checks, and a failed diagram no longer stops the ones after it from drawing.
2026-09-24code-modernization: harden the numeric tolerance and say what Rehost and ↵Morgan Lunt
Replace mean Follow-ups from review of the tolerance check: an absolute tolerance above 1e-6 is refused like a relative one above 1%, numbers are compared as exact decimals rather than doubles, dotted runs such as 1.2.3 or 10.0.0.1 are text that must match exactly, and the self-check now changes the leading digit of every sampled number to prove the tolerance cannot hide a real change. The business-rules header says how many rules there were at extraction, since later steps add rules. The assessment says what to do when it recommends Rehost or Replace, which change no code and so have no build command.
2026-09-24code-modernization: compare floating-point output within a declared toleranceMorgan Lunt
The equivalence check compared bytes only, which cannot pass for numeric code (Fortran, C, scientific and financial results) whose last digits differ between compilers and math libraries, so those cases pushed people to mask the numbers away. A case can now declare a tolerance, relative or absolute, with a required reason. Only numbers written with a decimal point or an exponent may differ within it; integers and every other byte must match, a relative tolerance above 1% is refused, and the tolerance and the largest difference are recorded in the result. The self-check also fails when a tolerance is loose enough to hide a change to the leading digit of a number.
2026-09-24code-modernization: call workflows by name and fix the uplift version argumentsMorgan Lunt
The Workflow tool refuses a plugin script path whenever the plugin lives outside the working directory, which is the normal case for an installed plugin: the model failed once or twice on every run before falling back to the registered name. The commands now call each workflow by its registered name and mention the script path only as a fallback. modernize-uplift also referred to legacy/$system_version, which is not an argument; it now uses $source_version everywhere, and the version pair, the rewrite target and the vision fall back to analysis/<system>/INTENT.md when they are not given. The README notes that a scripted (claude -p) run needs CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS=0 so long fan-out steps can finish.
2026-09-24code-modernization: measure portfolio complexity one way for every systemMorgan Lunt
The portfolio sweep let each survey agent pick its own complexity tool, so one system's number was a per-file total and another's a per-function mean, and the heat-map compared them anyway. Every agent now takes the same measure (the per-file decision-point total, and the most complex single file), the workflow computes complexity per thousand lines in code, and the table shows those columns. Documentation coverage no longer counts a license header as documentation.
2026-09-24code-modernization: a front door that asks what you want onceMorgan Lunt
/code-modernization:modernize takes no arguments. It finds the code, asks what the person wants to do with it (a newer version of the same technology, a rewrite in another one, a rebuild, or just to understand it) and what must stay true, writes the answers to analysis/<system>/INTENT.md, shows the road ahead in a few lines, and gives the exact first command. On a return visit it acts like status. brief takes its objective, target and each phase's build command from INTENT.md, and uplift, transform and reimagine fall back to it for their versions, target and vision, so nobody is asked the same thing twice. The README's start section now begins with the front door.
2026-09-24code-modernization: rate rules by what the system is for, and make live runs ↵Morgan Lunt
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.
2026-09-24code-modernization: simpler commands, a source option, a report page and an ↵Morgan Lunt
equivalence check Commands hardcoded legacy/<system>, so code too big to copy, or living at an absolute path, needed a hand-made symlink. Preflight now takes --source <path> and makes the legacy/<system> link for you (a junction on Windows); nothing is copied, and every command says where the link points before it starts. The harden patch is applied with patch -p1 -d. Each command ends by naming the next command to run, and the commands are about a third shorter with no step removed: - map accepts an existing dependency graph (--graph) or the stack's own tooling, maps very large estates in resumable chunks, records reflection targets as unresolved instead of dead, asks before describing more than 40 nodes, and never gives two nodes the same location. - transform can take its module and target from the brief, counts the equivalence cases that executed (zero is a failure and a comparison never skips), shows the tests can fail with a deliberate one-line break, and hands "same or different" to a script when both systems can run. - brief writes each phase in one fixed shape: one command, module ids as in the map, and criteria written as conditions a build command may tick but not reword. - reimagine reuses the discovery artifacts instead of extracting them again. - status names the exact command to paste next. scripts/build_report.py turns whatever the commands wrote into one self-contained, offline REPORT.html (Mermaid is vendored, all text from the analysis is escaped, the quarantined secrets file is never read), and scripts/compare.py decides byte-for-byte whether two outputs match, records why, and checks it can fail. The shard builder ignores symbolic links and paths that leave the source, matches a plain name against what lies beneath it, and falls back to the directory tree when the map's modules share a location. The README drops from 275 to about 100 lines; the pane's reference moves to hooks/README.md.
2026-09-24code-modernization: extract-rules uses a shard builder and a rules renderer ↵Morgan Lunt
that ship with the plugin The command used to carry a 35-line shard-building script inline and asked the model to write a rules renderer on every run, so the shard list and the BUSINESS_RULES.md layout varied from run to run and could not be tested. scripts/make_shards.py builds the shard list from topology.json when the map has run, and from the directory tree when it has not (skipping vendored, generated and test-fixture directories, one shard per directory, split at 25 files or about 5,000 lines). scripts/render_rules.py turns the workflow's result into BUSINESS_RULES.md and DATA_OBJECTS.md with RULE-NNN headings, the SME section and the coverage gaps, and writes every value from the analysis as plain text. The workflow takes an optional sourceDir, so the code can live outside the workspace, and shard files are kept relative to it. The command drops from 305 to about 150 lines.
2026-09-24code-modernization: fix contradictions and stale references in existing textMorgan Lunt
Make the text say what the commands and workflows already do: where each build command writes, which commands need earlier output, the approval stop before an uplift fan-out, a version placeholder that named arguments left unusable, a reference to a README section that does not exist, and a few counts and step references. No new steps or options.
2026-09-24code-modernization: extract-rules asks before a large run, with an estimateMorgan Lunt
The command told the model to state the shard count and an estimate before launching, but in live runs on a small system it launched without saying anything: a reply that only mentions the estimate is easy to skip and is not a gate. With more than 12 shards the command now requires an AskUserQuestion that carries the shard count, the line count and the estimate (agents, tokens, minutes) and offers to run all shards, run only a slice, or cancel. With 12 shards or fewer it launches straight away and says what it launched. The estimate is now a working formula (10 to 15 agents per shard, about 16k tokens per agent, about 8 agents finishing per minute) with the two runs it comes from: 4 shards used 58 agents in under 10 minutes, and a 44-program, 30,000-line estate used 466 to 647 agents.
2026-09-24code-modernization: preflight checks that legacy/ is protected from editsMorgan Lunt
The commands are written never to edit legacy/, but nothing checked that anything enforced it. Preflight now has a Check 7 that reads, without changing anything, the project's .claude/settings.json and .claude/settings.local.json and the user's settings file, and looks for an Edit deny rule that covers legacy/. The result is a row in PREFLIGHT.md with the same status marks as the other checks: a green row names the file and the rule, and a warning prints the settings snippet to add. The check never edits a settings file and never suggests loosening one. The check also says plainly that a permission rule covers the file tools and the shell commands the CLI recognizes, not a script that opens the files itself, so a green row is not a guarantee. A read-only mount, or a sandbox that blocks writes to legacy/, is. The README no longer says the settings file enforces the invariant: the commands keep to it by convention and the rule backs that up.
2026-09-24code-modernization: harden-scan reports the coverage it lost instead of ↵Morgan Lunt
dropping it When a verifier agent died, harden-scan dropped its finding: the finding was neither confirmed nor refuted and nothing in the result mentioned it. When a finder agent died, its whole vulnerability class vanished the same way, so a class nobody scanned looked like a class that was clean. Both also flattered the false-positive rate, which was divided by every finding, judged or not (issue #6109). The workflow now pairs each result with its input by position. Finder classes that returned nothing come back as deadFinders, findings no refuter judged come back as unverified with a reason, and both are counted in stats. Neither is in findings, so what counts as confirmed is unchanged, and the false-positive rate is refuted over judged findings. When nothing dies the result is identical to before. modernize-harden now writes a Coverage gaps section under the scorecard in SECURITY_FINDINGS.md that names the classes not scanned and the findings not judged, and offers to re-run just those. The workflow takes them back as optional classes and findings arguments and reports its own gaps the same way. The agent estimate now states the formula from the code (5 finders, one refuter per distinct finding, one second judge per finding still Critical or High) instead of a fixed range.
2026-09-24code-modernization: put flags after the positional argumentsMorgan Lunt
assess and harden said --show-secrets could appear anywhere and that the system dir was the first non-flag token. Since the commands declare named arguments, $system is filled with the first token, so "--show-secrets carddemo" puts legacy/--show-secrets into every path template, and harden's workflow rejects a system name that starts with a dash. The old rule contradicted how the arguments bind. The usage text now says flags go after the positional arguments, and the README shows --show-secrets in that position on the assess and harden usage lines. assess --portfolio keeps its mode flag first. No parsing logic is added. A flag-first invocation now gets a request to run again in the right order, where a model used to work out the intent on its own.
2026-09-24code-modernization: describe each node on the topology mapMorgan Lunt
After topology.json is built, map now writes one paragraph (55 to 90 words) per node into a description field: what the node does in business terms, then what it calls, reads, writes or is called by. Each writer gets only that node's source excerpt, header comment and connections from the map, is told every name and number must come from that data, and says so in one sentence when the data is thin. The session checks the paragraphs against those packets before merging them, and writers never write files. Writers run in parallel batches of about 8, and --no-describe skips the step. The viewer's sidebar shows the description under the size and language line with a muted caption, inserted as text rather than markup because it is derived from analyzed source. Nodes without a description, and topology.json files written before this change, render exactly as before.
2026-09-24code-modernization: preflight asks its questions in a pop-up and proves the ↵Morgan Lunt
target stack The five Check 0 questions were left to the model to ask in chat, where they were easy to skip, paraphrase or answer on the person's behalf. They are now asked with AskUserQuestion, questions 1-4 in one call and the fifth in a second, each with a "Don't know" option and room for free text, and never in chat text. Checks that do not depend on the answers may run while the pop-up is open, and a question that is never answered still lands in the report as an open item. Every answer is recorded verbatim in an Answers section of PREFLIGHT.md, which the brief reads. The command declared a target_stack argument but never used it. Check 3b now builds a throwaway project on the target stack (restore, build, one passing test) so a target that installs but cannot build here is caught before transform or uplift starts.
2026-09-24code-modernization: keep RULE-NNN headings and the rule-render scriptMorgan Lunt
A run numbered rules with domain-coded ids (BR-D7 and similar), which broke the tools that find rules by their RULE-NNN heading. The Rule Card section now says the heading is exactly that form, numbered sequentially. The script that renders BUSINESS_RULES.md and DATA_OBJECTS.md from the workflow result was being written to /tmp, so the documents could not be regenerated. It is now saved as analysis/<system>/render_rules.py, next to the result it reads.
2026-09-24code-modernization: extract-rules per-module shards, resume and coverage gapsMorgan Lunt
Extraction now shards by module: one extractor per module, in ordered batches, so each agent reads a small slice instead of the whole estate. The command builds the module list from analysis/<system>/topology.json when it exists (otherwise from the directory tree), states the shard count and an agent estimate before launching, and documents how to resume an interrupted run with resumeFromRunId and how to re-run only the shards that failed. The workflow stays inside the runtime's agent cap and reports coverage gaps (skipped, failed and unverified shards) instead of returning a partial catalog without saying so. The estimate paragraph carries what was observed on a 44-program, 30,000-line system: 466 to 647 agents, about 8.8M tokens, 50 to 80 minutes. Module-mode extractors cite paths relative to legacy/<system>/, like the lens-mode extractors.
2026-09-24code-modernization: extract-rules citation paths and categoriesMorgan Lunt
2026-09-24code-modernization: named arguments and namespaced command namesMorgan Lunt
Positional placeholders are zero-based ($0 is the first argument), but every command used $1 for the first one, so arguments arrived shifted: modernize-preflight carddemo java-spring analyzed legacy/java-spring. Each command now declares its arguments in frontmatter (for example `arguments: system module target_stack`) and uses the names. A missing optional argument now expands to an empty string instead of a literal placeholder. Plugin commands resolve only by their namespaced name, so the README, command cross-references, agents, workflow descriptions and the topology viewer now say /code-modernization:modernize-*. The extract-rules workflow is renamed modernize-extract-rules-mine. It shared the command's name, so invoking the command could start the workflow directly and skip the command's instructions. Commands launch workflows by script path, so nothing else changes.
2026-07-08code-modernization: pilot-first uplift migration, brief-driven execution, ↵morganl/code-mod-experiment-firstMorgan Lunt
deeper preflight /modernize-uplift migrates one representative project end-to-end and writes its lessons to analysis/<system>/PLAYBOOK.md before touching the rest. The remaining projects then fan out through a new uplift-migrate workflow, one uplift-migrator agent per project, in dependency-aware escalating batches behind a per-batch circuit breaker. A recorded per-test baseline (analysis/<system>/BASELINE.md) gates the migration, and the delta catalog reports a test framework whose runner does not support the target as its own highest-blast-radius dependency. The three execution commands (uplift, transform, reimagine) read MODERNIZATION_BRIEF.md and treat their phase's scope and entry and exit criteria as gates, so editing the brief steers execution. For a same-stack uplift the brief requires the delta catalog and applies the same ordering overrides the execution command does. /modernize-preflight opens with a short interview (scope, local build and test, bespoke build infrastructure, prior attempts, what is off limits) without blocking on the answers, reads the CI/build definition for how the system builds, escalates the smoke test to a whole-project restore and build, and adds a scope-boundary check that enumerates inbound and outbound dependencies when the system directory is a slice of a larger repository. Workflow scripts accept args delivered as either a JSON string or an object.
2026-06-10code-modernization: simplify README; give uplift its own modernized/ rootcodemod-dynamic-workflowsMorgan Westlee Lunt
Adversarial re-audit of the current (post-uplift) state found the plugin internally consistent (no blocker/high issues). Two follow-ups: README rewrite for clarity (209 -> 122 lines, ~halved): - Reorder so a newcomer goes what-it-is -> install -> quickstart -> command reference -> deeper notes, instead of hitting two dense design essays before the command list. - Lead with what it produces; add a 3-command teaser. - Collapse the 'Dynamic workflow orchestration' and 'Untrusted code & prompt injection' essays and the COCOMO note into short, plain sections at the bottom; drop the internal 'Bash isn't a tool-lock' hedging and per-defense enumeration (kept the load-bearing points: untrusted-code threat model, secrets quarantine, COCOMO-is-not-a-timeline). - Remove cross-section redundancy (build methods, read-only caveat, scaffolder write-scope, dir convention each stated once now); gloss strangler-fig/JOBOL inline. Path nit from the audit: uplift now writes to modernized/<system>-uplifted/ (mirroring reimagine's -reimagined/) so the three build paths occupy disjoint roots and status can't mis-detect an uplift copy as transform modules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-09code-modernization: fix findings from adversarial auditMorgan Westlee Lunt
Code/security: - extract-rules.js: guard null agent() verdicts in the verify + P0 loops (a skipped/dead referee made {rule,v:null} survive .filter(Boolean) and then crashed on v.injectionSuspected / v.every) — sibling scripts already had the guard. - topology viewer XSS: the map injector embedded untrusted JSON (node names from filenames, etc.) into a <script> island unescaped — a name containing </script> executed on open. Escape < > & in the injected data and add a CSP to the template. - Second-order injection: citation/identifier fields (source / cwe / source_site / correctedSource) were interpolated UNFENCED into the verifier prompts that are supposed to be the trust anchor. Fence them in extract-rules, harden-scan, uplift-deltas. uplift design (audit of the new feature): - Working-copy model: copy the WHOLE solution to modernized/ once and edit in place (relative project refs survive; result is a reviewable git diff) — the incremental per-project copy broke multi-project builds. - Dual-run honesty: reframed as 'if both runtimes run here' (net48 needs Windows; JUnit/pytest don't multi-target); dummy-test gate now binds a real SUT under both targets; per-stack harness notes. - Tooling honesty: present/runnable/actually-ran distinction; never fold in a tool that couldn't run; apiport/2to3 demoted; py2->3 removed from 'preserve' examples. - Delta classes: name the high-blast-radius landmines (JPMS strong encapsulation, .NET trimming/AOT, ICU globalization, hosting/runtime-config, analyzer/nullable) in the finder briefs + agent. - Rewrite-vs-uplift signal: weigh by touched sites (siteCount), not delta-card count; judgment-share demoted to secondary. Docs/consistency: brief reads topology.json (not TOPOLOGY.html); README 'five commands'; credential-masking claim split (analysts mask+cite vs code-writers substitute fakes); read-only/write-scope claims softened to match enforcement (Bash retained -> discipline, not tool-lock); reimagine nested blockers/pendingRuleIds; status splits transform vs reimagine markers; portfolio enumeration basenames; plugin.json description updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-09code-modernization: add /modernize-uplift for same-stack version migrationsMorgan Westlee Lunt
Adds a third build method alongside transform (cross-stack rewrite) and reimagine (greenfield): uplift, for same-stack version bumps (.NET Framework 4.8 -> .NET 8, Spring Boot 2->3, Python 2->3) where the right move is to PRESERVE the code and fix only the version deltas, not extract intent and rewrite. - commands/modernize-uplift.md: delta-catalog-driven, dual-target test harness (one suite on both runtimes; baseline-on-old is the oracle), leaf-first build graph ordering, minimal-diff discipline (architecture-critic flags gratuitous divergence), and a 'this is a rewrite, use transform' escape hatch. - agents/version-delta-analyst.md: finds the source->target breaking changes that THIS code hits; drives the ecosystem migration tool (upgrade-assistant / OpenRewrite / pyupgrade / ng update) and owns the residue; read-only. - workflows/uplift-deltas.js: parallel finder per delta category, each verified against the cited code so deltas that don't apply here are dropped. - Wired into assess (recommended-pattern routing), brief (per-phase command + leaf-first ordering), preflight (dual-run + tool readiness), status, README. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-09code-modernization: COCOMO is a complexity index, never a modernization timelineMorgan Westlee Lunt
COCOMO's constants encode human-team productivity; presenting its person-months as how long an agentic modernization will take (or cost) is a claim we should not make. Reframe COCOMO everywhere as a RELATIVE complexity/scale index for ranking and sequencing systems only: - assess: capture COCOMO as a complexity index; explicitly ignore scc's 'Estimated Schedule Effort' and cost-in-dollars; ASSESSMENT 'Effort Estimation' section becomes 'Relative Scale' with a not-a-timeline note; portfolio heat-map column renamed Complexity (COCOMO index). - brief: phase plan uses relative T-shirt sizing, not person-months/weeks; phases render as a dependency flowchart, not a gantt (gantt = calendar). - portfolio-assess.js: field cocomoPm -> complexityIndex; return label carries the not-a-duration caveat. - README: 'A note on COCOMO' explains the index framing and points at better intrinsic-complexity proxies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-09code-modernization: second-order injection fencing, path guards, scoped ↵Morgan Westlee Lunt
scaffolder agent Addresses automated security review of the workflow conversion: - Agent-produced text (rule specs, finding descriptions, dedup lists) is fenced as untrusted data when interpolated into downstream agent prompts, with embedded fence markers stripped so the fence can't be escaped; referees and judges are told to re-derive claims from the cited code. - system/service/subdir names that land in filesystem paths inside prompts are validated against a strict pattern — traversal-shaped values throw before any agent spawns. - Reimagine scaffolding now uses a dedicated 'scaffolder' agent with an explicit minimal tool list, a single-directory write scope, and the untrusted-content discipline extended to the generated spec/architecture docs it builds from (they derive from untrusted legacy code). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-09code-modernization: dynamic workflow orchestration + untrusted-content hardeningMorgan Westlee Lunt
Four commands gain a Workflow-tool path (with direct-fan-out fallback for older builds): extract-rules loops until dry with per-rule citation referees and a P0 two-judge panel; harden runs class-scoped finders with adversarial per-finding refutation; assess --portfolio pipelines one survey agent per system with COCOMO computed uniformly in script; reimagine Phase E drops the 3-service scaffolding cap. Workflow agents return schema-validated data and only the orchestrating session writes artifacts — analysis agents are structurally read-only. All five agents gain an untrusted-content discipline section (source code is data, never instructions; comment-only claims are findings, not facts), and the README documents the prompt-injection threat model for analyzed code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-09Merge pull request #2467 from anthropics/morganl/code-mod-secrets-redactionMorgan Lunt
code-modernization: never write discovered credential values into findings
2026-06-09code-modernization: legacy toolchain is advisory, not a transform blockermorganl/code-mod-interactive-mapMorgan Lunt
Legacy code often cannot build locally by nature — CICS/IMS programs have no local translator and the real runtime may be a mainframe the user doesn't have. Stopping transform on a failed legacy smoke compile would block exactly those systems. - transform Step 0a: the target toolchain remains required (its tests cannot run without it); a failed or impossible legacy compile no longer stops the run — the equivalence strategy switches to recorded traces / golden-master fixtures, and that downgrade is stated in the plan and in TRANSFORMATION_NOTES.md so reviewers know the strength of the proof - preflight: a red legacy toolchain now yields Ready-with-gaps for transform/reimagine instead of Not-ready
2026-06-09code-modernization: vendor d3, viewer robustness, status command, pipeline fixesMorgan Lunt
Viewer (assets/topology-viewer.html): - inline a minified d3 subset (hierarchy/pack, zoom, selection, interpolateZoom, ease; ISC license) instead of loading from a CDN — the page is now fully self-contained and works on air-gapped networks - handle duplicate node ids (unique-suffix; edges bind to the first occurrence) and store parent references directly, fixing level-of-detail and selection corruption with messy generated data - share one reveal rule between drawing, edge culling, and hit-testing so edges no longer draw into collapsed containers - pre-bucket edges by kind and keep a per-node adjacency map; the hover/selection pass no longer scans every edge each frame - cancel in-flight fly-to animations when a new one starts; clamp fly-to zoom to the zoom extent; derive max zoom from the smallest leaf so deep estates stay reachable - render dead-end candidates (new deadEnds field) with a dashed outline and a sidebar badge - clicking a node during a flow walkthrough exits the walkthrough; search results clear on selection and Escape; surrogate-safe label truncation; clearer stats line; explicit empty-topology message Commands: - new /modernize-status: read-only progress report — artifact inventory with timestamps, staleness flags, secrets-hygiene checks, next step - map: deadEnds in the topology schema; datastore names must be logical identifiers with credentials stripped from URLs/DSNs - brief: read topology.json + .mmd files (not the interactive HTML); staleness check against inputs; effort unit aligned to person-months - transform: secret-safe characterization-test prompt; diff -y fallback when delta is missing; credential-safe diff selection - reimagine: target vision is everything after the first argument (was silently truncated to one word); masking rules in spec/scaffold/ handoff prompts - brief/transform/reimagine: human-approval gates phrased as explicit stop-and-wait instead of 'enter plan mode' - preflight: delta in the tool table; brief added to the verdict list - README: preflight/status in the workflow; legacy/ deny list also covers Write; plugin + marketplace descriptions updated
2026-06-09code-modernization: harden topology viewer and template injectionMorgan Lunt
Fixes from an adversarial review of the new viewer: - pin d3 to 7.9.0 and load it via dynamic import with an explicit error panel when the CDN is unreachable (previously a blocked CDN produced a silent dark page — a real concern for restricted networks) - coerce ids/names/loc at intake: a single missing name or non-numeric loc previously threw inside the render loop or propagated NaN through the pack layout, blanking the canvas with no error - normalize flows/steps/edges defensively (null entries, missing steps, numeric ids vs string lookups) - mirror the level-of-detail reveal rule in the hit test so clicks can't select nodes that aren't drawn - scope the Escape shortcut so clearing the search box doesn't reset the viewport; set zoom clickDistance(4) so trackpad jitter doesn't swallow selection clicks - round canvas backing-store size (fractional devicePixelRatio caused a reallocation every frame on 125%/150% display scaling) - modernize-map: use braced ${CLAUDE_PLUGIN_ROOT} so substitution actually happens, assert the injection marker exists in the template, and correct the documented failure mode
2026-06-09code-modernization: interactive topology map, preflight command, persona flowsMorgan Lunt
modernize-map previously rendered the call graph and data lineage as static Mermaid diagrams, which become unreadable once a node has ~10+ edges — exactly the shape of real legacy systems. It now builds an interactive viewer from a shipped template (assets/topology-viewer.html): a zoomable circle-pack of domains/modules sized by LOC, rendered to canvas with level-of-detail reveal, dependency edges with per-kind toggles, search with fly-to, a per-node detail sidebar, and a flow walkthrough mode. Small domain-level .mmd exports remain for docs. - topology.json now has a documented schema (hierarchy + edges + entry points + observations + flows) consumed by the viewer - map traces 2-4 business flows anchored to personas (claimant, operator, auditor), each step in plain business language mapped to the modules that implement it; the viewer plays them as numbered paths - brief gains a Business Walkthroughs section connecting each persona flow to the phase that replaces it - new modernize-preflight command: detects the stack, checks analysis tooling, smoke-compiles a real source file with the legacy toolchain, inventories missing copybooks/descriptors/binary-only artifacts, and writes a per-command readiness verdict - transform now verifies legacy + target toolchains before its plan gate instead of failing at test time - README: commands updated, optional-tooling section reframed as 'what to give Claude'
2026-06-09code-modernization: assess writes the full quarantine ignore setmorganl/code-mod-secrets-redactionMorgan Lunt
assess only added SECRETS.local.md to analysis/.gitignore, leaving *.local.patch uncovered until harden's own Step 0 ran. Both patterns are now written by whichever command runs first.
2026-06-09code-modernization: close remaining credential-leak pathsMorgan Lunt
A red-team pass found four ways credential values still reached shareable artifacts after the initial redaction: - the remediation patch: a diff removing a hardcoded secret carries the raw value on its '-' lines by construction. harden now splits output: non-credential hunks in the shareable security_remediation.patch, credential hunks in a gitignored security_remediation.local.patch with comment-only placeholders in the shareable file - the other four agents had no secret-handling rules. legacy-analyst (hardcoded-config evidence in tech-debt findings), business-rules-extractor (credentials recorded as rule parameters), test-engineer (legacy literals becoming committed test fixtures), and architecture-critic (quoted code in notes files) now all mask values and cite file:line; assess's tech-debt prompt and ASSESSMENT.md masking now cover every section, not just Security Findings - non-git projects: a .gitignore protects nothing under SVN/Mercurial. Both commands now refuse --show-secrets without git and write the quarantine file to ~/.modernize/<system>/ outside the project tree - the patch-apply instruction was wrong in both documented layouts (symlinked legacy/ broke relative paths). Patches are now written with project-root-relative paths and applied from the project root Also: --show-secrets is now position-independent in both commands, and the README documents the full model.
2026-06-09code-modernization: never write discovered credential values into findingsMorgan Lunt
Legacy systems often contain live credentials, and assessment/findings files get committed and shared. Previously the security-auditor agent reported hardcoded secrets verbatim into ASSESSMENT.md and SECURITY_FINDINGS.md. - security-auditor: mandatory secret-handling rules — mask all credential values (file:line + 2-4 char preview), redact secrets from echoed tool output, recommend rotation for anything that looks live - assess/harden: gitignore-verified SECRETS.local.md quarantine file for the per-credential inventory; findings files get masked entries and a pointer only - new --show-secrets flag opts into raw values in the quarantine file (and only there) - README: document the behavior and advise users of earlier versions to check for already-committed findings and rotate
2026-05-11code-modernization: harden writes a patch instead of editing legacy; make ↵morganl/code-modernization-pluginMorgan Lunt
map/security guidance language-agnostic - modernize-harden: never edits legacy/ anymore. Writes findings plus a reviewed unified diff to analysis/<system>/security_remediation.patch. A second security-auditor pass reviews each hunk (RESOLVES / PARTIAL / INTRODUCES-RISK) before presenting. The user reviews and applies the patch deliberately, then re-runs to verify. This makes every command consistent with the recommended deny Edit(legacy/**) workspace setting, so the README's exception note is gone. - modernize-map: restructure the parse-target list around three stack- agnostic principles (dispatcher targets are variables; code-storage joins live in config; entry points live in deployment descriptors), with COBOL/Java/web/CLI examples on equal footing rather than COBOL-dominant. Same protections against false dead-code findings, less stack-specific. - security-auditor agent: rephrase coverage items in stack-neutral terms (record layouts/temp datasets, resource ACLs, deployment scripts/job definitions, batch input records) so the checklist reads naturally for COBOL, Java EE, .NET, and web targets alike. - README: drop the harden exception note; describe the patch workflow.
2026-05-11Harden code-modernization plugin from a real CardDemo dry runMorgan Lunt
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-11Fix code-modernization plugin: align README with commands, fix pipeline gapsMorgan Lunt
- modernize-brief: read TOPOLOGY.html (what modernize-map actually produces) instead of nonexistent TOPOLOGY.md, and tell the user which command produces each missing input. - README: rewrite the Commands section to match actual command behavior — correct output filenames, ordering (brief is the synthesis/approval gate after discovery, not the first step), agent attributions, and required args. Add a workspace-layout note and an explicit callout that modernize-harden edits legacy/, which conflicts with the recommended deny rule. Reconcile the Overview and Typical Workflow sequences. - modernize-assess: generalize the production-runtime overlay step so it no longer assumes a specific MCP server/tool; mark it optional. Fix app/jcl/ -> legacy/$1/jcl/ for layout consistency. - modernize-map: make TOPOLOGY.html self-contained (load Mermaid from a CDN) so it renders in any browser; drop assumptions about an external artifact renderer. Generalize the telemetry annotation note. - business-rules-extractor agent: fix command cross-reference to the actual command name. - plugin.json: include the brief step in the workflow description.
2026-04-24Add code-modernization pluginMorgan Westlee Lunt
Structured workflow (assess → map → extract-rules → reimagine → transform → harden) and specialist agents (legacy-analyst, business-rules-extractor, architecture-critic, security-auditor, test-engineer) for modernizing legacy codebases into current stacks.