Skip to content

Helper hooks are on by default, the destructive-command check runs as a hook, and prompt routing fires on long bug reports (GST-3110) - #4503

Merged
capy-ai[bot] merged 10 commits into
mainfrom
helper-hooks-on-by-default
Nov 18, 2026
Merged

capy-ai[bot] merged 10 commits into
mainfrom
helper-hooks-on-by-default

Conversation

@garrytan

@garrytan garrytan commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Claude Code now gets gstack's prompt-routing, skill-contract and destructive-command hooks on by default, and new OpenClaw and Hermes registrations get the start hook. On 60 real bug reports, routing now matches a bug-fix skill on 40 (was 22), but gstack's own skills route 14 (was 17).
Why: on Opus 5.5, unattended, a hook line naming a skill got it loaded in 58 of 60 sessions, and a skill relying on its description in 0 of 60 (gstack-evals#369).
To opt out: gstack-config set skill_routing off (or skill_contracts, destructive_guard, harness_start_hook); an off you chose before is kept.

What changed: the defaults, before and after
Hook Before After Turn it off
Prompt routing (UserPromptSubmit, one line naming the skill a prompt fits) off on gstack-config set skill_routing off or ./setup --no-skill-routing
Skill contracts (Stop, holds /review once if its specialist reviewers never ran) off on gstack-config set skill_contracts off or ./setup --no-skill-contracts
Destructive-command check (PreToolUse on Bash and PowerShell) only while /careful or /guard was loaded on in every session; in claude -p and other headless sessions it warns instead of asking gstack-config set destructive_guard off or ./setup --no-destructive-guard
OpenClaw and Hermes start hook (a note on each turn to run a skill's start command) off on for new registrations; an existing off stays off on upgrade gstack-harness register openclaw --no-start-hook, or gstack-config set harness_start_hook off
  • Upgrade path. The first ./setup or /gstack-upgrade after this lands registers each hook the person never turned off, prints one line per hook with its off switch, and once prints a notice listing what it turned on (marker $GSTACK_STATE_ROOT/.hooks-on-by-default-notice). An off set earlier by flag, gstack-config or the environment is read before the default and kept. For the start hook, every off a registration already has is kept, including a registration recorded before the start hook existed, so an upgrade never turns on a plugin that grants OpenClaw conversation access; the first refresh prints once off, as before: gstack now turns it on only for new registrations; turn it on: gstack-harness register <harness> --start-hook. The one off the default overrides is one gstack recorded because it had to refuse the hook (custom --skills-dir, foreign OPENCLAW_CONFIG_PATH), so the hook comes on once that cause is gone. When the default turns the start hook on and the harness can't activate it yet, registration still succeeds (no exit 4); later refreshes retry.
  • Destructive-command check as a hook. hosts/claude/hooks/destructive-guard-hook runs careful/bin/check-careful.sh unchanged: ask for the destructive families, deny for a recursive delete of / or home and a force-push to the default branch. An ask's reason (the person reads it) adds the hook's name and off switch; a deny's reason (the model reads it) doesn't. The two deny messages no longer tell the model to "end the /careful session", which can't lift an every-session check. In a session nobody is watching (claude -p, which Claude Code marks CLAUDE_CODE_ENTRYPOINT=sdk-cli, or a headless gstack-session-kind), an ask would wait forever, so the hook prints the reason as a warning and allows the command, the same as when the check is off; interactive sessions keep the ask and a deny stays a deny. About 0.13 s per Bash call.
  • Windows. The new hook registers the same way as the others (bash prefix on Windows, matcher Bash|PowerShell); no Windows-only path changed.
Prompt-routing matcher: what changed and the replay numbers

The matcher now (1) scores a prompt longer than 5,000 characters on its first 4,000 and last 1,000 characters instead of skipping anything over 8,000; (2) reads defect words (error, exception, traceback, crash, fail/failure, broken, regression, incorrect, wrong, defect, and exception names like ValueError) as "bug"; (3) keeps paths and identifiers whole (site-packages, src/review.ts), so traceback paths stop matching trigger words; (4) prefers a whole-phrase match when two triggers of one skill tie.

Replayed with no model calls on the 60 B1b bug prompts (b1b routes from garrytan/gstack-evals lanes/delivery-route at 6191ded's prompts; prompt hashes identical to the preregistered route-table.tsv):

Before (main) After
prove-it routable (score >= 0.66, with /prove-it installed and eligible), as GEVA-2 counts it 22 of 60 (26 scored >= 0.66, 4 of those were over 8,000 characters) 40 of 60
Of those, tasks from the benchmark's _interface split (mostly new-code asks; at least one reports a real bug) 0 of 7 1 of 7 (aws__bedrock-agentcore-sdk-python-279_interface)
Plain prompts that should route nowhere (new fixture test/fixtures/skill-route-plain-prompts.txt, 60 prompts: features, questions, docs, refactors, ops, data, and 6 that use error/exception/failed in feature requests) 0 of 60 routed 0 of 60 routed
Same 60 bug prompts with gstack's real routed skills only (/review, /qa, /verify) 17 routed (12 /verify, 5 /qa) 14 routed (11 /verify, 3 /qa)

Reading the remaining 20 misses by hand (not classified by the replay), most describe the defect only with "should", "instead" or "doesn't", or read like feature requests. Adding those words would route feature requests too. gstack's own routed list (/review, /qa, /verify) still has no bug-fix skill, so in a stock install a bug report routes to /verify, /qa or nowhere, and that stock routing fell from 17 to 14 of the 60 with this change; GEVA-2's measurement lists prove-it as B1b did.

Agent notes
  • Scope: GST-3110 A1 + B1, approved by Garry on 2026-11-18 ("do it"); /autoplan skipped per that approval. Out of scope and untouched: the CLAUDE.md routing block, "Load gstack. Run /X" docs, paid evals.
  • b1b routes caveat: its routable_if_listed column reads PROMPT_MAX_CHARS, which this change removes, so the "after" count is that column's other half (best_score >= ROUTE_THRESHOLD) from the same tool run.
  • Changes after the review cap, per Captain GStack Minder's ruling (decision A plus two scoped fixes): d3f19f2 makes the destructive-command hook warn instead of ask in headless sessions (tests "an interactive session (the claude CLI) gets the ask" and "claude -p and headless sessions get a warning and no decision, so nothing waits on an answer; a deny stays a deny" in test/destructive-guard-hook.test.ts); 21cc40d keeps an existing start-hook off on upgrade (test/harness-start-hook.test.ts "an off given by flag or env is kept by later runs; an off recorded before the default changed stays off and says once how to turn it on"). The read-only full review of 89ed42e (four readers, second-model review clean) found no blocker; the docs audit flagged four docs still describing the old opt-in defaults and a reader found that a record from before the start hook existed still turned it on. Per a second ruling, d5f4a63 fixes both (test "...or a record from before the start hook existed, stays off..." fails without the fix) under one scoped fix-check. That fix-check found that d5f4a63's other change, treating every Agent SDK entrypoint as headless, took the ask away from interactive Conductor sessions (also sdk-ts); b35ea46 reverts that part to the reviewed 89ed42e behaviour and adds the test "an interactive Agent SDK host (Conductor, CLAUDE_CODE_ENTRYPOINT=sdk-ts) still gets the ask", under a second scoped fix-check (the Captain's third exception on this PR). finish then refused because gstack does not count a fix-check link that found an issue as review for the other files in its commit, so a third scoped fix-check, granted separately, read lib/harness-register.ts and test/harness-start-hook.test.ts over 89ed42e..b35ea46 and found nothing.
  • The first ruling's fix-check allowance was used as the read-only full review of 89ed42e; the three fix-check links above came from later, separate grants.
  • Open notes, left as is by that ruling:
    • On upgrade, only an off that came from a record without a saved choice prints the one-line "turn it on" hint. An off set through GSTACK_HARNESS_START_HOOK or harness_start_hook stays off silently, and the changelog's "prints one line" reads broader than that; the docs-only follow-up corrects the changelog wording, along with its "40 instead of 22" line and the exit-4 sentence in docs/hosts.md.
    • If bun is missing from the hook's PATH, the destructive-command hook fails open (allows) with no signal; it is an advisory guard documented as fail-open.
    • Upstream Claude Code: a hook "ask" may drop bypassPermissions mode for the rest of the session ([BUG] Bypass permission mode resets after a PreToolUse hook returns "ask" anthropics/claude-code#37420, closed stale) and may act as "allow" in auto mode (#89561, open). Not checked against the current release; gstack's own upgrade and temp-dir cleanups can trip the ask.
    • Agent SDK runs (sdk-ts, sdk-py) still get the ask, because Conductor's interactive sessions use the same entrypoint.
    • The check (up to 8 s) plus the session lookup (up to 2 s) can exceed the 10 s hook timeout, and then the command runs unchecked.
    • lib/harness-register.ts:353's startHook comment still ends the order at "then the ledger".
    • The tokenizer keeps hyphenated words whole, so "code-review" no longer matches the two-word "code review" trigger, and "pre landing review" without the hyphen scores 0.5 against "pre-landing review".
  • Local checks at b35ea46: typecheck, the test typecheck ratchet, the destructive-guard-hook and changelog-fragments tests (22 pass; the Conductor test fails on d5f4a63's hook). At d5f4a63: gen:skill-docs freshness, the harness-start-hook, harness-register and hooks-windows-paths tests (101 pass with the guard tests), and seven docs-reading suites (556 pass). CI was green on every check at d5f4a63.

Review-loop exception: accepted by Captain GStack Minder (GSTA-36) 2026-11-18 via ruling of 2026-11-18 relayed by the lane (GSTA-627): one read-only full review of the final head 89ed42e, no fix round, per R51 and the ruling of 2026-11-18, then granted fix-checks of d5f4a63 (a-8354f1687fbd) and b35ea46 (a-4f7937d1e7ea) (fix-check at b35ea46, 0 findings)

  • Fix-check chain: d5f4a63 (grant a-8354f1687fbd, one blocker found and reverted in b35ea46), b35ea46 (grant a-4f7937d1e7ea, no findings), and lib/harness-register.ts plus test/harness-start-hook.test.ts over 89ed42e..b35ea46 (grant a-be1c97dcc94b, no findings).

Documentation:

Status: blocked, shipped under a documentation exception. Scope: docs/, README.md and careful/SKILL.md.tmpl against base 2f57b07 at head b35ea46 (read-only audit docs-4503-b35ea46-2). Two lines in docs/skill-routing-and-contracts.md are stale (line 18 and the Host support table); everything else this PR changed is current.

Documentation exception: accepted by GStack Minder (Captain, GSTA-36) 2026-11-18 via Captain ruling by agent message to the lane, relayed by the lane (GSTA-627): Two stale lines in docs/skill-routing-and-contracts.md are accepted as a documentation risk for #4503 at b35ea46. Line 18 says an unreadable config turns 'both' hooks off, but it turns off three. The Host support table has no column for the destructive-command check. Neither line fails a test, breaks production or loses data. They are fixed in a docs-only follow-up PR opened right after #4503 lands.

Open in Capy

{
  "schema_version": 1,
  "pr": 4503,
  "head": "b35ea46a864952b842a8c864732e47eb4592e143",
  "version": "1.101.0.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 112,
      "fail": 0,
      "skip": 0
    },
    "free": {
      "pass": 1702,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44418304654,
      "attempt": 1,
      "tree": "14978a5a4a48332b20d474ec53c2cdd7f954d740"
    }
  ],
  "calls": 31,
  "session_kind": "unattended",
  "run": "ship-4503-89ed42e",
  "head_tree": "14978a5a4a48332b20d474ec53c2cdd7f954d740",
  "product_patch_id": "1301ee507c442d525877dc8b3fb6af74475fd6c8",
  "gstack_version": "1.101.0.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 242,
    "rules": "1afa38a4be3b5eef",
    "base": "43026970b7da353a6d7f4bb8c5fab18f7b410ca4",
    "registry": "43026970b7da353a6d7f4bb8c5fab18f7b410ca4",
    "gate_scan": {
      "tagged": 0,
      "head": "b35ea46a864952b842a8c864732e47eb4592e143"
    },
    "reasons": [
      "risk:security",
      "risk:data",
      "runtime=242"
    ],
    "risk": [
      "security",
      "data"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @14978a5a4a48 (8 checks, current for b35ea46a8649)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/44418304654/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44418304654/attempts/1",
    "windows-setup-e2e.yml/windows-setup: https://github.com/garrytan/gstack/actions/runs/44415387668/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44415387924/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=14978a5a4a48 tests=37883 skipped=104 runs=44418304654/1 profiles=ci-reuse/free-tests heads=b35ea46a8649 verified=2026-11-18T23:19:55.005Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "blocked",
    "scope": "docs/, README.md and careful/SKILL.md.tmpl against base 2f57b07 at head b35ea46 (audit docs-4503-b35ea46-2, read-only)",
    "exception": {
      "accepted_by": "GStack Minder (Captain, GSTA-36)",
      "date": "2026-11-18",
      "via": "Captain ruling by agent message to the lane, relayed by the lane (GSTA-627)",
      "reason": "Two stale lines in docs/skill-routing-and-contracts.md are accepted as a documentation risk for #4503 at b35ea46. Line 18 says an unreadable config turns 'both' hooks off, but it turns off three. The Host support table has no column for the destructive-command check. Neither line fails a test, breaks production or loses data. They are fixed in a docs-only follow-up PR opened right after #4503 lands."
    }
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 8,
    "fixed": 1,
    "scope": "frozen",
    "fix_checks": 3,
    "rounds": 4,
    "ledgers_read": 6,
    "unbound": 2,
    "dispatches": {
      "specialist": 4,
      "red-team": 1
    }
  },
  "review_loop_exception": {
    "accepted_by": "Captain GStack Minder (GSTA-36)",
    "date": "2026-11-18",
    "via": "ruling of 2026-11-18 relayed by the lane (GSTA-627)",
    "reason": "one read-only full review of the final head 89ed42e, no fix round, per R51 and the ruling of 2026-11-18, then granted fix-checks of d5f4a63 (a-8354f1687fbd) and b35ea46 (a-4f7937d1e7ea)",
    "fix_check": {
      "head": "b35ea46a864952b842a8c864732e47eb4592e143",
      "findings": 0
    }
  },
  "review_round_grants": [
    {
      "kind": "fix-check",
      "head": "89ed42e06df894993557537f49641dfd6511e0bb",
      "pr": 4503,
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "one scoped fix-check of d5f4a63 by the same /ship run, no further rounds",
      "at": "2026-11-18T22:43:38.026Z",
      "approval": "a-8354f1687fbd",
      "stop_run": "ship-4503-89ed42e",
      "findings": [
        "p1/specialist-batched#1",
        "p1/adversarial-native#1",
        "p1/red-team#2",
        "p1/adversarial-native#3"
      ]
    }
  ],
  "gate_dispositions": []
}
{"head":"c621c5043b06cd173d8af6235033a18ba50be400","run":"ship-4503","status":"started","review_loop":{"passes":2,"blocking_found":3,"deferred":0,"noted":5,"fixed":3,"scope":"frozen","rounds":2,"dispatches":{"specialist":8,"red-team":2}}}
{"head":"89ed42e06df894993557537f49641dfd6511e0bb","run":"ship-4503-89ed42e","mark":"stop","tree":"7d34ac46182768a4b21966404cd64e1068a90186"}

… a hook, and prompt routing fires on long bug reports (GST-3110)

Prompt routing, skill contracts and the new destructive-command hook register by default in Claude Code; OpenClaw and Hermes get the start hook. An off the user set earlier is kept. The routing matcher scores long prompts on head and tail windows, reads defect words as bug and keeps paths whole: 40 of 60 bug prompts route instead of 22, and 0 of 60 plain prompts.

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

trunk-io Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 9 commits November 18, 2026 20:48
…pt runner

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…r config stays off on later runs

Review-Finding: p1v/outside-voice#1 reader=outside-voice
Review-Finding: p1v/adversarial-native#4 reader=adversarial-native
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… off

Review-Finding: p2/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…er headless sessions

An ask in a session nobody watches waits for an answer that never comes.
CLAUDE_CODE_ENTRYPOINT=sdk-cli (claude -p) or a headless gstack-session-kind
now gets the reason as a warning and the command runs; interactive sessions
keep the ask, and a deny stays a deny.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The start hook defaults to on only for new registrations. An off saved
before the default changed stays off, and the first refresh prints once how
to turn it on (gstack-harness register <harness> --start-hook). Only an off
gstack recorded because it refused the hook gives way to the default.

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>
… runs warn instead of asking; docs match the new defaults

A registration record written before gstack had a start hook has no
start_hook field and fell through to the new on default, so an upgrade
turned the OpenClaw or Hermes hook on. An existing record now counts as off.
The destructive-command hook treats every Agent SDK entrypoint (sdk-cli,
sdk-ts, sdk-py) as a session with nobody to answer an ask. install.md,
skills.md, uninstall.md, the routing dry-run example and the README /careful
row now describe the on-by-default hooks.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…laude -p counts as headless

An interactive Conductor session also reports CLAUDE_CODE_ENTRYPOINT=sdk-ts,
so the entrypoint cannot tell an unattended SDK run from a person watching.
Back to sdk-cli only, with a test that a Conductor sdk-ts session still gets
the ask.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 3f1b82b into main Nov 18, 2026
86 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 19, 2026
- `gstack-artifact validate` no longer passes a run.json that gstack-autoplan never wrote. (#4494)
- /ship's changed-number check no longer stops on tests that only share a word with the change (#4478). (#4496)
- On Capy, /ship no longer edits or comments on pull requests as you. (#4518)
- The destructive-command check stops asking about scratch deletes and catches the real damage it used to miss. (#4513)
- The destructive-command check reads commands more carefully, closing gaps found after the last release. (#4525)
- The Codex readiness check and the second-model review now pick the same model for a custom Codex provider (GST-3089). (#4491)
- gstack's Codex hooks work when your Codex folder's path has a `(`, `&` or other shell character in it. (#4528)
- Uninstalling gstack keeps your own Codex hooks trusted. (#4528)
- Codex hook setup matches Codex more closely. (#4528)
- On Windows, setup copies the Claude Code hook code that gstack's Codex hooks import (#4528)
- /review's checklist on Codex reads shell commands more carefully. (#4528)
- On Codex, gstack now suggests the right skill for a prompt and stops destructive commands before they run. (#4512)
- On Codex, /review is now held once when it tries to finish without its adversarial pass or its report, as it already is on Claude Code. (#4522)
- On Codex, gstack's skill suggestion now names the skill the way Codex lists it. (#4523)
- On Codex, gstack's suggested prompts and docs now name skills the way Codex lists them. (#4524)
- /review on Codex with gpt-6.1-sol is no longer held back for a second-model pass it already ran. (#4526)
- On Codex, office-hours, plan-design-review and gstack-upgrade work again when you name them. (#4510)
- gstack knows when Codex is running unattended. (#4510)
- Codex reviewers start with a clean context. (#4510)
- Docs no longer say Codex has no hook support. (#4510)
- A command whose output was cut off no longer counts as a finished read. (#4492)
- A folder marked as published data can no longer hide source code or agent files from /ship's review. (#4516)
- Correction to the on-by-default helper hooks entry: the hook still routes only to /review, /qa and /verify, so skills you've installed yourself aren't suggested yet. With gstack's skills it routes 14 of 60 real bug reports (was 17), and long prompts are no longer skipped. (#4505)
- /sync-gbrain's read check now works when the first page in your code source is over 64 KB. (#4497)
- Free-suite CI no longer fails before any test runs when Ubuntu's package mirror is slow. (#4530)
- Syncing a second repo no longer makes the first one ask for /sync-gbrain again. (#4532)
- gstack's helper hooks are now on by default in Claude Code, OpenClaw and Hermes, and the prompt-routing hook fires on real bug reports. (#4503)
- `gstack-pregate clear --receipt` accepts a remote gate run from before a merged release when the release only regenerated a declared release output. (#4483)
- The second-model review now keeps the reviewer's own result, and reports a used-up budget as a budget stop. (#4515)
- When the reviewer wrote its review to the result file it was asked for, Codex then replaced that file with its short closing message ("Done, I wrote the review"), so the review was thrown away and reported as missing its markers. (#4515)
- When the provider refuses the call with HTTP 402 Payment Required (usually a metering proxy that hit its allowance, or an account out of credits or quota), gstack used to record only "exit 1". (#4515)
- The pre-commit /verify check now fails a check that times out, and its checks share one time budget (GST-3201). (#4527)
- /ship's review collector no longer reads a reviewer's own scope list or list of passed checks as findings (GST-3201). (#4527)
- Merge-queue stack tests fail when git cannot list a PR's added test files (GST-3201). (#4527)
- /ship can now review results PRs that publish raw session data. (#4511)
- /ship's review pass works when the checkout you ship isn't the project's default checkout. (#4507)
- A second review round no longer reports done when nothing was reviewed. (#4520)
- The prompt-routing hook now suggests skills you install yourself, and no longer sends ordinary bug reports to /qa (GST-3123). (#4506)
- gstack's script runner and merge-queue checks now also refuse cut-off output. (#4502)
- A failed second-model review reports the cause that actually stopped it, and the runner never deletes its own prompt. (#4519)
- `gstack-ship-queue ready` now fills in the trial merges and the second-model trail read instead of printing lines to fill. (#4529)
- Five small ship-tool fixes. (#4529)
- A ruling the owner gives while a `/ship` run is open can be relayed. (#4529)
- /ship no longer kills a working test run as stalled when the test command starts its workers in their own session. (#4533)
- /ship no longer stops a review because the state-machine reader started its reply the way its instructions say. (#4504)
- When Claude Code runs /verify right before a commit, it now gets a quick check instead of the full fix loop (GST-3150). (#4508)

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