Skip to content
Lore← Back to site
Start
OverviewLexiconQuick start
Surfaces
VS Code extensionTerminal (CLI)The ScribeGitHub App
Backend
Self-hosting the backendDeployingAPI referenceArchitecture

Documentation

Everything to install, run, and self-host Lore.

Overview

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.

Lexicon

TermMeaning
a WhyOne captured decision + its reasoning (the atomic unit)
the CanonA team/repo's body of Whys
ProvenanceThe sources a Why is grounded in (PRs, commits)
the ScribeThe npm git-hook that captures commits
inscribe / recallWrite to / read from the Canon

Quick start

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", ...}
No backend yet? See Self-hosting. It runs locally with zero keys in "mock" mode (docker compose up), and goes live with a Groq API key.

VS Code extension

A /lore side-panel in your editor, plus a right-click "Why is this here?" on any code selection.

Install

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).

Use

  • Click the Lore icon in the Activity Bar → type a question in the /lore box.
  • Select code → right-click → "Lore: Why is this here?"
  • The status bar shows Lore: live / mock / offline.

Terminal (CLI)

Install

npm install --save-dev lore
npx lore init          # installs the post-commit hook + writes .lore.json

Interactive mode

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" }

The Scribe git hook

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."

GitHub App auto-capture

Install once; every merged pull request is captured automatically — no developer effort.

  1. Create a GitHub App (Settings → Developer settings → GitHub Apps).
  2. Webhook URL: https://your-backend/webhook/github
  3. Webhook secret: set the same value as the backend's GITHUB_WEBHOOK_SECRET.
  4. Permissions: Pull requests → Read. Events: subscribe to Pull request and Installation.
  5. Set GITHUB_APP_ID / GITHUB_APP_PRIVATE_KEY on the backend so it can mint installation tokens for backfill and PR comments.
  6. Install it on your repos.
Only merged PRs are captured (a merge = a finalized decision). Webhooks are HMAC-signature verified and deduped on GitHub's delivery ID, so retries can't double-inscribe. Installing on a new repo queues an automatic backfill of recent history (BACKFILL_DAYS) through the job queue — no manual re-index step.

Self-hosting the backend

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.

Key environment variables

VariablePurpose
DATABASE_URLPostgres — required always (control plane)
GROQ_API_KEY / GROQ_MODELLLM (empty = mock mode)
EMBEDDER_MODEL / EMBEDDER_DIMSlocal embeddings (fastembed)
VECTOR_STOREqdrant (local file) or pgvector (same Postgres)
RERANK_ENABLED / RERANK_MODELcross-encoder reranking of retrieval candidates
GITHUB_APP_ID / GITHUB_APP_PRIVATE_KEY / GITHUB_WEBHOOK_SECRETGitHub App auth + webhook verification
LORE_API_KEYS / LORE_ADMIN_SECRETmulti-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.

Deploying

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.

API reference

EndpointDoes
GET /healthmode, Canon store, auth mode
GET /metricsPrometheus-format request/latency counters
POST /v1/whyrecall — reranked, composed, cited answer
POST /v1/lorefree search across the Canon (no LLM composition)
GET /v1/canon · /v1/memorieseverything in the Canon, cursor-paginated
POST /v1/inscribethe Scribe inscribes a commit's Why (idempotent)
POST /v1/ingest/seedload the demo seed corpus
GET /v1/backfill/status · POST /v1/backfill/runinstallation backfill progress / manual trigger
POST /v1/keys · DELETE /v1/keys/{id}issue / revoke tenant API keys (admin-secret gated)
POST /webhook/githubGitHub 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?"}'

Architecture

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.