开源项目为 Agent 引入 Git 概念,实现行为可追溯和可回溯。对 Agent 应用开发者有直接实用价值。
追踪你的 agent 做了什么,哪个 prompt 写了每一行,以及检查任何步骤。
# Install via Homebrew (macOS/Linux)
brew tap regent-vcs/tap
brew install regent
# Or via Go
go install github.com/regent-vcs/regent/cmd/rgt@latest
# Initialize in your project
cd your-project
rgt init
# Work with Claude Code, Codex, or OpenCode normally — activity is tracked automatically
# See what happened
rgt log
rgt blame src/file.go:42
rgt show <step-hash>
就这样。你的 agent 活动现在可以审计了。
每个 agent 的回合都会自动捕获。不需要手动提交。
$ rgt log
Step a1b2c3d | 2 min ago | Tool: Edit
│ File: src/handler.go
│ Added error handling to request handler
│ + 5 lines, - 2 lines
Step d4e5f6g | 5 min ago | Tool: Write
│ File: tests/handler_test.go
│ Created unit tests for handler
│ + 23 lines
Step f8g9h0i | 8 min ago | Tool: Bash
│ Command: go mod tidy
│ Cleaned up dependencies
$ rgt blame src/handler.go:42
Line 42: func handleRequest(w http.ResponseWriter, r *http.Request) {
Step: a1b2c3d4e5f6
Session: claude-20260502-143021
Tool: Edit
Prompt: "Add error handling to the request handler"
$ rgt sessions
Active Sessions:
claude_code:claude-20260502-143021 | 3 steps | Last: 2 min ago
codex_cli:codex-20260502-091534 | 7 steps | Last: 2 hours ago
$ rgt log --session claude_code:claude-20260502-143021
# Filter history by session
$ rgt show a1b2c3d
Step a1b2c3d4e5f6
Parent: d4e5f6g7h8i9
Session: claude-20260502-143021
Time: 2026-05-02 14:30:21
Tool: Edit
File: src/handler.go
Changes:
+ func handleRequest(w http.ResponseWriter, r *http.Request) {
+ if r.Method != "GET" {
+ http.Error(w, "Method not allowed", 405)
+ return
+ }
- func handleRequest(w http.ResponseWriter, r *http.Request) {
Conversation:
User: "Add error handling to reject non-GET requests"
Assistant: "I'll add method validation to the handler..."
"五分钟前还能用"
"你为什么改了这个文件?"
"回到重构之前"
复制粘贴代码到新的聊天中
rgt log — 这个会话做了什么?
rgt blame — 哪个 prompt 写了这一行?
rgt show — 检查任何步骤的完整上下文
我们给了 agent 对代码库的写入权限。但我们没有给自己相应的 git。re_gent 修复了这个问题。
re_gent 将 agent 活动存储在 .regent/ 中(类似 .git/):
.regent/
├── objects/ # Content-addressed blobs (BLAKE3)
├── refs/ # Session pointers (one per agent)
├── index.db # SQLite query index
└── config.toml
每次使用工具的回合都会创建一个 Step — 一个关于改变了什么、为什么改变以及谁要求改变的内容寻址快照:
Step {
parent: <previous-step-hash>
tree: <workspace-snapshot>
causes: [{ tool_name: "Edit", args: <input>, result: <output> }]
session_id: "claude_code:claude-20260502-143021"
timestamp: "2026-05-02T14:30:21Z"
}
Step 形成一个 DAG。每个会话有自己的分支。公共祖先进行去重。你获得了 git 级别的 agent 活动审计能力。
技术细节:查看 POC.md 了解完整规范。
brew tap regent-vcs/tap
brew install regent
这会安装 rgt 命令并自动为 bash、zsh 和 fish 设置 shell 补全。
go install github.com/regent-vcs/regent/cmd/rgt@latest
# Bash
rgt completion bash > /usr/local/etc/bash_completion.d/rgt
# Zsh
rgt completion zsh > "${fpath[1]}/_rgt"
# Fish
rgt completion fish > ~/.config/fish/completions/rgt.fish
git clone https://github.com/regent-vcs/regent
cd regent
go build -o rgt ./cmd/rgt
sudo mv rgt /usr/local/bin/
从 GitHub Releases 下载预编译的二进制文件
Hooks 在 rgt init 时自动配置。不需要手动设置。
在编辑器中直接获取内联责任追踪注释:
# From VSIX (Recommended)
# Download the latest .vsix from:
# https://github.com/regent-vcs/vscode-regent/releases
# Then in VS Code: Extensions > ... > Install from VSIX...
# From source (Development)
git clone https://github.com/regent-vcs/vscode-regent
cd vscode-regent
npm install && npm run compile
# Press F5 in VS Code to launch Extension Development Host
需求:必须安装 rgt CLI 并在你的项目中运行 rgt init。
查看扩展文档 →
re_gent 补充 git,不替代它。同时使用两者。
查看 ROADMAP.md 了解计划功能,包括:
欢迎贡献!有关指南,请参阅 CONTRIBUTING.md。
QUICK_START.md — 5 分钟设置指南
测试通过:go test ./... 和 go test -race ./...
Linter 通过:golangci-lint run
代码格式化:go fmt ./...
cobra — CLI 框架
blake3 — BLAKE3 哈希
modernc.org/sqlite — 纯 Go SQLite
由贡献者构建
Discord • Discussions • Issues • Technical Spec