Dialogue · Interactive Architecture

Topology — how the browser and the local backend fit together

A local Python server (it can't live on Cloudflare Pages — it's a long-running, stateful SSE process) holds one running megaprompt context per session: it assembles the prompt, parses the model's output into the confer + the responses, and logs. When the session closes it writes the same artefacts the batch schemes emit, so viewer, index, and audit are untouched.

BROWSER · wireframe/chat-ui.html cream/coral · light · dark · e-ink message stream · @-address chips · jump-in + slide-out deliberation drawer POST /say { text, @target } SSE stream ← intro · confer · responses · floor PYTHON SERVER · serve_interactive.py localhost · one running megaprompt context per session session manager prompt assembler response parser confer ↔ responses event logger one context — no routing between minds ENGINE · megaprompt — one model voices the whole cast stages the panel — the confer AND each response — in one pass 李 Li Ka-shing Д Vladislav Doronin S Shane Lauft one context · sees every profile + brief · no isolation wall @name → answers as that one persona, skipping the confer Anthropic API one streaming call · opus / sonnet on close event-log.json · transcript.md + human-speak · deliberation · speak · cost · mode:"interactive" · participants[] backward-compatible superset — old 2-actor logs still validate EXISTING PIPELINE — unchanged viewer* · index · post-run audit * a live session becomes a normal replayable experiment — the N-way viewer update (human + 3 personas) comes later deferred: the python (isolated) engine + self-election bids — still the batch research thesis, not used by the interactive panel

One human turn, step by step

Two visible layers — there's no private <think> anymore; the one model stages everything. Confer (the panel's internal back-and-forth → side panel) → respond (one message per character → main chat).

The human types (optionally picking a @persona). The server appends it to the running context as From the floor: "…" and logs a human-speak event. @addressed → the model answers as that one persona, confer skipped. Otherwise:

megaprompt · confer, then respond

  1. The single model, holding the whole cast, writes the internal deliberation — the three characters reacting to each other, a flowing 3–4 exchange back-and-forth (no fixed rounds).
  2. It settles a relevance-led order inside that confer (the character the turn most implicates leads), then writes one response per character — each follower answering the line actually delivered before it.
  3. The response parser splits the output: deliberation lines → the side panel; speak lines → the main chat.
  4. The server streams them over SSE — drawer fills with the confer, the chat fills with one message each.
  5. Floor returns to the human. (The model can have a character pass — say nothing this turn — so it never forces a flat chorus.)

Why megaprompt for this: one model staging the confer + responses makes it trivial to change the format, add or drop a character, or dial the depth of the deliberation — all prompt edits, no routing or per-context plumbing.

Adding / removing a voice — at any turn

The user manages the cast live (sub-strip roster: ✕ retires, ⊕ add picks from the character library). Changes land at the next turn boundary, never mid-volley — and they're shaped to respect the cache.

cast changes, cache-aware

  1. Addappend the new character's materials to the end of the system block. Everything before stays cached; you pay a one-time cache write for just the new tail (it shows on that turn's cost meter). The joiner is omniscient — the one model already holds the thread, so no catch-up beat is needed.
  2. Retire → a simple parting line + an appended "stop voicing X" instruction. Their materials stay in place (dormant, still cheap cached reads) — deleting from the middle would shift the prefix and bust the cache. Garbage-collected only on a fresh session.
  3. Logged as join / leave events; participants[] updates. Down to one character → no group confer (it's a 1:1). Keep ≥1.
confer / deliberation — the flowing back-and-forth among the characters, logged as first-class deliberation events: how each turn's responses were formed. Shown in the slide-out side panel, never in the main chat.
relevance-led order — the character the turn most implicates leads; the others react to the delivered line (not the backstage draft), so going first actually matters.
@-address — the override: skips the confer and answers as the one named persona.
per-turn cost — every turn records its tokens + API price as a cost event (the dear cache-write on turn 1, cheap reads after); shown left of the floor marker in the chat, totalled in the sub-strip.
local-only backend — the server is a researcher tool on localhost; only the recorded session is committed and published to the CF-Pages viewer.