Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions bin/gstack-config
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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" ;;
Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
64 changes: 3 additions & 61 deletions bin/gstack-skill-start
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <preview url> (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 <<EOI
Expand Down
21 changes: 1 addition & 20 deletions browse/test/gstack-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('gstack-config', () => {
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:');
});
Expand Down Expand Up @@ -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');
});
});
1 change: 1 addition & 0 deletions changelog.d/cut-claude-md-routing-offer.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/OPENCLAW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 6 additions & 9 deletions docs/proactive.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/skill-routing-and-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/uninstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 0 additions & 8 deletions scripts/question-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 5 additions & 6 deletions test/autoplan-preconfigured-onboarding-ar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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') };
Expand All @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions test/design-review-build-loop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,19 @@ 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([]);
});
});

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 <preview url> (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 <preview url>`');
expect(read('design-html/SKILL.md')).toContain('/design-review --build <preview url>');
Expand Down
19 changes: 19 additions & 0 deletions test/fixtures/claude-md-skill-routing.md
Original file line number Diff line number Diff line change
@@ -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 <preview url> (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
Loading
Loading