fix: /plan empty-target fast path — stop burning ~5k tokens in empty repos#22
Merged
Conversation
A totally empty repo burned ~5k tokens of reference/module reading before the agent acknowledged there was nothing on disk. The plan dispatcher now runs one cheap ls -A probe first; an empty tree short-circuits to an immediate greenfield header, skips repo-evidence phases, and asks what to build when the prompt carries no idea. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running /plan in a totally empty repository burned ~5k tokens of reference and specialist-module reading before the agent acknowledged there was nothing on disk. The dispatch protocol mandates reading three reference files plus the full active module before any output, so the empty-tree discovery came last instead of first.
Fix
Dispatcher-level (scripts/gstack2/generate-skill-tree.ts, same gap/supplemental pattern as the Scale header): a plan-only "Empty-target fast path" section. One cheap
ls -Aprobe runs before any reference or module read. An empty tree (or only VCS/tooling metadata) short-circuits to an immediate greenfield header, states the repo is empty in the first sentence, skips decision-store recall and every repo-reading phase, and asks the single what-do-you-want-to-build question when the prompt carries no idea. Codebase vector fixes at greenfield; scale comes from the prompt alone.No specialist overlay and no EXPECTED_PARITY_CHECKS bump — the fast path runs before modules are read, so it lives in the dispatcher, not the legacy bodies.
Evidence
bun run test:gstack2passes (all 26 files, parity at 5027 checks)bun testpasses (exit 0)skills/plan/SKILL.md(+4 lines) and the parity transcript hash changed🤖 Generated with Claude Code
Summary by cubic
Add an empty-target fast path for
/planthat probes the repo with a singlels -Abefore any reads. Empty repos now short-circuit to a greenfield plan, saving ~5k tokens and time.Target: <path> (empty repository — greenfield); if no idea in the prompt, ask what to build.scripts/gstack2/generate-skill-tree.tsandskills/plan/SKILL.md; tests pass.Written for commit 49b8687. Summary will update on new commits.