Skip to main content

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 ✅ Atomic rollback — SAVEPOINT semantics for file operations ✅ LLM-optimized feedback — Structured JSON that helps agents self-repair ✅ CLI + Python SDK — Use standalone or integrate with agents ✅ Seven agent adapters — Claude Code, LangGraph, Cursor, Codex (http/); Gemini, LiteLLM, OpenAPI (hook/)

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

Quick Start

Install

pip install detent

Initialize in your project

cd my-project
detent init

Interactive setup wizard will ask:

  • Which agent you're using (auto-detected or manual)
  • Policy strictness (strict/standard/permissive)

Verify a file

detent run src/main.py

Output:

✅ Syntax: PASS
✅ Lint (ruff): PASS
✅ Type check (mypy): PASS
✅ Tests (pytest): PASS

Verification passed! File is safe to write.
Checkpoint: chk_before_write_001

If verification fails:

❌ Lint (ruff): FAIL
  src/main.py:5:1 - E501: Line too long

Fix suggested:
  Break line at column 100

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)
  • Feedback Synthesis — LLM-optimized structured feedback
  • Agent Adapters — Claude Code, LangGraph, Cursor, Codex (http/); Gemini, LiteLLM, OpenAPI (hook/)
  • CLIdetent 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
  • 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

Status

v0.1 (Proof of Concept) — Complete

  • Full interception layer
  • Verification pipeline with 4 stages
  • Feedback synthesis
  • 2 agent adapters
  • 211+ tests

v1.0 (Production Ready) — Complete (2026-03-16)

  • Python, JavaScript/TypeScript, Go, and Rust verification stages
  • All 7 agent adapters (Claude Code, LangGraph, Cursor, Codex, Gemini, LiteLLM, OpenAPI)
  • Security scanning (Semgrep, Bandit)
  • OpenTelemetry tracing and metrics, circuit breakers
  • GitHub Actions CI/CD workflows
  • 324+ tests

v2.0 (Enterprise) — Q1 2027

  • Detent Cloud (SaaS)
  • Multi-agent orchestration
  • VS Code extension

Documentation

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

detent-1.0.2.tar.gz (287.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

detent-1.0.2-py3-none-any.whl (119.6 kB view details)

Uploaded Python 3

File details

Details for the file detent-1.0.2.tar.gz.

File metadata

  • Download URL: detent-1.0.2.tar.gz
  • Upload date:
  • Size: 287.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for detent-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3f5199b9bfc93cc39aab935b06000737ea8f7e2efdde34cb2ac50b19489d4a54
MD5 53e9013c737dc41b4731731102d7c5f8
BLAKE2b-256 0ab2b86f0ac25f45ba0abc4691b1687ddda4d1dfeff83abbca596f68bd4f2a57

See more details on using hashes here.

Provenance

The following attestation bundles were made for detent-1.0.2.tar.gz:

Publisher: publish.yml on ofircohen205/detent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file detent-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: detent-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 119.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for detent-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9ed8a0f1f742bdbfc60639ebabbaac64f53f46b964bf29290c86fa6c0ce0af9
MD5 f44727ed6c64ac0a2dd3e1d27a562f92
BLAKE2b-256 ec8a8f822fb98cb8d9175a5f7e461af8b6ea785f795ce6d1b91d359a531eb631

See more details on using hashes here.

Provenance

The following attestation bundles were made for detent-1.0.2-py3-none-any.whl:

Publisher: publish.yml on ofircohen205/detent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page