LoreKitLoreKit docs

Offline storage

Store lore locally on your machine using the LoreKit CLI — no account, no network, full privacy. Memories live in a plain directory you own and control.

Tip:

Offline storage is the fastest way to start. You can move to remote storage later by adding a LOREKIT_MCP_URL and LOREKIT_TOKEN — the CLI then reads both stores, showing each in its own Offline and Remote section — and bring everything you learned along with npx @lorekit/cli migrate --from ~/.lorekit --to remote, which previews the plan before you add --yes.

Install the CLI

npx @lorekit/cli install

This scaffolds the lorekit-memory, lorekit-setup, and lorekit-groom skills and an MCP server entry into your .claude/ (project) or ~/.claude/ (global) directory, then asks whether to wire the lifecycle hooks.

The MCP entry it writes points at the hosted server. For an offline-only setup, replace it with the CLI's local stdio server (Step 3) — leave the token prompt blank, since local mode needs none.

The hooks inject context into your agent — they never write memory themselves. Pick all (inject lessons at session start and the ones matching each substantive prompt as you go, nudge on a tool failure and at end of turn), read-only (inject lessons at session start only, never nudge), or none. Choose non-interactively with --hooks:

npx @lorekit/cli install --hooks read-only

To skip hook injection entirely (if you manage hooks separately):

npx @lorekit/cli install --no-hooks

Verify the local store

npx @lorekit/cli doctor

This checks connectivity, token permissions, and scope health, and names the resolved mode plus the config source that decided it. In offline-only mode it confirms that the local MCP server is reachable and the store directory is writable. If it reports remote here, that is the built-in default and expected until you pin the mode in Step 6.

Write your first memory

npx @lorekit/cli mcp

This starts the local stdio MCP server. Point your agent at it instead of the hosted endpoint. This is half of an offline setup — it decides which server your agent talks to; Step 6 decides which store that server resolves, and you need both. install merges its lorekit entry into .mcp.json alongside any other servers you have, so edit that entry only rather than replacing the file:

// .mcp.json → mcpServers — the local store, no endpoint and no token.
// Edit this entry in place; your other servers stay as they are.
"lorekit": { "command": "npx", "args": ["-y", "@lorekit/cli", "mcp"] }

Your agent can then call memory.write to store a memory:

memory.write {
  scope: "global",
  key:   "my-first-lesson",
  value: "Always run the unit tests before committing."
}

Memories are stored as plain files under .lorekit/ in your home directory.

List your memories

npx @lorekit/cli list

Shows all memories in the applicable scopes (project → branch → repo → global), split into an Offline section (local files) and a Remote section (hosted, if configured).

Filter to a specific scope:

npx @lorekit/cli list --scope global

Search your memories

npx @lorekit/cli search "commit"

Matches a literal, case-insensitive substring against the memory key or value. Works across all applicable scopes. Add --scope to narrow the search.

Pin the mode with a project config file

This is what makes the setup offline. The built-in default mode is remote, so until something selects local, the CLI, the hooks and lorekit mcp all resolve to the hosted path — the local MCP entry from Step 3 included. Drop a .lorekit.json at the repo root to set the repo's default to local, with no per-machine env var:

// .lorekit.json  (safe to commit)
{
  "mode": "local"
}

The same file also controls the local store path and deny constraints:

{
  "mode": "local",
  "store": ".lorekit",      // path to the project-tier store (default: .lorekit)
  "deny": ["remote"]        // prevent remote mode in this repo (e.g. for air-gapped CI)
}

The two keys differ in force. Repo mode is only a default: a teammate whose ~/.lorekit/config.json sets its own mode overrides it, because precedence runs env var → user config → repo config → the built-in default. deny: ["remote"] is the team-wide guarantee — a deny can't be lifted by any personal config or env var, so it's what actually keeps an air-gapped repo offline for everyone, not the mode line alone.

A user-level version of the same file lives at ~/.lorekit/config.json and applies across all repos. User-level deny constraints are a ceiling the repo config can never lift — a user who sets "deny": ["remote"] is always offline, regardless of the repo default.

Tip:

Run npx @lorekit/cli doctor to see the resolved mode and which config source decided it. The output names the exact file or env var that won.

Note:

Next steps: once you have offline lore working, you can add the remote hosted store for cross-machine access — and push the lessons you already accumulated up to it with one migrate command. See the Remote storage tutorial to continue.