Recipes

Writ acceptance gates for Claude Code: plan and test-skeleton approval before source writes

From README links · today

Software & DevOpsWork & Operations

Enforced plan and test gates that block Claude Code writes until you approve.

What they did

They installed Writ, a local enforcement layer for Claude Code, and used it to gate a real build session. Instead of trusting CLAUDE.md instructions, they let Writ's hooks intercept each tool use and route decisions to a local daemon backed by Neo4j in Docker. In work mode, the agent's first source write was refused until a plan.md existed with the required sections (Files, Analysis, Rules Applied, Capabilities) and they replied 'approved'. A second gate then required test skeletons before implementation writes were allowed, and a drift gate kept plan.md unchanged after approval. They also ran writ audit-session to record gate events and reviewed the demo of an offline security briefing command being built under these constraints.

How it went

The gates behaved as designed: writes were refused, the agent asked for approval, and phases advanced from planning to testing to implementation only after explicit human replies. The session produced a working command with tests, and the audit log captured each gate event. Enforcement is cooperative rather than a sandbox, so a determined agent or a misconfigured exempt path could still slip through, and the demo explicitly does not guarantee bug-free code.

Worth knowing

Requires Docker for the Neo4j rule store, Python 3.11+, and hook configuration in Claude Code; V2 architecture is documented but unreleased. Gates only constrain a cooperative agent, not a hostile one, and exempt paths plus manual-testing grants can bypass the test gate. Setup detail for the daemon and database is spread across docs/install.md rather than the README.

Wiring

Install Writ (Python 3.11+) and start the Neo4j Docker container that stores rules and decision records. Register Writ's hooks with Claude Code so PreToolUse and related events call the local daemon. The daemon evaluates each attempted write against the active mode, plan gate, test-skeleton gate and drift gate, returning allow, block or ask. Approvals come only from the user's own reply, which the validator checks before advancing the session phase. Use writ mode set <mode> <session_id> when auto-routing misses, and writ audit-session to inspect gate events.

Try it yourself

Set up Writ in this repo for Claude Code. Install the hooks and local daemon, start the Neo4j container, and confirm the mode gate is active. Then run a small task in work mode: write a plan.md with ## Files, ## Analysis, ## Rules Applied and ## Capabilities, show me the refusal when you try to write source before approval, wait for me to reply 'approved', add test skeletons, and finally run writ audit-session to show the recorded gate events.

Source

Tools in this stack

Run this stack

Install the stack into this project. It writes AGENTS.md and the manifest, merges the MCP servers into .mcp.json, and — with --yes — runs the tool installs.

npx runchr install runchr/stack-superpowers-and-writ
No CLI?curl -s https://api.runchr.com/api/recipes/runchr/stack-superpowers-and-writ/manifest

This stack has no prompt yet. You get the tools and the wiring, not the prompt.

The manifest is also at api.runchr.com/api/recipes/runchr/stack-superpowers-and-writ/manifest.