Back to Browse

Cardloom MCP Server

Developer ToolsModerate5.4MCP RegistryLocal
Free

Server data from the Official MCP Registry

Reviewed, git-backed engineering knowledge base for coding agents, served over MCP.

About

Reviewed, git-backed engineering knowledge base for coding agents, served over MCP.

Security Report

5.4
Moderate5.4Moderate Risk

CardLoom is a git-backed knowledge card server for coding agents with reasonable safeguards: agents can only create drafts, human approval gates verification, path traversal checks exist on card IDs, and secret patterns are scanned on save. No exfiltration, shell execution, or hardcoded credentials were observed in the visible code, though the review was truncated and some files (mutation pipeline, secret scanner, web viewer, launcher-env) were not visible, so the assessment is partial. Supply chain analysis found 6 known vulnerabilities in dependencies (0 critical, 3 high severity). Package verification found 1 issue.

6 files analyzed · 14 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

File System Read

Reads files on your machine. Normal for tools that analyze or process local data.

File System Write

Writes or modifies files on your machine. Check that this is expected for the tool.

process_spawn

Check that this permission is expected for this type of plugin.

database

Check that this permission is expected for this type of plugin.

env_vars

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Folder that holds the cards (a git repository). Defaults to ~/.cardloom/knowledge-store.Optional

Environment variable: KNOWLEDGE_STORE_PATH

Path of the derived SQLite index. Defaults to ~/.cardloom/index.db.Optional

Environment variable: INDEX_DB_PATH

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "cardloom-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "cardloom-mcp@1.1.2"
      ],
      "env": {
        "INDEX_DB_PATH": "your-index-db-path-here",
        "KNOWLEDGE_STORE_PATH": "your-knowledge-store-path-here"
      }
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

cardloom-mcp

CI

Save engineering decisions and fixes your coding agent can look up later. Give your agent instructions to search before answering and to save new lessons as draft cards. Search returns verified cards by default, and you decide what gets verified. Cards are plain markdown in a git repository, and search is a local SQLite index with no LLM on the read path. It works with any MCP client, such as Claude Code, Cursor or Codex.

How it works

  • Cards. One markdown file per lesson: a decision, gotcha (with the error message in error_signature), pattern, playbook or snippet, tagged with the stack, versions and project it applies to.
  • Lifecycle. draft → verified → deprecated. An agent can only create drafts; a human approves (verified) or retires (deprecated) them. Deprecated is final and the file is kept for history. Merge promotion can optionally verify drafts whose source commit was merged. Search returns verified cards by default; drafts and deprecated cards only on request, always labelled.
  • Git is the source of truth. cards/*.md and events/*.jsonl are committed locally. The SQLite index is derived and can be rebuilt at any time. Syncing between machines is an ordinary git push/pull that you run; the server never touches a remote.
  • Search. Full-text search (SQLite FTS5) with matching on stack, version and project. Every result says how it matched, so an agent can tell a real hit from a loose one, and carries a trust score from usage feedback and age.
  • Checks on save and read. Draft and deprecated content is labelled untrusted / deprecated in every response, secret patterns are rejected on save, and a card that conflicts with an existing one is refused instead of silently overwriting it.

The agent searches before it works, reports whether a card helped, and saves what it learned as a draft. You decide what a draft becomes:

Tools

ToolWhat it does
search_knowledgeFind cards by keywords or a pasted error message; returns compact results with a match label.
get_cardRead one card in full (also available as the resource knowledge://card/{id}, which always returns the full body). Optional compact: true returns only the first 600 characters of the body (cut on a character boundary, then …; truncated: true is set only when something was cut); everything else is unchanged, and the default is the full body. Carries source (repo, 7-character commit, approved_at date; each null when unknown) so you can tell where it came from. Reports replacement.pending (a draft proposes to replace it; it is still the current answer) and replacement.superseded_by (read that card instead).
save_learning_draftSave a new card as a draft.
update_card_statusVerify, deprecate or reconfirm a card; agents should call it only when you tell them to.
report_card_usageReport whether a card helped: confirmed, refuted or neutral.

There is also one prompt, distill_project_knowledge, which guides an agent through turning an existing project's docs and history into draft cards.

Quickstart

Five steps from an empty knowledge store to your first trusted card:

  1. Register the server and the usage instructions with every agent CLI found on your machine (Claude Code, Codex, Gemini CLI). The first command only prints what it would do:

    npx -y cardloom-mcp install
    npx -y cardloom-mcp install --yes
    

    install --yes registers the server for all your projects and adds the instruction block between and in ~/.claude/CLAUDE.md, ~/.codex/AGENTS.md (or $CODEX_HOME/AGENTS.md) and ~/.gemini/GEMINI.md. It never touches a cardloom entry that runs another command, and running it again finishes whatever failed without duplicating the block (see Set it up once for all projects). To register by hand for one project instead:

    claude mcp add cardloom -- npx -y cardloom-mcp
    
  2. Run npx cardloom-mcp doctor to see the store path and card counts by status. If there are no verified cards, it points you back to this quickstart. The check is read-only.

  3. Ask your agent to save one gotcha it just hit, for example: "Save what we learned about this error as a gotcha card, and put the exact error message in error_signature." The agent calls save_learning_draft; the card lands as draft.

  4. Approve it in chat: "Verify that card." The agent calls update_card_status with action verify. Until you do this, the draft stays out of default search (see Approving knowledge in chat).

  5. Search for it: ask the agent to call search_knowledge with the exact error_signature text you saved. With default settings the card comes back with match: "exact_signature".

To label results for the repo you are working in, add a .knowledge-map.yaml at that repo's root (details in .knowledge-map.yaml):

project: acme/billing-api
stack:
  - node
domain: backend

To have your agent use the tools without being asked each time, see Enforcing usage.

Setup

The server exposes the same five tools with each setup option.

Options 2 and 3 run from a clone: git clone https://github.com/bangca85/cardloom-mcp.git && cd cardloom-mcp.

Option 1: npx (no clone, no Docker)

Needs Node 22 or newer (CI runs 22 and 24). The launcher keeps your cards in ~/.cardloom/knowledge-store and the SQLite index in ~/.cardloom/index.db; set KNOWLEDGE_STORE_PATH / INDEX_DB_PATH to put them elsewhere.

claude mcp add cardloom -- npx -y cardloom-mcp
npx cardloom-mcp doctor   # read-only health check: store path, card counts by status

claude mcp add registers the server for the current project only; add --scope user to use it everywhere (see Set it up once for all projects).

Other clients use the same command. Cursor (~/.cursor/mcp.json):

{
  "mcpServers": {
    "cardloom": { "command": "npx", "args": ["-y", "cardloom-mcp"] }
  }
}

Codex (~/.codex/config.toml):

[mcp_servers.cardloom]
command = "npx"
args = ["-y", "cardloom-mcp"]

The SQLite driver (better-sqlite3) ships prebuilt binaries for common platforms; elsewhere npm compiles it, which needs a C++ toolchain.

Option 2: Docker

  1. Build the server:

    npm install
    npm run build
    
  2. Build the container image:

    docker compose build
    
  3. Register the server with your MCP client using the wrapper script at bin/cardloom-mcp.sh — use an absolute path, since MCP clients spawn the command with an arbitrary working directory and the wrapper needs to find docker-compose.yml regardless.

    Claude Code:

    claude mcp add cardloom -- /absolute/path/to/cardloom-mcp/bin/cardloom-mcp.sh
    

    Cursor (~/.cursor/mcp.json):

    {
      "mcpServers": {
        "cardloom": {
          "command": "/absolute/path/to/cardloom-mcp/bin/cardloom-mcp.sh"
        }
      }
    }
    

    Codex CLI / Codex extension (VS Code) (~/.codex/config.toml):

    [mcp_servers.cardloom]
    command = "/absolute/path/to/cardloom-mcp/bin/cardloom-mcp.sh"
    args = []
    

    Or via the Codex Settings UI → MCP servers → Connect to a custom MCP (writes to the same config.toml): Name cardloom, Type STDIO, Command to launch = /absolute/path/to/cardloom-mcp/bin/cardloom-mcp.sh, leave Arguments/Environment variables/Working directory empty, Save.

  4. Verify: ask your client to list MCP tools. You should see exactly 5 — search_knowledge, get_card, save_learning_draft, update_card_status, report_card_usage — plus one resource template, knowledge://card/{id}, and one Prompt, distill_project_knowledge (see Ingesting an existing project).

Each MCP session starts a fresh container (docker compose run --rm -i) that exits when the client disconnects. Cards live in ./knowledge-store (a bind mount: human-editable and git-tracked). The SQLite index lives in a separate named Docker volume, because a SQLite file on a macOS bind mount is unreliable; never touch it by hand, it is fully disposable and rebuilds from knowledge-store/ (see npm run rebuild-index).

Option 3: Native from a clone (no Docker)

Docker on macOS runs a Linux VM (Virtualization.framework) underneath, which reserves several GB of RAM regardless of how small the container's own workload is. The server itself is light — measured at ~100MB RSS for the MCP process and ~71MB for the web viewer, both idle at 0% CPU — so running directly on the host with plain node skips the VM overhead entirely.

npm install
npm run build

Register the server with your MCP client using node directly instead of the Docker wrapper:

{
  "mcpServers": {
    "cardloom": {
      "command": "node",
      "args": ["/absolute/path/to/cardloom-mcp/dist/index.js"],
      "env": {
        "KNOWLEDGE_STORE_PATH": "/absolute/path/to/cardloom-mcp/knowledge-store",
        "INDEX_DB_PATH": "/absolute/path/to/cardloom-mcp/.metadata/index.db"
      }
    }
  }
}

Trade-off: you lose container isolation, and git commits use your host's git config. The SQLite index and its write lock live on your local filesystem, so there is no bind-mount quirk to worry about.

Configuration

Every setting is an environment variable and every one is optional.

VariableDefaultMeaning
KNOWLEDGE_STORE_PATH~/.cardloom/knowledge-store with npx, ./knowledge-store otherwiseWhere cards (cards/), usage events (events/) and your benchmark live. It is its own git repository.
INDEX_DB_PATH~/.cardloom/index.db with npx, <store>/.metadata/index.db otherwiseThe SQLite index. Derived data, safe to delete.
SEARCH_FALLBACKtieredtiered: when exact-word search finds fewer than limit cards, add partial matches labelled related. off: exact-word search only.
SEARCH_RANKINGbaselineResult order: baseline or the opt-in x / y. See How search works.
STALE_THRESHOLD_DAYS180A verified card older than this is flagged stale.
REVIEW_FAILURE_THRESHOLD2A card with this many refuted reports is flagged needs_review.
REVIEWER_NAMEhuman-reviewerRecorded as verified_by when a card is approved.
KNOWLEDGE_MACHINE_IDthe host nameNames this machine's usage log (events/<id>.jsonl) so two machines never write the same file.
CARDLOOM_TELEMETRYofflocal records how each search ended in telemetry.jsonl beside the index, for gaps. Anything else is off. See Knowledge gaps.
CARDLOOM_TELEMETRY_PATHbeside the indexAbsolute path of the telemetry file. Refused if it is inside the knowledge store.
CARDLOOM_TELEMETRY_SAMPLESoff1 or true also records the text of searches that found no direct answer. A separate opt-in; read the warning under Knowledge gaps.
PROMOTION_MODE and the other PROMOTION_*see Merge promotionControl npm run promote-merged.
PORT3334Web viewer port.
GRAPH_GENERIC_STACK_TAGS, MAX_SHARED_STACK_GROUP_SIZE, MAX_SHARED_STACK_EDGESempty, 50, 5000Web viewer graph tuning.

How search works

search_knowledge(query, context) takes keywords or a pasted error message. context carries the calling repo's stack, versions, project and aliases (see .knowledge-map.yaml).

Each result says how it matched:

matchMeaning
exact_signatureThe card's error_signature appears in your query. It is checked on the stored text, so ERR-42 does not match ERR_42.
exact_identifierYour query contains an identifier from the card's error_signature, such as ITMS-90683 or AccessDeniedException.
exact_titleYour query is the card's whole title.
all_termsEvery word of your query is in the card.
relatedOnly some of the words match.

When all returned cards are partial matches, the response includes no_direct_match: true. Use those cards as leads for a follow-up search, not as an answer. Set SEARCH_FALLBACK=off to get only cards that match all words.

search_knowledge returns at most 5 cards by default (it was 10 in earlier versions). Pass limit for more, for example limit: 10. With the tiered fallback, partial matches are added only when fewer than limit cards match every word.

Search results stay compact and do not carry source: adding repo, commit and approval date to every result raised the estimated response size by about 17% at limit 5. get_card returns it for the one card you read: source: { repo, commit, approved_at }. repo is the card's source_repo, else the first applies_to entry when that looks like owner/name (a guess; component names such as api give null); commit is the sha found in source_commit, shortened to 7 characters; approved_at is the date part of last_verified (null for a draft). Each field is null when it is unknown.

By default only verified, non-restricted cards are returned. include_drafts, include_deprecated and include_restricted opt in, and those cards are always labelled. Each result also carries a trust score and flags: drift (the card's version range does not match the caller's), stale and needs_review. With a project in the context, results also say whether a card belongs to this project, is shared, or applies to another project; cards for other projects are never hidden.

Ranking. The default (SEARCH_RANKING=baseline) orders results by stack and version match, then text relevance, then trust. The x and y modes also rank by project. They are opt-in because, in our benchmark, putting the project ahead of the text score pushed exact matches from shared cards below weaker matches from the caller's own project. Run npm run benchmark -- --matrix against your own store before enabling them.

What is tested

tests/integration/trust-guarantees.test.ts checks the JSON that search_knowledge and get_card return, not internal objects, for these behaviours:

  • Filtered by default. A default search does not return draft, deprecated or restricted cards, and does not return a card that has been superseded.
  • Labelled when requested. With include_drafts, a draft is returned with untrusted: true; with include_deprecated, a deprecated card is returned with deprecated: true; with include_restricted, a restricted card is returned with restricted: true. get_card labels the same three cards the same way (and returns the deprecation_reason).
  • Flagged when old. A card last verified more than STALE_THRESHOLD_DAYS ago carries flags.stale: true in search results (the test uses a card verified 400 days before a fixed date).
  • Replacement reported. get_card on a superseded card names the card that replaced it in replacement.superseded_by.

The test shows what the server returns and how it labels it. Whether an agent acts on those labels is not covered by this test.

.knowledge-map.yaml — giving the agent context per repo

Add a .knowledge-map.yaml to the root of each project you work on. Your agent reads it and passes the project and stack details to search_knowledge, so results are matched against your stack and versions:

# .knowledge-map.yaml — lives in the root of each project repo you work in
project: acme/billing-api
aliases:            # optional: other names this project has had in existing cards
  - billing-api
stack:
  - nextjs@15
  - postgres@16
  - node
domain: backend

project: is the key the agent passes as context.project (and aliases: as context.aliases) so results are labelled by scope (this project, shared, other project); they are ranked by project only when SEARCH_RANKING is set to x or y. Cards for other projects are never hidden. Older maps that use repo: instead of project: are still accepted by clients.

Workflow for a brand-new repo:

  1. Ask the agent to inspect the repo (package.json, lockfiles, etc.) and generate a draft .knowledge-map.yaml.
  2. Review and edit it yourself — fix wrong stack detection, add domain hints.
  3. Commit it into the project repo (not cardloom-mcp).
  4. Point your agent/client at it so search_knowledge calls include context: {stack, versions, project, aliases} read from that file.

Session context

npx cardloom-mcp context prints a short list of the verified cards that matter for the project you are standing in, so an agent starts a session already knowing them. It is meant for a Claude Code SessionStart hook, whose output is added to the session. It is opt-in: nothing registers it unless you do.

What it prints (nothing else, and nothing at all when the list would be empty):

# Cardloom: verified cards for acme/billing-api
- Retry payments at most twice (pattern-payment-retry): Retry a payment request at most twice, then surface the error.
- Lock before writing (gotcha-write-lock): Take the write lock before touching the index.
Use search_knowledge/get_card for details.
  • Which cards: verified and sensitivity: normal only, and only cards of this project (the project: key of .knowledge-map.yaml in the current directory, or one of its aliases:), global cards, and stack-scoped cards whose stack intersects the map's stack:. Drafts, deprecated, restricted, stale and needs-review cards are never printed. Without a .knowledge-map.yaml (and without --project <key>, which replaces the map) it prints nothing.
  • Order and size: highest trust first, then most used, then id. At most 5 cards (--max-cards) and an estimated 800 tokens in total (--max-estimated-tokens; the figure is an estimate, characters divided by 4, not a tokenizer count). Each summary is the first sentence of the card, at most 160 characters. Cards are dropped from the end until the output fits; if not even one fits, nothing is printed.
  • Read-only: it opens the existing index (INDEX_DB_PATH, ~/.cardloom/index.db by default) for reading and never builds, migrates or creates anything, not even the -wal files of a WAL index. If the index is missing, unreadable or from an older version, or the store is empty, it prints nothing and exits 0, so a session never breaks. Start the server once to have an index (the npx server builds ~/.cardloom/index.db). npm run rebuild-index from a clone builds the clone's own index (<store>/.metadata/index.db unless INDEX_DB_PATH is set), which is not the file the hook reads unless both point at the same INDEX_DB_PATH.

Register it with one command (it prints the plan; add --yes to apply):

npx cardloom-mcp install --hooks          # plan: shows the change to ~/.claude/settings.json
npx cardloom-mcp install --hooks --yes    # applies it

--hooks alone changes only ~/.claude/settings.json (Claude Code; codex and gemini have no hook here). The file is parsed strictly and an invalid one is refused and left untouched; everything else in it, and its indentation, are kept, and running it again does not add a second entry. To use it together with the normal setup, add --agent (for example install --agent claude --hooks --yes). To do it by hand, add this to ~/.claude/settings.json:

{
  "hooks": {
    "SessionStart": [
      { "hooks": [{ "type": "command", "command": "npx -y cardloom-mcp context", "timeout": 15 }] }
    ]
  }
}

Things to know before relying on it:

  • Docker users get no session context. The hook runs on the host and reads the index at ~/.cardloom/index.db (or INDEX_DB_PATH), not the index in the Docker named volume, so with a Docker-only setup it prints nothing.
  • npx -y cardloom-mcp context may contact the npm registry on every session start, which can slow the start of a session. For a faster hook, install the package globally (npm install -g cardloom-mcp) and register the command cardloom-mcp context instead. install --hooks registers the npx -y form, so edit the command in ~/.claude/settings.json to switch. The entry install --hooks writes has "timeout": 15 (seconds), so a slow or offline registry cannot hold up a session start for long; an entry you wrote without a timeout is still recognised and left as it is.
  • A custom INDEX_DB_PATH must reach the hook too. The hook is a separate process from the MCP server, so an INDEX_DB_PATH set only in your MCP config env is not seen by it: it reads the default ~/.cardloom/index.db instead, or prints nothing when that file is missing. Hook commands run in a shell, so put the variable in the command itself, for example "command": "INDEX_DB_PATH=/absolute/path/index.db npx -y cardloom-mcp context".
  • npm run context from a clone reads the clone's own .knowledge-map.yaml (the current directory) and needs INDEX_DB_PATH set to the index to read; without it, it prints nothing.

Enforcing usage (CLAUDE.md / AGENTS.md / GEMINI.md)

Nothing forces the agent to call these tools — MCP tools only fire when the model decides to. To have your agent search before answering, report whether a card helped, and save new lessons as drafts, give it the instructions below, in either of two places:

  • Globally, once for every project: put the block in your client's global instructions file. See Set it up once for all projects.
  • Per project: put it in the repo's own CLAUDE.md (Claude Code), AGENTS.md (Codex) or GEMINI.md (Gemini CLI). Codex does not read CLAUDE.md, and Gemini CLI reads AGENTS.md only if you list it in context.fileName. If several clients work in the repo, add the block to each client's file.

Use one place or the other: the same block in both only costs tokens.

## Knowledge Hub (MCP `cardloom`) — required

**Before answering/implementing a task touching a known domain** (auth, rate-limiting,
third-party API contracts, infra gotchas, etc.): call `search_knowledge(query, context)` first,
with `context` read from `.knowledge-map.yaml` at this repo's root (`stack`, `versions`, and
`project` / `aliases` so results are labelled for this repo). A result with `match: related`,
or a response with `no_direct_match: true`, is a partial match: use it as a lead for another search, not as an answer.
**If that file doesn't exist yet**, generate a draft yourself before proceeding — inspect this
repo's manifest (package.json / pubspec.yaml / go.mod / requirements.txt, lockfiles) for the
real stack + versions, write it in this shape, then ask the human to review before you rely on it:

```yaml
# .knowledge-map.yaml — repo root, human-reviewed after you draft it
project: <owner/repo-name>
aliases: []   # optional: other names this project has had in existing cards
stack:
  - <tech>@<version>
  - <tech>@<version>
domain: <frontend|backend|infra|product|...>
```

Don't re-derive something a `verified` card already answers. When a returned card from another project helps, say which project and commit it came from (`get_card` shows its "source").

**After using a returned card — you MUST call `report_card_usage(id, outcome)`**
(`confirmed`/`refuted`/`neutral`). This is not optional — every search/get_card response carries
a `write_back_reminder`; skipping it lets trust scores and `needs_review` flags drift stale.

**Learned something new** (a decision, pattern, or gotcha with no existing card, or a refinement
of an existing one) → call `save_learning_draft`. It always lands as `draft` — never verify it
yourself. Put a bare commit sha in `source_commit` and the repo's GitHub `owner/name` in
`source_repo` whenever the learning comes from a commit: that is what lets merge promotion find
it. Free text there ("working tree", "local changes") means the card can only ever be approved by hand.

**Found a major mismatch between a `verified` card and current reality** (the card says A, the
code/logs/API actually do B — a real contradiction, not a nuance): **stop, don't silently trust
either side.** Lay out:

- which card, what it currently claims (`id` + summary)
- what you actually observed (specific file/log/response)
- the two possible resolutions: the card is stale/wrong → deprecate it + save a new card with
  `supersedes`, or the code is the regression → fix the code and leave the card as-is

then ask for confirmation on which direction before calling `update_card_status` or
`save_learning_draft(supersedes=...)`. Don't decide alone when the mismatch affects an
architecture or security call.

Set it up once for all projects

npx -y cardloom-mcp install --yes does everything in this section for the agent CLIs it finds on PATH (--agent claude|codex|gemini limits it, and it can be repeated). Without --yes it prints the plan and changes nothing.

  • It skips registering when a server named exactly cardloom already runs cardloom-mcp (for Claude Code only a user-scope entry counts: a local or project-scope one is not global, so cardloom is registered again at user scope), and writes the instructions anyway. If cardloom exists with another command (a dev checkout, say), it leaves that entry alone, says so, and writes no instructions for that agent. A server named cardloom-dev is not touched.
  • The instruction block goes between and; text outside the markers is never changed and a second run replaces the block instead of adding another. If a marker is unmatched or repeated, that agent fails and its file is left as it was. A file that already has the ## Knowledge Hub (MCP `cardloom`) section pasted without markers is left alone too, with a note saying to wrap it in the markers or delete it so a later run can keep it current.
  • Any agent that fails makes the command exit 1 with a summary; run it again to finish the rest.
  • Even without --yes it runs claude mcp get cardloom and gemini mcp list (and codex mcp list --json) to see what is registered, and the first two may start the MCP servers you have configured. They run from an empty temporary directory, so only user-level entries are seen.

To do it by hand, register the server for every project and put the instruction block above in the client's global file:

ClientRegister the server for all projectsGlobal instructions file
Claude Codeclaude mcp add --scope user cardloom -- npx -y cardloom-mcp~/.claude/CLAUDE.md
Codex (OpenAI's coding agent)codex mcp add cardloom -- npx -y cardloom-mcp~/.codex/AGENTS.md
Gemini CLIgemini mcp add --scope user cardloom npx -y cardloom-mcp~/.gemini/GEMINI.md
  • Scope matters. claude mcp add and gemini mcp add register the server for the current project only unless you pass --scope user, so the Quickstart command is project-scoped. codex mcp add writes ~/.codex/config.toml, which is already global.

  • Codex. Use ~/.codex/AGENTS.override.md for a temporary global override without touching the base file. If you set CODEX_HOME, both files live there instead of ~/.codex.

  • Gemini CLI. You can also add the server by hand to ~/.gemini/settings.json (merge it with what is already there):

    { "mcpServers": { "cardloom": { "command": "npx", "args": ["-y", "cardloom-mcp"] } } }
    

    To make Gemini CLI read an AGENTS.md as well, set "context": { "fileName": ["AGENTS.md", "GEMINI.md"] } in the same file.

  • ChatGPT. The ChatGPT chat apps do not read these files; Codex is the OpenAI client covered here.

  • Check it worked. Run claude mcp list, codex mcp list or gemini mcp list and look for cardloom, then ask the agent to list its MCP tools. In Gemini CLI, /memory show prints the instructions it loaded.

Approving knowledge in chat

Every card an agent saves via save_learning_draft starts in status: draft and stays out of default search until it is verified. To promote or retire one:

  • Approve: tell the agent to approve a card; it calls update_card_status(id, "verify"). Status flips to verified, and if the card declared supersedes: <old-id>, the old card is deprecated in the same operation (one commit). If that old card was already replaced by another card, the approval is refused with invalid_transition (<old-id> is already superseded by <other-id>) and nothing changes; the draft stays a draft and can still be deprecated.
  • Reject / retire: tell the agent to deprecate a card with a reason; it calls update_card_status(id, "deprecate", reason). The file is kept (a retired card is never deleted) and disappears from default search, but stays readable via get_card.
  • Reject a draft: when the learning is wrong, a duplicate or not worth keeping, start the reason with rejected: (for example rejected: duplicate of pattern-foo). The web viewer's "Reject" button on a draft does this for you. distill_project_knowledge reads that prefix and tells the agent not to save the same learning again unless the new draft says what is different.

Re-confirming old cards

A verified card last verified more than STALE_THRESHOLD_DAYS ago is flagged stale. If you check it and it is still right, re-confirm it instead of verifying a new card: update_card_status(id, "reconfirm") keeps the card verified, sets last_verified to now and writes verification_method: reconfirmed:<previous method> (one prefix, however many times). Nothing else changes: not the status, not verified_by, not the usage counters. It is refused for a card that needs review (refuted REVIEW_FAILURE_THRESHOLD times or more): supersede it with a corrected card instead. From the shell:

npx cardloom-mcp reconfirm --stale          # list stale cards, oldest first, with id, title, age and a hash (--json for scripts)
npx cardloom-mcp reconfirm --confirm pattern-a@<hash>,gotcha-b@<hash> --by alice

--confirm re-confirms each id@hash it is given and refuses an entry whose card file changed since it was listed (the hash is checked under the write lock), has an unknown id, or needs review; the other entries are still applied, each refusal is printed on stderr and the exit code is 1. --by defaults to REVIEWER_NAME and is recorded in the git commit message (knowledge: reconfirm <id> (by <name>)), not in the card file; the name is trimmed to one line of at most 80 characters. Through update_card_status, by is optional and defaults the same way. From a clone: npm run reconfirm -- --stale.

npm run doctor shows how review is going: drafts waiting (and the age of the oldest), cards approved by a human, by merge promotion, rejected, and retired before review, and the human approval rate (of drafts a human approved or rejected; merge promotion and retired drafts are listed beside it, not in it). A card counts as merge promotion only when its verification_method is exactly what promote-merged writes in auto mode (merged:<repo>@<sha> (<via> <date>)); the same evidence with +chat-approval after it, which is what you get when you approve a candidate in chat, counts as a human approval. reconfirm does not change who first approved a card, so a re-confirmed auto-promoted card still counts as merge promotion. A draft's age is counted from the commit that added the card when the store is a git repository, otherwise from the card file's modification time.

deprecated is terminal — there's no un-deprecate. To bring a retired idea back, save a new card with supersedes pointing at the old one and approve it.

Triaging drafts

npx cardloom-mcp triage (or npm run triage-drafts from a clone) lists every draft with the cards you may want to look at before deciding: same type and a similar title (Jaccard overlap of the title words, 0.5 or more) or overlapping facets, plus the card the draft supersedes (shown as this draft replaces it). Each line shows the card's status, title similarity, whether the facets overlap and whether it is the same project. It also says when that card was already replaced (superseded by <id>) or rejected. Drafts with nothing to compare are listed under "No related card". The report is evidence only: it gives no verdict and changes nothing, and facet overlap does not predict what verify will do (verify does not run the conflict check). --limit <n> examines only the oldest n drafts; --json prints the report as JSON. It reads the card files, not index.db, so it works without the server running.

Reading the report

npx cardloom-mcp report shows what the store did in the last 7 days (--days <n> for another window, up to 36500, --json for scripts): how many times cards were reported confirmed, refuted and neutral, the five cards confirmed most often, cards that now need a look, verified cards that go stale within 30 days, and how many drafts are waiting.

$ npx cardloom-mcp report
Last 7 days: 3 confirmed · 1 refuted · 1 neutral

Cards that helped most
  pattern-retry-payments · Retry payment requests with backoff (3)

Cards that need a look
  gotcha-old-config

Cards going stale within 30 days
  gotcha-old-config

Drafts waiting: 1 (oldest 0 days)

"Cards that need a look" lists cards whose total refutes reached REVIEW_FAILURE_THRESHOLD (default 2) and that were refuted at least once inside the window. "Going stale" means the card's last verification is between STALE_THRESHOLD_DAYS minus 30 days (exclusive) and STALE_THRESHOLD_DAYS (default 180, inclusive) old. With no usage at all in the window it prints No activity in the last N days. instead of the counts. The numbers come from the usage events in events/*.jsonl (the same ones that feed the trust counters); the report is read-only, never creates the store and works without the server running.

Checking an upgrade

Before bumping a dependency, ask which verified cards it affects. Run this in a repo that has a .knowledge-map.yaml whose stack lists the tech with a version (nextjs@14.2.0), and pass the version you are moving to:

$ npx cardloom-mcp upgrade-check --to nextjs@15.0.0
nextjs 14.2.0 -> 15.0.0

  Stop applying (1)
    pattern-old · Old routing rule

  Start applying (1)
    pattern-new · New caching default

  Apply to both (1)
    pattern-both · Image config applies to both

Cards are matched on the card's version_range with the same rule search uses for its drift flag. Only verified, non-restricted cards that name the tech in their stack and have a version_range other than * are listed, sorted by id, at most 20 per list (a list that reached 20 says so). --to can be repeated for several techs; a tech that is not in the map, or that has no version there, is an error naming it. --json prints the result as an array of { tech, from, to, stopApplying, startApplying, stillApplying } with card ids. It reads the card files, changes nothing, and works without the server running.

Knowledge gaps

gaps answers "what do agents ask that the store cannot answer?". It is built on opt-in local telemetry, which is off by default: with CARDLOOM_TELEMETRY unset the server never creates or writes the file.

$ CARDLOOM_TELEMETRY=local CARDLOOM_TELEMETRY_SAMPLES=1 npx cardloom-mcp   # in your agent's MCP config env
$ npx cardloom-mcp gaps
5 searches since 2026-11-20T09:12:00.000Z
  answered: 2
  related only: 1
  empty: 2

Questions with no direct answer
  how to rotate the signing key (2)
  retry budget for webhooks (1)

What is recorded, one JSON line per search_knowledge call: the time (UTC), the tool name, how many results came back, the outcome (answered: at least one direct match; related_only: only partial matches; empty: nothing), and the search time in milliseconds. That is all.

What is never recorded: card ids, results or their text, the context you pass, repo names. The search text is recorded only when CARDLOOM_TELEMETRY_SAMPLES is 1 or true, only for searches that were not answered, cut to 200 characters, and left out when the secret scan flags it. The scan catches common credential formats only, and its patterns are case-sensitive: a lower-case password: hunter2hunter2 line or a Slack-style xoxb-... token is not caught. It does not remove customer names or internal terms either, which is why the text is a second opt-in. Turn it on only if you are comfortable with questions typed by an agent being written to your disk.

Where the file lives: telemetry.jsonl next to the index (INDEX_DB_PATH's folder: ~/.cardloom with npx, the cardloom-metadata volume in Docker), or exactly where CARDLOOM_TELEMETRY_PATH points (an absolute file path; a relative value is ignored with a note on stderr). It is created with mode 0600 (owner read and write only). The server refuses to write it inside the knowledge store, which is a git repository you might git add -A: if the resolved path is the store or below it (symlinks are followed), nothing is created, one [telemetry] line goes to stderr per process, and searches are unaffected. That is what happens when INDEX_DB_PATH is unset (the index then sits in <store>/.metadata, as with npm start and npm run dev) and with the example .env, whose INDEX_DB_PATH is under the store; set INDEX_DB_PATH or CARDLOOM_TELEMETRY_PATH outside the store to record. Nothing in trust, flags or ranking reads the file. Lines older than 90 days are dropped, at most once per UTC day per server process. A failed write never changes a search response; it prints one [telemetry] line on stderr per process at most. benchmark never records, even with the switch on.

npx cardloom-mcp gaps (or npm run gaps) reads the file. With Docker the file is in the named volume, which the host cannot see, so npx cardloom-mcp gaps on the host says No telemetry yet; run docker compose run --rm cardloom-mcp npm run gaps instead. --json prints the report as JSON. It needs no index or store and creates nothing. When the resolved path is inside the knowledge store it says Telemetry is not recorded while the index is inside the knowledge store. Set INDEX_DB_PATH or CARDLOOM_TELEMETRY_PATH outside it. Without the file it says No telemetry yet. Set CARDLOOM_TELEMETRY=local to start recording. "Questions with no direct answer" lists the unanswered texts (lower-cased, whitespace collapsed, same text grouped) by count, at most 10; when no line carries text it says search text is not recorded and how to turn it on.

Ingesting an existing project

Documentation truncated — see the full README on GitHub.

Reviews

No reviews yet

Be the first to review this server!