Skip to content

Capy threads use halved token limits and follow three new rules on subagents, relays and going forward (GST-3323) - #4582

Merged
capy-ai[bot] merged 3 commits into
mainfrom
capy/halved-token-limits-subagents-relays
Nov 21, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
capy/halved-token-limits-subagents-relays

Conversation

@garrytan

@garrytan garrytan commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Capy threads working on a PR now check in at 500M own tokens, standing threads rotate at 250M, and any subagent past 50M gets a look; gstack-runaway scan and /ship's default subagent cap use the new lines.
Why: Capy's token counts have read about half what they did before 2026-11-15, so the old lines were double the ones in use, and three standing rules (subagents, relays, going forward) were missing from the factory rules every Capy thread reads.
Nothing to do: the new lines apply on the next gstack upgrade.

What changed
  • Token lines, in the tools and the prose. lib/runaway.ts limits: standing rotation 500M to 250M (warn 400M to 200M), check-in for a thread holding a PR 1B to 500M, subagent stop-and-look 100M to 50M. lib/ship-budget.ts SUBAGENT_DEFAULT_CAP 100M to 50M. The same numbers in factory.md rule 12, lane-card.md, the controller manual (the controller manual), capy/skill/gstack/captain.md, /runaway-stopper, its successor brief, docs/ship-budget.md, docs/skills.md and README.md. Tests move with them, and fixtures that sat between the old and new lines are halved so each still tests the same side of its line.
  • Subagents earn their context. factory.md rule 15, lane-card.md and the controller manual's context section: start a subagent only for parallel work whose context can be thrown away, a fresh-eyes review or another model family, never to run a step of your own procedure, and name the compact result it returns. /ship keeps its subagent until gstack's trial without one reports.
  • Relays quote their source. capy/skill/gstack/captain.md § 1 widens the existing "send back the person's exact words" rule to every relay: the source's words unchanged and marked, with who wrote them, when, and what the relayer checked. factory.md rule 6 states it in one clause.
  • Go forward, don't stop and fix. factory.md rule 4 (was "Fix waves"), the controller manual's discipline section and capy/README.md: set a bad item aside, keep the rest moving, say what was set aside and repair it after; a red main gets its culprit reverted, and a blocking-floor finding still stops its PR.
  • factory.md's byte budget in test/capy-skill-wrapper.test.ts goes from 4,400 to 4,875 for these four rules (the page is 4,864 bytes).
Why

"Capy's token counts read about half what they did before 2026-11-15", so every token line in the rules and tools was double the line actually meant. Threads, subagents and /ship runs now check in, rotate and stop at the halved lines, and the factory rules every Capy thread reads now include the three standing rules on subagents, relays and going forward.

Blast radius

The code change is four numbers: LIMITS in lib/runaway.ts and SUBAGENT_DEFAULT_CAP in lib/ship-budget.ts. Every consumer reads the constants rather than literals (file:line read by two reviewers), and gstack-runaway and gstack-ship-budget start printed the new 250M, 500M and 50M lines when run on this branch. The rest is prose that agents load, which CI's full free suite and the skill-size, parity and context-budget guards checked.

Pre-Landing Review

No blocking issues. One review round of five readers on the whole diff, including a second-model review (openai/gpt-6.1-sol, verdict clean) and a targeted read of the budget code (no findings). Three notes below the blocking floor are listed next and were not changed in this PR.

Review notes
  • lib/ship-budget.ts:54: the 50M default /ship cap sits about 8% above the halved p90 of past runs, which holds only if Capy's counts halved evenly. A run that hits it stops and asks the owner, so it costs friction, not data.
  • lib/runaway.ts:15: the scan compares token totals that started before 2026-11-15 against the halved lines, so a long-lived subagent may be flagged early. The scan never acts on its own.
  • capy/skill/gstack/factory.md:8: the go-forward rule says a red main gets its culprit reverted but not who finds and reverts it.
Exploratory QA

Smoke probes on this branch: gstack-ship-budget start --mode observe --reading-from task with no cap printed BUDGET_DEFAULT_CAP: 50M and admission_cap=50000000; gstack-runaway usage prints the 250M rotation, 200M warning, 500M check-in and 50M subagent lines. Both passed.

Tests
  • bun run test (free suite, CI run 44848169504 at ad6eca7): green, 1722 test files.
  • macOS named regressions (same CI run) and Windows smoke (run 44848169112): green at ad6eca7.
  • Focused locally: test/ship-budget.test.ts 25 pass, 0 fail.
Agent notes

The controller manual is crew/docs/captain.md. Crew rules R70 (token lines halved), R104, R105 and R109, folded in from the 2026-11-21 audit of what gstack is missing (items 2 to 5). Not changed: docs/evals/runaway-stopper-prereg.md (a frozen preregistration) and the historical scan excerpt in docs/skills.md, which is labelled as read on 2026-11-03. No tool change for R104 beyond prose, because the tooling freeze through 2026-11-21 rules out a new /ship budget check.

Documentation

Scope: The audit read tree 7320b62217419a2a5c1a87492c4ffb718c4c5299. The working tree had no staged, unstaged or new files, so it covered only the committed diff from base 507ebfc to HEAD (18 files). I searched every .md and .tmpl file outside CHANGELOG.md and TODOS.md for the old token figures (100M, 400M, 1B, "500M own").

Result: The docs are current and nothing was edited. Every human-facing doc already uses the halved token lines that lib/runaway.ts and lib/ship-budget.ts now set: a 500M check-in for crew threads, a 250M rotation for standing threads with a 200M warning, a 50M stop for subagents, and BUDGET_DEFAULT_CAP: 50M. The changelog.d fragment already describes the new lines. CHANGELOG.md, TODOS.md, VERSION and the package files were left alone, as the brief requires.

Debt: No new debt. docs/evals/runaway-stopper-prereg.md still says "a Captain over 1B". It is a frozen preregistration, so it keeps its original wording. The benchmark-models "Step 1B" match is a step name, not a token figure.

Approvals

No approvals recorded for branch capy/halved-token-limits-subagents-relays.
Plan: exempt: crew:R70
Plan check: exempt crew:r70

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=3 fixed=0 scope=frozen dispatches=2 est_input_tokens=28409
Gate edits: none detected (10 listed, 10 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

{
  "schema_version": 1,
  "pr": 4582,
  "head": "ad6eca71cb29c333b0395ab4046752eadb073eb6",
  "version": "1.102.1.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1722,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44848169504,
      "attempt": 1,
      "tree": "7320b62217419a2a5c1a87492c4ffb718c4c5299"
    }
  ],
  "calls": 17,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/ship-4582",
  "head_tree": "7320b62217419a2a5c1a87492c4ffb718c4c5299",
  "product_patch_id": "618ae62e43f65b0bb9f6e3616c5b8001915a3cba",
  "gstack_version": "1.102.1.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 77,
    "rules": "85b3923b1a978e41",
    "base": "507ebfc16df362cc54a7e5842c42fabd8f8c0cfa",
    "registry": "507ebfc16df362cc54a7e5842c42fabd8f8c0cfa",
    "gate_scan": {
      "tagged": 0,
      "head": "ad6eca71cb29c333b0395ab4046752eadb073eb6"
    },
    "reasons": [
      "risk:money",
      "runtime=77"
    ],
    "risk": [
      "money"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @7320b6221741 (8 checks, current for ad6eca71cb29)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44848169504/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44848169112/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=7320b6221741 tests=38616 skipped=104 runs=44848169504/1 profiles=ci-reuse/free-tests heads=ad6eca71cb29 verified=2026-11-21T01:15:03.677Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "README.md, capy/README.md, docs/, crew/docs/, capy/skill/gstack/, runaway-stopper/"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 3,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "est_input_tokens": 28409,
    "dispatches": {
      "specialist-batched": 1,
      "red-team": 1
    }
  },
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "b3f6f8b4843c0c30",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "618ae62e43f65b0bb9f6e3616c5b8001915a3cba",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}
{"head":"350d227a4a0bb8621309ec5ff0148d095a8a6aeb","run":"ship-4582","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":0,"fixed":0,"scope":"frozen","rounds":1,"est_input_tokens":28409,"dispatches":{"specialist-batched":1,"red-team":1}}}

Open in Capy

…bagents, relays and going forward (GST-3323)

Capy's token counts read about half since 2026-11-15, so the runaway scan, the /ship subagent cap and the factory rules use half the old lines, and the factory rules gain the subagent, relay and go-forward rules.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 21, 2026 00:49
…d cap

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nces

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 1a95eae into main Nov 21, 2026
52 checks passed
@garrytan garrytan mentioned this pull request Nov 21, 2026
capy-ai Bot added a commit that referenced this pull request Nov 21, 2026
- Habits from nine teams, written into gstack. (#4585)
- Three more habits from teams that run evals. (#4602)
- The /ship conductor trial plan gives its real-problem judge one more attempt on fresh labels after it missed its agreement bar twice, and stops the trial incomplete if it misses again (GST-3003). (#4611)
- The /ship conductor trial plan now stops a trial only at the final remote-gate refusal, gives both arms the same note that the brief overrides team rules, and counts every report the no-gstack arm returns (GST-3003). (#4609)
- The /ship conductor trial plan now ends a trial at the remote gate when its case base isn't main, gives the no-gstack arm a test runner, and audits every trial for exposure to the plan (GST-3003). (#4605)
- The /ship conductor trial plan now runs an uncounted pilot in every arm before its counted trials and takes one planned look at half the cases (GST-3003). (#4587)
- gstack's own use on Capy can be counted, and is kept out of real-use numbers. (#4576)
- Free Tests shards finish closer together. (#4578)
- The weekly test-time recording can land again on its own. (#4581)
- The job-log tree.json step's recommended sleep is long enough for real runners. (#4589)
- Pull requests no longer wait on the Trunk flaky-test upload, and the quick tier's flaky passes now reach Trunk. (#4579)
- Windows Setup E2E finishes sooner on install changes. (#4575)
- Skills no longer stop on Codex when they clean up temp files. (#4612)
- /review on Codex with OpenAI models no longer holds back a review that ran its adversarial pass. (#4622)
- Crew threads on Capy now check in at 500M own tokens, standing threads rotate at 250M and any subagent past 50M gets a look, half the old lines, because Capy's token counts read about half what they did before 2026-11-15. (#4582)
- gstack no longer offers to add a `## Skill routing` section to your project's CLAUDE.md. (#4629)
- The README and docs no longer say gstack makes your agent fix more bugs. (#4598)
- `/eval-plan` now writes eval plans that waste less money. (#4591)
- /cso checks every folder above a source file before it looks at the file, so it never looks through a symlinked folder. (#4592)
- Plan reviews no longer read a /design-review audit summary as the branch's design doc. (#4623)
- Node's built-in test files now run with `node --test` in repos that use vitest or jest. (#4626)
- A quarantined test that the runner skipped now fails the run instead of passing it. (#4590)
- A flaky free test is fixed: the spawnSync overflow check no longer fails about once an hour on CI. (#4613)
- Free Tests runs its shards on 16-core runners. (#4600)
- /office-hours asks for ground truth first. (#4468)
- Every startup session ends with a dated test. (#4468)
- /plan-tune's dream cycle now logs each send of your typed answers to Anthropic. (#4621)
- Landing a ready PR no longer depends on a hand-copied gate decision, and the ready note, release PR and squash message say the right thing. (#4596)
- /ship no longer asks for a fresh review because of a stacked parent that main already had. (#4580)
- Results PRs with large captured agent sessions can be reviewed. (#4574)
- /ship no longer stalls on review notes a reviewer already cleared, counts review rounds the way the review policy reads them, and keeps security findings out of the PR body. (#4595)
- /ship's review readers are now told never to stop processes they didn't start. (#4607)
- /ship's review no longer stops when Capy's own drive sync database grows past 100 MB. (#4606)
- /ship's preflight now honors your repository's time limit for rerunning CI-skipped tests, and tells you when a fresh worktree needs its packages installed. (#4608)
- The slowest free test file is now six files. (#4588)
- Step 11.5 keeps a reviewed head current across base-only merges. (#4577)
- On a Capy install, only the owner's opt-in sends telemetry. (#4597)
- New page: working across agent systems. (#4583)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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.

1 participant