Skip to content

feat(multi-agent): route vendors on a benchmark trust model with trials - #18345

Merged
kyle-sexton merged 12 commits into
mainfrom
feat/multi-agent-vendor-routing-core
Nov 23, 2026
Merged

kyle-sexton merged 12 commits into
mainfrom
feat/multi-agent-vendor-routing-core

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

No related issue: Phases 2-4 of the owner-approved vendor-routing plan (PR-C1 of four).

Summary

/multi-agent:route vendors <task> now picks a vendor, model and effort per work type (coding,
web-ui, knowledge, image) from current, independent benchmark pages and from pairs proven on this
machine, and cites every source it read. No score, ranking or model name is stored in the
repository: the registry holds pointers, and every page is read live through the shared docs cache.

  • Phase 2, trust-model core:
    • reference/benchmarks.json: registry rows (pointers only), under a closed schema.
    • fetch-boards: reads the pages through the plugin's fetcher (--cache --public-only).
    • agents/board-reader.md: a Read-only agent that turns one page into closed-schema verdict
      records.
    • vendor-decide: counts sources by the trust model and prints the Decision JSON.
  • Phase 3, settings: one vendors block resolved through the user, team and personal layers. It
    holds the routing, trials and auto-delegation switches, the tiebreak, trial counts, per-vendor
    in_use and rank, and sources.<id>.enabled. A repository can add team rows in
    docs/conventions/multi-agent/benchmarks.json. Shipped defaults: routing on, trials off,
    auto-delegation off.
  • Phase 4, trial state: vendor-state records each reviewed result per machine. It writes one
    Outcome by exclusive create when a count threshold is crossed, refuses records after an Outcome,
    and returns a pair to trial only on send-back.

Fix

Trust boundary (page text is untrusted):

  • Only the Read-only board-reader sees page text. The route session never reads it.
  • vendor-decide takes source_id, page date and read state from the fetch manifest, never from
    the records. A record that claims another board's source_id is dropped.
  • A record for a vendor that is not a current candidate in --models abstains, so page text cannot
    route work to a vendor or model it names (regression test included).
  • Every record must match the closed VerdictRecord schema.

Verification

  • node --test over vendor-decide.test.mjs and vendor-state.test.mjs: 37 pass, 0 fail,
    covering each AC14 counting rule, AC2 consensus, AC3 ties and tiebreak, AC6 cache hit, AC7 stale
    and gone pages, AC9 no writes on routine runs, AC10 counts, AC11 routing off, a manifest-spoofing
    case and the two-writer threshold race.
  • resolve-roles.test.sh 131 cases and setup.test.sh 104 cases, 0 failed.
  • allowed-tools-pairing.test.sh passes, with every script granted bare under the skill directory.
  • No-model-names scan over the new and changed files: no matches.

Eval graders

  • No existing grader is loosened. The skill now prints the contract line exactly: nothing between
    the model id and @ (any note goes in the reason after basis:), and it says
    "external-agents is not installed" in those words. The base patterns stay as they were, and
    the note-form and "isn't" replies are fail samples.
  • stays-on-claude-default (in the new unread-page case): removed, because it could not fail.
    Fixture model ids never match a real candidate in the eval, so every record abstains whatever
    the unread handling does. The decision is covered by the AC7 tests in vendor-decide.test.mjs.
  • The routing-off negative grader no-vendor-recommendation is tighter: it also catches a
    recommendation line with a note after the id.

Related

  • Built by Antigravity from one brief per phase, then reviewed, fixed, tested and committed by
    Claude.

  • PR-A #18330 (external-agents
    harness facts and usage). PR-C2 (Phases 7-8) follows both.

  • vendor-decide is split into six modules under skills/route/scripts/lib/ by concern
    (arguments, inputs and schema validation, trust-model counting, trial state, Decision assembly,
    shared constants). The code was moved, not rewritten, and the tests are unchanged.

  • Eval runs (claude plugin eval, WSL2, one model):

    • ro-vendor-cites-sources (2 runs): VALID. Every with-arm run ran fetch-boards, dispatched
      board-reader, ran vendor-decide, and cited both boards.
    • ro-vendor-routing-off: VALID, every grader passed.
    • ro-vendor-everyday-default and ro-vendor-unread-page-abstains: VALID.
    • Every grader that failed had failed on the skill's output shape (a note between the model id
      and @, and "isn't installed"). The skill now prints the exact shape the graders check.
    • With one or two runs per case, the noise report reads "n too small to call", so no gain over
      the no-plugin baseline is claimed.

🤖 Generated with Claude Code

https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3

kyle-sexton and others added 4 commits November 22, 2026 23:02
`/multi-agent:route vendors` now picks a vendor, model and effort per
work type from current benchmark pages. The registry
(reference/benchmarks.json) holds pointers only. fetch-boards reads the
pages through the shared docs cache. A Read-only board-reader agent turns
each page into closed-schema verdict records. vendor-decide counts sources
by the trust model and prints the Decision JSON.

vendor-decide stamps source_id, page date and read state from the fetch
manifest, never from the records. A vendor that is not a current
candidate abstains, so page text cannot route work to a vendor or model
it names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
A `vendors` block in the multi-agent config holds the routing, trials and
auto_delegation switches, the tiebreak order, trial counts, per-vendor
in_use and rank, and sources.<id>.enabled. It resolves through the user,
team and personal layers. Shipped defaults: routing on, trials off,
auto_delegation off, no trial counts. resolve-roles and setup refuse
trials_fail below 2 and unknown tiebreak steps.

vendor-decide reads the resolved block. Routing off recommends nothing.
A vendor not in use is skipped silently, and one in use but unavailable
gets one note. Trials on without counts stays inactive with a note. A
repository's docs/conventions/multi-agent/benchmarks.json adds team rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
New skill script vendor-state keeps trial state in the plugin's data folder
(install path first, CLAUDE_PLUGIN_DATA only when named multi-agent-*).
`record` writes one file per reviewed result. When the accepted or
rejected count reaches trials_prove or trials_fail, it writes the Outcome
by exclusive create, so two sessions crossing the threshold produce one
Outcome, and deletes the trial notes. A record after an Outcome is
refused. `send-back` returns a proven pair to trial. `seen` reports new
model ids as a registry recheck. A pair is keyed by vendor, model,
version, effort and work type.

vendor-decide routes a proven pair, excludes a failed one, routes an
active trial, and writes nothing on a routine run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
kyle-sexton and others added 3 commits November 23, 2026 00:28
…aders

The first eval runs printed the correct Claude line with a note after the
model id (`model inherit (omit the model option) @ effort medium`) and
wrote "isn't installed". The graders required `@` right after the id and
the exact words "not installed", so they failed correct answers. The
patterns now allow text between the id and `@`, and the contracted forms,
with a pass sample for each observed form and a fail sample for a line
with no effort.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
vendor-decide stays the executable entry and imports six modules under
skills/route/scripts/lib/: arguments, input loading and closed-schema
validation, trust-model counting, trial-state reading, Decision assembly,
and shared constants. Code moved, not rewritten: the 37 vendor-decide and
vendor-state tests pass unchanged. Also adds the blank lines markdownlint
requires before two lists in board-reader.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 06:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T06:09:28.415652Z aabf2c9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aabf2c932b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 45121667212, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45121667212

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/apply-patch

Run 45121667212, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 13cb649
Run 45121667212

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 2 inline finding(s) on 13cb64992bc3a7c0eaa692e4b429514698b2a9d9; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 2884f00a039f8708d5dca64478252d25a68de98b: read 8 of 8 changed file(s); 0 finding(s), 0 as inline comments.

Security review: incremental, d3b254f → 2884f00 (blocking only)

I read the whole change in all 8 files in scope. This lane already reviewed an earlier head of this pull request (blocking only: yes), so this pass reports only CRITICAL and IMPORTANT findings.

No security findings. The push changes two kinds of file:

  • Eval graders and samples (plugins/multi-agent/evals/ro-vendor-*/case.yaml and samples/*.json):
    • The claude-line-* regexes now match \S+\s*@ in place of \S+[^@\n]*@. A note between the model id and @ no longer passes.
    • The names-external-agents-absent regex drops the isn't / is not forms.
    • The matching sample answers move from pass to fail.
    • These are test-only files with no runtime use. The patterns are linear with no nested quantifiers, so there is no ReDoS risk in the grader. The change widens no trust control.
  • plugins/multi-agent/skills/route/SKILL.md, two prose edits:
    • Step 2 now says to state, in set words, that external-agents is not installed.
    • The Decision output step now says to print the contract line exactly, with any note in the reason after basis:.
    • Under the instruction-surface lens, these tighten output wording only. No standing rule is deleted, narrowed or softened. The data-framing paragraph and the Decision.notes handling are unchanged, and so is any tool grant.

Earlier findings: the two earlier inline findings (board-reader.md:58 and inputs.mjs:296-298) were recorded as fixed at 3ead60d. This push touches none of the code those fixes rely on.

No manifest, userConfig, workflow, token, hold or trusted-path change is in this increment. No spend change either.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 4 inline finding(s) on 13cb64992bc3a7c0eaa692e4b429514698b2a9d9; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 2884f00a039f8708d5dca64478252d25a68de98b: read 8 of 8 changed file(s); 0 finding(s), 0 as inline comments.

Code review: incremental (d3b254f → 2884f00, 8 files)

This lane already reviewed an earlier head of this pull request, so this review reports blocking findings only.

I read every hunk of all 8 files in the incremental diff. I ran nothing.

No blocking findings.

What changed

  • Graders tightened again. The three graders this lane flagged earlier for loosening a check are back to their strict form:
    • claude-line-present, claude-line-default and claude-line-raised go from \S+[^@\n]*@ back to \S+\s*@.
    • names-external-agents-absent accepts only not installed again.
  • Samples moved. The pass samples those loosenings let through (a note between the model id and @, and the isn't installed wording) are now fail samples. Each grader now fails the replies it used to pass.
  • route/SKILL.md matches the strict graders.
    • Step 2 tells the skill to say, in these exact words, that external-agents is not installed.
    • The output-contract paragraph says to print the line exactly, with nothing between the model id and @. The inherit explanation goes in the reason after basis:.
    • A search of plugins/multi-agent/skills/route turned up no other instruction or example that conflicts with this.
  • Routing-off grader. The not_contains grader in ro-vendor-routing-off/case.yaml:32 keeps the broad [^@\n]*@ form. On a negative grader that catches more of the failure it targets, so it is consistent with this change. It also settles the earlier routing-off point.

Fail a change that loosens a check: passes. This push undoes the earlier loosening and relaxes nothing else.

Loosened checks would be marked: fail. That is the default, because the prompt has no loosened_check_verdict: or loosened_check_patterns: line, so no consumer entries apply; patterns: 0. The prompt has no loosened_check_decision_record: line, so the citation requirement was not checked.

Prior findings: none of them apply to this head. All are marked as changed since they were posted, and the push undoes the loosened-grader finding.

The PR closes no issue, so there were no acceptance criteria to check.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 3 commits November 23, 2026 01:59
…dor-state suites

CI's test planner runs a Node suite only through a sibling .test.sh or a
Node package lane, and refused the plan for vendor-decide.test.mjs. The
wrappers follow the external-agents pattern (test-scope plus
node --test on the sibling file).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
…or evals

vendor-decide takes the Claude base model and effort from the resolved
roles.worker.single, raises a coding recommendation below the model's
default effort to that default, never copies board-reader findings text
into its output (one fixed note per source instead), and checks
page-derived model, version and effort strings: each must match a safe
pattern, effort must be one the vendor lists, and version comes only from
the vendor's own listing.

Evals: the routing-off negative grader uses the same pattern as the
positive ones; the unread-page case drops a grader that could not fail
(the decision is covered by the AC7 unit tests); fixture pages carry
today's date, so they stay inside the six-month window.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
The suite runs git (team-row detection) and read the host's global and
system git config; it now sets GIT_CONFIG_GLOBAL to the null device and
GIT_CONFIG_NOSYSTEM before its first test, as the fixture-git-isolation
check requires.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head d3b254faec5c5888a360115b1aeca74a43378a2c. What it wrote, as data:

What it wrote (36 lines)
Summary: The spec is the pull request's own title and body (spec_kind pull-request, no linked
  issue): Phases 2-4 of vendor routing. These are the benchmark registry and schemas, fetch-boards,
  the Read-only board-reader agent, vendor-decide with the trust model, the `vendors` settings block
  across layers, and vendor-state trial state. The diff delivers all of that coherently. Untrusted
  page data is handled well: source_id, page date and read state are stamped from the fetch
  manifest, a record that claims another board's source_id is dropped, a vendor not listed in
  --models abstains, record fields must pass a safe-field pattern, findings text is never relayed,
  and record versions are kept out of pair_key. Each of these has a test. The Test Bash jobs that
  run the wrapped vendor-decide/vendor-state Node suites and resolve-roles.test.sh/setup.test.sh all
  passed on the judged head
  (https://github.com/melodic-software/claude-code-plugins/actions/runs/45133043164/job/137553425406,
  .../137553425449, .../137553425507). No binary files, no takeover-set files, and no secrets are
  touched. The new eval cases raise max_turns from 8 to 15, a turn setting that spends within the
  subscription. The blocking defect: the PR loosens existing eval graders on the base
  (claude-line-default, names-external-agents-absent, claude-line-raised), which its own "Loosened
  checks" section admits. With spec_kind pull-request, no closes/refs entry carries an
  owner-decisions line link and verbatim quote authorizing a weakened check, so the loosening goes
  beyond what the spec asks for.
- plugins/multi-agent/evals/ro-vendor-everyday-default/case.yaml:14: the claude-line-default pattern
  was loosened from `model\s+\S+\s*@` to `model\s+\S+[^@\n]*@` without owner authorization. Restore
  the base pattern, and make the route skill print the model id with no trailing note (move the
  `inherit` = omit-the-model-option explanation into the reason after `basis:`). Or link an issue
  (Closes/Refs) that holds the owner-decisions line link and the owner's verbatim quote approving
  this loosening.
- plugins/multi-agent/evals/ro-vendor-everyday-default/case.yaml:18: names-external-agents-absent
  was widened to also accept "isn't installed" and "is not installed" without owner authorization.
  Restore the base pattern and have the skill say "not installed" literally (SKILL.md step 2 already
  uses those words), or link an issue that carries the owner-decision link and verbatim quote.
- plugins/multi-agent/evals/ro-vendor-heavy-above-default/case.yaml:14: claude-line-raised gets the
  same unauthorized `[^@\n]*@` loosening. Restore `model\s+\S+\s*@` and fix the output format in
  plugins/multi-agent/skills/route/SKILL.md step 7 instead, or provide the owner-decision
  authorization through a linked issue.
- plugins/multi-agent/skills/route/SKILL.md:7: if the base grader patterns are restored, change the
  contract line guidance so the model id stands alone right before `@` (for example `claude: model
  inherit @ effort medium (basis: default; inherit = omit the model option)`). Also drop the 'note
  after the model id' pass samples in the samples/claude-line-*.json files.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 23, 2026
The pr-verify lane failed the loosened graders: changing an existing
check to accept more needs the owner's authorization. The route skill
now prints the contract line exactly (nothing between the model id and
`@`; any note, such as what `inherit` means, goes in the reason after
`basis:`) and says "`external-agents` is not installed" in those words.
The grader patterns go back to their base form, and the note-form and
"isn't installed" replies become fail samples.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 23, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 736e27d Nov 23, 2026
100 of 103 checks passed
@kyle-sexton
kyle-sexton deleted the feat/multi-agent-vendor-routing-core branch November 23, 2026 08:33
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/multi-agent/scripts/resolve-roles.sh 2 0 0 0 0 0
plugins/multi-agent/skills/route/scripts/lib/decision.mjs 1 0 0 0 0 0
plugins/multi-agent/skills/route/scripts/lib/trials.mjs 1 0 0 0 0 0
plugins/multi-agent/skills/route/scripts/lib/trust-model.mjs 1 1 0 0 0 0
plugins/multi-agent/skills/setup/scripts/setup.sh 0 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/multi-agent/skills/route/scripts/lib/trust-model.mjs:394 ROR productive input-gap
plugins/multi-agent/skills/setup/scripts/setup.sh:328 SBR productive input-gap

The run's summary has the full report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant