Catches your AI coding agent when it games the tests - locked-test hashes, tamper detection.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
An observable autonomy harness for AI coding agents. โ by TokenDrift
keel is an MCP server that gives your coding agent (Claude Code, Cline, โฆ) the tools to run a long task end to end โ without drifting, cheating, or losing its work โ while recording everything it does so you can steer on cost and quality.
You start the task. The agent disciplines itself. You come back to a milestone report.
The name: a keel is the part of a boat you never see โ the spine under the waterline that stops it from being blown sideways by the wind. That's the job.
An agent left alone on a long task tends to do four things you can't see until it's too late:
keel puts a tool on each of these, and the agent calls them itself โ because the rules are injected into its CLAUDE.md at init. Every call emits an event, so the whole run is legible afterward.
A real run on a throwaway calc-kit project โ the agent was told to implement add(a, b) so the locked tests pass, following the keel protocol. This is the actual sequence, unedited:
Then, to show the anti-cheat is real โ we modified a locked test file by hand (simulating an agent tampering to force a green) and ran verify:
tampered: true and passed: true at the same time. keel doesn't confuse "the tests pass" with "the tests are intact" โ it reports both axes separately. An agent can make the suite green by rigging it, and keel still sees it. That distinction is the whole point.
The hard problem with any optional-tool harness: an agent can ignore verify and just run pytest in the terminal, short-circuiting the one mechanism that catches cheating. A polite instruction in CLAUDE.md shapes what the agent tries to do โ it doesn't stop anything.
keel closes this with three layers, on the principle that no single layer is perfect but together no path is simultaneously easy, silent, and untraced:
Persuasion โ the CLAUDE.md block tells the agent, in no uncertain terms, that verify is the only judge and direct test runs are forbidden. Handles the dominant case: an agent that drifts out of negligence, not malice.
A mechanical guard โ init_project installs a PreToolUse hook (keel-guard) into the project's .claude/settings.json. It intercepts pytest, python -m pytest, npm test, yarn test, go test before they execute and refuses them, redirecting the agent to verify. This runs in the Claude Code harness, outside the model's control. On our setup it holds even under --dangerously-skip-permissions (bypass mode skips interactive confirmations, not hooks โ verify on your own machine, see Honest limits).
Tamper-proof attestation โ for anything that slips through, verify emits a hash of the exact working-tree state it judged, and checkpoint only marks a milestone certified if a passing, untampered verify ran against that same tree. A bypass produces an uncertified milestone โ visible in stats and report โ rather than a silent one.
Layer 2 makes the obvious bypass hard. Layer 3 makes every bypass visible. keel certifies what it witnessed; it doesn't claim to make evasion impossible โ and that honesty is exactly what produces the "% certified milestones" signal worth tracking over time.
The golden rule that makes it work: you write the tests, never the agent. verify runs your locked suite and detects any change to it, file by file. If you change the tests yourself, re-run lock_tests (a human action).
keel is plain Python โ one dependency (the MCP SDK, which pulls in FastMCP and pydantic), plus git. It is developed and hardened on Windows, and runs on macOS/Linux.
On Windows the venv activation is .venv\Scripts\activate; on macOS/Linux it's source .venv/bin/activate. Activation is optional if you point your client at the venv's Python directly (below).
Windows example:
Or paste the block from mcp_config.example.json into your client's config (Cline: cline_mcp_settings.json).
Two things that will save you a debugging session:
mcp__keel__*), or the agent's first keel call hangs waiting on an authorization prompt that doesn't always surface.keel-guard hook loads from the current directory's .claude/settings.json with no parent fallback โ it's active when Claude Code runs from where the project lives.keel has two parts, and they have different reach.
The 12 MCP tools are standard MCP โ they work with any MCP-capable coding agent: Claude Code, Codex, Cursor, Cline, Windsurf, Zed, VS Code + Copilot, Continue, Goose, and the Cline forks (Roo Code, Kilo Code). Memory, checkpoints, the anti-tamper verify, attestation, decision logging, cost tracking, and route_task all run anywhere MCP runs.
The keel-guard hook (layer 2) is Claude Codeโspecific. It's a PreToolUse hook in .claude/settings.json โ a Claude Code mechanism that no other client implements today. So:
| Client | MCP tools (layers 1 & 3) | Mechanical guard (layer 2) |
|---|---|---|
| Claude Code | โ Full | โ
Yes โ the keel-guard hook installs and fires |
| Codex, Cursor, Cline, Windsurf, Zed, Copilot, Continue, Goose | โ Full | โ ๏ธ Not installed โ no hook system |
On a nonโClaude Code client you still get the persuasion layer (the injected rules) and, crucially, the attestation layer: a checkpoint that skipped verify still comes out uncertified in stats and report. You lose the mechanical block on direct test runs, but you don't lose visibility โ the bypass is still recorded. That's the proof-regime design paying off: the guarantee that matters (you can always tell whether a milestone was verified) doesn't depend on any one client's hook system.
Claude Code is where keel is fullest and where it's developed and hardened. Other clients are first-class for everything except layer 2.
init_project: creates .keel/, writes the architecture and immutable constraints, locks your test files, initializes git, installs the keel-guard hook, and injects the autonomy rules into CLAUDE.md.load_context at the start of every session, save_progress + checkpoint after each step, verify to validate, log_usage after each model call, record_decision at each architectural choice, report at the end.You come back at milestones, not at every line.
| Tool | Role | Guards against |
|---|---|---|
init_project | Lays the harness (architecture, constraints, test lock, git, hook, CLAUDE.md) | โ |
load_context | Resumption briefing at session start | Context loss |
save_progress | Writes done / doing / todo to disk | Context loss |
record_decision | Append-only log of architectural choices | Architectural drift |
checkpoint | Git commit of the step, with certification | File loss |
verify | Runs the locked tests, detects tampering | Cheating (reward hacking) |
lock_tests | Re-locks the tests (human action) | โ |
check_drift | Recalls constraints, flags unsaved work | Drift |
route_task | Most cost-effective model for a subtask | Cost / data sovereignty |
log_usage | Records real spend of a model call | Cost observability |
stats | Aggregated metrics (cost, cheating, certification, velocity) | Steering |
report | Markdown milestone report for the human | Steering |
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/keel-3)<a href="https://allmcps.com/mcp/keel-3"><img src="https://allmcps.com/api/badge/keel-3?style=directory" alt="Keel on AllMCPs" /></a>