LoreKitLoreKit docs

Claude Code on the web

Set up LoreKit in Claude Code's cloud web environment. Each session runs in a fresh, ephemeral container, so either commit a project .mcp.json (auth via the LOREKIT_TOKEN environment variable) or install LoreKit globally from a setup script — the token always lives in LOREKIT_TOKEN, never in the repo.

Note:

Claude Code on the web runs every session in a fresh, ephemeral cloud container: the repository is re-cloned on start and disk writes don't survive. So keep remote mode (the default, so lore persists across sessions) and keep your token in the LOREKIT_TOKEN environment variable. Then choose how the container finds LoreKit: install it from the environment's setup script (below), or commit a project .mcp.json the clone reads directly (Step 3's --mcp-json). Either way the token stays out of the repo — it always comes from LOREKIT_TOKEN.

Generate a read-write API token

Go to Settings → API keys, click Generate new token, and choose the read + write tier (lk_rw_…). Copy it — the token is shown once only.

Add the token to your environment

In your environment's configuration, set the token as an environment variable (see the environment docs for where these live):

LOREKIT_TOKEN=lk_rw_<your-token>

This is the only secret, and it stays out of version control by living in the environment configuration.

Install LoreKit from the setup script

Add these two lines to the environment's setup script. It runs before each session starts, and the container caches the result, so the cost is paid once:

npm install -g @lorekit/cli
lorekit install --global --hooks all
  • npm install -g puts lorekit on PATH, so the hooks it wires call the fast lorekit binary directly instead of npx on every hook event.
  • lorekit install --global writes the skills, the MCP server entry, and the hooks into the container's home directory (~/.claude, ~/.claude.json) — resolving the endpoint (hosted by default) and the token (from LOREKIT_TOKEN) automatically — so the cloned repo is never touched.
  • --hooks all injects prior lore at session start and nudges on failures. Use --hooks read-only or --hooks none to change that — see Offline storage.
Tip:

Want the MCP tools available straight from the clone — no setup script? Add --mcp-json and LoreKit also writes a project-root .mcp.json that Claude Code on the web reads directly after cloning:

lorekit install --global --mcp-json --hooks all

It authenticates via a ${LOREKIT_TOKEN} reference (an mcp-remote --header), not an embedded token, so the file is safe to commit.

You must actually commit it — and .mcp.json is usually git-ignored. The default install writes a live token into .mcp.json, which is why LoreKit's own .gitignore (and many projects) ignore it. The --mcp-json form holds no secret, so un-ignore it before committing — remove the .mcp.json line from .gitignore (or negate it with !.mcp.json), or track it once with git add -f .mcp.json. The install command warns you when the file it just wrote is still git-ignored, so you don't discover it missing from a fresh clone later.

Warning:

Once .mcp.json is tracked, only ever run install with --mcp-json in this repo. A plain lorekit install --project embeds a live token in that same file — now committed — and leaks it. --mcp-json keeps the file secret-free.

Once committed, keep LOREKIT_TOKEN set as an environment secret (Step 2) and the mcp__lorekit__* tools load from the file in every session, even before the setup script runs. Run the install locally if you prefer to commit the config from your own machine rather than generate it in the container. The setup script's npm install -g @lorekit/cli is still what gives the container the lorekit binary, skills, and hooks; --mcp-json covers the MCP server entry.

Tip:

If your environment uses a restricted network policy, allow pqokxlhvnosogizsjztg.supabase.co (the MCP endpoint) and registry.npmjs.org (npm). A policy that already permits general HTTPS and npm needs no change.

Note:

The MCP tools and hooks take effect in new sessions. Because the setup script runs before the session opens, they are ready when it starts. If you instead run the install from a terminal in an already-running session, start a fresh session to pick up the mcp__lorekit__* tools — the lorekit CLI itself works immediately.

Verify

From a session terminal, run doctor — it must end with 0 failed, a resolved endpoint, and authentication — token accepted:

lorekit doctor

Then confirm real data flows, not just that the endpoint is reachable:

lorekit stats

The Remote section should show your memory counts (or an empty list for a new account) — not unavailable.

Tip:

A WARN .mcp.json — no lorekit server entry after a plain global install is expected and harmless: the global install wires the server into ~/.claude.json, so there is deliberately no project-level .mcp.json. If you used --mcp-json, that warning disappears — there is now a committed .mcp.json with the server entry.

Note:

Next steps: share memories across your whole team by setting up an organization. See the Team sharing tutorial.