/lorekit-memory:lorekit-groom [scope-hint]from lorekit-memory
Grooms a LoreKit memory store by deduplicating near-duplicate lessons, linting low-quality ones, setting TTL on time-bound lessons, and pruning or archiving obsolete entries. Always proposes a read-only plan before any mutation.
Ships in lorekit-memory. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Keep a shared memory store healthy as it grows.
A memory store that is never tended slowly rots: the same lesson gets written three times in slightly different words, a stub with an empty value sits next to a real one, a branch-specific gotcha outlives the branch by a year. Noise like that is not harmless — it drowns the signal every future read depends on, so the next agent scrolls past ten near-identical lines instead of acting on one clear one.
This skill runs a grooming pass over the lessons for a scope: survey → lint → dedupe & merge → set expiry → prune → verify. It is the maintenance counterpart to the other two LoreKit skills:
| Skill | Job |
|---|---|
lorekit-memory | Runtime: read scoped lessons on a task, write one on failure |
lorekit-setup | Authoring: wire a self-improvement loop into a host |
lorekit-groom | Maintenance: consolidate and clean an accumulated store |
Grooming edits a shared, persistent store — a lesson you merge or delete is gone for every agent on every machine, not just this session. So the entire pass is read-only until a human says otherwise:
Never batch-delete on a similarity score alone — the dedupe heuristic is a word-overlap guess, not a semantic judge (see the toolbox note below). It finds candidates for a human's eye, and merging is a judgement call about meaning.
If you are asked to "just clean it up" without oversight, still surface the plan once and get a single confirmation for the batch — that is the floor, not a step to skip.
Follow rules/grooming-pass.md for the full playbook. The short version is six phases; the first four are pure analysis.
lorekit stats (counts per scope + store) and
lorekit scopes (store-wide inventory: every scope with its lesson count)
show where the mass is. Pick the noisiest scope to start.lorekit lint --json flags structurally bad lessons (empty /
whitespace / suspiciously short / untrimmed values, empty keys, volatile
keys, malformed scopes). These are the cheapest wins: fix or drop them first.lorekit dedupe --json clusters near-duplicate lessons. Start at
a high --threshold (e.g. 0.85) for confident duplicates, then lower it to
surface looser paraphrases. Use lorekit show <scope::key> to read each
cluster member's full value before deciding.lorekit lint (should exit 0) and lorekit dedupe (no
clusters at your threshold) and lorekit stats (a lower count). Green means
the pass landed.Grooming spans two surfaces. Analysis is the CLI — its read commands
(lint, dedupe, stats, scopes, show, list, search, tree, diff)
survey the store far more richly than the MCP tools do, across both the offline
and remote stores at once. Mutation is the memory.* MCP tools — and
crucially, removal is MCP-only: there is no lorekit delete command, so
archiving and deleting always go through memory.delete / memory.archive.
| Job | How | Surface |
|---|---|---|
| Count lessons per scope/store | lorekit stats [--scope <s>] | CLI (read) |
| Inventory every scope + lesson count | lorekit scopes | CLI (read) |
| Find low-quality lessons | lorekit lint --json [--since <date>] [--until <date>] [--max <n>] | CLI (read) |
| Find near-duplicate clusters | lorekit dedupe --json [--threshold <n>] [--key-prefix <p>] [--since <date>] [--max <n>] | CLI (read) |
| List all lessons across large scopes | lorekit list --all [--max <n>] [--since <date>] [--until <date>] | CLI (read) |
| Read one lesson in full | lorekit show <scope::key> [--json] | CLI (read) |
| Compare offline vs remote | lorekit diff | CLI (read) |
| Write the merged/consolidated lesson | memory.write (or lorekit write) | MCP / CLI |
| Set / clear an expiry | memory.write { ttl_days } / { clear_ttl: true } | MCP / CLI (--ttl-days / --clear-ttl) |
| Archive a lesson (reversible) | memory.archive (or memory.delete) | MCP only |
| Hard-delete a lesson (permanent) | memory.delete { force: true } | MCP only |
When a scope holds more lessons than a single page (> 50 for list, > 100 for
lint/dedupe), use these flags to survey the full population or narrow it:
| Flag | Commands | Effect |
|---|---|---|
--all | list | Drain all pages (default for lint/dedupe) |
--max <n> | list --all, lint, dedupe | Hard cap on entries surveyed (default 5000) |
--since <iso-date> | list --all, lint, dedupe | Lower date bound (created_since) |
--until <iso-date> | list --all, lint, dedupe | Upper date bound (created_until) |
--key-prefix <p> | dedupe | Narrow deduplication to keys starting with prefix |
dedupe applies an internal population cap of 2000 for memory safety. When the
cap is reached, the output includes a warning with narrowing suggestions — use
--key-prefix or --since to reduce the population.
memory.list and memory.search now support pagination. When more results
exist than fit in one response, the response includes hasMore: true and a
nextCursor string. Pass nextCursor as the cursor argument on the next
call to retrieve the following page. Omit cursor to start from the first page.
{ "scope": "global", "limit": 100, "cursor": "<nextCursor from previous response>" }
Use this to drain an arbitrarily large scope in an agent loop rather than relying on a truncated first page.
dedupeis a heuristic, not a semantic judge. It clusters on Jaccard word-token overlap, so it can both miss reworded duplicates and group coincidental ones. Treat every cluster as a candidate to read and decide on, never as an instruction to merge.
If the
memory.*MCP tools are not connected, analysis still works (the CLI reads andlorekit write --ttl-dayssets expiries), but you cannot archive or delete. Say so once, complete everything you can, and hand the removal list to the human rather than silently skipping it.
Merging, expiry tiers, and the archive-vs-delete call each have real judgement in them — the details, with examples, live in references/merge-and-expiry.md. Read it before your first merge or TTL decision in a pass.
Lessons are partitioned by a canonical scope string (:: is the only separator):
global universal principles
project::{name} monorepo-wide
repo::{owner}/{repo} this repository's codebase
branch::{owner}/{repo}::{branch} short-lived, this branch only
Scope drives two grooming decisions: branch-scoped lessons are the prime candidates for expiry (a branch is short-lived, its lessons usually are too), and a merge lands in the narrowest scope that still covers all its members. Both are spelled out in the reference file.
Grooming uses the same install as the rest of LoreKit:
npx @lorekit/cli install
npx @lorekit/cli doctor
doctor confirms the store backend (remote, local, or off) and token
permission. Removal needs a token with write permission (lk_rw_* or
lk_wo_*); a read-only token can survey and propose but not apply. If a mutate
call fails with an authorization error, report it and stop — do not retry.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mthines/lorekit --plugin lorekit-memory4 skills in this plugin
/lorekit-memoryShared persistent memory for coding agents, backed by LoreKit's MCP server. Reads scoped lessons at the start of a task or when navigating into unfamiliar code (narrow-to-broad scope resolution across branch, repo, project, and global), and writes a lesson when something goes wrong — a stuck loop, a repeated command failure, a surprising gotcha, a near-miss, or a wrong assumption that cost time. Lessons are phrased as observations (never rigid rules), scoped to the narrowest namespace that fits, and deduplicated on write. Use at task start, before risky operations, and after any failure or retrospective. Triggers on "read lessons", "check memory", "what do we know about", "remember this", "save a lesson", "record this gotcha", "capture this lesson", "/lorekit-memory".
/lorekit-self-hostGuided runbook for deploying your OWN LoreKit backend instead of using the hosted service — full self-host (your Supabase project runs everything) or self-host + BYOD (memory rows live in a second Supabase project you control). Walks Supabase link → migrate → secrets → deploy-all-functions → dashboard/token → connect-your-agent → write/read round-trip, each step a gate: do the thing, verify it, stop and diagnose if the verification fails. Links out to docs/install.md and docs/byod.md rather than duplicating their commands. Slash-only — not installed by `lorekit install`. Its only memory call is Step 9's throwaway `self-host-test` write/read/delete round-trip. Use when deploying your own LoreKit instance, not for everyday read/write (see lorekit-memory) or store maintenance (see lorekit-groom). Triggers ONLY on explicit invocation: "/lorekit-self-host".
/lorekit-setupTurns a skill, workflow, agent, or CI job into one that gets better across runs and can PROVE it. Walks a six-step lifecycle — Find where a loop pays off, Wire it from a ready-made recipe card, Seed it so it delivers on run one, Prove it improved something, Maintain it so it does not rot, and Scale it to a team — with a 15-minute quickstart that ends in a loop firing once, live. Under the hood it is a LoreKit lessons loop: a fast episodic tier of advisory lessons read at the start of every run and written on failure; a slow procedural tier that promotes a recurring lesson into a permanent rule; and, for the rare judgement-free case, a third rung that compiles a lesson into a mechanically-checked CI invariant. Also covers the non-LLM case (durable JSON state records for a deterministic job) and the guards that stop a learning loop from reinforcing its own mistakes. Runtime reading and writing of lessons is the lorekit-memory skill; this is the authoring counterpart. Use when giving a host durable cross-run memory or wiring a lessons loop. Triggers on "set up memory for my skill", "add a self-improvement loop", "give my workflow memory", "make this learn from its mistakes", "where should I add a loop", "prove my loop is working", "self-improving memory", "memory in CI", "GitHub Actions state", "remember the last CI run", "/lorekit-setup".
Other plugins' skills for the same job