ContextBrain — Code-Context 3-Act adapter (LocalBrain / ContextQBrain, T441/T454)
Separate from the memory-preamble backend above, the ContextBrain port (src/core/contextBrain.ts)
is the seam behind the Code-Context 3-Act architecture (docs/design/code-context-3act.md) used by
WorkflowEngine and cyberine loop (AutonomyLoop): one method per act.
- boot (Act 1 SCOPE) — supply the worker a candidate file set + invariants + prior lessons before it starts.
- recall (Act 2 STEER) — committed-state lookup on a verify failure (never live edits).
- carry (Act 3 CARRY) — sink the post-judge capsule so future boots start warmer.
Two adapters, selected automatically by createContextBrain() (src/adapters/ContextQBrain.ts) —
no code change needed, same CYBERINE_CONTEXTQ switch as the memory backend above:
- LocalBrain (default, offline) — repo skeleton + git co-change signal + local
MemoryStorelessons for boot/recall; writes the capsule to.local/runs/<runId>/context.mdfor carry. - ContextQBrain (
CYBERINE_CONTEXTQ=1) — boot callsPOST /api/agent/bootfor a token-budgeted repo-map + lessons; recall callsPOST /api/retrievefor a kNN lesson/passage lookup on a verify error; carry pushes the capsule toPOST /api/contexts/bulk-upsert. LocalBrain's own output is always computed first as the offline floor — ContextQ's response only augments repoMap/lessons when it succeeds. Every method is best-effort: any network/HTTP failure (timeout, non-2xx, server down) degrades silently back to the LocalBrain result — a run must NEVER fail because ContextQ is unreachable.
export CYBERINE_CONTEXTQ=1 # same master switch as the memory backend
export CYBERINE_CONTEXTQ_URL=http://localhost:38200 # ContextQ base URL
export CYBERINE_CONTEXTQ_API_KEY=sk_live_xxx # scope read + write
npm run wf -- --sample # boot/recall/carry now round-trip through ContextQ
npm run selftest:contextq-brain # offline smoke: stub server, no live ContextQ neededCallers that explicitly inject a contextBrain/brain option (e.g. tests) still override the
factory's choice.
Shared memory backend — ContextQ (or any similar server)
The local episodic store above is the canonical record store and is always on. An OPTIONAL augmentation backend, selected purely by config, ALSO receives each terminal run and serves a...
Project groups — link dirs to share runs / chats / memory
A GROUP links several project directories so their runs, chats, and long-term memory collaborate across projects (one Cyberine group = one shared memory pool). Groups are OPT-IN: with no config,...