Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ To measure any of this, `qmd bench <fixture.json> -c memories` is usable as ship

**Check what contradiction a change creates.** Both skills carry emphatic guidance that can overrule a softer new instruction. The audit's "in genuine doubt, prefer DROP" is the clearest example: a new rule saying "report this rather than dropping it" loses unless that guideline is carved out explicitly. After editing, read the new text alongside the sections that push the opposite way.

Six DROP categories are duplicated between the two skills with nothing keeping them in step. Change one side, check the other.
Six DROP categories are duplicated between the two skills with nothing keeping them in step, and so are capture's Staleness Prevention and the audit's C.5 Staleness Signals, and the `Pending:` convention (capture's Check 3 and **Update existing** list, the audit's Step 2, DROP category A, and C.5), and rewrite-in-place editing (capture's **Update existing**, the audit's Step 4). Change one side, check the other.
2 changes: 1 addition & 1 deletion SYNC-BLOCKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Locations:

```markdown
<!-- SYNC:applies-to -->
**The `Applies to:` field.** Place `**Applies to:**` on the line immediately after the `# Title` heading of every memory; it declares which project(s) the memory targets. Use the **git repo name** — the last path segment of `git remote get-url origin`, with `.git` stripped (e.g. `git@github.com:org/repo.git` → `repo`; `https://github.com/owner/my-app.git` → `my-app`). Fall back to the working directory's basename only when the repo has no remote configured. Use the repo name — not the directory basename — because folder names vary across clones while the repo name is stable. This is also why `Applies to:` may differ from the set of memories the search index actually covers, which is folder-based and set automatically by the indexing hook.
**The `Applies to:` field.** Place `**Applies to:**` on the line immediately after the `# Title` heading of every memory; it declares which project(s) the memory targets. Use the **git repo name** — the last path segment of `git remote get-url origin`, with `.git` stripped (e.g. `git@github.com:org/repo.git` → `repo`; `https://github.com/owner/my-app.git` → `my-app`). Fall back to the project directory's basename only when the repo has no remote configured or the project is not a git repo. Use the repo name — not the directory basename — because folder names vary across clones while the repo name is stable. This is also why `Applies to:` may differ from the set of memories the search index actually covers, which is folder-based and set automatically by the indexing hook.

When a memory genuinely applies to multiple projects, list them comma-separated (e.g. `**Applies to:** web-dashboard, ios-app, api-backend`); the content must stay true in every listed project. When a memory is only partially relevant to one listed project, split it into separate memories instead of mixing.
<!-- /SYNC -->
Expand Down
10 changes: 5 additions & 5 deletions hooks/memory-loop-activator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ If this starts a new sub-task or phase (tests, refactor, deploy, etc.)
If you hit an unexpected error or are about to debug/diagnose
→ search the KB FIRST, before reasoning from scratch.

If this session produced reusable knowledge worth preserving, invoke
Skill(continuous-learning) — the skill evaluates and routes the knowledge
to the correct destination. Do not ask permission.
If this session produced reusable knowledge, or showed a memory is wrong
or outdated, invoke Skill(continuous-learning) — it routes the change to
the correct destination. Do not ask permission.

NEVER write to .claude/memories/ directly. Always go through the skill
so the routing and quality gates run.
NEVER write to .claude/memories/ directly. Only the continuous-learning
and memory-audit skills write there, so the routing and quality gates run.
EOF
96 changes: 52 additions & 44 deletions skills/continuous-learning/SKILL.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions skills/continuous-learning/references/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Template structures for the continuous-learning skill. Load this when creating or updating memories. Capture Rules, `Applies to:` derivation, and Staleness rules live in [SKILL.md](../SKILL.md) — this file is templates only.

When a memory's claim holds only on an unmerged branch, add `**Pending:** <what must merge>` on the line after `Applies to:` (SKILL.md, Step 4 Check 3).

## Learning Memory Template

```markdown
Expand Down
69 changes: 42 additions & 27 deletions skills/memory-audit/SKILL.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/continuous-learning.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Before writing code, planning, or exploring — **always search the knowledge ba

Results carry a score of `1/rank`, not a confidence — a poor match still scores 1.00 at the top. If nothing fits, re-query with different terms; raising `limit` only appends a tail and never reorders the results above it.

2. **Retrieve before relying on a result** — a result carries a snippet, which is a lead, not evidence. Fetch what you intend to use with `mcp__memory-loop__multi_get` (or `get` for one document) and read it. Never quote, summarise, or act on a memory you have only seen as a snippet.
2. **Retrieve before relying on a result** — a result carries a snippet, which is a lead, not evidence. Fetch what you intend to use with `mcp__memory-loop__multi_get` (or `get` for one document) and read it. Never quote, summarise, or act on a memory you have only seen as a snippet. A memory describes the code when it was captured, possibly on another branch: where the code you read disagrees, the code wins — say so rather than following the memory, and correct it through continuous-learning.

```
mcp__memory-loop__get(file: "memories/foo.md") # or file: "#docid" from a query hit
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/hook-messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"additionalContext": "This project keeps a knowledge base of past learnings, decisions, and\ndebugging discoveries in .claude/memories/, searchable with\nmcp__memory-loop__query.\n\n- If your prompt contains a \"KB context:\" block, treat it as established\n ground truth. Verify it against the code, but do NOT search the KB and\n do NOT re-derive it.\n- Otherwise, if you are about to read or grep more than a couple of files,\n issue ONE mcp__memory-loop__query for the topic of your task first — a\n lex line of terms you expect verbatim plus a vec line phrased as a\n question, and an intent saying what you want and what to avoid, with\n rerank:false and limit:6. One search is far cheaper than a blind\n file sweep. Unlike the main thread, do not try keyword variations: if\n nothing relevant comes back, move on to the code.\n- Snippets are leads, not evidence — they are capped at 300 characters and\n often show only a title. mcp__memory-loop__get a document before relying\n on what it says.\n- Report back anything the KB got wrong or left out."
}
},
"activator": "MANDATORY MEMORY PROTOCOL\n\nIf this starts a new sub-task or phase (tests, refactor, deploy, etc.)\n→ search the KB via mcp__memory-loop__query for relevant patterns first.\n\nIf you hit an unexpected error or are about to debug/diagnose\n→ search the KB FIRST, before reasoning from scratch.\n\nIf this session produced reusable knowledge worth preserving, invoke\nSkill(continuous-learning) — the skill evaluates and routes the knowledge\nto the correct destination. Do not ask permission.\n\nNEVER write to .claude/memories/ directly. Always go through the skill\nso the routing and quality gates run.\n"
"activator": "MANDATORY MEMORY PROTOCOL\n\nIf this starts a new sub-task or phase (tests, refactor, deploy, etc.)\n→ search the KB via mcp__memory-loop__query for relevant patterns first.\n\nIf you hit an unexpected error or are about to debug/diagnose\n→ search the KB FIRST, before reasoning from scratch.\n\nIf this session produced reusable knowledge, or showed a memory is wrong\nor outdated, invoke Skill(continuous-learning) — it routes the change to\nthe correct destination. Do not ask permission.\n\nNEVER write to .claude/memories/ directly. Only the continuous-learning\nand memory-audit skills write there, so the routing and quality gates run.\n"
}