Engine & brain
The Rust core every surface shares: it drives provider CLIs as backends, normalizes their output into one event stream, persists everything in a local SQLite store, and feeds each run from the brain.
Backends, not lock-in
Claude Code, Antigravity, and OpenCode are adapters over their own CLIs — your subscriptions, logins, and native features stay intact; Lectern compounds them. A mock backend exercises the full pipeline for zero tokens (it's how we test everything).
Your repo's conventions travel across all of them. Claude Code reads a project's AGENTS.md natively; for the backends that don't, Lectern reads that file (falling back to CLAUDE.md) and folds it into the run, so the project's rules apply whichever model runs.
The Conductor & routing
Auto mode routes each task by editable rules in ~/.lectern/routing.json (openable from Settings) — e.g. screenshots → Gemini Flash, architecture → Opus, one-word fixes → Haiku — with an optional fast classifier for ambiguous tasks. /conduct goes further: it plans the goal, hands each sub-step to the model best at it (running independent steps in parallel git worktrees), then cross-reviews the result with a different provider.
The brain
| Piece | What it holds | How it's used |
|---|---|---|
| Memory index | FTS + vector index over your repo's files | Relevant files recalled into every run ('recalled 3 files' chips) |
| Skills | Recorded GUI macros + learned procedures (usage-scored) | Auto-applied on matching tasks; /skill attaches one explicitly |
| System profile | Your machine — distro, tools, quirks (learned locally) | Injected so agents stop rediscovering your setup |
| Code graph | Symbols, links, clusters (graphify) | Recall starts structure-aware, not just text-aware |
| User profile | How you like to work (you write it in Settings → About you) | Honored in every session |
Re-indexing is throttled per workspace, so busy sessions never pay the indexing tax twice.
One store, every surface
Sessions, events, changes, schedules, and usage live in one local SQLite store. That's what makes cross-surface sessions real: the desktop, TUI, and CLI are three views of the same history — titles, pins, and metadata reconcile newest-wins at boot.
Security model
- Local-first: sessions execute on your machine; provider CLIs keep their own credentials — Lectern stores no API keys.
- Apply gate: nothing writes to disk without your acceptance unless you opt into apply/one-shot.
- E2EE export & sync: encrypted session bundles use scrypt + XChaCha20-Poly1305; the optional cloud sees counts and ciphertext only.
- Channels: inbound senders must be allowlisted from the CLI on the machine — a chat message can never approve itself.
- Open source: Apache-2.0 — audit any of this instead of trusting the docs.