ai-histBLOCK
Sync & search Claude Code + Codex CLI conversation history in SQLite. Zero dependencies.
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
Search, resume, and hand off every coding-agent session — across every harness on your machine.
Local memory for Claude Code, Codex, Cursor, Grok, Muse Code, OpenCode, and Devin CLI. Your agent sessions are indexed into one local SQLite database. Search them all at once, jump back into a session with its harness's native resume command, and hand a compact context pack to another agent — or to a teammate's agent — to continue the work.
ai-hist search "auth rewrite" # → matches across every codex/claude/cursor session on this machine ai-hist resume "auth rewrite" # → prints `codex resume 29284179-c09f-44f2-b9ec-16f678dc1832` ai-hist pack "auth rewrite" --tokens 1500 # → a token-budgeted context pack, ready to paste into another agent
Use Cases
- Never search for an old chat session again. One local index across every harness.
ai-hist search "the thing I was working on"finds it, whichever CLI you used. - Hand off work between agents without losing context.
ai-hist pack "the feature"produces a compact context pack;ai-hist resume "the feature"prints the native resume command. Great for switching from Claude to Codex mid-work, or picking up a teammate's session. - Give your agent access to its own memory via MCP. Wire
ai-hist-mcpinto Claude Code / Cursor / Codex and the agent can query its own past sessions while it's running — search, session events, tool calls, file edits. - The sourcing layer for [burn](https://github.com/AgentWorkforce/burn). burn prices and analyzes agent sessions. Today it still ships its own Claude Code, Codex and OpenCode readers; from burn 5.0.0 (burn #562) it drops them and reads usage, tool calls, file edits and session topology from the same
ai-history.dbthrough theai-histcrate, so the two tools share one ingest and agree on what a session is. Pricing and cost stay in burn. See
448d02803d82OBSERVED · 2026-10-11Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add ai-hist --env NODE_AUTH_TOKEN=${NODE_AUTH_TOKEN} -- npx -y [email protected]{
"mcpServers": {
"ai-hist": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"NODE_AUTH_TOKEN": "${NODE_AUTH_TOKEN}"
}
}
}
}Exposed tools (37)
32 read · 4 write · 1 destructive. Blast radius: 1 tool can delete or overwrite — an agent that can be talked into calling a tool can be talked into calling this one.
| Tool | Risk | Description |
|---|---|---|
ai-hist | read | Report local history readiness and list the catalogue. |
count | read | How many to show. |
create_handoff | write | Create a Relaycast handoff pointer for the caller\ |
discover_sessions | read | Explicit shallow provider discovery. Updates only the session catalog. |
events | read | Page through one session\ |
export | read | Export selected history as NDJSON. |
get_session | read | Get indexed prompts for one session. |
get_session_events | read | Get one bounded page of normalized events. |
get_session_file_edits | read | Get one bounded page of recorded file edits for one session. |
get_session_markers | read | Get one bounded page of a session\ |
get_session_relationships | read | Direct relationships for one session: delegation in both directions (as parent and as child), plus the continuity edges (resume, fork, continuation) that connect it to the conversation it came from. |
get_session_requests | read | Get one bounded page of a session\ |
get_session_tool_calls | read | Get one bounded page of recorded tool calls for one session. |
get_session_tree | read | Complete descendant tree for one session, with cycle protection and deterministic ordering. Follows delegation edges by default; pass relationship_kinds to also include resumed, continued, or forked descendants of the root. Child events are not flattened into the parent. |
get_session_usage | read | Provider-neutral token usage rollup for one session. Null usage means no usage evidence, never an assumed zero; cost appears only when the source data carried one. |
get_source_capabilities | read | What one provider\ |
history_stats | read | Statistics for already-indexed RelayHistory data. |
hydrate_session | write | Index one cataloged session as fully as its provider allows, without global sync. |
join_relay | write | Put the local session hosting this MCP server on Agent Relay so teammates and agents can reach it. Uses only the local Agent Relay desktop socket; optional name and description are public relay metadata. |
leave_relay | destructive | Remove the local session hosting this MCP server from Agent Relay. Uses only the local Agent Relay desktop socket. |
list_relay_agents | read | List live participants currently on Agent Relay, not session history. Reads only the local Agent Relay desktop socket; it uses no cloud client or credential. |
list_sessions | read | Cache-only indexed session catalog listing. This never discovers or syncs. |
pack | read | Pack matching history into a context block. |
query | read | Search terms. |
recent | read | Show the most recent prompts. |
recent_history | read | List recent already-indexed prompts, newest first by (timestampMs, id). |
relay_status | read | Report whether the local session hosting this MCP server is registered and reachable on Agent Relay. Reads only the local Agent Relay desktop socket. |
resume | read | Print the command that resumes the best-matching session. |
resume_handoff | read | Auto-resume a same-workspace handoff in one call: acquire the session and compose prompts, normalized events, tool calls, and file edits. Cross-workspace and cross-organization handoffs are rejected. |
review-bot | read | Reviews releases. |
search | read | Search indexed prompts and session events. |
search_history | read | Full-text search of already-indexed user prompts and session events (assistant text, tool calls and results), |
session | read | Show one session. |
session-id | read | Session identifier. |
source | read | Coding-agent source, e.g. claude or codex. |
stats | read | Summarize what the history store holds. |
sync | write | Index new sessions from every configured source. |
Trust audit
BLOCKgrade F · trust 55/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | FAIL |
| L3 | Class-specific surface | WARN |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (7 observation(s))
- Network
- declared (3 observation(s))
- Shell
- declared (5 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (25)
Report whether the local session hosting this MCP server is registered and reachable on Agent Relay. Reads only the local Agent Relay desktop socket.
process.stdout.write(String(eval(process.argv[1])));
process.stdout.write(String(eval(process.argv[1])));
assert!(require_https_or_loopback("http://127.0.0.1:8787").is_ok());assert!(require_https_or_loopback("http://[email protected]").is_err());leave_relay
offline-history.db.gz
exec(sql: string): void; prepare(sql: string): { get(): unknown }; close(): void } }exec(sql: string): void; prepare(sql: string): { get(): unknown }; close(): void } }node ../../scripts/verify-native-contract.mjs ./index.js
(cd helper-stage/provider-sources && npm pack --ignore-scripts --pack-destination ../../helper-packs)
run: node ../../scripts/verify-native-contract.mjs ./index.js
run: docker run --rm -v "$GITHUB_WORKSPACE:/work" -w /work/crates/ai-hist-napi node:22-alpine node ../../scripts/verify-native-contract.mjs ./index.js
cd ../../sdk-ts
{"parentUuid": "u-asst-1", "isSidechain": false, "type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "tool_use_id": "tu_bash_big", "content": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx{"timestamp": "2026-04-20T01:00:02.000Z", "type": "response_item", "payload": {"type": "function_call_output", "call_id": "call_shell_1", "output": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"text": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"text": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@napi-rs/cli
@types/node, typescript
@modelcontextprotocol/sdk, zod, @agent-relay/cli-surface, @relayhistory/cloud-client, @types/node, typescript
- **The sourcing layer for [burn](https://github.com/AgentWorkforce/burn).** burn prices and analyzes agent sessions. Today it still ships its own Claude Code, Codex and OpenCode readers; from burn 5.
The MCP server reads local history only, plus any source plugins named by `AI_HIST_PLUGIN_CONFIG`. The relay roster, status, join, and leave tools are also local: they use `AGENT_RELAY_SOCKET`, then `
crates/ai-hist/src/ingest.rs
The MCP server reads local history only, plus any source plugins named by `AI_HIST_PLUGIN_CONFIG`. The relay roster, status, join, and leave tools are also local: they use `AGENT_RELAY_SOCKET`, then `
Gates applied: critical_finding, no_behavioural_pass, undeclared_transfer.
448d02803d82full audit observations/trust-audit/mcp-server/agentworkforce__relayhistory.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-11 | 448d02803d82 | BLOCK | F | 55 | first audit |
Questions
What is the ai-hist MCP server?
Sync & search Claude Code + Codex CLI conversation history in SQLite. Zero dependencies.
What tools does ai-hist expose?
37 in total: 32 read-only, 4 that write, and 1 that can delete or overwrite (leave_relay). Every one is listed on this page with its risk.
Is ai-hist safe to connect to an agent?
No — not without reading the findings first. The audit graded it F (55/100) and found 3 critical or high issues in the source. Each one is listed on this page with the file and line it is on. Separately from the audit: 1 of its tools can destroy data, so scope the token you give it to what you actually need.
What credentials does ai-hist need?
It reads NODE_AUTH_TOKEN from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does ai-hist run?
It speaks stdio, so it runs as a local process your client starts. It is published on npm as ai-hist at 0.40.1.
How current is this page?
The grade is for one exact copy of the source (448d02803d82), read on 2026-10-11. The repository is watched and re-audited when it changes.