infinri/Writ
Governance runtime for Claude Code. Enforces workflow gates at tool time, delivers the engineering rules relevant to the work, and preserves decision provenance across sessions.
What it solves
Large language models are unreliable at following written instructions. A rule in CLAUDE.md or a system prompt is merely advice: the model must find it, keep it in context, and decide when it applies. As context fills or compacts, those instructions fade with no warning. Writ moves selected requirements out of the prompt and into code that runs whenever the agent acts. A source write before an approved plan is refused, not merely discouraged.
How it works
Writ runs as a local companion to Claude Code. Three pieces work together:
- Hooks that Claude Code calls around each tool use (including writes, shell commands, and submission of a prompt).
- A local daemon (
writ serve) that makes decisions about retrieval, session state, and gate checks. - A Neo4j database in Docker that stores rules and records of decisions.
When the agent attempts an action, hooks ask the daemon whether it is allowed. The daemon checks the current mode (conversation, review, investigate, debug, or work) and applies the relevant gates. In work mode, two acceptance gates block the first source write until an approved plan and approved test skeletons exist. Edits to an approved plan re-arm the gates; only a fresh user approval can re-bind them. Credential paths (like .env or .pem) are always refused, and the agent never has the means to approve itself—a single-use token is minted by the user's confirmation and required to advance any gate.
Writ also delivers context: each prompt gets up to five sections of ranked rules, always-on mandatory rules, methodology, decision recall, and project documents. At write time, it adds the rules for that file plus the decision behind its last change. Retrieval abstains when nothing fits well, and only the fixed set of hooks has the power to refuse an action—editing or adding rules never changes enforcement.
Continuity is handled through decision memory. Approving a plan snapshots it; commits link the commit, changed files, and the reasons from the plan. writ recall reads that back into the next session as a briefing. Open questions, project-document ingestion, and compaction handoffs complete the picture.
Who it's for
Developers using Claude Code who want stricter control over agent behavior in real coding workflow, especially those who want to enforce a test-driven or plan-first workflow. It suits teams that must ensure every change has an approved plan and tests before implementation begins, and who want a persistent record of why files changed.
Highlights
- Acceptance gates transform workflow rules into code refusals: an approved plan, then approved test skeletons, then implementation. Drift detection re-arms the gates if the plan is edited after approval.
- User-only approval with single-use tokens; the agent cannot self-approve, and tokenless attempts are logged and blocked.
- Retrieval with abstention — ranked rules are delivered only when the best match clears a cosine similarity threshold (0.30), reducing false injection of irrelevant rules.
- Measured retrieval — hit@5 of 0.929 and nDCG@10 of 0.832 on a gold set of 193 queries, with false injections cut from 20/20 to 4/20 by the abstention gate.
- Decision memory — approvals become snapshots, commits are linked to the plan and rules shown, and the next session begins with a briefing via
writ recall. - Verifyable limits — the README is explicit that Writ constrains a cooperative agent, is not a sandbox, and does not guarantee bug-free code.
Related
- Project
- Project
- Project
- Project