Not through prompt engineering tricks, but by automatically capturing what happens during your work and injecting compressed observations when you restart.
Claude-Mem works like a persistent context layer that survives session crashes, context limits, and those annoying moments when you have to restart because you hit token caps.
This open-source tool ❤️ uses lifecycle hooks to watch everything Claude does, extracts the meaningful bits through the Claude Agent SDK, and stores them in a SQLite database with full-text search. What makes it interesting is the progressive disclosure approach: you see an index of past observations with token costs upfront, then pull full details only when needed - mimicking how humans actually retrieve memories instead of dumping everything into context at once. Highlights:
- Automatic Context Injection - No manual commands needed; recent observations auto-inject at session start with type indicators ( critical, informational) and token costs displayed upfront, helping Claude decide whether to fetch details or read source code directly.
- Multi-Layer Memory Retrieval - Layer 1 shows observation indexes with token costs, Layer 2 fetches full narratives on-demand via MCP search, Layer 3 accesses original source code and complete transcripts for perfect recall.
- 10 Search Operations - Search by observations, sessions, prompts, concept tags, files, types, recent context, timeline around specific points, timeline by query match, plus API help—all accessible through the mem-search skill or HTTP endpoints.
- Installation - Run /plugin marketplace add thedotmack/claude-mem and /plugin install claude-mem in Claude Code, then restart; Bun and uv auto-install if missing, worker service starts automatically, memory capture begins immediately.