/lorekit-memory:lorekit-setup [host-name]from lorekit-memory
Wires a durable cross-run memory layer into skills, workflows, agents, or CI jobs so they learn from past runs and improve over time. Walks a six-step lifecycle from identifying payoff opportunities to proving improvement.
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.
Give a host durable cross-run memory, and make its improvement visible. For a model-driven host that means a self-improvement loop: it reads its own accumulated lessons at the start of every run and hardens the proven ones into permanent rules, so it gets better the more it runs. For a deterministic host — a CI job — it means state records: it reads what was true at the end of its last run instead of rediscovering it.
This is the authoring counterpart to lorekit-memory. lorekit-memory does the
runtime read/write of individual lessons; lorekit-setup wires the durable memory
that calls those primitives on a host's behalf. Both run on the same LoreKit store —
over the memory.* MCP tools for agents, over the lorekit CLI or REST for jobs.
A loop that nobody can see helping is indistinguishable from no loop. This skill treats "the host measurably got better" as the deliverable — not "a loop is wired." Every step below is judged against that.
A working loop is six steps. Do them in order; each links to the rule that covers it.
| # | Step | What it answers | Read |
|---|---|---|---|
| 1 | Find | Where does a loop actually pay off? (Do not guess — the data already knows.) | rules/self-improvement-loops.md § Find where a loop pays off |
| 2 | Wire | Add the read/write steps with the least effort — copy a recipe card. | templates/ + rules/self-improvement-loops.md |
| 3 | Seed | Deliver value on run one, before any lesson has been earned. | rules/cold-start-seeding.md |
| 4 | Prove | Show the loop reduced a real failure — not just that lessons exist. | rules/proving-improvement.md |
| 5 | Maintain | Keep it firing, keep the bucket clean, roll back a bad lesson. | rules/loop-health.md |
| 6 | Scale | Turn one person's loop into a team practice that compounds. | rules/team-and-portfolio.md |
If invoked with a host-name, set up memory for that host and walk this lifecycle.
Otherwise ask which skill / workflow / agent / job it is for, pick the shape from
Pick the shape, then walk it.
The shortest path from "I have a host" to "I watched the loop close." Do it against a
real host with memory.* connected.
Name the bucket. From the host's name <host>: tag loop::<host>-lessons,
key namespace <host>-lessons::<slug>. One bucket per host.
Copy a recipe card. Pick the archetype in templates/ that matches your host (code-changing agent, reviewer/reconcile host, multi-step orchestrator, CI job) and paste its read step at the host's start and its write step at the host's existing failure points. The card already carries the injection cap, the TTL, and the entrenchment defaults — do not hand-roll them.
Seed one real lesson (optional but recommended) so run one is not empty — rules/cold-start-seeding.md. Keep it to a handful, hand-checked.
Fire it once, on purpose. Trigger the failure the loop is meant to catch. Confirm a lesson was written to the right scope with the right tag:
memory.list { scope: "<the scope you expect>", tags: ["loop::<host>-lessons"], limit: 10 }
Run again and watch it read back. Start a second run over the same situation. Confirm the lesson surfaces in the read step and biases the run. That is the loop closing — the whole point, demonstrated once.
Write down the success metric you will use to prove it keeps helping — rules/proving-improvement.md. The required one is the immunity re-challenge: after you promote a lesson to a rule, the failure signature should stop recurring.
That is a live, working loop. Everything below is depth on each step.
Two kinds of host want memory, and they want a different record. Decide which first:
| The host is… | Wants | Read |
|---|---|---|
| A model-driven skill, agent, or workflow that fails in recurring, classifiable ways | Prose lessons — advisory, recurrence-gated, promotable into rules | rules/self-improvement-loops.md |
| A deterministic job — a GitHub Actions workflow, a cron script, a release pipeline — that needs last-run state | JSON state records — authoritative, parsed, one key per fact | rules/ci-state-records.md |
| A recurring lesson whose failure mode is judgement-free and checkable against an independent source of truth | A compiled invariant — a declarative entry a CI gate enforces mechanically, never advisory once gating | rules/compiled-invariants.md |
A host can want both, in separate buckets: the state record carries what is true right now, the lesson carries what we learned about it.
The runtime loop is two tiers, fast and slow; a third, rarer rung sits past promotion.
| Rung | Mechanism | Changes behavior? | Advisory or enforced? |
|---|---|---|---|
| Fast (episodic) | LoreKit lessons in a per-host bucket, read at the start of a run, written on failure | No — advisory input only | Advisory |
| Slow (procedural) | A human-reviewed edit that hardens a recurring lesson into a host rule | Yes | Advisory (works only if the next reader notices it) |
| Compiled invariant | A declarative obligations-map.mjs entry a CI gate checks against a changed-file set — see rules/compiled-invariants.md | Yes | Enforced once gating; most lessons never qualify |
A recurrence gate connects the first two: a lesson that recurs (seen_count >= 3) or
carries the status::structural tag becomes promotion-eligible. Entrenchment guards
keep the fast tier from reinforcing its own wrong conclusions.
Five co-requirements make the difference between a loop that helps and one that quietly rots or crowds out the run it was meant to help. Every recipe card bakes them in; if you wire by hand, wire these too:
key=value header. Every fact the store already
models goes in its own field, never restated in prose — see
the body contract below.ttl_days on the write, refreshed on recurrence, so a
stale belief decays instead of entrenching. Decay is automatic, never staffed.The value is markdown a person reads, and it carries no hidden payload. Every
fact the store already models goes in its own write field:
| Fact | Field, not prose |
|---|---|
| Recurrence | seen_count — the store increments it on every overwrite |
| Expiry | ttl_days (clear_ttl to make permanent) |
Status (structural / promoted) | a status::<value> tag |
| Owning host, bucket kind | host, kind |
| Repo / branch / commit / PR | the origin_* fields |
| What triggered the write | trigger |
A hidden block does not just look untidy — it is wrong. A seen_count=1 baked into
prose is stale the first time the lesson recurs, while the column that governs
promotion moves without it; an HTML comment renders to nothing, so a human is shown a
lesson that begins mid-sentence. The full shape, the field-by-field rationale, and the
writing rules are the lesson record.
This contract is now checkable — lorekit lint flags a body that violates it, and the
lorekit-groom skill cleans legacy offenders.
A per-host lessons bucket is private to one host. There is also one shared bucket
every code-touching host reads and, under a contract, writes: codebase-knowledge —
a repo-scoped, structurally-keyed record (knowledge::<symbol>@<path> facts,
hotspot::<path> counters) of what the codebase has taught every LoreKit loop that
touched it. Because the name is fixed and the key is structural, a loop wired by one
person compounds with a loop wired by another. The full specification is
rules/self-improvement-loops.md § Shared codebase-knowledge.
A lessons loop's runtime tier needs LoreKit's memory.* tools connected; if they are
not, the host's loop is a silent no-op (the slow tier — a normal source edit — still
works). A CI job needs a lk_* token in its environment instead, and degrades to its
first-run path when the store is unreachable. Designing either needs no connection.
rules/ci-state-records.md (opens in a new tab)rules/cold-start-seeding.md (opens in a new tab)rules/compiled-invariants.md (opens in a new tab)rules/loop-health.md (opens in a new tab)rules/proving-improvement.md (opens in a new tab)rules/self-improvement-loops.md (opens in a new tab)rules/team-and-portfolio.md (opens in a new tab)templates/README.md (opens in a new tab)templates/ci-job.md (opens in a new tab)templates/code-changing-agent.md (opens in a new tab)templates/multi-step-orchestrator.md (opens in a new tab)templates/reviewer-reconcile-host.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mthines/lorekit --plugin lorekit-memory4 skills in this plugin
/lorekit-groomGrooms and maintains an accumulated LoreKit memory store — the cleanup counterpart to lorekit-memory (which reads and records single lessons). It finds and merges near-duplicate lessons, lints out low-quality ones, sets expiry (TTL) on time-bound lessons, and prunes or archives obsolete ones, ALWAYS analysing read-only and proposing a plan before any change (nothing is deleted or merged without confirmation, and archive is preferred over hard-delete). Reach for this whenever a lesson/memory store has grown noisy, large, or stale and needs tidying — not for reading or writing one lesson. Triggers on "groom my memories", "clean up my lessons", "dedupe the memory store", "merge duplicate lessons", "too many memories", "my lorekit is a mess", "consolidate lessons", "add expiry dates to old lessons", "prune stale branch lessons", "lint my memories", "/lorekit-groom".
/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".
Other plugins' skills for the same job