/lorekit-memory:lorekit-self-host [full|byod]from lorekit-memory
Guided runbook for deploying your own LoreKit backend via Supabase. Walks through full self-host or self-host + BYOD setup with verification gates at each step. Slash-only, not auto-activated.
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, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A guided runbook for running your own LoreKit backend. Every step below is a gate: do the thing, verify it, and stop and diagnose before moving on if the verification fails. This skill links to the canonical docs instead of copying their commands, so it never drifts from them:
Never echo a token, API key, or service-role key value in any command output you show the user — redact it, or reference the env var name only.
| Setup | What you run | Memory rows live in | Dashboard/REST/hooks see them? |
|---|---|---|---|
| Hosted (default) | Nothing — use lorekit.io | LoreKit's hosted project | Yes |
| Full self-host | Your own Supabase project, all 8 Edge Functions | Your project's own DB | Yes |
| Self-host + BYOD | Your function project plus a second Supabase project for storage | The second (storage) project's DB | No — the dashboard, REST API, remote CLI commands, and hooks all read the function project's own DB, never the BYOD storage project |
If the user only wants the hosted service, stop here and point them at
npx @lorekit/cli install — nothing below applies.
Recommendation: choose full self-host unless your memory rows must live in
a separate database (data residency, an existing Supabase subscription you
want billed separately, or org policy). BYOD is full self-host plus a
second storage project layered on top — the hosted endpoint has no BYOD, and
BYOD is never a substitute for deploying your own function project; it only
changes where rows are written. State this trade-off to the user before
proceeding so they pick the right branch of this runbook (full or byod —
matches this skill's argument hint).
Follow docs/install.md § Prerequisites: Node ≥ 18, pnpm, the Supabase CLI, Git, and a Supabase project (create one at https://supabase.com if you don't have one yet).
Verify: node -v, pnpm -v, supabase -v, git --version all print a
version. On failure: install the missing tool per the Prerequisites table
before continuing.
Follow docs/install.md § Step 2:
supabase link --project-ref <your-project-ref>, then write
SUPABASE_PROJECT_REF=<your-project-ref> into .env.local.
Verify: supabase projects list shows your project, and the link command
exits 0. On failure: re-check the project ref (the subdomain of your
Supabase project URL) and that you're logged in (supabase login).
Follow docs/install.md § Step 3:
pnpm nx db:push supabase.
Verify: the command exits 0 and supabase migration list shows no
pending migrations. On failure: read the migration error — a partially
applied migration usually needs a manual fix before re-running db:push.
Follow docs/install.md § Step 5.
Required: SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY.
Optional: ALLOWED_ORIGINS (only if you deploy your own dashboard on a
non-lorekit.io domain — otherwise its REST calls are CORS-blocked), and the
Dash0/OTel variables (telemetry only, safe to skip).
Verify: supabase secrets list --project-ref <your-project-ref> lists
the three required names (never print their values). On failure: re-run
supabase secrets set with the correct project ref.
The project ships 8 Edge Functions (mcp, health, memories, orgs,
openapi, blog, profiling, groom-sweep). pnpm nx fn:deploy supabase
only deploys mcp + health — that leaves the memories function (used by
hooks, the remote CLI commands, and the dashboard's REST API) undeployed.
Deploy every function instead:
supabase functions deploy --no-verify-jwt --project-ref <your-project-ref>
Verify, in order:
curl https://<your-project-ref>.supabase.co/functions/v1/health
must return HTTP 200 with "status":"ok" and "db":"ok". A 503 with
"status":"degraded" and "db":"error" means the function can't reach the
DB — recheck the secrets from Step 4.memories deployed: curl -s -o /dev/null -w '%{http_code}' https://<your-project-ref>.supabase.co/functions/v1/memories
must return 401 (deployed, auth required). A 404 means the function
wasn't deployed — re-run the deploy command above; it deploys every
function found under supabase/functions/.On failure: check supabase functions list --project-ref <your-project-ref>
for which functions actually deployed, and re-run the command.
Skip this step for full self-host.
Create a second Supabase project for storage (or reuse an existing one).
Apply the LoreKit schema to it by following
docs/byod.md § Apply the LoreKit schema —
this runbook does not duplicate those commands since they vary by
revision; follow what that doc (and lorekit bootstrap itself) prints.
Set LOREKIT_STORAGE_URL, LOREKIT_STORAGE_ANON_KEY, AND
LOREKIT_STORAGE_SERVICE_KEY as Edge Function secrets on the function
project (supabase secrets set ... --project-ref <your-function-project-ref>)
— NOT in .mcp.json. An older docs/byod.md revision may say to put
these in .mcp.json; that env never reaches the edge function, only your
local MCP client process, so it has no effect on a deployed function.
lorekit bootstrap and lorekit doctor read LOREKIT_STORAGE_* from
your local shell, not from the Edge Function secrets set in 6.3 — so
pass them inline, matching docs/byod.md:
LOREKIT_STORAGE_URL=https://<storage-ref>.supabase.co \
LOREKIT_STORAGE_SERVICE_KEY=<storage-service-role-key> \
lorekit bootstrap
LOREKIT_STORAGE_URL=https://<storage-ref>.supabase.co \
LOREKIT_STORAGE_ANON_KEY=<storage-anon-key> \
lorekit doctor
Without those vars in the shell, doctor silently skips the BYOD check.
Caveat — repeat this to the user: the dashboard, REST API, remote CLI
commands, and hooks all read the function project's own DB. They do
not see rows written to the BYOD storage project. There is no dashboard
view into BYOD data — it is intentionally invisible to everything except the
memory.* MCP tools and the lorekit CLI talking directly to that endpoint.
Verify: the inline-env lorekit doctor run from 6.4 prints a passing
byod storage line. No byod storage line at all means the check was
skipped — the vars weren't set in that shell; re-run with them inline.
On failure: check the storage URL/anon key you passed, that the schema
from Step 6.2 applied cleanly, and that all three secrets are set on the
function project (not the storage project).
A token must be minted on a dashboard connected to your project — a token
minted on lorekit.io only authenticates the hosted project and will not work
against your self-hosted deployment.
Either:
NEXT_PUBLIC_SUPABASE_URL and
NEXT_PUBLIC_SUPABASE_ANON_KEY in packages/web/.env.local to your
project's values, add http://localhost:4200/api/auth/callback to
Supabase → Auth → URL Configuration → Redirect URLs, then pnpm nx serve web
(it listens on port 4200).Then, in that dashboard: Lore Explorer → Step 2: Connect your agent →
Generate new token. Choose Read + Write (lk_rw_), Read only (lk_ro_), or
Write only (lk_wo_). Copy it — it is shown once.
Verify: the token modal shows a token in the format lk_rw_<32 chars> (or
lk_ro_/lk_wo_). On failure: confirm the dashboard's Supabase env vars
point at your project, not the hosted one.
npx @lorekit/cli install --endpoint https://<your-project-ref>.supabase.co/functions/v1/mcp --token <your-token>
(or export LOREKIT_MCP_URL=https://<your-project-ref>.supabase.co/functions/v1/mcp
and LOREKIT_TOKEN instead of passing --endpoint/--token each time).
Warning: almost every lorekit install rewrites the MCP entry — a new
project, a global install, --force, --hooks, --mcp-json,
--completions <shell>, or a re-run
after an upgrade adds a skill. Without --endpoint (and with neither
LOREKIT_MCP_URL nor LOREKIT_ENDPOINT set) it writes the hosted URL
hardcoded in install.mjs. Only a plain re-run on a fully installed project
leaves .mcp.json alone. Always pass --endpoint, or export
LOREKIT_MCP_URL in your shell profile, on every install.
Verify: npx @lorekit/cli doctor shows your endpoint, reports
connectivity + authentication passing, and the endpoint line itself reads
PASS — not WARN. doctor's endpoint check judges the URL's shape
directly now (the connectivity/authentication checks above it go over
REST, a transport that is suffix-agnostic, which is exactly the trap this
check closes): a WARN there names which config source produced the
endpoint and the fix command to re-run, so follow that line rather than
re-deriving it by hand. Step 9 remains the real MCP check. On failure:
follow the WARN line's fix and confirm the token matches the permission
tier the connection needs. The required suffix depends on the host: a
*.supabase.co endpoint must end in /functions/v1/mcp; a custom domain or
reverse proxy only needs the path to end in /mcp.
Write a global test lesson, read it back, then delete it:
memory.write { scope: "global", key: "self-host-test", value: "It works." }
memory.read { scope: "global", key: "self-host-test" }
memory.delete { scope: "global", key: "self-host-test" }
memory.delete archives the lesson ("archived":true); a later
memory.read returns null.
Verify: the read returns the value you wrote. For BYOD, also confirm
the row landed in the storage project's memories table — not the
function project's — since that is the whole point of the BYOD layering.
On failure: re-check Step 8's endpoint/token, and for BYOD, re-check Step
6's secrets.
lorekit.io-minted token works against it.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
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-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