Agent/Orchestration
OpenContext - Give Your AI Assistant a Persistent Memory for Multi-Agent Workflows
A personal context store for AI agents: CLI + MCP + Desktop app to capture, search, and reuse project knowledge across agents and repos

π€ Curiosity: How Can We Give AI Agents Persistent Memory?
When building AI-powered applications, one recurring frustration stands out: context gets lost. Every new chat, every session restart, every repo switch β the AI forgets everything. You end up re-explaining your project background, repeating architectural decisions, and sometimes the assistant makes wrong assumptions because it lacks historical context.
Curiosity: What if AI agents could remember your project decisions, technical constraints, and domain knowledge across sessions, repos, and tools? How would that transform the multi-agent development workflow?
Core Question: Can we create a unified context store that works across Cursor, Claude Code, Codex, and other AI coding assistants?
π Retrieve: Understanding OpenContext
The Problem
| Before OpenContext | After OpenContext |
|---|---|
| π Hard to share context across repos/sessions | β Global context library works across all projects |
| π€· Your ideas canβt be quickly perceived by Agent | β Agent loads your background & decisions automatically |
| π Existing knowledge canβt be operated by Coding Agent | β Agent can directly read/write your knowledge base |
What is OpenContext?
OpenContext is a lightweight personal context/knowledge store for AI assistants and coding tools. It enables the paradigm:
βLoad history first, then act; ship, then persist.β
The tool provides:
ocCLI β manage a globalcontexts/library (folders/docs, manifests, search)- MCP Server β so Cursor/Claude Code/Codex/Agents can call OpenContext as tools
- Skills + Slash Commands β user-level skills for Cursor/Claude Code/Codex
- Desktop App β manage/search/edit contexts with a native UI
- Web UI β browse/edit contexts locally (no install required)
Multi-Agent Integration Architecture
graph TB
subgraph OpenContext["OpenContext Multi-Agent System"]
A[User Context] --> B[OpenContext Store]
B --> C[Cursor Agent]
B --> D[Claude Code Agent]
B --> E[Codex Agent]
B --> F[Custom MCP Agents]
C --> C1[opencontext-context]
C --> C2[opencontext-search]
C --> C3[opencontext-create]
C --> C4[opencontext-iterate]
D --> D1[Context Loading]
D --> D2[Knowledge Search]
D --> D3[Doc Creation]
D --> D4[Insight Persistence]
E --> E1[Skill-based Access]
E --> E2[Tool Integration]
F --> F1[MCP Protocol]
F --> F2[Custom Tools]
C1 --> G[Shared Knowledge Base]
C2 --> G
D1 --> G
D2 --> G
E1 --> G
F1 --> G
G --> H[Persistent AI Memory]
end
style B fill:#ff6b6b,stroke:#c92a2a,stroke-width:3px,color:#fff
style G fill:#4ecdc4,stroke:#0a9396,stroke-width:2px,color:#fff
style H fill:#ffe66d,stroke:#f4a261,stroke-width:2px,color:#000
π‘ Innovation: Setting Up Multi-Agent Context Management
Quick Start (30 Seconds)
1
2
3
4
5
6
7
8
9
10
11
12
# 1. Install CLI
npm install -g @aicontextlab/cli
# 2. Initialize (prompts for tool setup; defaults to all)
cd your-project
oc init
# 3. Use slash commands (Cursor + Claude Code)
# /opencontext-context β load background before working
# /opencontext-search β find relevant docs
# /opencontext-create β create a new doc
# /opencontext-iterate β persist what you learned
Installed Components by oc init
| Component | Location | Purpose |
|---|---|---|
| Cursor Commands | ~/.cursor/commands | Slash commands for context operations |
| Claude Code Commands | ~/.claude/commands | Slash commands integration |
| Cursor Skills | ~/.cursor/skills/opencontext-*/SKILL.md | User-level skill definitions |
| Claude Code Skills | ~/.claude/skills/opencontext-*/SKILL.md | Skill-based context access |
| Codex Skills | ~/.codex/skills/opencontext-*/SKILL.md | Codex skill integration |
| MCP Config | ~/.cursor/mcp.json, ~/.claude/mcp.json | MCP server configuration |
CLI Commands Reference
| Command | What it does |
|---|---|
oc init | Initialize OpenContext + user-level tool integrations |
oc folder ls | List folders |
oc folder create <path> -d "desc" | Create a folder |
oc doc create <folder> <name>.md -d "desc" | Create a document |
oc doc ls <folder> | List documents |
oc context manifest <folder> | Generate file list for AI to read |
oc search "query" | Search documents |
oc mcp | Start MCP server for MCP clients |
oc ui | Start local Web UI |
π οΈ Integrating with Multi-Agent Workflows
Workflow Pattern: Context-First Development
flowchart LR
subgraph BeforeWork["Before Work"]
A1[opencontext-context]
A2[Load project background]
end
subgraph DuringWork["During Work"]
B1[opencontext-search]
B2[Search existing conclusions]
end
subgraph AfterWork["After Work"]
C1[opencontext-iterate]
C2[Record decisions]
end
A1 --> A2
A2 --> B1
B1 --> B2
B2 --> C1
C1 --> C2
C2 -.-> A1
style A1 fill:#ff6b6b,stroke:#c92a2a,stroke-width:2px,color:#fff
style B1 fill:#4ecdc4,stroke:#0a9396,stroke-width:2px,color:#fff
style C1 fill:#ffe66d,stroke:#f4a261,stroke-width:2px,color:#000
Slash Commands Deep Dive
| Command | Description | Best For |
|---|---|---|
/opencontext-help | Not sure which to use? Start here | New users |
/opencontext-context | (Safe default) Load background before working | Starting any task |
/opencontext-search | Discover existing docs (no auto index build) | Finding prior decisions |
/opencontext-create | Draft a new doc/idea | Capturing new knowledge |
/opencontext-iterate | Persist conclusions & citations | Ending sessions |
Pro tip: Persist βacceptance criteria / common pitfalls / API contracts / dependency versionsβ as docs β highest ROI.
π Desktop App Features
For visual users who prefer a native UI:
Key Capabilities
- Create folders and docs β Organize by project or topic
- Search with
Cmd/Ctrl + Kβ Searches titles, descriptions, and content - Semantic search β Configure API Key in Settings β Embedding (auto-indexed)
- Cite to agents β Copy citations directly to Cursor/Claude/Agent
Citation Options
| Action | Steps | Effect |
|---|---|---|
| Cite text snippet | Select text β Right-click β βCopy Citationβ | Agent reads snippet + source |
| Cite document | Click citation icon next to doc title | Agent gets full doc + stable_id |
| Cite folder | Right-click folder β βCopy Folder Citationβ | Agent batch-reads all docs inside |
π§ Search Configuration
Search Modes
| Mode | Flag | Requirements |
|---|---|---|
| Keyword | --mode keyword | No embeddings needed |
| Vector | --mode vector | Requires embeddings + index |
| Hybrid | --mode hybrid | Requires embeddings + index (default) |
Enabling Semantic Search (CLI)
1
2
3
4
5
6
7
8
9
10
11
# 1. Set API Key
oc config set EMBEDDING_API_KEY "<your_key>"
# 2. (Optional) Set base URL
oc config set EMBEDDING_API_BASE "https://api.openai.com/v1"
# 3. (Optional) Set Model
oc config set EMBEDDING_MODEL "text-embedding-3-small"
# 4. Build Index
oc index build
Warning: The
oc index buildcommand may use paid APIs. AI assistants are NOT allowed to auto-run it by default.
π€ MCP Server Integration
OpenContext runs as a standard MCP (Model Context Protocol) server using stdio:
1
2
3
4
5
6
7
# Start manually
oc mcp
# User-level config locations:
# - Cursor: ~/.cursor/mcp.json
# - Claude Code: ~/.claude/mcp.json
# - Codex: ~/.codex/mcp.json
Example mcp.json Configuration
1
2
3
4
5
6
7
8
{
"mcpServers": {
"opencontext": {
"command": "npx",
"args": ["@aicontextlab/cli", "mcp"]
}
}
}
π Performance Comparison: With vs Without Context Store
| Metric | Without OpenContext | With OpenContext | Improvement |
|---|---|---|---|
| Context Re-explanation | Every session | Once | β¬οΈ 95% |
| Decision Consistency | Variable | Tracked | β¬οΈ High |
| Cross-repo Knowledge | Manual | Automatic | β¬οΈ Seamless |
| Onboarding Time | Hours per project | Minutes | β¬οΈ 80% |
| Agent Accuracy | Context-limited | Context-enriched | β¬οΈ Significant |
π― Best Practices for Multi-Agent Context
What to Persist
| Document Type | Example Content | ROI |
|---|---|---|
| Acceptance Criteria | Feature requirements, success metrics | βββ |
| Common Pitfalls | Known bugs, edge cases, gotchas | βββ |
| API Contracts | Endpoint specs, data formats | ββ |
| Dependency Versions | Lock file summaries, upgrade notes | ββ |
| Architecture Decisions | ADRs, design rationale | ββ |
| Domain Knowledge | Business logic, terminology | βββ |
Folder Organization Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
~/.opencontext/contexts/
βββ personal/
β βββ preferences.md
β βββ coding-style.md
βββ project-frontend/
β βββ architecture.md
β βββ component-patterns.md
β βββ known-issues.md
βββ project-backend/
β βββ api-design.md
β βββ database-schema.md
β βββ deployment-notes.md
βββ shared/
βββ team-conventions.md
βββ dependency-policies.md
π Environment Configuration
Default Paths
| Purpose | Default Location |
|---|---|
| Contexts | ~/.opencontext/contexts |
| Database | ~/.opencontext/opencontext.db |
Override with Environment Variables
1
2
export OPENCONTEXT_CONTEXTS_ROOT="/path/to/contexts"
export OPENCONTEXT_DB_PATH="/path/to/opencontext.db"
π€ New Questions This Raises
- Automatic Context Extraction: Can agents automatically identify and persist important decisions from conversations?
- Context Versioning: How do we handle context evolution and maintain historical snapshots?
- Team Collaboration: Can multiple developers share and sync context across a team?
- Domain-Specific Templates: What context structures work best for different project types (web app, mobile, ML, etc.)?
- Context Quality: How do we measure and improve the quality of persisted context?
Next Experiment: Building automated context extraction from conversation history using multi-agent orchestration.
References
Official Resources:
- OpenContext GitHub Repository
- OpenContext Usage Guide
- OpenContext Website
- NPM Package: @aicontextlab/cli
Related Tools & Frameworks:
Multi-Agent Systems:
Context Management Research:
- RAG: Retrieval-Augmented Generation
- Long-term Memory for LLMs
- Building Effective AI Agents (Anthropic)
Production Resources:
Working on something like this?
I take a small number of paid, scoped reviews: AI agent/RAG architecture diagnosis, Unity CI & build-automation audits, and multimodal QA design review. Each one ends in a written findings document.
Work with me