All work

senior-mode

Open source

Make a coding agent fail its own review

A portable core for coding agents. Hooks that block the failure modes and read the code after every edit, rules that scope by path, and reviewers that run before you see the answer. MIT.

License
MIT
Agents
9, one core plus adapters
Harness
287 cases, run on Linux, macOS, Windows
Dependencies
Nothing to install. Bash, plus your repo's own node or python.
github.com/MaxWynnDev/senior-mode
An agent reports twelve passing tests. The Stop hook blocks the report and asks what red would have looked like. The agent finds the new test was never picked up by the runner, moves it, and the suite reports thirteen.

The work

Coding agents rarely fail by writing code that won't parse. They fail by being confidently wrong in a way that reads well: a test that no runner imports, a suite that reports zero failures because zero ran, a fix whose stated reason is false, an import of a package nobody installed, a call with one argument too many.

senior-mode is the set of hooks, rules and reviewers we run on our own work, extracted and made portable. It enforces at the tool boundary: the agent gets blocked, gets told why, and has to come back with evidence.

What v7 reads

Until v7 the hooks watched how the agent behaved and never opened the file. Now a hook reads each file right after the edit. It blocks on an import that names nothing, a named import the module doesn't export, a call to one of your own functions with the wrong number of arguments, and an index that is always one past the end. Then it runs your repo's own type checker on that one file.

An off by one has no syntax, so there's a probe for it. It flips each comparison your diff added, runs the tests, and reports the flips no test noticed.

How it stays portable

One canonical hook contract, then thin adapters per agent. Two shims translate for the agents whose event model differs, and a plugin covers the one that denies by throwing. The 287-case harness runs the same assertions against all of them, on three operating systems, on every push.

The first CI run went red on macOS only. Two shims used a GNU-only sed alternation, so on BSD sed every parsed field came back empty and a deny turned into an allow. That is the exact bug class the doctrine is about: a detector that cannot fail is not a detector.

Built with

  • Bash
  • Claude Code
  • Cursor
  • Gemini CLI
  • OpenCode
  • MIT