diff --git a/bin/gstack-config b/bin/gstack-config index d3a4a4d29..f69f3ccac 100755 --- a/bin/gstack-config +++ b/bin/gstack-config @@ -61,9 +61,6 @@ CONFIG_HEADER='# gstack configuration — edit freely, changes take effect on ne # # off = only run skills you type explicitly. # # (true and false still work: true means all, false means off.) # -# routing_declined: false # Set to true to skip the CLAUDE.md routing injection -# # prompt. Set back to false to be asked again. -# # ─── Telemetry ─────────────────────────────────────────────────────── # telemetry: off # off | anonymous | community # # off — no data sent, no local analytics (default) @@ -333,7 +330,6 @@ CONFIG_HEADER='# gstack configuration — edit freely, changes take effect on ne lookup_default() { case "$1" in proactive) echo "core" ;; # core | all | off (true = all, false = off); core suggests only /office-hours, /review, /qa, /ship - routing_declined) echo "false" ;; telemetry) echo "off" ;; auto_upgrade) echo "false" ;; update_check) echo "true" ;; @@ -1163,7 +1159,7 @@ $_gstack_legacy_root" echo "" echo "# ─── Active values (including defaults for unset keys) ───" report_root_disagreement - for KEY in proactive routing_declined telemetry auto_upgrade update_check update_channel \ + for KEY in proactive telemetry auto_upgrade update_check update_channel \ skill_prefix explain_level plan_mode_preamble claude_loadout \ codex_reviews autoplan_shadow autoplan_shadow_model gstack_contributor skip_eng_review workspace_root \ artifacts_sync_mode artifacts_sync_mode_prompted artifacts_sync_removals plan_tune_hooks \ @@ -1189,7 +1185,7 @@ $_gstack_legacy_root" ;; defaults) echo "# gstack-config defaults" - for KEY in proactive routing_declined telemetry auto_upgrade update_check update_channel \ + for KEY in proactive telemetry auto_upgrade update_check update_channel \ skill_prefix explain_level plan_mode_preamble claude_loadout \ codex_reviews autoplan_shadow autoplan_shadow_model gstack_contributor skip_eng_review workspace_root \ artifacts_sync_mode artifacts_sync_mode_prompted artifacts_sync_removals plan_tune_hooks \ diff --git a/bin/gstack-skill-start b/bin/gstack-skill-start index 90eea8407..c2ddae719 100755 --- a/bin/gstack-skill-start +++ b/bin/gstack-skill-start @@ -141,9 +141,9 @@ case "$_PROACTIVE" in core|all|off) ;; *) _PROACTIVE="core" ;; esac -# off silences every unasked surface below: the tips, the one-time prompt and -# the CLAUDE.md routing offer. A stored off also answers the one-time prompt, -# so the marker is written here, before STATUS reports it. +# off silences every unasked surface below: the tips and the one-time prompt. +# A stored off also answers the one-time prompt, so the marker is written +# here, before STATUS reports it. case "$_PROACTIVE" in off) _PROACTIVE_OFF="yes" ;; *) _PROACTIVE_OFF="no" ;; esac _PROACTIVE_PROMPTED=$([ -f "$_GH/.proactive-prompted" ] && echo "yes" || echo "no") if [ "$_PROACTIVE_PROMPTED" = "no" ] && [ "$_PROACTIVE_OFF" = "yes" ]; then @@ -325,9 +325,7 @@ for _RF in CLAUDE.md AGENTS.md; do _HAS_ROUTING="yes" fi done -_ROUTING_DECLINED=$("$_BIN/gstack-config" get routing_declined 2>/dev/null || echo "false") echo "HAS_ROUTING: $_HAS_ROUTING" -echo "ROUTING_DECLINED: $_ROUTING_DECLINED" _VENDORED="no" if [ -d ".claude/skills/gstack" ] && [ ! -L ".claude/skills/gstack" ]; then if [ -f ".claude/skills/gstack/VERSION" ] || [ -d ".claude/skills/gstack/.git" ]; then @@ -666,62 +664,6 @@ EOI fi fi -# Routing injection (interactive: AUQ + CLAUDE.md append + commit). The body -# is a quoted heredoc (markdown backticks must stay literal), so the resolved -# bin path is substituted via sed on the __BIN__ placeholder. Under off the -# routing rules are the auto-invocation the user turned off, so no offer. -# Under core the heredoc's rule lines are replaced by the core rules below, so -# the offered section routes only the four core skills. -_CORE_ROUTING_RULES=$(cat <<'EOR' -- Product ideas/brainstorming → invoke /office-hours -- QA/testing site behavior → invoke /qa -- Code review/diff check → invoke /review -- Ship/deploy/PR → invoke /ship - -Do not suggest or auto-invoke other gstack skills: they run when the user types them, or when a running skill hands off to them (`gstack-config set proactive all` routes every skill). -EOR -) -_routing_offer() { - if [ "$_PROACTIVE" = "core" ]; then - _GSTACK_CORE_RULES="$_CORE_ROUTING_RULES" awk '/^- .* → / { if (!done) { print ENVIRON["_GSTACK_CORE_RULES"]; done = 1 } next } { print }' - else - cat - fi | sed "s|__BIN__|$_BIN|g" -} -if [ "$_HAS_ROUTING" = "no" ] && [ "$_ROUTING_DECLINED" = "false" ] && [ "$_PROACTIVE_PROMPTED" = "yes" ] && [ "$_PROACTIVE_OFF" = "no" ]; then - _routing_offer <<'EOI' | _emit_block routing-injection -gstack works best when the project CLAUDE.md includes skill routing rules. If no CLAUDE.md exists in the project root, create it. Use AskUserQuestion: - -> gstack works best when your project's CLAUDE.md includes skill routing rules. - -Options: A) Add routing rules to CLAUDE.md (recommended) B) No thanks, I'll invoke skills manually - -If A: append this section to the end of CLAUDE.md, then commit it (`git add CLAUDE.md && git commit -m "chore: add gstack skill routing rules to CLAUDE.md"`): - -## Skill routing - -When the user's request matches an available skill, invoke it via the Skill tool. Route only to skills in the session's available-skills list; answer directly for quick questions or small scoped edits. - -Key routing rules: -- Product ideas/brainstorming → invoke /office-hours -- Strategy/scope → invoke /plan-ceo-review -- Architecture → invoke /plan-eng-review -- Design system/plan review → invoke /design-consultation or /plan-design-review -- Full review pipeline → invoke /autoplan -- Bugs/errors → fix them directly: one read-only check of the cause, or a focused failing test first when the cause is unclear; then fix it and run that test -- QA/testing site behavior → invoke /qa or /qa-only -- Code review/diff check → invoke /review -- Visual polish → invoke /design-review -- Building UI → once it renders, invoke /design-review --build (opt-in) -- Ship/deploy/PR → invoke /ship (merge + deploy: the user types /land-and-deploy) -- Save progress → invoke /context-save -- Resume context → invoke /context-restore -- Author a backlog-ready spec/issue → invoke /spec - -If B: run `__BIN__/gstack-config set routing_declined true` and say they can re-enable with `__BIN__/gstack-config set routing_declined false`. This only happens once per project. -EOI -fi - # Vendoring deprecation (interactive; slug-scoped marker). if [ "$_VENDORED" = "yes" ] && [ ! -f "$_GH/.vendoring-warned-${SLUG:-unknown}" ]; then _emit_block vendoring-deprecation < { expect(content).toContain('telemetry:'); expect(content).toContain('auto_upgrade:'); expect(content).toContain('skill_prefix:'); - expect(content).toContain('routing_declined:'); + expect(content).not.toContain('routing_declined:'); expect(content).toContain('codex_reviews:'); expect(content).toContain('skip_eng_review:'); }); @@ -230,23 +230,4 @@ describe('gstack-config', () => { expect(content).toContain('existing: value'); expect(content).not.toContain('# gstack configuration'); }); - - // ─── routing_declined ────────────────────────────────────── - test('routing_declined defaults to false (not set)', () => { - const { stdout } = run(['get', 'routing_declined']); - expect(stdout).toBe('false'); - }); - - test('routing_declined can be set and read', () => { - run(['set', 'routing_declined', 'true']); - const { stdout } = run(['get', 'routing_declined']); - expect(stdout).toBe('true'); - }); - - test('routing_declined can be reset to false', () => { - run(['set', 'routing_declined', 'true']); - run(['set', 'routing_declined', 'false']); - const { stdout } = run(['get', 'routing_declined']); - expect(stdout).toBe('false'); - }); }); diff --git a/changelog.d/cut-claude-md-routing-offer.md b/changelog.d/cut-claude-md-routing-offer.md new file mode 100644 index 000000000..09c828316 --- /dev/null +++ b/changelog.d/cut-claude-md-routing-offer.md @@ -0,0 +1 @@ +**gstack no longer offers to add a `## Skill routing` section to your project's CLAUDE.md.** The prompt-routing hook, on by default, now gets the right skill started on its own: in a preregistered test on Claude Opus 5.5, it loaded the bug-fix skill in 45 of 60 and 48 of 60 unattended sessions, past the 39 of 60 that the CLAUDE.md section managed, while sessions without gstack loaded it in none ([results](https://github.com/garrytan/gstack-evals/tree/main/wiki/board/2026-11-21-capy-b1e-matcher-fix-results)). A section an older gstack added stays exactly as you left it and keeps working; gstack never edits it, and you can delete it. The `routing_declined` setting, which only answered that offer, is gone. diff --git a/docs/OPENCLAW.md b/docs/OPENCLAW.md index 3b1e84d9b..c5c42b72e 100644 --- a/docs/OPENCLAW.md +++ b/docs/OPENCLAW.md @@ -118,7 +118,7 @@ environment variable should be set. gstack detects this and adjusts: irreversible options are never auto-chosen — the conservative choice wins and gets recorded in the completion report) - Suppresses interactive-onboarding instruction blocks at emission (upgrade - checks, telemetry prompts, feature discovery, routing injection, tips), so + checks, telemetry prompts, feature discovery, tips), so one-time prompts survive intact for the next human session - Suppresses the Conductor prose signal (`CONDUCTOR_SESSION: true`) — a spawned session inside a Conductor workspace auto-chooses instead of diff --git a/docs/proactive.md b/docs/proactive.md index 350984656..8553ea2ed 100644 --- a/docs/proactive.md +++ b/docs/proactive.md @@ -34,15 +34,12 @@ needed, because every skill reads `PROACTIVE` from `gstack-skill-start` at the start of each run and the router (`/gstack`) applies it to its routing rules. A value gstack does not know (a hand-edited `proactive: maybe`) reads as `core`. -The `## Skill routing` section gstack offers to append to your project's -CLAUDE.md follows the setting too. Under `core` it lists only the four core -rules and says the other skills run when you type them or a running skill -hands off to them; under `all` it lists -every routing rule; under `off` it is not offered, because those rules are the -auto-invocation you turned off. gstack offers the section once per project and -never edits it afterwards. So a section you accepted earlier, or under another -setting, stays as it is: trim it to match (the core four are /office-hours, -/review, /qa and /ship), or delete it and let gstack offer it again. +gstack no longer offers to add a `## Skill routing` section to your project's +CLAUDE.md: its prompt-routing hook names the matching skill instead +([skill-routing-and-contracts.md](skill-routing-and-contracts.md)). If an older +gstack added that section, gstack never edits it, so it stays as you left it +whatever this setting says. Trim it to match (the core four are /office-hours, +/review, /qa and /ship), or delete it. Skill descriptions cannot change with the setting, so they are written for the `core` default. Only the four core skills say "Proactively suggest ..." in the diff --git a/docs/skill-routing-and-contracts.md b/docs/skill-routing-and-contracts.md index f1e82fb09..25e12f920 100644 --- a/docs/skill-routing-and-contracts.md +++ b/docs/skill-routing-and-contracts.md @@ -55,6 +55,8 @@ The hook scores the prompt against the `triggers:` list in each installed `SKILL - Prompts that start with `/` (you already picked a skill) are never routed. - The injected line names its source and its off switch, and asks the model to tell you in one sentence that gstack routed the request. +The hook replaces the `## Skill routing` section gstack used to offer for your project's CLAUDE.md. In a preregistered test on Claude Opus 5.5 (gstack-evals#415), the hook alone got the bug-fix skill loaded in 45 of 60 and 48 of 60 unattended sessions, past the 39 of 60 the CLAUDE.md section managed, so gstack stopped offering the section. A section an older gstack added keeps working; gstack never edits it, and you can delete it. + ### Dry run `gstack-skill-route --explain` shows what the hook would do, with the switch on or off. It never injects anything. diff --git a/docs/uninstall.md b/docs/uninstall.md index 48d371b31..835116572 100644 --- a/docs/uninstall.md +++ b/docs/uninstall.md @@ -159,7 +159,7 @@ disable gstack-start`, then delete ## Clean up CLAUDE.md -The uninstall script does not edit CLAUDE.md. In each project where gstack was added, remove the `## gstack` and `## Skill routing` sections. +The uninstall script does not edit CLAUDE.md. In each project where gstack was added, remove the `## gstack` section, and the `## Skill routing` section if an older gstack added one. ## Playwright diff --git a/scripts/question-registry.ts b/scripts/question-registry.ts index 4a0f7fa36..5e4ed2d6e 100644 --- a/scripts/question-registry.ts +++ b/scripts/question-registry.ts @@ -530,14 +530,6 @@ export const QUESTIONS = { options: ['core', 'all', 'off'], description: "Let gstack proactively suggest skills based on conversation context? core (the four core skills, default) / all / off", }, - 'preamble-routing-injection': { - id: 'preamble-routing-injection', - skill: 'preamble', - category: 'approval', - door_type: 'two-way', - options: ['accept', 'decline'], - description: "Add gstack skill routing rules to CLAUDE.md?", - }, 'preamble-vendored-migration': { id: 'preamble-vendored-migration', skill: 'preamble', diff --git a/test/autoplan-preconfigured-onboarding-ar.test.ts b/test/autoplan-preconfigured-onboarding-ar.test.ts index 54d43d392..6836f8aab 100644 --- a/test/autoplan-preconfigured-onboarding-ar.test.ts +++ b/test/autoplan-preconfigured-onboarding-ar.test.ts @@ -4,6 +4,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, import { tmpdir } from 'node:os'; import { join, resolve } from 'node:path'; import { seedAutoplanOnboarding } from './helpers/autoplan-preconfigured-fixture'; +import { readShippedSkillRouting } from './helpers/shipped-skill-routing'; import { DESIGN_DOC_DISCOVERY_BLOCK } from '../scripts/resolvers/design-doc-discovery'; const root = resolve(import.meta.dir, '..'); const read = (file: string) => readFileSync(join(root, file), 'utf8'); @@ -18,7 +19,7 @@ function fixture(plan = original) { writeFileSync(planFile, plan); execFileSync('git', ['init', '-q', '-b', 'main'], { cwd }); // This free test controls unrelated startup side effects, not the seeded repo. - // proactive: all, because the seeded CLAUDE.md is the every-rule section that setting offers. + // proactive: all, because the seeded CLAUDE.md is the every-rule section gstack used to offer under that setting. writeFileSync(join(state, 'config.yaml'), 'update_check: false\nartifacts_sync: off\ntelemetry: off\nproactive: all\n'); writeFileSync(join(state, '.proactive-prompted'), ''); const env = { PATH: process.env.PATH!, HOME: home, GSTACK_HOME: state, GSTACK_STATE_ROOT: state, GSTACK_LEASE_DIR: join(state, 'gstack-leases') }; @@ -35,17 +36,15 @@ test('real skill-start and canonical discovery see the configured chain prerequi const before = f.start(); expect(before).toContain('SESSION_KIND: interactive'); expect(before).toContain('HAS_ROUTING: no'); - expect(before).toContain('GSTACK_INSTRUCTION_BEGIN: routing-injection '); + expect(before).not.toContain('routing-injection'); expect(f.discover()).toBe('No design doc found'); seedAutoplanOnboarding(f.cwd); const after = f.start(); expect(after).toContain('SESSION_KIND: interactive'); expect(after).toContain('HAS_ROUTING: yes'); - expect(after).toContain('ROUTING_DECLINED: false'); - expect(after).not.toContain('GSTACK_INSTRUCTION_BEGIN: routing-injection '); + expect(after).not.toContain('routing-injection'); expect(f.discover()).toBe(`Design doc found: ${join(f.cwd, 'docs/designs/dashboard-context.md')}`); - const offered = before.slice(before.indexOf('## Skill routing\n'), before.indexOf('\nIf B: run', before.indexOf('## Skill routing\n'))).trimEnd() + '\n'; - expect(readFileSync(join(f.cwd, 'CLAUDE.md'), 'utf8')).toBe(offered); + expect(readFileSync(join(f.cwd, 'CLAUDE.md'), 'utf8')).toBe(readShippedSkillRouting().section + '\n'); expect(readFileSync(f.planFile, 'utf8')).toBe(original); } finally { f.cleanup(); } }, 60_000); diff --git a/test/design-review-build-loop.test.ts b/test/design-review-build-loop.test.ts index da3f0325a..c53e99be4 100644 --- a/test/design-review-build-loop.test.ts +++ b/test/design-review-build-loop.test.ts @@ -75,7 +75,7 @@ describe('the build-loop section (T7, T8, T17, T18, T29, T37)', () => { for (const item of items) expect(SECTION).toContain(item); const others = fs.readdirSync(ROOT, { recursive: true, withFileTypes: true }) .filter((d) => d.isFile() && /\.(md|tmpl)$/.test(d.name) && !d.parentPath.includes('node_modules') && !d.parentPath.includes('.git')) - .map((d) => path.relative(ROOT, path.join(d.parentPath, d.name))) + .map((d) => path.relative(ROOT, path.join(d.parentPath, d.name)).split(path.sep).join('/')) .filter((f) => !/^design-review\/sections\/build-loop\.md(\.tmpl)?$/.test(f) && !/^\.[\w-]+\/skills\//.test(f) && !f.startsWith('test/')); const carriers = others.filter((f) => items.some((i) => fs.readFileSync(path.join(ROOT, f), 'utf8').includes(i))); expect(carriers).toEqual([]); @@ -83,12 +83,11 @@ describe('the build-loop section (T7, T8, T17, T18, T29, T37)', () => { }); describe('adoption surfaces recommend the loop, never require it (T5, T31)', () => { - test('lane card, routing block, docs/skills.md and /design-html', () => { + test('lane card, docs/skills.md and /design-html', () => { const lane = read('capy/skill/gstack/lane-card.md'); expect(lane).toContain('UI work (recommended, never a READY prerequisite)'); expect(lane).toContain('`install.sh --check --for design-review` and `gstack-browser-ensure`'); expect(lane).toContain('A start that prints `GSTACK_RESULT: skill=design-review status=refused` is `DESIGN_BUILD: unrendered code=INSTALL`'); - expect(read('bin/gstack-skill-start')).toContain('- Building UI → once it renders, invoke /design-review --build (opt-in)'); expect(read('docs/skills.md')).toContain('**`--build` (opt-in, for UI you are building).**'); expect(read('design-html/SKILL.md.tmpl')).toContain('recommend (opt-in, never required) `/design-review --build `'); expect(read('design-html/SKILL.md')).toContain('/design-review --build '); diff --git a/test/fixtures/claude-md-skill-routing.md b/test/fixtures/claude-md-skill-routing.md new file mode 100644 index 000000000..3a01862de --- /dev/null +++ b/test/fixtures/claude-md-skill-routing.md @@ -0,0 +1,19 @@ +## Skill routing + +When the user's request matches an available skill, invoke it via the Skill tool. Route only to skills in the session's available-skills list; answer directly for quick questions or small scoped edits. + +Key routing rules: +- Product ideas/brainstorming → invoke /office-hours +- Strategy/scope → invoke /plan-ceo-review +- Architecture → invoke /plan-eng-review +- Design system/plan review → invoke /design-consultation or /plan-design-review +- Full review pipeline → invoke /autoplan +- Bugs/errors → fix them directly: one read-only check of the cause, or a focused failing test first when the cause is unclear; then fix it and run that test +- QA/testing site behavior → invoke /qa or /qa-only +- Code review/diff check → invoke /review +- Visual polish → invoke /design-review +- Building UI → once it renders, invoke /design-review --build (opt-in) +- Ship/deploy/PR → invoke /ship (merge + deploy: the user types /land-and-deploy) +- Save progress → invoke /context-save +- Resume context → invoke /context-restore +- Author a backlog-ready spec/issue → invoke /spec diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index b813e0749..dd9806785 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -919,9 +919,8 @@ describe('REVIEW_DASHBOARD resolver', () => { test('plan-ceo-review chaining mentions eng and design reviews', () => { // Carved skill: the chaining prose lives in sections/*.md. (It used to - // pass against the skeleton only because the preamble's routing-injection - // rules incidentally named these skills — that prose moved into - // bin/gstack-skill-start in token-reduction Phase 2.) + // pass against the skeleton only because the preamble's CLAUDE.md routing + // offer incidentally named these skills; that offer is gone.) const content = readSkillUnion('plan-ceo-review'); expect(content).toContain('/plan-eng-review'); expect(content).toContain('/plan-design-review'); @@ -2279,21 +2278,9 @@ describe('parameterized resolver support', () => { }); }); -// --- Preamble routing injection tests --- - -describe('preamble routing injection (bin/gstack-skill-start emission layer)', () => { - // Token-reduction Phase 2: the routing-injection prose left the rendered - // preamble entirely — bin/gstack-skill-start probes, gates, and emits the - // whole flow as a GSTACK_INSTRUCTION block (with the AUQ, the routing rules - // to append, and the decline ack all INSIDE the block). Absence from the - // renders is pinned by test/onboarding-moved-literals.test.ts (tombstone); - // this suite pins the gate structure and the emitted block's content. - const routingBlock = (() => { - const start = SKILL_START_SCRIPT.indexOf('_emit_block routing-injection'); - expect(start).toBeGreaterThan(0); - return SKILL_START_SCRIPT.slice(start, SKILL_START_SCRIPT.indexOf('\nEOI', start)); - })(); +// --- Preamble routing probe --- +describe('preamble routing probe (bin/gstack-skill-start)', () => { test('routing probe checks CLAUDE.md and AGENTS.md (now in gstack-skill-start)', () => { // #2500: the probe iterates CLAUDE.md AND AGENTS.md — non-Claude hosts // route skills via AGENTS.md, the cross-harness convention file. @@ -2302,47 +2289,11 @@ describe('preamble routing injection (bin/gstack-skill-start emission layer)', ( expect(SKILL_START_SCRIPT).toContain('echo "HAS_ROUTING: $_HAS_ROUTING"'); }); - test('script reads and echoes routing_declined config', () => { - expect(SKILL_START_SCRIPT).toMatch(/_ROUTING_DECLINED=\$\("\$_BIN\/gstack-config" get routing_declined/); - expect(SKILL_START_SCRIPT).toContain('echo "ROUTING_DECLINED: $_ROUTING_DECLINED"'); - }); - - test('emitted block carries the routing injection AskUserQuestion', () => { - expect(routingBlock).toContain('Add routing rules to CLAUDE.md'); - expect(routingBlock).toContain("I'll invoke skills manually"); - }); - - test('routing injection respects prior decline (gate + in-block ack)', () => { - expect(SKILL_START_SCRIPT).toContain('[ "$_ROUTING_DECLINED" = "false" ]'); - expect(routingBlock).toMatch(/routing_declined.*true/); - expect(routingBlock).toContain('re-enable with `__BIN__/gstack-config set routing_declined false`'); - }); - - test('routing injection only fires when all conditions met', () => { - // Must be: HAS_ROUTING=no AND ROUTING_DECLINED=false AND PROACTIVE_PROMPTED=yes AND the offer is not switched off by proactive off - expect(SKILL_START_SCRIPT).toContain( - 'if [ "$_HAS_ROUTING" = "no" ] && [ "$_ROUTING_DECLINED" = "false" ] && [ "$_PROACTIVE_PROMPTED" = "yes" ] && [ "$_PROACTIVE_OFF" = "no" ]; then', - ); - }); - - test('routing section content includes key routing rules', () => { - expect(routingBlock).toContain('invoke /office-hours'); - expect(routingBlock).toContain('Bugs/errors → fix them directly'); - expect(routingBlock).not.toContain('/investigate'); - expect(routingBlock).toContain('invoke /ship'); - expect(routingBlock).toContain('invoke /qa'); - }); - - test('routing section uses renamed checkpoint skills (not stale /checkpoint)', () => { - expect(routingBlock).toContain('invoke /context-save'); - expect(routingBlock).toContain('invoke /context-restore'); - expect(routingBlock).not.toContain('invoke checkpoint'); - }); - - test('routing section routes only to available skills, without "when in doubt" over-triggering (#3018)', () => { - expect(routingBlock).toContain("Route only to skills in the session's available-skills list"); - expect(routingBlock).not.toContain('When in doubt'); - expect(routingBlock).not.toContain('Do NOT answer directly'); + test('skill-start no longer offers to write a routing section into CLAUDE.md: the prompt-routing hook routes instead (B1e)', () => { + expect(SKILL_START_SCRIPT).not.toContain('routing-injection'); + expect(SKILL_START_SCRIPT).not.toContain('Add routing rules to CLAUDE.md'); + expect(SKILL_START_SCRIPT).not.toContain('routing_declined'); + expect(SKILL_START_SCRIPT).not.toContain('ROUTING_DECLINED'); }); test('root router skips routes to skills that are not loaded and says when not to invoke (#3018)', () => { diff --git a/test/gstack-skill-start.test.ts b/test/gstack-skill-start.test.ts index 07bd7ca20..40250b225 100644 --- a/test/gstack-skill-start.test.ts +++ b/test/gstack-skill-start.test.ts @@ -70,7 +70,7 @@ afterAll(() => { * PROACTIVE, SKILL_PREFIX, REPO_MODE, GSTACK_PLAN_MODE, * ARTIFACTS_SYNC, ...) and keys the script's OWN emission gates consume * (ACTIVATED, FIRST_TASK, LAKE_INTRO, TEL_PROMPTED, PROACTIVE_PROMPTED, - * HAS_ROUTING, ROUTING_DECLINED, VENDORED_GSTACK, ...). Both classes stay in + * HAS_ROUTING, VENDORED_GSTACK, ...). Both classes stay in * the emitted contract: the echoes are the debugging surface for the gates, * and prose in older installed renders may still read them. */ @@ -96,7 +96,6 @@ const PROSE_REFERENCED_KEYS = [ 'UPDATE_CHECK', 'LEARNINGS', 'HAS_ROUTING', - 'ROUTING_DECLINED', 'VENDORED_GSTACK', 'MODEL_OVERLAY', 'GSTACK_PLAN_MODE', diff --git a/test/helpers/autoplan-preconfigured-fixture.ts b/test/helpers/autoplan-preconfigured-fixture.ts index f5c426221..e374061b8 100644 --- a/test/helpers/autoplan-preconfigured-fixture.ts +++ b/test/helpers/autoplan-preconfigured-fixture.ts @@ -1,7 +1,8 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; -// Real project routing, matching the section offered by gstack-skill-start. +// Real project routing: the section gstack-skill-start offered before the prompt-routing hook replaced it +// (test/fixtures/claude-md-skill-routing.md). const ROUTING = `## Skill routing When the user's request matches an available skill, invoke it via the Skill tool. Route only to skills in the session's available-skills list; answer directly for quick questions or small scoped edits. diff --git a/test/helpers/plan-count-fixture.ts b/test/helpers/plan-count-fixture.ts index 519c8d176..70543358b 100644 --- a/test/helpers/plan-count-fixture.ts +++ b/test/helpers/plan-count-fixture.ts @@ -45,10 +45,10 @@ export function createNativeReviewState(opts: { preconfiguredReviewActor?: boole let config = fs.readFileSync(path.join(sharedState, 'config.yaml'), 'utf8') .replace(/^codex_reviews:.*(?:\r?\n|$)/gm, ''); if (opts.preconfiguredReviewActor) { - // This fixture has already declined setup changes and cross-project recall. + // This fixture has already declined cross-project recall. // Keep native review questions interactive; never alter shared/operator state. - config = config.replace(/^(?:routing_declined|cross_project_learnings):.*(?:\r?\n|$)/gm, '') - + '\nrouting_declined: true\ncross_project_learnings: false\n'; + config = config.replace(/^cross_project_learnings:.*(?:\r?\n|$)/gm, '') + + '\ncross_project_learnings: false\n'; } fs.writeFileSync(path.join(stateRoot, 'config.yaml'), config + '\ncodex_reviews: disabled\n'); // Readers and onboarding writers must agree on the owned state. diff --git a/test/helpers/shipped-skill-routing.ts b/test/helpers/shipped-skill-routing.ts index d87941e15..bc81929b9 100644 --- a/test/helpers/shipped-skill-routing.ts +++ b/test/helpers/shipped-skill-routing.ts @@ -4,7 +4,7 @@ import * as path from 'path'; const ROOT = path.resolve(import.meta.dir, '..', '..'); export interface ShippedSkillRouting { - /** The whole `## Skill routing` section gstack offers to append to CLAUDE.md. */ + /** The whole `## Skill routing` section gstack offered to append to CLAUDE.md. */ section: string; /** The heading plus the opening instruction, without the per-skill rules. */ instruction: string; @@ -13,21 +13,19 @@ export interface ShippedSkillRouting { } /** - * Read the routing section from the routing-injection heredoc in - * bin/gstack-skill-start, so E2E fixtures use the routing text users receive. + * Read the `## Skill routing` section bin/gstack-skill-start offered to append + * to CLAUDE.md until the prompt-routing hook replaced it (B1e). gstack no longer + * writes it, but projects set up before then still carry it, so E2E fixtures + * use these exact bytes (test/fixtures/claude-md-skill-routing.md). */ export function readShippedSkillRouting(root = ROOT): ShippedSkillRouting { - const source = fs.readFileSync(path.join(root, 'bin', 'gstack-skill-start'), 'utf8'); - const heredoc = source.match(/<<'EOI' \| _emit_block routing-injection\n([\s\S]*?)\nEOI\n/)?.[1]; - if (!heredoc) throw new Error('bin/gstack-skill-start: routing-injection heredoc not found'); - const start = heredoc.search(/^## Skill routing$/m); - const end = heredoc.search(/^If B:/m); - if (start < 0 || end < start) throw new Error('bin/gstack-skill-start: ## Skill routing section not found'); - const section = heredoc.slice(start, end).trim(); + const file = path.join(root, 'test', 'fixtures', 'claude-md-skill-routing.md'); + if (!fs.existsSync(file)) throw new Error('test/fixtures/claude-md-skill-routing.md: routing section fixture not found'); + const section = fs.readFileSync(file, 'utf8').trim(); const rules = section.split('\n').filter(line => /^- .+→ invoke \//.test(line)); const instruction = section.split(/\n\n/).slice(0, 2).join('\n\n'); - if (rules.length === 0 || !/Skill tool/.test(instruction)) { - throw new Error('bin/gstack-skill-start: ## Skill routing section has an unexpected shape'); + if (!section.startsWith('## Skill routing\n') || rules.length === 0 || !/Skill tool/.test(instruction)) { + throw new Error('test/fixtures/claude-md-skill-routing.md: ## Skill routing section has an unexpected shape'); } return { section, instruction, rules }; } diff --git a/test/helpers/touchfiles-data.ts b/test/helpers/touchfiles-data.ts index f11850fd6..4bfa0f271 100644 --- a/test/helpers/touchfiles-data.ts +++ b/test/helpers/touchfiles-data.ts @@ -644,15 +644,15 @@ export const E2E_TOUCHFILES: Record = { // test/skill-e2e-context-skills.test.ts. These are periodic-tier because // each one spawns claude -p and costs ~$0.20-$0.40. Collectively they // verify the thing the /checkpoint → /context-save rename was for. - 'context-save-routing': [ 'context-save/**', 'scripts/resolvers/preamble.ts', 'scripts/resolvers/preamble-hoist.ts', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-save-then-restore-roundtrip': ['bin/gstack-state-root.sh', 'lib/state-root.ts', 'context-save/**', 'context-restore/**', 'bin/gstack-slug', 'bin/gstack-remote-identity.sh', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-restore-fragment-match': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-restore-provenance-order': ['context-save/**', 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-restore-empty-state': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-restore-list-delegates': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-restore-legacy-compat': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-save-list-current-branch': [ 'context-save/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], - 'context-save-list-all-branches': [ 'context-save/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/context-restore-fragment.ts'], + 'context-save-routing': [ 'context-save/**', 'scripts/resolvers/preamble.ts', 'scripts/resolvers/preamble-hoist.ts', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-save-then-restore-roundtrip': ['bin/gstack-state-root.sh', 'lib/state-root.ts', 'context-save/**', 'context-restore/**', 'bin/gstack-slug', 'bin/gstack-remote-identity.sh', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-restore-fragment-match': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-restore-provenance-order': ['context-save/**', 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-restore-empty-state': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-restore-list-delegates': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-restore-legacy-compat': [ 'context-restore/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-save-list-current-branch': [ 'context-save/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], + 'context-save-list-all-branches': [ 'context-save/**', 'test/skill-e2e-context-skills.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/context-restore-fragment.ts'], // Document-release 'document-release': [ 'test/helpers/outside-voice-evidence.ts', 'bin/gstack-version-bump', 'document-release/**', 'test/skill-e2e-workflow.test.ts', 'test/fixtures/coverage-audit-fixture.ts', 'test/helpers/coverage-audit.ts', 'test/helpers/coverage-audit-evidence.ts', 'test/helpers/office-hours-attempt.ts'], @@ -867,24 +867,24 @@ export const E2E_TOUCHFILES: Record = { 'scrape-match-path': [ 'scrape/**', 'browse/src/browser-skills.ts', 'browse/src/browser-skill-commands.ts', 'browser-skills/hackernews-frontpage/**', - 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/skill-body-narration.ts' + 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/skill-body-narration.ts' ], 'scrape-prototype-path': [ 'scrape/**', 'browse/src/browser-skills.ts', 'browse/src/browser-skill-commands.ts', - 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/skill-body-narration.ts' + 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/skill-body-narration.ts' ], 'skillify-happy-path': [ 'skillify/**', 'scrape/**', 'browse/src/browser-skill-write.ts', 'browse/src/browser-skills.ts', 'browse/src/browser-skill-commands.ts', - 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/skill-body-narration.ts' + 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/skill-body-narration.ts' ], 'skillify-provenance-refusal': [ 'skillify/**', 'browse/src/browser-skill-write.ts', - 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/skill-body-narration.ts' + 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/skill-body-narration.ts' ], 'skillify-approval-reject': [ 'skillify/**', 'scrape/**', 'browse/src/browser-skill-write.ts', - 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/helpers/skill-body-narration.ts' + 'test/skill-e2e-skillify.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', 'test/helpers/skill-body-narration.ts' ], // Skill routing — journey-stage tests (depend on ALL skill descriptions) @@ -892,7 +892,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -901,7 +901,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -910,7 +910,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -919,7 +919,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -928,7 +928,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -937,7 +937,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -946,7 +946,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -955,7 +955,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -964,7 +964,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -973,7 +973,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" @@ -1161,7 +1161,7 @@ export const E2E_TOUCHFILES: Record = { "test/fixtures/plan-scope-recovery-av.json", - "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', + "test/fixtures/design-scope-checkpoint-at.json", '*/SKILL.md.tmpl', 'SKILL.md.tmpl', 'scripts/gen-skill-docs.ts', 'test/skill-routing-e2e.test.ts', 'bin/gstack-skill-start', 'test/helpers/shipped-skill-routing.ts', 'test/fixtures/claude-md-skill-routing.md', "scripts/resolvers/preamble/generate-preamble-bash.ts", "scripts/resolvers/preamble/generate-completion-status.ts" diff --git a/test/onboarding-moved-literals.test.ts b/test/onboarding-moved-literals.test.ts index 47cffc1eb..4ca1682b0 100644 --- a/test/onboarding-moved-literals.test.ts +++ b/test/onboarding-moved-literals.test.ts @@ -26,7 +26,6 @@ const MOVED: Record = { 'proactive-prompt': "Turn it off — I'll type /commands myself", 'first-run-tip': 'Fresh repo — shape it first with', 'first-loop-tip': 'gstack pays off when you complete one loop', - 'routing-injection': 'Add routing rules to CLAUDE.md (recommended)', 'vendoring-deprecation': 'Migrate to team mode?', 'writing-style-migration': 'Keep default or restore terse?', 'spawned-session': 'spawned by an AI orchestrator', diff --git a/test/plan-ceo-floor-interactive-boundary.test.ts b/test/plan-ceo-floor-interactive-boundary.test.ts index 9f03847ee..59d16eb0f 100644 --- a/test/plan-ceo-floor-interactive-boundary.test.ts +++ b/test/plan-ceo-floor-interactive-boundary.test.ts @@ -129,7 +129,6 @@ if (!workerCase) { stateRoot = ctx.launch.env!.GSTACK_STATE_ROOT!; expect(ctx.launch.env!.GSTACK_HOME).toBe(stateRoot); const state = fs.readFileSync(path.join(stateRoot, 'config.yaml'), 'utf8'); - expect(state).toContain('routing_declined: true'); expect(state).toContain('cross_project_learnings: false'); expect(state).toContain('codex_reviews: disabled'); } }, diff --git a/test/plan-count-fixture.test.ts b/test/plan-count-fixture.test.ts index d582ef4e3..4c20e3872 100644 --- a/test/plan-count-fixture.test.ts +++ b/test/plan-count-fixture.test.ts @@ -75,7 +75,7 @@ describe('plan-count fixtures', () => { const env = { PATH: process.env.PATH!, HOME: home, ...configured.env }; const config = (key: string) => spawnSync('bash', [path.join(ROOT, 'bin/gstack-config'), 'get', key], { cwd: configured.cwd, env, encoding: 'utf8', timeout: 10_000 }); - for (const [key, value] of [['routing_declined', 'true'], ['cross_project_learnings', 'false'], + for (const [key, value] of [['cross_project_learnings', 'false'], ['codex_reviews', 'disabled'], ['question_tuning', 'false']]) { const result = config(key); expect(result.status, result.stderr).toBe(0); @@ -86,8 +86,7 @@ describe('plan-count fixtures', () => { expect(start.status, start.stderr).toBe(0); expect(start.stdout).toContain('SESSION_KIND: interactive'); expect(start.stdout).toContain('HAS_ROUTING: no'); - expect(start.stdout).toContain('ROUTING_DECLINED: true'); - expect(start.stdout).not.toContain('GSTACK_INSTRUCTION_BEGIN: routing-injection '); + expect(start.stdout).not.toContain('routing-injection'); expect(start.stdout).toContain('QUESTION_TUNING: false'); expect(fs.readFileSync(path.join(configured.cwd, 'PLAN.md'), 'utf8')).toBe(PROMPT); expect(fs.readFileSync(path.join(configured.cwd, 'CLAUDE.md'), 'utf8')) @@ -278,7 +277,7 @@ record({ type: 'startup', pid: process.pid, cwd: process.cwd(), argv: process.argv.slice(2), stateRoot: process.env.GSTACK_STATE_ROOT, gstackHome: process.env.GSTACK_HOME, codexReviews: config('codex_reviews'), explainLevel: config('explain_level'), - routingDeclined: config('routing_declined'), crossProjectLearnings: config('cross_project_learnings'), + crossProjectLearnings: config('cross_project_learnings'), onboarding: fs.readdirSync(process.env.GSTACK_HOME).filter(name => name.startsWith('.')), gitRoot: spawnSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8', timeout: 10_000 }).stdout.trim(), plan: fs.existsSync(planPath) ? fs.readFileSync(planPath, 'utf8') : null, @@ -629,7 +628,6 @@ await Bun.write(${JSON.stringify(resultPath)}, JSON.stringify({ results, onboard expect(startup.stateRoot).not.toBe(hostState); expect(startup.codexReviews).toBe('disabled'); expect(startup.explainLevel).toBe('beginner'); - expect(startup.routingDeclined).toBe(item.preconfiguredReviewActor ? 'true' : 'false'); expect(startup.crossProjectLearnings).toBe(item.preconfiguredReviewActor ? 'false' : ''); expect(startup.onboarding).toEqual(report.onboarding); expect(startup.plan).toBe(item.prompt); diff --git a/test/plan-floor-permission.test.ts b/test/plan-floor-permission.test.ts index 17d23c7e4..a9f68a3db 100644 --- a/test/plan-floor-permission.test.ts +++ b/test/plan-floor-permission.test.ts @@ -73,7 +73,7 @@ async function exercise(mode: Mode, kind: keyof typeof SEEDS = 'ceo', capture?: expect(opts).toMatchObject({nativeReviewOnly:true,preconfiguredReviewActor:true}); fixture = createPlanCountFixture(seed, opts); const config = fs.readFileSync(path.join(fixture.env.GSTACK_HOME,'config.yaml'),'utf8'); - expect(config).toContain('routing_declined: true'); expect(config).toContain('cross_project_learnings: false'); + expect(config).toContain('cross_project_learnings: false'); expect(config).toContain('codex_reviews: disabled'); return fixture; }, readPlanFloorTarget, currentFilePermissionBinding, readPendingWriteInput, isCroppedEditPermissionVisible, diff --git a/test/plan-tune.test.ts b/test/plan-tune.test.ts index 204d8d4ec..91ae2bdfd 100644 --- a/test/plan-tune.test.ts +++ b/test/plan-tune.test.ts @@ -209,10 +209,10 @@ describe('registry breadth', () => { } }); - test('preamble one-time prompts are registered (telemetry, proactive, routing)', () => { + test('preamble one-time prompts are registered (telemetry, proactive)', () => { expect(getQuestion('preamble-telemetry-consent')).toBeDefined(); expect(getQuestion('preamble-proactive-behavior')).toBeDefined(); - expect(getQuestion('preamble-routing-injection')).toBeDefined(); + expect(getQuestion('preamble-routing-injection')).toBeUndefined(); }); test('/plan-tune itself registers its enable + setup + mutation-confirm', () => { diff --git a/test/proactive-core-set.test.ts b/test/proactive-core-set.test.ts index 6bf166fad..dbcfbb0f7 100644 --- a/test/proactive-core-set.test.ts +++ b/test/proactive-core-set.test.ts @@ -128,7 +128,7 @@ describe('proactive core set: every surface names the same four skills and three const docsSkills = fs.readFileSync(path.join(ROOT, 'docs', 'skills.md'), 'utf-8'); const docsSkillsAt = docsSkills.indexOf('## Proactive skill suggestions'); const surfaces: Record = { - 'bin/gstack-config header': configSrc.slice(configSrc.indexOf('# proactive:'), configSrc.indexOf('# routing_declined:')), + 'bin/gstack-config header': configSrc.slice(configSrc.indexOf('# proactive:'), configSrc.indexOf('# ─── Telemetry')), 'bin/gstack-config lookup_default': configSrc.slice(configSrc.indexOf('lookup_default()')).match(/^\s*proactive\).*$/m)?.[0] ?? '', 'SKILL.md.tmpl core block': routerTmpl.slice(routerTmpl.indexOf('If `PROACTIVE` is `core` (default)'), routerTmpl.indexOf('If `PROACTIVE` is `all`')).replace(TYPE_IT_RULE, ''), 'preamble rule': generateUpgradeCheck({ paths: { skillRoot: '~/.claude/skills/gstack' } } as never), diff --git a/test/proactive-skill-start.test.ts b/test/proactive-skill-start.test.ts index 4b5384598..e5afece0f 100644 --- a/test/proactive-skill-start.test.ts +++ b/test/proactive-skill-start.test.ts @@ -29,7 +29,6 @@ import * as os from 'os'; import * as path from 'path'; import { runBin } from './helpers/run-bin'; -import { readShippedSkillRouting } from './helpers/shipped-skill-routing'; const ROOT = path.resolve(import.meta.dir, '..'); const BIN = path.join(ROOT, 'bin'); @@ -98,53 +97,19 @@ describe('gstack-skill-start PROACTIVE status line', () => { } }, 60_000); - test('the CLAUDE.md routing offer fires under core and not under off (the routing rules are the auto-invocation off turns off)', () => { - const cases: Array<[string, boolean]> = [ - ['update_check: false\n', true], - ['update_check: false\nproactive: off\n', false], - ['update_check: false\nproactive: false\n', false], - ]; - for (const [config, offered] of cases) { + test('no proactive setting offers a CLAUDE.md routing section: the prompt-routing hook routes instead (B1e)', () => { + for (const config of ['update_check: false\n', 'update_check: false\nproactive: all\n', 'update_check: false\nproactive: off\n']) { const state = freshState(config); fs.writeFileSync(path.join(state, '.proactive-prompted'), ''); try { const out = runStart(path.join(BIN, 'gstack-skill-start'), state); expect(out, config).toContain('HAS_ROUTING: no'); - expect(out.includes('GSTACK_INSTRUCTION_BEGIN: routing-injection '), config).toBe(offered); + expect(out, config).not.toContain('routing-injection'); + expect(out, config).not.toContain('## Skill routing'); } finally { fs.rmSync(state, { recursive: true, force: true }); } } - }); - - test('the offered section follows the setting: core offers the four core rules and the scoping line, all offers every rule (#3446)', () => { - const offered = (config: string): string => { - const state = freshState(config); - fs.writeFileSync(path.join(state, '.proactive-prompted'), ''); - try { - const out = runStart(path.join(BIN, 'gstack-skill-start'), state); - const block = out.slice(out.indexOf('GSTACK_INSTRUCTION_BEGIN: routing-injection ')); - return block.slice(block.indexOf('## Skill routing\n'), block.indexOf('\nIf B:')).trim(); - } finally { - fs.rmSync(state, { recursive: true, force: true }); - } - }; - const rulesOf = (section: string) => section.split('\n').filter(line => /^- .+→ invoke \//.test(line)); - const shipped = readShippedSkillRouting(); - const core = offered('update_check: false\n'); - expect(rulesOf(core)).toEqual([ - '- Product ideas/brainstorming → invoke /office-hours', - '- QA/testing site behavior → invoke /qa', - '- Code review/diff check → invoke /review', - '- Ship/deploy/PR → invoke /ship', - ]); - expect(core).toContain('Do not suggest or auto-invoke other gstack skills: they run when the user types them, or when a running skill hands off to them (`gstack-config set proactive all` routes every skill).'); - expect(core.split('\n').filter(line => line.includes('→'))).toEqual(rulesOf(core)); - expect(core.startsWith(shipped.instruction)).toBe(true); - for (const config of ['update_check: false\nproactive: all\n', 'update_check: false\nproactive: true\n']) { - expect(offered(config), config).toBe(shipped.section); - } - expect(rulesOf(shipped.section).length).toBeGreaterThan(4); }, 60_000); test('a stored off answers the one-time proactive prompt: no prompt block, marker written; core still asks once telemetry was answered', () => { diff --git a/test/skill-e2e-context-skills.test.ts b/test/skill-e2e-context-skills.test.ts index 18d9c7613..c347bef34 100644 --- a/test/skill-e2e-context-skills.test.ts +++ b/test/skill-e2e-context-skills.test.ts @@ -76,7 +76,7 @@ function setupWorkdir(suffix: string): { workDir: string; gstackHome: string; sl // from beside bin/. A copy, not a symlink: the agent runs inside workDir. fs.cpSync(path.join(ROOT, 'lib'), path.join(workDir, 'lib'), { recursive: true }); - // Routing CLAUDE.md: the ## Skill routing section gstack ships. + // Routing CLAUDE.md: the ## Skill routing section gstack offered, which older projects still carry. fs.writeFileSync(path.join(workDir, 'CLAUDE.md'), `# Project Instructions ${readShippedSkillRouting().section} diff --git a/test/skill-e2e-skillify.test.ts b/test/skill-e2e-skillify.test.ts index acdf4d647..58fa35ee2 100644 --- a/test/skill-e2e-skillify.test.ts +++ b/test/skill-e2e-skillify.test.ts @@ -63,7 +63,7 @@ interface Workdir { * - bin/ scripts referenced by the preamble * - A scoped GSTACK_HOME under the workdir so on-disk artifacts are * contained and assertable - * - A CLAUDE.md with the ## Skill routing section gstack ships + * - A CLAUDE.md with the ## Skill routing section gstack offered (older projects still carry it) * * `installSkills` lets each test pick the minimum surface (e.g., the * provenance-refusal scenario doesn't need /scrape). diff --git a/test/skill-fixture.test.ts b/test/skill-fixture.test.ts index f05ca0729..9fd1c61db 100644 --- a/test/skill-fixture.test.ts +++ b/test/skill-fixture.test.ts @@ -499,7 +499,7 @@ test('routing catalog contains installed project names without a request-to-skil expect(writes.size).toBe(4); }); -test('routing fixtures read the ## Skill routing section gstack ships', () => { +test('routing fixtures read the ## Skill routing section gstack offered for CLAUDE.md, frozen in a fixture', () => { const routing = readShippedSkillRouting(); expect(routing.instruction).toStartWith('## Skill routing\n\n'); expect(routing.instruction).toContain('Skill tool'); @@ -508,9 +508,10 @@ test('routing fixtures read the ## Skill routing section gstack ships', () => { expect(routing.section).not.toContain('If B:'); const root = fs.mkdtempSync(path.join(os.tmpdir(), 'shipped-routing-drift-')); try { - fs.mkdirSync(path.join(root, 'bin')); - fs.writeFileSync(path.join(root, 'bin', 'gstack-skill-start'), '#!/bin/bash\necho no routing here\n'); - expect(() => readShippedSkillRouting(root)).toThrow('routing-injection heredoc not found'); + expect(() => readShippedSkillRouting(root)).toThrow('routing section fixture not found'); + fs.mkdirSync(path.join(root, 'test', 'fixtures'), { recursive: true }); + fs.writeFileSync(path.join(root, 'test', 'fixtures', 'claude-md-skill-routing.md'), '## Skill routing\n\nno rules here\n'); + expect(() => readShippedSkillRouting(root)).toThrow('unexpected shape'); } finally { fs.rmSync(root, { recursive: true, force: true }); } }); diff --git a/test/skill-routing-e2e.test.ts b/test/skill-routing-e2e.test.ts index 1919375ea..af92d3042 100644 --- a/test/skill-routing-e2e.test.ts +++ b/test/skill-routing-e2e.test.ts @@ -95,7 +95,8 @@ function installSkills(tmpDir: string) { // The names-only catalog keeps new CLI built-ins from changing the candidate // set. Descriptions still choose the skill; no request-to-skill answer key. - // The routing instruction is the one gstack ships (bin/gstack-skill-start), + // The routing instruction is the one gstack offered for CLAUDE.md + // (test/fixtures/claude-md-skill-routing.md), // without its per-skill rule list. These journey tests exist to catch skill // DESCRIPTION regressions (their touchfiles key on */SKILL.md.tmpl): with a // lookup table in context, a badly regressed frontmatter description still diff --git a/test/skill-validation.test.ts b/test/skill-validation.test.ts index 184e1db88..c4f068bd3 100644 --- a/test/skill-validation.test.ts +++ b/test/skill-validation.test.ts @@ -2050,7 +2050,7 @@ describe('Bug reports: the router has no bug-fix route, other surfaces keep thei expect(router).not.toContain('/investigate'); }); - test('the routing gstack offers for CLAUDE.md, and this repo\'s own, fix bugs directly behind a cause check or a failing test', () => { + test('the routing section gstack offered for CLAUDE.md, and this repo\'s own, fix bugs directly behind a cause check or a failing test', () => { const bugRule = readShippedSkillRouting().section.split('\n').find(line => line.startsWith('- Bugs/errors')); expect(bugRule).toMatch(/→ fix them directly: one read-only check of the cause, or a focused failing test first when the cause is unclear/); expect(bugRule).not.toContain('/investigate');