brain.digest
Use first for scoped current knowledge, event-core counts, pending proposals, and quiet-loop checks.
Agent-readable runtime manual
ocbrain is the shared, local, source-backed memory layer for Codex, Claude Code, OpenClaw, and compatible MCP clients. It is not an autopilot, scheduler, policy engine, or skill installer. Treat it as evidence-backed context with strict scope and feedback.
Quick contract
Startup routine
1. Identify context:
project, repo, task, client, runtime, and session when known.
2. Call brain.digest with that context.
3. If the task depends on prior work, call brain.search or brain.preview
with a narrow query and the same context.
4. Use the result as evidence-backed orientation only.
5. After using context, call brain.feedback when a retrieval_use_id exists.
Decision routine
1. Orient from brain.digest.
2. Retrieve narrowly with brain.search or brain.preview.
3. Check provenance, scope, status, and recency.
4. Compare against local files, tests, live services, or the user's latest request.
5. Use the retrieved context only if it survives that verification.
6. Cite or summarize the evidence that actually changed your action.
7. Record brain.feedback for any retrieval_use_id you relied on.
Never treat memory as fresher than the repo, command output, deployment state, or the user's newest instruction.
Tool contract
Use first for scoped current knowledge, event-core counts, pending proposals, and quiet-loop checks.
Use for source-backed lookup. Pass context so retrieval respects project, repo, task, client, and visibility scope. Prefer focused queries over broad fishing.
Use before relying on a retrieved packet. It shows included items, excluded scoped material, and contradictions.
Use before local model, hosted teacher, or human export packaging. Preview shows what would be included or rejected and does not grant send approval.
Use only to prepare a hosted-teacher package for review. A healthy default path packages and audits without dispatching a hosted call.
Use to mark retrievals helpful, used, ignored, irrelevant, or harmful. With write mode, it can carry gated correction decisions.
Context example
{
"project": "ocbrain",
"repo": "jonathangu/ocbrain",
"runtime": "openclaw",
"task": "agent-manual"
}
Use the narrowest true context. If the project is unknown, do not guess confidential scope; use workspace or session scope and surface uncertainty.
Scope rules
Conflicts and corrections
brain.feedback when available. Durable hard corrections require write mode and should remain human-gated.Write safety
The normal MCP server is read-first. Write-capable tools should only appear when ocbrain is launched with write mode. Even then, agents should prefer evidence and feedback over durable mutation.
Health check
brain.digest(context={"project":"ocbrain"}, event_core=true, limit=3)
brain.search(query="scope doctrine", context={"project":"ocbrain"}, limit=3)
brain.preview(query="Bountiful Fly deployment", context={"project":"bountiful"}, limit=3)
brain.egress_preview(target="hosted_teacher", context={"project":"ocbrain"}, query="scope doctrine")
A healthy install should return populated counts, scoped results, visible exclusion counts, and no hosted call unless explicitly approved elsewhere.
Agent output
When ocbrain changes your answer or implementation, say so briefly and name the evidence class: repo doc, task ledger, artifact, command output, source file, or retrieval id. Do not dump raw memory unless the user asks.
Good output:
Used ocbrain scoped to project=bountiful, then verified against the repo
and the live health endpoint before changing the deployment note.
Bad output:
The brain said it, so I did it.
Anti-patterns
Canonical sources