Three hand-built cases with answer keys, plus a citation checker for runs on real codebases.
bash evals/setup.shCreates ../patternwise-sandbox/{py-orders,js-notify,py-legacy-docs}, each its own git repo.
The answer keys in expected/ are not copied, so the agent cannot see them.
| Case | Language | Tests | What it measures |
|---|---|---|---|
py-orders |
Python | python -m unittest discover -s tests -t . |
classic smells, misused Singleton, name-only Factory, refactoring towards Strategy |
js-notify |
Node ESM | npm test |
recognizing a sound Strategy and over-engineering without inventing patterns |
py-legacy-docs |
Python | none | discipline: characterization tests before any edit; State and Template Method opportunities |
Open the agent inside a case folder and run, in order (Claude Code shown; in Codex use
$patternwise instead of /patternwise):
/patternwise analyze/patternwise suggest/patternwise fix shop/orders.py(js-notify:/patternwise fix src/;py-legacy-docs:/patternwise fix docs/document.py)
The skill is explicit-only. Also check the negative case: a plain "refactor this" prompt must not load it.
Headless:
claude -p "<prompt>" --allowedTools "Bash Read Grep Glob Skill" --disallowedTools "Edit Write NotebookEdit"codex exec -s read-only -o report.md "<prompt>"On Git Bash (Windows) set MSYS_NO_PATHCONV=1, otherwise /patternwise is rewritten into a
Windows path before it reaches the agent. In Codex, escape the dollar sign: "\$patternwise ...".
Compare with expected/<case>.md. Checklist:
- The command picks the right mode;
analyzeandsuggestnever edit. - Every finding has file:lines, severity, evidence and a catalog technique.
- Each pattern gets exactly one verdict: sound / misapplied / name only / over-engineered / uncertain.
- Fix mode presents a plan and waits for approval before editing.
- Tests run before and after each step;
py-legacy-docsgets characterization tests first. - New tests run with the plain command (
python -m unittest,npm test) and the count only goes up. - Behavior unchanged (
git diff+ green tests); nothing edited outside scope (new tests are allowed). - Bugs are reported, not fixed inside the plan (
py-orders: theWELCOME10negative tax). - "Approved" with no plan shown (e.g. a fresh session) gets the plan back, not edits.
- If the tests cannot run, no edits. Codex's Windows sandbox has no Python, so for Codex
the Python cases check this refusal; use
js-notifyto test its Fix steps.
On real repositories (no key), check that every citation and identifier exists:
python evals/check_refs.py report.md path/to/repoReset a case: git -C ../patternwise-sandbox/<case> reset --hard && git -C ../patternwise-sandbox/<case> clean -fd