openclawbrain-site

Getting Started with OpenClawBrain

OpenClawBrain is a second brain for your OpenClaw agent — a guide that learns which knowledge matters for each question, instead of keyword-searching every document. Think of it as hiring a librarian who gets smarter every day.

This guide is the day-0 setup path. It covers what the repo delivers today and what’s coming next — clearly separated. OpenClaw owns the live runtime (front of house); OpenClawBrain owns the knowledge, learning, and context compilation (the kitchen).

Current truth: promoted-pack lifecycle, PG-only route_fn evidence, operator observability, local tarball distribution. Target end shape: npm-published API, scanner/labels/harvest on by default after attach, continuous live graph update (decay/co-firing/pruning/reorganizing), hard API enforcement of the OpenClaw/OpenClawBrain split.

What you need

1. Build the workspace

corepack enable
pnpm install --frozen-lockfile
pnpm check                  # type-check, lint, test, and verify package integrity
pnpm release:check          # full proof lane + local tarballs
pnpm fresh-env:smoke        # clean-room outside-consumer install proof

A brain pack is an immutable versioned artifact containing graph nodes, vector entries, provenance, and an optional learned route_fn. It is materialized off the hot path by the learner and made compile-visible only after promotion by activation. The compiler always serves from the currently active promoted pack.

pnpm check runs type-check, lint, test, lifecycle smoke, and observability smoke. pnpm release:check runs the full proof lane, rebuilds .release/*.tgz tarballs, and writes .release/release-proof-manifest.json. pnpm fresh-env:smoke is the clean-room outside-consumer lane: installs tarballs into an isolated plain-npm directory and proves the attach/promotion/rollback flow.

2. Connect to OpenClaw

OpenClaw owns runtime orchestration. You tell it where to find the brain pack by setting a runtime profile:

{
  "brain": {
    "enabled": true,
    "packSet": "<versioned-pack-set>",       // which brain pack version to load
    "fastBootFromExistingFiles": true,        // start serving immediately from existing files
    "backgroundLearning": {
      "enabled": true,
      "prioritizeNewEvents": true             // learn from new usage before backfilling history
    },
    "labels": { "human": true, "self": true },// collect human and automated feedback signals
    "scanner": { "enabled": true },           // watch for new workspace and event data
    "harvest": { "enabled": true },           // extract learning signals from events
    "teacher": { "onHotPath": false }         // keep learning off the response path
  }
}

Key points — current truth:

Target end shape (not yet): scanner/labels/harvest on by default after attach without any config; continuous live graph update (decay, co-firing, pruning, reorganizing) on the active pack during serving.

2b. Public package surface

The supported packages (from local tarballs today, npm-published in the target wave):

Use pnpm operator:status, pnpm operator:doctor, and pnpm operator:rollback -- --dry-run for day-0 triage once you have a real activation root.

3. Confirm it is working

After connecting, verify these behaviors:

  1. Agent responds immediately. OpenClaw boots from the seed pack without waiting for background learning. Zero-event bootstraps stay in seed-state only until the first exported turn arrives.
  2. Background learning is running. New events are exported first; historical backfill continues. The learner materializes candidate packs off the hot path; activation promotes them.
  3. Fail-open works. If brain workers are delayed, OpenClaw still serves from the active pack. Missing active packs fail open, but learned-required route-artifact drift hard-fails instead of silently bypassing the learned path.
  4. Observability. Run pnpm operator:status for a one-screen answer to: did attach land first value, what is active now, and is rollback ready? Run pnpm operator:doctor for explicit PASS/WARN/FAIL follow-up when status shows drift.

4. Rollback and fail-open

OpenClaw owns fail-open behavior. If something goes wrong:

Recovery happens through background loops and pack rollback — no manual intervention needed.

Next steps

Proof lanes

Run these to verify the full promoted-pack lifecycle locally:

pnpm lifecycle:smoke            # normalized events → promoted-pack compilation
pnpm observability:smoke        # activation health, PG metadata, route artifact diffs
pnpm continuous-product-loop:smoke  # live-style export → PG-only candidate refresh → promotion
pnpm runtime-wrapper-path:smoke # OpenClaw wrapper path: compile → export → async learning → promotion
pnpm customer-value-proof:smoke # recorded-session replay showing learning changes later served turns