magic-context
Unbounded context. Memory that manages itself. One session, for life. The hippocampus for coding agents, part of CortexKit.
Magic Context is a Claude Code plugin that provides unbounded, self-managing context and long-term memory for AI coding agents, enabling continuous sessions that never forget. It captures project knowledge automatically as conversations progress, consolidates memories through background dreamer agents, and recalls relevant information across sessions without manual intervention. The plugin eliminates context window compaction pauses by using a background historian that compresses old conversation history into tiered compartments, while maintaining a stable prompt cache. Compatible with OpenCode, Pi, and Oh My Pi (OMP) harnesses, it stores all project memories, constraints, and decisions in a shared SQLite database accessible across different coding environments.
Key Features
Use Cases
- 01Maintaining long-running development sessions across weeks or months without losing project context
- 02Automatically building a knowledge base of architectural decisions, constraints, and coding conventions
- 03Searching across past conversations and git history to recall why specific technical decisions were made
- 04Running low-cost or local models for background memory tasks while keeping premium models for active coding
- 05Sharing project knowledge between different AI coding environments (OpenCode, Pi, OMP)
- 06Consolidating and verifying project memories overnight to keep documentation current with code changes
Related Plugins
View moreandrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
claude-mem
Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Understand-Anything
Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
rtk
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
magic-context — FAQ
What is Magic Context and what does it do?+
Magic Context is a Claude Code plugin that gives AI coding agents persistent memory and self-managing context across sessions. It automatically captures project knowledge from conversations, compresses old history in the background, and recalls relevant information without manual intervention, enabling sessions that can run for months without forgetting.
How do I install Magic Context?+
Run the interactive setup wizard with `npx @cortexkit/magic-context@latest setup` on any OS, or use the curl/PowerShell one-liners for macOS/Linux/Windows. The wizard auto-detects your harnesses (OpenCode, Pi, OMP), configures the plugin, disables built-in compaction, and helps you select models for the historian and dreamer agents.
Which AI coding clients does Magic Context support?+
Magic Context works with OpenCode, Pi (version 0.74.0 or higher), and Oh My Pi/OMP (version 17.1.7 or higher). All three harnesses share the same SQLite database, so project memories and embeddings are accessible across all supported environments.
Do I need API keys or a specific model to use Magic Context?+
You must configure a historian model in your magic-context.jsonc config file (e.g., `historian.opencode.model`). You can use any provider/model combination your harness supports, including local models. The optional dreamer and embedding features can also use local models to minimize costs.
Is Magic Context free to use?+
Magic Context itself is MIT-licensed open source software. However, you'll incur costs for the AI models you configure for the historian and optional dreamer agents, unless you use fully local models.
Does Magic Context work with other context-management plugins?+
No, Magic Context disables itself if another context manager is detected to prevent conflicts. It automatically checks for OpenCode built-in compaction, OMP native compaction/memory, DCP, and oh-my-opencode overlapping features, and the setup wizard helps you resolve these conflicts.
How do I install magic-context?+
Open the source repository on GitHub and follow its README. magic-context is a plugin — MCP Agents Market links you directly to the official repo.
Is magic-context free?+
magic-context is an open-source project hosted on GitHub. Check the repository for its license and any usage requirements.