Sessions · index + cross-device
August 10, 2026
Agents do not share a brain. Each conversation is a transcript on disk. agents sessions builds a per-machine SQLite + FTS5 index, then answers filtered queries — locally or on other machines over SSH. Command: agents.
Visual longform: shareable HTML edition. Hands-on recipe: recall and resume.
Not shared memory
When someone asks how agents “share memory” across devices, the honest answer is: they don’t. They query. Claude, Codex, Grok, Kimi each write their own transcripts. AGI CLI is the read API over those files — search, filter, fan out, optionally export.
# Agent mid-turn recall
agents sessions --all --since 7d "secrets unlock" --flat -n 20
agents sessions a1b2c3d4 --markdown --include user,assistant --last 5How indexing works
Each machine maintains ~/.agents/.history/sessions/sessions.db (WAL SQLite):
- Roots — Claude
projects, Codexsessions, Kimi, Droid, … including versioned homes - Incremental scan —
scan_ledgertracks mtime/size; only dirty files re-parse - FTS5 — label-first ranking + BM25 over topic/project/content
- Rebuildable — JSONL is source of truth; the DB is a query cache
agents sessions --roots --json --local
sqlite3 ~/.agents/.history/sessions/sessions.db \
"SELECT COUNT(*) FROM sessions;"Cross-device query
No multi-master memory. Cross-device means: run the same query on the peer over SSH, merge rows tagged by machine.
| Mode | Behavior |
|---|---|
--local | This machine only |
--device zion | Explicit peer(s) over SSH |
| Default list | Fan-out to online fleet from devices registry |
import --from-host | Copy transcripts into a machine-tagged mirror |
sessions sync | Optional R2 CRDT — opt-in, off by default |
Peers answer with AGENTS_SESSIONS_LOCAL=1 so they do not re-fan-out. Unreachable hosts are skipped (or cache-replayed for explicit device queries). Auth is SSH only.
Filters that matter
agents sessions --all --since 7d "auth middleware" --flat -n 20
agents sessions --agent claude --project agents-cli
agents sessions --active --device zion
agents sessions --include tools --agent codex --since 7d
agents sessions a1b2c3d4 --markdown --last 3 --include user,assistantTypical local list/search is sub-second; single-device SSH is often under a second on a healthy tailnet — fast enough for mid-turn recall.
Export / import
Portable NDJSON bundles hand off transcripts without requiring R2 sync. Import lands under a mirror keyed by origin machine; local live sessions are never clobbered. Byte-exact duplicates skip.
agents sessions export --since 7d -o week.bundle
agents sessions import week.bundle --dry-run
agents sessions import --from-host zion --since 7d
agents sessions export --since 7d --stdout --encrypt \
| agents ssh boxB 'agents sessions import - --decrypt'Query never copies files. Import materializes them for offline search later. Neither is shared memory.
Cookbook
# What did zion do this week?
agents sessions --all --since 7d --device zion --flat -n 50
# Resume by id (local index first, then fleet)
agents resume a1b2c3d4
# Team-spawned sessions
agents sessions --teams
# Live across the fleet
agents sessions --active