# cogmemory-mcp [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/skylarng89/cogmemory-mcp  
**GitHub Stars:** 0  
**npm Downloads (last month):** 326  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/cogmemory-mcp

## Description
CogMemory MCP Server — Unified context subsystems for AI coding agents

## Tools
Capabilities this server exposes over MCP:

- **start_session** — Begin a work session (returns session ID)
- **end_session** — Close session, store summary
- **get_session_summary** — Recall session details including decisions, errors, changelog
- **remember_decision** — Log a decision with rationale and tags
- **remember_convention** — Log/update a convention (design token, pattern, style, naming)
- **log_error** — Record an error with signature and resolution
- **set_active_context** — Upsert current focus/task by key
- **get_active_context** — Read current focus by key
- **log_change** — Append changelog entry
- **add_plan_item** — Add a roadmap item
- **update_plan_status** — Change plan item status
- **create_task** — Create a task, optionally linked to a plan
- **update_task_status** — Change task status
- **recall** — Unified search across decisions/conventions/errors/changelog
- **create_entity** — Add entity (deduped on name+type)
- **create_relation** — Link two entities with a typed relation
- **add_observation** — Attach a fact to an entity
- **search_knowledge** — Query entities, relations, observations
- **create_spec** — Store a long-form document
- **get_spec** — Retrieve by ID or exact title
- **update_spec** — Update content/title, auto-bumps version
- **index_codebase** — Walk workspace, extract symbols + edges (JS/TS via ts-morph, Python via tree-sitter)
- **query_code_graph** — Look up a symbol's callers/callees/imports (1-hop)
- **generate_codemap** — BFS from entry symbol, bounded subgraph with optional traces + annotations
- **annotate_symbol** — Attach narrative text to a symbol or trace
- **cogmemory_status** — Show runtime config: package version, schema version, db path, workspace root, scope, index coverage, and subsystem counts
- **check_for_updates** — Check if a newer version is available on npm (HTTPS GET to registry, cached 24h)
- **semantic_code_search** — TF-IDF based semantic code search — natural language query returns ranked symbols by relevance
- **find_dead_code** — Find symbols with zero inbound callers, excluding exported symbols and configurable entry points
- **find_duplicates** — Detect duplicate/clone symbol pairs via exact hash + MinHash similarity, inserts `SIMILAR_TO` edges
- **find_related** — Discover semantically-related symbols via shared callers/imports/same-file heuristics, inserts `SEMANTICALLY_RELATED` edges
- **query_graph** — Multi-hop structural graph query using recursive CTE — supports arbitrary depth, edge-type filters, direction
- **analyze_impact** — Analyze impact of uncommitted changes (`git diff`) — maps changed files to symbols and computes reverse transitive caller closure
- **get_code_snippet** — Fetch source code lines for a symbol by ID or name, with optional context padding
- **check_index_coverage** — Report indexed vs. unindexed vs. stale files with per-language breakdowns
- **list_items** — Browse stored entries from any subsystem with optional filters
- **delete_item** — Delete a single row by ID from any subsystem
- **delete_by_key** — Delete a context entry by its string key
- **delete_by_path** — Remove a file from the code graph file_index
- **purge_subsystem** — Remove ALL rows from a subsystem (requires `confirm=true`)
- **list_projects** — List all projects with row counts, staleness flags; active project marked
- **rename_project** — Rename a project's display label (slug is immutable)
- **prune_projects** — Permanently delete a project and all of its rows (requires `confirm=true`)
- **switch_project** — Re-resolve the active project at runtime from a workspace root (fail-closed)

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

```json
"mcpServers": {
  "cogmemory-mcp": {
    "command": "npx",
    "args": ["-y","cogmemory-mcp@latest"]
  }
}
```

## Documentation

## What cogmemory-mcp does

The cogmemory-mcp MCP server provides four related context subsystems for coding agents. Its memory features record sessions, decisions, conventions, errors, active work, changelog entries, plans, and tasks. The knowledge graph stores named entities, typed relationships, and observations, while the specs subsystem keeps longer documents such as requirements or design material.

The code graph represents symbols and structural edges extracted from JavaScript, TypeScript, and Python workspaces. Agents can inspect callers, callees, and imports, generate bounded subgraphs from an entry symbol, and attach narrative annotations to symbols or execution traces. Additional analysis tools provide ranked code search, dead-code detection, and duplicate-symbol detection.

## How it works

Storage uses SQLite through `better-sqlite3`. By default, each clone receives its own project identity and database under `~/.cogmemory/projects/`. A workspace configuration can instead select a database inside the repository, while global scope uses `~/.cogmemory/global.db`. Project identity is based on an opaque ID in `.cogmemory/config.json`, so moving or renaming a workspace does not change which memories belong to it.

Scope resolution checks workspace configuration first, then `COGMEMORY_SCOPE`, then user-level configuration, and finally the project default. The server can also switch its active project at runtime by receiving an absolute workspace root. Its status tool reports configuration, database, workspace, scope, index coverage, and subsystem counts.

## Setup and configuration

Install the cogmemory-mcp MCP server with `npx -y cogmemory-mcp@latest`, install it globally with npm, use `pnpm dlx`, or build it from source with pnpm. Standard client configuration starts the command as a local stdio MCP server. The README provides configuration examples for VS Code, Cursor, Claude Desktop, Claude Code, Cline, Windsurf, and Zed.

Native dependencies may need Python 3, a C/C++ compiler, and `make` for `better-sqlite3` and `tree-sitter`. Prebuilt binaries are available for common Linux, macOS, and Windows architectures, so compilation is often skipped.

To target a monorepo sub-root, pass `--workspace` with the intended absolute path. Otherwise, the server discovers a project from the Git root, a parent containing `.cogmemory`, or the current working directory. Keep `.cogmemory/config.json` gitignored unless intentionally sharing the project identity.

## Tools and capabilities

- Start and close sessions, then retrieve summaries containing decisions, errors, and changelog information.
- Record decisions, conventions, errors, active context, changes, plans, and task status.
- Search stored decisions, conventions, errors, and changelog entries with `recall`.
- Create and query entities, relations, and observations in the knowledge graph.
- Create, retrieve, and version long-form specifications.
- Index JavaScript, TypeScript, and Python code, then query symbol relationships.
- Generate code maps, annotate symbols, search code semantically, find dead code, and detect duplicates.

## Limitations and notes

The code index is static: JavaScript and TypeScript use `ts-morph`, while Python uses `tree-sitter`. Code-graph queries are limited to one-hop caller, callee, and import relationships; generated maps are bounded subgraphs. Semantic code search is TF-IDF based rather than a separately documented embedding service.

The update-check tool contacts the npm registry over HTTPS and caches results for 24 hours. Database isolation depends on scope and project configuration, so clients working across repositories should verify `cogmemory_status` and use project switching when a pinned workspace does not match the active repository.

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

