Everything to install, run, and self-host Lore.
Lore is decision memory for engineering teams. It captures the why behind technical decisions — from merged pull requests and commit messages — and lets anyone recall it in plain English, with a citation to the source.
One backend (the engine) does the thinking; thin clients talk to it: a VS Code extension,
a terminal CLI, and a GitHub App. Ask /lore <question> and get a cited answer.
The backend is a real multi-tenant FastAPI service, not a single-user script: a Postgres control plane (tenants, hashed API keys, an async job queue, webhook delivery dedup), retrieval that's cross-encoder reranked before an LLM composes the answer, and a regression harness that checks answer quality on every change. See Architecture.
| Term | Meaning |
|---|---|
| a Why | One captured decision + its reasoning (the atomic unit) |
| the Canon | A team/repo's body of Whys |
| Provenance | The sources a Why is grounded in (PRs, commits) |
| the Scribe | The npm git-hook that captures commits |
| inscribe / recall | Write to / read from the Canon |
Point any client at a running backend, then ask. Check it's alive:
GET /health
→ {"ok":true,"mode":"live","canon_store":"pgvector","auth":"multi-tenant", ...}
docker compose up), and goes live with a Groq API key.A /lore side-panel in your editor, plus a right-click "Why is this here?" on any code selection.
git clone https://github.com/lorehasit/lore-vscode-extension
cd lore-vscode-extension && npm install && npx vsce package
code --install-extension lore-*.vsix
Then reload VS Code. Set the backend URL in Settings → lore.backendUrl, and
lore.apiKey if the backend is multi-tenant (sent as X-Lore-Key).
/lore box.Lore: live / mock / offline.npm install --save-dev lore
npx lore init # installs the post-commit hook + writes .lore.json
Run lore with no arguments for a full-screen prompt (banner + /lore REPL). Quit with /quit.
lore # interactive prompt
lore recall "why postgres?" # one-off question
lore canon # list the Canon
Configure the backend via ~/.lore.json (global) or a per-repo .lore.json
(written by lore init), --url, or LORE_BACKEND_URL. An API
key for a multi-tenant backend goes in lore init --key, .lore.json, or
LORE_API_KEY — sent as X-Lore-Key.
{ "backendUrl": "https://your-backend", "apiKey": "lk_...", "canon": "my-repo" }
Capture the why of a commit automatically. Install into any repo:
npm install --save-dev lore
npx lore init --url https://your-backend --canon my-repo
Then add a Why: line to a commit — the Scribe inscribes it. Commits without a
Why: are ignored, keeping the Canon high-signal.
git commit -m "feat(auth): short-lived JWTs" \
-m "Why: Redis failover logged everyone out; stateless tokens remove that SPOF."
Install once; every merged pull request is captured automatically — no developer effort.
https://your-backend/webhook/githubGITHUB_WEBHOOK_SECRET.GITHUB_APP_ID / GITHUB_APP_PRIVATE_KEY on the backend so it can mint installation tokens for backfill and PR comments.BACKFILL_DAYS) through the job queue — no manual re-index step.cp .env.example .env # works as-is in mock mode — no keys required
docker compose up # Postgres + API + background worker, one command
curl localhost:8000/health
Add GROQ_API_KEY to .env and restart to go live (real retrieval,
real GitHub ingestion). DATABASE_URL is always required — the control plane
(tenants, hashed API keys, the job queue, webhook dedup) lives in Postgres regardless of mode.
| Variable | Purpose |
|---|---|
DATABASE_URL | Postgres — required always (control plane) |
GROQ_API_KEY / GROQ_MODEL | LLM (empty = mock mode) |
EMBEDDER_MODEL / EMBEDDER_DIMS | local embeddings (fastembed) |
VECTOR_STORE | qdrant (local file) or pgvector (same Postgres) |
RERANK_ENABLED / RERANK_MODEL | cross-encoder reranking of retrieval candidates |
GITHUB_APP_ID / GITHUB_APP_PRIVATE_KEY / GITHUB_WEBHOOK_SECRET | GitHub App auth + webhook verification |
LORE_API_KEYS / LORE_ADMIN_SECRET | multi-tenant auth (env fallback) and key management |
For a shared team brain, set VECTOR_STORE=pgvector — one Postgres, one backup,
for both the control plane and the Canon.
The backend ships as a single Docker image (Dockerfile), with
docker-compose.yml as the reference topology: API + background worker + Postgres.
Deploy that image to any container platform (Fly, Render, ECS, Cloud Run, ...) with a managed
Postgres for DATABASE_URL — nothing in the app assumes a specific host.
Run the worker (python -m app.jobs.worker) as its own process/service — it's
what drains the job queue (backfills, retries) independently of request traffic.
Then point clients at the public URL: extension lore.backendUrl, CLI
--url / LORE_BACKEND_URL, GitHub App webhook URL.
| Endpoint | Does |
|---|---|
GET /health | mode, Canon store, auth mode |
GET /metrics | Prometheus-format request/latency counters |
POST /v1/why | recall — reranked, composed, cited answer |
POST /v1/lore | free search across the Canon (no LLM composition) |
GET /v1/canon · /v1/memories | everything in the Canon, cursor-paginated |
POST /v1/inscribe | the Scribe inscribes a commit's Why (idempotent) |
POST /v1/ingest/seed | load the demo seed corpus |
GET /v1/backfill/status · POST /v1/backfill/run | installation backfill progress / manual trigger |
POST /v1/keys · DELETE /v1/keys/{id} | issue / revoke tenant API keys (admin-secret gated) |
POST /webhook/github | GitHub App webhook (auto-capture, signature-verified) |
curl -X POST https://your-backend/v1/why \
-H "Content-Type: application/json" \
-H "X-Lore-Key: lk_..." \
-d '{"question":"why is auth stateless?"}'
GitHub App / CLI / VS Code → Backend (FastAPI) → mem0
├─ Groq (LLM)
├─ fastembed (embeddings + cross-encoder rerank)
└─ Qdrant / pgvector (vector store)
Capture: a merged PR (via the GitHub App webhook) or a Why:
commit (via the Scribe) is distilled into the Canon. New installs queue an automatic backfill
of recent history through a Postgres-backed job queue (SELECT ... FOR UPDATE SKIP
LOCKED) instead of blocking the webhook response.
Recall: a question runs dense vector search over the Canon, widened to a candidate shortlist and rescored by a cross-encoder before an LLM composes a cited answer — catching exact-term matches (a PR number, a ticket ID) that vector similarity alone loses to paraphrases.
Multi-tenant by default: a Postgres control plane holds tenants, hashed API keys, job state, and webhook-delivery dedup — independent of which vector store backs any given tenant's Canon. Every outbound GitHub API call goes through a retry-with-backoff and circuit-breaker layer, so one flaky installation can't take down another tenant's ingestion.
Evaluated: a golden-question regression harness runs the same
/v1/why path and checks citation correctness and answer relevance, so retrieval or
reranking changes are validated against a quality floor before they ship — not just eyeballed.