How einsia/agent-git works
agit is a local-first, lossless version-control CLI for AI-agent sessions, with a resident-control-daemon feature. The main workflow adopts or creates a runtime session, records snapshots and turns, then lets users inspect, resume, or publish it. The graph also preserves the README’s search, sharing, clone/run, and remote-control capabilities. Source excerpts establish entry-point dispatch, adapter and storage roles, hub-client behavior, and RC protocol/daemon roles; several command-level connections are documented in the README rather than sampled implementation.
Main entry points: commands/mod.rs Command dispatch · daemon/mod.rs RC daemon · main.rs CLI entry · push.rs Hub commands
Components 23
CLI and terminal
- CLI entry
src/main.rs - Command dispatch
src/commands/mod.rs - Terminal interface
src/tui/mod.rs
Session lifecycle
- Runtime adapters
src/adapter/mod.rs - Agent runtimes
- Session storage
src/domain/storage.rs - Session domain
src/domain/session/mod.rs - Commit and history
src/commands/commit.rs - Import and lineage
src/commands/import.rs - Resume and run
src/commands/run.rs - Inspect sessions
src/commands/show.rs - Session search
src/commands/search.rs
Hub and publishing
- Hub commands
src/commands/push.rs - Hub Git operations
src/hub/git.rs - Hub HTTP client
src/hub/client.rs - AgentGit Hub
Remote control
- RC daemon
src/rc/daemon/mod.rs - Agent harnesses
src/rc/harness/mod.rs - Session RPC types
src/protocol/mod.rs - Peer transport
crates/agit-peer/src/client.rs - Peer controller
crates/agit-controller/src/lib.rs - Tunnel worker
crates/agit-tunnel/src/worker.rs
Other components
- User
Connections 26
- User → CLI entry: invokes
- CLI entry → Command dispatch: dispatches
- CLI entry → Terminal interface: opens
- Command dispatch → Import and lineage: dispatches
- Command dispatch → Commit and history: dispatches
- Command dispatch → Resume and run: dispatches
- Command dispatch → Inspect sessions: dispatches
- Command dispatch → Session search: dispatches
- Command dispatch → Hub commands: dispatches
- Import and lineage → Runtime adapters: reads runtime
- Resume and run → Runtime adapters: installs session
- Runtime adapters → Agent runtimes: reads and writes
- Commit and history → Session storage: saves versions
- Inspect sessions → Session storage: reads history
- Session search → Session domain: queries sessions
- Session domain → Session storage: uses storage
- Hub commands → Hub Git operations: publishes session
- Hub commands → Hub HTTP client: calls API
- Hub Git operations → AgentGit Hub: transfers Git data
- Hub HTTP client → AgentGit Hub: sends HTTP requests
- RC daemon → Agent harnesses: supervises
- RC daemon → Session RPC types: encodes session events
- RC daemon → Peer transport: uses peer transport
- Peer transport → Peer controller: connects controllers
- RC daemon → Tunnel worker: dispatches tunnel work
- RC daemon → AgentGit Hub: streams events