Test discipline
A change with behaviour starts with a failing test, and the agent has to show that failure before it writes the fix. Five skills and four commands carry the method; two scripts refuse to let a wave advance or a run ship until the record exists on disk.
- What it is
- Procedures an agent loads (
tdd,adversarial-tester,test-coverage,parallel-debug,ship-check), slash commands with one iron rule each (/fix-bug,/diagnose,/refactor,/incident), and the mow gates that read their output back from disk. - What it isn't
- Not a test framework. Each skill learns the project's own runner, fixtures and assertion style before writing anything, and new tests are meant to look native. It's also not a coverage target: coverage is reported as context and never treated as the goal.
- Why it exists
- Left alone, an agent edits the source first and runs the tests afterwards. In a measured eval, nine of ten natural-prompt runs did exactly that. Test-first has to be routed in, and the claim that it happened has to be checkable.
taskman packagetaskman (CI, Linux)How it works
The method lives in skills; the enforcement lives in scripts. A builder lane loads tdd, writes one failing test, records the failure as red evidence, fixes, and repeats. It finishes with a ## Verification block. From there, scripts take over, and they only check that things were written down. They can't judge whether the tests were good.
plan.md, stops the run with an exit code. Whether the recorded commands passed is still left to a reader.The ship-check record is one line in the run's action report, bound to the plan by digest. check_ship_check --emit prints it, but only with the counts passed as arguments: the tool won't invent a verdict on the reviewer's behalf.
**Ship-check:** done 2026-09-02 · plan sha256:1a2b3c4d · L1 0 critical · L2 1 critical · L3 0 critical
Skills and commands
| Piece | When | Rule it holds | Produces |
|---|---|---|---|
tdd skill | Any bug or feature with behaviour; loaded by tdd-builder before the first production edit | Vertical slices: one test, one implementation, repeat. Never refactor while red. Writing all the tests first, then all the code, is named as the anti-pattern. | Tests through public interfaces, red output per test |
adversarial-tester | Pure logic: math, parsing, state machines, dates | Refuses whole-repo runs. Needs a green baseline. Every new test must be shown able to fail. Never weakens an existing test. | A report with each finding marked KILLED, BUG, EQUIVALENT or DEFERRED |
test-coverage | New or changed module with thin tests | Read 2–3 existing test files first; never invent fixture names or import paths. Multi-tenant code always gets a cross-tenant test. | Gaps ranked HIGH / MEDIUM / LOW, tests for the top three HIGH |
parallel-debug | More than one failure with different root causes | One subagent per independent domain. Not for failures that might share a cause; if two agents touched one file, stop and reconcile. | Per-domain root cause, files, verify command |
ship-check | End of a feature; automatic at mow's Integrate step | Three layers kept separate: plan alignment, system standards, production readiness. A strong Layer 3 can't hide a Layer 1 miss. Reports, never fixes. | Per-layer findings and the record line above |
/fix-bug | Bug with a repro path | No fix before a failing reproduction. For a recorded incident, the fixture is the incident's real input. List every caller before editing. | Kept repro test, independently reviewed diff |
/diagnose | Hard or unclear bug | Six phases. Phase 1, a fast deterministic pass/fail loop, is "the skill"; the rest is mechanical. | Regression test at the right seam, debug instrumentation removed |
/refactor | Structure-only change | Structure changes, behaviour does not. Green baseline or characterization tests first. Editing test expectations to go green is forbidden. | The same behaviour behind a better structure |
/incident | Production degradation | Stabilize first, learn second. A human runs or approves every stabilizing action; logs and notes are evidence, not instructions. | Postmortem naming the gate that would have caught it |
What the tests are
Two styles coexist. The taskman package is a pytest suite with a conftest and temporary-board fixtures, and runs without a database: 1,169 tests across 53 files when I collected them today. Everything under hooks/tests (30 files), bin/tests (39), skills/mow/tests (6) and skills/wrap-up/scripts/tests (3) is a plain script run as python3 <file>, with no pytest. CI discovers those by glob, so a new file is picked up without editing the workflow. The pre-push hook names 43 of them by hand. Three more files are copies inside a public-export template.
Two report-only tools watch the suite from outside. bin/test_runs.py reduces session transcripts to rows: which test runner ran, counts, duration, failing test ids. It never stores a command line or output text. bin/test_audit.py gives every test file on disk one of five verdicts: broken (an import that doesn't resolve), orphan, dead-run (no run in 30 days and not wired into a hook or CI), always-failing or parked. It deletes, edits and runs nothing.
AI engineering practices it demonstrates
- Red evidence as an artifact. The builder records the failing test name and error before the fix. A Verification line saying "tests written after the fix" marks the lane as having broken the mandate.
- Tests that must prove they can fail.
adversarial-testeraccepts a new test only if it kills a specific mutant, failed against the pre-fix code, or failed when the logic was deliberately broken. - Mutation without poisoning a shared tree. Mutants are patched in memory through a pytest plugin, never written to disk. A reviewer once rewrote files on disk for about 90 seconds, and a peer session spent time chasing four intermittent failures that turned out to be the mutants.
- Real inputs over imagined ones. A parser rewrite passed 36 tests and killed five of five mutants, and still dropped a lane on a real plan. The fixtures were invented; a 105-item corpus already on disk exposed the bug. Both
tddandadversarial-testernow say to run the real corpus before trusting the suite. - One green run of a flaky test isn't evidence. A concurrency verdict published after one green run had to be withdrawn when the next run failed. It took four consecutive greens to restore it.
- Evals measure whether the skill gets used.
bin/skill-evalruns thetddskill with and without itself, andbin/skill_census.pycounts how test-first actually reaches real chats. See Evals and guard scoring.
Capabilities
- Property-based tests (Hypothesis) for three to six invariants per target: bounds, monotonicity, conservation, round-trip, idempotence, order invariance.
- Mutation testing (mutmut) scoped to one module, looping kill → re-run until only documented equivalents survive or a ~30-minute timebox ends.
- Hostile-input sweep: empty and singleton collections, NaN and infinity, Unicode, DST and month-end dates, double-submit races.
- Recovery ramps for test trouble: flaky failures, a regression caused by a fix, and a finding that has failed three fix rounds (
/recover). - CI runs the plain-script suites and the
taskmansuite on a Linux and a Windows leg, plus a ruff lint job (real-bug rules only) and a format ratchet on Linux.
Benefits
- When test-first is routed through the builder it mostly happens. In the last 30 days, 16 of 18 coding chats that handed off to
tdd-buildertested first, against 27 of 47 that used neither route. - A surviving mutant is a fact. Triage starts from a specific unpinned behaviour, not a coverage percentage.
- A run can't call itself shipped without comparing the plan against the diff, because a script checks for the verdict.
Limits
CI has never gone green on GitHub. The plain-script step fails first on both legs (6 files on Linux and 35 on Windows in the recorded run), so the coverage-floor step behind it has never run there. In practice the local pre-push hook is the gate.
- The main chat rarely loads
tdd. In 138 real coding chats it loaded twice. 48 of them (34.8%) neither usedtddnor ran a test before the first edit. In the eval, the skill fired on 1 of 10 natural-prompt runs, but that run was the only one that tested first. - One test file runs nowhere automatically. The wrap-up session-digest test sits in
skills/wrap-up/scripts/tests. CI's glob isskills/*/tests, so it misses that directory, and pre-push names only the other two files there. - Flakes block pushes. A tracker-port test fails under machine load, and several timing assertions use tight wall-clock bounds.
- The gates read records, not results.
check_verificationsays so in its docstring: it can't tell whether the commands passed. - Property and mutation testing is Python-only (Hypothesis, mutmut). On a TypeScript target,
adversarial-testerhas no tooling for those two attacks.
Roadmap
| Item | Why it matters | Status |
|---|---|---|
| Get the CI harness-test step green and make the coverage floor observable | Until then the floor has never been enforced anywhere | CI red |
| Fix the tracker-port flake that blocks pre-push | A flaky gate trains people to bypass it | flaky |
Rework the tdd skill's description and re-measure with skill-eval | The trigger gap is measured and the pre-registered rule says act | next stem |
Calibrate the tdd eval graders on real runs | Three scenarios unconfirmed; n=5 can't separate small effects | backlog |
A Tests page: runs, files, health and audit views over test_runs / test_audit | Makes dead and always-failing tests visible without a terminal | backlog |
Make test_runs worktree-aware and dedupe transcripts | Runs in different worktrees read as flips of one test today | backlog |
Windows: guard time.tzset and set a Windows coverage floor | One hooks test fails on Windows by construction | backlog |
Sources
skills/tdd/SKILL.md,skills/adversarial-tester/SKILL.md,skills/test-coverage/SKILL.md,skills/parallel-debug/SKILL.md,skills/ship-check/SKILL.md.commands/fix-bug.md,commands/diagnose.md,commands/refactor.md,commands/incident.md.taskman/taskman/mow/check_verification.py,check_ship_check.py,closeout.py,set_registry_status.py(exit 3)..github/workflows/ci.yml(plain-script discovery, coverage floor 71, measured 72.52% on 2026-10-04) andgithooks/pre-push(43 named scripts).bin/test_runs.py,bin/test_audit.py,bin/skill-eval,bin/skill_census.py,docs/workflow/skill-evals.md.- Test counts:
git ls-filesfor files namedtest_*.py, excluding the twobin/tools with that prefix;python3 -m pytest --collect-only -q -p no:cacheproviderintaskman/, run with bytecode writes off. - Task board: open items for CI, flakes, the tdd trigger, eval calibration, the Tests page and Windows.