DEV.co
RAG Frameworks · JuliusBrussee

cavemem

Cavemem is a TypeScript library that gives coding assistants persistent memory across sessions by storing compressed observations in local SQLite. It hooks into multiple IDEs (Claude Code, Cursor, GitHub Copilot, etc.) to capture what happened during coding sessions, compresses the data using a deterministic grammar to save tokens, and makes it queryable via MCP tools without requiring cloud infrastructure.

Source: GitHub — github.com/JuliusBrussee/cavemem
608
GitHub stars
56
Forks
TypeScript
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryJuliusBrussee/cavemem
OwnerJuliusBrussee
Primary languageTypeScript
LicenseMIT — OSI-approved
Stars608
Forks56
Open issues5
Latest releasev0.2.1 (2026-05-06)
Last updated2026-07-03
Sourcehttps://github.com/JuliusBrussee/cavemem

What cavemem is

Cavemem captures IDE session events (SessionStart, UserPromptSubmit, PostToolUse, SessionEnd) via hook handlers, redacts private content, compresses observations with a deterministic grammar that preserves code/paths byte-for-byte, writes to SQLite with FTS5 full-text indexing, and optionally builds local vector embeddings for hybrid BM25+semantic search. MCP tools (search, timeline, get_observations) enable agents to retrieve and filter their own history progressively.

Quickstart

Get the cavemem source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/JuliusBrussee/cavemem.gitcd cavemem# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Multi-Session Context for Coding Agents

Agents (Claude Code, GitHub Copilot, Cursor) can now recall decisions, patterns, and errors from earlier sessions without repeating work. Particularly valuable for long-running projects where context continuity reduces redundant troubleshooting.

Token-Efficient Agent Memory

The caveman grammar compression (~75% fewer tokens) lets agents maintain larger memory footprints within context windows. Useful for RAG-like workflows where agents need to search their own history without burning through token limits.

Privacy-First Local Memory

Organizations that cannot send coding session data to cloud providers can use cavemem's local-by-default storage with optional embedded vectors. Satisfies on-premise or air-gapped deployment requirements while supporting semantic search.

Implementation considerations

  • Windows users must ensure Git Bash (`sh`) is in PATH; without it, Claude Code hooks fail silently. Run `cavemem doctor` to verify installation.
  • The library auto-spawns a background worker for embeddings and the web viewer; configure `embedding.idleShutdownMs` to control shutdown behavior and avoid resource creep.
  • Redaction of `<private>...</private>` tags and path glob exclusions happen at write time. Plan your naming conventions for sensitive data.
  • Hook handlers complete in <150ms, but compression and indexing are synchronous writes. Monitor for latency impact in high-frequency IDE environments.
  • Optional remote embedding providers (e.g., cloud APIs) can be configured, but default is local vector index. Choose based on privacy and latency requirements.

When to avoid it — and what to weigh

  • Query-Only IDEs and Limited Capture Coverage — Cursor, Gemini CLI, Antigravity, and IBM Bob are query-only (no hooks system). If your primary IDE has no capture hooks, the database never populates, and only agents on other IDEs can benefit from searching stored memory.
  • Agents That Don't Support MCP — Cavemem exposes memory via Model Context Protocol. If your agent framework or IDE doesn't support MCP servers, retrieval won't work. The library cannot integrate with agents that lack MCP client support.
  • Dependency on Specific IDE Hook Events — Some IDEs have incomplete hook coverage (e.g., Copilot and Codex lack SessionEnd; Augment lacks UserPromptSubmit). Gaps in the event stream mean incomplete observations. Verify the IDE capability matrix matches your workflow.
  • Complex Multi-Workspace Setups — Cavemem uses a single local SQLite database. Cross-device or multi-workspace synchronization requires manual export/import. Real-time sync across machines is not supported.

License & commercial use

Cavemem is licensed under the MIT License, a permissive open-source license that allows commercial use, modification, and distribution with minimal restrictions. Attribution is required, but no copyleft obligations apply.

MIT License permits commercial use without additional licensing fees or restrictions. No proprietary license or commercial tier is mentioned. Organizations can deploy cavemem in production systems and offer it as part of a product. Verify the license for any dependencies cavemem itself requires.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Cavemem runs locally by default with no network calls unless remote embedding is configured. Redaction of `<private>...</private>` tags and path glob exclusions mitigate accidental leakage at write time. The web viewer uses a token-protected API (bearer token auto-generated locally). Threat model: Requires review. No audit history, fuzzing results, or formal security review disclosed. SQLite injection risk is standard; assess use of untrusted queries in `search` and `timeline` calls.

Alternatives to consider

LangChain Memory / LlamaIndex Memory

General-purpose agent memory systems with broader framework support, but less IDE-specific and less compression-focused. Heavier overhead, cloud-ready defaults.

Sourcegraph Cody or GitHub Copilot Chat History

Some IDEs have built-in session history, but lack cross-IDE interoperability, semantic search, or token compression. Vendor-locked and not customizable.

Custom SQLite + Vector DB (e.g., Postgres+pgvector)

Full control, but requires manual integration, event capture, compression logic, and MCP server implementation. Significantly higher development and ops overhead.

Software development agency

Build on cavemem with DEV.co software developers

Start with `npm install -g cavemem` and pick your IDE. Capture observations automatically, search your session history, and watch your agents avoid repeating themselves.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

cavemem FAQ

Does cavemem work with agents outside the listed IDEs?
Cavemem's MCP tools can be queried by any agent that supports MCP. However, observation capture requires IDE hooks. If your IDE isn't listed, you can query memory captured elsewhere (query-only mode) but won't populate new observations.
How much disk space will the SQLite database consume?
Unknown. Depends on session volume, observation count, and compression ratio. The ~75% token savings suggest good space efficiency, but absolute database size is not disclosed in the data.
Can I share memory across multiple machines?
Yes, via `cavemem export` and `cavemem import`. Manual cross-device transfer is supported, but real-time sync is not. Importing the same file twice is safe (records are deduplicated).
What happens if I disable the background worker?
Set `embedding.autoStart false` to prevent auto-spawn. Without it, embeddings won't build, the web viewer won't serve, and only FTS5 keyword search (no semantic re-ranking) will work. The HTTP listener is also disabled.

Software development & web development with DEV.co

Need help beyond evaluating cavemem? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and rag frameworks integrations — and maintain them long-term.

Ready to Give Your Agents Memory?

Start with `npm install -g cavemem` and pick your IDE. Capture observations automatically, search your session history, and watch your agents avoid repeating themselves.