Skip to content

Operations

Once your loops work with bf run, hand them to bf watch for continuous 24/7 supervision. You can control live loops, inspect checkpoints, upgrade versions, and recover from failures without editing bf.yaml or disturbing unrelated state.

1. Supervise continuously (bf watch)

bf watch supervises note rebuilds, schedules, events, delayed timers, and always-on daemons in one process:

# Live dashboard on a TTY (switches to structured JSONL under systemd or launchd)
bf watch

# Attach a read-only live view from another terminal at any time
bf status --watch

For 24/7 always-on operation, run bf watch --brain /path/to/brain under systemd --user or launchd. Your OS restarts the supervisor on login or reboot while passive daemons and scheduled or event-driven agents keep running in the background. On laptops that suspend, sleep, or drop Wi-Fi overnight, bf watch recovers automatically in three ways: it detects wall-clock sleep jumps (>= 30s, settling 15s before retrying), runs a rate-limited connectivity recovery sweep (watch.recover, 300s cooldown) whenever a previously failing cycle loop succeeds, and accepts SIGUSR1 on POSIX hosts to clear busy cooldowns, wake sleeping daemon backoffs, and retry failed scheduled loops immediately without restarting (you can also run bf run --failed on demand).

2. Control live loops and forgotten records

Operate live loops without editing bf.yaml:

bf pause github-issues --for 2h     # Mute a flaky loop temporarily
bf resume github-issues             # Resume early
bf state show github-issues         # Inspect a loop's checkpoint safely mid-run
bf events --timers --format text    # Inspect pending delayed wakeups

If an ingested record should stay removed on future syncs, list its ID (one per line, bare <id> or <source>:<id>) in memories/<source>.forgotten instead of overriding snapshot safety checks.

3. Upgrading

Upgrade the CLI with uv tool upgrade brain-framework.

Before crossing a major version, back up your brain and check Breaking changes in the changelog. Preview state cleanup with bf state prune --dry-run, then run bf state prune && bf build && bf check.

4. Maintenance runbook

Reset a stuck loop cursor

  1. Check bf status --format text and back up .bf/state/<loop>.json if you want a rollback copy.
  2. Preview with bf state reset <loop> --dry-run, then run bf state reset <loop>.
  3. Blast radius: clears failure counters, schedule anchor (next run re-backfills window.backfill), and active paused state while anchoring event_seq at the latest event. Verify with bf status --format text.

Prune removed loop artifacts

  1. Preview with bf state prune --dry-run and copy any .bf/state/<loop>.json, .bf/state/<loop>/, or logs/<loop>.jsonl files you want to keep.
  2. Run bf state prune.
  3. Blast radius: deletes orphaned state files, state dirs, unlocked lock files, and logs for loops removed from bf.yaml (active locked loops are skipped). Verify orphans clears in bf status --format text.

Rebuild a corrupt or stale search cache

  1. Confirm index: stale in bf status --format text, and stop bf watch if running so no writer races the rebuild.
  2. Remove only .bf/cache/ (rm -rf .bf/cache, never .bf/state/). Blast radius: .bf/cache/ is strictly disposable and rebuilt from memories/*.jsonl; concurrent reads fall back to JSONL scans until bf build finishes.
  3. Run bf build and confirm index: stale disappears in bf status --format text.

See Security for secret isolation, filesystem confinement, and resource limits, and Reference for every command and exit code.