{"name":"Magic Context: Unbounded, Self-Managing Memory for AI Coding Agents","description":"Magic Context is a powerful GitHub repository that provides unbounded, self-managing memory for AI coding agents. Acting as the 'hippocampus' for agents, it ensures continuous learning and recall across sessions without disruptive context compaction. This tool, part of CortexKit, allows agents to build lasting project knowledge and maintain context efficiently.","github":"https://github.com/cortexkit/magic-context","url":"https://osrepos.com/repo/cortexkit-magic-context","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/cortexkit-magic-context","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/cortexkit-magic-context.md","json":"https://osrepos.com/repo/cortexkit-magic-context.json","topics":["AI Agents","Agent Memory","Context Management","TypeScript","AI Development","LangChain","CortexKit","Open Source"],"keywords":["AI Agents","Agent Memory","Context Management","TypeScript","AI Development","LangChain","CortexKit","Open Source"],"stars":null,"summary":"Magic Context is a powerful GitHub repository that provides unbounded, self-managing memory for AI coding agents. Acting as the 'hippocampus' for agents, it ensures continuous learning and recall across sessions without disruptive context compaction. This tool, part of CortexKit, allows agents to build lasting project knowledge and maintain context efficiently.","content":"## Introduction\n\nMagic Context is an innovative solution designed to address the persistent memory challenges faced by AI coding agents. It provides an \"unbounded context\" and a self-managing memory system, akin to a hippocampus, enabling agents to retain knowledge and context across long-running sessions. This crucial component of the CortexKit ecosystem ensures that agents can learn, remember, and recall project-specific information without the typical limitations of short-term memory or disruptive context management processes.\n\n## Why Use It & Key Benefits\n\nMagic Context transforms how AI agents interact with their environment and tasks, offering several significant advantages:\n\n*   **Uninterrupted Workflow**: Agents never stop to manage their context, eliminating disruptive \"compaction\" pauses. The system handles context management continuously in the background, ensuring a smooth and uninterrupted workflow.\n*   **Persistent Memory**: Agents never forget. Magic Context builds lasting project knowledge, allowing agents to accumulate and recall information across weeks, months, or even years.\n*   **Historian for Knowledge Capture**: The historian component automatically compresses old raw history into tiered chambers, summarizing permanent knowledge, such as decisions, constraints, and conventions, into project memory. This process builds your agent's memory from the work it already performs.\n*   **Dreamer for Memory Consolidation**: An optional dreamer agent works in the background, similar to how sleep consolidates human memories. It checks memories against the current codebase, organizes redundancies, refines phrasing, and upgrades recurring insights, ensuring memory quality over time.\n*   **Intelligent Recall**: Active project memories and compressed session history are automatically injected into the agent's context. Agents can also use `ctx_search` to query project memories, raw conversation history, and indexed Git commits, providing relevant information precisely when needed.\n*   **Cache-Aware Design**: The system is designed with a stable cache layout, ensuring that background operations never invalidate the cached prompt prefix. This maintains efficiency and reduces costs with cache-aware providers.\n*   **Cross-Session and Cross-Harness Persistence**: Memories persist seamlessly across different sessions and are shared between various harnesses like OpenCode and Pi, allowing for a unified knowledge base.\n\n## Installation\n\nGetting started with Magic Context is straightforward. You can use the interactive setup wizard which detects your models, configures everything, and handles compatibility.\n\n**macOS / Linux:**\nbash\ncurl -fsSL https://raw.githubusercontent.com/cortexkit/magic-context/master/scripts/install.sh | bash\n\n\n**Windows (PowerShell):**\npowershell\nirm https://raw.githubusercontent.com/cortexkit/magic-context/master/scripts/install.ps1 | iex\n\n\n**Or run directly (any OS):**\nbash\nnpx @cortexkit/magic-context@latest setup\n\n\nThe wizard automatically detects your harnesses, adds the necessary plugin, disables built-in compaction, and helps you select models.\n\n## Examples\n\nMagic Context provides powerful agent tools for memory management and recall.\n\n**Writing to Project Memory with `ctx_memory`:**\nAgents can explicitly record cross-session knowledge into specific categories.\n\n\nctx_memory(action=\"write\", category=\"ARCHITECTURE\", content=\"Event sourcing for orders.\")\n\n\n**Searching Across Memories, Conversations, and Git with `ctx_search`:**\nAgents can query multiple layers of information simultaneously for relevant context.\n\n\nctx_search(query=\"why did we pick event sourcing for orders\")\n\n\n## Links\n\nExplore Magic Context further through these official resources:\n\n*   **GitHub Repository**: [https://github.com/cortexkit/magic-context](https://github.com/cortexkit/magic-context)\n*   **Official Documentation**: [https://docs.cortexkit.io/magic-context](https://docs.cortexkit.io/magic-context)\n*   **Desktop Application**: [https://github.com/cortexkit/magic-context/releases](https://github.com/cortexkit/magic-context/releases)","metrics":{"detailViews":3,"githubClicks":1},"dates":{"published":null,"modified":"2026-09-02T19:54:55.000Z"}}