# context-mem [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/JubaKitiashvili/context-mem  
**GitHub Stars:** 20  
**npm Downloads (last month):** 450  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/context-mem

## Description
Persistent memory for AI agents — 98%+ retrieval recall, 99% token savings, 44 tools

## Tools
Capabilities this server exposes over MCP:

- **observe** — Store observation with auto-summarization, importance scoring, entity extraction, topic detection
- **recall** — Retrieve verbatim content by filter (importance, type, flag, time)
- **search** — Hybrid search (BM25 + vector + optional LLM judge)
- **ask** — Natural language Q&A over the full memory store
- **timeline** — Reverse-chronological observations with importance badges and flags
- **stats** — Token economics for current session (raw vs. compressed)
- **save_knowledge** — Save a knowledge entry with contradiction detection + temporal validity windows
- **search_knowledge** — Search (superseded entries filtered by default)
- **promote_knowledge** — Promote to global cross-project store
- **global_search** — Search across all projects simultaneously
- **resolve_contradiction** — Resolve knowledge conflicts (supersede / merge / keep / archive)
- **merge_suggestions** — View cross-project duplicate suggestions
- **graph_query** — Traverse entity relationships
- **add_relationship** — Link entities with typed relationships
- **graph_neighbors** — Find connected entities (configurable depth)
- **temporal_query** — Query what was true at a specific point in time
- **time_travel** — Compare project state at two arbitrary timestamps
- **explain_decision** — Walk evidence chain backward to reconstruct why a decision was made
- **predict_loss** — Identify observations at risk of compression/deletion
- **generate_story** — Generate PR description, standup update, ADR, or onboarding guide
- **entity_detect** — Detect entities in arbitrary text
- **find_tunnels** — Find cross-project topic connections
- **wake_up** — Token-budgeted context primer for session start
- **restore_session** — Restore session from checkpoint
- **handoff_session** — Cross-session continuity package
- **agent_register** — Register an agent with role and capabilities
- **agent_status** — Check all active agents and their claimed resources
- **claim_files** — Claim files to prevent parallel-agent conflicts
- **agent_broadcast** — Broadcast a finding to all agents in the project
- **configure** — Update runtime configuration
- **budget_status** — Token budget management
- **summarize** — Summarize content without storing (one-shot)
- **execute** — Run code (JS, TS, Python, Shell, Ruby, Go, Rust, PHP, Perl, R, Elixir)
- **index_content** — Index with code-aware chunking
- **search_content** — Search indexed chunks
- **list_people** — Browse entities and topics
- **import_conversations** — Import conversation history
- **browse** — Retrieve observations by person, entity, or topic
- **diagnostics** — Error log, pipeline stats, storage health

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "context-mem": {
    "command": "npx",
    "args": ["-y","context-mem"]
  }
}
```

## Documentation

## What context-mem MCP server does

The context-mem MCP server gives AI agents a persistent memory layer for development work. It records observations from tool calls, file reads, shell commands, and other project activity, then processes those observations with summarization, importance scoring, entity extraction, topic detection, and adaptive compression.

SQLite is the authoritative storage layer. A synchronized Markdown vault under `.context-mem/vault/` provides a browsable representation containing indexes, session sources, entity pages, topic pages, knowledge entries, and an event log. The vault is designed to be readable with ordinary tools such as a terminal or Obsidian, while the MCP interface provides structured access for agents.

The system keeps raw sources separate from derived summaries and wiki pages. This allows retrieval to use indexed data while preserving the original record. It also supports project-scoped and cross-project memory, temporal validity, contradiction handling, and entity relationships.

## How it works

Incoming observations pass through content-aware summarization before they are stored. The material describes separate summarization behavior for content such as stack traces, JSON configuration, shell output, and compiler errors. Importance affects how aggressively older information is compressed; recent or important observations can remain verbatim, while pinned entries are not compressed.

Retrieval combines BM25 search with vector search, plus trigram and Levenshtein matching. An optional LLM judge can rerank results. The underlying store includes SQLite FTS5 indexes and vector embeddings. Knowledge entries can be marked as superseded, merged, retained, or archived, and temporal tools can inspect what was true at a given time or compare two project states.

The context-mem MCP server also includes mechanisms for agent coordination. Agents can register capabilities, report status, claim files, and broadcast findings. Session tools create checkpoints, restore previous context, and prepare handoff packages for later sessions.

## Setup and configuration

Install the npm package and initialize it from the project directory:

```bash
npm i context-mem
npx context-mem init
```

The initializer detects supported editors and writes the corresponding MCP and instruction files. Documented targets include Claude Code, Cursor, Windsurf, VS Code with Copilot, Cline, Roo Code, Continue, and JetBrains AI. The generated files differ by client and may include hooks, rules, or project instructions in addition to the MCP configuration.

Runtime settings can be changed through the `configure` MCP tool. The Markdown vault is derived from SQLite; deleting it does not remove the authoritative stored observations, while manual vault edits are preserved during synchronization.

## Tools and capabilities

The MCP interface includes tools for several workflows:

- Store and retrieve observations with `observe`, `recall`, `timeline`, and `stats`.
- Search memory with hybrid `search` or natural-language `ask`.
- Manage durable knowledge using `save_knowledge`, `search_knowledge`, `promote_knowledge`, `global_search`, `resolve_contradiction`, and `merge_suggestions`.
- Explore entities and relationships with `entity_detect`, `graph_query`, `add_relationship`, and `graph_neighbors`.
- Inspect history with `temporal_query`, `time_travel`, and `explain_decision`.
- Control context and continuity with `wake_up`, `restore_session`, `handoff_session`, `predict_loss`, and `generate_story`.
- Coordinate multiple agents using `agent_register`, `agent_status`, `claim_files`, and `agent_broadcast`.

These tools make the context-mem MCP server suitable for projects where agents must recover prior decisions, find evidence from earlier work, preserve knowledge across sessions, or avoid conflicting edits during parallel work.

## Limitations and notes

It also describes the Markdown vault as a derived layer rather than the primary database, so applications that require direct database-level control should account for SQLite being authoritative. Client setup varies by editor, and the available initialization targets do not include every MCP-compatible client.

_Full upstream README: https://allmcps.com/mcp/context-mem/readme_

