Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

docs: crew lanes keep context cheap (bounded warm waits, lane start card, names-only AGENTS.md index) (#4060)

Garry Tan01572dec6d66
diff --git a/AGENTS.md b/AGENTS.md
index 52065c769..a572ea733 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -7,122 +7,77 @@ designer, QA lead, release engineer, debugger, and more.
## Available skills
Skills live in `.agents/skills/` (or `~/.claude/skills/gstack/` on Claude Code).
-Invoke them by name (e.g., `/office-hours`).
-
-### Plan-mode reviews
-
-| Skill | What it does |
-|-------|-------------|
-| `/office-hours` | Start here. Reframes your product idea before you write code. |
-| `/plan-ceo-review` | CEO-level review: find the 10-star product in the request. |
-| `/plan-eng-review` | Lock architecture, data flow, edge cases, and tests. |
-| `/plan-design-review` | Rate each design dimension 0-10, explain what a 10 looks like. |
-| `/plan-devex-review` | DX-mode review: TTHW, magical moments, friction points, persona traces. |
-| `/plan-tune` | Self-tune AskUserQuestion sensitivity per question. |
-| `/autoplan` | One command runs CEO → design → DX → eng review (eng always last). |
-| `/design-consultation` | Build a complete design system from scratch. |
-| `/spec` | Turn vague intent into a precise, executable spec in five phases. Files a GitHub issue, optionally spawns a Claude Code agent in a fresh worktree, and lets `/ship` close the source issue on merge. |
-
-### Implementation + review
-
-| Skill | What it does |
-|-------|-------------|
-| `/review` | Pre-landing PR review. Finds bugs that pass CI but break in prod; lists every gate edit for gate integrity. |
-| `/deslop-shared-libs` | Find worthwhile shared-code extractions in recent work. Recommendations only. |
-| `/write-skill` | Write or improve an agent skill without bloat: edit ladder, size per level (`gstack-skill-bill`), skill-to-bin drift check, full diets with a before/after test. |
-| `/test-audit` | Sweep existing tests for low-value, implementation-coupled or duplicate tests. Report-only unless you approve a batch. |
-| `/codex` | Second opinion via OpenAI Codex. Review, challenge, or consult modes. Available outside the Codex harness. |
-| `/claude-code` | Second opinion via Claude Code. Review, challenge, or consult modes. Available outside the Claude Code harness. |
-| `/investigate` | Systematic root-cause debugging. No fixes without investigation. |
-| `/verify` | Build-and-verify loop while you code: the repo's checks plus the tests pregate selects, fix, repeat, then hand off to `/ship`. Never green on an unmapped change. |
-| `/design-review` | Live-site visual audit + fix loop with atomic commits. |
-| `/design-shotgun` | Generate multiple AI design variants, comparison board, iterate. |
-| `/design-html` | Generate production-quality Pretext-native HTML/CSS. |
-| `/design-motion` | Turn an approved design into a showcase loop: MP4 for X, website GIF, 800×500 GIF, with seam, rest and overflow checks. |
-| `/devex-review` | Live developer experience audit (TTHW measured against the real flow). |
-| `/qa` | Test browser, API, CLI, job, worker and webhook behavior; reproduce bugs, fix them and re-verify. |
-| `/qa-only` | The same surface-aware QA, reporting findings and proposed tests without changing product code or tests. |
-| `/scrape` | Pull data from a web page in your Aside browser, with your real logged-in state. Read-only. On the fallback browser a codified browser-skill answers a repeat intent in ~200ms. |
-| `/skillify` | Codify the most recent successful `/scrape` flow into a permanent browser-skill (fallback browser only). |
-
-### Release + deploy
-
-| Skill | What it does |
-|-------|-------------|
-| `/ship` | Run tests, review, gate integrity, push, open PR. Workspace-aware version queue. |
-| `/land-and-deploy` | Merge the PR, wait for CI and deploy, verify production health. |
-| `/modernize` | Bring an aging PR onto its current base and decide MODERNIZE, REWORK or CLOSE, with `git range-diff` proof before a pinned-lease push. Never closes a PR itself. |
-| `/canary` | Post-deploy monitoring loop in your Aside browser (or gstack's own when Aside is absent). |
-| `/landing-report` | Read-only dashboard for the workspace-aware ship queue. |
-| `/document-release` | Audit relevant docs before final verification on every ship; also supports standalone documentation updates. |
-| `/document-generate` | Generate Diataxis docs (tutorial / how-to / reference / explanation) from code. |
-| `/setup-deploy` | One-time deploy config detection (Fly.io, Render, Vercel, etc.). |
-| `/gstack-upgrade` | Update gstack to the latest version. |
-
-### Operational + memory
-
-| Skill | What it does |
-|-------|-------------|
-| `/context-save` | Save working context (git state, decisions, remaining work). |
-| `/context-restore` | Resume from a saved context, even across Conductor workspaces. |
-| `/learn` | Manage what gstack learned across sessions. |
-| `/retro` | Weekly retro with per-person breakdowns and shipping streaks. |
-| `/health` | Code quality dashboard (type checker, linter, tests, dead code). |
-| `/captain` | Run a crew from one controller: READY contract, merge trains, digest, approvals shapes, daily flaky pass. Also `/crew`. Templates in `captain/templates/`, team guide in `docs/captain.md`. |
-| `/benchmark` | Performance regression detection (page load, Core Web Vitals). |
-| `/ubicloud` | Run a heavy suite, build or eval on an ephemeral 16-vCPU Ubicloud VM: TTL-named VMs with a reaper, quota preflight, hang watchdog, one committed verify per repository. |
-| `/runaway-stopper` | Find runaway Capy threads and subagents (own tokens past 500M, active past 3 days, subagent past 100M, empty wakes, review rounds past 2), stop or rotate them at a clean point, and prevent the pattern. |
-| `/benchmark-models` | Cross-model benchmark for skills (Claude, GPT, Gemini, plus particle-1 and DeepSeek V4.1 Flash through OpenRouter, side-by-side). |
-| `/eval-plan` | Preregister a paid eval (bars, arms, decoys, stop rules), dry-run it for $0, pilot three priced items, then approve the spend. |
-| `/cso` | Supported security findings with explicit coverage. Static assessment remains available without catalog profiles. Contained runtime and scanner execution needs Docker and a matching qualified profile. The runtime catalog qualifies ten images: Node 24.4.0, Bun 1.3.10, Python 3.13.4 with uv 0.8.0, Rails on Ruby 3.4.4, and PostgreSQL 17.2, each for linux/amd64 and linux/arm64. The scanner catalog qualifies twelve: gitleaks, OSV-Scanner, Schemathesis, Semgrep, Trivy and zizmor on both platforms. Without Docker, or where no profile matches (native Windows Docker, for example), `/cso` runs static assessment only. Runtime-tested bundles authenticate separate external assertions. Project-test completion remains `self_reported` because target code controls the test process; `tested` is reserved for a future target-independent completion witness. |
-| `/setup-gbrain` | Set up gbrain for cross-machine session memory sync. |
-| `/sync-gbrain` | Keep gbrain current with this repo's code; refresh agent search guidance in CLAUDE.md. |
-
-### Browser + agent integration
-
-Every browser skill drives the Aside AI browser first (macOS 15+, aside.com) —
-the user's real browser with their real sessions, through `aside repl` scripts;
-gstack never installs it. When Aside is not installed or not running (Linux,
-Windows, a closed Aside app) the same skills fall back automatically to gstack's
-own headless Chromium (`$B`), which is where the three skills under `/browse` apply.
-
-| Skill | What it does |
-|-------|-------------|
-| `/browse` | Drive a browser: open a page, read it, click through a flow, screenshots, console errors. Aside first; gstack's own Chromium (~100ms/command) as the fallback. Every other browser skill stands on it. |
-| `/open-gstack-browser` | Launch the visible GStack Browser with sidebar + stealth — the headed face of the fallback engine. |
-| `/setup-browser-cookies` | Import cookies from your real browser into the fallback engine for authenticated testing. Unnecessary on Aside. |
-| `/pair-agent` | Pair a remote AI agent (OpenClaw, Codex, etc.) with gstack's own browser over a scoped tunnel. |
-
-### iOS QA — drive real iPhones over USB or Tailscale (v1.43.0.0+)
-
-| Skill | What it does |
-|-------|-------------|
-| `/ios-qa` | Live-device iOS QA via USB CoreDevice tunnel + embedded StateServer. Optionally exposes the device over Tailscale so remote agents can drive it. |
-| `/ios-fix` | Autonomous iOS bug fixer with regression snapshot capture. |
-| `/ios-design-review` | Designer's-eye QA on a real iPhone — 10-dimension Apple HIG rubric. |
-| `/ios-clean` | Convenience: strip DebugBridge + #if DEBUG wiring before a Release build. |
-| `/ios-sync` | Regenerate the iOS debug bridge against the latest upstream templates. |
-
-Companion CLIs (run on the Mac that's plugged into the device):
-
-| Command | What it does |
-|---------|-------------|
-| `gstack-ios-qa-daemon` | Mac-side broker. Loopback by default; `--tailnet` adds a Tailscale-facing listener with capability tiers and audit logging. |
-| `gstack-ios-qa-mint` | Owner-grant CLI for the tailnet allowlist (`grant`/`revoke`/`list`). |
-| `gstack-ios-qa-regen` | Regenerate the canonical local DebugBridge package and typed accessors (`--app-source` / `--bridge-dir`). |
-
-End-to-end walkthrough: [docs/howto-ios-testing-with-gstack.md](docs/howto-ios-testing-with-gstack.md).
-
-### Safety + scoping
-
-| Skill | What it does |
-|-------|-------------|
-| `/careful` | Warn before destructive commands (rm -rf, DROP TABLE, force-push). |
-| `/freeze` | Lock edits to one directory. Hard block, not just a warning. |
-| `/guard` | Activate both careful + freeze at once. |
-| `/unfreeze` | Remove directory edit restrictions. |
-| `/make-pdf` | Turn any markdown file into a publication-quality PDF. Renders through Aside, or gstack's own browser when Aside is absent. |
-| `/diagram` | English in, diagram out: mermaid source + editable .excalidraw + SVG/PNG, offline. Renders through Aside, or gstack's own browser when Aside is absent. |
+Invoke them by name (e.g., `/office-hours`). This index lists names only; what each
+skill does, with examples, is in [docs/skills.md](docs/skills.md). The iOS companion
+CLIs (`gstack-ios-qa-daemon`, `gstack-ios-qa-mint`, `gstack-ios-qa-regen`) are in
+[docs/howto-ios-testing-with-gstack.md](docs/howto-ios-testing-with-gstack.md).
+
+| Skill | Area |
+|-------|------|
+| `/office-hours` | plan |
+| `/plan-ceo-review` | plan |
+| `/plan-eng-review` | plan |
+| `/plan-design-review` | plan |
+| `/plan-devex-review` | plan |
+| `/plan-tune` | plan |
+| `/autoplan` | plan |
+| `/design-consultation` | plan |
+| `/spec` | plan |
+| `/review` | build + review |
+| `/deslop-shared-libs` | build + review |
+| `/write-skill` | build + review |
+| `/test-audit` | build + review |
+| `/codex` | build + review |
+| `/claude-code` | build + review |
+| `/investigate` | build + review |
+| `/verify` | build + review |
+| `/design-review` | build + review |
+| `/design-shotgun` | build + review |
+| `/design-html` | build + review |
+| `/design-motion` | build + review |
+| `/devex-review` | build + review |
+| `/qa` | build + review |
+| `/qa-only` | build + review |
+| `/scrape` | build + review |
+| `/skillify` | build + review |
+| `/ship` | release + deploy |
+| `/land-and-deploy` | release + deploy |
+| `/modernize` | release + deploy |
+| `/canary` | release + deploy |
+| `/landing-report` | release + deploy |
+| `/document-release` | release + deploy |
+| `/document-generate` | release + deploy |
+| `/setup-deploy` | release + deploy |
+| `/gstack-upgrade` | release + deploy |
+| `/context-save` | operational + memory |
+| `/context-restore` | operational + memory |
+| `/learn` | operational + memory |
+| `/retro` | operational + memory |
+| `/health` | operational + memory |
+| `/captain` | operational + memory |
+| `/benchmark` | operational + memory |
+| `/ubicloud` | operational + memory |
+| `/runaway-stopper` | operational + memory |
+| `/benchmark-models` | operational + memory |
+| `/eval-plan` | operational + memory |
+| `/cso` | operational + memory |
+| `/setup-gbrain` | operational + memory |
+| `/sync-gbrain` | operational + memory |
+| `/browse` | browser |
+| `/open-gstack-browser` | browser |
+| `/setup-browser-cookies` | browser |
+| `/pair-agent` | browser |
+| `/ios-qa` | iOS QA |
+| `/ios-fix` | iOS QA |
+| `/ios-design-review` | iOS QA |
+| `/ios-clean` | iOS QA |
+| `/ios-sync` | iOS QA |
+| `/careful` | safety + scoping |
+| `/freeze` | safety + scoping |
+| `/guard` | safety + scoping |
+| `/unfreeze` | safety + scoping |
+| `/make-pdf` | safety + scoping |
+| `/diagram` | safety + scoping |
## Validation discipline
diff --git a/captain/templates/brief.md b/captain/templates/brief.md
index b68b6b5e6..02e008d81 100644
--- a/captain/templates/brief.md
+++ b/captain/templates/brief.md
@@ -11,6 +11,14 @@ Owns: <the files and directories this lane may edit; everything else is routed t
Do not touch: <files other live lanes own, each with its lane>
Plan: required | approved: <autoplan run dir, or its checkpoint dir> | exempt: <reason from the exemption list>
Spend cap: <focused paid runs per PR, from SPEND>
+Read: <the files and sections this lane needs, by path; the brief names them, never pastes them>
+Context: after the install check, read the gstack skill's lane-card.md (the checkout's
+ capy/skill/gstack/lane-card.md when the skill copy lacks it), not its whole SKILL.md.
+ 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
+ tell me in one line (docs/captain.md, Lane context).
1. Plan (when Plan: required). After the session-start install check, install for autoplan
and follow autoplan/DRIVER.md "On Capy" (launch file sourced, GSTACK_AUTOPLAN_CHECKPOINT_DIR
diff --git a/capy/skill/gstack/SKILL.md b/capy/skill/gstack/SKILL.md
index 7dabc7458..e4795cd88 100644
--- a/capy/skill/gstack/SKILL.md
+++ b/capy/skill/gstack/SKILL.md
@@ -7,7 +7,7 @@ description: Install and use gstack in Capy and Claude Code. Load at session sta
## Session start: check, then install only when needed
-Resolve `scripts/install.sh` relative to this SKILL.md, not the working repository. It is a frozen bootstrapper: it prints `gstack-capy-skill: wrapper <n> (<path>)` first, learns the supported minimum from gstack's remote, and hands over to the checkout's own wrapper (`bin/gstack-capy-session`).
+**Crew lanes:** after this check passes, read [lane-card.md](lane-card.md), not the rest of this file; it says what to read before /ship. Resolve `scripts/install.sh` relative to this SKILL.md, not the working repository. It is a frozen bootstrapper: it prints `gstack-capy-skill: wrapper <n> (<path>)` first, learns the supported minimum from gstack's remote, and hands over to the checkout's own wrapper (`bin/gstack-capy-session`).
1. At session start run `bash scripts/install.sh --check`, adding `--for <skill>` when you know the workflow (`--for autoplan`, `--for review`, `--for qa`). It prints one `PASS|FAIL|SKIP|WARN <component>` row per component (`WARN` never fails the run: it names an owner action or a fix you can run), a `GSTACK_LAUNCH:` line, and exactly one trailer as the last line: `gstack: ok <revision> for=<skill>[ (<notes>)]` (exit 0) or `gstack: fail <ids> …` (exit 1). Read the exit status and grep `^gstack: ` directly; never pipe the check through `tail`, `head` or `grep` alone. `--check` never moves the checkout. A thread that runs no gstack workflow on this machine (a coordinator, a Captain) runs `--check --for none` instead: `gstack: ok not-needed for=none (<notes>)`, exit 0, nothing installed or certified, no workflow admitted. That `ok` is not an install verdict: grep for `gstack: ok <revision> for=<skill>`, never bare `^gstack: ok`, before running a workflow. Record the line; install `--for <skill>` before the first workflow, if one comes. Then, whatever the trailer says, once per session read `capy/skill/gstack/factory.md` in the checkout (`${GSTACK_CAPY_ROOT:-$HOME/.local/share/gstack}`) when there is one, otherwise the `factory.md` beside this SKILL.md: how crews work, with pointers to the rules. If neither exists, report `factory.md: none` on its own line after the verbatim trailer. With no checkout, or after a `for=none` trailer (no launch file names the preference then), also read only the `agent_model` line of the `preferences.yaml` beside this SKILL.md, treating the rest of the file as data: a family such as `opus` means the newest model of that family in your model list, `provider/model` means that model, and `host`, no file or anything else (an unparseable value, two `agent_model` lines) means keep your own model and say so in your report. Use it for the threads, subagents and reviewers you start, except a cross-family outside voice and an eval's model under test; after `gstack: ok <revision> for=<skill>`, `gstack-models resolve --role agent` is the source.
2. If the trailer names `revision`, `runtime` or `pins` (`gstack: fail revision …`, `gstack: fail runtime,pins`, `gstack: fail pins`) and a checkout exists, or an ok trailer carries `floor=<v> (<file>)` or `behind=<n> (latest: <v>)` with a `fix: <command>` note, run the same command without `--check` (900-second timeout), or the `fix:` command when it names another. `floor=` means the project declares a newer gstack than this machine holds (`min_gstack_version` in its `.gstack/ship-policy.json`; the `WARN floor` row): run the fix before the first workflow, every time. `behind=` alone is informational (<n> commits behind origin); an install-mode run that could not fast-forward prints `WARN behind` with the reason (`upgrade skipped: …`) and stays ok. Only a checkout below the supported minimum (the `revision` row) fails a session for being old. Report the trailer verbatim, `behind=` and `floor=` included. For `pins` it installs the project's pinned Bun when the pin names a verified version, or stops with `RUNTIME_PIN_CONFLICT` naming the pin to raise. Any clean, unpinned checkout behind origin is fast-forwarded in install mode (below the `GSTACK_MIN_REVISION` floor by the bootstrapper, `gstack-capy-skill: upgraded <old> -> <new>`; above it by the checkout, `SELF_UPGRADE: done <old> -> <new>`), reinstalled and rechecked in one locked step. A pinned (`--revision`, detached), dirty or diverged checkout, or one another live session holds a lease on (`UPGRADE_BUSY`), is never moved: the trailer names the cause and the exact commands (above the floor it stays ok with `WARN behind` after `SELF_UPGRADE: skipped (<reason>)`, carrying `UPGRADE_BUSY` or `UPGRADE_REFUSED`). A lease whose pid was reused after a wake is reclaimed on its own. `GSTACK_CAPY_AUTO_UPGRADE=0` disables every fast-forward, `GSTACK_CAPY_SELF_UPGRADE=off` only the above-floor one.
@@ -28,11 +28,11 @@ With `GSTACK_CAPY=1`, a workflow started in an unattended or spawned session che
## Load the right workflow
-For Capy running GPT-6 Astra, read `${CODEX_HOME:-$HOME/.codex}/skills/gstack/SKILL.md` for routing, then `${CODEX_HOME:-$HOME/.codex}/skills/gstack-<skill>/SKILL.md` for the selected workflow. These are generated for GPT-6 Astra, not the Claude source files.
+For Capy running GPT-6 Astra, read `${CODEX_HOME:-$HOME/.codex}/skills/gstack/SKILL.md` for routing, then `${CODEX_HOME:-$HOME/.codex}/skills/gstack-<skill>/SKILL.md` for the selected workflow. They are generated for GPT-6 Astra.
-For Claude Code, read `~/.claude/skills/gstack/SKILL.md` for routing and `~/.claude/skills/<skill>/SKILL.md` for the selected workflow. When launching a Claude Code session, tell it to load gstack and name the intended workflow. For Capy running a Claude model, the Claude instruction files can be read directly with the Capy adaptations below; that does not turn Capy into the Claude Code harness.
+For Claude Code, read `~/.claude/skills/gstack/SKILL.md` for routing and `~/.claude/skills/<skill>/SKILL.md` for the selected workflow. When launching a Claude Code session, tell it to load gstack and name the intended workflow. Capy on a Claude model reads the Claude files directly with the Capy adaptations below; that does not make Capy the Claude Code harness.
-If no specific skill was requested, use the router's task-to-skill mapping. Read only the selected workflow and its referenced files. For other models, use the closest applicable instruction profile without claiming a model-specific profile was generated or evaluated for them.
+If no specific skill was requested, use the router's task-to-skill mapping. Read only the selected workflow and its referenced files. Other models use the closest profile, never claiming one was generated or evaluated for them.
## Unattended runs for a parent agent
@@ -50,7 +50,7 @@ Token caps on /ship: pass a brief's cap as `--token-cap <n>`. /ship reads `cost.
## Plan, approve, ship
-Every Capy thread that uses gstack follows these for new work, under a Captain or on its own. The rule in full is `docs/captain.md`, "Plan before build"; the lane side is section 3 of captain.md in this folder.
+Every Capy thread using gstack follows these for new work, Captain or not. The rule in full is `docs/captain.md`, "Plan before build"; the lane side is section 3 of captain.md in this folder.
- **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 (`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>"`.
@@ -62,7 +62,7 @@ Exempt from the plan step: read-only work, the daily flaky pass's repairs, slot
## Working under a Captain
-When you work for a Capy Captain (a crew thread) or straight for a person, gstack's decisions reach them through you. Every workflow started with the `GSTACK_LAUNCH` line prints `CAPY: on` and a `capy-asks` block that repeats these rules. The full guide, with worked examples and copy-paste templates, is [captain.md](captain.md) in this folder.
+When you work for a Capy Captain (a crew thread) or straight for a person, gstack's decisions reach them through you. Every workflow started with the `GSTACK_LAUNCH` line prints `CAPY: on` and a `capy-asks` block that repeats these rules. The full guide, with examples and templates, is [captain.md](captain.md).
- **How approvals flow.** A crew thread never asks the person directly. It sends the ask to its Captain as a needs-you report, and the Captain asks the person in plain words and brings back their exact reply. A thread with no Captain asks the person with a Capy question. An answer covers only the thread and scope it was asked for.
- **Standing approvals need no ask.** These are the ones your Captain lists in its rules (for example "merge when green, through a train"). Cite the rule instead of asking again.
@@ -85,4 +85,4 @@ In a repository with a sealed configuration (a `sealed` key in its `.gstack/preg
## Maintenance
-`bash scripts/install.sh --check` is the health check; `bash scripts/install.sh` installs or repairs and fast-forwards a checkout below the supported minimum. Between minimums, `~/.local/share/gstack/bin/gstack-upgrade --check` says whether the checkout is behind, and `~/.local/share/gstack/bin/gstack-upgrade` fast-forwards it to the tip of the default branch and reinstalls (it refuses dirty, diverged or pinned checkouts and never stashes or resets). The installer is for Capy's Ubuntu cloud machines with Git, curl, Node.js, flock and timeout; do not run it on a personal device without permission.
+`bash scripts/install.sh --check` is the health check; `bash scripts/install.sh` installs or repairs and fast-forwards a checkout below the supported minimum. Between minimums, `~/.local/share/gstack/bin/gstack-upgrade --check` says whether the checkout is behind, and `~/.local/share/gstack/bin/gstack-upgrade` fast-forwards it to the tip of the default branch and reinstalls (it refuses dirty, diverged or pinned checkouts and never stashes or resets). The installer targets Capy's Ubuntu cloud machines (Git, curl, Node.js, flock, timeout); never run it on a personal device without permission.
diff --git a/capy/skill/gstack/lane-card.md b/capy/skill/gstack/lane-card.md
new file mode 100644
index 000000000..eae6cfced
--- /dev/null
+++ b/capy/skill/gstack/lane-card.md
@@ -0,0 +1,40 @@
+# Lane start card
+
+For a crew lane (a thread working for a Captain). Read this once `gstack: ok <revision> for=<skill>` is in hand from this machine's install check, instead of the rest of [SKILL.md](SKILL.md). It keeps what a lane needs between the check and /ship. Before you run /ship, read SKILL.md § "Unattended runs for a parent agent" and § "Plan, approve, ship". For anything else (an upgrade that fails, driving /autoplan, loading another workflow, maintenance), read the matching SKILL.md section.
+
+## After the check
+
+- Report the trailer verbatim in your first report, `floor=` and `behind=` notes included. A `floor=` note or a `fix:` command runs before the first workflow (§ "Session start: check, then install only when needed", step 2).
+- Read `capy/skill/gstack/factory.md` in the checkout once per session.
+- Start every shell that runs a gstack command with `. <GSTACK_LAUNCH_FILE>`. Never re-type the assignments as `export $(...)`, and never run `env`, `printenv`, a bare `set` or a bare `export`: they print API keys into the transcript. Hand a child agent the file path, never the values.
+- Every subagent runs its own `--check` and puts its trailer in its first report; a read-only reviewer uses `--for review-voice`. One machine's install never covers another.
+- A workflow that prints `INSTALL: fail …` and exits 3 refuses this install: run its fix and start again. A planning-only install does not admit `review`, `ship` or `qa`; run `--for <that skill>` first.
+- Run directories and scratch live under `~/.capy/work/<name>`, never `/tmp`, which Capy wipes when a machine sleeps.
+
+## Plan, approve, ship
+
+- 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`.
+- Never merge. The controller merges on a recorded standing approval.
+
+## Under a Captain
+
+- Asks go to the Captain as a needs-you report, never to the person. Cite a standing approval instead of asking again.
+- A fresh ask is always needed for a product or behaviour decision, spend over a stated cap, anything published outside the repository, a change to a threshold, budget or trial count, closing someone's contribution without landing it, and anything destructive.
+- Record every answer with `gstack-approvals add` or `gstack-approvals import`; `gstack-approvals render` prints the table for your report and the PR body. Full guide: [captain.md](captain.md).
+
+## Keep context cheap
+
+- 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.
+- 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.
+- 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.
+
+## Before a push
+
+In a repository with a `sealed` key in `.gstack/pregate.json`, run `~/.local/share/gstack/bin/gstack-pregate sealed` before every push and every pull request (§ "Before any push or pull request").
+
+## Capy adaptations
+
+An instruction to invoke `Skill` means read that SKILL.md. Messages and questions go through Capy's tools; plain assistant text reaches nobody. Hooks are advisory here; report a missing capability instead of claiming an equivalent. Selecting a model in Capy installs no Codex or Claude Code CLI; a subagent on another model family is a full outside voice. Installing gstack authorizes no merge, deploy or destructive step (§ "Adapt host-specific instructions to Capy").
diff --git a/changelog.d/gsta-332-lane-context.md b/changelog.d/gsta-332-lane-context.md
new file mode 100644
index 000000000..acca3edf1
--- /dev/null
+++ b/changelog.d/gsta-332-lane-context.md
@@ -0,0 +1,5 @@
+### Changed
+
+- **Crew lanes keep their context cheap, and docs/captain.md says how.** A new "Lane context" section covers four habits. A lane that expects a wait under about 30 minutes checks in every 240 seconds, for about 30 minutes at most, so its prompt cache stays warm; a cold restart after five idle minutes costs about eight times as much as a warm step. Longer waits still sleep, the controller never warm-waits, and a lane still sleeps while /ship runs. Independent reads go in one parallel program, each call returns 4k characters or less, and long output goes to files. A lane past twice the crew's median lane spend writes `handoffs/<code>/next.md`, and the controller decides whether it continues, rotates or parks, below the crew's hard spend stop. The brief template gains a `Read:` line and a `Context:` line that say the same, and docs/unattended.md notes the warm-wait exception.
+- **The gstack Capy skill has a lane start card.** `capy/skill/gstack/lane-card.md` (about 1,100 tokens) is what a crew lane reads once its install check passes, instead of the rest of the skill's SKILL.md. It points to the SKILL.md /ship sections, which lanes still read before shipping. SKILL.md stays inside its 5,315-token context budget. Owners copy the skill folder as usual to pick it up.
+- **AGENTS.md lists skills by name only.** The catalog tables, about 9.8 KB that every agent reading AGENTS.md loaded each session, are now a names-only index of about 2.7 KB that points to docs/skills.md for what each skill does. Validation discipline, build commands, platform support and key conventions are unchanged. The /cso runtime and scanner catalog details that lived only in AGENTS.md moved to docs/skills.md.
diff --git a/docs/captain.md b/docs/captain.md
index 552ba2916..2c60a8aab 100644
--- a/docs/captain.md
+++ b/docs/captain.md
@@ -139,6 +139,40 @@ such decision with a plain-language explanation of every option: what it is, why
matters, what each answer does, and what it costs. A gate code or a tool's result line
alone is not an ask.
+## Lane context
+
+Every step a lane takes re-reads its whole conversation. A step within about five minutes
+of the previous one reads it from the prompt cache; after five idle minutes the cache is
+gone and the next step costs about eight times as much. Fixed instruction text and idle
+restarts, not checks, are now most of a lane's own spend, so a lane keeps its context
+cheap:
+
+- **Warm waits.** When a lane expects a wait under about 30 minutes (a CI run, a test
+ tier, a background build), it checks in every 240 seconds: on Capy, `wait` on the
+ operation with `duration_seconds: 240`, and on a timer wake that brings nothing new it
+ re-issues the same wait silently, with no message. Once a warm wait has run about 30
+ minutes, or past the end the lane expected, the lane stops re-issuing the timer and
+ sleeps on the operation or pull request watch alone. 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](unattended.md#report-length)). The controller
+ never warm-waits, and a lane still sleeps while /ship runs
+ ([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
+ output (logs, test output, diffs) goes to a file under `~/.capy/work`, and the lane reads
+ the part it needs with `grep` or a paged read.
+- **Start card.** Once the install check passes, a lane reads
+ [lane-card.md](../capy/skill/gstack/lane-card.md) instead of the rest of the gstack
+ skill's SKILL.md. It still reads the SKILL.md sections on /ship before it ships.
+- **Tail check.** When a lane's spend passes twice the crew's median lane spend per merged
+ PR (about $50 at today's prices), it writes `handoffs/<code>/next.md` in the controller's
+ drive (what is done, what is left and what finishing costs) and tells the controller in
+ one line. The controller decides whether the lane continues, rotates to a fresh lane
+ that starts from that file, or parks. This sits below the crew's hard spend stop (a
+ per-PR figure in the controller's rules), where the lane stops and asks whether the PR
+ is still worth it. Spend is the
+ thread's credit meter, never a token count.
+
## New threads join the crew
A crew thread never creates a thread itself. It asks its Captain, and the Captain creates
diff --git a/docs/skills.md b/docs/skills.md
index a96f83d09..e46831b02 100644
--- a/docs/skills.md
+++ b/docs/skills.md
@@ -1088,6 +1088,8 @@ This is my **Chief Security Officer**.
Run `/cso` for a bounded static investigation with an application model, challenged findings, and explicit coverage; static assessment remains available when no runtime or scanner catalog profile is qualified. With matching qualified profiles, `/cso --comprehensive` can prepare Node/Bun, Python, and Rails applications in contained local runtimes, reproduce a defect, and retain a reviewable repair candidate without changing the working branch. An out-of-process witness can authenticate the external boot, legitimate-control, and security assertions and issue a `runtime_tested` bundle. Project-test completion remains `self_reported` because target code shares that process and can forge reporter output or terminate the runner; recorded command, count, exit, and output hashes are diagnostic evidence, not a target-independent completion witness. Every report shows assertion, test-completion, and review assurance separately. The `tested` state is reserved for a future target-independent witness and is not emitted today. `/cso --doctor`, `--resume`, `--replay`, and `--recheck` diagnose prerequisites, recover interrupted work, repeat recorded verification, and establish current-source closure from fresh evidence.
+Contained runtime and scanner execution needs Docker and a matching qualified profile. The runtime catalog qualifies ten images: Node 24.4.0, Bun 1.3.10, Python 3.13.4 with uv 0.8.0, Rails on Ruby 3.4.4, and PostgreSQL 17.2, each for linux/amd64 and linux/arm64. The scanner catalog qualifies twelve: gitleaks, OSV-Scanner, Schemathesis, Semgrep, Trivy and zizmor on both platforms. Without Docker, or where no profile matches (native Windows Docker, for example), `/cso` runs static assessment only.
+
```
You: /cso
diff --git a/docs/unattended.md b/docs/unattended.md
index 71caf1272..427841a72 100644
--- a/docs/unattended.md
+++ b/docs/unattended.md
@@ -192,7 +192,8 @@ A parent reads many lanes, so length is a cost it pays per lane. A READY block
holds its required lines plus at most 150 words; a completion report holds at
most 300 words; a subagent brief names the files to read instead of pasting
them. Evidence goes in files the report points to. Waits go on operations,
-never on polling wakes.
+never on polling wakes, except a crew lane's warm wait under about 30 minutes
+([captain.md](captain.md#lane-context)).
### Token caps and fresh-context handoffs
diff --git a/test/captain-skill.test.ts b/test/captain-skill.test.ts
index 3c4e68df7..1461b1bdf 100644
--- a/test/captain-skill.test.ts
+++ b/test/captain-skill.test.ts
@@ -135,6 +135,21 @@ describe('/captain skill', () => {
}
});
+ test('the lane start card cites real SKILL.md sections, stays short, and docs/captain.md carries the lane context rules', () => {
+ const capySkill = read('capy/skill/gstack/SKILL.md');
+ const card = read('capy/skill/gstack/lane-card.md');
+ const headings = new Set([...capySkill.matchAll(/^## (.+)$/gm)].map(m => m[1]));
+ const cited = [...card.matchAll(/§ "([^"]+)"/g)].map(m => m[1]);
+ expect(cited).toContain('Unattended runs for a parent agent');
+ expect(cited).toContain('Plan, approve, ship');
+ expect(cited.filter(h => !headings.has(h!))).toEqual([]);
+ expect(capySkill).toMatch(/## Session start[^#]*?read \[lane-card\.md\]\(lane-card\.md\), not the rest of this file/);
+ expect(Buffer.byteLength(card)).toBeLessThanOrEqual(6800);
+ const doc = read('docs/captain.md').replace(/\s+/g, ' ');
+ for (const s of ['`duration_seconds: 240`', 'stops re-issuing the timer', 'The controller never warm-waits', '4k characters or less', 'twice the crew\'s median lane spend', '`handoffs/<code>/next.md`']) expect(doc, s).toContain(s);
+ expect(read('captain/templates/brief.md')).toMatch(/^Read: <[^>]+>$/m);
+ });
+
test('docs/captain.md links resolve and the skill is registered where skills are listed', () => {
const doc = read('docs/captain.md');
const links = [...doc.matchAll(/\]\(([^)#\s]+)(?:#[^)]*)?\)/g)].map(m => m[1]).filter(l => !/^https?:/.test(l));