Shaping

Chain
conversations

Sequential multi-bot collaboration with enforced
turn control at the channel level.

Decision Shape A — Channel-Level Chains Status Shaped, ready to build
Source

Origin

This group chat system is going to be a struggle with every bot instantly trying to reply immediately lol.

Max, colony chat

I think the turn taking will need to be a pretty strong harness. Maybe I just need to limit conversations to two bots, or a chain of bots through the turn keeper?

Max

Yeah let's try chain. It is very helpful tho to have a chat UI for it. Maybe rather than group chats we have kind of chain IDs or something. Then we can easily chain other bots in too, and they can read up the chain.

Max
Problem & Outcome

What we're solving

Problem

Multi-bot group chats produce simultaneous replies. Every bot races to respond, creating duplicated messages and incoherent conversations. Manual moderation works but burns coordinator context and adds latency.

Outcome

Bots collaborate on tasks sequentially — each participant contributes in order, reads full prior context, and the coordinator controls the flow. The monitor dashboard shows chains as navigable threads.

Requirements

What it must do

ID
Requirement
Priority
R0
One bot speaks at a time — no simultaneous replies
Core
R1
Each new participant reads full chain history before contributing
Must
R2
Coordinator controls who speaks next
Must
R3
Works within existing colony channel infrastructure (SQLite DB, MCP tools)
Must
R4
Chains viewable in monitor dashboard as threads
Must
R5
Any bot can be chained in at any point, including Max
Must
R6
Non-active participants cannot post to the chain (enforced, not convention)
Must
R7
Chain history preserved and auditable after completion
Nice
R8
Minimal new MCP tools — reuse existing where possible
Nice
Current

Manual chaining

What we do today: CEO DMs each bot in sequence, copy-pasting relevant context.

Current System
CUR1
CEO sends DM to bot with context from prior steps
CUR2
Bot does work, replies to CEO via DM
CUR3
CEO reads reply, composes next DM to next bot with accumulated context
CUR4
No shared thread — chain exists only in CEO's context window
Shape A

Channel-level chains Selected

New chains table and MCP tools. Chains are a first-class colony feature enforced at the channel server level.

Parts
A1
chains table: id, name, coordinator, current_turn, participants (JSON), state (active/completed)
A2
chain_messages table: chain_id, turn_number, sender, content, timestamp. Separate from main messages table.
A3
colony_chain_create(name, coordinator) — creates chain, coordinator is the turn controller
A4
colony_chain_add(chain_id, bot, prompt) — adds a bot, delivers full chain history + prompt, sets as current turn holder
A5
colony_chain_message(chain_id, content) — current turn holder posts. Rejects if sender isn't turn holder (enforces R6)
A6
colony_chain_pass(chain_id, to_bot, prompt) — passes turn to next bot with a prompt. Delivers chain history.
A7
colony_chain_close(chain_id) — coordinator closes chain, state → completed
A8
Monitor UI: chain list view, chain thread view with turn indicators, participant sidebar
Shape B

Tagged group messages

No new tables. Chains as a convention on top of existing group messages with chain_id tag and turn enforcement in the send tool.

Parts
B1
Add chain_id and chain_turn columns to existing messages table
B2
colony_send gains --chain flag. Rejected if sender doesn't hold turn.
B3
Turn state in presence table or small key-value store
B4
Chain history = query messages WHERE chain_id = X
B5
Turn pass via message metadata chain_turn_to: botname
B6
Monitor UI queries chain messages and renders as thread
Shape C

Coordinator bot (Haiku) Rejected

A lightweight Haiku bot that manages turn-taking, sitting between participants and controlling message flow.

Parts
C1
Haiku bot "moderator" registered in colony
C2
Moderator intercepts group messages and queues them risk
C3
Moderator decides turn order based on content and roles risk
C4
Sends @bot your turn directives, holds others
C5
Bots must wait for moderator directive before replying risk
C6
Monitor UI shows moderator queue and turn state
Fit check

Requirements vs shapes

Req
Requirement
Priority
A
B
C
R0
One bot speaks at a time
Core
R1
Full chain history on entry
Must
R2
Coordinator controls turns
Must
R3
Existing colony infra
Must
R4
Viewable in monitor
Must
R5
Any bot chainable
Must
R6
Enforced turn-taking
Must
R7
History preserved
Nice
R8
Minimal new tools
Nice
Score (must-haves)
6/6
6/6
2/6

C is eliminated — fails the core goal (R0) and 4 must-haves. You can't enforce turn-taking with a bot that sits alongside participants. Enforcement must happen at the message delivery layer.

A over B — both pass all must-haves. A is cleaner: separate tables avoid ambiguity ("is this message part of a chain or a regular chat?"). B's only advantage is R8 (fewer tools), but A's tools are simple and well-scoped.

Decision

Shape A — Channel-level chains

Shape A is the strongest. It cleanly separates chain data from regular messages, enforces turn-taking at the server level, and produces a clear data model for the monitor UI.

The cost is 5 new MCP tools, but they're simple: create, add, message, pass, close. Each maps to one DB operation.

Breadboard

Architecture summary

5
Places
Coordinator, Channel Server, Bot Session, Chain List UI, Chain Thread UI
10
UI Affordances
Chain list, thread view, turn indicators, notifications
14
Code Affordances
5 MCP tools, 7 server handlers, 2 dashboard endpoints
2
Data Stores
chains table, chain_messages table

Key decisions:

  • Turn returns to coordinator after every bot post — prevents bots from passing turns directly to each other
  • History delivered as formatted context block via existing notification polling
  • Handoff messages stored with type="handoff" — part of the chain record, render as visual turn bars
  • chain_messages is separate from messages table — chains don't pollute regular inbox
Spike

Implementation steps

1
colony/channel/db.ts
Add chains and chain_messages tables. Add query functions: createChain, addParticipant, postMessage, getHistory, passTurn, closeChain, listChains, getChain.
2
colony/channel/server.ts
Register 5 new MCP tools: chain_create, chain_add, chain_message, chain_pass, chain_close.
3
colony/channel/server.ts
Add chain notification delivery to polling loop — notify bot when added to chain or given turn.
4
monitor-dashboard/serve.ts
Add /api/chains and /api/chains/:id endpoints.
5
monitor-dashboard/src/
New Chains.tsx component: chain list + thread views. Add to sidebar nav.