cortexkit

magic-context: Manage Coding Agent Context and Memory

Magic Context manages coding-agent context and project memory across sessions, reducing reliance on disruptive compaction and manual note-taking. It is designed for developers using OpenCode, Pi, or Oh My Pi who want persistent, searchable project knowledge.

Stars
2.3k
Forks
129
Stars, last 15 days
+95

Our take

Health score

70/100

How it is scored
Activity
90
Community
33
Issues
86
Pull requests
72

+95 stars in the last 15 days

  • Releases more often than 93% of the projects we track

Overview

Magic Context is a context-management and memory plugin for coding agents. It continuously summarizes older conversation history, captures durable project knowledge, and makes relevant information available in later turns and sessions.

It is intended for developers who keep agents working on a project over time and want less manual context maintenance. It replaces host compaction in supported harnesses, so it is best suited to users willing to let it manage that part of the agent workflow.

Key Features

  • Summarizes older conversation history into tiered compartments while retaining access to the original transcript.
  • Captures project decisions, constraints, conventions, and configuration details as reusable memories.
  • Injects relevant memories and session history into later turns, with tools for searching and expanding past context.
  • Offers optional background consolidation to verify, curate, and update memories against the codebase.
  • Supports OpenCode, Pi, and Oh My Pi, with a shared local SQLite store for cross-harness memory.
  • Includes a desktop app for browsing memories, session history, logs, and configuration.

Use Cases

  • A developer maintaining a long-running project wants an agent to retain project decisions between sessions.
  • Teams using coding agents encounter context-window limits and want background history management instead of manual summaries.
  • Developers switching between supported harnesses want project memories available across those tools.
  • Users who want to inspect or maintain agent memory outside the terminal can use the companion desktop app.

Getting Started

Run the setup wizard with:

npx @cortexkit/magic-context@latest setup

It detects supported harnesses and guides configuration. See the README for harness-specific setup, configuration, and troubleshooting details.

Considerations

  • The historian requires a model configured for the active harness; without one, history summarization fails.
  • Magic Context is designed to own context management. Its setup disables or flags overlapping compaction and memory features, so check compatibility with other context plugins before enabling it.
  • It does not backfill sessions from before installation. Persistent memory and history depend on retaining its local SQLite database.
  • Memory consolidation by the dreamer is optional, and embeddings can use a local model by default or be configured differently. Review storage and model settings for your environment.

Found this useful?

Share it with someone who would like magic-context.