{"name":"claude-mem: Persistent Context Across Sessions for AI Agents","description":"claude-mem is an innovative GitHub repository designed to provide persistent context across sessions for various AI agents. It intelligently captures agent activities, compresses them using AI, and injects relevant information into future interactions. This powerful tool supports a wide range of AI platforms, including Claude Code, OpenClaw, Gemini, and Copilot.","github":"https://github.com/thedotmack/claude-mem","url":"https://osrepos.com/repo/thedotmack-claude-mem","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/thedotmack-claude-mem","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/thedotmack-claude-mem.md","json":"https://osrepos.com/repo/thedotmack-claude-mem.json","topics":["ai-agents","persistent-memory","claude-code","typescript","rag","artificial-intelligence","open-source","embeddings"],"keywords":["ai-agents","persistent-memory","claude-code","typescript","rag","artificial-intelligence","open-source","embeddings"],"stars":null,"summary":"claude-mem is an innovative GitHub repository designed to provide persistent context across sessions for various AI agents. It intelligently captures agent activities, compresses them using AI, and injects relevant information into future interactions. This powerful tool supports a wide range of AI platforms, including Claude Code, OpenClaw, Gemini, and Copilot.","content":"## Introduction\n\n**claude-mem** is a powerful open-source repository by thedotmack that provides persistent context across sessions for various AI agents. It addresses a critical challenge in AI development: enabling agents to retain and leverage knowledge from past interactions. By automatically capturing agent activities, compressing them with AI, and injecting relevant context into future sessions, claude-mem ensures a continuous and intelligent workflow. This system is designed to work seamlessly with a wide array of AI platforms, including Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, and OpenCode, making it an invaluable tool for developers building sophisticated AI applications.\n\n## Installation\n\nGetting started with claude-mem is straightforward. The primary installation method is via `npx`:\n\nbash\nnpx claude-mem install\n\n\nFor specific IDEs, you can use the `--ide` flag:\n\nbash\n# For Gemini CLI (auto-detects ~/.gemini)\nnpx claude-mem install --ide gemini-cli\n\n# For OpenCode\nnpx claude-mem install --ide opencode\n\n\nIf you are using Claude Code, you can install it directly from the plugin marketplace:\n\nbash\n/plugin marketplace add thedotmack/claude-mem\n/plugin install claude-mem\n\n\nAfter installation, restart your AI environment (e.g., Claude Code or Gemini CLI) for the changes to take effect. Context from previous sessions will then automatically appear in new sessions.\n\n**Note:** While `claude-mem` is also on npm, `npm install -g claude-mem` only installs the SDK/library and does not set up the necessary plugin hooks or worker service. Always use `npx claude-mem install` or the `/plugin` commands for full functionality.\n\nFor OpenClaw Gateway integration, use the dedicated installer:\n\nbash\ncurl -fsSL https://install.cmem.ai/openclaw.sh | bash\n\n\n## Examples\n\nclaude-mem enhances AI agent capabilities with intelligent memory search through a token-efficient, 3-layer workflow pattern. This approach optimizes context retrieval, saving tokens and improving performance.\n\n**The 3-Layer Workflow:**\n\n1.  **`search`**: Get a compact index with IDs (e.g., ~50-100 tokens per result).\n2.  **`timeline`**: Get chronological context around interesting results.\n3.  **`get_observations`**: Fetch full details ONLY for filtered IDs (e.g., ~500-1,000 tokens per result).\n\nHere's an example of how to use these tools:\n\ntypescript\n// Step 1: Search for index\nsearch(query=\"authentication bug\", type=\"bugfix\", limit=10)\n\n// Step 2: Review index, identify relevant IDs (e.g., #123, #456)\n\n// Step 3: Fetch full details\nget_observations(ids=[123, 456])\n\n\nThis method allows AI agents to efficiently query their memory, focusing on relevant information and significantly reducing token usage compared to fetching full details upfront.\n\n## Why Use It\n\nclaude-mem offers a suite of features designed to elevate the performance and intelligence of your AI agents:\n\n*   **Persistent Memory**: Ensures context survives across sessions, allowing agents to build on past knowledge.\n*   **Progressive Disclosure**: Provides layered memory retrieval with clear token cost visibility, optimizing resource usage.\n*   **Skill-Based Search**: Query your project history using natural language with the `mem-search` skill.\n*   **Web Viewer UI**: A real-time memory stream available at `http://localhost:37777` for easy monitoring and debugging.\n*   **Privacy Control**: Use `<private>` tags to exclude sensitive content from storage, maintaining data confidentiality.\n*   **Automatic Operation**: Requires no manual intervention, seamlessly integrating into your agent's workflow.\n*   **Token Savings**: The 3-layer search workflow provides approximately 10x token savings by filtering before fetching full details.\n\nBy integrating claude-mem, developers can empower their AI agents with robust, long-term memory capabilities, leading to more coherent, efficient, and intelligent interactions.\n\n## Links\n\n*   **GitHub Repository**: [https://github.com/thedotmack/claude-mem](https://github.com/thedotmack/claude-mem){:target=\"_blank\"}\n*   **Official Documentation**: [https://docs.claude-mem.ai/](https://docs.claude-mem.ai/){:target=\"_blank\"}\n*   **Official X Account**: [@Claude_Memory](https://x.com/Claude_Memory){:target=\"_blank\"}\n*   **Official Discord**: [Join Discord](https://discord.com/invite/J4wttp9vDu){:target=\"_blank\"}","metrics":{"detailViews":10,"githubClicks":7},"dates":{"published":null,"modified":"2026-05-20T00:04:58.000Z"}}