/ship runs in the pull request's own thread, with no helper agent (GST-3466) (#4670)

On Capy, /ship now runs in the thread that owns the pull request,
starting its reviewers as that thread's own subagents, instead of
handing the whole run to a separate helper agent.

Why: a 30-run trial found no clear difference in cost or bugs caught, so
the extra agent layer goes; the project owner chose this.

Nothing to do: /ship's review plan, review rounds, final sign-off and
checks are unchanged.

Refs: GST-3466
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/specialist-batched#2 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: fc/fix-check#1 reader=fix-check
Review-Finding: fc/targeted#1 reader=targeted
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 09:17:44 +00:00
1 parent 0b4f0ceeec
commit 540da9b5b1
19 files changed
+82 -77

No files matched your search

+5 -5
View File
@@ -17,7 +17,7 @@ Context: after the install check, read the gstack skill's lane-card.md (the chec
Batch independent reads in one parallel program; return 4k characters or less per call and
send long output to files under ~/.capy/work. A wait under about 30 minutes checks in every
240 s (wait on the operation with duration_seconds 240, then a silent re-wait, for about 30
minutes at most); longer waits sleep on their operations, and so does the lane while /ship runs. Past twice the median lane spend, write handoffs/<code>/next.md and
minutes at most); longer waits sleep on their operations. Past twice the median lane spend, write handoffs/<code>/next.md and
tell me in one line (crew/docs/captain.md, Lane context).
1. Plan (when Plan: required). After the session-start install check, install for autoplan
@@ -40,10 +40,10 @@ Context: after the install check, read the gstack skill's lane-card.md (the chec
3. Ship. CHANGELOG entry under [Unreleased]; GUARD_CHECKS, pregate and /ship at the final
head; one unstamped READY block (captain/templates/READY.md) to me; the PR body carries
gstack-approvals render --plan "<this brief's Plan line>". Never merge; stamp only on my slot call.
After dispatching /ship, end your turn; wake only on /ship's completion, holding no PR
watch meanwhile (cancel one you hold; a red check during /ship waits for it to finish).
/ship owns the receipt and the PREGATE line. On that wake you subscribe to the PR, read
its checks and comments once, stop the /ship subagent, run gstack-ship-queue ready
Run /ship yourself, in this thread: follow ship/DRIVER.md phase by phase and start its
reviewers as your own subagents; never start a subagent to run /ship (a red check during
/ship waits for it to finish). /ship owns the receipt and the PREGATE line. After the
receipt, read the PR's checks and comments once, run gstack-ship-queue ready
--pr <n> --pregate <pregate.json> --screen|--no-screen at the pin (its notes on origin),
audit your decision trail, write Attention and send READY; after READY, handle PR events
as usual (crew/docs/captain.md, the lane's /ship sequence).
+3 -3
View File
@@ -38,13 +38,13 @@ If no specific skill was requested, use the router's task-to-skill mapping. Read
For `/autoplan` driven from Capy, read `autoplan/DRIVER.md` in the checkout (`~/.local/share/gstack/autoplan/DRIVER.md`): the compact phase loop, artifact contract and gate protocol, without the interactive preamble. A checkout without that file predates it; follow its `autoplan/SKILL.md` instead. Run every command with the `GSTACK_LAUNCH` assignments and read outputs as files, not prose: the run directory holds `run.json`, `decisions.jsonl`, `findings.jsonl`, `tasks.jsonl`, `timing.json`, `plan.md` and `review-record.md`, and the run ends with `GSTACK_RESULT: skill=autoplan status=gate_pending run=<dir>`. `~/.local/share/gstack/bin/gstack-artifact validate <dir>/run.json` is the completion check. The gate is answered through `gstack-autoplan answer` (or `gstack-gate parse`) with the printed `gate_rev`; an unattended run never approves its own gate. `docs/unattended.md` in the checkout is the contract.
For `/ship` driven from Capy, read `ship/DRIVER.md` in the checkout (`~/.local/share/gstack/ship/DRIVER.md`): one or two calls per phase, and the section each STOP needs. A checkout without that file predates it; follow its `ship/SKILL.md` instead.
For `/ship` driven from Capy, read `ship/DRIVER.md` in the checkout (`~/.local/share/gstack/ship/DRIVER.md`): one or two calls per phase, and the section each STOP needs. The thread that owns the pull request runs /ship itself and starts its reviewers as its own subagents; never start a subagent to run /ship. A checkout without that file predates it; follow its `ship/SKILL.md` instead.
Run directories and scratch on Capy live under `~/.capy/work/<name>` (`--out ~/.capy/work/<project>/autoplan`), never `/tmp`: Capy wipes `/tmp` when a machine sleeps, and a vanished run cannot be resumed, answered or exported. Likewise any file a later turn reads.
Capy checklist for `/autoplan`: drive `gstack-autoplan`, never a hand adaptation presented as a run. Relay `gstack-gate render <dir>/gate.json --all` with `rec` (every recommendation, plan changes included) as the one-word default; answer with `--by agent:<id> --owner-reply "<their words>"`. Set `GSTACK_AUTOPLAN_CHECKPOINT_DIR` to a private project-user Drive folder; after machine replacement, `gstack-autoplan resume --out <new dir> --from <that dir>` restores the newest valid checkpoint.
Token caps on /ship: pass a brief's cap as `--token-cap <n>`. /ship reads `cost.tokens` and `cost.credits` from `tools.thread.get({ thread_id: "<your own jam id>" })` (its own jam; a subagent reading root `"this"` starts `--subagent --reading-from this --meter-scope tree`) inside the same execute program as the `gstack-ship-budget` command that takes them as `--reading <n> --credits <c>`, never alone. `ship/DRIVER.md` starts `--mode observe`: each program ends with `note`, and only a note past the cap stops (`docs/ship-budget.md`).
Token caps on /ship: pass a brief's cap as `--token-cap <n>`. /ship reads `cost.tokens` and `cost.credits` from `tools.thread.get({ thread_id: "<your own jam id>" })` (the thread running /ship, its reviewers included) inside the same execute program as the `gstack-ship-budget` command that takes them as `--reading <n> --credits <c>`, never alone. `ship/DRIVER.md` starts `--mode observe`: each program ends with `note`, and only a note past the cap stops (`docs/ship-budget.md`).
/ship on Capy is about a dozen calls, each an execute program (`ship/DRIVER.md`). Each review pass and Step 11 is one call to the checked-in pass program (fill only `input`): `const t0 = await now(); const p = (await tools.capy.bash({ command: ". '<launch file>' && gstack-review-dispatch program", description: "Pass" })).output.split("\n"); return p[0] + "\n" + (await new (Object.getPrototypeOf(async () => {}).constructor)("tools", "sleep", "now", "input", JSON.parse(p[1]))(tools, sleep, now, { startedAt: t0, launch: "<launch file>", cwd: "<repo>", base: "<base>", out: "<run dir>/p<n>", pass: "<run>-p<n>", laneModel: "<your model id>", planFlags: [], logStart: ["review"], jam: "<jam id>", record: "<rec>", step: "9.2" }));` It plans, logs `logStart` (`reservation` mode from `RESERVATION_ID:`), sends each brief on `machine: "shared"`, then polls: one `tools.subagent.list` per ~20 s tick, returning 200 s after the program's first line, where a reader is settled only at status `done` or `failed` or with a `summary` (a just-created `idle` reader has not run); it starts readers under `rejected` with `tools.subagent.start` as slots free and stops on one stuck 20 minutes. It ends on `NEXT:` (`poll`: rerun) or `STOP:`. `models` maps roles to models (`outside-voice`: another family, pinned in `voice-models.json`); Step 11 swaps `logStart` for `stage: "voices"`; a full repeat pass, `diffBase: "<RANGE_BASE>"`. Steps 7, 8 and 14.5 (`step: "14.5"`) use `extras`, JSON `{name, prompt_file, first, model}` (prompts verbatim from their sections, Step 7 `first`); they cannot block, so omit `model`: the pass prints `AUDIT_MODEL:`. Every other phase is one call to `gstack-ship-phase program`, loaded the same way, with `input` `{ startedAt, launch, cwd, dir: "<run dir>", phase: <n>, commands: ["<bin> …"], record, jam, step: "<last step>" }` (Phase 2's `gstack-ship-budget start` takes `--reading "$GSTACK_SHIP_READING" --credits "$GSTACK_SHIP_CREDITS"`; `pass: { … }` runs that pass after the commands); on `NEXT: rerun`, call it again unchanged. Waits under about 80 minutes: never let 5 minutes pass between calls. While readers run, never end the turn on `wait`; rerun the loader. Else re-issue `wait` with `duration_seconds: 200` and operation ids. A wait expected past 80 minutes (full CI) ends the turn on one `wait` on its operations; never poll every 10-15 minutes. `STOP: past 100 minutes`: report its `stop.json` and end. At Step 22 report the `CALLS:` line of `gstack-ship-budget calls --record <rec>`. A small waiting child saves nothing.
@@ -55,7 +55,7 @@ Every Capy thread using gstack follows these for new work, Captain or not. The r
- **Plan first.** Run `/autoplan` on new functionality right after the install check. The lean run (the Capy default) is one reviewer over plan and draft code; `--full` adds every phase.
- **ELI5, then the word.** Send the plan and gate to the person, or the Captain, in plain language: `gstack-owner-brief render --captain --out <run dir> --captain-name "<Captain name>"`, its choices as lettered lines in the ask format (`crew/docs/captain.md`) and "do it" taking every recommendation at full scope. Build only after their word is answered into the run and it reports `APPROVED`; then `gstack-approvals import --autoplan <run dir> --by "<owner>"`.
- **/ship before ready.** Run /ship at the final pushed head before a PR is called ready; `SHIP_RECEIPT: pr=<n> head=<head>` must name that head, and a later push needs a new /ship. The review inside /ship, like the autoplan, is sized to the change.
- **Sleep while /ship runs, then stop it.** After dispatching /ship the parent ends its turn with no PR watch until /ship completes (a re-READY drops a held watch first). On that wake it subscribes to the PR (renewed on expiry, cancelled at merge or close), reads its checks and comments once, stops the subagent, runs `gstack-ship-queue ready` and owns the PR thereafter: slot stamp, re-READY, receipt carry (`crew/docs/captain.md`, the lane's /ship sequence). A stopped /ship subagent woken by a check, review or merge notice, not its parent, reports what woke it, its pin and the PR head (`gh pr view <n> --json headRefOid --jq .headRefOid`) in one line and ends the turn without acting, even if the head moved. A message from its parent is an instruction it carries out.
- **Run /ship yourself, then keep the PR.** The thread that owns the PR runs /ship phase by phase (`ship/DRIVER.md`), with its reviewers as its own subagents. Once /ship prints its receipt, the thread reads the PR's checks and comments once, runs `gstack-ship-queue ready` and owns the PR thereafter: slot stamp, re-READY, receipt carry (`crew/docs/captain.md`, the lane's /ship sequence).
- **No merge without the owner's word.** A thread never merges on its own; under a Captain the controller merges on a recorded standing approval, and a thread with no Captain asks the person.
Exempt from the plan step: read-only work, the daily flaky pass's repairs, slot stamps, CHANGELOG-only resolves, cap re-pins under a written grant, S1 emergencies (a broken install or upgrade, a red main, a security bug) and fixes from an already-diagnosed, audited problem list. Other bug fixes skip plan review (`--kind fix`, R65) but carry a repro on current main or a failing test written first; features get the lean run (`--kind feature`).
+3 -4
View File
@@ -168,10 +168,9 @@ every wake more than about five minutes after its last call rewrites its whole c
warm price. The merge lane reports to the Captain only a landing, a decision or a blocker
(`crew/docs/captain.md` in the gstack checkout, Roles).
A token cap in a brief goes to /ship as `--token-cap <n>`. Run each /ship in a fresh subagent titled
`ship #<n> at <head7> <4-char nonce>` (unique), with `GSTACK_SHIP_TASK_TITLE=<that title>` in its brief and the instruction to
take every reading (start, notes, close) from its own row of the root thread's `tasks` and start the budget with
`--reading-from task`, so it caps at 50M by default; never message a finished /ship subagent to run another. When /ship stops on it (`STOP:
A token cap in a brief goes to /ship as `--token-cap <n>`. Run /ship in your own thread, never in a subagent, and
take every reading (start, notes, close) from your own jam id's `tools.thread.get`, which counts its reviewers
too; a rerun at the same head is a new /ship run with a new run id. When /ship stops on the cap (`STOP:
reason=budget_exhausted`, `status=incomplete`), the lane reports the BUDGET and RECOVER lines and asks the
owner; it never raises the cap itself. The owner's answer runs the RECOVER line with
`--approved-by <who> --words "<their words>"`, and `gstack-approvals add` records the same words.
+3 -3
View File
@@ -17,7 +17,7 @@ For a crew lane (a thread working for a Captain). Read this once `gstack: ok <re
- New functionality gets a lean `/autoplan` (`--kind feature`) right after the check. Bug fixes skip plan review (`--kind fix`) but carry a repro on current main or a failing test written first. Exempt: read-only work, the daily flaky pass's repairs, slot stamps, CHANGELOG-only resolves, cap re-pins under a written grant, S1 emergencies and fixes from an already-diagnosed, audited problem list.
- Send the gate to the Captain as `gstack-owner-brief render --captain --out <run dir>`, whole. Build only after the owner's word is answered into the run and it reports `APPROVED`, then `gstack-approvals import --autoplan <run dir> --by "<owner>"`.
- /ship runs at the final pushed head before any READY; `SHIP_RECEIPT: pr=<n> head=<head>` names that head, and a later push needs a new /ship.
- After dispatching /ship, end your turn and hold no PR watch until it completes. Then subscribe to the PR, read its checks and comments once, stop the /ship subagent and run `gstack-ship-queue ready`.
- Run /ship in this thread (`ship/DRIVER.md`), with its reviewers as your subagents, never in a subagent of its own. After the receipt, read the PR's checks and comments once and run `gstack-ship-queue ready`.
- Never merge. The controller merges on a recorded standing approval.
- UI work (recommended, never a READY prerequisite): once the change renders, run `install.sh --check --for design-review` and `gstack-browser-ensure`, launch with the printed `GSTACK_LAUNCH` line, then `/design-review --build <preview url>`, and paste its one `DESIGN_BUILD:` line in READY. A start that prints `GSTACK_RESULT: skill=design-review status=refused` is `DESIGN_BUILD: unrendered code=INSTALL` (`gstack-design-build admit <saved start output>` prints it). `incomplete` does not count as having run it.
@@ -31,10 +31,10 @@ For a crew lane (a thread working for a Captain). Read this once `gstack: ok <re
- Batch independent reads in one parallel program. Return 4k characters or less per call; write long output to a file under `~/.capy/work` and read the part you need.
- Never write a file back from a read that came back cut off: a file-read tool can return only the start of a long file, or cut long lines, without saying so. Edit in place (the exact-string edit tool, `sed` or a script) and compare `wc -l` and the last lines before and after; an unplanned shrink is a blocker.
- A wait you expect to last under about 30 minutes checks in every 240 s: `wait` on the operation with `duration_seconds: 240`, then re-issue it silently on a wake that brings nothing new. After about 30 minutes, or past the expected end, stop re-issuing and sleep on the operation or pull request watch. A longer wait sleeps on its operations. While /ship runs, sleep.
- A wait you expect to last under about 30 minutes checks in every 240 s: `wait` on the operation with `duration_seconds: 240`, then re-issue it silently on a wake that brings nothing new. After about 30 minutes, or past the expected end, stop re-issuing and sleep on the operation or pull request watch. A longer wait sleeps on its operations. While /ship runs, follow the waits in `ship/DRIVER.md`.
- Past twice the crew's median lane spend, write `handoffs/<code>/next.md` and tell the Captain in one line; it decides whether you continue, rotate or park.
- Keep your PR until it merges or closes; never hand off mid-PR on a token count. Past 500M own tokens, check in with the Captain once, then carry on unless told otherwise. Capy's token counts read about half what they did before 2026-11-15, so every token line here is half its old figure.
- Start a subagent only for parallel work whose context can be thrown away, a fresh-eyes review or a model from another family, never to run a step of your own procedure. Its brief names the compact result it returns (a verdict line, a file path, a short list), and nothing else comes back. /ship keeps its own subagent until gstack's trial of /ship without one reports. Stop and look at any subagent past 50M tokens.
- Start a subagent only for parallel work whose context can be thrown away, a fresh-eyes review or a model from another family, never to run a step of your own procedure. Its brief names the compact result it returns (a verdict line, a file path, a short list), and nothing else comes back. /ship runs in your thread; only its reviewers are subagents. Stop and look at any subagent past 50M tokens.
## Before a push
@@ -0,0 +1 @@
**On Capy, `/ship` now runs in the thread that owns the pull request, with no separate helper agent.** The thread follows `ship/DRIVER.md` one phase at a time and starts /ship's reviewers as its own subagents; the Capy skill, lane card, crew manual, lane brief template and `/runaway-stopper` no longer tell anyone to hand /ship to a subagent. gstack's trial of both ways (30 paired runs on fresh threads, covering the review and fix phases) found no clear difference in cost or in bugs caught; its verdict rested on one scoring ruling, and Garry chose to remove the helper agent. Threads that reach /ship with a large context were not measured. A /ship run that meters its own thread's counter keeps the 50M default token cap the helper agent had (`BUDGET_DEFAULT_CAP:`). The review plan, rounds, receipt and gates are unchanged. (GST-3466)
+16 -18
View File
@@ -203,7 +203,7 @@ cheap:
A status read in between counts and does not restart the 30 minutes. A wait expected to run
longer sleeps on its operations alone. For short lane waits this overrides "waits go on
operations, never on polling wakes" ([unattended.md](../../docs/unattended.md#report-length)). The
controller never warm-waits, and a lane still sleeps while /ship runs
controller never warm-waits, and a lane running /ship follows the waits in `ship/DRIVER.md`
([the lane's /ship sequence](#the-lanes-ship-sequence-before-ready)).
- **Batched reads.** Independent reads (files, greps, pull request and thread state) go in
one parallel program, not one call each. Each call returns 4k characters or less; long
@@ -237,8 +237,8 @@ cheap:
because the subagent re-reads its own brief and context on every step and its tree's
spend adds to the lane's: subagent trees were about a quarter of one day's crew spend.
The brief names the compact result the subagent returns, such as a verdict line, a file
path or a short list, and nothing else comes back. /ship keeps its own subagent until
gstack's trial of /ship without one reports.
path or a short list, and nothing else comes back. /ship is the lane's own procedure, so
the lane runs it in its own thread; only /ship's reviewers are subagents.
## New threads join the crew
@@ -519,32 +519,30 @@ a push included. The sequence that works unattended on Capy (steps 3 to 8 run in
`/ship --resume <record>`; no READY goes out on the conditional receipt,
except on a train with `gates` ([Merge trains for other repos](#merge-trains-for-other-repos)).
9. READY: `gstack-ship-queue ready --pr <n> --pregate <pregate.json> --screen|--no-screen`;
send the printed block. The lane runs this on /ship's completion wake, below.
send the printed block. The lane runs this once /ship prints its receipt, below.
10. After the slot call, the stamp commit keeps the pin's receipt; re-READY with the same
receipt, no second /ship.
When /ship runs in a subagent, the lane sleeps while it runs. After dispatching /ship, the
lane ends its turn and wakes only on /ship's completion: one wake to relay READY, because the
controller hears READY from the lane, never from its subagent. So the lane holds no pull request watch of its own
while /ship runs: /ship opens the pull request, and on a re-READY the lane cancels the watch
it already holds before it dispatches. Every READY duty has one owner, so `train build`
The lane runs /ship itself, in its own thread: one call per `ship/DRIVER.md` phase, with every
reviewer started as the lane's own subagent. It never hands /ship to a subagent. gstack's trial of
/ship without one (GST-3003, 30 paired runs on fresh threads, review and fix phases only) found no
clear difference in cost or catches; its verdict rested on one scoring ruling, and the owner chose to
drop the extra layer (A1, 2026-11-22). Lanes that reach /ship with a large context were not measured.
Every READY duty has one owner, so `train build`
never refuses the pin with `QUEUE_NOT_READY` for a step nobody ran:
| READY duty | Owner |
|---|---|
| The ship receipt (`SHIP_RECEIPT:`) and the pregate record behind the `PREGATE:` line (steps 4, 7 and 8) | /ship |
| `gstack-ship-queue ready --pr <n> --pregate <pregate.json> --screen\|--no-screen` at the pin, with its notes pushed to origin `refs/notes/gstack-trains` (step 9; /ship runs on the lane's machine, or the lane copies its `pregate.json` over first) | the lane |
| `gstack-ship-queue ready --pr <n> --pregate <pregate.json> --screen\|--no-screen` at the pin, with its notes pushed to origin `refs/notes/gstack-trains` (step 9, on the lane's machine, where /ship ran) | the lane |
| The decision-trail audit and the READY's `Attention` section, when the crew keeps a trail ([unattended.md](../../docs/unattended.md#the-decision-trail)) | the lane |
On the completion wake the lane subscribes to the pull request's check and review notices,
reads its checks and comments once (a notice that landed while /ship ran went to /ship, or to nobody on a re-READY),
stops the /ship subagent, runs `ready`, audits its trail, writes `Attention` and sends the
READY. A completion that ends `SHIP_PAUSED: base-red` follows step 8 instead: the lane
When /ship prints its receipt, the lane reads the pull request's checks and comments once,
runs `ready`, audits its trail, writes `Attention` and sends the READY. A run that ends
`SHIP_PAUSED: base-red` follows step 8 instead: the lane
registers the base-red wait, tells the controller, and sends no READY. From then on the lane handles the pull request's events as before: red checks, human
review, the slot stamp and re-READY of step 10, and any receipt carry. It does that work
itself or sends it to the subagent as an explicit instruction. The tradeoff: a red check
that lands while /ship runs waits for /ship to finish instead of being fixed in parallel.
In exchange, the lane stops re-reading its whole context on every notice during /ship. On
review, the slot stamp and re-READY of step 10, and any receipt carry. A red check that
lands while /ship runs waits for /ship to finish instead of being fixed mid-run. On
Capy the mechanics are in [the gstack skill](../../capy/skill/gstack/SKILL.md#plan-approve-ship).
When the base moves under a reviewed branch, merge it in; never rebase. A merge that
+7 -4
View File
@@ -3,9 +3,10 @@
`/ship --token-cap 25M` (or `GSTACK_SHIP_TOKEN_CAP=25M`) bounds what one /ship run spends, and
long runs hand their heavy segments to fresh-context children. The helper is
`bin/gstack-ship-budget`; the skill's procedure is `ship/sections/budget-handoff.md`.
There is one default cap: an observe-mode /ship subagent that meters its own task row (`--reading-from task`,
below) and names no cap gets 50M, the line where /runaway-stopper stops a subagent, and prints
`BUDGET_DEFAULT_CAP: 50M`; `--token-cap none` turns it off. Without a cap, /ship meters usage when it can and prints it, and
There is one default cap: an observe-mode run that meters its own counter (the thread's own jam id, `--reading-from own`,
or one row of a root thread's `tasks` with `--reading-from task`, below) and names no cap gets 50M, the line where
/runaway-stopper stops a subagent, and prints `BUDGET_DEFAULT_CAP: 50M`; `--token-cap none` turns it off. A run that
reads a shared counter (`--reading-from this`, `--meter-scope tree`) gets no default. Without a cap, /ship meters usage when it can and prints it, and
nothing else changes.
## What the cap guarantees
@@ -140,7 +141,9 @@ one program measure nothing: Capy books a call after its program ends.
A jam's own counter includes its own subagents, outside voices too (measured 2026-10-30: +10.92M
across a six-reader dispatch with two ~0.35M parent calls between). `"this"` is the root thread,
whose counter also holds every sibling tree. A subagent running /ship cannot read its own jam id. When its brief names its title
whose counter also holds every sibling tree. /ship runs in the thread that owns the pull request, never in a subagent,
so on Capy it reads that thread's own jam id: a crew thread is a root thread, and its counter holds its reviewers. A
reading taken inside a subagent is different, because a subagent cannot read its own jam id. When its brief names its title
(`GSTACK_SHIP_TASK_TITLE=<title>`), it reads `cost` from its own row of the root thread's `tasks` (the row whose `title` matches; its subtree, exact)
and starts with `--reading-from task`; every later reading in the run comes from that same row, and the title carries a
nonce so a rerun at the same head can't match a finished row. Otherwise it
+2 -3
View File
@@ -1045,9 +1045,8 @@ sets the defaults that keep it from coming back.
a handoff file and a successor brief (`runaway-stopper/templates/`), then archived by its own Captain once none of
its PRs is open (R91), through `gstack-archive-check thread`. A thread
mid-/ship or mid-merge gets `DEFER:` and nothing happens until that work finishes.
- **Prevent.** One wait on all pending operations, quiet wakes, compact program returns, one /ship subagent per
PR head (metering its own row with a 50M default cap, `BUDGET_DEFAULT_CAP:`), two review rounds, and a fresh
thread per automation run.
- **Prevent.** One wait on all pending operations, quiet wakes, compact program returns, /ship run in the pull
request's own thread rather than a subagent, two review rounds, and a fresh thread per automation run.
Scanning FOUN-4, FOUN-14 and FOUN-71 as read on 2026-11-03, before R70's 2026-11-09 amendment and the 2026-11-15 halving of
its token lines (today only a thread marked standing gets `ROTATE`, past 250M; a crew thread past 500M gets `CHECK_IN`; a
+2 -2
View File
@@ -251,7 +251,7 @@ export function cmdStart(argv: string[], ctx: Ctx): Outcome {
const record = str(o, 'record');
if (!record) throw usageError('start needs --record <invocation record path>');
const rawCap = str(o, 'token-cap') ?? ctx.env.GSTACK_SHIP_TOKEN_CAP;
const defaultCap = rawCap === undefined && mode === 'observe' && from === 'task' && tokensOpt(o, 'reading') !== undefined;
const defaultCap = rawCap === undefined && mode === 'observe' && (from === 'task' || from === 'own' || (from === undefined && scope !== 'tree')) && tokensOpt(o, 'reading') !== undefined;
const cap = defaultCap ? SUBAGENT_DEFAULT_CAP : rawCap === undefined || rawCap === 'none' ? null : parseTokens(rawCap, '--token-cap');
const callFloor = tokensOpt(o, 'call-floor');
const delegate = str(o, 'delegate') ?? 'auto';
@@ -291,7 +291,7 @@ export function cmdStart(argv: string[], ctx: Ctx): Outcome {
const out = decide(l, '0.9', { kind: 'step', step: '1' }, call, true);
writeLedger(l, ctx.env);
pointMarker(l.marker, l);
const note = defaultCap ? [`BUDGET_DEFAULT_CAP: ${SUBAGENT_DEFAULT_CAP / 1e6}M (a /ship subagent metering its own task row; --token-cap <n> or none to change it)`] : [];
const note = defaultCap ? [`BUDGET_DEFAULT_CAP: ${SUBAGENT_DEFAULT_CAP / 1e6}M (a /ship run metering its own counter; --token-cap <n> or none to change it)`] : [];
return labelScope(l, { stdout: [`BUDGET_RUN: id=${run} ledger=${l.file}`, ...note, ...out.stdout], exit: out.exit });
}
+1 -1
View File
@@ -46,7 +46,7 @@ export const MAX_CHAIN_DEPTH = 3;
export const SEGMENTS: Record<string, string> = { '1': '22', '9': '11.5', '12': '22' };
export const DEFAULT_TAIL = 2_000_000;
/**
* The cap an observe-mode /ship subagent metering its own task row (--reading-from task) gets when it names none:
* The cap an observe-mode /ship run metering its own counter (its thread's own jam, --reading-from own, or a task row) gets when it names none:
* R70's stop-and-look line, 50M since Capy's token counts read about half from 2026-11-15 (it was 100M). Single-run /ship
* subagent rows on 2026-11-03, on the old count (GSTA crew and FOUN-4/14/71, n=9): p50 64M, p90 92M; the one past 100M
* (485M) was a subagent reused for five runs.
+4 -6
View File
@@ -224,8 +224,8 @@ cold starts (after the 5-minute cache lapsed) and empty wakes cost; `scan --wake
| `RUNAWAY_INPUT:`, `FETCH_FAILED:` | That thread wasn't read: fetch it again and rerun; never count it as OK. |
No `RUNAWAY:` or `SWEEP:` line means the scan failed, never that the crew is clean. `DEFER:` holds a rotation, and
a stop of a subagent that is itself, or holds, a /ship mid-run (its own cap stops it); stopping any other subagent
goes ahead.
a stop of a /ship reader mid-run, or of a subagent that holds one (the run's own cap stops it); stopping any other
subagent goes ahead.
## 2. Stop a subagent
@@ -254,10 +254,8 @@ Put the lines that apply into every brief you write:
message to a parent or Captain: send a READY, a decision you need, a blocker or the final report.
- **Compact returns.** A program returns only the lines the next step needs; big output goes to a file under
~/.capy/work and you read the part you need.
- **One /ship subagent per PR head.** A rerun or another PR gets a fresh subagent with the run directory path; never
message a finished /ship subagent to run another. Title it `ship #<n> at <head7> <4-char nonce>` and put
`GSTACK_SHIP_TASK_TITLE=<title>` in its brief: /ship then takes every reading from that one row and caps at
50M by default (`BUDGET_DEFAULT_CAP:`); raising the cap needs the owner's words.
- **/ship runs in the PR's own thread.** The thread follows `ship/DRIVER.md` itself and starts only the reviewers as
subagents; it never starts a subagent to run /ship. Raising a brief's `--token-cap` needs the owner's words.
- **Two review rounds.** Reader and review rounds stop at 2 per PR (R51), and every reader's title names the PR
(`#<n>`) so the scan can count them.
- **Rotate standing roles** at 250M own tokens or 3 days. An automation gets a fresh thread per run that archives
+4 -6
View File
@@ -88,8 +88,8 @@ cold starts (after the 5-minute cache lapsed) and empty wakes cost; `scan --wake
| `RUNAWAY_INPUT:`, `FETCH_FAILED:` | That thread wasn't read: fetch it again and rerun; never count it as OK. |
No `RUNAWAY:` or `SWEEP:` line means the scan failed, never that the crew is clean. `DEFER:` holds a rotation, and
a stop of a subagent that is itself, or holds, a /ship mid-run (its own cap stops it); stopping any other subagent
goes ahead.
a stop of a /ship reader mid-run, or of a subagent that holds one (the run's own cap stops it); stopping any other
subagent goes ahead.
## 2. Stop a subagent
@@ -118,10 +118,8 @@ Put the lines that apply into every brief you write:
message to a parent or Captain: send a READY, a decision you need, a blocker or the final report.
- **Compact returns.** A program returns only the lines the next step needs; big output goes to a file under
~/.capy/work and you read the part you need.
- **One /ship subagent per PR head.** A rerun or another PR gets a fresh subagent with the run directory path; never
message a finished /ship subagent to run another. Title it `ship #<n> at <head7> <4-char nonce>` and put
`GSTACK_SHIP_TASK_TITLE=<title>` in its brief: /ship then takes every reading from that one row and caps at
50M by default (`BUDGET_DEFAULT_CAP:`); raising the cap needs the owner's words.
- **/ship runs in the PR's own thread.** The thread follows `ship/DRIVER.md` itself and starts only the reviewers as
subagents; it never starts a subagent to run /ship. Raising a brief's `--token-cap` needs the owner's words.
- **Two review rounds.** Reader and review rounds stop at 2 per PR (R51), and every reader's title names the PR
(`#<n>`) so the scan can count them.
- **Rotate standing roles** at 250M own tokens or 3 days. An automation gets a fresh thread per run that archives
+1 -1
View File
@@ -8,7 +8,7 @@ table, and tell your Captain they are in place (<old code>
stays unarchived until every PR it opened or carries is merged or closed, R91); then pick up the table in order.
Work rules for this role (from /runaway-stopper, Step 4): one wait on all pending operations; a wake with nothing to
decide ends without a message; no acknowledgment or progress messages to your Captain; compact program returns;
one /ship subagent per PR head; at most 2 review rounds per PR. When you pass 250M own tokens or 3 days active,
run /ship in this thread, never in a subagent; at most 2 review rounds per PR. When you pass 250M own tokens or 3 days active,
write your own rotation handoff and tell your Captain.
Report to your Captain only with a READY, a decision you need, a blocker or your final report.
+3 -3
View File
@@ -1,9 +1,9 @@
<!-- AUTO-GENERATED from ship/DRIVER.md.tmpl — do not edit directly -->
<!-- Regenerate: bun run gen:skill-docs -->
# /ship driver: run /ship from a parent agent
# /ship driver
Read this, not `ship/SKILL.md`, when a parent agent runs /ship
(`SESSION_KIND: unattended`). Commands live in `<root>/bin/` (`<root>` holds `ship/`); run each with
Read this, not `ship/SKILL.md`, to run /ship (`SESSION_KIND: unattended`) in the PR's
own thread, never in a subagent. Commands live in `<root>/bin/` (`<root>` holds `ship/`); run each with
the `GSTACK_LAUNCH` assignments your installer printed (`. <its GSTACK_LAUNCH_FILE>`), never
`export $(...)`, `env`, `printenv` or a bare `set` in a tool fence.
+3 -3
View File
@@ -1,7 +1,7 @@
# /ship driver: run /ship from a parent agent
# /ship driver
Read this, not `ship/SKILL.md`, when a parent agent runs /ship
(`SESSION_KIND: unattended`). Commands live in `<root>/bin/` (`<root>` holds `ship/`); run each with
Read this, not `ship/SKILL.md`, to run /ship (`SESSION_KIND: unattended`) in the PR's
own thread, never in a subagent. Commands live in `<root>/bin/` (`<root>` holds `ship/`); run each with
the `GSTACK_LAUNCH` assignments your installer printed (`. <its GSTACK_LAUNCH_FILE>`), never
`export $(...)`, `env`, `printenv` or a bare `set` in a tool fence.
+2 -3
View File
@@ -11,9 +11,8 @@ Field-by-field reference: docs/ship-budget.md. Exit 0 continue or delegate, 3 st
note past the cap stops.
**Meter.** Read one per command:
- Capy: read `(await tools.thread.get({ thread_id: "<your own jam id>" })).cost` (your own jam, its
subagents included; a root thread's is `"this"`; a subagent with `GSTACK_SHIP_TASK_TITLE` reads its own row of the
root thread's `tasks` for every reading) in the same program as the
- Capy: read `(await tools.thread.get({ thread_id: "<your own jam id>" })).cost` (the thread that runs
/ship, its reviewers included) in the same program as the
`gstack-ship-budget` command, never its own call: `--reading <cost.tokens> --credits <cost.credits>`.
`--prior-reading <n>` (per-call charge; three of them price steps at the run's own median) is a reading
your previous call already took; never spend a call only to read the meter. One older than the run's last reading is ignored.
+2 -3
View File
@@ -9,9 +9,8 @@ Field-by-field reference: docs/ship-budget.md. Exit 0 continue or delegate, 3 st
note past the cap stops.
**Meter.** Read one per command:
- Capy: read `(await tools.thread.get({ thread_id: "<your own jam id>" })).cost` (your own jam, its
subagents included; a root thread's is `"this"`; a subagent with `GSTACK_SHIP_TASK_TITLE` reads its own row of the
root thread's `tasks` for every reading) in the same program as the
- Capy: read `(await tools.thread.get({ thread_id: "<your own jam id>" })).cost` (the thread that runs
/ship, its reviewers included) in the same program as the
`gstack-ship-budget` command, never its own call: `--reading <cost.tokens> --credits <cost.credits>`.
`--prior-reading <n>` (per-call charge; three of them price steps at the run's own median) is a reading
your previous call already took; never spend a call only to read the meter. One older than the run's last reading is ignored.
+16 -9
View File
@@ -122,22 +122,27 @@ describe('meter scope (GST-467)', () => {
}
});
// Value: protects=a /ship subagent metering its own task row can't grow past R70's 50M stop-and-look line (100M before Capy's token counts halved on 2026-11-15); fails_when=an observe-mode --reading-from task start with no cap stays uncapped, its note past 50M doesn't stop, a task-row run is labeled tree, or none, an explicit cap, admit mode, a root run or a tree-metered subagent get the default;
// why_new=FOUN-4's Subagent 40 reached 485M over five /ship runs in one context (GST-1279); a tree reading would count sibling lanes (autoplan review d2); seam=none; no_claim=that the lane passes the title
test('an observe-mode /ship subagent metering its own task row gets the 50M default; none, an explicit cap or a tree meter does not', () => {
// Value: protects=a /ship run metering its own counter (its thread's own jam, or a task row) can't grow past R70's 50M stop-and-look line (100M before Capy's token counts halved on 2026-11-15); fails_when=an observe-mode own-counter or --reading-from task start with no cap stays uncapped, its note past 50M doesn't stop, a task-row run is labeled tree, or none, an explicit cap, admit mode, a shared "this" reading or a tree-metered run get the default;
// why_new=FOUN-4's Subagent 40 reached 485M over five /ship runs in one context (GST-1279); GST-3466 moved /ship into the thread's own counter; a tree reading would count sibling lanes (autoplan review d2); seam=none; no_claim=that the lane passes the title
test('an observe-mode /ship run metering its own counter gets the 50M default; none, an explicit cap, a shared or tree meter does not', () => {
const sub = ['--mode', 'observe', '--reading', '10000000', '--credits', '100', '--reading-from', 'task'];
const h = fresh();
const s = h.sb(['start', '--record', h.record(), ...sub]);
expect(s.code, s.err).toBe(0);
expect(s.out).toContain('BUDGET_DEFAULT_CAP: 50M (a /ship subagent metering its own task row; --token-cap <n> or none to change it)');
expect(s.out).toContain('BUDGET_DEFAULT_CAP: 50M (a /ship run metering its own counter; --token-cap <n> or none to change it)');
expect(s.out).not.toContain(TREE);
const run = h.field(s.out, 'BUDGET_RUN', 'id');
expect(h.sb(['note', '--run', run, '--step', '6', '--reading', '50000000', '--credits', '150']).code).toBe(0);
expect(h.sb(['note', '--run', run, '--step', '9', '--reading', '62500000', '--credits', '160']).code).toBe(3);
const viaEnv = fresh();
expect(viaEnv.sb(['start', '--record', viaEnv.record(), '--mode', 'observe', '--reading', '10000000'], { GSTACK_SHIP_TASK_TITLE: 'ship #1 at abc1234 q7x2' }).out).toContain('BUDGET_DEFAULT_CAP: 50M');
for (const own of [['--mode', 'observe', '--reading', '1000000000'], ['--mode', 'observe', '--reading', '1000000000', '--reading-from', 'own']]) {
const o = fresh();
expect(o.sb(['start', '--record', o.record(), ...own]).out).toContain('BUDGET_DEFAULT_CAP: 50M');
}
for (const [args, env] of [[[...sub, '--token-cap', 'none'], {}], [sub, { GSTACK_SHIP_TOKEN_CAP: 'none' }], [[...sub, '--token-cap', '200M'], {}],
[['--mode', 'observe', '--reading', '1000000000'], {}], [['--reading', '1000000000', '--reading-from', 'task'], {}],
[['--mode', 'observe', '--reading', '1000000000', '--meter-scope', 'tree'], {}], [['--reading', '1000000000', '--reading-from', 'task'], {}],
[['--mode', 'observe', '--reading', '1000000000', '--reading-from', 'this'], {}],
[['--mode', 'observe', '--reading', '1000000000', '--subagent', '--reading-from', 'this'], {}]] as const) {
const o = fresh();
const out = o.sb(['start', '--record', o.record(), ...args], env);
@@ -172,11 +177,13 @@ describe('meter scope (GST-467)', () => {
expect(fs.readFileSync(path.join(ROOT, 'docs/troubleshooting.md'), 'utf8')).toContain(`<a id="${RESULT_CODES.METER_SCOPE_PARENT.anchor}"></a>`);
});
// Value: protects=the /ship brief tells a subagent to meter tree-scoped and the docs say where exact cost comes from; fails_when=the Capy skill or docs/ship-budget.md drops --meter-scope tree or the root-replay pointer;
// why_new=GST-467; seam=none; no_claim=agent compliance
test('the Capy skill and docs/ship-budget.md tell a subagent to pass --meter-scope tree; exact per-run cost comes from root replay threads', () => {
// Value: protects=the Capy skill has the thread that owns the PR run /ship and read its own counter, and the docs say how a subagent's reading is scoped and where exact cost comes from; fails_when=the skill drops the own-thread reading, sends /ship back to a subagent, or docs/ship-budget.md drops --meter-scope tree or the root-replay pointer;
// why_new=GST-467, GST-3466 (the G1 trial: /ship runs in the calling thread); seam=none; no_claim=agent compliance
test('the Capy skill has the thread running /ship read its own counter and start no /ship subagent; docs/ship-budget.md keeps the tree scope and root replay pointer', () => {
const skill = fs.readFileSync(path.join(ROOT, 'capy/skill/gstack/SKILL.md'), 'utf8').replace(/\s+/g, ' ');
expect(skill).toContain('--subagent --reading-from this --meter-scope tree');
expect(skill).toContain('tools.thread.get({ thread_id: "<your own jam id>" })` (the thread running /ship, its reviewers included)');
expect(skill).toContain('never start a subagent to run /ship');
expect(skill).not.toContain('--reading-from this --meter-scope tree');
const doc = fs.readFileSync(path.join(ROOT, 'docs/ship-budget.md'), 'utf8').replace(/\s+/g, ' ');
expect(doc).toContain('--meter-scope tree');
expect(doc).toContain(TREE);
@@ -0,0 +1,4 @@
{
"bytes": -124,
"why": "GST-3466: /ship runs in the PR's own thread, never a subagent; budget-handoff Meter drops the task-row clause"
}