The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(store): add Roundtable harness for decisions
dee0477bd021b74
diff --git a/docs/research/2026-09-20-roundtable-harness.md b/docs/research/2026-09-20-roundtable-harness.mdnew file mode 100644index 000000000..94a9bf1f0--- /dev/null+++ b/docs/research/2026-09-20-roundtable-harness.md@@ -0,0 +1,262 @@+# Roundtable — a harness that puts N agents in the room++Design date: September 20, 2026. Status: design only, nothing built. Engine CLIs and flags below were+checked on this machine; everything else is proposal.++**Recommendation: build `autonomous/roundtable` — a tier-2 harness whose agent is a moderator, not an+author. It seats N coding agents from different vendors around one question, runs them in sealed+parallel rounds so they cannot anchor on each other, and draws the room as a matrix in the pane:+one column per seat, one row per round. The artifact is the disagreement.**++## Why this one is unlike every harness on the shelf++Every package in `store/agents/` is one agent making a thing: a board, a part, a deck, a scene. The+value is the artifact and the pane that draws it.++Roundtable inverts that. The artifact **is the conversation**, and the thing worth looking at is+where four models that were trained differently stop agreeing. Nobody gets that today: you ask+Claude, then you ask Codex in another window, then you hold two answers in your head and lose the+comparison. Putting them in one room, on one motion, in one view, is the product.++It is also the first package where `engine` in `harness.json` is only the **moderator**. The+panelists are not Harness sessions and not tiles — they are headless subprocesses the moderator+spawns (`claude -p`, `codex exec`, …). That matters: **no app change, no daemon change, no spec+change.** The DSH contract already allows it, because a harness may run whatever it likes from its+toolchain.++## The room++| Role | Who | Can write |+|---|---|---|+| **Chair** | the user, in the tile's chat | sets the motion, presses a seat, adds a constraint, closes the debate |+| **Moderator** | the harness's own agent (Claude Code) | the only process that touches the workspace |+| **Seats** | N headless engines, one subprocess each | nothing — they speak to stdout |++**One writer, N speakers.** Four agents with write access to one folder is not a debate, it is a+merge conflict. Panelists run read-only; the moderator files every turn. This is the rule that keeps+the whole thing sane, and it is also what makes the transcript trustworthy — one hand wrote it.++The moderator never argues. It frames, calls rounds, enforces the word cap, files the turns, tags+the claims, and writes the decision. If it has an opinion it declares it as a seat like anyone else.++## The protocol, and the one idea that makes it work++Rounds, in order. Each is a phase in the verdict strip.++1. **Motion.** The moderator turns the user's question into a motion with the constraints and the+ stakes written down, and proposes the seating. One user confirmation, then it runs.+2. **Openings — sealed and parallel.** Every seat answers the motion cold. No seat sees another's+ answer. They run concurrently, so this costs one turn of wall-clock, not N.+3. **Cross-examination — parallel again.** Each seat now reads all the openings and answers: what is+ wrong in the others, what did they miss, what do you concede.+4. **Chair's turn.** The pane is full of positions; the user presses one, adds a constraint, seats+ another engine, or calls it.+5. **Convergence.** Each seat states what it now agrees with, what it still refuses, and — the+ question worth the whole exercise — **what evidence would change its mind**.+6. **Decision.** The moderator writes the call *and attaches the dissent under it by name*.++**Sealed parallel openings are the design.** Run these agents in a chat loop and they converge on+whoever spoke first, politely, within two turns — you get four voices agreeing and learn nothing.+Independence has to be enforced by the protocol, not asked for in a prompt. Everything else here is+plumbing; this is the part that decides whether the harness is interesting or a novelty.++Second rule, same spirit: **a decision never averages.** It picks, and the minority position stays on+the page with a name on it. A verdict that blends four answers into mush is worth less than any one+of them.++## On disk++The pane watches a folder, so the transcript is files.++```+motion.md the question, the constraints, what would settle it+room.json the seats: id, engine, model, stance, session id, state+rounds/1-opening/<seat>.md one file per seat per round; front matter carries the facts+rounds/2-cross/<seat>.md+rounds/3-converge/<seat>.md+claims.json claim x seat -> agree | disagree | silent (the moderator's tagging)+decision.md the call, and the dissents by name+dist/index.html the rendered room (what the pane serves)+.harness/verdict.json+```++Each turn file:++```markdown+---+seat: codex-skeptic+engine: codex+model: gpt-5.1-codex+round: cross+stance: "the position that this is not worth the migration cost"+elapsed_ms: 41200+---+```++Markdown, one file per turn, is deliberate: diffable, quotable, greppable, and re-runnable. A room is+a folder you can commit, and a decision six months later can be re-opened with the original motion.++## The pane++Layout is where this harness lives or dies. A chat log destroys the comparison — you cannot see four+answers to one question by scrolling. So: **a matrix.**++- **Columns are seats**, headed by the engine icon (`desktop/assets/engine-icons/` already has+ claude, codex, grok, opencode, pi, hermes, copilot, …) with the stance under the name.+- **Rows are rounds.** Read across a row to compare four minds on one beat. Read down a column to+ follow one mind changing (or not).+- **A seat still thinking** is a pulsing cell. Seats finish at different speeds and the room should+ show that honestly rather than wait for the slowest.+- **The claim map** under the matrix: rows are claims the moderator extracted, cells are agree /+ disagree / silent per seat. This is the one screen a busy chair actually reads — solid green rows+ are settled, striped rows are the argument.+- **Read mode** flattens it to a linear transcript for reading end to end, and to paste into a doc.++**Viewer, v1:** no new viewer package. A `render.mjs` in the toolchain rebuilds `dist/index.html`+from the folder on every turn, and the manifest says `"viewer": { "use": "autonomous/web-viewer" }`.+That is a day of work against a viewer that already exists and already reloads on change. If the+matrix earns it, graduate to `autonomous/debate-viewer` later — the folder format does not change.++## The verdict++The contract fits this harness almost suspiciously well.++| Field | Roundtable |+|---|---|+| `phases` | Motion · Openings · Cross · Converge · Decision — the rounds, exactly what the strip is for |+| `ready` | a decision is written and every seated engine answered every called round |+| `summary` | `4 seats · 3 rounds · agreed on 5, split on 2` |+| `findings` | `info` per agreement; `warning` `kind: split` per unresolved disagreement, `ref` the claim; `error` `kind: seat_unavailable` when an engine is missing or timed out |+| `artifact` | `dist/index.html` |++Writing the verdict after every turn is what makes the pane move, which the spec asks for and this+harness gets for free — there is a turn landing every few seconds.++## Seat plumbing++One script, `toolchain/seat.mjs`, dispatches per engine. Verified on this machine:++| Engine | First turn | Later turns | Read-only |+|---|---|---|---|+| `claude` | `claude -p --session-id <uuid> --model <m> --append-system-prompt <stance>` | `claude -p --resume <uuid>` | `--allowedTools Read Grep Glob` |+| `codex` | `codex exec -m <m> -s read-only -C <evidence>` | `codex exec resume <id>` | `-s read-only` |+| `opencode`, `grok`, `pi`, `hermes` | their own run/exec form | best effort | best effort |++Three things make this reliable:++- **Per-seat session memory.** Each seat keeps its own session across rounds (`--resume`,+ `exec resume`), so it remembers its own position instead of being re-fed the whole transcript every+ round. Cheaper, and it makes a seat behave like a person who has been in the room the whole time.+- **Timeouts, and absence is not failure.** A seat that misses its window is marked absent for that+ round and the room continues. Never block four agents on one slow vendor.+- **Seat what is installed.** `doctor.sh` reports which engine CLIs exist on this machine; the+ moderator seats from that list and says out loud who could not attend. A machine with only Claude+ still gets a room — same engine, different stances — it is just a weaker room, and the pane should+ say so rather than pretend.++## The feature that makes it more than a parlour trick: put the codebase in the room++An optional `evidence` path — a repo, a folder, a set of files — that every seat can **read+independently** before it speaks.++> "Should the daemon's Windows port be native or WSL2?" with `evidence: cli/`++Now four different models each read the actual process model, and disagree about the actual code+rather than about the abstract question. That is not something you can get from asking one model+twice, and it is exactly the shape of decision this repo's user keeps facing — the Windows port, the+Superterminal chrome, the Solid move. This is the use case I would lead the store page with.++## Preset rooms++| Room | Seats | For |+|---|---|---|+| **Panel** (default) | N engines, no stance | "what do the models actually think" — the purest multi-perspective read |+| **Red team** | one proposal, N attackers with no mandate to be fair | before you ship the decision |+| **Trial** | advocate · opponent · judge (judge is a seat, not the moderator) | a binary call with a real cost either way |+| **Bake-off** | each seat *builds* the small thing and they are compared | later; needs write sandboxes per seat, worth its own design |++Keep engine and stance on separate axes and show both on the chip, so you can always tell whether a+split came from a different model or a different assigned role. Conflating them would quietly wreck+the one thing the harness is for.++## Honest risks++| Risk | What it does to the product | Answer |+|---|---|---|+| Sycophantic convergence | four voices agreeing; the harness is pointless | sealed parallel openings; every round asks explicitly where you disagree |+| Verbosity | 4 × 5 essays nobody reads | hard word cap per turn, enforced by the moderator and truncated in the render |+| False balance | a decision that averages four answers into mush | the decision picks, and names the dissent |+| Cost and latency | N × R model calls per room | parallel fan-out keeps wall-clock at R turns; show elapsed and, where the CLI reports it, tokens per seat; ship a "quick room" of 3 seats × 2 rounds as the default |+| Theatre | a debate that entertains and decides nothing | every room ends in `decision.md` with a falsifier per open split; `ready` is false until it exists |++## MVP++Tier 2. `engine: claude`, `viewer.use: autonomous/web-viewer`, up to 3 seats from installed engines,+3 rounds, `decision.md`, verdict with phases. Folder layout as above.++Two prompts to prove it on, both live questions in this repo:++- *"Should OpenHarness support Windows natively or through WSL2? Evidence: `cli/`, and+ `docs/research/`'s port assessment."*+- *"Is a bottom command-line the right chrome for Superterminal, or is it nostalgia?"*++If the matrix on those two rooms tells the chair something they did not already know, build the+dedicated viewer. If it does not, the protocol is wrong and no viewer will save it.++## Name++**Roundtable**, `autonomous/roundtable`, category "Debate", author Autonomous. Alternate: **Quorum**,+which reads better against a verdict that has to reach a decision. Both are first-party names, like+Autonomous Circuit — there is no upstream project to credit here, because this harness is the+protocol and the pane, and both are ours.++---++## What changed when it was built (September 20, 2026)++The package is `store/agents/roundtable/`. It passes `harness dsh check`, the store shelf test, and+15 tests of its own. Four things came out different from the design above, all for the same reason —+the design trusted prompts where the build could enforce behaviour:++- **The seal is a working directory, not an instruction.** A seat never runs with the workspace as+ its cwd; it runs in the evidence directory or an empty scratch directory that is deleted after.+ Telling a seat not to peek at the other turn files is a request. Not giving it the path is a fact.+- **Seats are stateless per round, with the peers' turns replayed into the prompt** — not+ `--resume`. Session resume works on Claude Code and Codex and is guesswork on the other four, and+ a seat that carries a session also carries whatever it read last round. Replay is uniform across+ every vendor and keeps the seal exact: what a seat knows is what the prompt was told to include.+- **A turn starts at its position.** Several CLIs narrate their research before answering. Honest,+ but in a matrix cell it pushes the answer below the fold, so the runner trims to the first heading.+- **Shape is enforced in the system prompt**, identical for every seat — `**Position.** / **Why.** /+ **Strongest case against me.** / **What would change my mind.**` That is what makes a row of the+ matrix readable across: four cells that all open the same way.++Installed and seatable on this machine: Claude Code (read-only tools), Codex (`-s read-only`),+OpenCode and Grok Build (best effort — their CLIs cannot restrict tools). Pi and Hermes have+adapters but no credentials, so they show as absent with the reason, which is the behaviour the+design asked for.++### The first real room, and the bug it found++Motion: *"Should the Windows port be native, or WSL2?"*, four seats, evidence: this repository.++Claude Code and Grok Build both answered well and **disagreed on the load-bearing question** — is the+daemon genuinely tmux-shaped? Claude read `terminalBackend.ts`, found the tmux-only parts are three+*optional* methods of an 18-method interface, and argued the real cost is POSIX process identity+(`ps -axo`, `lsof`, `/proc`), which a native port does not get from ConPTY. Grok read+`restoreAgents.ts`, pointed out it exists precisely because a new tmux server reissues pane ids, and+that Herdr already implemented `TerminalBackend` without `respawn`/`openStream` and was retired.+Neither saw the other's answer. That is the product working.++Codex and OpenCode both hit the 900-second timeout with nothing. Not a vendor failure: asked the same+open question with the whole monorepo as evidence, they kept reading. Codex answers a narrow question+about the same file in 17 seconds. So:++- **Seats now get a research budget in the system prompt** — about 70% of the round's timeout, with+ an explicit instruction to read the three or four files that decide it and skip `node_modules`.+- **The moderator is told to scope `--evidence` to the folder the question turns on**, not the repo.+- **`room run <round> --only <seat>` refills one cell** without disturbing the turns already filed.++The general lesson is worth keeping: in a panel, an unbounded research task does not produce a slow+answer, it produces **no answer**, and the seats that fail that way are not the weakest models — they+are the most thorough. A room has to hand out a budget with the question.diff --git a/store/agents/roundtable/AGENTS.md b/store/agents/roundtable/AGENTS.mdnew file mode 100644index 000000000..68acbfd43--- /dev/null+++ b/store/agents/roundtable/AGENTS.md@@ -0,0 +1,106 @@+# Roundtable — you are the moderator++You are Claude Code in a terminal that Harness opened for a **Roundtable** workspace. The person+you are talking to has a decision to make. Your job is not to answer it. Your job is to **put it to+a panel of coding agents from other vendors**, run the room so their disagreement is real and+visible, and hand back a call with the dissent still attached.++Next to this terminal, Harness has already opened the **viewer pane**. It watches this folder and+redraws `index.html` the moment anything changes: the motion, the phase strip, the claim map, and+the matrix — one column per seat, one row per round. The user watches the room fill there while you+work. You never start a viewer, never print a URL, never open a browser.++**You are the only writer.** The seats are headless subprocesses of other vendors' CLIs. They speak;+you file what they said. Never edit a turn file, never paraphrase a seat, never improve its wording.+If a seat said something weak, that is a fact about the room and it stays on the page.++## Where things are++- **This folder is the workspace.** `motion.md` is the question; `room.json` is the seating;+ `rounds/<n>-<round>/<seat>.md` is one turn each; `claims.json` is your tagging; `decision.md` is+ the call. `index.html` and `.harness/verdict.json` are generated — never edit them by hand.+- **The toolchain** is `$ROUNDTABLE_TOOLCHAIN`, used as `"$ROUNDTABLE_TOOLCHAIN/room" …`:++ | Command | What it does |+ |---|---|+ | `room seats` | which engine CLIs this machine can seat, and which are read-only |+ | `room open --motion "…" [--evidence a,b] [--word-cap 250]` | starts the room |+ | `room seat --id <name> --engine <engine> [--stance "…"] [--model m]` | adds a seat |+ | `room run opening\|cross\|converge [--timeout 600]` | runs every seat at once |+ | `room render` | rebuilds the pane and the verdict |+ | `room decide` | closes the room, after you have written `decision.md` |++ Every command re-renders the pane. Use them; never call `claude`, `codex` or any other engine+ yourself — `room run` is what keeps the openings sealed.++## The protocol, and why it is not negotiable++1. **Motion — inside the first minute.** Turn their message into `motion.md`: the decision in one+ line, the constraints that make it hard, and what would actually settle it. Infer, choose, write.+ Do not interview them first; a motion on the page is worth more than three clarifying questions,+ and they will correct it.+2. **Seat the panel.** Run `room seats`. Seat **at least two vendors** — a panel of one vendor is a+ mirror. Three or four is the good room. Say which engines could not be seated and why.+ Stances are optional: default to none (each seat says what it actually thinks). Assign stances+ only when the user wants a position stress-tested, and then say plainly in the pane that the+ stance was assigned, so nobody mistakes an assignment for a belief.+3. **One confirmation.** Show the motion and the seating in the chat, in four lines. Then run.+4. **Openings — sealed.** `room run opening`. No seat sees another; they run in parallel and cannot+ read this folder. **Point `--evidence` at the folder that decides the question, not at the whole+ repository** — a seat given a monorepo will read it until its timeout and answer nothing. The+ seats are told to time-box their research to about 70% of `--timeout`; give them 600s for a+ focused folder and say so if you widen it. This is the single rule the harness rests on: agents in a chat loop converge on+ whoever spoke first, politely, and you learn nothing. Never work around it.+5. **Tag the claims.** Read the openings and write `claims.json`: the handful of claims the room+ actually turns on, and how each seat voted on each. This is the ten-second view of the whole+ debate, and it is yours to get right — see the format below.+6. **Cross-examination.** `room run cross`. Each seat now reads the others and answers.+7. **The chair's turn — stop here.** Report what split the room, in five lines or fewer, and ask+ what they want pressed. Do not run convergence on your own initiative. This pause is the product:+ the user is the chair, and a room that runs to the end without them is a report, not a decision.+8. **Convergence.** `room run converge`, then update `claims.json`.+9. **The call.** Write `decision.md`: the recommendation, the reasoning, what it costs if it is+ wrong, and **the dissent under it by name** — "codex still holds that …, and would be right if …".+ Then `room decide`.++## The rules that keep this honest++- **A decision picks.** Never average four answers into a fifth mushy one. If the room genuinely+ split, say which way you would go and why, and leave the minority position standing with a name on+ it. A blended answer is worth less than any single seat's.+- **Never invent agreement.** If three seats agreed because the question was easy, say the question+ was easy. If they all missed something, say so as yourself — clearly marked as the moderator, not+ as a seat.+- **A seat that ran out of time is usually your fault, not its.** Too much evidence, or a motion so+ broad that reading is unbounded. Narrow the evidence and re-run that seat alone with+ `room run <round> --only <seat>`; the other seats' turns stay exactly as they were.+- **An absent seat is a fact, not an error to hide.** If an engine times out or is not logged in, the+ pane shows the empty cell and the reason. Tell the user which vendor is missing from the room.+- **Quote, don't summarise.** In the chat, quote the line that matters and point at the pane. The+ transcript is right there; retelling it is what makes this feel like a report instead of a room.+- **`ready` stays false until `decision.md` exists.** This harness is fun, and that is its failure+ mode: a debate that entertains and decides nothing. The verdict is the guardrail. Respect it.++## `claims.json`++```jsonc+{+ "claims": [+ { "id": "tmux-shaped",+ "text": "The daemon's process model is genuinely tmux-shaped, not incidentally so",+ "by": { "claude": "agree", "codex": "disagree", "opencode": "agree", "grok": "silent" } }+ ]+}+```++One line per claim, in the seats' own terms, never yours. `agree` / `disagree` / `silent` — and+`silent` is a real answer: a seat that never engaged with the claim did not agree with it. Five to+eight claims is right; twenty is a transcript, not a map.++## Talking to the user++Short. You are running a room, not narrating it. Announce the motion and the seating, then go quiet+while a round runs — it takes a few minutes and the pane is already showing them the wait. Come back+with what split the room, in their language, and the pane open at the claim map. When they press a+point, put it to the seats as a new round or a follow-up question; do not answer it yourself, unless+they ask you directly — then answer as the moderator, and say that is what you are doing.diff --git a/store/agents/roundtable/LICENSE b/store/agents/roundtable/LICENSEnew file mode 100644index 000000000..ca35940f2--- /dev/null+++ b/store/agents/roundtable/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 Autonomous (the Harness wrapper: harness.json, AGENTS.md, skills/, template/, toolchain/). Every panelist engine is the vendor’s own software, run through its published CLI.++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/store/agents/roundtable/README.md b/store/agents/roundtable/README.mdnew file mode 100644index 000000000..87b924b9d--- /dev/null+++ b/store/agents/roundtable/README.md@@ -0,0 +1,46 @@+# Roundtable, a Harness agent++[Harness](https://github.com/autonomous-ai/openharness) agent package for making a decision with a+**panel of coding agents from different vendors** instead of one. You state the question; Claude+Code, Codex, OpenCode and Grok Build research it independently, argue about what they found, and the+pane shows you where they agree and where they don't. Runs on Claude Code as the moderator.++- `harness.json` — engine, template, skill, toolchain, and the shared [Web Viewer](../../viewers/web-viewer/)+ for the pane.+- `AGENTS.md` — the moderator's instructions. It never argues; it frames the motion, seats the room,+ calls the rounds, tags the claims and writes the decision.+- `toolchain/room` — the room engine. `room seats` finds the vendor CLIs on this machine,+ `room run <round>` runs every seat at once, and every command rewrites the pane and the verdict.+- `toolchain/lib/engines.mjs` — one row per engine (`claude -p`, `codex exec -s read-only`,+ `opencode run`, `grok -p`, `pi --print`, `hermes -z`). Adding a vendor is adding a row.+- `toolchain/lib/render.mjs` — the pane: a matrix, columns are seats and rows are rounds, over a+ claim map that shows settled rows against split ones. One generated `index.html`, no CDN.+- `skills/roundtable/` — the craft: writing a motion, seating, the sealed-openings rule, the claim+ map, and a decision that picks and keeps its dissent.++## How it works++The panelists are **not** Harness sessions and never appear as tiles. They are headless subprocesses+of each vendor's own CLI, spawned by the moderator, run in parallel, read-only where the CLI can say+so, and — critically — run **outside the workspace**, so a sealed opening really is sealed. The+moderator is the only process that writes a file.++That is also why this package needs nothing from the app or the daemon: a harness may run whatever+it likes from its toolchain, and a panel of agents is just six CLIs and a renderer.++## Credit and stewardship++Every seat is another vendor's software, run unmodified through the command line interface they+publish: [Claude Code](https://claude.com/claude-code) (Anthropic), [Codex](https://openai.com/codex)+(OpenAI), [OpenCode](https://opencode.ai) (SST), [Grok Build](https://x.ai) (xAI),+[Pi](https://github.com/earendil-works) and [Hermes](https://nousresearch.com) (Nous Research).+Nothing of them is vendored here and nothing is changed; Roundtable only chooses the arguments and+files the answers. Each runs under its own licence and the user's own account, and a vendor that is+not installed or not signed in simply has no seat.++This folder — the manifest, the room engine, the pane, the skill, the moderator's instructions — is+the Harness package, written by Autonomous, MIT (`LICENSE`).++If you maintain one of these engines and want its adapter to work differently, open an issue on+[autonomous-ai/openharness](https://github.com/autonomous-ai/openharness); the adapter table is six+lines per vendor and yours to correct.diff --git a/store/agents/roundtable/harness.json b/store/agents/roundtable/harness.jsonnew file mode 100644index 000000000..59d012736--- /dev/null+++ b/store/agents/roundtable/harness.json@@ -0,0 +1,33 @@+{+ "spec": 1,+ "id": "autonomous/roundtable",+ "name": "Roundtable",+ "category": "Decisions",+ "author": "Autonomous",+ "description": "Put a decision to a panel of coding agents — Claude, Codex, Grok, more — who research it independently, argue it out, and hand you the call with the dissent still attached.",+ "engine": "claude",+ "workspace": {+ "template": "template",+ "marker": "room.json",+ "init": "toolchain/init-workspace.sh"+ },+ "agent": {+ "instructions": "AGENTS.md",+ "skills": [+ "skills"+ ],+ "env": {+ "ROUNDTABLE_TOOLCHAIN": "${dsh}/toolchain"+ }+ },+ "toolchain": {+ "setup": "toolchain/setup.sh",+ "doctor": "toolchain/doctor.sh"+ },+ "viewer": {+ "use": "autonomous/web-viewer",+ "url": "http://127.0.0.1:${port}/?file=index.html",+ "artifactExtensions": [".html"]+ },+ "verdict": ".harness/verdict.json"+}diff --git a/store/agents/roundtable/skills/roundtable/SKILL.md b/store/agents/roundtable/skills/roundtable/SKILL.mdnew file mode 100644index 000000000..9005b581d--- /dev/null+++ b/store/agents/roundtable/skills/roundtable/SKILL.md@@ -0,0 +1,111 @@+---+name: roundtable+description: Run a decision through a panel of coding agents from different vendors — writing the motion, seating the room, the sealed-openings protocol, tagging the claim map, pressing a split, and writing a decision that picks and keeps its dissent. Read before opening a room.+---++# roundtable++A room here is a **decision being made**, not a debate being staged. Four agents from four vendors+research the question independently, argue about what they found, and the person watching walks away+able to act. This skill is the craft of running that room. Read it once, then open one.++## 1. The motion++A motion is not the user's question repeated. It is the question made decidable. Three parts, and+all three go in `motion.md`:++- **The decision, in one line.** A real fork. "Should the Windows port be native, or WSL2?" is a+ motion. "Thoughts on Windows?" is a topic, and a topic produces four essays nobody reads.+- **The constraints that make it hard.** Who is doing the work, what already exists, what it costs+ to be wrong. This is where a room gets its teeth — without it every seat answers the generic+ version of the question and they all agree.+- **What would settle it.** Name the evidence that would end the argument. It tells the seats what+ to go and look for, and it tells you afterwards whether the room actually did the work.++If the user's first message has only part of this, write the rest yourself and let them correct it.+A motion on the page beats an interview.++**Point the room at evidence.** `--evidence <path>` gives every seat read access to the real thing —+the repository, the folder, the data. It is the difference between four models arguing about your+decision and four models arguing about decisions like yours. Use it whenever the subject is+something on disk.++**Scope the evidence tightly.** Hand a seat a whole monorepo and some engines will read it until the+timeout and answer nothing at all, while others skim four files and answer well — and you will have+learnt about their search strategies instead of about your decision. Name the folder the question+turns on. The seats are told to time-box their reading to roughly 70% of `--timeout`, but that only+works if the pile is finite.++## 2. Seating the room++| Preset | Seats | When |+|---|---|---|+| **Panel** (default) | 3–4 vendors, no stances | "what do they actually think" — nearly always the right room |+| **Red team** | one proposal in the motion, every seat told to break it | a decision you have already made and want attacked |+| **Trial** | two seats with opposed stances, one seat as judge | a binary call that costs real work either way |++Rules that matter more than the preset:++- **Two vendors minimum.** Three or four is the good room. Four seats of the same engine is a+ mirror with extra steps — if only one vendor is installed, say so plainly and run it anyway, but+ do not pretend it is a panel.+- **Stance ≠ engine.** They are separate axes. Keep them separate so that when the room splits you+ can tell whether the split came from a different model or from a role you assigned. If you assign+ stances, put that in the chat: an assigned position is not a belief.+- **Absent is fine.** A vendor that is not installed or not logged in shows as an empty cell with+ the reason. Never quietly drop it from the seating — the missing vendor is information.++## 3. The rounds++`room run opening` → `room run cross` → `room run converge`. All seats run **at once**, so a round+costs the slowest seat, not the sum. What each round asks for is already in the prompts; what you+control is when to stop.++**Openings are sealed.** Seats run outside the workspace and cannot read each other's files. This is+the load-bearing rule: in any shared-context loop these agents converge on whoever spoke first,+politely and fast, and four voices agreeing teaches nothing. If someone asks you to "let them+discuss it", explain what that costs and offer another round instead.++**Stop after cross-examination.** Report the split and ask the chair what to press. A room that runs+start to finish without the user is a report, and they could have got a report from one agent.++**Pressing a point** is a new round on a narrowed motion, not a private chat with one seat: amend+`motion.md` with what the chair wants settled, then run `cross` again. The pane keeps both passes.++## 4. The claim map++This is the artifact most people actually read, and it is yours. After the openings, write+`claims.json`: five to eight claims the room turns on, each in the seats' own words, each with a+vote per seat (`agree` / `disagree` / `silent`).++- **Extract, don't invent.** A claim must be traceable to a line someone wrote.+- **`silent` is a verdict.** A seat that never engaged did not agree. Marking silence as agreement is+ the fastest way to fake consensus.+- **Sharp beats fair.** "WSL2 users lose native file-watching performance" is a claim. "There are+ tradeoffs around performance" is not, and it will be `agree` from everyone, which tells the chair+ nothing.++Rows where everyone agrees are settled — the chair can stop thinking about them. Rows that split are+the decision. That contrast is the whole point of the table, so keep the claims at a grain where+both kinds appear.++## 5. The decision++`decision.md` has four parts and no more:++1. **The call.** One line. Pick. "Both have merit" is not a call.+2. **Why, in the room's terms.** Quote the seats. If you are relying on a claim only one seat made,+ say which seat and that it stood alone.+3. **What it costs if this is wrong**, and the earliest signal you would see.+4. **The dissent, by name.** "`codex` still holds that the daemon is only incidentally tmux-shaped,+ and would be right if `probeDsh` is the only place that scans panes." Never delete the losing+ argument; a decision you can reopen in six months is worth more than one that reads clean.++Then `room decide`. The verdict goes `ready` only when a decision exists and every seat answered+every round — a room that entertained and decided nothing is not done.++## 6. What a good room looks like from the chat++Four lines to open. Silence while a round runs. Then the split, quoted, with the pane pointed at.+Never retell the transcript — it is on screen beside you, and retelling it turns a room back into+the single-agent answer the user was trying to get away from.diff --git a/store/agents/roundtable/store.json b/store/agents/roundtable/store.jsonnew file mode 100644index 000000000..76491384f--- /dev/null+++ b/store/agents/roundtable/store.json@@ -0,0 +1,17 @@+{+ "license": "MIT",+ "examples": [+ {+ "prompt": "Should our Windows port be native, or should we ship the daemon inside WSL2? One engineer on it. Evidence: the cli/ folder.",+ "caption": "Four vendors read the daemon, split 2–2 on whether it is genuinely tmux-shaped"+ },+ {+ "prompt": "We're about to rename the product. Red-team the new name: three seats whose only job is to break it.",+ "caption": "Red team · one proposal, three attackers, the objections ranked"+ },+ {+ "prompt": "Postgres or SQLite for this app's local store? Evidence: this repo. I care about migrations and multi-process access.",+ "caption": "Panel · agreed on five claims, split on one, decided with the dissent attached"+ }+ ]+}diff --git a/store/agents/roundtable/template/motion.md b/store/agents/roundtable/template/motion.mdnew file mode 100644index 000000000..e42d833d0--- /dev/null+++ b/store/agents/roundtable/template/motion.md@@ -0,0 +1,4 @@+# The motion++The moderator writes this from your first message: the decision in one line, then the constraints+that make it hard, then what would actually settle it.diff --git a/store/agents/roundtable/template/room.json b/store/agents/roundtable/template/room.jsonnew file mode 100644index 000000000..ba6fb3061--- /dev/null+++ b/store/agents/roundtable/template/room.json@@ -0,0 +1,13 @@+{+ "spec": 1,+ "motion": "",+ "status": "seating",+ "evidence": [],+ "wordCap": 250,+ "rounds": [+ { "id": "opening", "name": "Openings", "state": "pending" },+ { "id": "cross", "name": "Cross-examination", "state": "pending" },+ { "id": "converge", "name": "Convergence", "state": "pending" }+ ],+ "seats": []+}diff --git a/store/agents/roundtable/toolchain/doctor.sh b/store/agents/roundtable/toolchain/doctor.shnew file mode 100755index 000000000..368a70588--- /dev/null+++ b/store/agents/roundtable/toolchain/doctor.sh@@ -0,0 +1,15 @@+#!/usr/bin/env bash+# exit 0 = ready. Roundtable is ready when there is a Node and at least two engines from different+# vendors: one seat is not a panel, it is a chat.+set -u; cd "$(dirname "$0")/.."; bad=0+# shellcheck source=runtimes.sh+. toolchain/runtimes.sh+if harness_node 18; then echo "ok node $(node --version)"; else bad=1; fi+if [ -f toolchain/room.mjs ] && [ -f toolchain/lib/render.mjs ]; then echo "ok room engine and pane renderer"; else echo "miss toolchain/ — the checkout is incomplete"; bad=1; fi+seats=$(node toolchain/room.mjs seats 2>/dev/null | grep -cE '^(claude|codex|opencode|grok|pi|hermes) ' || true)+case "${seats:-0}" in+ 0) echo "miss no engine CLIs on PATH — a room needs at least one seat (claude, codex, opencode, grok, pi, hermes)"; bad=1 ;;+ 1) echo "warn only one engine CLI on PATH — the panel will be one vendor arguing with itself" ;;+ *) echo "ok $seats engine CLIs on PATH (a seat still needs that vendor's own login)"; node toolchain/room.mjs seats 2>/dev/null | grep -E '^(claude|codex|opencode|grok|pi|hermes) ' | sed 's/^/ /' ;;+esac+exit $baddiff --git a/store/agents/roundtable/toolchain/init-workspace.sh b/store/agents/roundtable/toolchain/init-workspace.shnew file mode 100755index 000000000..fa5788fea--- /dev/null+++ b/store/agents/roundtable/toolchain/init-workspace.sh@@ -0,0 +1,7 @@+#!/usr/bin/env bash+# Runs once in a fresh workspace (cwd = the workspace): an empty room that already draws, so the pane+# has something to show before the first seat is filled.+set -euo pipefail+: "${HARNESS_DSH_DIR:?}"+mkdir -p .harness rounds+HARNESS_WORKSPACE="$PWD" "$HARNESS_DSH_DIR/toolchain/room" render >/dev/null 2>&1 || truediff --git a/store/agents/roundtable/toolchain/lib/engines.mjs b/store/agents/roundtable/toolchain/lib/engines.mjsnew file mode 100644index 000000000..1075e1a6d--- /dev/null+++ b/store/agents/roundtable/toolchain/lib/engines.mjs@@ -0,0 +1,72 @@+// The panelists. Each seat is one headless run of a vendor's own CLI — never a Harness session, never+// a tile. The moderator is the only process that writes to the workspace, so every adapter here is+// read-only where its CLI can say so, and speaks to stdout (or to a file the CLI is told to write).+//+// Adding an engine is adding a row. `build()` returns the argv after the binary and where the final+// answer lands; nothing else in the room knows one vendor from another.++/** Vendors decorate their stdout. Strip the decoration, never the answer. */+export const stripAnsi = (text) => String(text ?? '')+ .replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, '')+ .replace(/\u001b\][^\u0007]*\u0007/g, '')++export const ADAPTERS = {+ claude: {+ label: 'Claude Code', vendor: 'Anthropic', bin: 'claude', icon: 'claude',+ readOnly: 'tools restricted to Read, Grep, Glob, WebSearch, WebFetch',+ build({ system, prompt, model }) {+ const args = ['-p', prompt, '--append-system-prompt', system, '--output-format', 'text',+ '--allowedTools', 'Read', 'Grep', 'Glob', 'WebSearch', 'WebFetch']+ if (model) args.unshift('--model', model)+ return { args, capture: 'stdout' }+ },+ },+ codex: {+ label: 'Codex', vendor: 'OpenAI', bin: 'codex', icon: 'codex',+ readOnly: 'sandbox read-only',+ build({ system, prompt, model, outFile }) {+ const args = ['exec', '--skip-git-repo-check', '--color', 'never', '-s', 'read-only',+ '-o', outFile, `${system}\n\n---\n\n${prompt}`]+ if (model) args.splice(1, 0, '-m', model)+ return { args, capture: 'file' }+ },+ },+ opencode: {+ label: 'OpenCode', vendor: 'SST', bin: 'opencode', icon: 'opencode',+ readOnly: null,+ // `opencode run` prints a "> project · model" banner before the answer.+ clean: (text) => text.replace(/^>[^\n]*\n+/, '').trim(),+ build({ system, prompt, model }) {+ const args = ['run', `${system}\n\n---\n\n${prompt}`]+ if (model) args.splice(1, 0, '-m', model)+ return { args, capture: 'stdout' }+ },+ },+ grok: {+ label: 'Grok Build', vendor: 'xAI', bin: 'grok', icon: 'grok',+ readOnly: null,+ build({ system, prompt, model }) {+ const args = ['-p', `${system}\n\n---\n\n${prompt}`]+ if (model) args.unshift('--model', model)+ return { args, capture: 'stdout' }+ },+ },+ pi: {+ label: 'Pi', vendor: 'Parallel', bin: 'pi', icon: 'pi',+ readOnly: null,+ build({ system, prompt, model }) {+ const args = ['--print', `${system}\n\n---\n\n${prompt}`]+ if (model) args.unshift('--model', model)+ return { args, capture: 'stdout' }+ },+ },+ hermes: {+ label: 'Hermes', vendor: 'Nous Research', bin: 'hermes', icon: 'hermes',+ readOnly: null,+ build({ system, prompt }) {+ return { args: ['-z', `${system}\n\n---\n\n${prompt}`], capture: 'stdout' }+ },+ },+}++export const ENGINE_IDS = Object.keys(ADAPTERS)diff --git a/store/agents/roundtable/toolchain/lib/prompts.mjs b/store/agents/roundtable/toolchain/lib/prompts.mjsnew file mode 100644index 000000000..0745da5f0--- /dev/null+++ b/store/agents/roundtable/toolchain/lib/prompts.mjs@@ -0,0 +1,81 @@+// What a seat is told. Two jobs, and they are separate on purpose:+//+// system — who this seat is: its stance, its read access, and the house rules it shares with every+// other seat, so four answers come back in the same shape and a row of the matrix can be+// read across.+// prompt — the motion, the round, and (from cross-examination on) what the other seats said.+//+// The shape is the UX. Cells that all start with **Position.** can be compared at a glance; four+// essays in four different shapes cannot.++const SHAPES = {+ opening: [+ '**Position.** One sentence. A real answer — pick a side. No "it depends" without saying on what.',+ '**Why.** Up to three bullets, each concrete and specific to this decision, not to decisions in general.',+ '**Strongest case against me.** One line, argued honestly.',+ '**What would change my mind.** One line, and it must be something that could actually be observed.',+ ],+ cross: [+ '**Where they are wrong.** One line per seat, naming the seat. Quote the claim you are attacking.',+ '**What I concede.** One line. If you concede nothing, say so and say why that is not stubbornness.',+ '**Position now.** One sentence — restated, changed or unchanged. Say which.',+ ],+ converge: [+ '**Agreed.** The claims you now accept, as bullets.',+ '**Still refuse.** The claims you do not accept, as bullets, with the reason in the same line.',+ '**What would change my mind.** One line.',+ ],+}++/**+ * Where a turn really begins. Several CLIs narrate their research before answering ("I'll inspect+ * how tightly the daemon is bound to tmux…"). That is honest and it is not the turn — in a matrix+ * cell it pushes the position below the fold. The answer starts at its first heading.+ */+export const FIRST_MARKER = { opening: '**Position.', cross: '**Where they are wrong.', converge: '**Agreed.' }++export function trimToShape(body, roundId) {+ const at = String(body ?? '').indexOf(FIRST_MARKER[roundId] ?? '')+ return at > 0 ? body.slice(at).trim() : String(body ?? '').trim()+}++export function buildSystem(seat, room, roundId, budgetMinutes = 8) {+ const peers = room.seats.filter((s) => s.id !== seat.id).map((s) => `${s.id} (${s.engine})`)+ const lines = [+ `You are "${seat.id}", one seat on a panel of ${room.seats.length} AI agents from different vendors.`,+ peers.length ? `The other seats are: ${peers.join(', ')}. They are not you and do not share your training.` : '',+ seat.stance ? `Your assigned stance: ${seat.stance}. Argue it as well as it can honestly be argued — do not argue for it past the point where the evidence stops.` : 'You have no assigned stance. Say what you actually think.',+ '',+ 'You are advising one person who has to make this decision and live with it. They are technical. They do not need the question restated, a summary of both sides, or encouragement. They need your judgement and the reasoning under it.',+ '',+ 'House rules, and they are enforced:',+ `- At most ${room.wordCap} words. Under is better. A long answer is a weak answer here.`,+ '- Use exactly these headings, in this order, and write nothing outside them:',+ ...SHAPES[roundId].map((line) => ` ${line}`),+ '- Be specific. Name the file, the number, the failure mode. "Consider the tradeoffs" is not a contribution.',+ '- Disagreement is the product. If you find yourself agreeing with everything, you have not read closely enough.',+ '- You are read-only. Do not write, edit or run anything that changes state. Research, then answer.',+ `- Time-box the research to about ${budgetMinutes} minutes, then answer with what you have. Read the three or four files that decide the question — not the tree. Skip node_modules, dist, build output and lockfiles. An answer grounded in four files beats a survey that never arrives.`,+ ]+ return lines.filter(Boolean).join('\n')+}++export function buildPrompt(seat, room, round, { motionText, peerTurns, ownTurns }) {+ const parts = [`# The motion\n\n${motionText.trim()}`]+ if (room.evidence?.length) {+ parts.push(`# Evidence you may read\n\n${room.evidence.map((p) => `- ${p}`).join('\n')}\n\nRead what you need from these before answering. You may also search the web. Say what you read.`)+ }+ // A seat is a fresh process every round, so its own position has to be handed back to it. Without+ // this a seat contradicts itself in cross-examination and the room reads like four strangers.+ if (ownTurns?.length) {+ parts.push('# What you said earlier, in your own words\n\n' + ownTurns+ .map((t) => `## Your ${t.roundName}\n\n${t.body.trim()}`).join('\n\n')+ + '\n\nThis is your position. Hold it or change it deliberately, and say which.')+ }+ if (peerTurns?.length) {+ parts.push('# What the other seats said\n\n' + peerTurns+ .map((t) => `## ${t.seatId} (${t.front.engine}) — ${t.roundName}\n\n${t.body.trim()}`).join('\n\n'))+ }+ parts.push(`# Your turn: ${round.name}\n\n${round.instruction}`)+ return parts.join('\n\n')+}diff --git a/store/agents/roundtable/toolchain/lib/render.mjs b/store/agents/roundtable/toolchain/lib/render.mjsnew file mode 100644index 000000000..0f5dad33b--- /dev/null+++ b/store/agents/roundtable/toolchain/lib/render.mjs@@ -0,0 +1,224 @@+// The pane. One self-contained page, rewritten after every turn, served by the shared Web Viewer —+// which reloads it the moment the file changes, so the room fills in front of the user.+//+// The layout is the argument for this harness: columns are seats, rows are rounds. Read ACROSS a row+// to compare four minds on one beat; read DOWN a column to watch one mind hold or move. A chat log+// cannot do either, which is why this is not a chat log.++import { writeFileSync } from 'node:fs'+import { join } from 'node:path'+import { ADAPTERS } from './engines.mjs'+import { trimToShape } from './prompts.mjs'+import { PROTOCOL, WORKSPACE, decision, motion, readClaims, readRoom, readTurn } from './room.mjs'++const ENGINE_HUE = { claude: 18, codex: 220, opencode: 268, grok: 0, pi: 150, hermes: 44 }+const esc = (s) => String(s ?? '').replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]))++/** Just enough markdown for a turn: headings, bold, code, bullets, paragraphs. No dependencies. */+function md(text) {+ const inline = (s) => esc(s)+ .replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')+ .replace(/(^|[\s(])\*([^*\n]+)\*/g, '$1<em>$2</em>')+ .replace(/`([^`]+)`/g, '<code>$1</code>')+ const out = []+ let list = null+ for (const raw of String(text ?? '').split('\n')) {+ const line = raw.trimEnd()+ const bullet = /^\s*[-*]\s+(.*)$/.exec(line)+ const heading = /^(#{1,6})\s+(.*)$/.exec(line)+ if (bullet) { list ??= []; list.push(inline(bullet[1])); continue }+ if (list) { out.push(`<ul>${list.map((i) => `<li>${i}</li>`).join('')}</ul>`); list = null }+ if (!line) continue+ if (heading) out.push(`<h4>${inline(heading[2])}</h4>`)+ else out.push(`<p>${inline(line)}</p>`)+ }+ if (list) out.push(`<ul>${list.map((i) => `<li>${i}</li>`).join('')}</ul>`)+ return out.join('\n')+}++const seconds = (ms) => (!ms ? '' : ms < 1000 ? `${ms}ms` : ms < 60_000 ? `${(ms / 1000).toFixed(0)}s` : `${Math.floor(ms / 60_000)}m ${Math.round((ms % 60_000) / 1000)}s`)++function seatHead(seat) {+ const adapter = ADAPTERS[seat.engine] ?? { label: seat.engine, vendor: '' }+ const hue = ENGINE_HUE[seat.engine] ?? 210+ return `<div class="seat" style="--hue:${hue}">+ <div class="seat-top"><span class="chip">${esc(seat.engine.slice(0, 2).toUpperCase())}</span>+ <div><div class="seat-name">${esc(seat.id)}</div>+ <div class="seat-engine">${esc(adapter.label)}${adapter.vendor ? ` · ${esc(adapter.vendor)}` : ''}</div></div></div>+ ${seat.stance ? `<div class="stance">${esc(seat.stance)}</div>` : '<div class="stance none">no assigned stance</div>'}+ </div>`+}++function cell(roundId, seat) {+ const turn = readTurn(roundId, seat.id)+ if (!turn) return '<div class="cell empty"><span>—</span></div>'+ const state = turn.front.state ?? 'answered'+ if (state === 'thinking') {+ return `<div class="cell thinking"><div class="bar"></div><div class="bar"></div><div class="bar short"></div>+ <div class="cell-foot">thinking…</div></div>`+ }+ if (state === 'absent') {+ return `<div class="cell absent"><p class="why">No answer.</p><p class="why dim">${esc(turn.front.error ?? '')}</p></div>`+ }+ return `<div class="cell" tabindex="0" role="button" aria-expanded="false"><div class="turn">${md(trimToShape(turn.body, roundId))}</div>+ <div class="fade"></div>+ <div class="cell-foot"><span class="more">more</span>${esc(seconds(Number(turn.front.elapsed_ms)))}${turn.front.model && turn.front.model !== 'default' ? ` · ${esc(turn.front.model)}` : ''}</div></div>`+}++function claimsTable(room, claims) {+ if (!claims.length) return ''+ const mark = { agree: '<span class="m yes">✓</span>', disagree: '<span class="m no">✗</span>', silent: '<span class="m dim">—</span>' }+ const rows = claims.map((claim) => {+ const votes = room.seats.map((s) => claim.by?.[s.id] ?? 'silent')+ const settled = votes.every((v) => v === 'agree')+ const split = votes.includes('agree') && votes.includes('disagree')+ return `<tr class="${settled ? 'settled' : split ? 'split' : ''}">+ <td class="claim">${esc(claim.text)}</td>+ ${votes.map((v) => `<td>${mark[v] ?? mark.silent}</td>`).join('')}+ <td class="verdictcol">${settled ? 'settled' : split ? 'split' : 'open'}</td></tr>`+ }).join('')+ return `<section class="claims"><h2>Where they agree, and where they don't</h2>+ <table><thead><tr><th>Claim</th>${room.seats.map((s) => `<th class="seatcol">${esc(s.id)}</th>`).join('')}<th></th></tr></thead>+ <tbody>${rows}</tbody></table></section>`+}++function phaseStrip(room) {+ const phases = [...room.rounds, { id: 'decision', name: 'Decision', state: room.status === 'decided' ? 'done' : 'pending' }]+ return `<div class="phases">${phases.map((p) => `<span class="phase ${p.state}">${esc(p.name)}</span>`).join('<i></i>')}</div>`+}++function readView(room) {+ const blocks = []+ for (const round of PROTOCOL) {+ const turns = room.seats.map((s) => ({ seat: s, turn: readTurn(round.id, s.id) })).filter((t) => t.turn?.body?.trim())+ if (!turns.length) continue+ blocks.push(`<h2 class="readround">${esc(round.name)}</h2>`)+ for (const { seat, turn } of turns) {+ blocks.push(`<article class="readturn" style="--hue:${ENGINE_HUE[seat.engine] ?? 210}">+ <header><span class="chip">${esc(seat.engine.slice(0, 2).toUpperCase())}</span><b>${esc(seat.id)}</b>+ <span class="dim">${esc(ADAPTERS[seat.engine]?.label ?? seat.engine)}</span></header>${md(trimToShape(turn.body, round.id))}</article>`)+ }+ }+ return blocks.join('\n')+}++export function renderHtml() {+ const room = readRoom()+ const { claims } = readClaims()+ const motionText = motion().replace(/^#.*\n/, '').trim()+ const call = decision()+ const answered = PROTOCOL.flatMap((r) => room.seats.map((s) => readTurn(r.id, s.id))).filter((t) => t?.front?.state === 'answered').length+ const cols = `160px repeat(${Math.max(room.seats.length, 1)}, minmax(220px, 1fr))`++ return `<!doctype html>+<html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">+<title>${esc(room.motion || 'Roundtable')}</title>+<style>+:root{color-scheme:light dark;--bg:light-dark(#fbfbfa,#161615);--fg:light-dark(#1b1b19,#eceae4);--dim:light-dark(#6b6a65,#9a9892);+--line:light-dark(#e2e0da,#2e2e2b);--card:light-dark(#fff,#1e1e1c);--accent:light-dark(#b8552a,#e08a5a);+--yes:light-dark(#2f7d4f,#63c48c);--no:light-dark(#b23b3b,#e8756f);font-family:ui-sans-serif,-apple-system,"SF Pro Text",system-ui,sans-serif}+*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg);font-size:13.5px;line-height:1.5}+header.top{position:sticky;top:0;z-index:5;background:var(--bg);border-bottom:1px solid var(--line);padding:14px 20px 10px}+.label{font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--accent);font-weight:600}+h1{font-size:19px;line-height:1.3;margin:4px 0 10px;font-weight:600;max-width:70ch}+.meta{display:flex;align-items:center;gap:14px;flex-wrap:wrap}+.phases{display:flex;align-items:center;gap:7px;font-size:11px}+.phases i{width:14px;height:1px;background:var(--line)}+.phase{color:var(--dim)}.phase.done{color:var(--fg)}.phase.done::before{content:"● "}+.phase.active{color:var(--accent);font-weight:600}.phase.active::before{content:"◐ "}.phase.pending::before{content:"○ "}+.count{margin-left:auto;font-size:11px;color:var(--dim)}+.views{display:flex;gap:2px;background:light-dark(#efeee9,#232321);border-radius:7px;padding:2px}+.views button{font:inherit;font-size:11.5px;border:0;background:transparent;color:var(--dim);padding:3px 11px;border-radius:5px;cursor:pointer}+.views button[aria-pressed=true]{background:var(--card);color:var(--fg);box-shadow:0 1px 2px #0002}+main{padding:16px 20px 60px}+.call{background:var(--card);border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:8px;padding:14px 18px;margin-bottom:18px}+.call h2{font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--accent);margin:0 0 6px}+.claims{margin-bottom:22px}+.claims h2,.grid-title{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);margin:0 0 8px;font-weight:600}+table{border-collapse:collapse;width:100%;font-size:12.5px}+th,td{text-align:left;padding:7px 10px;border-bottom:1px solid var(--line);vertical-align:top}+th{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--dim);font-weight:600}+th.seatcol,td:not(.claim):not(.verdictcol){text-align:center;width:74px}+tr.settled td.claim{color:var(--dim)}tr.split{background:light-dark(#fff8f0,#26211c)}+.verdictcol{font-size:10.5px;color:var(--dim);text-transform:uppercase;letter-spacing:.06em;width:60px}+.m.yes{color:var(--yes)}.m.no{color:var(--no)}.m.dim{color:var(--dim)}+.grid{display:grid;grid-template-columns:${cols};gap:1px;background:var(--line);border:1px solid var(--line);border-radius:8px;overflow:hidden}+.grid>*{background:var(--bg)}+.corner{background:var(--bg)}+.seat{padding:10px 12px;background:var(--card)}+.seat-top{display:flex;gap:8px;align-items:center}+.chip{display:grid;place-items:center;width:20px;height:20px;border-radius:5px;font-size:9.5px;font-weight:700;letter-spacing:.02em;+background:oklch(.72 .13 var(--hue));color:#111;flex:none}+.seat-name{font-weight:600;font-size:12.5px}.seat-engine{font-size:10.5px;color:var(--dim)}+.stance{margin-top:7px;font-size:11px;color:var(--dim);line-height:1.35}.stance.none{font-style:italic;opacity:.7}+.rowhead{padding:12px;background:var(--card);font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--dim);font-weight:600}+.cell{position:relative;padding:11px 13px 30px;max-height:340px;overflow:hidden;font-size:12.5px;cursor:pointer}+.cell.open{max-height:none;cursor:default}+.cell:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}+.cell .fade{position:absolute;left:0;right:0;bottom:26px;height:46px;pointer-events:none;+background:linear-gradient(transparent,var(--bg))}+.cell.open .fade{display:none}+.cell:not(.clipped) .fade,.cell:not(.clipped) .more{display:none}+.more{border:1px solid var(--line);border-radius:4px;padding:0 5px;margin-right:7px;color:var(--accent)}+.cell.open .more::after{content:"less"}.cell.open .more{font-size:0}.cell.open .more::after{font-size:10px}+.cell.empty{display:grid;place-items:center;color:var(--line);min-height:70px}+.cell.absent .why{color:var(--dim);font-size:11.5px}.cell.absent .why.dim{opacity:.7;font-size:10.5px}+.turn h4{font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--accent);margin:12px 0 3px}+.turn p,.readturn p{margin:0 0 7px}.turn strong,.readturn strong{font-weight:650}+.turn ul,.readturn ul{margin:0 0 8px;padding-left:16px}.turn li,.readturn li{margin:0 0 3px}+.turn p strong:first-child{color:var(--accent)}+.cell-foot{position:absolute;left:0;right:0;bottom:0;background:var(--bg);display:flex;align-items:center;+font-size:10px;color:var(--dim);border-top:1px solid var(--line);padding:5px 13px 6px}+.cell.thinking{display:flex;flex-direction:column;gap:7px;justify-content:center;min-height:90px}+.bar{height:7px;border-radius:4px;background:var(--line);animation:pulse 1.4s ease-in-out infinite}+.bar.short{width:55%}@keyframes pulse{0%,100%{opacity:.35}50%{opacity:.9}}+code{font-family:ui-monospace,SFMono-Regular,monospace;font-size:.92em;background:light-dark(#f0efe9,#262623);padding:1px 4px;border-radius:4px}+#read{display:none;max-width:74ch}#read.on{display:block}.grid.off,.claims.off{display:none}+.readround{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);margin:26px 0 10px}+.readturn{border-left:2px solid oklch(.72 .13 var(--hue));padding:2px 0 2px 14px;margin-bottom:18px}+.readturn header{display:flex;gap:8px;align-items:center;margin-bottom:6px;font-size:12px}+.dim{color:var(--dim)}+.empty-room{color:var(--dim);padding:40px 0;text-align:center}+</style>+<header class="top">+ <div class="label">Roundtable${room.status === 'decided' ? ' · decided' : ''}</div>+ <h1>${esc(room.motion || 'No motion yet')}</h1>+ <div class="meta">${phaseStrip(room)}+ <div class="views"><button id="b-matrix" aria-pressed="true">Matrix</button><button id="b-read" aria-pressed="false">Read</button></div>+ <span class="count">${room.seats.length} seats · ${answered} turns${room.evidence?.length ? ` · evidence: ${esc(room.evidence.map((e) => e.split('/').pop()).join(', '))}` : ''}</span>+ </div>+</header>+<main>+ ${call ? `<section class="call"><h2>The call</h2>${md(call.replace(/^#\s+.*\n/, ''))}</section>` : ''}+ ${claimsTable(room, claims)}+ ${room.seats.length ? `<div class="grid-title">The room</div>+ <div class="grid">+ <div class="corner"></div>+ ${room.seats.map(seatHead).join('')}+ ${PROTOCOL.map((round) => `<div class="rowhead">${esc(round.name)}</div>${room.seats.map((s) => cell(round.id, s)).join('')}`).join('')}+ </div>` : '<div class="empty-room">No seats yet. The moderator is still setting the room.</div>'}+ ${motionText ? `<details style="margin-top:22px"><summary class="grid-title" style="cursor:pointer">The motion in full</summary><div style="max-width:74ch;margin-top:8px">${md(motionText)}</div></details>` : ''}+ <div id="read">${readView(room)}</div>+</main>+<script>+for(const cell of document.querySelectorAll('.cell[role=button]')){+ const turn=cell.querySelector('.turn');+ if(turn.scrollHeight>cell.clientHeight-30)cell.classList.add('clipped');+ cell.addEventListener('click',()=>{const open=cell.classList.toggle('open');cell.setAttribute('aria-expanded',open)});+}+const grid=document.querySelector('.grid'),claims=document.querySelector('.claims'),read=document.getElementById('read');+const set=(mode)=>{document.getElementById('b-matrix').setAttribute('aria-pressed',mode==='matrix');+ document.getElementById('b-read').setAttribute('aria-pressed',mode==='read');+ grid&&grid.classList.toggle('off',mode==='read');claims&&claims.classList.toggle('off',mode==='read');+ read.classList.toggle('on',mode==='read');try{localStorage.setItem('rt-view',mode)}catch{}};+document.getElementById('b-matrix').onclick=()=>set('matrix');document.getElementById('b-read').onclick=()=>set('read');+try{set(localStorage.getItem('rt-view')||'matrix')}catch{set('matrix')}+</script>+</html>`+}++export function writeIndex() {+ const html = renderHtml()+ writeFileSync(join(WORKSPACE, 'index.html'), html)+ return html.length+}diff --git a/store/agents/roundtable/toolchain/lib/room.mjs b/store/agents/roundtable/toolchain/lib/room.mjsnew file mode 100644index 000000000..95bb19eff--- /dev/null+++ b/store/agents/roundtable/toolchain/lib/room.mjs@@ -0,0 +1,98 @@+// The room's state on disk. One writer — this process, run by the moderator — so every mutation is a+// read-modify-write of room.json and a turn file beside it. Markdown turns with front matter are+// deliberate: a room is a folder you can commit, grep, quote and re-open six months later.++import { mkdirSync, readFileSync, writeFileSync, existsSync, readdirSync } from 'node:fs'+import { join } from 'node:path'++export const WORKSPACE = process.env.HARNESS_WORKSPACE || process.cwd()+export const ROOM_FILE = join(WORKSPACE, 'room.json')+export const MOTION_FILE = join(WORKSPACE, 'motion.md')+export const CLAIMS_FILE = join(WORKSPACE, 'claims.json')+export const DECISION_FILE = join(WORKSPACE, 'decision.md')++/** The protocol. Sealed openings first — the one rule the whole harness rests on. */+export const PROTOCOL = [+ { id: 'opening', name: 'Openings', peers: false,+ instruction: 'Answer the motion cold. You are the first voice; nobody else has spoken.' },+ { id: 'cross', name: 'Cross-examination', peers: true,+ instruction: 'The other seats have now answered. Say where each is wrong, what they missed, and what you concede.' },+ { id: 'converge', name: 'Convergence', peers: true,+ instruction: 'State what you now agree with, what you still refuse, and the one piece of evidence that would change your mind.' },+]++const EMPTY = {+ spec: 1, motion: '', status: 'seating', evidence: [], wordCap: 250,+ rounds: PROTOCOL.map((r) => ({ id: r.id, name: r.name, state: 'pending' })),+ seats: [], startedAt: null, decidedAt: null,+}++export function readRoom() {+ if (!existsSync(ROOM_FILE)) return structuredClone(EMPTY)+ try { return { ...structuredClone(EMPTY), ...JSON.parse(readFileSync(ROOM_FILE, 'utf8')) } }+ catch { return structuredClone(EMPTY) }+}++export function writeRoom(room) {+ writeFileSync(ROOM_FILE, `${JSON.stringify(room, null, 2)}\n`)+ return room+}++export function readClaims() {+ if (!existsSync(CLAIMS_FILE)) return { claims: [] }+ try { return JSON.parse(readFileSync(CLAIMS_FILE, 'utf8')) } catch { return { claims: [] } }+}++export const roundDir = (roundId) => {+ const index = PROTOCOL.findIndex((r) => r.id === roundId)+ return join(WORKSPACE, 'rounds', `${index + 1}-${roundId}`)+}++export const turnPath = (roundId, seatId) => join(roundDir(roundId), `${seatId}.md`)++export function writeTurn(roundId, seat, { state, body, elapsedMs, error }) {+ mkdirSync(roundDir(roundId), { recursive: true })+ const front = [+ '---',+ `seat: ${seat.id}`,+ `engine: ${seat.engine}`,+ `model: ${seat.model ?? 'default'}`,+ `round: ${roundId}`,+ `state: ${state}`,+ `stance: ${JSON.stringify(seat.stance ?? '')}`,+ `elapsed_ms: ${Math.round(elapsedMs ?? 0)}`,+ error ? `error: ${JSON.stringify(String(error).slice(0, 400))}` : null,+ `at: ${new Date().toISOString()}`,+ '---', '',+ ].filter((line) => line !== null).join('\n')+ writeFileSync(turnPath(roundId, seat.id), front + (body ?? '') + '\n')+}++/** Parse a turn file back into { front, body }; the renderer and the peer packer both need it. */+export function readTurn(roundId, seatId) {+ const file = turnPath(roundId, seatId)+ if (!existsSync(file)) return null+ const text = readFileSync(file, 'utf8')+ const match = /^---\n([\s\S]*?)\n---\n?/.exec(text)+ if (!match) return { front: {}, body: text }+ const front = {}+ for (const line of match[1].split('\n')) {+ const at = line.indexOf(':')+ if (at < 0) continue+ const key = line.slice(0, at).trim()+ let value = line.slice(at + 1).trim()+ if (value.startsWith('"')) { try { value = JSON.parse(value) } catch { /* keep raw */ } }+ front[key] = value+ }+ return { front, body: text.slice(match[0].length) }+}++export function roundTurns(roundId) {+ const dir = roundDir(roundId)+ if (!existsSync(dir)) return []+ return readdirSync(dir).filter((f) => f.endsWith('.md'))+ .map((f) => ({ seatId: f.slice(0, -3), ...readTurn(roundId, f.slice(0, -3)) }))+}++export const decision = () => (existsSync(DECISION_FILE) ? readFileSync(DECISION_FILE, 'utf8') : null)+export const motion = () => (existsSync(MOTION_FILE) ? readFileSync(MOTION_FILE, 'utf8') : '')diff --git a/store/agents/roundtable/toolchain/lib/run.mjs b/store/agents/roundtable/toolchain/lib/run.mjsnew file mode 100644index 000000000..82247b7e5--- /dev/null+++ b/store/agents/roundtable/toolchain/lib/run.mjs@@ -0,0 +1,95 @@+// Running the seats. All of them at once, each with its own timeout, none of them able to see the+// room.+//+// That last part is not a detail: a sealed opening is only sealed if the seat cannot read the other+// seats' turn files. So a seat never runs with the workspace as its working directory — it runs in+// the evidence directory, or in an empty scratch directory when there is no evidence. What it knows+// about its peers is exactly what the prompt was told to include, and nothing else.++import { spawn } from 'node:child_process'+import { mkdtempSync, mkdirSync } from 'node:fs'+import { readFile, rm } from 'node:fs/promises'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { ADAPTERS, stripAnsi } from './engines.mjs'+import { buildPrompt, buildSystem, trimToShape } from './prompts.mjs'+import { PROTOCOL, readTurn, roundDir, writeTurn } from './room.mjs'++export function binOnPath(bin) {+ const probe = spawn(process.platform === 'win32' ? 'where' : 'command', process.platform === 'win32' ? [bin] : ['-v', bin], { shell: true, stdio: 'ignore' })+ return new Promise((resolve) => probe.on('close', (code) => resolve(code === 0)))+}++export async function installedEngines() {+ const out = []+ for (const [id, adapter] of Object.entries(ADAPTERS)) {+ if (await binOnPath(adapter.bin)) out.push({ id, ...adapter })+ }+ return out+}++async function runOne(seat, room, round, { motionText, peerTurns, ownTurns, timeoutMs, onChange }) {+ const adapter = ADAPTERS[seat.engine]+ const started = Date.now()+ writeTurn(round.id, seat, { state: 'thinking', body: '', elapsedMs: 0 })+ onChange?.()++ const scratch = mkdtempSync(join(tmpdir(), 'roundtable-seat-'))+ const outFile = join(scratch, 'answer.md')+ const system = buildSystem(seat, room, round.id, Math.max(2, Math.round((timeoutMs / 60_000) * 0.7)))+ const prompt = buildPrompt(seat, room, round, { motionText, peerTurns, ownTurns })+ const { args, capture } = adapter.build({ system, prompt, model: seat.model, outFile })+ const cwd = room.evidence?.[0] || scratch++ let stdout = '', stderr = '', timedOut = false+ // `detached` puts the seat in its own process group. These CLIs shell out (`/bin/zsh -lc rg …`),+ // and killing only the CLI leaves those grandchildren holding the stdout pipe open — the round+ // then hangs well past its own timeout waiting for a close that never comes.+ const child = spawn(adapter.bin, args, { cwd, env: { ...process.env, NO_COLOR: '1' }, detached: true })+ child.stdout.on('data', (d) => { stdout += d })+ child.stderr.on('data', (d) => { stderr += d })+ const timer = setTimeout(() => {+ timedOut = true+ try { process.kill(-child.pid, 'SIGKILL') } catch { child.kill('SIGKILL') }+ }, timeoutMs)+ const code = await new Promise((resolve) => {+ child.on('error', () => resolve(-1))+ child.on('close', (c) => resolve(c))+ })+ clearTimeout(timer)++ let body = stripAnsi(stdout).trim()+ if (capture === 'file') { try { body = stripAnsi(await readFile(outFile, 'utf8')).trim() } catch { /* fall back to stdout */ } }+ if (adapter.clean) body = adapter.clean(body)+ body = trimToShape(body, round.id)+ await rm(scratch, { recursive: true, force: true })++ const elapsedMs = Date.now() - started+ if (timedOut) {+ writeTurn(round.id, seat, { state: 'absent', body: '', elapsedMs, error: `no answer within ${Math.round(timeoutMs / 1000)}s` })+ } else if (code !== 0 || !body) {+ writeTurn(round.id, seat, { state: 'absent', body: '', elapsedMs, error: stderr.trim().slice(-400) || `${adapter.bin} exited ${code} with no answer` })+ } else {+ writeTurn(round.id, seat, { state: 'answered', body, elapsedMs })+ }+ onChange?.()+ return { seat: seat.id, state: timedOut || code !== 0 || !body ? 'absent' : 'answered', elapsedMs }+}++/** One round: every seat at once. Wall clock is the slowest seat, not the sum. */+export async function runRound(room, round, { motionText, timeoutMs = 600_000, onChange, only }) {+ mkdirSync(roundDir(round.id), { recursive: true })+ const seats = room.seats.filter((s) => !only || only.includes(s.id))+ // Everything already on the record, from every earlier round: the seat's own turns so it can hold+ // its position, and the peers' so it has something to answer.+ const earlier = PROTOCOL.slice(0, PROTOCOL.findIndex((r) => r.id === round.id))+ const turnsOf = (seatId) => earlier+ .map((r) => ({ seatId, roundName: r.name, ...(readTurn(r.id, seatId) ?? {}) }))+ .filter((t) => t.body && t.front?.state === 'answered')+ const peerTurnsFor = (seat) => (round.peers+ ? room.seats.filter((s) => s.id !== seat.id).flatMap((s) => turnsOf(s.id))+ : [])+ return Promise.all(seats.map((seat) => runOne(seat, room, round, {+ motionText, peerTurns: peerTurnsFor(seat), ownTurns: turnsOf(seat.id), timeoutMs, onChange,+ })))+}diff --git a/store/agents/roundtable/toolchain/lib/verdict.mjs b/store/agents/roundtable/toolchain/lib/verdict.mjsnew file mode 100644index 000000000..2d156b21f--- /dev/null+++ b/store/agents/roundtable/toolchain/lib/verdict.mjs@@ -0,0 +1,66 @@+// The verdict, which is what the app's header reads. Written after every turn, not at the end: the+// spec asks for a feed, and this harness produces one naturally — a turn lands every few seconds.+//+// `ready` is the guardrail against the failure mode of this whole idea. A room that was interesting+// and decided nothing is not ready, however good the transcript reads.++import { mkdirSync, writeFileSync } from 'node:fs'+import { join } from 'node:path'+import { PROTOCOL, WORKSPACE, decision, readClaims, readRoom, readTurn } from './room.mjs'++export function writeVerdict() {+ const room = readRoom()+ const { claims } = readClaims()+ const call = decision()+ const seats = room.seats ?? []++ const findings = []+ let answered = 0, absent = 0+ for (const round of PROTOCOL) {+ for (const seat of seats) {+ const turn = readTurn(round.id, seat.id)+ if (!turn) continue+ if (turn.front.state === 'answered') answered += 1+ if (turn.front.state === 'absent') {+ absent += 1+ findings.push({ severity: 'error', kind: 'seat_unavailable', ref: `${seat.id}/${round.id}`,+ message: `${seat.id} (${seat.engine}) did not answer the ${round.name.toLowerCase()}: ${turn.front.error ?? 'no answer'}` })+ }+ }+ }++ let settled = 0, split = 0+ for (const claim of claims) {+ const votes = seats.map((s) => claim.by?.[s.id] ?? 'silent')+ if (votes.length && votes.every((v) => v === 'agree')) {+ settled += 1+ findings.push({ severity: 'info', kind: 'agreed', ref: claim.id ?? undefined, message: `Every seat agrees: ${claim.text}` })+ } else if (votes.includes('agree') && votes.includes('disagree')) {+ split += 1+ findings.push({ severity: 'warning', kind: 'split', ref: claim.id ?? undefined,+ message: `Unresolved: ${claim.text} — ${seats.filter((s) => claim.by?.[s.id] === 'agree').map((s) => s.id).join(', ') || 'none'} for, ${seats.filter((s) => claim.by?.[s.id] === 'disagree').map((s) => s.id).join(', ') || 'none'} against` })+ }+ }++ const everySeatSpoke = seats.length > 0 && PROTOCOL.every((round) =>+ seats.every((seat) => readTurn(round.id, seat.id)?.front?.state === 'answered'))+ const ready = Boolean(call) && everySeatSpoke++ const phases = [+ ...(room.rounds ?? []).map((r) => ({ id: r.id, name: r.name, state: r.state ?? 'pending' })),+ { id: 'decision', name: 'Decision', state: call ? 'done' : room.status === 'deciding' ? 'active' : 'pending' },+ ]++ const summary = !seats.length ? 'Setting the room'+ : !call ? `${seats.length} seats · ${answered} turns${split ? ` · ${split} open splits` : ''}${absent ? ` · ${absent} absent` : ''}`+ : `Decided · ${seats.length} seats · agreed on ${settled}, split on ${split}`++ const verdict = {+ spec: 1, ready, summary, findings, phases,+ artifact: 'index.html',+ updatedAt: new Date().toISOString(),+ }+ mkdirSync(join(WORKSPACE, '.harness'), { recursive: true })+ writeFileSync(join(WORKSPACE, '.harness', 'verdict.json'), `${JSON.stringify(verdict, null, 2)}\n`)+ return verdict+}diff --git a/store/agents/roundtable/toolchain/package.json b/store/agents/roundtable/toolchain/package.jsonnew file mode 100644index 000000000..7eede6dd1--- /dev/null+++ b/store/agents/roundtable/toolchain/package.json@@ -0,0 +1,9 @@+{+ "name": "roundtable-toolchain",+ "private": true,+ "type": "module",+ "description": "The room engine and the pane. No dependencies: the panel is the vendor CLIs the user already has.",+ "scripts": {+ "test": "node --test test/*.test.mjs"+ }+}diff --git a/store/agents/roundtable/toolchain/room b/store/agents/roundtable/toolchain/roomnew file mode 100755index 000000000..cdf4f9efc--- /dev/null+++ b/store/agents/roundtable/toolchain/room@@ -0,0 +1,8 @@+#!/usr/bin/env bash+# `"$ROUNDTABLE_TOOLCHAIN/room" …` — room.mjs on this machine's node, or on the Node Harness itself+# runs on when the agent's shell has none on PATH.+here="$(cd "$(dirname "$0")" && pwd)"+# shellcheck source=runtimes.sh+. "$here/runtimes.sh"+harness_node 18 || exit 1+exec node "$here/room.mjs" "$@"diff --git a/store/agents/roundtable/toolchain/room.mjs b/store/agents/roundtable/toolchain/room.mjsnew file mode 100644index 000000000..c247f884e--- /dev/null+++ b/store/agents/roundtable/toolchain/room.mjs@@ -0,0 +1,119 @@+#!/usr/bin/env node+// `room` — everything the moderator does to the room. The moderator is the only writer; the seats+// only speak. Every command re-renders the pane and rewrites the verdict, so the user watching the+// viewer sees the room fill in rather than a finished transcript appearing at the end.+//+// room seats which engines this machine can seat+// room open --motion "…" [--evidence a,b] start a room+// room seat --id x --engine codex [--stance …] add a seat+// room run <opening|cross|converge> [--timeout 600]+// room render rebuild index.html + verdict+// room decide close the room (after writing decision.md)++import { existsSync, writeFileSync } from 'node:fs'+import { resolve } from 'node:path'+import { ADAPTERS } from './lib/engines.mjs'+import { installedEngines } from './lib/run.mjs'+import { runRound } from './lib/run.mjs'+import { writeIndex } from './lib/render.mjs'+import { writeVerdict } from './lib/verdict.mjs'+import {+ DECISION_FILE, MOTION_FILE, PROTOCOL, WORKSPACE, motion, readRoom, writeRoom,+} from './lib/room.mjs'++const argv = process.argv.slice(2)+const command = argv[0]+const flag = (name, fallback = null) => {+ const at = argv.indexOf(`--${name}`)+ return at >= 0 && argv[at + 1] && !argv[at + 1].startsWith('--') ? argv[at + 1] : fallback+}+const die = (message) => { console.error(message); process.exit(1) }+const refresh = () => { writeIndex(); return writeVerdict() }++if (command === 'seats') {+ const found = await installedEngines()+ if (!found.length) die('No engine CLIs on PATH. A room needs at least one seat.')+ for (const engine of found) {+ console.log(`${engine.id.padEnd(10)} ${engine.label.padEnd(14)} ${engine.vendor.padEnd(14)} ${engine.readOnly ? `read-only (${engine.readOnly})` : 'best effort'}`)+ }+ console.log(`\n${found.length} engines available. Seat at least 2 from different vendors, or the room is a mirror.`)+ process.exit(0)+}++if (command === 'open') {+ const text = flag('motion') ?? die('room open --motion "the question"')+ const room = readRoom()+ room.motion = text.split('\n')[0].slice(0, 160)+ room.status = 'running'+ room.startedAt = new Date().toISOString()+ room.evidence = (flag('evidence') ?? '').split(',').filter(Boolean).map((p) => resolve(WORKSPACE, p))+ room.wordCap = Number(flag('word-cap', '250'))+ for (const path of room.evidence) if (!existsSync(path)) die(`evidence not found: ${path}`)+ if (!existsSync(MOTION_FILE) || motion().trim().startsWith('# The motion')) {+ writeFileSync(MOTION_FILE, `# ${room.motion}\n\n${text}\n`)+ }+ writeRoom(room)+ refresh()+ console.log(`Room open: ${room.motion}`)+ process.exit(0)+}++if (command === 'seat') {+ const id = flag('id') ?? die('room seat --id <name> --engine <engine>')+ const engine = flag('engine') ?? die('room seat --id <name> --engine <engine>')+ if (!ADAPTERS[engine]) die(`unknown engine "${engine}" — one of: ${Object.keys(ADAPTERS).join(', ')}`)+ const available = await installedEngines()+ if (!available.some((e) => e.id === engine)) die(`${engine} is not installed on this machine (looked for "${ADAPTERS[engine].bin}" on PATH). Seat it elsewhere or leave it empty and say so.`)+ const room = readRoom()+ if (room.seats.some((s) => s.id === id)) die(`seat "${id}" is already at the table`)+ room.seats.push({ id, engine, model: flag('model'), stance: flag('stance'), state: 'ready' })+ writeRoom(room)+ refresh()+ console.log(`Seated ${id} (${ADAPTERS[engine].label})`)+ process.exit(0)+}++if (command === 'run') {+ const roundId = argv[1]+ const index = PROTOCOL.findIndex((r) => r.id === roundId)+ if (index < 0) die(`unknown round "${roundId}" — one of: ${PROTOCOL.map((r) => r.id).join(', ')}`)+ const room = readRoom()+ if (!room.seats.length) die('no seats — `room seat --id … --engine …` first')+ const round = { ...PROTOCOL[index], previousId: index > 0 ? PROTOCOL[index - 1].id : null }+ room.rounds = room.rounds.map((r) => (r.id === roundId ? { ...r, state: 'active' } : r))+ writeRoom(room)+ refresh()++ const only = flag('only') ? flag('only').split(',') : null+ const started = Date.now()+ console.log(`${round.name}: ${room.seats.length} seats, in parallel${round.peers ? ', each reading the others' : ', sealed — no seat sees another'}…`)+ const results = await runRound(room, round, {+ motionText: motion(), timeoutMs: Number(flag('timeout', '600')) * 1000,+ only, onChange: refresh,+ })++ const fresh = readRoom()+ const allIn = results.every((r) => r.state === 'answered')+ fresh.rounds = fresh.rounds.map((r) => (r.id === roundId ? { ...r, state: allIn ? 'done' : 'failed' } : r))+ writeRoom(fresh)+ const verdict = refresh()+ for (const r of results) console.log(` ${r.state === 'answered' ? 'ok ' : 'miss'} ${r.seat.padEnd(14)} ${Math.round(r.elapsedMs / 1000)}s`)+ console.log(`${round.name} done in ${Math.round((Date.now() - started) / 1000)}s · ${verdict.summary}`)+ process.exit(0)+}++if (command === 'decide') {+ if (!existsSync(DECISION_FILE)) die('write decision.md first — the call, and the dissent under it by name')+ const room = readRoom()+ room.status = 'decided'+ room.decidedAt = new Date().toISOString()+ writeRoom(room)+ const verdict = refresh()+ console.log(verdict.ready ? `Decided · ${verdict.summary}` : `Decision written, but not ready: ${verdict.findings.filter((f) => f.severity === 'error').length} seats never answered.`)+ process.exit(0)+}++if (command === 'render') { const v = refresh(); console.log(v.summary); process.exit(0) }++console.log(`room seats | open --motion … | seat --id … --engine … | run <${PROTOCOL.map((r) => r.id).join('|')}> | render | decide`)+process.exit(command ? 1 : 0)diff --git a/store/agents/roundtable/toolchain/runtimes.sh b/store/agents/roundtable/toolchain/runtimes.shnew file mode 100644index 000000000..7223c78dc--- /dev/null+++ b/store/agents/roundtable/toolchain/runtimes.sh@@ -0,0 +1,192 @@+# shellcheck shell=bash+# runtimes.sh — the interpreters a store package runs on, found on this machine or fetched, never+# asked of the person who pressed Get.+#+# Sourced (not run) by a package's setup, doctor and viewer scripts. A new Mac has Apple's Python 3.9,+# no Homebrew and, for most people, no Node on PATH; a package that answers "brew install [email protected]"+# has failed its install. So:+#+# harness_node 18 node >= 18 on PATH, with npm: the machine's own, else the Node Harness+# itself runs on (~/.harness/runtime/current-node, laid down with the CLI)+# harness_uv uv on PATH: the machine's own, else a pinned, checksummed release+# fetched into ~/.harness/runtime+# harness_venv DIR 3.12 [MIN [BELOW]]+# DIR is a venv on CPython 3.12, which uv downloads when the machine+# has none. A venv already there on a Python in [MIN, BELOW) is kept.+# harness_pip DIR PKG… install into that venv, through uv+# harness_micromamba micromamba, pinned and checksummed, for native libraries PyPI has+# no wheel for (pycairo on macOS)+# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages+#+# Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).+#+# ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package+# carries an identical copy (a package installs alone, so it cannot reach this one);+# `node store/tools/sync-runtimes.mjs` rewrites them and the CLI's store spec fails when one drifts.++HARNESS_RUNTIME="${ADAPTER_RUNTIME_DIR:-${HOME:-}/.harness/runtime}"+# The Pythons uv downloads live with Harness's other runtimes, not in uv's own ~/.local/share/uv:+# a package's venv points at its interpreter, and `uv python uninstall` there must not break it.+UV_PYTHON_INSTALL_DIR="${UV_PYTHON_INSTALL_DIR:-$HARNESS_RUNTIME/python}"+export UV_PYTHON_INSTALL_DIR+HARNESS_UV_VERSION=0.12.15+HARNESS_MICROMAMBA_VERSION=2.9.0-0++_harness_platform() {+ case "$(uname -s)-$(uname -m)" in+ Darwin-arm64) echo darwin-arm64 ;;+ Darwin-x86_64) echo darwin-x64 ;;+ Linux-x86_64) echo linux-x64 ;;+ Linux-aarch64 | Linux-arm64) echo linux-arm64 ;;+ *) return 1 ;;+ esac+}++_harness_sha256() {+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | cut -d' ' -f1+ else sha256sum "$1" | cut -d' ' -f1; fi+}++# _harness_fetch URL DEST SHA256 — DEST exists only if what arrived matches the pinned checksum.+_harness_fetch() {+ local part="$2.part.$$"+ if ! curl -fsSL --retry 3 --connect-timeout 20 --max-time 900 -o "$part" "$1"; then+ rm -f "$part"; echo "miss could not download $1 — check this machine's internet connection"; return 1+ fi+ if [ "$(_harness_sha256 "$part")" != "$3" ]; then+ rm -f "$part"; echo "miss $1 did not match its pinned checksum; nothing was installed"; return 1+ fi+ mv -f "$part" "$2"+}++_harness_node_at_least() {+ command -v node >/dev/null 2>&1 || return 1+ node -e '+ const [a, b = 0] = process.argv[1].split(".").map(Number)+ const [x, y] = process.versions.node.split(".").map(Number)+ process.exit(x > a || (x === a && y >= b) ? 0 : 1)+ ' "$1" >/dev/null 2>&1+}++harness_node() {+ local min="${1:-18}" recorded saved="$PATH" own=0+ _harness_node_at_least "$min" && own=1+ # A node without npm beside it (a distro's nodejs package) cannot run a setup's `npm ci`.+ if [ "$own" = 1 ] && command -v npm >/dev/null 2>&1; then return 0; fi+ recorded="$(cat "$HARNESS_RUNTIME/current-node" 2>/dev/null || true)"+ # Already Harness's own (a second call, or a wrapper calling a script that asks again): nothing to add.+ if [ "$own" = 1 ] && [ -n "$recorded" ] && [ "$(command -v node)" = "${recorded%/*}/node" ]; then return 0; fi+ if [ -n "$recorded" ] && [ -x "${recorded%/*}/node" ]; then+ PATH="${recorded%/*}:$PATH"; export PATH; hash -r 2>/dev/null || true+ _harness_node_at_least "$min" && return 0+ PATH="$saved"; export PATH; hash -r 2>/dev/null || true+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min — this machine's newest is $("${recorded%/*}/node" -v), Harness's own; update Harness"+ return 1+ fi+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min, and Harness's own Node is not in $HARNESS_RUNTIME — run \`harness start\` once to lay it down"+ return 1+}++harness_uv() {+ local dir asset sum tmp+ command -v uv >/dev/null 2>&1 && return 0+ for dir in "${HOME:-}/.local/bin" "${HOME:-}/.cargo/bin"; do+ [ -n "${HOME:-}" ] || break+ if [ -x "$dir/uv" ]; then PATH="$dir:$PATH"; export PATH; return 0; fi+ done+ dir="$HARNESS_RUNTIME/uv-$HARNESS_UV_VERSION"+ if [ ! -x "$dir/uv" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=uv-aarch64-apple-darwin sum=dc304b9ed1b24174572290fba60ac3f6fe63c73a671f0439e62a91375841964d ;;+ darwin-x64) asset=uv-x86_64-apple-darwin sum=e9ca61775532368fe518ab03e7a354c7ecab8ccb3c7d941c775fcc4a362b801b ;;+ linux-x64) asset=uv-x86_64-unknown-linux-gnu sum=f97935763c04be3e692460a7aaeaaab8fc3b78fcf8b389da820b38ae7423a638 ;;+ linux-arm64) asset=uv-aarch64-unknown-linux-gnu sum=0e9a3499b0587d449c9ff684c0160da607826e4af1cee220bc87f378702d3e08 ;;+ *) echo "miss uv — there is no uv release for $(uname -s) $(uname -m); install it from https://docs.astral.sh/uv/"; return 1 ;;+ esac+ echo " fetching uv $HARNESS_UV_VERSION into $HARNESS_RUNTIME (it brings Python and the packages)"+ mkdir -p "$HARNESS_RUNTIME" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ tmp="$(mktemp -d "$HARNESS_RUNTIME/.uv.XXXXXX")" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ if ! _harness_fetch "https://github.com/astral-sh/uv/releases/download/$HARNESS_UV_VERSION/$asset.tar.gz" "$tmp/uv.tar.gz" "$sum"; then+ rm -rf "$tmp"; return 1+ fi+ tar -xzf "$tmp/uv.tar.gz" -C "$tmp" && chmod +x "$tmp/$asset/uv" "$tmp/$asset/uvx" \+ || { rm -rf "$tmp"; echo "miss the uv archive would not unpack"; return 1; }+ # Two installs at once both get here; whichever renames first wins and the other's copy goes.+ # (mv onto a directory that exists would nest the copy inside it, hence the test.)+ [ -e "$dir" ] || mv "$tmp/$asset" "$dir" 2>/dev/null || true+ rm -rf "$tmp"+ [ -x "$dir/uv" ] || { echo "miss uv did not land in $dir"; return 1; }+ fi+ PATH="$dir:$PATH"; export PATH+}++# harness_venv DIR VERSION [MIN [BELOW]] — MIN defaults to VERSION; BELOW is exclusive and optional.+harness_venv() {+ local dir="${1:?harness_venv needs a directory}" want="${2:?harness_venv needs a Python version}"+ local min="${3:-$2}" below="${4:-}"+ if [ -x "$dir/bin/python" ] && "$dir/bin/python" -c '+import sys+at = lambda s: tuple(int(p) for p in s.split("."))+v = sys.version_info[:2]+sys.exit(0 if v >= at(sys.argv[1]) and (not sys.argv[2] or v < at(sys.argv[2])) else 1)+' "$min" "$below" 2>/dev/null; then+ echo "ok $("$dir/bin/python" --version) in $dir"+ return 0+ fi+ harness_uv || return 1+ echo " python $want in $dir (uv downloads it when this machine has none)"+ rm -rf "$dir"+ # only-managed: the same python-build-standalone interpreter on every machine, so a package tested+ # once is tested everywhere — not whichever Homebrew or pyenv Python happened to be first on PATH.+ uv venv --quiet --seed --python "$want" --python-preference only-managed "$dir" \+ || { echo "miss could not make a Python $want environment in $dir"; return 1; }+ echo "ok $("$dir/bin/python" --version) in $dir"+}++harness_pip() {+ local dir="${1:?harness_pip needs a venv}"+ shift+ harness_uv || return 1+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }+}++harness_micromamba() {+ local dir asset sum+ dir="$HARNESS_RUNTIME/micromamba-$HARNESS_MICROMAMBA_VERSION"+ if [ ! -x "$dir/micromamba" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=micromamba-osx-arm64 sum=ec2a072f028e1a7cf20f3e2e74d5a8127cf5a5f27636375b5359811565f4e5be ;;+ darwin-x64) asset=micromamba-osx-64 sum=1e71054bb3ac9a076e21f7ec48acfef536f9b3f1408f371a942784bf5ef83d8a ;;+ linux-x64) asset=micromamba-linux-64 sum=366cd9cd8be14df1ab8ed50352a82111082a36686b2d389fdb79a92c3fafb3e3 ;;+ linux-arm64) asset=micromamba-linux-aarch64 sum=9f93b974adcb4d166996af969b6cd371287d1a3e52733704727884d9b74cb7a7 ;;+ *) echo "miss micromamba — there is no release for $(uname -s) $(uname -m)"; return 1 ;;+ esac+ echo " fetching micromamba $HARNESS_MICROMAMBA_VERSION into $HARNESS_RUNTIME (native libraries PyPI has no wheel for)"+ mkdir -p "$dir" || { echo "miss cannot write $dir"; return 1; }+ _harness_fetch "https://github.com/mamba-org/micromamba-releases/releases/download/$HARNESS_MICROMAMBA_VERSION/$asset" "$dir/micromamba.$$" "$sum" || return 1+ chmod +x "$dir/micromamba.$$" && mv -f "$dir/micromamba.$$" "$dir/micromamba" \+ || { rm -f "$dir/micromamba.$$"; echo "miss micromamba would not install into $dir"; return 1; }+ fi+ HARNESS_MICROMAMBA="$dir/micromamba"+ export HARNESS_MICROMAMBA+}++# harness_conda_env DIR SPEC… — conda-forge only, packages cached under ~/.harness/runtime/mamba.+harness_conda_env() {+ local dir="${1:?harness_conda_env needs a directory}"+ shift+ # micromamba takes a relative --prefix as a name under its root prefix and "succeeds" there.+ case "$dir" in /*) ;; *) dir="$PWD/$dir" ;; esac+ harness_micromamba || return 1+ MAMBA_ROOT_PREFIX="$HARNESS_RUNTIME/mamba" "$HARNESS_MICROMAMBA" create --yes --quiet \+ --prefix "$dir" --override-channels --channel conda-forge "$@" >/dev/null \+ && [ -d "$dir/conda-meta" ] \+ || { echo "miss could not make the conda-forge environment in $dir ($*)"; return 1; }+}diff --git a/store/agents/roundtable/toolchain/setup.sh b/store/agents/roundtable/toolchain/setup.shnew file mode 100755index 000000000..1211a8838--- /dev/null+++ b/store/agents/roundtable/toolchain/setup.sh@@ -0,0 +1,16 @@+#!/usr/bin/env bash+# Runs once at install, cwd = the install dir. Roundtable has no dependencies to fetch: the panel is+# the coding-agent CLIs the user already has, and the pane is one generated HTML file. All this does+# is make sure there is a Node to render with, and say which engines could be seated today.+set -euo pipefail+cd "$(dirname "$0")/.."+# shellcheck source=runtimes.sh+. toolchain/runtimes.sh+harness_node 18 || exit 1+echo "ok node $(node --version) (the room engine and the pane)"+seats=$(node toolchain/room.mjs seats 2>/dev/null | grep -c . || true)+if [ "${seats:-0}" -gt 0 ]; then+ node toolchain/room.mjs seats | sed 's/^/ /'+else+ echo "warn no engine CLIs on PATH yet — install claude, codex, opencode, grok, pi or hermes to seat a panel"+fidiff --git a/store/agents/roundtable/toolchain/test/room.test.mjs b/store/agents/roundtable/toolchain/test/room.test.mjsnew file mode 100644index 000000000..ea75d451c--- /dev/null+++ b/store/agents/roundtable/toolchain/test/room.test.mjs@@ -0,0 +1,189 @@+// The room engine, tested where it is load-bearing: the seal, the shape of a turn, the claim map,+// and the one fact the app reads.+import { deepStrictEqual, match, ok, strictEqual } from 'node:assert/strict'+import { mkdtempSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { after, before, describe, it } from 'node:test'++const workspace = mkdtempSync(join(tmpdir(), 'roundtable-test-'))+process.env.HARNESS_WORKSPACE = workspace++const room = await import('../lib/room.mjs')+const { ADAPTERS, stripAnsi } = await import('../lib/engines.mjs')+const { buildPrompt, buildSystem } = await import('../lib/prompts.mjs')+const { renderHtml } = await import('../lib/render.mjs')+const { writeVerdict } = await import('../lib/verdict.mjs')++const SEATS = [+ { id: 'claude', engine: 'claude', stance: null },+ { id: 'codex', engine: 'codex', stance: 'the cheaper route is enough' },+]+const base = { spec: 1, motion: 'Native or WSL2?', status: 'running', evidence: [], wordCap: 220, seats: SEATS,+ rounds: room.PROTOCOL.map((r) => ({ id: r.id, name: r.name, state: 'pending' })) }++before(() => {+ writeFileSync(join(workspace, 'motion.md'), '# Native or WSL2?\n\nThe daemon is tmux-shaped.\n')+ room.writeRoom(base)+})++describe('turn files', () => {+ it('round-trips a turn through front matter', () => {+ room.writeTurn('opening', SEATS[1], { state: 'answered', body: '**Position.** Native.', elapsedMs: 1234 })+ const turn = room.readTurn('opening', 'codex')+ strictEqual(turn.front.engine, 'codex')+ strictEqual(turn.front.state, 'answered')+ strictEqual(turn.front.stance, 'the cheaper route is enough')+ strictEqual(turn.front.elapsed_ms, '1234')+ strictEqual(turn.body.trim(), '**Position.** Native.')+ })++ it('records an absent seat with its reason rather than dropping it', () => {+ room.writeTurn('opening', SEATS[0], { state: 'absent', body: '', elapsedMs: 900_000, error: 'no answer within 600s' })+ strictEqual(room.readTurn('opening', 'claude').front.state, 'absent')+ match(room.readTurn('opening', 'claude').front.error, /600s/)+ })+})++describe('what a seat is told', () => {+ const system = buildSystem(SEATS[0], base, 'opening')++ it('names the other vendors, the word cap and the shape', () => {+ match(system, /codex \(codex\)/)+ match(system, /At most 220 words/)+ match(system, /\*\*Position\.\*\*/)+ match(system, /read-only/)+ })++ it('seals the openings: no peer turns reach the first round', () => {+ const prompt = buildPrompt(SEATS[0], base, { ...room.PROTOCOL[0], peers: false }, { motionText: 'Native or WSL2?', peerTurns: [] })+ ok(!prompt.includes('What the other seats said'))+ })++ it('hands over the peers from cross-examination on', () => {+ const prompt = buildPrompt(SEATS[0], base, room.PROTOCOL[1], {+ motionText: 'Native or WSL2?',+ peerTurns: [{ seatId: 'codex', roundName: 'Openings', front: { engine: 'codex' }, body: '**Position.** WSL2.' }],+ })+ match(prompt, /What the other seats said/)+ match(prompt, /codex \(codex\)/)+ })+})++describe('engine adapters', () => {+ it('builds a read-only argv per vendor', () => {+ const claude = ADAPTERS.claude.build({ system: 'S', prompt: 'P', model: null })+ ok(claude.args.includes('--allowedTools') && !claude.args.includes('Write'))+ strictEqual(claude.capture, 'stdout')+ const codex = ADAPTERS.codex.build({ system: 'S', prompt: 'P', model: null, outFile: '/tmp/a.md' })+ ok(codex.args.includes('read-only'))+ strictEqual(codex.capture, 'file')+ })++ it('strips the decoration and keeps the answer', () => {+ strictEqual(stripAnsi('\u001b[0mOK\u001b[32m'), 'OK')+ strictEqual(ADAPTERS.opencode.clean('> build · some-model\n\n**Position.** Native.'), '**Position.** Native.')+ })+})++describe('the verdict', () => {+ it('is not ready while the room is still talking', () => {+ const verdict = writeVerdict()+ strictEqual(verdict.ready, false)+ strictEqual(verdict.artifact, 'index.html')+ ok(verdict.findings.some((f) => f.kind === 'seat_unavailable' && f.severity === 'error'))+ deepStrictEqual(verdict.phases.map((p) => p.name), ['Openings', 'Cross-examination', 'Convergence', 'Decision'])+ })++ it('turns a split claim into a warning and an agreed one into info', () => {+ writeFileSync(join(workspace, 'claims.json'), JSON.stringify({ claims: [+ { id: 'tmux', text: 'The daemon is tmux-shaped', by: { claude: 'agree', codex: 'disagree' } },+ { id: 'cost', text: 'A native port is a quarter', by: { claude: 'agree', codex: 'agree' } },+ ] }))+ const verdict = writeVerdict()+ ok(verdict.findings.some((f) => f.kind === 'split' && f.severity === 'warning' && /tmux-shaped/.test(f.message)))+ ok(verdict.findings.some((f) => f.kind === 'agreed' && f.severity === 'info'))+ })++ it('stays unready when a decision is written but a seat never spoke', () => {+ writeFileSync(join(workspace, 'decision.md'), '# The call\n\nWSL2 first.\n')+ room.writeRoom({ ...base, status: 'decided' })+ strictEqual(writeVerdict().ready, false)+ })++ it('is ready only when every seat answered every round and the call is written', () => {+ for (const round of room.PROTOCOL) {+ for (const seat of SEATS) room.writeTurn(round.id, seat, { state: 'answered', body: '**Position.** Yes.', elapsedMs: 10 })+ }+ const verdict = writeVerdict()+ strictEqual(verdict.ready, true)+ match(verdict.summary, /^Decided/)+ })+})++describe('the pane', () => {+ it('draws a column per seat, a row per round, and the claim map', () => {+ const html = renderHtml()+ match(html, /grid-template-columns:160px repeat\(2/)+ for (const name of ['Openings', 'Cross-examination', 'Convergence']) match(html, new RegExp(name))+ match(html, /The daemon is tmux-shaped/)+ match(html, /class="m no"/) // the split+ match(html, /class="m yes"/) // the agreement+ match(html, /The call/)+ })++ it('shows an empty room rather than a broken one', () => {+ room.writeRoom({ ...base, seats: [], status: 'seating' })+ match(renderHtml(), /No seats yet/)+ room.writeRoom(base)+ })++ it('never lets a turn inject markup into the pane', () => {+ room.writeTurn('opening', SEATS[0], { state: 'answered', body: '<img src=x onerror=alert(1)>', elapsedMs: 5 })+ ok(!renderHtml().includes('<img src=x'))+ match(renderHtml(), /<img src=x/)+ })+})++after(() => { /* tmpdir is the OS's to clean */ })++describe('a turn starts at its position', () => {+ it('drops the research narration some CLIs print before the answer', async () => {+ const { trimToShape } = await import('../lib/prompts.mjs')+ strictEqual(trimToShape("I'll inspect the daemon first.**Position.** WSL2.", 'opening'), '**Position.** WSL2.')+ strictEqual(trimToShape('**Position.** Native.', 'opening'), '**Position.** Native.')+ strictEqual(trimToShape('no shape at all', 'opening'), 'no shape at all')+ })+})++describe('a seat is a fresh process every round', () => {+ it('is handed its own earlier turn back, marked as its own', () => {+ const prompt = buildPrompt(SEATS[0], base, room.PROTOCOL[1], {+ motionText: 'Native or WSL2?',+ ownTurns: [{ roundName: 'Openings', body: '**Position.** Native.' }],+ peerTurns: [{ seatId: 'codex', roundName: 'Openings', front: { engine: 'codex' }, body: '**Position.** WSL2.' }],+ })+ match(prompt, /What you said earlier/)+ match(prompt, /This is your position/)+ match(prompt, /codex \(codex\) — Openings/)+ ok(prompt.indexOf('What you said earlier') < prompt.indexOf('What the other seats said'))+ })+})++describe('a seat that overruns', () => {+ it('is killed as a process group, so a shelling-out CLI cannot outlive its round', async () => {+ const { runRound } = await import('../lib/run.mjs')+ const slow = { ...base, seats: [{ id: 'slow', engine: 'claude', stance: null }] }+ const { ADAPTERS } = await import('../lib/engines.mjs')+ const real = ADAPTERS.claude.build+ // A "CLI" that shells out to something long-lived and then waits on it.+ ADAPTERS.claude.build = () => ({ args: ['-c', 'sleep 120 & sleep 120'], capture: 'stdout' })+ ADAPTERS.claude.bin = 'sh'+ const started = Date.now()+ const [result] = await runRound(slow, { ...room.PROTOCOL[0], previousId: null }, { motionText: 'x', timeoutMs: 1500 })+ ADAPTERS.claude.build = real; ADAPTERS.claude.bin = 'claude'+ strictEqual(result.state, 'absent')+ ok(Date.now() - started < 20_000, 'the round ended with the timeout, not with the grandchild')+ match(room.readTurn('opening', 'slow').front.error, /within 2s/)+ })+})