If you've been watching AI coding assistants proliferate across your workflow, you've probably noticed a brutal pattern: every new session starts from zero. The agent re-reads the same files, re-runs the same commands, and re-derives conclusions it already figured out last week. That's not just annoying—it's a direct hit to both token budgets and developer patience.

Introducing agent-historian

The newly open-sourced tool attacks this problem at its root by giving your AI agents a way to search their own conversation history from the command line. The CLI is called ochist (a play on "oh, I see" meets "history"), and it reads directly from the session stores of multiple agents—OpenCode's SQLite database and Claude Code's JSONL transcripts are supported out of the box, with a pluggable interface for adding others like Qoder. The project requires Node ≥ 22.5 for its use of the built-in node:sqlite module, meaning zero external dependencies to manage.

A Real Example of Why This Matters

The project's README includes a concrete scenario that hits home for anyone who's worked with Go repositories. Merge conflicts in files like go.sum or lockfiles shouldn't be hand-merged—the right fix is usually a command like go mod tidy. But an agent in a new session doesn't remember that you already solved this exact problem last week, so it tries to hand-merge and gets it wrong. With agent-historian wired up via its bundled Agent Skill, the agent can check history before re-researching, find the previous session, see the command that worked, and immediately do the right thing. No manual intervention required.

CLI-First by Design

The project deliberately chose a CLI plus Agent Skill approach over an MCP server, and the reasoning is solid: agents already have a shell, so why force them through tool schemas and permission round-trips for data they could just grep? With ochist, the agent composes commands like ochist grep … | head | wc -l | grep -i error itself—using pipes the way developers actually work. Context control happens naturally with standard Unix tools rather than requiring server-side pagination that inevitably over- or under-fetches. There's also zero resident cost: no daemon process sitting around consuming memory and token overhead on every turn.

Comparing Memory Strategies

The README includes a thoughtful comparison of approaches to giving agents "memory." Where memory layers like mem0, OpenMemory, and MemGPT store LLM-distilled summaries (lossy, potentially hallucinated), agent-historian reads the exact original transcript text. RAG and embedding-based approaches need an embedding model plus vector database plus re-indexing pipeline—substantial infra for semantic recall that's overkill when you just want to find a specific command you ran yesterday. The project's stance is that these are complementary: historian answers "show me exactly what I did," while memory layers answer "recall the gist of what I know."

Project vs Global Scope, Plus Usage Stats

By default, ochist sessions and ochist grep search only within the current project directory, which keeps results relevant to immediate work. The --global flag widens scope to everything on disk. For observability, every invocation appends one line of metadata (timestamp, subcommand, whether a query was used) to ~/.agent-historian/usage.log, with no query text or paths recorded—though this is fully opt-out via the AGENT_HISTORIAN_NO_TELEMETRY environment variable. The ochist stats command provides human-readable summaries of actual usage patterns.

Key Takeaways

  • Agents supported out of the box: OpenCode (SQLite), Claude Code (JSONL), with a pluggable interface for others
  • Zero runtime dependencies—uses Node's built-in node:sqlite module only
  • Read-only by design—it never modifies any agent data store, so no risk of corrupting source truth
  • Progressive disclosure workflow: locate → orient → scan → read keeps context windows tight
  • Agent Skill bundled at skills/agent-history/SKILL.md teaches agents when and how to check history before re-researching
  • Can be installed via npx for immediate use without npm globally, or standard npm install -g agent-historian

The Bottom Line

This is the kind of tool that makes you wonder why nobody built it sooner—and then makes you appreciate that someone finally did. The multi-agent angle is particularly smart: instead of vendor-locking into one assistant's ecosystem, you get a unified interface across OpenCode, Claude Code, and whoever comes next. If you're serious about getting real value from AI coding agents rather than watching them rediscover the same problems on loop, this belongs in your toolkit.