Shared Agent Protocols
Shared infrastructure for all agents: hive mind logging, scheduling, dispatching, team formation, learning, and file placement. Load this when coordinating across agents or need any protocol below.
⚠️ Messaging Hard Rule
All WhatsApp, Instagram, Slack, iMessage, Telegram, Signal, and Discord messages go through the self-hosted Matrix stack. Never use the Beeper desktop app. Never use a third-party messaging MCP tool.
Full protocol, credentials, and code snippets: _system/protocols/messaging.md
Quick reference:
- Homeserver:
http://localhost:8008(server:rawgrowth.local) - Agent token:
syt_YWdlbnRib3Q_sXJzNktpYuSUJkCIufqd_2IFHMI(@agentbot:rawgrowth.local) - Send to any room:
PUT http://localhost:8008/_matrix/client/v3/rooms/{room_id}/send/m.room.message/{txn_id} - New WhatsApp DM: send
start-chat 19493743016 {phone_no_plus}to mgmt room!rfEnUovczRzyOpqPYE:rawgrowth.local - Phone numbers: strip the leading
+(e.g.19493743016not+19493743016)
What to Load
| Task | Load These | Skip These |
|------|-----------|------------|
| Log an action | Hive Mind section below | everything else |
| Schedule a task | Scheduling section below | everything else |
| Message another agent | Agent Network section below | everything else |
| Delegate work | Team Formation section below | everything else |
| Learn from a mistake or win | Learning Protocol section below | everything else |
| Figure out where a file goes | File Placement table | everything else |
| Deploy or mark done | Ship Check section | everything else |
| Understand company direction | Read ops/strategy/north-star.md | — |
| Understand org and authority | Read _system/ORG-STRUCTURE.md | — |
| Understand what we deliver | Read ops/delivery/DELIVERY-SPEC.md | — |
| Understand the offer | Read brand/offer.md | — |
Heartbeat (call at session start and every ~30 min during long tasks)
bash /Users/scanbot/RawgrowthOS/_system/scripts/heartbeat-write.sh [AGENT_ID]
This writes a pulse to hive_mind. A cron job alerts Chris via Matrix if any agent goes silent for 4+ hours.
Hive Mind (log after every meaningful action)
sqlite3 _system/store/businessos.db "INSERT INTO hive_mind (agent_id, chat_id, action, summary, artifacts, created_at) VALUES ('[AGENT_ID]', '[CHAT_ID]', '[ACTION]', '[SUMMARY]', NULL, strftime('%s','now'));"
Scheduling Tasks
node dist/schedule-cli.js create "PROMPT" "CRON"
node dist/schedule-cli.js list
node dist/schedule-cli.js delete <id>
Common crons: daily 9am 0 9 * * *, weekdays 8am 0 8 * * 1-5, every 4h 0 */4 * * *
Agent Network (message another agent)
sqlite3 _system/store/businessos.db "INSERT INTO inter_agent_tasks (id, from_agent, to_agent, chat_id, prompt, status, created_at) VALUES (hex(randomblob(8)), 'FROM', 'TO', 'direct', 'TASK', 'pending', datetime('now'));"
Available agents: scan, larry, quilly, cleo, sam, ovi, ali, vinny, rawclaw
Spawn Workers (parallel execution)
node dist/worker-cli.js --agent <id> --prompt "Full task"
node dist/worker-cli.js --skills "brand-voice,sales" --agent <id> --prompt "Task"
Mission Tasks (async, queued)
node dist/mission-cli.js create --agent TARGET "Full prompt. DOD: (1)... (2)..."
node dist/mission-cli.js list
node dist/mission-cli.js result <task-id>
Sandbox Experiments (overnight self-improvement)
Queue an improvement for the system to try overnight in an isolated sandbox. The live codebase is never touched. Results arrive as a morning briefing.
sqlite3 _system/store/businessos.db "INSERT INTO sandbox_experiments (id, title, prompt, status, submitted_by, created_at) VALUES (hex(randomblob(8)), 'TITLE', 'FULL EXPERIMENT PROMPT — be specific about what to try and how to verify it worked', 'pending', '[YOUR_AGENT_ID]', strftime('%s','now'));"
Runs nightly at 2am. Check results: SELECT title, status, result FROM sandbox_experiments ORDER BY created_at DESC LIMIT 10;
Theta Wave runs automatically every night at 10pm — queues a full system audit for 2am execution.
Script: bash /Users/scanbot/RawgrowthOS/_system/scripts/theta-wave-queue.sh
You can also queue targeted experiments manually using the INSERT above.
KB Ingest (push research findings to shared memory)
After completing research, push key findings so all agents can retrieve them:
bash /Users/scanbot/RawgrowthOS/_system/scripts/kb-ingest.sh [AGENT_ID] "One-line finding" "Full notes (optional)" '["topic1","topic2"]'
Findings are FTS5-indexed and queryable by all agents via the Pre-Task Memory Check below.
Team Formation (delegate and scale)
You can delegate work three ways, from lightest to heaviest:
1. One-Off Worker (no persistent agent)
For a single task that doesn't repeat:
node dist/worker-cli.js --agent [your-id] --prompt "Full task with DOD"
2. Parallel Team (multiple workers at once)
For a project that benefits from parallel execution:
node dist/worker-cli.js spawn-team --tasks tasks.json
tasks.json format: [{"id":"t1","agent":"[your-id]","prompt":"Task 1"},...]
Max 5 parallel workers. 10-minute timeout each.
3. Request Persistent Sub-Agent (via Scan)
For recurring work that deserves a dedicated agent:
sqlite3 _system/store/businessos.db "INSERT INTO inter_agent_tasks (id, from_agent, to_agent, chat_id, prompt, status, created_at) VALUES (hex(randomblob(8)), '[YOUR_ID]', 'scan', 'direct', 'REQUEST: Create sub-agent [your-id]-[function]-1 for [purpose]. Recurring: [yes/no]. Schedule: [cron if recurring].', 'pending', datetime('now'));"
Scan evaluates and creates if justified. See _system/ORG-STRUCTURE.md for naming and limits.
Product Interrogation (before any new bet)
Before Chris greenlights a new product, feature, or offer variant — and before Larry writes for a net-new angle — run the six forcing questions:
- Demand Reality — who is desperately asking, by name, today?
- Status Quo — what's the current "good enough"? What does doing nothing cost?
- Desperate Specificity — named buyer with budget in 30 days?
- Narrowest Wedge — smallest 7-day version that still moves the needle?
- Observation — real user behavior witnessed, not reported?
- Future-Fit — does this compound or is it a side-quest?
Full skill + sales-discovery reframe: _system/skills/product-interrogation/SKILL.md.
Save interrogation outputs to _scratch/interrogations/[YYYY-MM-DD]-[slug].md.
Confusion Protocol (stop-and-ask rule)
When you hit high-stakes ambiguity, STOP. Do not guess. This applies to:
- Two plausible architectures or data models for the same requirement
- A request that contradicts existing patterns and you're unsure which to follow
- A destructive operation (migrations, deletions, force-push,
git reset --hard) where scope is unclear - Missing context that would change the approach significantly
Protocol:
- Name the ambiguity in one sentence.
- Present 2-3 options with trade-offs (matches our "3 solutions → pick best" decision framework).
- Ask Chris or the originating agent. Log the decision to
hive_mindwithaction="decision"once resolved.
Architectural and data-model decisions never get guessed. Routine code paths still execute — this is a guard against silent divergence, not a blocker.
Safety Guards (gstack-installed)
Global /careful, /guard, /freeze commands are live via gstack (~/.claude/skills/gstack/). Use them on:
- Any
rm -rf,DROP TABLE,git reset --hard, force-push, orgit clean -f - Any edit session where Claude should not "helpfully fix" files outside the target directory (use
/freeze <dir>to scope) - Pre-prod deploys on Rawclaw, customer portal, or any database migration — run
/csofirst (OWASP Top 10 + STRIDE audit)
Learning Protocol
Nothing learned once should need to be learned twice.
After a Mistake
- Log to hive_mind with
action="learning":sqlite3 _system/store/businessos.db "INSERT INTO hive_mind (agent_id, chat_id, action, summary, created_at) VALUES ('[AGENT_ID]', '[CHAT_ID]', 'learning', 'WHAT: [what went wrong]. CAUSE: [root cause]. FIX: [what was changed].', strftime('%s','now'));" - Fix the source doc (not just the output). Voice mistake ->
brand/voice.md. Process failure -> relevant SOP. Wrong routing -> relevant CONTEXT.md. - Prevent recurrence. Add a guard, a constraint, or a check to the appropriate doc.
After a New Data Point
Route it to the right place. Don't let information die in a conversation.
- Sales call transcript ->
sales/calls/YYYY-MM-DD-name.md - Client feedback ->
clients/[name]/activity-log.md - Competitor intel ->
research/competitor/ - Voice correction from Chris ->
brand/voice.mdorbrand/constraints.md - Process improvement -> relevant SOP
After a Successful Pattern
- Log to hive_mind with
action="pattern_confirmed" - If replicable, add to the relevant framework doc (playbook, content framework, SOP)
Pre-Task Memory Check
Before starting meaningful work, check recent memories:
sqlite3 _system/store/businessos.db "SELECT summary FROM memories WHERE agent_id='[AGENT_ID]' AND salience > 0.3 ORDER BY importance DESC LIMIT 10;"
File Placement
| Content Type | Location |
|-------------|----------|
| Research outputs | research/[category]/ |
| Content scripts | content/pipeline/[stage]/ |
| Content ideas | content/pipeline/01-ideas/ |
| Brand copy examples | sales/copy-library/[type]/ |
| Sales scripts | sales/scripts/[type]/ |
| Sales SOPs | sales/docs/sops/ |
| CRM data/reports | sales/crm/ |
| Client docs | clients/[client-name]/ |
| Delivery SOPs | ops/delivery/sops/ |
| Financial reports | ops/finance/monthly-reports/ |
| Strategy docs | ops/strategy/ |
| Generated artifacts | _scratch/ |
| Temp/scratch | _scratch/tmp/ only |
| Nothing at root. Always in a workspace folder. | |
New App Protocol
- Create
engineering/apps/[app-name]/folder - Write
engineering/apps/[app-name]/CONTEXT.mdwith: what it is, tech stack, URLs, file map - All app-specific files stay inside that folder
- Shared/reusable code in
engineering/src/ - Serverless endpoints in
engineering/api/[app-name]-[action].js
ClickUp Policy
ClickUp = humans only. Add a task ONLY when Chris or Dilan needs to take action.
Agent-to-agent work uses inter_agent_tasks table. Autonomous work never goes to ClickUp.