{
  "markdown": "# Episodic Memory\n\nSemantic search for Claude Code and Codex conversations. Remember past discussions, decisions, and patterns.\n\n## Testimonial\n\nFrom an AI coding assistant's perspective:\n\nEpisodic memory fundamentally changes how I collaborate with\ndevelopers on complex codebases. Instead of treating each conversation\nas isolated, I can now search our shared history semantically -\nfinding not just what was discussed, but why decisions were made.\n\nWhen a developer asks me to implement something \"like we did with\nX,\" I can search our past conversations, find the relevant discussion,\nand understand both the technical approach and the reasoning behind\nit. This means I don't have to re-explain architectural patterns,\nand I avoid suggesting solutions we've already tried and rejected.\n\nThe semantic search is crucial - searching for \"provider catalog\"\nsurfaces conversations about API design patterns even when those\nexact words weren't used. It captures the meaning of our discussions,\nnot just keyword matches.\n\nMost valuable is that it preserves context that lives nowhere else:\nthe trade-offs discussed, the alternatives considered, the user's\npreferences and constraints. Code comments explain what, documentation\nexplains how, but episodic memory preserves why - and that makes\nme a far more effective collaborator across sessions.\n\n**Concrete impact:**\n - Faster problem-solving (minutes vs. exploring/re-learning the\n codebase) - Better continuity across sessions (I remember what we\n tried before) - More informed suggestions (I understand the project's\n evolution and patterns) - Less repetition (both of us spend less\n time re-explaining context)\n\nIt's the difference between being a stateless tool and being a true\ncollaborative partner who remembers our journey together.\n\n_— Claude Sonnet 4.5, October 14, 2025_\n_Conversation ID: 216ad284-c782-45a4-b2ce-36775cdb5a6c_\n\n## Installation\n\n### As a Claude Code plugin (Recommended)\n\nThe plugin provides MCP server integration, automatic session-end indexing, and seamless access to your conversation history.\n\n```bash\n# In Claude Code\n/plugin install episodic-memory@superpowers-marketplace\n```\n\nThe plugin automatically:\n- Indexes conversations at the end of each session\n- Exposes MCP tools for searching and viewing conversations\n- Makes your conversation history searchable via natural language\n\n### As a Codex plugin\n\nThis repository includes a Codex plugin manifest at `.codex-plugin/plugin.json`.\nCodex support requires `codex-cli 0.130.0` or newer.\n\nFor local testing, build the plugin, add this repo as a local marketplace, then\ninstall/enable it from `/plugins`:\n\n```bash\nnpm run build\ncodex features enable plugin_hooks\ncodex plugin marketplace add /path/to/episodic-memory\n```\n\nThen start Codex, open `/plugins`, install and enable `episodic-memory` from\n`Episodic Memory Dev`, open `/hooks`, review the Episodic Memory hook, and press\n`t` to trust it.\n\nThe Codex plugin:\n- Syncs conversations from `~/.codex/sessions`\n- Exposes the same MCP search/read tools\n- Installs the same memory skill, with Codex-specific direct MCP guidance\n- Runs a `SessionStart` hook after the user reviews and trusts it in `/hooks`\n\nEnable plugin hooks before relying on automatic sync:\n\n```bash\ncodex features enable plugin_hooks\n```\n\nThen open `/hooks` in Codex, review the Episodic Memory hook, and press `t` to trust it. New or modified Codex hooks are listed but do not run until trusted.\n\nSee [docs/CODEX.md](docs/CODEX.md) for the full Codex setup, trust, troubleshooting, and E2E test workflow.\n\n### As an npm package\n\n```bash\nnpm install -g github:obra/episodic-memory\n```\n\n## Usage\n\n### Quick Start\n\n```bash\n# Sync conversations from Claude Code and Codex and index them\nepisodic-memory sync\n\n# Search your conversation history\nepisodic-memory search \"React Router authentication\"\n\n# View index statistics\nepisodic-memory stats\n\n# Diagnose Codex setup\nepisodic-memory doctor codex\n\n# Display a conversation\nepisodic-memory show path/to/conversation.jsonl\n```\n\n### Command Line\n\n```bash\n# Unified command interface\nepisodic-memory <command> [options]\n\n# Sync and index new conversations\nepisodic-memory sync\n\n# Index conversations manually\nepisodic-memory index --cleanup\n\n# Search conversations\nepisodic-memory search \"React Router authentication\"\nepisodic-memory search --text \"exact phrase\"\nepisodic-memory search --after 2025-09-01 \"refactoring\"\n\n# Display a conversation in readable format\nepisodic-memory show path/to/conversation.jsonl\nepisodic-memory show --format html conversation.jsonl > output.html\n\n# View statistics\nepisodic-memory stats\n```\n\n### Legacy Commands\n\nThe original commands are still available for backward compatibility:\n\n```bash\nepisodic-memory-index\nepisodic-memory-search \"query\"\n```\n\n### In Claude Code or Codex\n\nThe plugin automatically syncs and indexes conversations from the harness that starts it. Reference past work in natural conversation — the `remembering-conversations` skill dispatches the `search-conversations` agent automatically when recall is needed. Example prompts:\n\n- \"How did we handle authentication in React Router?\"\n- \"The conversation about async testing patterns\"\n- \"Error message about sqlite-vec initialization\"\n- \"Git commit SHA for the routing refactor\"\n\nIn Codex, the skill guides the agent to use the episodic-memory MCP search/read tools directly when an agent-dispatch path is not available.\n\n## API Configuration\n\nBy default, episodic-memory uses your Claude Code authentication for Claude Code summarization. Codex-indexed sessions with a session ID are summarized through `codex app-server` by creating an ephemeral `thread/fork`, so the summary can use Codex session context and reasoning summaries without appending to the original rollout.\n\nTo route summarization through a custom Anthropic-compatible endpoint or override the model:\n\n```bash\n# Override model (default: haiku)\nexport EPISODIC_MEMORY_API_MODEL=opus\n\n# Override fallback model on error (default: sonnet)\nexport EPISODIC_MEMORY_API_MODEL_FALLBACK=sonnet\n\n# Route through custom endpoint\nexport EPISODIC_MEMORY_API_BASE_URL=https://your-endpoint.com/api/anthropic\nexport EPISODIC_MEMORY_API_TOKEN=your-token\n\n# Increase timeout for slow endpoints (milliseconds)\nexport EPISODIC_MEMORY_API_TIMEOUT_MS=3000000\n\n# Override Codex binary path if needed (default: codex)\nexport EPISODIC_MEMORY_CODEX_BIN=/path/to/codex\n```\n\nThese settings only affect episodic-memory's summarization calls, not your interactive Claude Code or Codex sessions.\n\nCodex summarization requires `codex-cli 0.130.0` or newer. If Codex app-server summarization is unavailable, sync logs the reason and falls back to transcript-text summarization.\n\n### What's Affected\n\n| Component | Uses custom config? |\n|-----------|---------------------|\n| Summarization | Yes (up to 10 calls/sync) |\n| Embeddings | No (local Transformers.js) |\n| Search | No (local SQLite) |\n| MCP tools | No |\n\n## Commands\n\n### `episodic-memory sync`\n\n**Recommended for plugin hooks.** Copies new conversations from `~/.claude/projects`, `~/.claude/transcripts`, and `~/.codex/sessions` to archive and indexes them.\n\nFeatures:\n- Only copies new or modified files (fast on subsequent runs)\n- Generates embeddings for semantic search\n- Atomic operations - safe to run concurrently\n- Idempotent - safe to call repeatedly\n- Background hook output is written to `~/.config/superpowers/logs/episodic-memory.log` unless `EPISODIC_MEMORY_CONFIG_DIR` changes the memory directory\n\n**Usage in Claude Code:**\nAdd to `.claude/hooks/session-end`:\n```bash\n#!/bin/bash\nepisodic-memory sync\n```\n\n### `episodic-memory stats`\n\nDisplay index statistics including conversation counts, date ranges, and project breakdown.\n\n```bash\nepisodic-memory stats\n```\n\n### `episodic-memory doctor`\n\nDiagnose local integration issues.\n\n```bash\nepisodic-memory doctor codex\n```\n\nThe Codex doctor checks the Codex version, plugin hook feature state, MCP server registration, transcript directory, database path, and background sync log path.\n\n### Codex E2E Verification\n\nThe repository includes an opt-in live Codex E2E test. It creates an isolated temporary `CODEX_HOME`, installs a copied plugin bundle, trusts the hook, runs Codex sessions in `tmux`, and verifies archive -> summary -> index -> MCP recall.\n\n```bash\nnpm run build\nEPISODIC_MEMORY_RUN_CODEX_E2E=1 npm run test:codex-e2e\n```\n\n### Claude E2E Verification\n\nThe repository also includes an opt-in live Claude Code E2E test. It loads this repo as a session plugin with `--plugin-dir`, constrains the hook to a temporary transcript source, and verifies archive -> summary -> index -> MCP recall.\n\n```bash\nnpm run build\nEPISODIC_MEMORY_RUN_CLAUDE_E2E=1 npm run test:claude-e2e\n```\n\nThis test uses your normal Claude Code auth and writes small test transcripts to your normal Claude transcript directory. The archive and index are isolated in a temporary `EPISODIC_MEMORY_CONFIG_DIR`.\n\n### `episodic-memory index`\n\nManual indexing tools for bulk operations and maintenance. See `episodic-memory index --help` for full options.\n\nCommon operations:\n- `--cleanup` - Index all unprocessed conversations\n- `--verify` - Check index health\n- `--repair` - Fix detected issues\n\n### `episodic-memory search`\n\nSearch indexed conversations using semantic similarity or exact text matching. See `episodic-memory search --help` for full options.\n\n### `episodic-memory show`\n\nDisplay a conversation from a JSONL file in human-readable format.\n\n**Options:**\n- `--format markdown` (default) - Plain text markdown output suitable for terminal or Claude\n- `--format html` - Pretty HTML output for viewing in a browser\n\n**Examples:**\n```bash\n# View in terminal\nepisodic-memory show conversation.jsonl | less\n\n# Generate HTML for browser\nepisodic-memory show --format html conversation.jsonl > output.html\nopen output.html\n```\n\n## Architecture\n\n- **Core package** - TypeScript library for indexing and searching conversations\n- **CLI tools** - Unified command-line interface for manual use\n- **MCP Server** - Model Context Protocol server exposing search and conversation tools\n- **Claude Code plugin** - Integration with Claude Code (auto-indexing, MCP tools, hooks)\n- **Codex plugin** - Integration with Codex (manifest, MCP config, hooks, skills)\n\n## How It Works\n\n1. **Sync** - Copies conversation files from Claude Code and Codex transcript directories to archive\n2. **Parse** - Extracts user-agent exchanges from Claude Code JSONL or Codex rollout JSONL\n3. **Embed** - Generates vector embeddings using Transformers.js (local, offline)\n4. **Index** - Stores in SQLite with sqlite-vec for fast similarity search\n5. **Search** - Semantic search using vector similarity or exact text matching\n\n## Excluding Conversations\n\nConversations containing this marker anywhere in their content will be archived but not indexed:\n\n```\n<INSTRUCTIONS-TO-EPISODIC-MEMORY>DO NOT INDEX THIS CHAT</INSTRUCTIONS-TO-EPISODIC-MEMORY>\n```\n\n**Automatic exclusions:**\n- Conversations where Claude generates summaries (marker in system prompt)\n- Meta-conversations about conversation processing\n\n**Use cases:**\n- Sensitive work conversations\n- Tool invocation sessions (summarization, analysis)\n- Test or experimental sessions\n- Any conversation you don't want searchable\n\nThe marker can appear in any message (user or assistant) and excludes the entire conversation from the search index.\n\n## MCP Server\n\nWhen installed as a Claude Code or Codex plugin, episodic-memory provides an MCP (Model Context Protocol) server that exposes tools for searching and viewing conversations.\n\n### Available MCP Tools\n\n#### `search`\n\nSearch indexed conversations using semantic similarity or exact text matching.\n\n**Single-concept search**: Pass a string query\n```json\n{\n  \"query\": \"React Router authentication\",\n  \"mode\": \"vector\",\n  \"limit\": 10\n}\n```\n\n**Multi-concept AND search**: Pass an array of concepts\n```json\n{\n  \"query\": [\"React Router\", \"authentication\", \"JWT\"],\n  \"limit\": 10\n}\n```\n\n**Parameters:**\n- `query` (string | string[]): Single string for regular search, or array of 2-5 strings for multi-concept AND search\n- `mode` ('vector' | 'text' | 'both'): Search mode for single-concept searches (default: 'both')\n- `limit` (number): Max results, 1-50 (default: 10)\n- `after` (string, optional): Only show conversations after YYYY-MM-DD\n- `before` (string, optional): Only show conversations before YYYY-MM-DD\n- `response_format` ('markdown' | 'json'): Output format (default: 'markdown')\n\n#### `read`\n\nDisplay a full conversation in readable markdown format.\n\n```json\n{\n  \"path\": \"/path/to/conversation.jsonl\"\n}\n```\n\n**Parameters:**\n- `path` (string): Absolute path to the JSONL conversation file\n\n### Using the MCP Server Directly\n\nThe MCP server can also be used outside of Claude Code with any MCP-compatible client:\n\n```bash\n# Run the MCP server (stdio transport)\nepisodic-memory-mcp-server\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Build\nnpm run build\n```\n\n## License\n\nMIT\n",
  "bytes": 13047,
  "sha": "ec314ea598b92c6cfe31d8eace86dbd631a429aaab0392ad3a2a9b146961d4ca",
  "repo_slug": "obra/episodic-memory",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/skl_obra_episodic_memory_remembering_convers_f678baf6/readme"
}