{"slug": "sessiongrep-local-first-memory-layer-for-cli-agents", "title": "Sessiongrep: Local-first memory layer for CLI agents", "summary": "Sessiongrep, a new local-first memory layer for CLI agents, indexes session histories from Claude Code, Codex CLI, Cursor, Antigravity, and Pi into a single SQLite + FTS5 database, providing a CLI/TUI and MCP server for searching and retrieving past work. The tool, developed by Brain Company, keeps all data local with a static binary and no daemon, enabling agents to recover and critique their own prior reasoning across different tools.", "body_md": "**You solved that bug last week. Your next agent session has no idea.**\n\nA local-first memory layer for CLI agents. `sessiongrep`\n\nindexes your Claude Code, Codex CLI, Cursor, Antigravity, and Pi session histories into a single SQLite + FTS5 database, then gives you one CLI/TUI to find old work by topic, repo, provider, or recency. It also ships an MCP server so your agent can search its own history.\n\nThe real payoff is portable context: your session history isn't trapped in one tool. Work you started in Claude Code can continue in Codex, and an agent can recover — and even critique — its own prior reasoning across every tool you use.\n\nRead the announcement: [Sessiongrep: a local-first memory layer for CLI agents](https://brain.co/blog/sessiongrep-a-local-first-memory-layer-for-cli-agents).\n\nSession transcripts already live on your machine — scattered across `~/.claude/projects`\n\n, `~/.codex/sessions`\n\n, `~/.cursor/projects`\n\nas noisy JSONL with opaque filenames. The information is not missing, it's stranded. Humans don't want to read it; agents don't know how to retrieve it. Grep over JSONL drowns in tool payloads. Shell history captures commands but not reasoning. Cloud-synced or vector-backed alternatives bring secrets and URLs into systems that aren't yours.\n\n`sessiongrep`\n\nkeeps recall local. One static binary, one SQLite file, no daemon, no server. The index is a disposable cache — delete it and rebuild it whenever you want.\n\nProvider adapters normalize Claude, Codex, Cursor, Antigravity, and Pi transcripts into a single `Session`\n\nmodel and write them into SQLite (WAL mode) with an FTS5 virtual table over transcript text, title, summary, and preview. Every read command runs an incremental reindex first — files whose mtime and size haven't changed are skipped, so search and list stay fast even as your history grows.\n\n[Rust toolchain](https://rustup.rs/)(1.70+)- Claude Code, Codex CLI, and/or Cursor installed (for session data)\n\n```\ngit clone git@github.com:braincompany/sessiongrep.git\ncd sessiongrep\n\n# Install both binaries\ncargo install --path .\n```\n\nThis installs two binaries to `~/.cargo/bin/`\n\n:\n\n`sessiongrep`\n\n— CLI and TUI`sessiongrep-mcp`\n\n— MCP server\n\nMake sure `~/.cargo/bin`\n\nis in your PATH. Add to your `~/.bashrc`\n\nor `~/.zshrc`\n\nif not already present:\n\n```\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n```\n\nThe index updates automatically — every command (search, list, tui, etc.) runs an incremental reindex before executing. No cron jobs or manual steps needed.\n\nTo force a full rebuild from scratch:\n\n```\nsessiongrep reindex --full\nsessiongrep list --limit 20        # recent sessions (auto-indexes on first run)\nsessiongrep search \"auth bug\"      # keyword search\nsessiongrep search \"redis\" --provider codex\nsessiongrep search \"datadog\" --provider cursor\nsessiongrep search \"temporal\" --provider pi\nsessiongrep show claude:79accec8-5bf5-415b-a4a5-fe370eb2c998\nsessiongrep resume 79accec8 --dry-run\nsessiongrep export 79accec8 --format markdown\nsessiongrep doctor                 # health check\nsessiongrep tui                    # interactive browser\n```\n\nThe MCP server lets AI agents search and retrieve your past sessions programmatically — no copy-pasting context from old conversations.\n\n```\nclaude mcp add --scope user --transport stdio sessiongrep -- sessiongrep-mcp\ncodex mcp add sessiongrep -- sessiongrep-mcp\n```\n\nStart a new session and try a prompt like:\n\n\"Find my previous session where I was setting up Datadog metrics\"\n\nThe agent will call `search_sessions`\n\nto find matches and `get_session`\n\nto pull in relevant context.\n\n| Tool | Description |\n|---|---|\n`search_sessions` |\nSearch sessions by keyword, with optional provider filter and limit |\n`get_session` |\nGet full transcript and metadata by session ID (supports `max_lines` to limit context) |\n`list_sessions` |\nList recent sessions, filterable by provider and path prefix |\n`timeline_for_repo` |\nDay-bucketed metadata timeline for a repo path prefix — scoped view of what changed over time |\n`get_resume_command` |\nGet the CLI command to resume a session in its native tool |\n\nOptional config file at `~/.config/sessiongrep/config.toml`\n\n:\n\n```\n[providers.claude]\nenabled = true\npaths = [\"~/.claude/projects\"]\n\n[providers.codex]\nenabled = true\npaths = [\"~/.codex/sessions\"]\n\n[providers.cursor]\nenabled = true\npaths = [\"~/.cursor/projects\"]\n\n[providers.antigravity]\nenabled = true\npaths = [\"~/.gemini/antigravity/brain\"]\n\n[providers.pi]\nenabled = true\npaths = [\"~/.pi/agent/sessions\"]\n\n[index]\ndb_path = \"~/.local/share/sessiongrep/index.db\"\ncache_dir = \"~/.cache/sessiongrep\"\n\n[ui]\npreview_lines = 30\n\n[search]\ndefault_limit = 50\nprefer_current_repo = true\n```\n\n- Everything stays on your machine. No network calls, no telemetry, no cloud sync.\n- The tool is read-only — it never modifies your session files.\n- The SQLite index is a derived cache. Delete it anytime and\n`reindex --full`\n\nrebuilds it from your transcripts. - All paths (database, cache, config) are user-local under\n`~/.local/share`\n\n,`~/.cache`\n\n, and`~/.config`\n\n.\n\n- Resume delegates to the native provider CLI (\n`claude --resume <id>`\n\n,`codex resume <id>`\n\n, or`pi --session <id>`\n\n). Cursor and Antigravity resume are not currently supported. - Claude, Cursor, and Pi subagent transcripts are excluded from indexing to avoid duplicate records.\n\nEarly but usable — pre-release, built from source (no tagged release yet). The CLI surface and MCP tool names are likely to stay stable; the on-disk index schema may still change (delete `~/.local/share/sessiongrep/index.db`\n\nand let it rebuild if you hit a schema mismatch).\n\nIssues and pull requests are welcome. For bugs, please include your provider versions and a `sessiongrep doctor`\n\noutput. For features, a quick issue to discuss scope before sending a PR keeps things moving.\n\nApache-2.0. See [LICENSE](/braincompany/sessiongrep/blob/main/LICENSE).", "url": "https://wpnews.pro/news/sessiongrep-local-first-memory-layer-for-cli-agents", "canonical_source": "https://github.com/braincompany/sessiongrep", "published_at": "2026-07-31 18:07:36+00:00", "updated_at": "2026-07-31 18:22:31.958388+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-agents", "artificial-intelligence"], "entities": ["Sessiongrep", "Brain Company", "Claude Code", "Codex CLI", "Cursor", "Antigravity", "Pi", "SQLite"], "alternates": {"html": "https://wpnews.pro/news/sessiongrep-local-first-memory-layer-for-cli-agents", "markdown": "https://wpnews.pro/news/sessiongrep-local-first-memory-layer-for-cli-agents.md", "text": "https://wpnews.pro/news/sessiongrep-local-first-memory-layer-for-cli-agents.txt", "jsonld": "https://wpnews.pro/news/sessiongrep-local-first-memory-layer-for-cli-agents.jsonld"}}