What it is
claude-mem is a project for persistent context across AI-agent sessions. Agents often forget previous commands, decisions, and fixed errors; claude-mem tries to preserve that information between runs.
It supports Claude Code, Gemini CLI, Codex, OpenClaw, and similar agent environments. It uses lifecycle hooks, a worker service, search, and compression to bring relevant fragments into new sessions.
What is inside
The repository contains installation scripts, hook architecture, a local worker service, web viewer, search, documentation, beta features, and integrations. It describes hooks such as SessionStart, UserPromptSubmit, PostToolUse, Stop, and SessionEnd.
A practical flow is to install claude-mem, restart the agent tool, use it across several sessions, and check whether useful context appears without manual note copying.
Lifecycle idea
This snippet shows which session moments can be captured and later returned as context.
SessionStart -> load relevant memory
PostToolUse -> capture action
Stop -> summarize session
Next session -> inject context
Strengths and limits
The strength is reducing context loss. Long coding tasks need memory of decisions, local project details, and already investigated dead ends.
The limitation is privacy and noise. The system observes agent work, so storage, cleanup, and secret handling matter. Bad memory can confuse the agent instead of helping.