# donggyun112/keymem [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/donggyun112/keymem  
**GitHub Stars:** 3  
**npm Downloads (last month):** 1717  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/donggyun112-keymem

## Description
Associative key-graph memory for LLM agents — recall by association, not vector similarity.

## Tools
Capabilities this server exposes over MCP:

- **recall** — Search long-term memory for what is already known about the user, project, or topic — call this before your first reply and whenever the topic shifts. Always pass the active namespace when known. Returns {status, query, namespace, keys, memories}: ranked key clusters plus one passive Top-1 memory selected under the top key. The memory includes validity, matched_key, and connected_keys, each with a relevance score (cosine of that key to your query/context, sorted high→low). Before answering, check whether the Top-1 memory supplies every fact the question needs. If a fact is missing, follow an unvisited connected key that fits that fact with read_key(key_id, missing_fact_query, namespace), then read_memory on a relevant handle; recheck and continue only while a required fact and promising path remain. If no connected key fits, recall the missing fact directly. Do not add hops to a complete single-fact answer. Passive recall never reinforces links or changes access, depth, aliases, or confirmation — except: when `context` is a strong restatement of the returned memory, it is auto-confirmed (`memories[0].auto_confirmed: true`) without a separate confirm_memory call. An empty result includes empty keys/memories and nearest_keys.
- **browse_keys** — Browse the vocabulary of one namespace when recall has no hit or you need an entry point. Returns active key clusters with hubs first, then by linked-memory count. This is index metadata only; continue with read_key(key_id, query, namespace) and read_memory(memory_id, via_key_id, namespace).
- **read_key** — List the memories stored under one key (concept), ranked. Returns the canonical key, its aliases, and hub metadata plus ranked memory IDs, metadata, and validity — never memory content. Pass a focused query for the missing fact and the active namespace when known: handles are then ranked by content relevance, which is essential for hubs. Each memory's score is content_relevance × link_weight × depth_factor × freshness_factor when query is passed (link_weight × depth_factor × freshness_factor otherwise); content_relevance is a cosine, comparable to recall's key relevance — both only meaningful within this one key's ranking. Call read_memory(memory_id, via_key_id=key_id, namespace) on the selected handle to inspect the fact and reinforce the path; reading does not confirm that its content is current. Use limit/offset to page without flooding context.
- **read_memory** — Read the full content and validity of one stored memory (selected via read_key). Returns the memory and all connected key clusters so exploration can continue Key → Memory → Key. Pass via_key_id from the selected key: the read records access and only that traversed edge is Hebbian-reinforced. Reading does not change content depth or confirm that the content is current.
- **confirm_memory** — Confirm that a memory is still current using explicit present evidence. Never call this merely because read_memory returned the content. Use only after a current user assertion, an authoritative current source, or direct observation. Refreshes validity but does not change content or key links. A strong restatement passed as recall's `context` is already auto-confirmed there (check memories[0].auto_confirmed) — this tool is for evidence recall can't see: read_memory results, authoritative sources, or direct observation.
- **remember** — MANDATORY END-OF-TURN GATE: before replying, save every durable fact newly revealed this turn (names, preferences, decisions, corrections, project facts, goals). A durable fact left unsaved is a bug; save silently in the same turn. Save nothing only after consciously confirming that nothing durable appeared. Before writing, recall() the topic in the same namespace and reuse returned canonical concepts or aliases. Use 3-6 diverse ATOMIC concept keys of 1-2 words each, never memory-specific phrases (use 'Nexora' and 'portfolio', not 'Nexora portfolio'); 3+-word keys are flagged in hints.phrase_keys and are measurably 91% unreachable singletons. CROSS-LINGUAL: register both language forms together (for example '포트폴리오' and 'portfolio'). Shared broad keys become navigable hubs. namespace groups memories by project/context; ttl_seconds sets expiry; decay_profile selects transient, standard (the default), stable, or permanent confirmation freshness; related_to adds explicit memory links; source attaches provenance and is auto-stamped with the server session, a timestamp, and — when a host agent (Claude Code, Codex) transcript is active — host_session/host_agent/host_turn. The response may include hints.near_keys (existing concepts your keys nearly duplicate — prefer reusing those concepts) and hints.language_note (add the missing-language variants).
- **correct** — Update outdated information. Use when user corrects you or info changes (e.g. moved cities, changed job). Old version is preserved but weakened — never lost. Omit keys to keep the same search terms. Omit decay_profile and ttl_seconds to preserve the predecessor's policies; provide either to replace that policy. related_to links the updated memory to other memory IDs.
- **dismiss** — Tell keymem a recalled memory was surfaced by the WRONG key — the fact may be fine, it just should not have come up for this query. Pass the memory_id and the key_id it arrived under (recall returns both). Weakens that one key->memory link so the pairing ranks lower next time, and cancels any pending alias learning for it. The memory itself, its other keys, and its content are untouched, and the link is floored rather than severed, so nothing becomes unreachable. Use correct() when the fact changed and forget() when it is simply wrong.
- **forget** — Permanently delete a memory. Only use for completely wrong information. For outdated info, use correct() instead — it preserves history.
- **remember_batch** — MANDATORY END-OF-TURN GATE: when a turn reveals multiple durable facts, save them silently before replying. A durable fact left unsaved is a bug. Recall each topic first, reuse canonical concept-level keys (ATOMIC, 1-2 words each — never phrases), and register cross-lingual forms together. Each item: {content, keys, key_types?, namespace?, ttl_seconds?, decay_profile?, related_to?}; decay_profile defaults to standard. Returns saved IDs and is more efficient than multiple remember() calls.

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

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

## Documentation

## What donggyun112/keymem does

donggyun112/keymem gives MCP-compatible agents a persistent memory layer organized around concepts and their relationships. Memories occupy a value space, while short concept keys form a separate key space. One memory can be reachable through several keys, and one key can lead to many memories. This structure allows an agent to move through associations such as Newton → apple → fruit → strawberry, even when the starting query and final fact are not embedding-neighbors.

Memory is grouped by namespace, allowing separate project or context scopes. Keys can have aliases, related memories can be explicitly linked, and saved entries can carry expiry or confirmation-freshness policies. Provenance is attached to saved memories, along with server-session metadata and host transcript details when available.

## How it works

The normal exploration pattern is Key → Memory → Key. `recall` searches for relevant key clusters and returns one passive top-ranked memory under the strongest key. If that memory does not contain everything needed, the agent can use `read_key` to rank memories under a connected concept, then call `read_memory` for the selected entry. The memory response includes connected key clusters so the agent can continue the walk deliberately.

Only the first memory is inserted automatically by recall. Later branches are loaded through explicit calls, which limits unnecessary context growth. Reading a memory records access and reinforces only the key-to-memory edge used for that traversal. Reading does not establish that the content is still current; `confirm_memory` requires present evidence such as a user assertion, an authoritative source, or direct observation.

Agents should recall before answering and before changing topics, then save newly revealed durable facts before the turn ends. `remember_batch` handles several facts more efficiently than separate save calls. Concept keys should be short, atomic terms, and related language forms can be registered together.

## Setup and configuration

Run the server with `npx -y keymem`, or install the CLI globally with `npm i -g keymem`. It is intended to run as an MCP server rather than as an application dependency. The default process starts a stdio server that an MCP client can spawn.

OpenAI embeddings use `OPENAI_API_KEY`. For a local setup, set `EMBEDDING_BACKEND=local`; `LOCAL_EMBEDDING_MODEL=bge-m3` is the recommended multilingual option and downloads roughly 570 MB on first use. Omitting the model selects the lighter `fast-multilingual-e5-large` default. Reranking is enabled in the normal recall path; set `KEYMEM_RERANK=false` to disable it.

Claude Desktop can launch the server through an `mcpServers` entry. Claude Code and Codex can use their MCP commands, while the repository plugin also supplies a daemon-backed shim, prompt hook, and memory-use skill. Codex should use the `keymem-shim` entry point for the plugin push path and explicitly forward environment overrides.

## Tools and capabilities

- `recall` finds relevant key clusters and a passive top-ranked memory.
- `browse_keys` lists active namespace vocabulary and hub keys.
- `read_key` ranks memory handles under a concept without returning their content.
- `read_memory` loads a selected memory and its connected keys.
- `remember` and `remember_batch` save durable facts with keys, namespaces, links, expiry, and freshness policies.
- `confirm_memory`, `correct`, `dismiss`, and `forget` manage validity, changed facts, misplaced links, and permanent deletion.

`correct` preserves an older version while weakening it. `forget` is reserved for information that is completely wrong, while `dismiss` lowers a wrong key-to-memory association without deleting the fact.

## Limitations and notes

The graph is navigated intentionally: recall does not expand every connected branch automatically. Scores are meaningful within the ranking produced for a single key or query, rather than as universal values across all searches. Local embedding and reranking models download on first use and may add startup or prompt latency. A recalled or read memory can be aging or stale, so currentness must be checked before presenting it as current.

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

