Automated decision workflow

Every multiple-choice question an agent raises is reviewed by two independent models and decided automatically, built on 3,101 tests at 100% coverage.

#Claude Code#AskUserQuestion#dual review#TDD#mutation testing#staged release
Dual-model decision arbiter hook

WorkflowDual-model decision arbiter hook

Agent operations Claude Code

A hook that, whenever Claude puts a multiple-choice question to the user mid-task, has two separate models answer it independently; it answers on the user's behalf only when they agree and hands everything else back. Getting there has taken 42 days so far: requirements in the user's own words, dual-model design review, a TDD plan, adversarial test review, mutation testing and on-device attestation.

Challenge

  • Without a person, agent questions stall the work; letting the agent answer itself risks irreversible choices
  • The hook intercepts every question, so one bug stalls every project: it has to be sturdier than ordinary code
  • Where to draw the line on questions an AI may answer only becomes clear by building it

Approach

  • Keep the requirements in the author's own words, confirm them one question at a time and record each decision as an ADR
  • Rewrite both the design and the TDD plan until two models, Codex and Claude, rate them READY
  • Another agent attacks the test matrix for wrong implementations that would still pass, and mutation testing must clear 80%

Outcome

  • 3,101 tests, 100% line and branch coverage, 94.37% mutation score (Release 0)
  • Registered in 56 projects, 55 of them in auto-answer mode
  • Yet it has answered only one question for real, a mechanism test; the over-strict rules are being redesigned now

AskUserQuestion is how a Claude Code agent asks a person to choose when it is unsure. ask-arbiter steps in just before the question, has Claude and Codex answer separately, and answers on the user's behalf only when they agree and the project is in auto-answer mode.

At run time that is five steps; making it safe to run was the real work. "The full workflow" below shows the ten development steps that have been running since 2026-10-03.

The full workflow

TaskWhoInputsOutputs
1. Record wordsAuthorauthor—Requirements
2. Outline designDesign agentFable / OpusRequirementsOutline design
3. Confirm eachAuthor + Choice-log hookauthor + askq_log.pyOutline designUse cases, ADR
4. Design reviewDual review + State scriptCodex + Claude + state.pyOutline design, Refers to Use cases, ADRReview record
5. TDD planTDD plannerplanner subagentReview recordTDD plan
6. Test matrixTest designer + adversarytest subagentsTDD planTest matrix
7. Red → greenImplementersubagentTest matrixCode + tests
8. Quality gatesGatekeepersauditor agentsCode + testsGate results
9. Final reviewFinal review + Deploy scriptreviewer + Codex + sync_toolchain.pyGate resultsApproval
10. Attest + liveAuthor + Arbiter CLIauthor + arbiter.pyApprovalModes + log
Dual-model decision arbiter hook

10 steps · 8 roles · 4 tools · 4 loops · 42 days since 2026-10-03 · 3,101 tests

Start from the author's own words, let another model attack the design, plan and tests, and delegate only what has been proven on the real machine.

  • Steps 1–4 decide what to build; steps 5–10 build it through six stages run by a team of TDD agents
  • Four loops: design review, mutation testing, final review and on-device attestation
  • The person decides only requirements, confirmations and the switch on the real machine; every other role is a separate agent
  • Not finished: Release 1 has not started its TDD plan, and Releases 2–4 have not begun

Project folders involved (5)

This workflow does not live in one folder: it runs across projects.

claude-infra/components/ask-arbiter
The core: design, plans, decision records (ADRs), tests and release runbooks
~/.claude/hooks/ask_arbiter
Deployed hook: runs in sessions of every project folder
~/.claude/skills/ask-arbiter
Skill for queries and switches: reviewing delegated answers, changing modes
~/.claude/skills/build-pipeline
Shared skill that runs requirement confirmation through dual design review
56 project folders
Registered folders, 55 of them in auto-answer mode; questions from private projects are never sent out
Record words

Step 1 · Author

Record wordsverbatim

Keep the requirements in the author's own words.

  • Paraphrasing shifts intent, so the input itself is saved word for word
  • Later additions are kept separately as dated addenda
  • Every later decision must trace back to these words

Common misconceptionKeep only a summary and you can never tell where the intent changed

OutputsRequirements
Outline design

Step 2 · Design agent

Outline designbuild-pipeline

Write the input list, the outline design and the baseline.

  • A strong reasoning model writes the design (Fable 5.1, later Opus 5.5)
  • The request is rewritten by a prompt-refining agent before it is handed over
  • Output: three files, input list, outline design and baseline
InputsRequirements
OutputsOutline design
Confirm each

Step 3 · Author + Choice-log hook

Confirm eachAskUserQuestion

Ask the author about each fork in the design, one question at a time.

  • Release 1 took 26 questions plus 4 follow-ups
  • Each answer writes one decision record (ADR) automatically
  • Every line of the summary and use cases traces back to the original words

Claude CodeThis is the only stop; after it, /goal runs the rest automatically

InputsOutline design
OutputsUse cases, ADR
Design review

Step 4 · Dual review + State script

Design reviewdual review

Revise until both Codex and Claude say READY.

  • The first development plan was READY on round 7; the Release 1 design needed 9 rounds for both reviewers
  • After four straight "major gaps" verdicts, the author changed course to break the cycle
  • When the revision budget ran out it stopped and handed back; the work resumed with a different model

Claude CodeA state script records each verdict and round, and refuses a pass that does not name both reviewers

InputsOutline design
OutputsReview record
Refers toUse cases, ADR
TDD plan

Step 5 · TDD planner

TDD planTDD plan

Split the work into items with acceptance criteria and test targets.

  • The first phase had 68 work items
  • The TDD plan is reviewed too: 9 versions, 10 review rounds
  • Nothing outside the plan gets built
InputsReview record
OutputsTDD plan
Test matrix

Step 6 · Test designer + adversary

Test matrixtest design

Write the test matrix, then let another agent attack it.

  • Six agents design tests in parallel
  • The adversary hunts for a wrong implementation that still passes everything: 24 gaps in the first round, then 21 and 9 more for Release 0
  • How each gap was handled is recorded as an ADR
InputsTDD plan
OutputsTest matrix
Red → green

Step 7 · Implementer

Red → greenimplement

One item at a time: see the test fail, then implement.

  • No implementation is accepted without a receipt proving the test went red first
  • Each implementer takes exactly one work item
  • Release 0 alone had 16 work items plus fixes
InputsTest matrix
OutputsCode + tests
Quality gates

Step 8 · Gatekeepers

Quality gatesgates

Pass two gates: coverage and mutation testing.

  • 100% line and branch coverage (Release 0: 11,412 lines, 3,726 branches)
  • Mutation score 94.37% across five modules, against an 80% gate
  • Surviving mutants are killed by adding tests (16 in one go, once)

Common misconception100% coverage means little if mutants survive: the tests are not checking anything

InputsCode + tests
OutputsGate results
Final review

Step 9 · Final review + Deploy script

Final reviewfinal review

Pass final review, then deploy by the runbook.

  • The first verdict was BLOCKED; with a second opinion from Codex it passed on round 3
  • Release 0 also went through three final reviews
  • A backup is always taken before deploying

Claude CodeDeployment goes through a sync script that sets the old files aside before overwriting

InputsGate results
OutputsApproval
Attest + live

Step 10 · Author + Arbiter CLI

Attest + liveattestation

Attest the runtime on the real machine, then delegate project by project.

  • Only 6 of 9 on-device probes passed, so part of the design was split off and rebuilt
  • A Claude Code update invalidated the attestation and every project fell back to asking the person
  • Delegated answers are reviewed via a skill; mark one wrong and that project falls back at once

Claude CodeEvery switch writes an ADR so it can always be rolled back

InputsApproval
OutputsModes + log

Loops and rework

  • Major gaps in design review → step 2: Rewrite and resubmit; the Release 1 design took 9 rounds
  • Mutants survive → step 7: Add tests that kill the surviving mutants
  • CHANGES REQUESTED in final review → step 7: Fix the findings, then review again
  • On-device probes fail → step 4: A redesign separating attestation from the resume feature was recorded as an ADR and went back through review

Key points

Hand reviewers a masked question. Options are reshuffled per reviewer, labels become meaningless two-character codes, and identifiers are masked before anything leaves the machine. If something looks like a credential, the whole question goes back to the person.

When in doubt, hand it back. If either reviewer fails, abstains, rates it high-risk or disagrees, or confidence is below 0.8, the person decides. In practice Codex abstained on 51 of the 75 questions sent.

Prove the running environment before delegating. Without matching policy and runtime fingerprints and five on-device probes, it will not answer. When a Claude Code update shifted the fingerprint, every project dropped back to asking the person automatically.