Rank #05 · Daily · Agent-Skill
claude-mem: Capture, Compress, Reinject — Persistent Memory for Coding Agents
Stop re-explaining your codebase every morning. claude-mem gives agents a searchable, token-aware memory that persists between sessions.
What it does
The repository description: "Persistent Context Across Sessions for Every Agent." It captures everything your agent does during a session, compresses it with AI, and injects relevant context back into later sessions. Supported hosts listed include Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode "+ more," with installers also covering T3 Code, Antigravity CLI, Pi, and others.
The pipeline has three stages:
- Capture. Lifecycle hooks in the host agent record tool use, prompts, and outcomes as observations. A local worker process handles them.
- Compress. An AI step condenses raw activity into compact, typed observations and session summaries, stored locally (SQLite plus search indexes; Chroma for hybrid semantic/keyword search).
- Reinject. At session start, relevant context is injected automatically. During a session, the agent can query memory through MCP search tools.
Retrieval uses progressive disclosure. The agent first gets a compact index of matching observation IDs, can optionally pull a timeline around one, and only fetches full details for the IDs it actually needs — keeping memory lookups cheap in tokens.
Other details from the project docs:
- Settings live in
~/.claude-mem/settings.json(model, worker port, data directory, context-injection options). - Wrap content in
<private>tags to keep it out of memory. - Modes adjust observation style and language (for example
code--zh). - A web viewer lets you browse captured memory; optional cloud sync / commercial layers sit beside the Apache-2.0 core.
- Install with
npx claude-mem install(or host-specific flags), not a bare global npm install, so hooks and the worker get wired up.
Who it's for
- Heavy users of Claude Code, Codex, Gemini CLI, OpenCode, or similar hosts on long-lived repos where each new session starts cold.
- Teams running several agent hosts that want one memory store across them.
- Anyone who keeps a hand-maintained
CONTEXT.mdand wants that process automated and searchable.
Stars / language / license
112,878 stars · TypeScript · Apache-2.0
Data verified: 2026-11-05 09:31 Asia/Shanghai (GitHub API get_repository + README get_file_contents)
Trending note: +1,172 stars today (Trending selection captured 09:26 Asia/Shanghai), still notable growth for a repo already past 100k stars.
Category tags
Agent-Skill · agent-memory · MCP · Claude-Code · context-engineering · SQLite · RAG
How it differs from similar projects
Compared with built-in host memory (CLAUDE.md, AGENTS.md, vendor "memories"). Built-in options are mostly static files you write or vendor-specific stores. claude-mem observes automatically and works across hosts.
Compared with memory libraries (mem0-style SDKs, vector stores). Libraries give you primitives and leave the integration to you. claude-mem is an opinionated, installed product: hooks, worker, compression, injection, MCP search, and a viewer, all wired into agent lifecycles.
Compared with "dump the transcript into RAG." The compression step and progressive-disclosure retrieval aim to return small, relevant context rather than raw logs.
Caveats. Compression calls a model, so it has costs and privacy implications — check which model and provider your settings use. Read the project's license-boundary docs before an enterprise rollout. Usage-savings claims in marketing copy aren't independent benchmarks, and TidyHow hasn't measured them.
Quick mental model
| Stage | Where it runs | What you control | |---|---|---| | Capture | Host hooks → local worker | Which hosts, <private> tags | | Compress | Model call | Model/provider in settings | | Reinject | SessionStart + MCP search | Injection scope, query filters |