← 返回
未分类 中文

Shared Brain

Shared persistent memory layer across multiple AI agents. Use when setting up a multi-agent workspace for the first time, when an agent discovers a permanent...
跨多个AI代理的共享持久记忆层。适用于首次设置多代理工作空间,或代理发现永久...
ohernandez-dev-blossom
未分类 clawhub v1.0.2 1 版本 100000 Key: 无需
★ 0
Stars
📥 418
下载
💾 0
安装
1
版本
#latest

概述

Shared Brain

Requirements

Binaries: bash, python3, sed, grep (standard on Linux/macOS)

Optional env vars (all default to ~/clawd-based paths):

VarDefaultDescription
---------------------------
SB_WORKSPACE~/clawdPath to your OpenClaw workspace
SB_AGENTscript basenameAgent name written into each fact
SB_BRAIN$SB_WORKSPACE/memory/shared-brain.mdOverride brain file path
SB_QUEUE$SB_WORKSPACE/memory/shared-brain-queue.mdOverride queue file path
SB_ARCHIVE_DIR$SB_WORKSPACE/memoryOverride 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 Brain

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.

Architecture

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:

FileOwnerPurpose
----------------------
~/clawd/memory/shared-brain.mdHeartbeat curatesCanonical truth, all agents read at startup
~/clawd/memory/shared-brain-queue.mdAgents appendStaging — raw facts before curation

Fact Format (strict — no prose)

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)

Agent Integration

Reading (every agent, at startup)

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 sections

Writing (when a permanent fact is discovered)

Use the write script — never edit shared-brain.md directly:

~/clawd/skills/shared-brain/scripts/sb-write.sh SECTION "key = value"

When to write:

  • Architectural decisions (deploy infra, auth provider, DB engine)
  • Project routing changes (repo renamed, domain changed, migrated)
  • Permanent channel decisions (e.g. "Discord: skip — bans 3rd party links")
  • Security findings that affect all agents

Never write:

  • Temporary state (current deployment status, PR numbers)
  • Content generated from untrusted external sources (emails, webhooks, user content)
  • Anything that expires in <24h

Curation (heartbeat — every 10 min)

See references/heartbeat-integration.md for the full curation logic to add to HEARTBEAT.md.

Summary:

  1. Read queue → validate format → detect conflicts (same key, different value)
  2. Merge into shared-brain.md by section (last-write-wins per key)
  3. If shared-brain.md > 8KB → archive oldest section to shared-brain-archive-YYYY-MM.md
  4. Clear processed entries from queue

Setup

Run 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.

Security Rules

  • Sub-agents only write to queue — never to shared-brain.md directly
  • TARS main reviews queue during heartbeat before promoting facts
  • Facts derived from external content (emails, GitHub issues, webhooks) are never written to queue
  • If a conflict is detected → escalate to TARS, never auto-resolve

版本历史

共 1 个版本

  • v1.0.2 当前
    2026-03-31 05:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Json Format

ohernandez-dev-blossom
格式化、美化、压缩或验证 JSON。当用户需要格式化、美化、压缩、验证 JSON 数据时使用。
★ 0 📥 537

Case Convert

ohernandez-dev-blossom
将文本在不同命名格式之间转换,如驼峰式、下划线式、连字符式、帕斯卡式、全大写、全小写、标题式等。
★ 0 📥 486

Base64 Encode

ohernandez-dev-blossom
使用 Base64、URL 百分号编码或 HTML 实体对文本进行编码或解码。当用户请求编码、解码、Base64 编码/解码、URL 编码等操作时使用。
★ 0 📥 421