From code-memory
Local-first memory layer (semantic vectors + call/import graph + episodes + bi-temporal user claims) wired in via MCP. Use to orient on unfamiliar code, answer topology questions (who calls X, who imports Y), recall prior work, refresh the index after writes, AND to remember durable user assertions — preferences ("I love / prefer / want"), tech-stack decisions ("we use X"), rejections ("don't ship Y"), ownership, location facts. Load this skill whenever the user states an opinion, preference, choice, or correction worth keeping across sessions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-memory:code-memoryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`code-memory` exposes a local index of the project as **four complementary
code-memory exposes a local index of the project as four complementary
surfaces:
Context Pack (semantic code hits + relevant past
episodes) injected automatically when the user asks something substantive.
Tells you roughly where to look.Use them in that order. Vectors orient; the graph answers structural questions; assembly tools answer "what's on this .NET type"; temporal tools answer "before / after" / "what was true at commit X".
If the user's phrasing matches the left column, call the right tool. Do not answer from grep or memory before you've tried the right tool.
| User says… | First call |
|---|---|
| "explain X" / "how does this work" / "where does it live" | codememory_retrieve(query=user-text, project=…) |
| "docs inventory" / "repo documentation" / "where do docs live" | codememory_retrieve(query=user-text, project=…), then glob / read to verify exhaustive list |
| "who calls X" / "what depends on X" / "impact of …" | codememory_callers(symbol="X", project=…) |
| "what does X call" / "outgoing dependencies of X" | codememory_callees(symbol="X", project=…) |
| "where is X defined" / "X is ambiguous" | codememory_definitions(symbol="X", project=…) |
| "who imports M" / "who uses the package M" | codememory_importers(target="M", project=…) |
| "what does file F import" | codememory_dependencies(file="F", project=…) |
| "what methods does T have" (.NET) / "show overloads of T" | codememory_assembly_members(type="T", project=…) |
| "what changed since" / "stale references" / "drift" | codememory_drift(head_sha=…, project=…) |
| "what used to call X before deletion" | codememory_callers_at_sha(symbol="X", sha=…, sha_ord=…) |
| "what existed at commit C" | codememory_at_sha(sha=C, sha_ord=N, project=…) |
| "I just wrote / edited a file" | codememory_reingest(path=…, project=…) |
| "I finished a task" | codememory_record(prompt=…, patch=…, verdict=…, project=…) |
| User asserts a durable fact / preference / decision | codememory_assert_claim(subject, predicate, object, project=…) |
| "what did the user say about X" / surface user prefs | codememory_claims(subject="X", project=…) |
If two rules match, pick the more specific one (callers beats retrieve
when the question is about a named symbol).
Every codememory_* MCP tool requires a project parameter. This is
non-negotiable; the server rejects calls that omit it. The error message
returned in that case tells you which slug to pass.
"project": "<slug>". Reuse that exact value.project field
description in any tool's inputSchema — the server embeds the current
project's slug there as currently: \``.code-memory projects.These are sentinel strings the server explicitly rejects:
"auto" — not a slug. Falls back to nothing."default" — same."" / null / whitespace-only — same.If you don't know the slug, don't invent one. Re-read this skill or inspect a prior tool response.
| Tool | Required | Optional |
|---|---|---|
codememory_retrieve | query, project | k (default 8), eps (5), include_idle_episodes (false) |
codememory_record | prompt, project | plan, patch, verdict |
codememory_reingest | path, project | — |
codememory_ingest | root, project | full, since, dry_run, confirmed — never call without explicit user authorisation |
codememory_callers | symbol, project | depth (1–3, default 1) |
codememory_callees | symbol, project | depth (1–3, default 1) |
codememory_importers | target, project | — |
codememory_dependencies | file, project | depth (1–3, default 1) |
codememory_definitions | symbol, project | — |
codememory_assembly_members | type, project | assembly ('Name, Version=…') |
codememory_drift | head_sha, project | — |
codememory_at_sha | sha, sha_ord, project | label (Symbol/File, default Symbol), limit (200) |
codememory_callers_at_sha | symbol, sha, sha_ord, project | — |
codememory_assert_claim | subject, predicate, object, project | polarity (true), confidence (0.95), evidence_span, valid_at, session_id, source_prompt_id |
codememory_claims | project | subject, as_of, limit (50) |
symbol is a bare identifier (getBearerToken), not a dotted expression.
target for importers is the literal module key (@scope/pkg, rxjs,
or ./relative-path). path / file are absolute filesystem paths.
type for assembly_members is the fully qualified .NET type name
(Namespace.TypeName). sha_ord is the topological ordinal — compute
once with git rev-list --count --first-parent <sha> and reuse for all
time-travel calls in the same conversation.
| Trigger | Action |
|---|---|
| User sends a code-shaped prompt | Pulls a Context Pack (5 min TTL) and injects it. |
write / edit tool succeeds | Re-indexes the affected file in the background. |
session.idle event | Records the session as an episode (best effort). |
Trivial follow-ups ("yes", "continue", "thanks") do not trigger retrieval.
The pack contains:
If the pack is empty or low-signal, fall back to graph tools first (cheap,
exact) and then read / grep only as a last resort.
Before reading multiple files, ask whether a single graph query would answer the question precisely.
codememory_callers(symbol, project, depth?=1)Who calls this symbol? Reverse CALLS traversal.
Call when:
Example: codememory_callers(symbol="getBearerToken", project="sample-webapp")
→ list of files + the definition's location.
codememory_callees(symbol, project, depth?=1)What does the file defining this symbol call? Forward CALLS traversal.
Call when:
codememory_importers(target, project)Which files import this module or relative path? Reverse IMPORTS.
Call when:
@scope/lib" or any package.Example: codememory_importers(target="@acme-ng/security", project="sample-webapp").
codememory_dependencies(file, project, depth?=1)What modules does this file import? Forward IMPORTS.
Call when:
codememory_definitions(symbol, project)Every file+line that defines a symbol with this name.
Call first when a name is ambiguous, before passing it to
callers / callees. Tells you whether the symbol is unique or
duplicated across modules.
codememory_assembly_members(type, project, assembly?)Returns the public methods declared on a Type from an indexed .NET Assembly. Members are not bulk-indexed — that would multiply the graph by 50–100× for a typical solution — so the tool reads them on demand from the referenced DLL (~tens of ms per call).
Call when:
name::SomeMethod placeholder in topology output and want to
resolve which assembly exposes it.Don't call when:
codememory_definitions
is faster and gives line ranges.Example: codememory_assembly_members(type="System.Linq.Enumerable", project="my-dotnet-app")
If assembly is omitted, the first matching assembly wins. Pass the full
identity ('Name, Version=X.Y.Z.W, Culture=…, PublicKeyToken=…') when
multiple versions of the same DLL are referenced.
The graph stamps every File / Symbol / edge with first_seen_sha /
last_seen_sha / invalid_sha (and matching topological ordinals).
Deletes don't erase data; they tombstone it. These three tools query the
history that builds up.
codememory_drift(head_sha, project)Symbols the most recent ingest didn't confirm at head_sha. Each row is
either tombstoned (explicitly removed) or drifted (an
incremental ingest missed it).
Call when:
codememory_at_sha(sha, sha_ord, project, label?, limit?)Lists nodes alive at the supplied commit. Pass sha_ord (precomputed
once with git rev-list --count --first-parent <sha>).
Call when:
Caveat: only nodes that carry topological ordinals are visible — anything ingested before the temporal upgrade is filtered out.
codememory_callers_at_sha(symbol, sha, sha_ord, project)Callers of a symbol as the graph looked at that commit — including tombstoned edges that were alive then.
Call when:
Claims are bi-temporal (subject, predicate, object) facts about the
user, project, or preferences — not about the code itself. They
persist across sessions so a future session can answer "what did the
user say about X?" without re-reading every prompt.
You are the triage layer. Auto-extraction is intentionally OFF — running a local LLM on every prompt produced noisy / empty triples and missed half the durable signal because the LLM lacked task context. You see the full conversation, so you decide.
codememory_assert_claimCall it as soon as the user states something durable — i.e. the assertion is likely still true in the next session, not transient task state. Do this inline in the same turn as the user message; don't batch to end-of-session.
Worth asserting (call the tool):
(user, prefers, "no end-of-turn summaries").Not worth asserting (skip the tool):
codememory_record, not claims.Use these canonical predicates so single-valued contradiction handling works:
| Predicate | Sense | Single-valued? |
|---|---|---|
uses | primary tool ("we use Postgres") | yes |
prefers | user preference | yes |
rejected | explicit no | no |
wants-to | stated intent | no |
is-located-at | path / URL | yes |
depends-on | hard dependency | yes |
deployed-to | deployment target | yes |
owns | ownership / responsibility | yes |
is-a | type / category | yes |
mentioned | weak co-occurrence (use sparingly) | no |
worked-on | history of work | no |
Single-valued predicates auto-close prior conflicting assertions: a
later (project, uses, "FalkorDB") supersedes an earlier
(project, uses, "Neo4j") without manual cleanup.
user — the human at the keyboard.project — the current repo.apps/api/auth, BillingService).Alice).evidence_spanPass the verbatim user quote that justifies the claim when practical. It's not enforced (unlike the LLM extractor) but it makes future audit trivial.
codememory_extract_claims — when to use itReserved for batch processing of multiple historical prompts at
once (e.g. seeding claims from a long imported conversation).
Requires CLAIMS_EXTRACTION=true + gemma2:9b. Prefer
codememory_assert_claim for inline single-claim authoring — it
skips the LLM and gives you full control over the triple.
codememory_claims — read user preferencesCall before making a recommendation that touches a user preference
area (deployment, tooling choice, output style). Example:
codememory_claims(subject="user", project=…) returns the agent's
running profile of the user's stated preferences.
codememory_retrieve(query, project, k?, eps?, include_idle_episodes?)
codememory_record(prompt, project, plan?, patch?, verdict?)
git diff) and a verdict (success / reverted / partial). Future
sessions will surface this episode for similar prompts.codememory_reingest(path, project)
1. User asks question
│
├─ Context Pack already injected? → skim Code hits + Episodes
│
├─ Question mentions a past commit / "before" / "used to" / "drift" /
│ "release/X"?
│ → codememory_drift (current vs last ingest)
│ → codememory_at_sha / codememory_callers_at_sha (point-in-time)
│
├─ Question about a .NET type's method surface (overloads, signatures)?
│ → codememory_assembly_members(type=Namespace.Name)
│
├─ Topology question ("who calls", "what imports", "impact",
│ "who defines")?
│ → codememory_callers / callees / importers / dependencies / definitions
│ → ONLY THEN open files at the lines the graph returned
│
├─ Need conceptual orientation in unfamiliar area?
│ → codememory_retrieve(query)
│
├─ User asserted a durable preference / decision / ownership /
│ rejection?
│ → codememory_assert_claim(subject, predicate, object, project)
│ inline in the same turn (don't batch)
│
├─ About to make a recommendation that touches a known preference
│ area (deploy target, output style, tooling)?
│ → codememory_claims(subject="user", project=…) first
│
└─ After completing the task → codememory_record(prompt, patch, verdict)
Cost ordering (cheapest first): drift / at_sha → topology graph hops → assembly_members (reads a DLL) → retrieve (vector + rerank) → reading source files. Prefer the cheaper tool when both would answer.
Treat it as orientation, not ground truth:
verdict=success episode matches
your task, read its plan / patch before reinventing it.project missing or invalid → server raises MissingProjectError
with the cwd-detected slug embedded. Read the error, re-issue the call
with that exact project value. Do not invent a slug or pass "auto".code-memory ingest <repo> — the git-aware
delta makes this cheap.[], the symbol may be ambiguous,
external, or simply not yet resolved. Try codememory_definitions
first to disambiguate before falling back to grep.codememory_at_sha returns [] for a SHA you know is real, the
graph rows from that era predate the temporal upgrade — the lifecycle
fields are NULL so the query filters them out. Either re-ingest at
that SHA or fall back to git show <sha>:<file> for source-level
answers.codememory_assembly_members returns an error like "no parsable
DLL", the assembly was referenced but not indexed (no NuGet restore
ran, or the project was excluded). Don't retry; surface the gap to
the user.codememory_ingest triggers a full / incremental repository
ingest. On large repos this takes minutes to hours and blocks the MCP
transport. Always confirm with the user first; only set
confirmed=true after they explicitly authorise the run in chat. The
server returns a dry advisory payload when confirmed is omitted.Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub fmflurry/code-memory --plugin code-memory