Skip to content

feat(gen-skill-docs): add --plan-mode=off to omit the plan-mode preamble (#3168) - #3213

Closed
xingzihai wants to merge 1 commit into
garrytan:mainfrom
xingzihai:feat/plan-mode-off-3168
Closed

xingzihai wants to merge 1 commit into
garrytan:mainfrom
xingzihai:feat/plan-mode-off-3168

Conversation

@xingzihai

@xingzihai xingzihai commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3168

What

Adds a --plan-mode=off flag to gen-skill-docs that drops the ~1.8 KB "Plan Mode Safe Operations" + "Skill Invocation During Plan Mode" preamble block from every generated skill. Default builds (flag absent or --plan-mode=on) keep the block byte-identically.

Live evidence

$ bun run gen:skill-docs --out-dir /tmp/pm-default-build
[103 artifacts generated]
$ grep -rl "Plan Mode" /tmp/pm-default-build/ | wc -l
50

$ bun run gen:skill-docs --plan-mode=off --out-dir /tmp/pm-off-build
[103 artifacts generated]
$ grep -rl "Plan Mode" /tmp/pm-off-build/ | wc -l
1
$ grep -n "Plan Mode" /tmp/pm-off-build/landing-report/SKILL.md
484:## Plan Mode   ← skill-specific section, not the preamble

$ diff -rq /tmp/pm-default-build/ /tmp/pm-off-build/ | grep -c "differ"
58   ← only the plan-mode preamble lines differ

$ bun test test/plan-mode-off-build.test.ts
 9 pass, 0 fail, 14 expect() calls

$ bun test test/terse-build.test.ts test/review-entry-and-design-clarity-au.test.ts
 24 pass, 0 fail, 531 expect() calls

$ bun run typecheck
✓ (no errors)

Liveness proof

Live command output above. The --plan-mode=off flag is parsed in gen-skill-docs.ts, threaded through GenerationOptions → RenderOptions → TemplateContext, and consumed in generate-completion-status.ts where generatePlanModeInfo returns '' when ctx.planMode === false.

…ble (garrytan#3168)

Generated skills ship a ~1.8 KB "## Plan Mode Safe Operations" +
"## Skill Invocation During Plan Mode" block on every skill, for hosts
and users who never enter plan mode. This adds a --plan-mode=off flag to
gen-skill-docs that drops that block at gen time. Default builds
(planMode undefined or true) keep the block byte-identically.

The "PLAN MODE EXCEPTION — ALWAYS RUN" markers inside skill bodies
still apply when the flag is off.
@trunk-io

trunk-io Bot commented Oct 16, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@xingzihai xingzihai changed the title feat(gen-skill-docs): add --plan-mode=off to omit the plan-mode preamble feat(gen-skill-docs): add --plan-mode=off to omit the plan-mode preamble (#3168) Oct 16, 2026
@capy-ai

capy-ai Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Triage (fix wave 5, GSTA-37): this adds a new generator flag for #3168, which is a feature request, so it's outside this bug-fix wave. I left it open for Garry's call.

@capy-ai

capy-ai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thanks @xingzihai, this is a clean, well-tested change, and keeping default output byte-identical is exactly right.

Decision: we want this, reworked so it's reachable from an installed gstack. Installed copies never run the generator, so a --plan-mode=off flag alone doesn't help users. Could you wire it to a gstack-config key (for example plan_mode_preamble=off) that setup and /gstack-upgrade pass through when they regenerate skills? Keep default output byte-identical, add a test for the config path, and rebase onto main. Note that #3236 already drops the sections on hosts with planMode:false, so the key only matters for Claude, copilot and opencode. We'll land it with your authorship kept. Tracking in #3168.

@capy-ai

capy-ai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Thank you @xingzihai. Your flag was clean, well tested and byte-identical by default, and it's now the core of #3308. We went ahead and built the config wiring we asked about on the 17th, so this didn't have to wait on you: gstack-config set plan_mode_preamble off now reaches installed skills through setup, relink, gbrain-refresh and upgrade, including the default Claude install, which normally serves the committed files with no render. Your commit is cherry-picked unchanged with you as author; the only conflict was keeping both guards next to #3236's host-capability check. Closing this in favour of #3308, which closes #3168 when it merges.

@capy-ai capy-ai Bot closed this Oct 19, 2026
garrytan added a commit that referenced this pull request Oct 19, 2026
…preamble from installed skills (port of #3213)

Merge origin/main and stamp 1.91.158.0.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
capy-ai Bot added a commit that referenced this pull request Oct 19, 2026
…preamble from installed skills (port of #3213) (#3308)

* feat(gen-skill-docs): add --plan-mode=off to omit the plan-mode preamble (#3168)

Generated skills ship a ~1.8 KB "## Plan Mode Safe Operations" +
"## Skill Invocation During Plan Mode" block on every skill, for hosts
and users who never enter plan mode. This adds a --plan-mode=off flag to
gen-skill-docs that drops that block at gen time. Default builds
(planMode undefined or true) keep the block byte-identically.

The "PLAN MODE EXCEPTION — ALWAYS RUN" markers inside skill bodies
still apply when the flag is off.

(cherry picked from commit 51edee9)

* style(types): fix stray indentation on TemplateContext.installRoot

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

* feat(config): plan_mode_preamble key wires --plan-mode=off into setup and every installed render

gstack-config plan_mode_preamble (on|off, default on) makes ./setup pass
--plan-mode=off to every gen:skill-docs render, gbrain-refresh and the
gstack-relink router render. The default Claude install, which otherwise
serves the committed SKILL.md files, gets a plain render with the key off;
the activation record notes plan_mode=off so switching back on removes the
render, including on the gbrain=unknown keep branch. With the key on or
unset every path and record is byte-for-byte unchanged.

Fixes #3168. Finishes #3213 by @xingzihai.

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

* fix(setup,relink): plan_mode_preamble=off survives builds and failed renders; alias follows the router

Review findings on the plan_mode_preamble wiring:
- a build renders env hosts without --plan-mode=off, so with the key off
  setup no longer skips their re-render after a build;
- with the key off the gbrain-absent branch leaves the render to the plain
  re-render, so a failed render keeps the previous one;
- gstack-relink refreshes the _gstack-command alias after re-rendering the
  router (also fixes the same staleness for disabled_skills).

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

---------

Co-authored-by: xingzihai <xingzihai@users.noreply.github.com>
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.

Option to omit the plan-mode preamble from generated skills

1 participant