Skip to content

Load the never-print-secrets rule in every skill on every host, with the commands it missed (GST-2753) - #4382

Merged
capy-ai[bot] merged 3 commits into
mainfrom
never-print-secrets-shared-rule
Nov 16, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
never-print-secrets-shared-rule

Conversation

@garrytan

@garrytan garrytan commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Every gstack skill, on every host, now tells the agent never to print a whole environment, git config or process table, and how to read the one value it needs instead.

Why: in our own agent teams, tokens leaked through exactly these commands, and the old rule loaded only in the Capy wrapper and missed git config --list and process listings.
Nothing to do: the next ./setup or upgrade picks it up.

Summary, why and blast radius

Summary

A new Ground Rules section in the shared preamble lists the commands that print a whole environment, git config or process table, with the safe form for each. It also says to wait on CI with one gstack-pr-wait call instead of a poll loop or gh pr checks --watch.

Why

Run tokens leaked through these commands in real agent sessions. The old rule lived only in the Capy wrapper, so other hosts never saw it.

Blast radius

Prompt text only. Every skill that loads the shared preamble gets about 600 more bytes. Seven skills with no shared preamble (careful, cso, deslop-shared-libs, freeze, gstack-upgrade, guard, unfreeze) are unchanged.

Documentation audit

Status: current. No documentation edits were needed, because the branch already updated the affected doc.

Scope: The audit covered base 0326b14 to head 15d80ac on never-print-secrets-shared-rule, plus the unstaged change to changelog.d/never-print-secrets-shared-rule.md. The change adds a pinned shared-preamble piece, ground-rules, generated by scripts/resolvers/preamble/generate-ground-rules.ts. It tells every skill never to print a whole environment, git config or process table, and to wait on CI with one gstack-pr-wait call. The rest of the diff is the regenerated SKILL.md and preamble outputs, plus updated size guards and budgets.

Documentation health

  • docs/loadouts.md: current. Its Pinned row and its Lite on Claude Opus 5.5 section name the Ground Rules, which matches modules/loadouts.json and PREAMBLE_PIECES.
  • changelog.d/never-print-secrets-shared-rule.md: current. It is accurate against the generator and against gstack-pr-wait --help. I reviewed it but did not edit it, because changelog edits belong to the parent.
  • docs/capy-install.md, docs/state-root.md, capy/skill/gstack/SKILL.md and capy/skill/gstack/lane-card.md: current. They agree with the new rule.
  • AGENTS.md, CLAUDE.md and CONTRIBUTING.md: no change needed.

Coverage debt: The Ground Rules piece has reference coverage in docs/loadouts.md and explanation coverage in its generator docstring and the changelog fragment. It has no how-to or tutorial, which is acceptable for a guardrail rule. There are no critical gaps.

Diagram drift: None. No architecture diagram names preamble pieces.

Agent notes

Where the rule lives. A new preamble piece, scripts/resolvers/preamble/generate-ground-rules.ts, renders a ## Ground Rules section at every tier (minTier: 1). Tier 1 skills carry it inline; tier 2+ skills get it in the shared sections/preamble.md that preamble-hoist.ts writes for every host. gen:skill-docs --host all renders it for Claude Code, Codex, Factory, Kiro, OpenCode and the other hosts, so this is the one place every host loads. ETHOS.md is only pointed at, never loaded, so it was not the home. The piece is pinned in modules/loadouts.json so no model loadout drops it, and docs/loadouts.md lists it with the other pinned pieces.

What it bans. env; bare printenv, set and export, and an export $(...) that expands to a bare export; export -p/-n; declare -p/-x; typeset -p; set -x; git config --list/-l (it can print a proxy login header); any ps with full args (ps aux, ps -ef, ps -o args); docker top ... args and docker inspect's Env block. The safe form: git config --get <name>, [ -n "${NAME:-}" ] && echo set for a variable, processes by name or pid. printenv NAME is not taught as the safe form: test/launch-env-echo-ratchet.test.ts bans printenv with a name in every skill fence, and printing a named secret still prints it.

CI waits. One line: wait on CI with one gstack-pr-wait <n> --until green call, never a poll loop or gh pr checks --watch. The first draft recommended gh pr checks --watch; review pointed out that it spends the shared GitHub GraphQL quota gstack moved off (GST-1713), so it now names gstack's REST-based watcher.

Left alone. The Capy wrapper's launch-file sentence (capy/skill/gstack/SKILL.md) keeps its own short ban, because it loads before any workflow and explains the export $(...) trap specific to the launch file.

Size guards. +614 bytes per skill (+544 at b681106, +70 from the review fixes). Raised to measured, each with a comment: eight parity ratio caps and two tier 1 skeleton caps in test/helpers/carve-guards.ts, the runaway-stopper eager ceiling in test/fixtures/context-budget.json (that one value only; a full recapture would have moved 38 unrelated ceilings), and a /ship size-ledger entry. Ship goldens refreshed.

Evidence and measurement. A safety guard, so no eval is owed. Evidence of the leaks stays private. test/ground-rules.test.ts pins the byte budget, every banned command, the safe forms, the render in a tier 1 skill and the shared preamble, and the loadout pin.

Checks run locally. At 15d80ac: 148 focused tests (ground rules, parity, context budget, size ledger, host config, size guards, catalog budget), 0 fail; typecheck clean. At b681106: bun run typecheck clean; 1,023 tests across the parity suite, size guards, context budget, preamble compose and hoist, loadouts, launch-env ratchet, carve guards, generator, host config and conformance, agents digest and prose lint: 0 fail.

Plan. Plan: exempt: Garry-approved safety guard (A1), no plan review

Paid coverage. Paid coverage of the preamble change is left to the release gate; no paid evals at PR tier

Review fixes. Pass 1 red-team findings p1/red-team#1 (the CI-wait bullet named the GraphQL-spending watcher) and p1/red-team#2 (the banned list missed ps aux/-ef, set -x, git config -l and an empty export $(...)) were fixed in 15d80ac. The release note was narrowed to skills that load the shared preamble in c204cca.

Review notes.

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL scripts/resolvers/preamble/generate-ground-rules.ts:16 The CI-wait rule names gstack-pr-wait by its bare name; a standard install does not put gstack's bin/ on PATH, so the host-resolved path (~/.claude/skills/gstack/bin/gstack-pr-wait, as land-and-deploy uses) would be more reliable.
  • INFORMATIONAL scripts/resolvers/preamble/generate-ground-rules.ts:16 CI-wait rule names gstack-pr-wait bare; a standard install does not put gstack's bin/ on PATH (same as fix-check note).
  • INFORMATIONAL scripts/resolvers/preamble/generate-ground-rules.ts:16 gstack-pr-wait blocks up to 60 minutes; the rule does not say to run it in the background or with a --timeout sized to the host shell limit, so a foreground run gets killed and rerun.
  • INFORMATIONAL changelog.d/never-print-secrets-shared-rule.md:1 Changelog says every skill on every host; seven skills with no shared preamble (careful, cso, deslop-shared-libs, freeze, gstack-upgrade, guard, unfreeze) do not carry Ground Rules.
Agent notes
{
  "schema_version": 1,
  "pr": 4382,
  "head": "c204ccaadf4406d8962619263c49c2c2232a7a74",
  "version": "1.99.5.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1670,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 43674445300,
      "attempt": 1,
      "tree": "4da2c137600defbc78d6b53d487ec2e8c0643c8f"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "4da2c137600defbc78d6b53d487ec2e8c0643c8f",
  "product_patch_id": "08d5ef264ee048224cb9b92e1d82d36deafc1f1b",
  "gstack_version": "1.99.5.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 26,
    "rules": "66e5174161eecc2c",
    "base": "0326b144af36676d599dcf63a9fad9a870d22ed6",
    "registry": "0326b144af36676d599dcf63a9fad9a870d22ed6",
    "gate_scan": {
      "tagged": 0,
      "head": "c204ccaadf4406d8962619263c49c2c2232a7a74"
    },
    "reasons": [
      "risk:data",
      "runtime=26"
    ],
    "risk": [
      "data"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @4da2c137600d (8 checks, current for c204ccaadf44)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/43674445300/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/43674445294/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=4da2c137600d tests=37311 skipped=105 runs=43674445300/1 profiles=ci-reuse/free-tests heads=c204ccaadf44 verified=2026-11-15T04:12:35.894Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md against base 0326b144"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 1,
    "fixed": 2,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 2,
    "dispatches": {
      "specialist": 1,
      "red-team": 1
    }
  },
  "gate_dispositions": []
}

…the commands it missed (GST-2753)

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

trunk-io Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 15, 2026 03:40
…ecret-printing commands

The Ground Rules section told every skill to wait with gh pr checks --watch, which spends the shared GitHub GraphQL quota gstack moved off; it now names gstack-pr-wait. The banned list also covers ps aux and ps -ef, set -x, git config -l and an export $(...) that expands to a bare export. Size caps raised to the measured +70 bytes.

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 28822af into main Nov 16, 2026
54 checks passed
@garrytan garrytan mentioned this pull request Nov 17, 2026
capy-ai Bot added a commit that referenced this pull request Nov 17, 2026
- /autoplan's approval page no longer hides a reviewer's product objection behind "keep your direction". (#4431)
- Every skill that loads the shared preamble, on every host, now says to ask a question once and to check a file before handing it over. (#4383)
- The Captain manuals now name the `Failed or skipped:` and `Also changed:` lines that READY and lane reports carry. (#4432)
- gstack's shell locks hold again on Ubuntu 26.04, where `mkdir` reports success when another process won the race (GST-2247). (#4262)
- `test/gstack-lock-race.test.ts` runs the old pattern and the helper against a PATH shim that behaves like uutils 0.8.0 `mkdir`, so it runs on any runner image: the old pattern lets two of four racers win, the helper admits exactly one in each of 60 races and never overlaps across take, hold and release loops, and parallel `gstack-config` writers keep every key. (#4262)
- Windows Setup E2E now runs when `bin/gstack-lock.sh` changes. (#4433)
- Claude Code's skill list now says when to use each gstack skill, so Opus loads /review and /plan-eng-review when a request fits. (#4387)
- A pull request's merge head can no longer keep its `/ship` receipt without a full review. (#4365)
- `/ship` now counts review rounds per pull request, and the head that merges always gets a full review. (#4360)
- /ship's documentation audit no longer accepts a passing result when an earlier line from the same audit said "blocked". (#4434)
- /ship's documentation audit no longer spends an attempt when the audit child writes text after its result. (#4285)
- The README lists the two new guides, and the install doc counts its hooks right. (#4403)
- docs/releases.md now says the stable release cut treats a failed commit status as red and a pending one as still going, as it has since #4257. (#4436)
- /ship's `finish --docs-requested` now accepts a docs fix when the audit named the file with a line number. (#4437)
- Document the `.gstack/approval-classes.json` schema, `gstack-approval-classes` CLI commands, and owner approval citation format in `docs/ship-policy.md#approval-classes`. (#4355)
- `/eval-plan` now runs four result checks instead of leaving them to judgment. (#4384)
- The /review coverage-audit eval no longer fails a run that really read the source file when zsh stops a command line at an `echo ====` separator. (#4364)
- Sixteen in-repo documentation links reach their section again. (#4394)
- gstack agents now open every status report with what failed, what they didn't verify and what else they changed. (#4273)
- Two new short guides. (#4380)
- A skill you wrote whose contract still lists `check_after_last_edit` keeps the rest of its contract. (#4439)
- The ship policy guide now explains how to merge any pull request with `gstack-ship-queue land`, even in a repository with one maintainer. (#4377)
- /ship's test step runs a large unit suite on Linux. (#4426)
- Every skill that loads the shared preamble, on every host, now says never to print a whole environment, git config or process table. (#4382)
- Pull requests from /ship now open with at most three plain lines, and every merge lands as one commit titled with the PR title. (#4438)
- `gstack-pr-wait`, `gstack-ci-gate` and the release cut no longer call a commit green while a check on it failed. (#4257)
- `gstack-runaway` now says what a thread's cold and empty wakes cost, not just how many there were (GST-2770). (#4385)
- The optional Stop hook no longer checks for a test run after the last edit, and /verify asks for it in plain words instead. (#4428)
- /ship's test step says when it ran out of time, and you can set its budget. (#4429)
- The remote test command no longer puts every file on one command line. (#4429)
- The stable release no longer waits on the nightly Windows tests (GST-2815). (#4400)
- Ubicloud fan-outs can no longer overshoot the vCPU limit, and owners no longer delete each other's VMs. (#4430)
- hono is pinned to 4.13.16, which fixes five advisories the weekly OSV scan found in 4.13.13 (gstack#4406). (#4408)
- `package.json` overrides (#4408)
- `test/dependency-security.test.ts`: the lockfile floor check now covers `hono >= 4.13.16`. (#4408)
- The nightly Windows test run finishes again. (#4409)
- A short write-up checklist in ETHOS.md. (#4381)

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