agent-history-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CODEX_PATH | No | Override the default Codex CLI history directory (default: ~/.codex/sessions/) | |
| CLAUDE_PATH | No | Override the default Claude Code history directory (default: ~/.claude/projects/) | |
| AGENT_HISTORY_GRAPH_DB | No | Override the path for the local graph database (default: ~/.agent-history-mcp/history_graph.sqlite) |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Local memory and context bridge across Claude Code, Codex CLI, Gemini CLI, OpenCode and Cursor. Use search_history to find relevant context from previous sessions in any agent. Use handoff_brief at the start of work in a repository to see where the last agent stopped. Prefer search_history over get_session to stay token-efficient. After context compaction, use session_recall to get back exact text the summary dropped. Tools that write files (install_skill, sync_memory, save_checkpoint with apply) only write when apply=true.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| search_historyA | Search past AI coding agent conversations for a keyword or topic. Returns matching message excerpts with surrounding context. sources: "all" or any of claude, codex, gemini, opencode, cursor. project: optional repository path to limit results to sessions run there. Prefer this over get_session to avoid token bloat. Example: search_history("CUDA illegal address", sources=["codex", "claude"]) |
| search_graphA | Search the persistent local knowledge graph built from past conversations. Use this for relationship-heavy questions where exact keywords may differ across sessions, such as "where did I solve a similar auth migration bug?". sources: "all" or any of claude, codex, gemini, opencode, cursor. |
| list_sessionsA | List available past sessions with their titles, dates, sources and projects. source: "all" or one of claude, codex, gemini, opencode, cursor. project: optional repository path filter. Returns session IDs needed for get_session. |
| get_sessionA | Retrieve the conversation for a specific session. session_id: from list_sessions output (a unique prefix works) source: claude | codex | gemini | opencode | cursor max_messages: limit messages returned (default 30) to control token usage. include_tools: interleave tool calls/results (commands, edits, errors). Prefer search_history for finding context; use this only when you need the full conversation flow. |
| refresh_history_indexA | Manually refresh the persistent graph index and in-memory keyword cache. rebuild=true deletes and recreates the derived graph database. It never modifies any agent's history files. |
| suggest_skillsA | Suggest reusable skills from repeated work across all your agents. Combines repeated multi-step tool workflows (the same commands/edits in the same order across sessions) with recurring topic clusters, then checks each against your installed skills: create, update , or skip. Returns ranked ideas with steps, triggers and evidence sessions. Never writes files or calls a model; use draft_skill next. |
| draft_skillA | Draft an Agent Skills SKILL.md (works in Claude Code, Codex, Gemini CLI, Cursor, OpenCode...) for a candidate from suggest_skills. The draft is deterministic: frontmatter (name, description with triggers), steps with real example commands, known failure modes and their fixes, verification, and evidence. Review and edit it, then pass it to install_skill. Use get_session on the evidence sessions to refine it. |
| install_skillA | Install a SKILL.md for several agents at once (dry run unless apply=true). skill_md: the reviewed SKILL.md text (or pass candidate_id to install the
unedited draft). targets: "claude" ( |
| skill_healthB | Check how your installed skills are actually used across agents: invocations per agent, last use, missed triggers (matching work where the skill never fired, meaning its description needs work), outcome proxies, references to commands that no longer appear, and a keep / revise / update / retire call. |
| handoff_briefA | Summarize where the latest session(s) in a repository stopped, across agents. Includes the goal, open todos, files touched, recent commands with outcomes, unresolved errors, dead ends (commands that failed repeatedly), the latest checkpoint note, and live git status. Call this when starting work in a repo that another agent (or an earlier session) worked on. project: repository path (defaults to the server's working directory). exclude_source: skip one agent, e.g. "claude" to see only what others did. |
| session_recallA | Get back exact text from one session, including what context compaction summarized away. session_id: the session to search (the post-compaction checkpoint names it). query: words to find, e.g. an error string, file name or decision. source: claude | codex message: read message [mN] in full instead of searching. Reads the transcript on disk directly, so it sees the current, still-running session. |
| save_checkpointA | Save a handoff checkpoint (your note + the current brief) for this repository. The checkpoint is stored under ~/.agent-history-mcp/checkpoints and shown by handoff_brief to any agent. apply=true also writes .agent-context/HANDOFF.md inside the repository. |
| list_agent_memoryB | Show which instruction and memory files each agent reads for a repository, and the drift between them (rules one agent sees but another doesn't). Covers CLAUDE.md, Claude auto-memory, AGENTS.md (Codex/Cursor/OpenCode), GEMINI.md, .cursor/rules, and Codex memories at project and user level. |
| suggest_rulesB | Mine your repeated corrections ("no, use pnpm"), stated preferences ("always run ruff first") and rejected tool calls into candidate rules for CLAUDE.md / AGENTS.md / GEMINI.md, with evidence and whether each rule is already documented. Pass project="" to search all projects. |
| sync_memoryA | Add shared rules to every agent's instruction file via a managed block. rules: rules to add; omit to sync the drift (rules some agents are missing). targets: agents to update (claude -> CLAUDE.md, codex/cursor/opencode -> AGENTS.md, gemini -> GEMINI.md); defaults to agents that already have one. scope: "project" (repo files) or "user" (~/.claude, ~/.codex, ~/.gemini). Returns a unified diff. Writes only when apply=true, and only edits the |
| analyze_sessionsA | Analyze your coding-agent sessions: active time, tokens, tool mix, top and failing commands, most edited files, friction (retry loops, corrections, interrupts, rejected tool calls, compactions) and a directional comparison of agents on shared topics. project: limit to one repository (omit for all projects). group_by: project | source | day | model. |
| history_reportB | Write a self-contained HTML report (analytics, friction, cross-agent comparison, skill and rule candidates) to ~/.agent-history-mcp/reports and return its path. Local only; no model calls. |
| score_sessionsB | Score recent sessions on prompt clarity, context efficiency, rework, consistency and completion, and list the lowest and highest scorers. If report_path is given, also writes the report as local Markdown. |
| get_session_scorecardB | Explain one session's scorecard. session_id may be a full ID or a unique prefix from list_sessions. |
| compare_sessionsC | Compare two session scorecards to see whether a workflow improved. Session IDs may be full IDs or unique prefixes. |
| find_friction_patternsB | List friction patterns that recur across sessions (repeated file reads, failing commands, correction loops, vague openers, tool-call explosions). |
| suggest_instruction_updatesA | Suggest CLAUDE.md / AGENTS.md rules from friction that recurs across sessions, with the sessions as evidence. Read-only: never writes files (use sync_memory to apply a rule). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| handoff | Continue work from where the last agent stopped in this repository |
| draft-skill | Turn a repeated workflow from your history into a reviewed SKILL.md |
| weekly-review | Review the last week of agent sessions: friction, skills, rules |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 22 tools
Several clusters overlap: search_history/search_graph/session_recall/get_session all retrieve past conversation content, and suggest_rules vs suggest_instruction_updates both mine sessions for rule candidates. Descriptions do differentiate them (keyword vs graph vs exact text vs full flow; corrections vs friction), but an agent must read carefully to pick correctly.
Mostly consistent verb_noun snake_case (search_history, list_sessions, get_session, save_checkpoint, sync_memory, compare_sessions). A few noun-only outliers (skill_health, handoff_brief, session_recall, history_report) are minor deviations but still readable.
22 tools is on the heavy side for a history/memory server, spanning search, skills, memory sync, checkpoints, and analytics. Each earns some place, but the surface feels broad and could be consolidated (e.g. the four retrieval tools, the two rule-suggestion tools).
Strong lifecycle coverage: search/retrieve, skill suggest→draft→install→health, memory list→suggest→sync, checkpoints, and analytics/scoring. Minor gaps like no explicit skill uninstall/retire action and no delete for checkpoints, but core workflows are covered.