feat(ce-plan): reduce token usage by extracting conditional references#489
Merged
feat(ce-plan): reduce token usage by extracting conditional references#489
Conversation
…vings Extract three large conditional/late-sequence blocks from ce:plan SKILL.md into on-demand reference files, reducing the base skill from 1,023 lines (~15,525 tokens) to 685 lines (~9,971 tokens) — a 36% reduction. For orchestration-heavy skills like ce:plan with 20-40+ tool/agent calls per session, unused content carried in every message exchange compounds significantly. This saves ~130,000-167,000 context tokens per planning session depending on which code paths execute. Extracted files: - references/deepening-workflow.md (5.3.3-5.3.7, ~3,808 tok) — loaded only when the deepening gate passes - references/visual-communication.md (4.4, ~823 tok) — loaded only when plan has complex visual-worthy content patterns - references/plan-handoff.md (5.3.8-5.4, ~1,304 tok) — loaded only at end of workflow for document review and post-generation options Also adds a "Conditional and Late-Sequence Extraction" rule to the plugin AGENTS.md to guide future skill optimization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2ac5cf51d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The 4.4 stub was missing the Key Technical Decisions and Alternative Approaches triggers. Restores the complete condition set so the agent loads visual-communication.md for all cases the reference file covers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Token savings evidence
ce:plan is an orchestration-heavy skill that makes 20-40+ tool/agent calls per session. Every message exchange carries the full SKILL.md in context. Extracting unused content eliminates that compounding cost:
references/deepening-workflow.mdreferences/visual-communication.mdreferences/plan-handoff.mdPer-session savings: ~130,000-167,000 context tokens (extracted tokens x messages before they're needed).
Validation
Ran 3 test plans exercising all code paths:
Zero premature reference file reads across all tests. All 582 unit tests pass.
Test plan
bun test— 582 pass, 0 fail🤖 Generated with Claude Code