Skip to content

feat(brainstorm): divergent style - #290

Open
cukas wants to merge 4 commits into
mainfrom
feat/brainstorm-divergent-style
Open

feat(brainstorm): divergent style#290
cukas wants to merge 4 commits into
mainfrom
feat/brainstorm-divergent-style

Conversation

@cukas

@cukas cukas commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

No description provided.

KERN-Agon and others added 4 commits August 12, 2026 10:01
Brainstorm was architecturally the most convergent multi-engine mode:
every seat got an identical prompt, qualityScore rewarded file-grounded
concreteness, and the synthesis prompt collapsed all drafts into one
'specific and actionable' answer. Over-specified inbound questions from
orchestrators then anchored the whole panel on the stated framing.

- style option on runBrainstorm: 'divergent' (new default) | 'grounded'
  (previous behavior); --style flag on the CLI command
- divergent seats get distinct stances (anchor/contrarian/first-principles/
  outsider/expansionist/wildcard) via the system prompt, shuffled per run
  so no engine is systematically stuck with a low-scoring stance (Glicko
  stays unbiased); the protocol draft prompt stays byte-identical so the
  draft-block output contract is undisturbed
- seats are told to treat the question's framing as a hypothesis about
  the underlying problem, not a hard constraint
- structuralScore drops the keyFiles reward in divergent style so
  reframing drafts are not buried by winner selection
- divergent synthesis presents 2-3 distinct directions (at least one
  challenging the framing) and still closes with a single recommendation
  so downstream automation keeps one decidable answer
- scout path (runScout) is untouched: no style passed, grounded scoring

⚔️ Forged by [Agon](https://github.com/KERNlang/agon)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: agon (KERN) <noreply@kernlang.dev>
Review consensus (minimax) flagged that the divergent default shipped
with only the structuralScore math asserted. Adds fake-adapter coverage:
assignStances assigns all six distinct stances and cycles on larger
panels; divergent seats carry distinct stances in the system prompt
while the protocol draft prompt stays byte-identical and stance-free;
grounded/absent style keeps the plain instruction; runBrainstorm routes
the synthesis prompt by style (divergent keeps distinct directions plus
one closing recommendation, grounded restores the convergent prompt).

⚔️ Forged by [Agon](https://github.com/KERNlang/agon)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: agon (KERN) <noreply@kernlang.dev>
Root-caused the long-standing 'claude returns "I'll quickly verify..."
instead of the answer' flakiness. Claude exec dispatches route through
the stream-json companion (--max-turns 1): when the model tries a tool,
the only turn ends at the tool call and the pre-tool preamble comes back
as a successful answer. Two adjacent defects fixed alongside:

- companion stream-json silently DROPPED the caller's systemPrompt (only
  ACP/JSONRPC forwarded it) — brainstorm seat instructions ('do NOT use
  tools') and the new divergent stances never reached claude. New
  CompanionConfig.systemPromptFlag appends it to serverCmd
  (claude: --system-prompt).
- stripStreamJson concatenated assistant text blocks AND the final
  result event — duplicating one-turn answers and keeping multi-turn
  tool preambles. The result event is now authoritative; assistant
  texts remain the fallback for streams the result never closed
  (timeout kill, is_error/max-tokens truncation).

Fix mechanics:
- DispatchOptions.textOnly (opt-in, set by brainstorm seats + synthesis;
  never by agon ask/room work which may legitimately want tools) appends
  CompanionConfig.textOnlyArgs (claude: --tools '') so the model gets no
  tool definitions and the single turn is always the complete answer.
- Backstop: a stream-json exec turn that still ends on tool_use returns
  empty stdout (preamble preserved in stderr for diagnosability), so the
  adapter's existing empty-output fall-through retries via the plain CLI
  spawn (--max-turns 10), which can finish the tool loop; the fixed
  stripStreamJson then extracts the final answer from its result event.

Nero adversarial pass shaped the design: textOnly is per-dispatch opt-in
(not blanket exec), the backstop keeps the preamble in stderr, and the
result-event preference falls back to assistant texts on truncation.

⚔️ Forged by [Agon](https://github.com/KERNlang/agon)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: agon (KERN) <noreply@kernlang.dev>
Full-roster review (high risk: schema + shared dispatch contract) on
f50eca6 found one verified blocker and three consensus gaps, all fixed:

- BLOCKER (codex): CompanionConfigSchema omitted systemPromptFlag and
  textOnlyArgs, so Zod stripped both from registry-loaded claude.json
  and the new behavior was inactive at runtime. Schema extended;
  regression test asserts the fields survive validateEngineConfig, and
  a fresh-dist registry load was verified manually.
- tool_use backstop now covers review mode too (codex/zai/kimi/minimax
  consensus): review turns inherently want tools, so via the
  --max-turns 1 companion they hit the preamble truncation on nearly
  every dispatch; empty stdout now falls through to the CLI review
  path (--max-turns 50).
- textOnly extended to every dispatch whose system prompt already says
  'do NOT use tools': tribunal debates + verdict, council advisors +
  chair, nero critic, campfire, synthesis-modus drafts/improve/judge,
  thinking critique/steps (codex finding on tribunal, swept repo-wide).
- stripStreamJson: only a STRING result event is authoritative;
  non-string payloads keep the old stringify-into-parts behavior so an
  object result can never mask real assistant text (agy finding).
- systemPromptFlag argv append gated to the stream-json protocol —
  ACP/JSONRPC forward the system prompt in-band and must never get it
  twice (minimax finding).

⚔️ Forged by [Agon](https://github.com/KERNlang/agon)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: agon (KERN) <noreply@kernlang.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants