atomic agent
Manage AI agent integration for automatic turn-level recording with full provenance.
Synopsisโ
atomic agent <SUBCOMMAND>
Descriptionโ
The agent command manages integration with AI coding agents โ Claude Code, Gemini CLI, and OpenCode. When enabled, every agent turn is automatically recorded as an Atomic change with full provenance, and every session produces a provenance graph (causal decision DAG) and an attestation (session-level audit node).
No daemon required. Each hook invocation is a standalone process that opens the repo, does its work, and exits.
Subcommandsโ
enableโ
Install agent hooks for turn-level recording.
# Auto-detect which agent is present
atomic agent enable
# Specify the agent explicitly
atomic agent enable --agent claude-code
# Force reinstall (removes existing hooks first)
atomic agent enable --force
# Install for all detected agents
atomic agent enable --all
Options:
| Option | Description |
|---|---|
--agent <NAME> | Target a specific agent: claude-code, gemini-cli, opencode |
--force | Remove existing Atomic hooks before reinstalling |
--all | Install hooks for all detected agents |
--global | Install hooks globally (all projects) |
What it does:
- Claude Code โ Writes hooks into
.claude/settings.json - Gemini CLI โ Writes hooks into
.gemini/settings.json - OpenCode โ Copies plugin to
.opencode/plugins/atomic/
disableโ
Remove agent hooks while preserving non-Atomic hooks.
# Disable for auto-detected agent
atomic agent disable
# Disable for a specific agent
atomic agent disable --agent claude-code
Options:
| Option | Description |
|---|---|
--agent <NAME> | Target a specific agent |
statusโ
Show agent integration status.
# Show status
atomic agent status
# Show verbose status with session details
atomic agent status --verbose
Options:
| Option | Description |
|---|---|
--verbose, -v | Show session details, turn history, and watcher state |
Output includes:
- Installed agents and hook status
- Active sessions with turn counts
- File watcher state
- Recent recording history
explainโ
Generate AI reasoning summaries for recorded agent turns.
# Explain the most recent session
atomic agent explain <session-id>
# Explain a specific turn
atomic agent explain <session-id> --turn 3
# Explain all turns and save reasoning + learnings
atomic agent explain <session-id> --all --save
Options:
| Option | Description |
|---|---|
--turn <N> | Explain a specific turn number |
--all | Explain all turns in the session |
--save | Save reasoning into the change's unhashed section and append learnings to the agent's context file |
When --save is used:
- Reasoning is stored in the change (travels on push, rendered in server UI)
- Repo and Workflow learnings are appended to the agent's context file (
CLAUDE.md,GEMINI.md, oropencode.md)
attestโ
List and inspect attestations โ graph-level audit nodes capturing AI cost, token usage, model breakdown, and code change statistics.
Attestations are created automatically at session end. They aggregate data from the provenance entries embedded in each covered change: model name, token counts (input, output, cache read/write), cost in USD, and lines added/removed from the CRDT semantic layer.
# List all attestations
atomic agent attest
# Show details for a specific attestation
atomic agent attest --hash XMJZ3IPF
# Show attestations for a stack
atomic agent attest --stack dev
# Verbose output with model breakdown
atomic agent attest --verbose
Options:
| Option | Description |
|---|---|
--hash <PREFIX> | Show details for a specific attestation (supports prefix matching) |
--stack <NAME> | Filter attestations covering changes in this stack |
--verbose, -v | Show per-model token breakdown and per-change details |
Example output:
$ atomic agent attest
XMJZ3IPF OpenCode ยท claude-sonnet-4-5 ยท 12.4k tokens ยท 3m 42s ยท 2 changes
R3KQP7YN Claude Code ยท claude-sonnet-4-5 ยท 8.1k tokens ยท 1m 15s ยท 1 change
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total: $0.27 ยท 3 changes covered ยท 20.5k tokens
Detail view:
$ atomic agent attest --hash XMJZ3IPF
Attestation XMJZ3IPF
Agent: OpenCode
Session: agent-ses_3781fc7a6ffet5c6r1ILy1BEbv
Changes: 2 changes
Wall time: 3m 42s
Cost: $0.15
Tokens: 12.4k
Code: +116 -8
Model Breakdown:
claude-sonnet-4-5: 3.2k in / 9.2k out ยท $0.15
Changes Covered (2):
ABC12345
DEF67890
Coverage:
dev โโโโโโโโโโโโโโโโโโโโ 2/5 (40%)
How It Worksโ
You prompt the agent โ agent reads, edits, tests โ Atomic records the turn
โ
โโโ Change: "Turn 3: Fix the auth bug"
โโโ Provenance: anthropic/claude-sonnet-4-5, session, turn
โโโ Envelope: timing, files touched, model info
โโโ Provenance Graph: goal โ explorations โ commitment โ verification
โโโ Transcript: conversation (unhashed, redactable)
On Each Turn Endโ
- Status โ ask the repository what changed since the last recorded state
- Add โ track any new files the agent created
- Record โ create an Atomic change with AI provenance metadata
- Provenance โ append a PatchProposal node, convert the accumulated graph to a content-addressed
ProvenanceGraph, and save it to the repository
On Session Endโ
- Attestation โ aggregate model/cost/token data from all covered changes and create a session-level audit node
- Stack restore โ switch back to the user's original stack
Provenance Graph Pipelineโ
Throughout the session, the ProvenanceAccumulator builds a causal decision DAG:
user-promptโ appends a Goal node (the user's intent)after-toolโ appends a classified tool node (Exploration, Commitment, Verification, or Execution) with causal edges inferred from contextstopโ appends a PatchProposal node, converts toProvenanceGraph, saves to.atomic/changes/
The accumulator is persisted to .atomic/sessions/{session_id}/graph.json between hook invocations (each hook is a separate process). Writes are atomic (temp file + rename) to prevent corruption.
Provenance graphs are pushed to remotes alongside changes and rendered in the web UI.
Agent Identityโ
Agent changes are attributed using a +tag email format:
User identity: Lee Faus <lee@atomic.dev>
Agent author: claude+60f5 <lee@atomic.dev>
| Agent | Example Author |
|---|---|
| Claude Code | claude+60f5 <lee@atomic.dev> |
| Gemini CLI | gemini+abcd <lee@atomic.dev> |
| OpenCode | opencode+9876 <lee@atomic.dev> |
Supported Agentsโ
| Agent | Config File | Hook System |
|---|---|---|
| Claude Code | .claude/settings.json | Native hooks |
| Gemini CLI | .gemini/settings.json | Native hooks |
| OpenCode | .opencode/plugins/atomic/ | Plugin-based |
Examplesโ
Enable and work with Claude Codeโ
# Initialize repo and enable agent
atomic init
atomic agent enable --agent claude-code
# Work with Claude Code normally โ turns are recorded automatically
# Check what happened
atomic log
atomic agent status --verbose
# Inspect attestations
atomic agent attest
# Generate reasoning summary
atomic agent explain <session-id> --all --save
Review agent work before promotingโ
# See what the agent changed on its isolated stack
atomic log --stack agent-ses_3781fc...
# Apply specific changes to your stack
atomic apply <change-hash> --to dev
# Clean up the agent stack
atomic stack delete agent-ses_3781fc...
Push agent data to remoteโ
$ atomic push origin
# Changes, attestations, and provenance graphs are uploaded automatically:
# โ Pushed 2 changes
# โ XMJZ3IPF attestation ($0.15, 2 covered)
# โ ABC12345 provenance (7 nodes, 1 change)
Rewind an agent turnโ
# See the turn history
atomic log
# Undo the last turn
atomic revise
See Alsoโ
- Provenance Graphs โ How agent reasoning is captured as causal DAGs
- Attestations โ Session-level audit and cost tracking
- AI Agent Workflows โ Getting started guide
- record โ How changes are recorded
- identity โ Managing user identities
- log โ Viewing change history