Skip to content
hsusulPublic

About

Local archive of your Claude Code and Codex sessions, plus reviewed long-term memory for coding agents and a doctor for their skill folders. Runs offline; no accounts.

Resources

Stars

107 stars

Watchers

0 watching

Forks

Repository files navigation

Lore

Lore

Long-term memory for your coding agents, learned from the corrections you already gave them.

Lore reads your Claude Code and Codex sessions after they end and keeps the rules and project facts you gave the agents as Markdown notes. Each note quotes what you said to the agent. Lore files notes without asking you to approve them, and you can see and undo every change. On each prompt it gives the agent the few notes that match what you asked, by keywords and by meaning. Notes stay on your machine in a git vault, which you can sync to a remote of your own.

Get started

Lore v2 is not in a release yet. Build it from the repository root with Git and Rust installed. Rustup selects the version in rust-toolchain.toml. The installer puts lore in your bin directory, with lorectl as an alias.

cargo build --release --locked -p lorectl &&
  sh scripts/install-cli.sh target/release/lorectl "$HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH"

Run lore install to connect the agents it finds. It creates the vault at ~/Lore if there is none and backs up each configuration file before changing it. Claude Code and Codex get hooks and MCP tools. Cursor, Gemini CLI, and OpenCode get the MCP tools. In Codex, open /hooks to approve the new hooks. Then run lore doctor to check the configuration and hook approvals.

Set LORE_VAULT_DIR to an absolute path to keep the vault somewhere else.

How it works

Learning

When a Claude Code or Codex session ends, a hook starts a background learner on its transcript. The learner sends your turns, the agent text around them, and the 20 existing notes closest to the session to your own agent: claude -p with Haiku by default, or codex exec with LORE_LEARN_PROVIDER=codex. LORE_LEARN_MODEL picks another model. The agent answers with notes to add, update, or retire.

Lore writes a change only when its receipt, a quote from you, appears word for word in one of your turns in that transcript. The quote is saved in the note, so the note keeps its source after the agent deletes the transcript. New notes are scoped to the repository they came from. The learner makes at most 20 calls a day unless LORE_LEARN_DAILY_LIMIT says otherwise.

Session start catches up on transcripts that ended without a hook, and lists what Lore learned since your last session, each with its undo command.

Recall

  • At session start, up to 10 notes for the repository and global notes.
  • On each prompt, up to 3 notes the session has not seen yet, ranked by BM25 and by embedding similarity from a small model built into the binary. A prompt like "yes" adds nothing.
  • Before an edit, notes anchored to the files being changed.

Anchored notes carry a freshness label: fresh, moved (the lines are unchanged but somewhere else), changed, gone, or unanchored.

Consolidation

Once a day, the session-start worker consolidates the vault. It merges notes that state the same rule and promotes a rule learned in two repositories to a global note. It rewrites a note that has collected several updates, and retires notes whose anchored files were deleted in a commit. Merges and rewrites use the same agent login as the learner, at most 3 calls a day by default (LORE_CONSOLIDATE_DAILY_LIMIT).

Enforce rules

A note can carry enforce rules that block a tool call breaking the rule:

enforce:
  - tool: bash
    pattern: '(?i)co-authored-by:\s*(claude|codex)'

tool is bash for a shell command, write for the lines a call adds to a file, or path for the path written. An optional unless regex exempts a call. A rule that does not parse blocks nothing, and its note is still recalled. lore mem enforce-check lists each rule with its matches among the last 30 days of tool calls.

Staying in control

Every change is a git commit in the vault, and .lore/log.jsonl records why it was made.

  • lore log lists what was learned, changed, and retired, and why.
  • lore undo NOTE_ID reverses the latest change to that note and stops Lore from learning it again from the same receipt.
  • An agent can do the same through the forget MCP tool when you ask it to.
  • lore pause stops learning and keeps recall. lore resume starts it again and skips the turns recorded during the pause.
  • You can edit or delete any note by hand, in an editor or in Obsidian.

Sync

lore sync --remote URL sets a git remote for the vault and syncs it. Use a private repository. After that, Lore pulls at session start and pushes after it learns. The index is rebuilt on each machine.

Commands

To do this Run
Connect installed agents lore install
Check agent configuration and hook approvals lore doctor
Check a native transcript's format lore doctor --file TRANSCRIPT
Show which hooks and MCP entries each agent has lore connect
Create or reuse the vault lore init
Learn from one finished transcript lore learn TRANSCRIPT
Catch up on missed sessions lore learn --catch-up
See learned changes and why lore log
Reverse a learned change lore undo NOTE_ID
Pause or resume learning lore pause, lore resume
Count learned changes and undos over a window lore report --since 30d
Sync the vault lore sync
Notes for the current repository lore mem recall
Rank notes by a query lore mem search QUERY
Print one note lore mem show NOTE
Add a note by hand lore mem add FILE
Rebuild the index from the vault files lore mem reindex
List enforce rules and their recent matches lore mem enforce-check
List skill folders, or report problems in them lore skills ls, lore skills doctor

lore --help lists every command, option, and exit code.

MCP tools

lore install registers lore mcp as an MCP server. The plugins in plugins/ register it too.

  • recall returns the notes for the directory the agent is working in, with freshness labels.
  • read_note returns one note in full.
  • remember saves a repository note with an exact quote from you in the current Claude Code or Codex session.
  • forget undoes a learned change by note ID or event key and suppresses its receipt.

Privacy

The vault stays on your machine unless you set a sync remote. Lore has no account, no telemetry, and no server. CI checks that the CLI and its crates depend on no networking crate and runs their tests with networking denied (scripts/egress-check.sh).

Text leaves your machine only through the agents you are signed in to:

  • The learner and consolidation send transcript excerpts and existing notes to the agent you configured, under your login. Claude Code sends them to Anthropic, Codex to OpenAI.
  • Notes that hooks and MCP tools return become part of the session, so they reach the agent's provider like any other context.

Lore masks text that matches its secret rules before returning a note through MCP. This lowers the risk but does not guarantee that no secret remains.

Benchmarks

On 12 synthetic closed-choice tasks, the answering model repeated a corrected decision 6 times with no project memory and 0 times with either a plain CLAUDE.md or Lore's hook output. Both memory conditions received the same active rules, so this measures whether an agent follows rules it is given, not whether Lore learns them. Method and trial collection

results=bench/repeat-mistakes/results/2026-12-01
scripts/bench-repeat-mistakes score "$results/plan.json" "$results/decisions.json"

A two-question LongMemEval-S pilot is in bench/longmemeval/results/2026-12-01-pilot. Full LongMemEval results are not yet published.

Migrate from v1

To bring a v1 vault forward, run migrate-v1 from the last release that includes it, v0.2.7. If an agent's configuration still starts Lore from inside Lore.app, python3 scripts/migrate-bundle-launcher.py CONFIG --binary /absolute/path/to/lorectl previews the change to the standalone binary for one file, and adding --apply --backup-dir DIR makes it.

Development

Point development runs at scratch directories with CLAUDE_CONFIG_DIR, CODEX_HOME, and LORE_VAULT_DIR, never at your real history.

crates/lore-transcripts/  native transcript formats and parsing
crates/lore-memory/       vault, notes, index, recall, freshness, enforce rules
crates/lore-skills/       skill inventory and doctor
crates/lorectl/           the CLI, hooks, learner, consolidation, and MCP server
crates/lore-replay/       session replays for evaluation; starts Claude Code or Codex

lore-replay sends sessions to a model provider under your login and is not covered by the no-network checks. CI runs cargo fmt, cargo clippy -D warnings, and cargo test for each package, plus scripts/egress-check.sh and scripts/toolchain-pin-check.sh.

License

Apache License 2.0

Lore is not affiliated with Anthropic or OpenAI.

About

Local archive of your Claude Code and Codex sessions, plus reviewed long-term memory for coding agents and a doctor for their skill folders. Runs offline; no accounts.

Resources

Stars

107 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages