Skip to content

feat(start,ship): token-efficient flags for cascade gating (#64)#65

Merged
JFK merged 1 commit into
mainfrom
64-feat/make-start-token-efficient-with-optional
May 19, 2026
Merged

feat(start,ship): token-efficient flags for cascade gating (#64)#65
JFK merged 1 commit into
mainfrom
64-feat/make-start-token-efficient-with-optional

Conversation

@JFK
Copy link
Copy Markdown
Owner

@JFK JFK commented May 19, 2026

Summary

Closes #64. Adds four opt-in flags that adapt the cascade to the actual scope of the work, plus measurement infrastructure for verifying token impact.

Flag Phase Effect
auto-size /start Skip gate1 entirely when issue matches the label/body-length heuristic (gate1.size_heuristic).
auto-skip /ship Skip docs-only gate2 advisors per gate2.diff_scope_skip.
--with-plan /start Invoke /superpowers:writing-plans after gate1, persist plan to state file.
--parallel /start Chain /superpowers:subagent-driven-development as the step 18 continue target. Requires --with-plan.

Backward-compat: with no flags and no config opt-in, behavior is byte-identical to v0.8.0. State schema is additive (plan, gate2.skipped_advisors, gate2.diff_scope are all optional v2-compatible fields).

Gate1 outcome

Verdict: yellow (via /claude-c-suite:ask, CTO lens)

The reviewer flagged 5 design concerns; all 5 are addressed in this PR:

  1. Skill tool execution modelstep 12a of commands/start.md now documents the in-line execution model explicitly: writing-plans body is injected into Claude's context; the parent (/start) captures the plan output and persists it. No autonomous sub-process.
  2. PM signal self-cancellation — the size heuristic uses only label and body_length. The PM signal proxy mentioned in the issue body was rejected during gate1 review because invoking /pm to decide whether to invoke gate1 would cancel out the savings.
  3. backward-compat tension — resolved by making both heuristics opt-in (CLI flag + config enabled=false default).
  4. docs-only path classification — the default docs_only_patterns deliberately excludes commands/*.md (markdown-as-code in this plugin). Documented in config.md and both READMEs.
  5. rtk gain reproducibilitytests/fixtures/typo-fix-issue.md provides a fixed scenario; CONTRIBUTING.md documents the measurement procedure.

Gate1 markdown: ~/.claude/cache/gh-issue-driven/64-feat-make-start-token-efficient-with-optional.gate1.md

Gate2 outcome

Verdict: green (advisor-only mode — gate2.binary_gate=null)

Advisor Verdict Key note
/claude-c-suite:cso green No new attack surface; auto-skip's commands/*.md exclusion is well-designed.
/claude-c-suite:qa-lead green Existing tests pass (state-schema 39/39, enum-sync 24/24, jq-sync 5/5, verdict-parser 25/25). Heuristic logic unit tests deferred per spec-as-code convention.
/claude-c-suite:cto green Plan-extraction reliability is the main residual risk — observable via dogfooding. Schema additivity preserved. --auto-size inverse flag could be a follow-up.

Gate2 markdown: ~/.claude/cache/gh-issue-driven/64-feat-make-start-token-efficient-with-optional.gate2.md

Acceptance criteria

  • /start --with-plan invokes superpowers:writing-plans (step 12a) and persists the plan (step 14.5).
  • /start --parallel invokes superpowers:subagent-driven-development (step 18b), requires --with-plan.
  • /start auto-size applies an issue-size heuristic (step 7a) using label and body_length (no PM signal — would self-cancel). Heuristic and override documented in config.md.
  • /ship auto-skip applies a diff-scope heuristic (step 4a) for docs-only diffs. Rules documented in config.md.
  • Deferred: verbose Skill bodies move to references/. Gate1 noted limited effect (Skill loader does not auto-expand @references/ paths). Follow-up issue to be filed.
  • Pending dogfooding: capture rtk gain numbers using tests/fixtures/typo-fix-issue.md and append to this PR description before merge.
  • Default /start and /ship behavior backward-compatible (no flags -> current cascade).
  • doctor updated: superpowers entry now mentions --with-plan / --parallel graceful-degradation path.
  • README.md / README.ja.md describe new flags and skipping rules.

Out of scope

  • commands/*.md extraction to references/ (deferred per gate1 review's "limited effect" assessment).
  • Replacing the CxO panel — only the gating of when each runs changes.
  • Refactoring /propose.

Files changed

  • commands/start.md (+126) — 3 new flags, step 7a (size heuristic), step 12a (writing-plans), step 14.5 (plan persistence), step 18b parallel branch.
  • commands/ship.md (+62) — auto-skip flag, step 4a (diff-scope skip).
  • commands/config.md (+48) — gate1.size_heuristic, gate2.diff_scope_skip keys + documentation.
  • commands/doctor.md (+6) — superpowers entry updated.
  • README.md (+42) — Token-efficient flags section.
  • README.ja.md (+42) — same in Japanese.
  • CONTRIBUTING.md (+27) — rtk gain measurement procedure.
  • tests/fixtures/typo-fix-issue.md (new) — measurement fixture.

How was this tested

  • All four existing test suites pass:
    • bash tests/test_state_schema.sh: 39 passed / 0 failed
    • bash tests/enum-sync-check.sh: 24 in sync / 0 drifted
    • bash tests/jq-sync-check.sh: 5 in sync / 0 drifted
    • python3 tests/test_verdict_parser.py: 25 passed / 0 failed
  • This PR itself was dogfooded end-to-end (/propose -> /start -> /ship), exercising the v0.8.0 pre-change paths. Post-merge, follow-up runs will exercise the new flags.

Follow-ups (separate issues)

  1. References/ refactor for commands/start.md / commands/ship.md to reduce primary-load file size.
  2. Inverse flag (no-auto-size) or per-invocation disable mechanism for gate1.size_heuristic.enabled=true global config.
  3. Shell-level unit test framework for heuristic logic (currently spec-as-code, verified via manual dogfooding).

Add four opt-in flags that adapt the cascade to issue/diff scope:

- `auto-size` (/start): skip gate1 entirely for small issues per the
  label/body-length heuristic in gate1.size_heuristic. Default off.
- `auto-skip` (/ship): skip docs-only gate2 advisors per the path-pattern
  rules in gate2.diff_scope_skip. Default off.
- `--with-plan` (/start): invoke /superpowers:writing-plans after gate1
  and persist the plan to the state file (step 12a + 14.5).
- `--parallel` (/start): chain /superpowers:subagent-driven-development
  as the step 18 continue target. Requires --with-plan.

Backward-compat: with no flags and no config opt-in, behavior is
byte-identical to v0.8.0. State schema is additive (`plan`,
`gate2.skipped_advisors`, `gate2.diff_scope` are all v2-compatible
optional fields). Co-locates measurement procedure (CONTRIBUTING.md,
tests/fixtures/typo-fix-issue.md) so future PRs can produce reproducible
rtk gain numbers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 19, 2026 17:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in “token-efficient” gating and workflow flags to the gh-issue-driven command specs so /start and /ship can adapt reviewer/skill execution to the scope of work, plus documentation and a fixture for measuring token impact.

Changes:

  • Add /start flags auto-size, --with-plan, and --parallel with a size-heuristic gate1 short-circuit and optional plan/subagent chaining.
  • Add /ship flag auto-skip with diff-scope classification to filter gate2 advisors for docs-only diffs.
  • Document the new config keys and measurement procedure; add a reproducible measurement fixture.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
commands/start.md Adds size-heuristic gate1 skip plus optional writing-plans and parallel subagent continue-target logic.
commands/ship.md Adds diff-scope detection to optionally skip irrelevant gate2 advisors on docs-only diffs.
commands/config.md Documents gate1.size_heuristic and gate2.diff_scope_skip defaults and behavior.
commands/doctor.md Updates superpowers plugin check messaging to cover --with-plan / --parallel degradation.
README.md Documents the new token-efficiency flags and how they affect /start and /ship.
README.ja.md Japanese documentation for the new token-efficiency flags.
CONTRIBUTING.md Adds a reproducible rtk gain measurement procedure for flag-impact changes.
tests/fixtures/typo-fix-issue.md New fixture issue body for consistent token-consumption measurement runs.

Comment thread commands/start.md
Comment on lines +419 to +421
Both signals are checked. The issue is **small** when **either**:
- Any label name (case-insensitive) is in `SMALL_LABELS`, OR
- `len(PRIMARY_ISSUE.body)` is less than `SMALL_BODY_MAX`
Comment thread commands/start.md
Determine what the **continue** option will actually do, based on flags, skill detection from step 17b, and `IS_BATCH`:

- If `IS_BATCH` is true → continue target is **"draft a per-issue implementation plan in this conversation"**. Do **not** auto-launch `/feature-dev` for batch mode (it is single-feature oriented).
- If `PARALLEL=true` (the operator opted in via `--parallel`) AND `PLAN_OUTPUT` is non-null (the writing-plans step produced a usable plan) → continue target is **"invoke `/superpowers:subagent-driven-development` via the Skill tool, passing the plan from step 12a as its input"**. This branch is only reachable when `WITH_PLAN=true` as well (step 1's interaction rules guarantee it). If the `/superpowers:subagent-driven-development` skill is not installed OR `PLAN_OUTPUT` is null (writing-plans skill was unavailable or returned nothing usable), fall through to the next applicable branch and log a one-line warning naming the reason.
Comment thread README.md
Comment on lines +226 to +232
### `auto-skip` — skip irrelevant gate2 advisors (`/ship`)

`/gh-issue-driven:ship auto-skip` probes the diff and, when every changed file matches `gate2.diff_scope_skip.docs_only_patterns` (default `README*`, `CHANGELOG*`, `CONTRIBUTING*`, `docs/`, `.github/`), skips the advisors listed in `docs_only_skip_advisors` (default `cso` and `qa-lead`). The remaining advisors (e.g. `cto`) still run, and the binary gate (`gate2.binary_gate`) is never affected.

A diff that touches even one non-doc file disqualifies docs-only treatment — there is no partial skip. The `commands/*.md` files in this repo are markdown-as-code and are intentionally **not** in the default pattern list.

Persistent equivalent: set `gate2.diff_scope_skip.enabled: true` in config.
Comment thread README.ja.md
Comment on lines +225 to +231
### `auto-skip` — 関係ない gate2 advisor をスキップ (`/ship`)

`/gh-issue-driven:ship auto-skip` は diff を調べ、変更ファイル**すべて**が `gate2.diff_scope_skip.docs_only_patterns` (デフォルト `README*` / `CHANGELOG*` / `CONTRIBUTING*` / `docs/` / `.github/`) に一致したら、`docs_only_skip_advisors` (デフォルト `cso` と `qa-lead`) をスキップします。残りの advisor (例: `cto`) は走り、binary gate (`gate2.binary_gate`) は影響を受けません。

1ファイルでも非doc 変更があれば docs-only 判定は不成立 — partial skip はありません。このリポジトリの `commands/*.md` は markdown-as-code (実行 spec) なので、意図的にデフォルトパターンから除外されています。

永続化設定は `gate2.diff_scope_skip.enabled: true`。
Comment thread CONTRIBUTING.md
Comment on lines +91 to +92
| /start typo-fix-issue --auto-size | <tokens> | <tokens> | -N% |
| /ship docs-only-diff --auto-skip | <tokens> | <tokens> | -N% |
@JFK
Copy link
Copy Markdown
Owner Author

JFK commented May 19, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@JFK JFK merged commit 4e5c06b into main May 19, 2026
5 checks passed
@JFK JFK deleted the 64-feat/make-start-token-efficient-with-optional branch May 19, 2026 18:03
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.

Make /start token-efficient with optional plan and parallel-dispatch skills

2 participants