by Danialsamadi
Synapse is a local-first personal memory operating system designed for AI agents. It provides durable, typed, and highly reliable long-term memory using only local SQLite — giving agents the ability to remember, update, and reason over facts across sessions with full user control.
# Add to your Claude Code skills
git clone https://github.com/Danialsamadi/synapsesynapse is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by Danialsamadi. Synapse is a local-first personal memory operating system designed for AI agents. It provides durable, typed, and highly reliable long-term memory using only local SQLite — giving agents the ability to remember, update, and reason over facts across sessions with full user control. It has 50 GitHub stars.
synapse's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/Danialsamadi/synapse" and add it to your Claude Code skills directory (see the Installation section above).
synapse is primarily written in TypeScript. It is open-source under Danialsamadi on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh synapse against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.

Chat history is a log. Synapse is a brain.
Synapse is a local-first personal memory operating system that gives AI agents durable, typed long-term memory. It extracts semantic facts from episodic conversations, anchors single-current-value facts to entity keys so new values supersede old ones, detects and resolves conflicts, decays stale information, and retrieves with a hybrid scoring pipeline that attaches trust qualifiers and learns from agent feedback — all on local SQLite with full user control over export and purge. It refuses to store credentials, and an always-on digest covers what retrieval can't: the facts an agent should just know at session start.
flowchart TB
subgraph Agents["Agents & Surfaces"]
MCP["MCP clients<br/>Claude Code · Claude Desktop · Cursor · OpenCode"]
SDK["SDK adapters<br/>Anthropic · OpenAI-compatible routers"]
CLI["CLI<br/>synapse remember / query / export"]
UI["Inspector UI"]
end
subgraph Tools["Memory tools (Zod-validated, importance-capped)"]
W["memory_write<br/>+ entityKey supersession"]
R["memory_retrieve<br/>+ trust qualifiers"]
D["memory_digest<br/>always-on core memory"]
F["memory_feedback<br/>helpful / stale / wrong"]
end
API["HTTP API (Hono)<br/>/v1/memories · /v1/jobs · /v1/conflicts · /v1/export · /v1/purge"]
subgraph Store["Store (better-sqlite3 · WAL)"]
REPO["MemoryRepository<br/>CRUD · links · quarantine · audit · jobs"]
RET["RetrievalService<br/>vector + BM25 keyword + importance + recency − decay − conflict"]
JOBS["Jobs<br/>consolidate · conflict · decay · purge"]
end
subgraph Providers["Providers (env-configured factories)"]
EMB["Embeddings<br/>hash (offline) · OpenAI-compatible"]
LLM["LLM<br/>OpenAI-compatible · FakeLlm for tests"]
end
MCP --> W & R & D & F
SDK --> W & R
W & R --> API
CLI --> Store
UI --> API
API --> Store
RET --> EMB
JOBS --> LLM
JOBS --> EMB
The MCP server talks to the store directly (like the CLI); the SDK adapters route through the HTTP API. All write paths share the same guards.
apps/
api/ HTTP API (Hono) + inspector page
demo-agent/ tool-calling demo agent
mcp-server/ stdio MCP server (Claude Code/Desktop/Cursor)
packages/
core/ Zod schemas, scoring helpers, ID generation
store/ SQLite repository, retrieval, jobs
embeddings/ provider interface + hash/OpenAI embeddings
sdk/ SynapseClient + tool definitions + provider adapters
evals/ 32 golden cases + lifecycle test
cli/ synapse CLI
scripts/
demo.sh north-star demo script
Hybrid score per candidate memory:
\begin{aligned}
\text{score} ={} & 0.40 \cdot \text{vector} + 0.20 \cdot \text{keyword} + 0.15 \cdot \text{importance} + 0.10 \cdot \text{confidence} \\
& + 0.10 \cdot \text{recency} - 0.10 \cdot \text{decay} - 0.05 \cdot \text{conflict}
\end{aligned}
Weights defined in DEFAULT_RANK_WEIGHTS (packages/core/src/scoring.ts). Retrieval is 100% non-LLM by default; the LLM is used only in consolidation and conflict detection. An opt-in rerank: true flag lets an LLM reorder the final hit list (for benchmark headroom) — any parse failure or LLM error falls back silently to hybrid order, and the MCP path never uses it.
The keyword component is real full-text search, not substring matching: an SQLite FTS5 index (porter unicode61 tokenizer — English stemming, other scripts match exactly) scores hits with BM25, and every query token prefix-matches ("roas" finds "roast"). Candidacy is the union of FTS keyword hits and the vector top-K — memories matching neither signal are noise for that query and are never scored (always-know facts are the digest's job, below). If the FTS index is ever broken, retrieval degrades to legacy substring scoring instead of failing, and audits the fallback.
Retrieval also closes the loop instead of being a one-way pipe:
qualifier string ("stored 8 months ago — may be outdated; disputed by a conflicting memory; low confidence") so the consuming LLM can hedge instead of confidently asserting stale facts.lastAccessedAt bumped, so memories that keep proving relevant rank higher over time via the recency term.minScore and Synapse returns nothing rather than weakly-related noise; an empty result is a signal, not a failure.part_of / related_to neighbors at half score when there's room, so a hit on a chapter brings its book along.| Tool | What it does |
|---|---|
memory_write |
Store a typed memory (episodic / semantic / procedural). Pass entityKey (e.g. user.employer) for single-current-value facts — a new value automatically supersedes the old one instead of coexisting with it. Content that looks like a credential is rejected (see Secret detection). |
memory_retrieve |
Hybrid-scored recall with trust qualifiers on each result. |
memory_digest |
Always-on core memory: pinned + most important facts as one capped block. Call once at session start — the "agent should just know this" layer that pure retrieval misses. |
memory_feedback |
Report a retrieved memory as helpful, stale, or wrong. Helpful raises confidence (and re-activates a disputed memory); stale/wrong lowers it and marks the memory disputed, hiding it from default retrieval. |
Entity anchoring fixes the classic staleness bug ("I work at Acme Corp" retrieved three months after you switched jobs): facts with an entityKey behave like a current-value slot, not an append-only log. The consolidation job emits entity keys too, so facts extracted from conversation get the same treatment. Superseded values stay in history (status: superseded, linked via supersedes) — nothing is silently lost.
pnpm install
pnpm test # all tests
pnpm eval # eval harness (32 cases)
pnpm dev:api # http://localhost:8787
# CLI
pnpm --filter @synapse/cli start remember semantic "User prefers TypeScript"
pnpm --filter @synapse/cli start query "TypeScript preference"
pnpm --filter @synapse/cli start export
# Inspector — browse/edit memories, link graph, analytics charts, audit trail (light/dark)
open http://localhost:8787/inspector
# North-star demo (requires API running)
./scripts/demo.sh
Synapse exposes memory_write, memory_retrieve, memory_digest, and memory_feedback over MCP. Any MCP-capable agent can use it — verified live with Claude Code (write in one session, recall in a fresh one).
Claude Code:
claude mcp add --scope user synapse -- npx -y synapse-os
# or from a source checkout:
claude mcp add --scope user synapse -- pnpm --dir /path/to/synapse mcp
Then verify inside a new session with /mcp — synapse must show as connected. Tool calls appear as permission prompts named synapse - memory_write / synapse - memory_retrieve.
Claude Desktop — add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), then restart the app:
{
"mcpServers": {
"synapse": {
"command": "pnpm",
"args": ["--dir", "/path/to/memory-os", "mcp"]
}
}
}
Cursor — Settings → MCP → Add server, or add the same mcpServers block to ~/.cursor/mcp.json.
OpenCode:
opencode mcp add synapse -- pnpm --dir /path/to/memory-os mcp
Forced recall (optional): MCP tool calls are ultimately the model's choice. For deterministic recall, copy integrations/opencode/synapse-recall.ts to ~/.config/opencode/plugin/ and set SYNAPSE_REPO to your checkout (or edit the REPO constant). It hooks chat.message: when a prompt contains a trigger phrase ("use synapse", "deep memory", "recall", "what do you know about …"), it queries the DB directly and injects the results into the prompt before the model runs — no reliance on the model calling the tool.
Any other MCP client — it's a standard stdio server: command pnpm, args ["--dir", "/path/to/memory-os", "mcp"].
The server stores to ~/.synapse/synapse.db by default; set SYNAPSE_DB in the server's env to share one database with the API/CLI/Inspector.
Testing tips (learned the hard way):
/mcp in Claude Code, opencode mcp list).Use the synapse MCP tools for storing and recalling user memories. to