Before you start

Install the CLI, then create the local database:

sh
$ lighthouse init

The commands below use an example project called harbor-api.

1. Save a result

sh
$ lighthouse code --project harbor-api <<'EOF'saved = save(    title="Retry policy for webhooks",    content="Retry 5 times with exponential backoff starting at 2s.",    agent="codex",    kind="decision",)emit({"id": saved["artifact"]["id"], "revision": saved["revision"]})EOF{"id":"618d91d2b2be6d67a3513eb4c92c4452","revision":10}

Every write advances the project revision and returns a fresh context snapshot.

2. Search it

sh
$ lighthouse code --project harbor-api <<'EOF'matches = search("deployment decision", limit=8)emit([{"id": m["id"], "title": m["title"], "kind": m["kind"]} for m in matches])EOF[{"id":"e13a289bc890e2717ac71abf0bcdc27e","kind":"decision","title":"Deployment decision: blue/green on Fly"}]

3. Load context

sh
$ lighthouse code --project harbor-api <<'EOF'pack = load_memory(limit=12)emit({"snapshot_id": pack["snapshot_id"], "revision": pack["revision"], "context": pack["context"]})EOF

The context field is a compact markdown pack: durable memory first, then recent results with their source IDs.

text
# Lighthouse contextProject: harbor-apiMemory revision: 9 ## Durable memory- **style** (preference, revision 1): Prefer plain functions over classes. Keep handlers under 60 lines.- **test-clock** (fact, revision 1): Tests must inject a fake clock; never read wall time directly.- **deploy-strategy** (decision, revision 1): Deploys are blue/green on Fly with a 10 minute soak before cutover.

4. Open the dashboard

sh
$ lighthouse serve --port 8080

Visit http://127.0.0.1:8080. See Dashboard.

Optional: connect an app

Other local apps, such as Dock, use a token-protected API. Create a token with lighthouse token create --name dock --scope 'read:*' --scope 'write:dock_*'. See Local API and Dock.

Next

Set up your agent so it runs this loop on its own.