Sessions
Every run writes a transcript — prompts, tool calls, responses — to a local store, indexed by content and project. agents sessions searches it across Claude, Codex, Gemini, and OpenCode, replays it, and streams it live.
Search and read
Pass a query to search this project by topic, file path, or command; pass a session id to open one. A filter flag without --markdown/--json defaults to markdown output.
agents sessions "stripe webhook signature" # search this project
agents sessions "deploy script" --all # search every directory
agents sessions a7f3e2c1 --markdown # replay as markdown
agents sessions a7f3e2c1 --include user # just the user turns--markdown renders user, assistant, thinking, and tool calls with secrets redacted by default. Narrow the replay with --include/--exclude <roles> or --first/--last <n> turns. The search reaches across every agent — one query, every CLI's history.
Live sessions
--active shows what is running right now across terminals, teams, cloud, and headless runs, grouped by directory. Each row carries a live state:
- working — the agent is mid-turn, executing tools or generating.
- waiting — it is blocked on your input.
--waitingfilters to just these (and exits non-zero if any exist, so a shell prompt can nudge you). - idle — the session is open but the agent is not doing anything.
agents sessions --active # everything running now, by directory
agents sessions --active --waiting # only sessions blocked on your inputFocus a live session
sessions focus jumps you into a running session — it attaches the terminal the session lives in, or opens a new tab and resumes it. Omit the id for an interactive picker.
agents sessions focus 80289224 # attach or resume a running session
agents sessions focus --attach-only # attach only, never open a new tabStream events
sessions tail follows a session's JSONL events as they are written — one event per line, Claude and Codex only. Start at the end, or replay from the beginning first.
agents sessions tail --latest # follow the most recent session
agents sessions tail a7f3e2c1 --from-start # replay, then follow
agents sessions tail --latest | jq 'select(.type == "user")'Query another machine
--host <name> runs the query on a remote machine's own index over SSH — no sync needed, SSH access is the only auth. Repeat it to fan the same query across several machines. The interactive listing folds in your other online machines automatically; --local keeps it to this box.
agents sessions "auth bug" --host yosemite-s1 # one remote index
agents sessions "deploy script" --host box-a --host box-b # fan out
agents sessions --active --local # this machine onlyAcross devices
History also syncs across the fleet via CRDT merge, so a session started on one machine is readable everywhere. Sessions across devices →
How it works — index, not embeddings
"Agent memory" usually means a vector database: embed every message, hope the nearest neighbor is relevant. Sessions takes the opposite bet. The transcript each agent already writes is the source of truth — agi-cli indexes that text into SQLite full-text search (FTS5, BM25 ranking), with no embeddings anywhere.
Each search compares every transcript file's modified-time and size against a ledger and re-parses only what changed, so the index is current the instant a file is written and a search is a local index lookup — no network call, no model, no re-encode tax. That is why recall is instant, always fresh, and free.
To steer a running agent rather than read a finished one, see Messaging.
Related: Learn: How agents communicate, Messaging, Teams, Cloud dispatch, Sessions across devices.