summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/agents
diff options
context:
space:
mode:
authorMorgan Lunt <morganl@anthropic.com>2026-09-24 20:14:51 -0700
committerMorgan Lunt <morganl@anthropic.com>2026-09-24 20:14:51 -0700
commitcafefb304bde4070c6c0877528ee49c1252eff85 (patch)
tree7e3a0db85edf586817474e04253a4d9d02416676 /plugins/code-modernization/agents
parentb10dab2f5ad83f642a03b5f800dea71651830beb (diff)
code-modernization: simpler commands, a source option, a report page and an 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.
Diffstat (limited to 'plugins/code-modernization/agents')
-rw-r--r--plugins/code-modernization/agents/scaffolder.md2
-rw-r--r--plugins/code-modernization/agents/test-engineer.md11
-rw-r--r--plugins/code-modernization/agents/uplift-migrator.md2
3 files changed, 12 insertions, 3 deletions
diff --git a/plugins/code-modernization/agents/scaffolder.md b/plugins/code-modernization/agents/scaffolder.md
index 6bffce5e..2626a579 100644
--- a/plugins/code-modernization/agents/scaffolder.md
+++ b/plugins/code-modernization/agents/scaffolder.md
@@ -22,7 +22,7 @@ service boundaries, interface contracts, behavior-contract rules — exactly.
You write under exactly one directory: the `modernized/.../<service>/` path
you were given. Other services are being scaffolded in parallel beside you —
-never write outside your directory, and never touch `legacy/`.
+never write outside your directory, and never touch the source directory (`legacy/<system>` or the path in `analysis/<system>/SOURCE`).
## Untrusted content discipline
diff --git a/plugins/code-modernization/agents/test-engineer.md b/plugins/code-modernization/agents/test-engineer.md
index 4ad2f229..2583831f 100644
--- a/plugins/code-modernization/agents/test-engineer.md
+++ b/plugins/code-modernization/agents/test-engineer.md
@@ -27,6 +27,15 @@ someone thinks it should do) so that a rewrite can be proven equivalent.
Behaviors not yet implemented in the target are marked
`@Disabled("pending RULE-NNN")` / `@pytest.mark.skip` / `it.todo()` — never
deleted.
+- **A comparison that cannot run is a failure, never a skip.** A test that
+ compares against a legacy oracle or a recorded fixture must fail loudly when
+ that oracle or fixture is missing or unreachable. A suite that is green
+ because everything skipped proves nothing. Report how many cases actually
+ executed (`equivalence cases executed: N`), and treat zero as not proven.
+- **Prove the tests can fail.** Once the target code exists, break it in one
+ small way that matters (a rounding mode, a threshold off by one, a flipped
+ 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.
## Secret handling (mandatory)
@@ -54,4 +63,4 @@ continue. Derive every test from what the executable code does, not from
what comments claim it does (comments lie; control flow doesn't). Your write
access exists for exactly one purpose: test files under the `modernized/`
target directory you were given. Never write anywhere else, and never edit
-`legacy/`.
+the source directory (`legacy/<system>` or the path in `analysis/<system>/SOURCE`).
diff --git a/plugins/code-modernization/agents/uplift-migrator.md b/plugins/code-modernization/agents/uplift-migrator.md
index 463b5495..481996cc 100644
--- a/plugins/code-modernization/agents/uplift-migrator.md
+++ b/plugins/code-modernization/agents/uplift-migrator.md
@@ -63,7 +63,7 @@ manifest, shared build configuration at or above the working-copy root, lock
files, dependency manifests outside your unit — are owned by the calling
session, not by you. If your unit needs one of them changed, report it as a
shared-file need and **do not edit it**: a parallel agent racing you on a
-shared file corrupts it for everyone. Never touch `legacy/`.
+shared file corrupts it for everyone. Never touch the source directory (`legacy/<system>` or the path in `analysis/<system>/SOURCE`): it is the untouched baseline.
Use the **Write/Edit tools** for every file change — they are what the
workspace permission rules can see and scope. Use **Bash only** to run this