Skip to main content
Glama

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@contextos

Restart 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 | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/aftabkh4n/contextos/main/install.ps1 | iex

The 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 ContextOS

The .NET tool path does not include the ONNX model. Run contextos --selftest after 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 -- contextos

Docker (amd64 and arm64):

docker build -t contextos https://github.com/aftabkh4n/contextos.git
docker run -i --rm -v contextos-data:/data -v "$PWD":/workspace contextos

The 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 contextos

If 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 ContextOS

The .NET tool path does not include the ONNX model. Run contextos --selftest after 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 -- contextos

Verify 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 tools
contextA

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

    A3.7/5.0

    Scored across 4 tools

    Disambiguation4/5

    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.

    Naming Consistency3/5

    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.

    Tool Count5/5

    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.

    Completeness3/5

    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

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Persistent 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.
      15
      342 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Persistent 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 npm
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Local 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.
      16
      91 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Standardize 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 verification
      MIT