ContextOS
ContextOS
Persistent engineering context for AI coding agents. ContextOS is an MCP server that gives Claude Code memory across sessions. Store decisions, notes, and gotchas once; the agent already knows them next time you open a project.
Apache 2.0. Single binary. No cloud, no auth, no Postgres.
How it works
When Claude Code opens a workspace, ContextOS injects a context summary into
the MCP initialize handshake. The agent receives your recent commits, open
todos, and top decisions before any user message. No tool call required.
Three MCP tools are always available:
remember -- store a memory (decision, note, gotcha, or todo).
recall -- search memories by hybrid semantic and keyword search.
context -- assemble a full workspace summary on demand.
Storage is local SQLite, one file per workspace under ~/.contextos/.
Related MCP server: Cortex
Install (Claude Code)
/plugin marketplace add aftabkh4n/contextos
/plugin install contextos@contextosRestart Claude Code. The first start downloads the binary for your
platform. If contextos shows as failed in /mcp, choose Reconnect.
This happens once per install or update.
Then open any git repo and ask: "What was I working on?"
Other install options
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/aftabkh4n/contextos/main/install.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/aftabkh4n/contextos/main/install.ps1 | iexThe script downloads the right binary for your platform, extracts it, adds it to PATH, registers with Claude Code, and runs a selftest.
Or via .NET tool (requires .NET 10 SDK):
dotnet tool install -g ContextOSThe .NET tool path does not include the ONNX model. Run
contextos --selftestafter install. If it reports a missing model, see TROUBLESHOOTING.md for the three options to fix it.
After installing, register with Claude Code:
claude mcp add --scope user contextos -- contextosDocker (amd64 and arm64):
docker build -t contextos https://github.com/aftabkh4n/contextos.git
docker run -i --rm -v contextos-data:/data -v "$PWD":/workspace contextosThe image runs the server over stdio, so give it -i. Memories are stored in
/data; keep the contextos-data volume to keep them between runs. Mount the
project you want memories for at /workspace. The model is built into the
image, so the server needs no network at runtime. A container cannot see which
project Claude Code has open, so register it once per project, from that
project's folder:
claude mcp add --scope project contextos -- docker run -i --rm -v contextos-data:/data -v "$PWD":/workspace contextosIf downloading from "latest" returns a 404, the release has not been published yet. Check the Releases tab.
macOS (Apple Silicon)
These commands are safe to run repeatedly. If you've installed ContextOS before, this will cleanly upgrade you to the latest version.
# Stop any running instance and remove existing registration (no-ops on a fresh machine)
pkill -f contextos || true
claude mcp remove contextos 2>/dev/null || true
# Extract to a permanent location (no sudo required)
mkdir -p "$HOME/.local/share/contextos/osx-arm64"
curl -fsSL https://github.com/aftabkh4n/contextos/releases/latest/download/contextos-osx-arm64.tar.gz \
| tar xz -C "$HOME/.local/share/contextos"
# Verify
"$HOME/.local/share/contextos/osx-arm64/contextos" --version
# Register with Claude Code (full path, works without any PATH changes)
claude mcp add --scope user contextos -- "$HOME/.local/share/contextos/osx-arm64/contextos"macOS (Intel)
pkill -f contextos || true
claude mcp remove contextos 2>/dev/null || true
mkdir -p "$HOME/.local/share/contextos/osx-x64"
curl -fsSL https://github.com/aftabkh4n/contextos/releases/latest/download/contextos-osx-x64.tar.gz \
| tar xz -C "$HOME/.local/share/contextos"
"$HOME/.local/share/contextos/osx-x64/contextos" --version
claude mcp add --scope user contextos -- "$HOME/.local/share/contextos/osx-x64/contextos"Linux x64
pkill -f contextos || true
claude mcp remove contextos 2>/dev/null || true
mkdir -p "$HOME/.local/share/contextos/linux-x64"
curl -fsSL https://github.com/aftabkh4n/contextos/releases/latest/download/contextos-linux-x64.tar.gz \
| tar xz -C "$HOME/.local/share/contextos"
"$HOME/.local/share/contextos/linux-x64/contextos" --version
claude mcp add --scope user contextos -- "$HOME/.local/share/contextos/linux-x64/contextos"Windows (PowerShell)
# Stop any running ContextOS (released by Claude Code MCP sessions)
Get-Process -Name contextos -ErrorAction SilentlyContinue | Stop-Process -Force
& claude mcp remove contextos
# Download and extract to a permanent location (no admin required)
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://github.com/aftabkh4n/contextos/releases/latest/download/contextos-win-x64.zip" `
-OutFile "$env:TEMP\contextos-install.zip"
Expand-Archive "$env:TEMP\contextos-install.zip" -DestinationPath "$env:LOCALAPPDATA\Programs\contextos" -Force
$ProgressPreference = 'Continue'
# Verify it runs
& "$env:LOCALAPPDATA\Programs\contextos\win-x64\contextos.exe" --version
# Register with Claude Code (full path, works without any PATH changes)
claude mcp add --scope user contextos -- "$env:LOCALAPPDATA\Programs\contextos\win-x64\contextos.exe"Optional: add to PATH so you can type contextos at the command line:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:LOCALAPPDATA\Programs\contextos\win-x64", "User")
# Restart your PowerShell session for the change to take effect..NET tool (requires .NET 10 SDK)
dotnet tool install -g ContextOSThe .NET tool path does not include the ONNX model. Run
contextos --selftestafter install. If it reports a missing model, see TROUBLESHOOTING.md for the three options to fix it.
After installing, register with Claude Code:
claude mcp add --scope user contextos -- contextosVerify the registration
Run claude mcp list — contextos should appear without a "failed" status.
Open a Claude Code session and run /mcp to confirm all three tools appear:
remember, recall, context.
First five minutes
After registering, open Claude Code in any git repo with a few commits. Ask:
"What was I working on?"
The agent will describe the recent commit history and any stored memories without calling any tool. That is auto-hydration working.
Then try storing a memory:
"Use contextos remember to store: We chose SQLite over Postgres to keep the install zero-dependency. Type: decision, importance: 0.8."
Close Claude Code, reopen it in the same directory, and ask again. The decision comes back automatically.
Technical summary
ContextOS listens on stdio and speaks the MCP protocol. On the initialize
handshake it assembles a context blob (recent commits, top memories by
importance and recency, open todos) and returns it in serverInfo.instructions.
The client passes this to the model as a system instruction before any user
message lands.
Search uses a hybrid pipeline: vector cosine similarity over 384-dim embeddings (all-MiniLM-L6-v2, runs locally via ONNX Runtime) merged with SQLite FTS5 full-text search. The two ranked lists are merged via Reciprocal Rank Fusion and reranked by recency and stored importance. All of this runs in-process with no network calls for the default ONNX provider.
State lives in ~/.contextos/{workspace_id}.db, one SQLite file per workspace.
The workspace ID is derived from the absolute path of the nearest .git directory.
No data leaves the machine unless you configure the OpenAI embeddings provider.
Scope
v1 is a local, single-user tool. Out of scope: web UI, auth, Postgres, team sync, cloud features, PR ingestion, architecture graphs, memory decay policies. See PROJECT.md for the full spec.
Contributing
See CONTRIBUTING.md.
License
Apache 2.0. See LICENSE.
Available Tools
4 toolscontextA
Read-only. Returns a Markdown summary of this workspace's memories. Use it when you need more than the summary injected at session start.
Inputs: scope.
recallA
Read-only. Searches stored memories by meaning and keywords, ranked by relevance, recency and importance. Use it before answering questions about past decisions or gotchas. Returns a JSON array of {id, type, content, score}; content is cut to 300 characters.
Inputs: query (required), k, scope, types.
rememberA
Saves a memory for this workspace so later sessions can recall it. Stored verbatim in a local SQLite file. Memories not recalled for 90 days (default) are archived. Returns JSON {id, message}.
Inputs: content (required), tags, type, importance.
remember_skillA
Saves a reusable procedure for this project, such as how to release or run a migration. Skills never decay and appear in the current context summary. Returns JSON {id, message}.
Inputs: name (required), steps (required), outcome (required), tags, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The four tools have mostly distinct purposes: read summary, save memory, save reusable skill, and search. The only possible confusion is between remember and remember_skill, but the descriptions clearly separate decaying memories from permanent procedures.
All names are lowercase with underscores, but the conventions are mixed: context is a noun, recall and remember are bare verbs, and remember_skill is verb_noun. The set is readable but lacks a predictable naming pattern.
Four tools is a well-scoped surface for a memory context server: one for summary, one for search, and two for persistence. Each tool earns its place without bloat.
The surface covers creating memories/skills, reading a summary, and searching, but lacks update, delete/forget, and targeted retrieval by ID. Agents cannot manage or correct stored memories beyond adding new ones.
Maintenance
Related MCP Connectors
Give your AI agent persistent, governed memory for every project. At task start it recalls the approved decisions, conventions, risks and architecture (semantic search, ranked by importance); at close it proposes what was learned as typed memories that you review and approve — governance, not a notes dump. Agents propose, humans govern: edits go back to pending and deletion is human-only by design. Connect Claude Code, Cursor, Claude Desktop or any MCP client in two minutes with just your API key — hosted (nothing to install) or locally via `uvx solucortex-mcp`. Built by SoluAI and dogfooded daily: SoluCortex is developed using its own living memory.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Share one project context across ChatGPT, Claude, Telegram and any MCP client.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Related MCP Servers
- AlicenseAqualityBmaintenancePersistent memory MCP server for Claude Code, Cursor, and GitHub Copilot. Semantic search, Git sync, project-based, Persistent memory MCP server for Claude Code, Cursor, and GitHub Copilot. Semantic search, Git sync, project-based organization, and team collaboration via Model Context Protocol.15342 npm2MIT
- AlicenseNot gradedqualityDmaintenancePersistent memory MCP server for Claude Code that captures and recalls project context across sessions, eliminating the need to re-explain architecture and decisions daily.73 npm1MIT
- AlicenseAqualityCmaintenanceLocal MCP server giving AI coding agents (Claude Code, Cursor, VS Code/JetBrains Copilot) a shared, persistent memory of your projects and every bug/issue faced during development. Stateless, plain-file storage (AGENTS.md + issues.jsonl) — no database.1691 npm1MIT
- AlicenseNot gradedqualityBmaintenanceStandardize Context, Not Intelligence. An open protocol and native MCP server for preserving, organizing, and serving structured project context (architecture, decision logs, domain rules, and roadmap) to AI coding assistants (Cursor, Claude Desktop, Antigravity) with built-in CLI verificationMIT