Skip to content

Brain into Rooms: convergence, persisted history, reply-loop fix, manual halt#662

Open
Wirasm wants to merge 1 commit into
mainfrom
feature/brain-into-rooms
Open

Brain into Rooms: convergence, persisted history, reply-loop fix, manual halt#662
Wirasm wants to merge 1 commit into
mainfrom
feature/brain-into-rooms

Conversation

@Wirasm

@Wirasm Wirasm commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Follow-ups from the deep-dive review of the recent channel → Room rename. Five threads, one PR.

1. Agent prompts say "room" (#1)

.pi/agents/{orchestrator,worker,reviewer}.md were still describing a "channel" — the data agents actually read. Updated to "room" / "participant(s)" to match the primitive.

2. Brain converged onto the real Room primitive (#2)

The brain talked over a separate CommsBus while the cockpit used the real Room primitive — two things both called "room". Now the brain drives the same surface as the human:

  • brain.ts gains open_room / post_to_room backed by roomManager; RoomManager gains postAs / messages.
  • Deleted comms-bus.ts and the superseded rooms-demo.ts (the real multi-agent room demo is kild room --participants a,b,c).
  • Agent dispatch stays on Flue (run_agent_in_worktree) — real participants are worker subprocesses that only bootstrap inside the engine, so standalone workflows can't spawn them.

3. Room log persisted as read-only history (#3)

Rooms were in-memory only and vanished on every --watch reload. RoomRegistry now write-throughs each room's log to $KILD_HOME/rooms/<id>.json and loads past rooms into a read-only archive on start. New GET /api/rooms/archive; the cockpit renders archived rooms as a read-only transcript (disabled composer). Participants stay dead — it's a record, not a resumable session.

4. Fixed the agent reply-loop (#4, found live)

Two agents ping-ponged "standing by" / "(no response needed)" forever and burned tokens. Root cause: the implicit reply auto-posted an agent's turn-final narration as a delivered turn — so "I'll stay quiet" became a message that prompted the other agent, contradicting the prompts ("no one sees your normal output — only what you post"). Fix: an implicit reply now broadcasts but never delivers a turn; prompting another agent requires an explicit post_message @mention. Two router tests lock it in.

5. Manual circuit breaker (halt button)

A Topbar ⏹ halt button (room_halt) stops a room's agent sessions but keeps it read-only — the operator can trip it to stop a runaway or off-track room without tearing it down (vs ✕ which closes it).

Verification

  • engine: typecheck ✅, lint ✅, 44 tests ✅ (+4), compile
  • app: svelte-check ✅ (0 errors)
  • Ran engine + cockpit locally; health + archive endpoint verified.

Notes

  • room-types.ts and a few files span more than one thread, so this is one commit rather than split.
  • Loop control beyond the root-cause fix is now the manual halt button (no automatic turn cap), by request.

…al halt

Follow-ups from the deep-dive review of the channel→Room rename.

- prompts: .pi/agents/{orchestrator,worker,reviewer} now say "room"/"participant"
  to match the renamed primitive; drop the stray engine/.claude reviewer stub.
- brain: converge onto the real Room primitive — the brain opens/posts via the
  roomManager (open_room/post_to_room) instead of the parallel CommsBus, which is
  deleted along with the now-superseded rooms-demo. RoomManager gains postAs/messages.
- history: RoomRegistry write-throughs each room's log to $KILD_HOME/rooms/<id>.json
  and loads past rooms into a read-only archive on start; GET /api/rooms/archive plus
  cockpit rendering (read-only transcript, disabled composer).
- loop fix: an implicit reply (an agent's auto-posted turn-final narration) now
  broadcasts but never delivers a turn, so two agents can't ping-pong on "staying
  quiet". Prompting another agent requires an explicit post_message @mention, matching
  the prompts. Adds two router tests.
- halt: a manual circuit breaker (room_halt) — the Topbar "halt" button stops a room's
  agent sessions but keeps it read-only, vs ✕ which tears the room down.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant