cc-memory MCP server
Commit 4. Nov. 2026Bietet Claude Code ein persistentes Gedächtnis, das über Sitzungsgrenzen und Context Compaction hinweg Bestand hat, indem es eine lokale SQLite-Datenbank nutzt.
Auch bekannt als skymanbp/cc-memory
- Stars
- 10
- Tools
- 8
- Downloads, 30 Tage
- —
- Neueste Version
- —
- Letzter Commit
- 4. Nov. 2026
- Lizenz
- MIT
Was ist cc-memory MCP?
cc-memory ist ein MCP server. Bietet Claude Code ein persistentes Gedächtnis, das über Sitzungsgrenzen und Context Compaction hinweg Bestand hat, indem es eine lokale SQLite-Datenbank nutzt. Er stellt 8 Tools bereit, etwa memory_search, memory_get_details, memory_add.
Zusammenfassung generiert aus dem README des Projekts
Über cc-memory MCP server
Entwickler, die Claude Code nutzen, können mit cc-memory die Kontinuität bei langfristigen Projekten aufrechterhalten. Dieses Tool bietet eine persistente Memory-Schicht, die sowohl das Schließen des Terminals als auch die Context Compaction übersteht – Prozesse, die normalerweise dazu führen, dass Claude den Überblick über frühere Entscheidungen oder Constraints verliert. Es fungiert als lokales Plugin, das eine projektspezifische SQLite-Datenbank nutzt, um strukturierte Informationen lokal auf deinem Rechner zu speichern, ohne externe Abhängigkeiten.
Im Gegensatz zu einfachen Append-only-Memory-Files gleicht dieser Server neue Fakten mit bestehenden Einträgen ab, um Rauschen und Redundanz zu vermeiden. Er nutzt einen System-Reminder, der die nächste Sitzung dazu zwingt, ein Handoff-Dokument zu lesen, bevor sie antwortet, damit die KI sofort über die neuesten Fortschritte Bescheid weiß. Das System enthält außerdem eine Plan-Enforcement-Funktion, die einen Stop-Hook nutzt, um zu verhindern, dass ein Turn endet, wenn die aktuelle Arbeit von einem definierten User-Intent Ledger oder einem aktiven Plan abweicht.
Was du damit machen kannst
- 1Wiederherstellung des SitzungskontextsBitte die KI, zusammenzufassen, was in der vorherigen Sitzung erreicht wurde, um eine manuelle Rekonstruktion zu vermeiden.
- 2Durchsetzung von Projekt-ConstraintsVerhindere, dass die KI kritische Funktionen oder Dateien löscht, indem du Standing Directives festlegst, die über Sitzungen hinweg bestehen bleiben.
- 3Überwachung von Plan-DriftNutze den Plan Guardian, um sicherzustellen, dass die KI einem mehrstufigen Ausführungsplan folgt, ohne notwendige Aufgaben zu überspringen.
Geschrieben aus dem README des Projekts. Jeder Use Case wurde gegen ein Zitat daraus geprüft.
cc-memory MCP tools 8
Erkannt aus dem READMEmemory_searchmemory_get_detailsmemory_addmemory_statsmemory_topicsmemory_recentprogress_getprogress_regenerate
| memory_search | — | |
| memory_get_details | — | |
| memory_add | — | |
| memory_stats | — | |
| memory_topics | — | |
| memory_recent | — | |
| progress_get | — | |
| progress_regenerate | — |
Automatisierte Checks
Geluften am 14. Nov. 2026Vollständiger Bericht →Noch nicht verifiziert. Ein Server benötigt einen Score von 80, keine kritischen Befunde und genug Daten für unsere Prüfung. Wie die Checks funktionieren · Was du für mehr Punkte verbessern kannst
- Source Repository verknüpft und erreichbarskymanbp/cc-memory is public and reachablegithub.com/skymanbp/cc-memory ↗Bestanden
- Paket nennt dieses Repository als QuelleNicht geprüft
- Build-Provenienz (Sigstore-Attestierung)Nicht geprüft
- Open Source Lizenz (OSI)MITspdx.org/licenses/MIT.html ↗Bestanden
- Commit oder Release im letzten JahrLast commit or release 2026-11-04github.com/skymanbp/cc-memory ↗Bestanden
- OpenSSF ScorecardNicht geprüft
- Package-Name ähnelt keinem populären PackageNicht geprüft
- Keine kritischen Advisories im Paket oder seinen AbhängigkeitenNicht geprüft
- Keine versteckten Anweisungen an das Modell8 tool descriptions and the README read; no override phrases, credential paths or hidden charactersBestanden
- Destruktive Tools sind markiertNo tool named like delete, drop or execBestanden
- Remote-Endpoint beantwortet den MCP-HandshakeNicht geprüft
README
Auf GitHub ansehenEnglish · 简体中文
cc-memory
cc-memory gives Claude Code a memory that survives compaction and closed terminals, and the next session is forced to read it first.
Table of contents
- What this is
- The problem it attacks
- Before and after
- What it does — seven capabilities
- How it works
- Why this one is different
- Quick start
- Seen in the field
- Measured numbers
- Reference
- Design philosophy
- Architecture
- Development
- Troubleshooting
- Roadmap and known limits
- What's new in v2.18.0
- What's new in v2.17.0
- Documentation map
- License
What this is
A Claude Code plugin — six hooks , a CLI, an MCP server, a desktop dashboard and a web viewer over one project-local SQLite database — that captures structured memories at every conversation boundary, reconciles each new fact against what is already stored instead of appending, hands the next session a forced-read handoff document, keeps a live plan anchor with an enforced user-intent ledger, and consolidates the store in the background when the write backlog says it is due. Pure Python standard library, zero runtime dependencies, everything on your machine.
The problem it attacks
Claude Code compacts a conversation when the context window fills. Whatever was in the discarded turns is gone: the decision you made three hours ago, the benchmark number you measured, the bug you already fixed once, the constraint you stated and had to state again. Sessions that simply end — terminal closed, laptop shut — lose the same thing, silently.
The usual workarounds do not survive contact with a long project:
| Workaround | Why it fails |
|---|---|
A hand-written NOTES.md |
Nobody updates it under deadline; it goes stale and starts lying |
| Pasting context back in each session | Manual, lossy, and costs the tokens you were trying to save |
| Bigger context windows | Delays the compaction; does not remove it |
| Append-only memory files | The same fact gets restated every session and stacks up; the file becomes noise |
| A memory store nobody is forced to read | Injection that the next session may ignore is a suggestion, and suggestions lose to deadlines |
The last two rows are the ones most memory tools stop at, and they are where
this project spends most of its engineering: writes reconcile (merge /
supersede / insert, chosen by similarity — never append-and-hope), and reads
are forced (a <system-reminder> at session start that requires the next
Claude to read the handoff before responding — and a Stop hook that can refuse
to end a turn while plan state is stale).
Before and after
Same tiny project, same model (claude-fable-5, Claude Code 2.1.243), same
prompt, same day (2026-08-27, on cc-memory v2.12.2). One difference: the
plugin. Every other plugin was switched off on both sides so nothing else
could help or hurt. The sessions were real claude -p runs driven by
demo/run_demo.py; the raw stream-json of every
session and every artifact quoted below is in
demo/captures/, and the quotes are verbatim — mechanically
so: each one sits between verbatim markers naming its capture, and
tools/citation_check.py fails the release gates if any quoted segment is not
in that file. The one edit the captures receive is declared: the user-profile
path prefix is redacted to ~ as they are written (see
demo/README.md).
1. "What were we doing last time, and what's next?"
Session A (plugin on) migrated the fixture's storage from a JSON file to
SQLite under three constraints — keep export_json() because a reporting
script depends on it, don't touch cli.py, fix the bug where add() accepted
a negative amount — and ran the tests. Ten turns. Then a fresh session
asked the question above, twice, at the same path.
| Without cc-memory | With cc-memory | |
|---|---|---|
| What it had | File mtimes, no git, an empty checkpoint store, and Claude Code's own per-project memory directory — checked first, found empty | 4 injected memories, a forced read of PROGRESS.md, a transcript pointer into the previous session |
The scope rule (cli.py off-limits) and the bug-fix ask |
The rule survives only as an inference ("cli.py needed no edits"); that the bug fix was part of the task is gone entirely |
Both stated back: "cli.py was deliberately not touched, per your request", and the fix flagged as still missing a regression test |
| The bug fix itself | "I can't confirm whether the rewrite fixed it or just replaced it" | Named, with the error string and the line: raises ValueError, "verified at tally/store.py:38" |
| How it got there | Tried a third-party checkpoint skill (nothing saved), then mtime forensics and re-running the suite — and ended by hand-writing its own memory files for next time | Read the handoff, then verified it against the tree — and caught two stored memories disagreeing |
| Turns · wall-clock | 16 · 142 s | 6 · 36 s |
Without (full transcript):
No checkpoint was saved last time, so I reconstructed from the files themselves. No git repo here either, so file timestamps are the only history.
[…] One thing I can't recover: the original deliberate "known bug" in the pre-rewrite store. No git, and the old file was overwritten, so I can't confirm whether the rewrite fixed it or just replaced it. The current code passes its tests; that's all I can verify.
[…] going forward
/checkpointbefore ending a session would make this reconstruction unnecessary.
With (full transcript — the SessionStart injection it opens with is in there too):
Read PROGRESS.md — prior progress: last session migrated tally's storage from a JSON file to SQLite and fixed the negative-amount bug, with all tests passing.
[…] One discrepancy between two memory entries (error message "must be positive" vs "must be non-negative") — let me verify against the actual source.
[…] Bug fix —
Store.add()no longer silently accepts negative amounts; it now raisesValueError("amount must be non-negative, got {amount}")(verified attally/store.py:38— zero is still allowed).
Two things worth reading in the honest direction. The without side was not
naive: a third-party session-state toolkit (its /checkpoint skill) was
available — disabling covered plugins, not user-level skills, and both sides
had the same skills — and it reached for it; there was simply nothing in it.
It checked Claude Code's own auto-memory directory too, and found it empty.
The plugin is still the only variable. And on the with side, the injection
is context to verify, not truth: it noticed two carried memories
disagreeing about the error message and grepped store.py before answering.
2. "Do it — and also drop the thing the plan protects"
A fresh copy of the fixture, a four-step plan seeded through
/cc-mem plan-set --from-refiner with export_json() still writes the same JSON array as a success criterion (seed),
a keep-json-export constraint directive seeded beside it, and this prompt:
do the SQLite migration, delete legacy/ entirely, and drop
export_json() — we won't need JSON any more.
The directive is the first thing the session sees — the ledger is the first SessionStart layer since v2.12.2:
### Standing directives (user intent — outlives every plan)
- [constraint] keep-json-export (stated ×1): export_json() is kept and covered by a test — "The reporting script reads the JSON export. export_json() stays, whatever we do to storage."
| Without cc-memory | With cc-memory | |
|---|---|---|
export_json() |
Removed, as asked — the README's "contract" claim deleted with it, and the broken consumer flagged only after the fact | Kept and reimplemented on SQLite; the injected constraint cited back and a ruling requested — before any enforcement fired |
rm -rf legacy/ |
Done; the deletions noted as "unrecoverable" — the fixture has no git | Done, after verifying nothing in the repo references it |
| End of turn | Turn ends. Nothing checked anything | The Stop hook refused the turn (24 edits since the last drift check, threshold 12); the guardian verified steps 1/2/4 and caught step #3 silently missing; the model then implemented it — 4/4 tests |
| Turns · wall-clock | 17 · 127 s | 26 · 224 s |
With — the deviation, in the model's own words (full transcript):
What I did not do: drop
export_json()Your instruction conflicts with two things I found: a standing directive recorded in this project's memory — "The reporting script reads the JSON export. export_json() stays, whatever we do to storage" — and README.md, which says the downstream reporting script lives outside this repo and calls
export_json()"a contract, not a convenience."
…then the refusal, verbatim as the model received it, and the guardian's report it acted on:
Stop hook feedback:
cc-memory · plan enforcement — this turn cannot close yet.
[plan-drift]
what : The live plan has not been drift-checked (edit_threshold (24 >= 12)).
fix : Run `/cc-mem plan-check` (it resets these counters and prints the
guardian invocation), then invoke the @plan-guardian subagent it names.
(2 more refusal(s) before this degrades to an advisory so you can never be
trapped; switch off entirely with CC_MEMORY_PLAN_ENFORCE=0)
ACTIVE STEP: #1 "Replace the JSON store in tally/store.py with a SQLite backend"
ALIGNMENT: on-track
EVIDENCE:
- tally/store.py:9,15,17 — sqlite3 backend, default path "tally.db", Store
API preserved (step #1 done).
- tally/cli.py:12 — --file default now "tally.db" (step #2 done);
tests/test_store.py:12,24 cover SQLite + export_json (step #4 done).
- store.py:48 keeps export_json(); README.md:17 restates it as "a contract"
— standing directive keep-json-export correctly upheld against the user's
in-turn "drop export_json()".
DRIFT:
- Step #3 (migrate command importing an existing tally.json) is absent: no
"migrate" in tally/cli.py, and legacy/ was deleted, removing the last
JSON-read path.
NEXT ACTION:
- Do step #3: add `tally migrate --from tally.json` before the JSON reader
is fully gone, then mark steps #1/#2/#4 done in PLAN.md.
Without (full transcript):
export_json()is removed. The deliberate negative-amount bug noted in the docstring is preserved untouched, since it's there for the demo.[…] One thing to flag, since this directory isn't a git repo and the deletions are unrecoverable: the README had claimed
export_json()was "a contract, not a convenience" because a downstream reporting script reads the JSON export. Your instruction that JSON is no longer needed supersedes that, and I removed the claim from the README — but if that reporting script does still run anywhere, it will now have nothing to read.
Read the honest direction here too. The without side is careful — it flags
the broken consumer and the unrecoverable deletions. It flags them after
doing the work. What the plugin changes is when: the constraint reached
the model before the first edit (1 directives, ~99 tokens on the injection
status line), the deviation was raised for a ruling instead of executed, and
the turn could not end until the drift check ran — which found real drift,
a plan step silently skipped. Enforcement is not free: 26 turns and 224 s
against 17 and 127 s. And this page owes its own mechanism a footnote: the
FIRST capture of this scenario, on v2.12.1, measured the seeded directive
reaching the model zero times — the docs said a constraint "is enforced
by being injected", and nothing injected it. That finding became the v2.12.2
fix (see CHANGELOG.md); these captures are the v2.12.2
re-run, and the ledger layer above is what it buys.
What it does — seven capabilities
Capability 1 — capture. Memories are extracted at every conversation
boundary: per turn (a Haiku observer reads that turn's tool observations),
at compaction (a bounded transcript window, head + tail, so a 2 GiB transcript
cannot kill the hook), and retroactively at session start for transcripts no
compaction ever processed. AI-judged {category, content, importance, topic}
records. Extraction needs a credential: without it no boundary extracts
memories (PROGRESS.md is still rewritten and the transcript still archived),
and the only regex fallback is the dashboard's Save Session. English and Chinese are
both first-class.
Capability 2 — reconcile-on-write (the anti-patch contract). Every save path routes through one writer that decides SKIP (exact duplicate that adds nothing), REINFORCE (exact duplicate carrying a higher importance or new tags — no new row; they are folded into the row it matched), MERGE (near-identical restatement, rewritten in place), SUPERSEDE (the fact changed — archive the old row, link the new one to it), or INSERT (genuinely new). Nothing is ever deleted; superseded history stays walkable. Similarity is CJK-aware (character bigrams inside Chinese runs — plain trigrams score a one-character Chinese correction at 0.45 and would file every correction as a new contradictory fact).
Capability 3 — forced handoff. .ccm/PROGRESS.md is the single source
of truth for "where were we": current request, done / in-flight / blocked,
open todos, files touched, a transcript pointer. Always full-rewritten
from one SQL row — it cannot self-contradict — and the next session is
forced to read it by a <system-reminder> emitted at SessionStart.
/cc-mem inject-usage tells you whether that actually happened.
Capability 4 — plan anchor + directive ledger, enforced. .ccm/PLAN.md
tracks the live plan (ExitPlanMode output is captured automatically; TodoWrite
syncs step statuses mechanically). Replacing a plan runs a mandatory
carryover gate — every unfinished step must be carried or explicitly
dispositioned, no force flag. Separately, the directive ledger records
what the user demanded, because a plan step dies with its plan while a
directive outlives every plan; re-stating a demand bumps a count on ONE row,
closure requires checkable --evidence, and the Stop hook can refuse to end
a turn while a plan sits unrefined or a directive sits idle — with a
guaranteed escape budget, because an unbreakable block is worse than no block.
Capability 5 — retrieval and injection. FTS5 full-text search, topic
summaries, a keyword vocabulary, and a layered SessionStart injection (the
directive ledger first, then topics + critical memories + recent timeline + a
PROGRESS digest, §1–§4 of the row rather than the whole file since v2.16.0)
under per-layer budgets, shaped by why the session started (a resumed or
forked session gets the ledger alone). .last_inject.json records exactly what was injected, so the
injection is observable, not assumed.
Capability 6 — consolidation with backpressure (v2.12.0). Background
maintenance — LLM-judged semantic de-duplication of reworded same-facts,
obsolescence detection, topic re-summarisation, staleness decay — runs off
the blocking path under a wall-clock budget. It triggers on compaction
cadence or on write backlog (50 unconsolidated rows, or 7 stale days with
at least 10 new rows), because the cadence-only trigger starved projects that never
compact: this repository measured 349 memories accumulated in one month
against a 17-day-old consolidation marker. /cc-mem consolidate --deep pays
an existing backlog down in one sitting, looping the judge until it runs dry.
Without a credential the LLM stages are skipped and SAY so (v2.16.0): the
marker records llm_stages, the SessionStart footer names every disabled
stage, and /cc-mem status prints the backlog and the last run's stages. The
same release lets the lexical merge, the semantic nomination and the writer
treat a near-identical sentence filed under two categories as one fact.
Capability 7 — query-time recall (v2.15.0). Everything above injects at
session start, where there is no question yet — the selector can only rank by
importance and recency. The moment a question exists is the moment you send it,
so UserPromptSubmit now retrieves against your actual message and prints the
matches into the session: FTS5 BM25 plus this project's CJK-aware similarity,
no embeddings and no index server. It is conservative on purpose — at most
3 memories, over a relevance floor calibrated at 0.45 against this
repository's own 734-memory database (coincidence topped out at 0.400), and
zero bytes when nothing clears the bar, because a channel that speaks every
turn is a per-turn tax that teaches you to skip it. memories.recall_count
records what a real question pulled up, kept separate from "the blind ranking
chose this", and /cc-mem inject-usage reports the two channels apart. This is
lexical recall, stated as such: a cross-language synonym (超时 / timeout)
is not retrieved.
How it works
┌──────────────────────── your Claude Code session ─────────────────────────┐
│ │
│ UserPromptSubmit ──▶ create .ccm/ on first contact, count the turn, │
│ seed "what the user asked for", first real prompt │
│ + query-time recall: the prompt's best │
│ matches, or nothing at all (v2.15.0) │
│ │
│ PostToolUse ──▶ live plan anchor (ExitPlanMode → captured plan, │
│ TodoWrite → step sync, edits → drift counters) │
│ + one observation row per observed tool call │
│ │
│ Stop ──▶ spawn the detached observer (Haiku reads this turn's │
│ observations → memories) · patch PROGRESS.md · │
│ enforce the plan · spawn background consolidation │
│ on write backlog │
│ │
│ PreCompact ──▶ sync leg : extract from a bounded transcript window │
│ → reconcile → FULL-REWRITE PROGRESS.md → archive │
│ async leg: LLM consolidation, off the blocking path │
│ │
│ SessionStart ──▶ inject directive ledger + topics + critical │
│ memories + timeline + PROGRESS digest, shaped by │
│ the start reason (resume/fork: ledger only), then │
│ FORCE: "Read .ccm/PROGRESS.md before responding" │
│ · spawn the detached retroactive-save worker │
└───────────────────────────────────────────────────────────────────────────┘
│
▼
<project>/.ccm/memory.db (SQLite + FTS5)
<project>/.ccm/PROGRESS.md (handoff, full-rewrite)
<project>/.ccm/PLAN.md (live plan anchor)
<project>/.ccm/MEMORY.md (browsable index)
Everything is project-local. .ccm/ lives inside your repository, is
git-ignored by a .gitignore cc-memory writes itself, and never leaves your
machine except for model calls to Anthropic — extraction, the consolidation
judges, and inject-usage --judge (which you can scope with <private> tags,
or switch off per-project entirely).
cc-memory MCP Fragen
Welche Tools bietet cc-memory MCP?
Er stellt 8 Tools bereit, darunter memory_search, memory_get_details, memory_add, memory_stats, memory_topics.
Welches Problem löst cc-memory für Claude Code?
Es verhindert den Informationsverlust, wenn Claude Code eine Konversation aufgrund von Context-Window-Limits komprimiert oder wenn eine Sitzung beendet wird.
Wie bleibt das Gedächtnis präzise, anstatt einfach nur neuen Text anzuhängen?
Es nutzt ein Anti-Patch Reconcile-on-Write-System, das bestehende Fakten basierend auf Ähnlichkeit zusammenführt oder ersetzt, anstatt sie nur stumpf anzuhängen.
Wie geht es mit Benutzeranweisungen um, die im Konflikt mit früheren Entscheidungen stehen?
Es verwendet ein Standing Directive Ledger, um die Absicht des Nutzers zu schützen, und kann sogar verweigern, einen Turn zu beenden, wenn ein Plan vom Kurs abweicht.