A verification runtime that intercepts AI coding agent file writes, runs them through a configurable verification pipeline, and rolls back atomically on failure.
Project description
Detent โ Verification Runtime for AI Agents
Intercept. Verify. Rollback. A verification runtime that sits between AI coding agents and the filesystem, running every proposed file write through a configurable verification pipeline and atomically rolling back on failure.
The Problem
AI coding agents (Claude Code, Cursor, Codex) are powerful but unpredictable. They can write broken code, introduce security issues, or corrupt your codebaseโall silently, before you notice.
Existing solutions are slow:
- Code review tools require human review (defeats the purpose of agents)
- CI/CD runs tests after code hits the repo (too late to prevent damage)
- Linters in editors are superficial (don't catch logic errors or test failures)
You need a protocol-level verification layer that intercepts tool calls in real time, before they hit the filesystem.
What Detent Does
graph TD
Agent["๐ค AI Agent (e.g., Claude Code, Cursor)"]
subgraph DV["Detent Verification Runtime"]
S1["1. Create SAVEPOINT (checkpoint)"]
S2["2. Run Verification Pipeline:<br>- Syntax check (tree-sitter)<br>- Lint (ruff, ESLint, clippy, go vet)<br>- Type check (mypy, tsc, cargo check, go build)<br>- Test execution (pytest, jest, cargo test, go test)<br>- Security scan (semgrep, bandit)"]
S3["3. Synthesize feedback"]
end
FS[("๐พ Filesystem (protected)")]
Agent -->|tool call: Write src/main.py, content| S1
S1 --> S2
S2 --> S3
S3 -->|โ
passed? โ allow write| FS
S3 -.->|โ failed? โ rollback| S1
Key Features
โ Real-time interception โ Catches bad code before it hits your repo โ Composable verification โ Chain stages: syntax โ lint โ typecheck โ tests โ security โ Atomic rollback โ SAVEPOINT semantics for file operations โ LLM-optimized feedback โ Structured JSON that helps agents self-repair โ Multi-language support โ Python, JavaScript/TypeScript, Go, Rust โ Four agent adapters โ Claude Code, Codex, Gemini (hook-based enforcement); LangGraph (VerificationNode) โ Production-ready โ Security hardened, telemetry, circuit breakers, 366+ tests โ CLI + Python SDK โ Use standalone or integrate with agents
How It Differs
| Feature | Detent | Code Review | CI/CD | Linters |
|---|---|---|---|---|
| Real-time interception | โ | โ | โ | โ (editor only) |
| Prevents bad code | โ | โ | โ | โ (superficial) |
| Atomic rollback | โ | โ | โ | โ |
| Runs tests | โ | โ | โ | โ |
| Agent-aware feedback | โ | โ | โ | โ |
| Multi-language | โ | โ | โ | โ (varies) |
Quick Start
Install
pip install detent
Initialize in your project
cd my-project
detent init
The interactive wizard auto-detects your agent and writes detent.yaml. If you're using Claude Code or Codex, it also registers the hook automatically โ no manual config needed.
Connect Detent to your agent
Detent enforces at the tool execution layer (Point 2) via a pre-execution hook โ this is what blocks writes and triggers rollbacks. It optionally also runs an HTTP proxy (Point 1) for observability.
Claude Code (hook auto-configured by detent init):
detent proxy & # start the proxy (Point 1 โ optional, for observability)
claude # hook is already wired via .claude/settings.json
The hook in .claude/settings.json was written by detent init:
{
"hooks": {
"PreToolUse": [
{
"matcher": "",
"hooks": [{"type": "command", "command": "curl -s -X POST http://127.0.0.1:7070/hooks/claude-code -H 'Content-Type: application/json' -d @-"}]
}
]
}
}
Codex CLI (hook auto-configured by detent init):
detent proxy & # start the proxy (also serves /hooks/codex)
export OPENAI_BASE_URL=http://127.0.0.1:7070 # Point 1 โ optional
codex # hook is wired via .codex/instructions.md
Gemini CLI:
detent proxy & # start the proxy (serves /hooks/gemini)
# Register the BeforeTool hook in your Gemini CLI config:
# curl -s -X POST http://127.0.0.1:7070/hooks/gemini -H 'Content-Type: application/json' -d @-
gemini
LangGraph (no hook โ use VerificationNode instead):
from detent.adapters.langgraph import VerificationNode
graph.add_node("verify", VerificationNode(proxy))
graph.add_edge("agent", "verify")
graph.add_edge("verify", "tools")
Hook vs proxy: The hook (Point 2) is what enforces โ it intercepts each tool call before it executes, runs verification, and returns allow/deny. The proxy (Point 1) is observational only and does not block writes on its own. See AGENTS.md โ Using Hooks vs Proxy for the full breakdown.
Verify a file manually
detent run src/main.py
โ
Syntax: PASS
โ
Lint (ruff): PASS
โ
Type check (mypy): PASS
โ
Tests (pytest): PASS
Verification passed. Checkpoint: chk_before_write_001
If verification fails:
โ Lint (ruff): FAIL
src/main.py:5:1 - E501: line too long
Rolling back to checkpoint: chk_before_write_001
Check session state
detent status
Rollback if needed
detent rollback chk_before_write_001
Architecture
Two-Point Interception
Point 1: Conversation Layer โ HTTP reverse proxy intercepts LLM API traffic
- Detects what the agent plans to do
- Extracts tool calls from LLM responses
Point 2: Tool Execution Layer โ Agent adapters intercept tool calls
- Enforces what the agent is allowed to do
- Creates checkpoint, runs verification, controls execution
Components
- Checkpoint Engine โ SAVEPOINT + rollback (in-memory + shadow git)
- Verification Pipeline โ Composable stages (syntax, lint, typecheck, tests, security)
- Feedback Synthesis โ LLM-optimized structured feedback
- Agent Adapters โ Claude Code, Codex, Gemini (hook enforcement); LangGraph (VerificationNode); HTTP proxy for Claude Code + Codex
- CLI โ
detent init,detent run,detent status,detent rollback - Python SDK โ 27+ public APIs for programmatic use
Use Cases
Solo Developers
- Verify code before committing to main
- Catch mistakes in real time
- Build confidence in agent-generated code
Teams
- Prevent broken PRs from blocking CI
- Faster code review (bad code never lands)
- Enforce quality gates automatically
Research
- Study agent error patterns
- Benchmark verification techniques
- Feedback synthesis for agent improvement
Project Status
Current Release: v1.0.6 (2026-03-25)
โ v1.0 (Production Ready) โ Released 2026-03-16
- Multi-language support: Python, JavaScript/TypeScript, Go, Rust
- Hook adapters for Claude Code, Codex, and Gemini (Point 2 enforcement); LangGraph VerificationNode
- Security scanning (Semgrep + Bandit)
- OpenTelemetry tracing, metrics, and circuit breakers
- Security hardening: path traversal fixes, input validation, HTTP allowlist, dependency audit
- GitHub Actions CI/CD with automated testing and security scanning
- 366+ tests covering all stages, adapters, and checkpoint engine
Latest Updates (v1.0.1 โ v1.0.6):
- Adapter wiring and compatibility fixes (Claude Code, Codex, Gemini)
- Dependency optimization (removed rich runtime dependency)
- HTTP header handling improvements
- Structured logging migration
- Production stability improvements
โณ v2.0 (Enterprise) โ Planned Q1 2027
- Detent Cloud (SaaS platform)
- Multi-agent orchestration
- VS Code extension
- Advanced analytics and insights
Development Phases
| Phase | Component | Status |
|---|---|---|
| 1 | Schema, config, project setup | โ Complete |
| 2 | Checkpoint engine | โ Complete |
| 3 | Verification stages | โ Complete |
| 4 | Verification pipeline | โ Complete |
| 5 | Feedback synthesis | โ Complete |
| 6-8 | Agent adapters, observability, security | โ Complete |
All core features shipped in v1.0. Ongoing work focuses on production reliability, performance optimization, and v2.0 planning.
Documentation
- INSTALLATION.md โ Setup instructions and configuration
- DEVELOPMENT.md โ Developer guide and build instructions
- AGENTS.md โ Architecture, verification stages, adapters, and SDK
- CONTRIBUTING.md โ How to contribute
- SUPPORT.md โ FAQ, troubleshooting, and community
Testing
Detent has comprehensive test coverage:
# All tests (366+ total)
make test
# Unit tests only (fast, no external tool deps)
make test-unit
# With coverage report
make test-cov
Test breakdown:
- 200+ unit tests (syntax, lint, typecheck, tests, security stages)
- 100+ integration tests (full pipeline with real tools)
- 60+ adapter and checkpoint tests
- Security and regression tests
See DEVELOPMENT.md for detailed testing guidance.
License
Apache License 2.0 โ See LICENSE for details.
Community
- GitHub Discussions โ Questions, ideas, show & tell
- GitHub Issues โ Bugs, feature requests
- Security โ Vulnerability reports via GitHub Security Advisories
Made with โค๏ธ for AI-assisted development
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file detent-1.1.0.tar.gz.
File metadata
- Download URL: detent-1.1.0.tar.gz
- Upload date:
- Size: 303.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f9fdc72c8ab3667736a2afe768196ce5582336d93f5acb8482e1808e55b4984
|
|
| MD5 |
63e623f5a8747ffb8c7d9d7fb2327287
|
|
| BLAKE2b-256 |
59ff2626b946349715b01cb19239adf86f1cd7afd3c64c6f3a1840d2b78bfff0
|
Provenance
The following attestation bundles were made for detent-1.1.0.tar.gz:
Publisher:
publish.yml on ofircohen205/detent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detent-1.1.0.tar.gz -
Subject digest:
2f9fdc72c8ab3667736a2afe768196ce5582336d93f5acb8482e1808e55b4984 - Sigstore transparency entry: 1185507080
- Sigstore integration time:
-
Permalink:
ofircohen205/detent@e0a0c3ab39e11776e32b104e26dbde6527c7ce5c -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/ofircohen205
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0a0c3ab39e11776e32b104e26dbde6527c7ce5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file detent-1.1.0-py3-none-any.whl.
File metadata
- Download URL: detent-1.1.0-py3-none-any.whl
- Upload date:
- Size: 128.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aa4cebc26aa9ad3f36da9d3804300eca662815b4b577bc80894a0c64f71f52d
|
|
| MD5 |
742de1565e9f2f3a0e3e41fc11299d5b
|
|
| BLAKE2b-256 |
5065f622d18ea9042ecccc3d2d1e77c25367fe5209920949886249a7a95f5bf0
|
Provenance
The following attestation bundles were made for detent-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on ofircohen205/detent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detent-1.1.0-py3-none-any.whl -
Subject digest:
8aa4cebc26aa9ad3f36da9d3804300eca662815b4b577bc80894a0c64f71f52d - Sigstore transparency entry: 1185507083
- Sigstore integration time:
-
Permalink:
ofircohen205/detent@e0a0c3ab39e11776e32b104e26dbde6527c7ce5c -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/ofircohen205
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0a0c3ab39e11776e32b104e26dbde6527c7ce5c -
Trigger Event:
push
-
Statement type: