# re_gent

re_gent is a git-shaped version control system for **AI agent activity**. It tracks each tool call an agent (specifically Claude Code today) makes, captures the workspace snapshot, conversation transcript, and tool invocation, then exposes git-like commands (`log`, `blame`, `show`) over the resulting history. The idea is to make agent activity auditable per-prompt, not per-PR.

## How it works

Storage lives in a `.regent/` directory analogous to `.git/`. Each tool call creates a **Step** containing:
- Parent step hash (chains form a DAG)
- Workspace snapshot before/after
- Conversation transcript at that point
- Tool name, arguments, result
- Session ID
- Timestamp

Steps form a directed acyclic graph; each session is its own branch. Storage uses **BLAKE3 content addressing** for deduplication and **SQLite** for the index. Hooks capture Claude Code activity transparently — no separate driver, no manual `rgt commit`.

Critically, the conversation history is preserved across `/compact` operations. So `rgt blame file.go:42` can return not just "step `abc123` wrote this line" but "this prompt at this point in this conversation produced this line." That's the missing primitive for agent-driven engineering: a stable spec→code link that survives context compaction.

## Usage

```sh
brew install regent
rgt init
rgt log              # view step history
rgt blame file.go:42 # which prompt wrote this line
rgt show <step>      # full step context
```

## Status / limitations

- 265 stars at time of ingest, Apache 2.0
- Pre-v1.0; the README describes the codebase as "production-quality at POC-level feature completeness"
- Currently focused on Claude Code; Cursor/Cline adapters planned for later phases
- Planned but not implemented: rewind, fork, multi-tool support
- Not yet integrated with PR workflows — the agent-VCS history is local to the developer, not shared across review

Conceptually adjacent to [[acceptance-criteria-ids]] (acai's spec-back-reference idea) and to [[forge]] (Nesbitt's unified git-host CLI; agents need both forge-level operations *and* an agent-history layer). Solves a real problem named in [[agent-principal-agent-problem]] — when the prompt is the contributor, you need provenance at the prompt grain.

## Watchlist reason

On [[toolbox/watchlist]]: pre-v1.0, single-author, narrow Claude Code coupling, planned-but-not-built core features. Re-check in 90 days for: v1.0 release, Cursor/Cline adapters, integration with PR review tooling, whether other coding-agent ecosystems have shipped similar primitives that obviate it.
