Binaries: bash, python3, sed, grep (standard on Linux/macOS)
Optional env vars (all default to ~/clawd-based paths):
| Var | Default | Description |
|---|---|---|
| ----- | --------- | ------------- |
SB_WORKSPACE | ~/clawd | Path to your OpenClaw workspace |
SB_AGENT | script basename | Agent name written into each fact |
SB_BRAIN | $SB_WORKSPACE/memory/shared-brain.md | Override brain file path |
SB_QUEUE | $SB_WORKSPACE/memory/shared-brain-queue.md | Override queue file path |
SB_ARCHIVE_DIR | $SB_WORKSPACE/memory | Override archive directory |
Install note: sb-install.sh patches agents/*/AGENTS.md and HEARTBEAT.md and copies scripts into $SB_WORKSPACE/skills/shared-brain/scripts/. Use --dry-run first to preview all changes. No network access, no secrets required.
Shared persistent memory layer for multi-agent OpenClaw workspaces. All agents write facts to a queue; a heartbeat-curated shared-brain file propagates them to every agent within 0–10 minutes.
Agent discovers fact
↓
Append to ~/clawd/memory/shared-brain-queue.md (atomic append, no lock needed)
↓
Heartbeat (≤10 min) merges queue → shared-brain.md
↓
Next agent startup → reads shared-brain.md → current ground truth
Files:
| File | Owner | Purpose |
|---|---|---|
| ------ | ------- | --------- |
~/clawd/memory/shared-brain.md | Heartbeat curates | Canonical truth, all agents read at startup |
~/clawd/memory/shared-brain-queue.md | Agents append | Staging — raw facts before curation |
Every entry in the queue must follow this schema:
[YYYY-MM-DD HH:MM UTC] [SECTION] [agent-name] key = value
Sections: [INFRA] [PROJECTS] [DECISIONS] [CAMPAIGNS] [SECURITY]
Examples:
[2026-03-22 10:15 UTC] [INFRA] security deploy:frontends = Vercel (migrated 2026-03-21)
[2026-03-22 09:00 UTC] [PROJECTS] dev crimsondesert:branch = master
[2026-03-22 08:00 UTC] [DECISIONS] growth discord:crimsondesert = SKIP (3rd party links banned)
Add to each AGENTS.md initialization block:
cat ~/clawd/memory/shared-brain.md
Each agent only needs its relevant sections — declare which in AGENTS.md:
dev, qa, security → [INFRA] + [PROJECTS]growth, pm, po → [PROJECTS] + [CAMPAIGNS] + [DECISIONS]tars main → all sectionsUse the write script — never edit shared-brain.md directly:
~/clawd/skills/shared-brain/scripts/sb-write.sh SECTION "key = value"
When to write:
Never write:
See references/heartbeat-integration.md for the full curation logic to add to HEARTBEAT.md.
Summary:
shared-brain-archive-YYYY-MM.mdRun once per workspace:
~/clawd/skills/shared-brain/scripts/sb-install.sh
This creates the files, patches all AGENTS.md with the startup read line, and adds curation logic to HEARTBEAT.md.
共 1 个版本