Brain: inject identity into the live prompt + surface AGENTS.md in the command center
ci / gates (push) Failing after 11s
ci / rust (push) Has been skipped
ci / sandbox-k8s (push) Has been skipped
ci / frontend (push) Has been skipped
ci / e2e (push) Has been skipped

Gap 1 — the brain's identity sections were stored but UI-only. cm-runtime/brain.rs
`compose_system` now folds the brain's AGENTS.md ("## How I operate") + personality
into the live system prompt (after the Postgres-authoritative base, before skills +
memory; falls back to the brain's soul_md when the base is empty). Mirrors the
OpenClaw/ZeroClaw render order.

Mapping — expose `agent_md` on `GET /api/claws/{id}/brain` (ClawBrainResponse) and
render it as a collapsible "HOW I OPERATE · AGENTS.md" card in the command center's
BRAIN column (RawBrain gains agent_md; richBrain passes it through). So the section
that's now in the prompt is also visible in the UI.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
Omar Sobh
2026-06-26 12:59:17 -07:00
co-authored by Claude Opus 4.8
parent 11a1f22daa
commit 9fca3f6676
5 changed files with 39 additions and 9 deletions
+3
View File
@@ -148,6 +148,8 @@ pub struct ClawBrainResponse {
/// Whether a `.brain` file already existed before this request.
pub exists: bool,
pub system_prompt: Option<String>,
/// AGENTS.md — "how I operate" (workflow/rules); folded into the live prompt.
pub agent_md: Option<String>,
pub personality: Option<String>,
pub skills: Vec<BrainSkill>,
pub tools: Vec<BrainTool>,
@@ -205,6 +207,7 @@ fn load_brain(agent: &Agent, skills: &[(String, String)]) -> ClawBrainResponse {
ClawBrainResponse {
exists: existed,
system_prompt: brain.system_prompt(),
agent_md: brain.agent_md(),
personality: brain.personality(),
skills: skills_v,
tools: tools_v,