Catalogue / persistent-code-intelligence
persistent-code-intelligence
Older skill: source not recordedSignedGuides an agent through building a persistent, locally stored understanding of one codebase with the in-memoria CLI and offering it to MCP clients such as Claude or Copilot. Covers deciding between durable memory and a one-off analysis, choosing exclusions, creating the store, validating it, keeping…--- name: persistent-code-intelligence description: > Guides an agent through building a persistent, locally stored understanding of one codebase with the in-memoria CLI and offering it to MCP clients such as Claude or Copilot. Covers deciding between durable memory and a one-off analysis, choosing exclusions, creating the store, validating it, keeping it current, serving it on a confirmed port, and repairing a stale or corrupt store. Use when the user wants agents to retain project knowledge across sessions, wants a codebase memory connected through MCP, or asks to refresh or fix an existing store. Not for single-use code summaries, projects small enough to read directly, installing the package, or machines where the CLI is absent. license: MIT ---
Give Agents a Memory of the Codebase
Goal
The aim is a body of knowledge about one codebase that AI tools can draw on session after session without re-parsing the project each time. The in-memoria CLI does the learning once and keeps the result under the project's .in-memoria directory; an MCP server then makes that store available to compatible clients. All of it stays on the user's machine.
What a connected agent gains
Once the store is served, agents can ask about:
- The project's shape — languages, frameworks, entry points, and how the layers fit together.
- Conventions the code genuinely follows — naming styles, error-handling habits, recurring structures.
- Placement suggestions — a request like "add invoice PDF export" comes back with a proposed home such as
src/billing/invoice-pdf.tsbefore anyone types code. - Search by meaning — files matching an intent ("where do we parse uploaded spreadsheets") rather than a bare keyword.
- Working context — decisions already taken, tasks in flight, and whether a proposed change stays consistent with the approach the team settled on.
Confirm the tool is already installed
Before invoking anything, look for the CLI as a dependency of the project or as a binary on the PATH. If it is missing, stop there: ask the user to install it the way they normally would and wait until they have. Never download the package yourself, and never start it through a runner that fetches code each time it is invoked — run only the copy the user already installed.
First decision: durable memory or a one-off answer?
Put three honest paths in front of the user before touching a command:
- Memory that later sessions and teammates' agents reuse — stay on this path.
- A throwaway read right now — run
analyze [path]; it produces a single summary for immediate reading and creates none of the store the later steps depend on, so there is nothing to validate, refresh, or serve afterward. - A project small enough to read in one sitting — skip the tool and read the source.
What separates the paths: learn [path] is the command that persists knowledge into the store; analyze [path] is reporting only.
Second decision: what must never be indexed
Decide exclusions before the first build, because once something is learned, removing it again is clumsy. Two categories are not up for debate:
- Files that carry secrets — environment files, keys, tokens. Never let credentials into the store.
- Third-party dependency folders, build products, and generated code: they inflate the store and can stretch a build into hours.
Capture the choices with setup --interactive, run once per project. It asks once for paths, exclusions, and preferences and records them in the project configuration. Revisit it only when the project's layout changes significantly.
Create the store
Point learn [path] at genuine source — ./src, ./lib, whatever holds the code — never at a repository root that mixes in dependencies or build products. One pass runs, the store is written, and the command exits. Expect a few hundred files to finish in well under a minute, several thousand to take about a minute, and past ten thousand a few minutes. A run still going after roughly ten minutes usually means an exclusion is missing: stop it, correct the configuration, and begin again. After a large refactor or a switch of frameworks, learn the project again on purpose so the store matches the new shape of the code.
Validate before anything consumes the store
Run check [path] --verbose and read the report it prints: what the store covers and what it misses. A clean report is the signal to continue. Where it names shortfalls, point learn at the affected paths again and re-check. Do not open the server while gaps remain — agents will answer firmly on the strength of an incomplete store.
Choose how the store stays current
Put the refresh mode to the user:
- Code changes daily — launch
watch [path]and leave it running; it applies each file change to the store the moment the file is saved. - Quiet repository — leave the watcher out and repeat
learnwhen the project hits a milestone.
Later, if an agent cannot see newly written code, ask first whether the watcher is alive.
Expose the store only after an explicit yes
Serving puts the store in front of MCP clients, so it needs the user's own decision. State plainly what will be offered — which project and on which port — and wait for a spoken yes before launching; an assumed approval is not approval. Once confirmed, run server in its own terminal; it keeps listening until stopped. Each project gets its own server, and when several must run at the same time, give each a separate port with --port — 4010 for the payments service, 4011 for the docs site — so the stores never collide. The watcher and the server are long-running processes that each hold a terminal; tell the user which terminal holds which so they can stop both deliberately.
Verified behavior versus assumptions
Only two commands are documented as changing the store: learn builds or rebuilds it, and watch updates it incrementally. For setup, check, analyze, and server, the upstream documentation describes their output — saved configuration, a printed report, a one-time summary, a listening service — and documents no further writes. Offer no stronger guarantee than that: if a step's disk behavior matters to the user, verify it on their machine before relying on it.
Diagnose and repair
| Observation | Likely cause | Response | |---|---|---| | learn fails straight away | The path is wrong or unreadable | Check the path and the user's read permissions, then retry | | check names shortfalls | learn was interrupted or partial | Point learn at the affected path again, then re-check | | Agent cannot see recently written code | watch is not active | Launch watch [path] in a separate terminal | | server refuses to start | Store corrupt or incomplete | Run check --verbose; if the store is corrupt, obtain the user's explicit approval, then delete the generated database files inside the project's .in-memoria directory and run learn again — the store rebuilds itself | | Projects step on each other | Two servers on the same port | Relaunch one with --port pointed at an unused number |
Command summary
| Invocation | Documented effect | Changes the store | |---|---|---| | setup --interactive | Asks once for paths, exclusions and preferences; records them in the project configuration | No — configuration only | | learn [path] | One pass over the path, then exits | Yes — builds or rebuilds it | | check [path], add --verbose for detail | Prints a report of coverage and gaps | No store update documented | | analyze [path] | Produces a single summary for immediate reading | No — creates no store | | watch [path] | Runs until stopped; applies each change as it happens | Yes — incremental updates | | server, with --port N to pick the port | Accepts MCP client queries until stopped | Runtime writes not documented |
Boundaries and attribution
Left out deliberately: installing the package, step-by-step wiring for each MCP client, and the full API documentation of the upstream project — this skill stays with the local lifecycle of configure, build, verify, refresh, serve, and repair. The tool and this workflow come from the MIT-licensed In Memoria project; these instructions carry the same license and credit its authors.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 8.4 kB | 7bd6813ee679 |
| THIRD_PARTY_NOTICES.md | 1.4 kB | e3bb69b3daef |
| examples.json | 2.0 kB | 308e64692350 |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 1.0.0 Current | Not recorded | 10 Oct 2026 |
Locking a skill to one version needs Pro.