v2.7.0: routing, concurrency and cost - #11
Merged
Merged
Conversation
Model routing per issue type and stage, a per-stage context pack, current Anthropic model pricing, machine-wide concurrency slots and spend caps, and proof:check so Markdown-only work never needs a failing test. Closes out the remaining v2.7.0 structural tests: every routed skill is checked at boot, and a Markdown-only proof:check plan ships with no test file, both proven by revert-and-fail. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
routesin.factory/config.jsonpicks an agent per (type, stage), resolved byresolveRoute(
routes[type].stages[stage]→stages[stage]→stages.default→"claude"); triage alwaysuses
stages.triage, since the type isn't known yet.template/.factory/config.example.jsonships the recommended default (triage/PR on Haiku, plan on Opus, build/verify on Sonnet, docs
builds on Haiku).
src/context.ts:buildContextPackassembles AGENTS.md, a route's skills, ARCHITECTURE.md andthe plan's named files into one pack per stage, capped at 64 KiB, dropped whole (never
truncated) in priority order. Claude gets it on the same
--append-system-promptasSTAGE_GUIDANCE; every other agent gets it inlined ahead of the artifact contract.claude-sonnet-5andclaude-opus-5-5, captured inresearch/pricing/anthropic.md.src/machine.ts: machine-wide concurrency (FACTORY_SLOTSormachine.json), leased inmachine.dband reclaimed on a dead pid, so two watchers on one machine share one pool. Arepo's own
concurrencybecomes a cap on top, andfactory doctoradvises a slot count.watch.ts: the poll loop no longer waits for the whole batch to drainbefore starting new work off a freed slot.
spend.perIssueUsdanddailyUsd(repo and machine), checked before every stageagainst
stage_runs.cost_usd; over a cap parks the issue with a "budget" inbox item.proof: "test" | "check"on the plan artifact:checkruns named commands instead of afailing test, so Markdown-only work (a blog post, a docs page) can ship without one. The type
list is config-driven everywhere now;
TYPE_LABELSis the default, not the only list.Structural tests (all revert-and-fail proven)
(type, stage)pair inroutes/TYPE_LABELSresolves to a defined agentloadConfigrefuses at boot when a routed skill has noSKILL.mdon disk, instead of a silentmid-run no-op in the context pack (
tests/routes.test.ts)proof: checkplan (Markdown files, a prose-lint gate, no test file) ships exactly like aproof: testplan (tests/scenarios.test.ts, scenario 23)template/.claude/skillsandtemplate/.claude/agentsfor a named stack toolconfirms a freed slot is picked up within one poll
Test plan
bunx tsc --noEmitcleanbun test: 739 pass, 0 fail, 2384 expect() calls, 74 filesmake check: ok (typecheck + test + skills-ref validate)src/config.ts, and theproof: "check"schema entry insrc/schemas.ts)🤖 Generated with Claude Code