
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
agent-session-reader
Advanced tools
Multi-agent session reader (Claude, Codex, OpenCode, Antigravity, Pi) with MCP server
English | Русский | 中文 | 日本語 | Español
An agent reported "done." There's nothing to check it against.
ai-r reads the session history of any of the five coding agents and lets a
fresh agent cold-check what git can't answer:
Across our own corpus — 1600+ sessions of five agents in 20+ projects — that's how we found 312 risky commands (
rm -rf,curl|sh,git push --force): the agent caught and rolled back two itself; the other 310 ran silently —gitwon't show them.
git shows what made it into the code; ai-r shows whether you can trust
how the agent got there. Read-only: no LLM calls, no network.
The primary mode is MCP: an agent (Claude, Codex, …) calls ai-r directly
and asks about history in plain language. For example — pull the plan the
previous agent settled on, drafts discarded:
Show me the plan from the last session — final only, no intermediate revisions.
→ plan(session=…, kind="final") → get_body(id, shallow=true)
plan: "Migrate auth to JWT: 1) extract the check…"
dropped_drafts: 2 ← two drafts the agent threw away along the way
session: a3f… (claude)
Fast edit attribution — one terminal command, across every agent at once:
ai-r find-file-edits auth.py --since 2026-06-01
2026-06-03 codex auth.py "add a refresh token" edit
2026-06-07 claude auth.py "extract the check into middleware" edit
One cause: every agent writes its history its own way — Claude and Codex in JSONL, OpenCode in SQLite, Antigravity in "brain" directories, Pi in per-project JSONL. Five formats, five layouts — together they don't reconcile.
ai-r folds all five into one read-only interface. Point any agent — or a
script, or yourself — at any session, no matter which tool recorded it. One
query shape per agent; format differences are normalized inside the parsers.
Even with a single agent it works: you audit your own Claude history (or Codex…). The five formats are so your history doesn't break when you switch tools — not a requirement to have all five.
Each item is a trust question from the first screen and the verb that answers it:
dropped_drafts) and checks it against what actually made
it into the edits — catching "did X per plan Y" where Y is no longer that
plan. (plan, session_diff)rm -rf, curl|sh, git push --force) and, from the turns that follow,
sees whether the agent caught it and rolled back — or it passed silently.
(incidents, query tool_kind=bash)> file under codex) that a plain diff misses.
(find-file-edits, find-tool-calls)session_stats with_tokens, aggregate group_by=model)query with_intent)Deterministically, with no second LLM guessing — and honest about the edges:
rm -rf, curl|sh,
git push --force, …). Anything obfuscated (exec(input())) the pattern
won't catch — that's a declared boundary, not a silent miss.ai-r won't infer a silent rollback, it honestly
says "not confirmed".ai-r doesn't decide for you. It lays the plan
entity next to the session's reconstructed edits (session_diff) — the
mismatch is visible to you or a reviewing agent. That's evidence assembly, not
a semantic verdict.Zero LLM calls, read-only — the numbers are reproducible and "confirmed" is never guessed.
/compact erases
the specifics. Instead, open a fresh session: it reads the previous session's
logs and continues from its conclusions, without re-burning context on
what's already been worked out. The original session stays intact — for audit
and search. The new session can run in any agent: the history reconciles
regardless of the tool.ai-r gives you, for AI chats, what you already do with
message history — parsed entities to build a lasting memory of the details
that matter.A handful of cross-agent tools now read more than one agent's history
(jazzyalex/agent-sessions, Dicklesworthstone/coding_agent_session_search,
hacktivist123/agent-session-resume). Almost all are about search and
timeline: find a session, scroll the history.
ai-r goes deeper: it extracts the plan, intent, and authorship as ready-made
entities you build memory on. Search finds text — ai-r answers why.
Technically a search tool could also dig a plan out of a session's text, but it
doesn't hand it back parsed into a single, normalized shape — with ai-r that's
the primary surface.
| Capability | Single-agent viewers | Cross-agent search tools | ai-r |
|---|---|---|---|
| Reads >1 agent's logs | No | Yes | Yes — Claude, Codex, OpenCode, Antigravity, Pi |
| Programmatic surface | Mostly GUI/TUI | Mostly TUI/CLI/app | MCP + CLI + Python SDK |
| Attribution (edit/command → agent + intent) | — | Partial | Yes — find-file-edits / find-tool-calls |
| Audit replay (reconstruct a session's changes, no git) | — | Rarely | Yes — session_diff |
| Plan extraction (final vs draft, normalized) | — | — | Yes — plan |
| Scope | Viewer | Search / resume / memory | Read-only extraction core |
Competitor columns reflect their public docs as of 2026-07; where a capability is unclear we under-state rather than over-claim.
We deliberately don't compete on agent breadth, speed, or TUI richness.
ai-r's wedge is extracting the "why" and structured entities for machine
consumption.
ai-r already reads its own development history — across all five agents. Real
tools run on it (they live separately, on top of its read-only API):
export rounds) — renders a session into a ready handoff doc.These tools are workflow-side, outside this repo. ai-r itself only reads and
returns data.
| Agent | Storage | Parser |
|---|---|---|
| Claude Code | ~/.claude/projects/ | JSONL |
| Codex | ~/.codex/sessions/ | JSONL |
| OpenCode | ~/.local/share/opencode/opencode.db | SQLite (snap/flatpak auto-detect) |
| Antigravity | ~/.gemini/antigravity/brain/ | JSON / markdown brain directories |
| Pi | ~/.pi/agent/sessions/<encoded-cwd>/*.jsonl | JSONL |
Not your agent? Adding a sixth is one parser module; the read-only pattern ports to any tool in minutes. See CONTRIBUTING.md.
ai-r gives the same reading power three ways:
ai-r-mcp) — 15 tools over JSON-RPC, so any MCP agent
calls it directly (recommended). Default is stdio; optionally a shared
http server (one warm process for all agents instead of a per-agent stdio
swarm), see the http extra under Quick start. Registration — see
docs/mcp-registration.md.ai-r) — subcommands for scripts and manual use (list / read /
search / find-file-edits / find-tool-calls / file-frequency /
detect-agent / export rounds). Search operators —
docs/search-operators.md.from ai_r.parsers import ...) — parsers, typed
Session/message models, and the event verbs, to build your own tools.The full dictionary of public verbs and presets (signatures, parameters, behaviour) lives in its own file: docs/methods.md.
The verbs above are new: one event core replaces a pile of one-off tools.
Each parser reads one agent's logs and emits typed models, normalized into a
single agent-neutral stream — user_turn / assistant_turn / tool_call(...)
/ plan_event. A small set of verbs filters, aggregates, and diffs that stream;
agent differences (ExitPlanMode vs update_plan vs implementation_plan.md)
stay hidden inside the parsers — the caller sees one shape.
An honest boundary: this is extraction of entities only — turns, tool calls, plans, intents, reactions. It is not a graph and not a memory store. What you do next (knowledge graph, Obsidian, persistent memory) is on your side, outside this repo. For the full layering and the MCP tool list, see docs/architecture.md.
Requirements: Python 3.11+ with venv or pip, and jq (used to auto-patch
the Claude and Antigravity MCP configs — the others don't need jq).
git clone https://github.com/pro-target/ai-r.git ~/dev/ai-r
cd ~/dev/ai-r && bash install.sh
The installer creates a venv, installs the runtime package, patches MCP configs for Claude, Codex, OpenCode, Antigravity (where the configs exist), installs the Pi CLI skill, and runs smoke tests.
Optional extra — tokens: AI_R_EXTRAS=tokens bash install.sh (or
pip install "ai-r[tokens]") adds tiktoken
for better token estimates on sessions whose format stores no exact usage
numbers. Fully optional: without it exact numbers still come straight from the
session files where recorded, and the fallback estimate degrades to a rough
chars/4 heuristic, honestly labeled estimate — never a crash.
Optional extra — semantic: AI_R_EXTRAS=semantic bash install.sh (or
pip install "ai-r[semantic]" + a one-time model download the installer does
for you) enables sort="semantic" on text search (query, search_sessions) —
the BM25 top-50 candidates are re-ranked by meaning.
sort="semantic" honestly
falls back to the BM25 order and the response says why
(semantic: {active: false, reason, fallback: "bm25"}) — never a crash.Two knobs keep the model well-behaved inside a long-lived MCP process (both
env-tunable, both degrading to the default on blank/invalid input — never a
crash): AI_R_SEMANTIC_THREADS caps how many CPU threads onnxruntime may use
per inference (default 2, never more than the machine's core count — so it
does not grab every core and fight the server for CPU), and
AI_R_SEMANTIC_IDLE_SEC frees the loaded model's ~118 MB of RAM after that
many idle seconds (default 300); the next request transparently re-loads it.
Optional extra — http: AI_R_EXTRAS=http bash install.sh (or
pip install "ai-r[http]") adds uvicorn and enables
a shared streamable-http transport (requires mcp>=1.9.0).
ai-r-mcp over stdio — under
multi-agent fan-out that is N processes, each with a cold cache, re-scanning
the corpus (the measured cause of RAM exhaustion). With
AI_R_MCP_TRANSPORT=http a single warm server on localhost (default
127.0.0.1:8756) is shared by every agent instead of a swarm; the systemd
units in packaging/systemd/ add socket-activation with idle self-exit.AI_R_MCP_ALLOW_REMOTE=1 and an
AI_R_HTTP_TOKEN — without the token it refuses to start (transcripts carry
secrets). On loopback the token is optional (protection against another local
user on a shared box); the client sends an Authorization: Bearer <token>
header.AI_R_MCP_PORT — port (default 8756).AI_R_MCP_IDLE_SEC — idle self-exit threshold.AI_R_MCP_HOST / AI_R_MCP_ALLOW_REMOTE — bind host / allow non-loopback.AI_R_HTTP_TOKEN — bearer token (required for a remote bind).AI_R_HAYSTACK_CACHE_MAX — search cache ceiling by entry count.AI_R_HAYSTACK_CACHE_CHARS_MAX — by total size (an RSS safeguard for a
long-lived server).Both extras are fully optional: without them stdio mode and the BM25 order work as before.
http extra above). Either way, keep the
data where untrusted local processes can't reach.The public surface is covered by end-to-end scenarios an LLM agent runs against the live MCP (complementing pytest). Full list — docs/scenarios.md.
A gallery of real examples — one per capability (error analysis, dangerous commands, network trail, token burn, plan comments, commit phantom-check, cross-agent file history, cross-lingual search, zombie subagents, git-less diff): docs/examples/showcase-gallery.md.
docs/methods.md
(English SSOT) · docs/methods.ru.md (Russian mirror)docs/scenarios.mddocs/architecture.mddocs/search-operators.mddocs/mcp-registration.mddocs/parsers.mddocs/security.mdCONTRIBUTING.mdgit clone https://github.com/pro-target/ai-r.git
cd ai-r
pip install -e ".[dev]"
pytest --cov=src/ai_r
0.x, a minor release may
break compatibility — where possible a migration path is given (a loud
deprecation warning before removal); changes land in
CHANGELOG.mdfeat:, fix:, docs:, …)claude code session reader · claude code session parser · codex session parser · opencode session reader · antigravity brain parser · pi agent session reader · cross-agent attribution · ai coding agent audit · ai agent session history · mcp session tools · read-only session reader · agent session replay · resume agent session · agent handoff · plan extraction · tool-call audit · file edit attribution · multi-agent coding · claude codex opencode antigravity pi
MIT — see LICENSE.
Get started: clone + bash install.sh, then register the MCP server for your
agent (docs/mcp-registration.md) and restart the
host tool. One read-only surface to every agent's history.
FAQs
Multi-agent session reader (Claude, Codex, OpenCode, Antigravity, Pi) with MCP server
We found that agent-session-reader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.