Git for AI Agents: Version Control for Agent Activity

An open-source tool called re_gent brings version control semantics to AI agent workflows, addressing a gap that has become acute as developers delegate more code-writing tasks to Claude and similar systems.

The problem re_gent targets is concrete: when an AI agent modifies your codebase, you have no way to ask "why did you do this?", "which prompt caused this change?", or "how do I rewind to before the refactor?" Agents write code with no audit trail, no blame layer, and no easy path back to a known-good state. The author describes the current workaround as "copy-pasting code into a fresh chat"—a sign the primitives are missing.

re_gent applies three git-like concepts to agent activity. First, every tool call—whether an Edit, Write, or Bash command—is automatically captured as a Step, a content-addressed unit stored with BLAKE3 hashing. Each Step contains the parent step hash, a workspace snapshot, the conversation delta (user prompt + assistant response), what tool was called, and when. Steps form a directed acyclic graph (DAG), allowing multiple concurrent agent sessions to coexist without collision.

The CLI interface mirrors git. `rgt log` shows step history. `rgt blame src/handler.go:42` identifies which step and which prompt wrote line 42, including the exact user instruction and assistant reasoning. `rgt show a1b2c3d` displays full context for any step—the changes, the before-and-after code, and the conversation. `rgt sessions` lists all active agent sessions, and `rgt log --session [id]` filters history by session.

Storage mirrors git's structure. A `.regent/` directory holds objects (content-addressed blobs), refs (session pointers), an index.db (SQLite), and config.toml. The SQLite layer enables sub-10ms queries without subprocess overhead. Conversation data persists even after Claude's /compact or /clear commands, preserving auditability across chat boundaries.

Installation options include Homebrew (macOS/Linux), Go, or building from source. After `rgt init` in a project, every Claude Code tool call is tracked transparently with no manual commits. A VSCode extension is available now and adds inline blame annotations directly in the editor, showing which step modified each line with hover tooltips for full context.

Commands available now include log, blame, show, sessions, status, cat, version, and completion. `rgt rewind` and garbage collection are marked "coming soon." The tool is hook-driven and transparent to the Claude Code workflow, capturing activity without agent modification. Content-addressed storage enables automatic deduplication when multiple sessions perform identical changes.

Source: HN AI Filter
← Back to Daily
Git for AI Agents: Version Control for Agent Activity — 38twelveDaily