cortexkit/magic-context

Unbounded context. Memory that manages itself. One session, for life. The hippocampus for coding agents, part of CortexKit.

What it solves

Coding agents often suffer from "anterograde amnesia," where every new task starts from zero without memory of previous decisions, constraints, or project history. Standard context compaction can also interrupt the agent's flow by forcing pauses to re-read history. Magic Context provides a persistent, self-managing memory that allows agents to become long-term teammates rather than disposable contractors.

How it works

Magic Context acts as a "hippocampus" for agents through three main processes:

  • Capture: A background "historian" compresses raw conversation history into tiered, chronological summaries (compartments) and extracts durable knowledge (like architecture decisions or project rules) into permanent project memory.
  • Consolidate: An optional "dreamer" agent runs during idle time to verify memories against the codebase, remove duplicates, and update documentation.
  • Recall: The system automatically injects relevant memories and compacted history into the active context window. Agents can also explicitly search through memories, conversation history, and git commits.

Who it’s for

It is designed for developers using coding agent harnesses (specifically OpenCode and Pi) who want to maintain continuous, long-running sessions without losing project context or suffering from context-window limitations.

Highlights

  • Unbounded sessions: Manages context in the background so the agent never has to stop for compaction pauses.
  • Self-organizing memory: Automatically lifts important decisions and conventions into a searchable project memory.
  • Cross-session persistence: Memories and context persist across different sessions and different agent harnesses.
  • Cache-aware operations: Designed to maintain prompt cache stability to reduce costs and latency.
  • Desktop management: Includes a companion desktop app to browse and edit memories and session history via a GUI.