modernize-extract-rules
Extract the business rules embedded in the system into a structured, testable
specification: the institutional knowledge that is locked in code and in the heads of
engineers about to retire. If a module pattern was given ($module_pattern), focus
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. If legacy/$system does not exist, stop and say so: nothing can run without the code, so the fix is /code-modernization:modernize $system --source <path to the code>. 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)
This command is your authorization to run it. Extraction is sharded per module, so
each extractor reads a small slice (whole-estate passes miss the tail and their contexts
balloon); each rule's file:line citation is verified by a referee agent; and every P0
rule is confirmed by a two-judge panel before it can anchor the behavior contract.