Add skill: token-budget-advisor (TBA)#920
Conversation
Skill that intercepts prompts, estimates token consumption across 4 depth levels, and lets the user choose before Claude responds.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a new community skill "Token Budget Advisor" that intercepts prompts to estimate input tokens, compute a response-token window, present a 25/50/75/100% depth selection to the user, and then generate answers constrained by the chosen depth; also updates install manifest and documentation counts. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant TBA as Token Budget Advisor
participant Model as Claude Model
User->>TBA: Submit prompt
TBA->>TBA: Evaluate trigger / non-trigger rules
alt Triggered
TBA->>TBA: Estimate input tokens (chars → tokens)
TBA->>TBA: Classify complexity → compute response window (apply multipliers, cap by model limit)
TBA->>User: Present depth-selection (25/50/75/100%) with token estimates
User->>TBA: Select depth (or use shortcut)
TBA->>Model: Forward prompt + depth constraints
Model->>User: Return final answer per selected depth
else Not triggered
TBA->>Model: Forward prompt unchanged
Model->>User: Return default answer
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds a new community skill, Token Budget Advisor (TBA), which intercepts Claude's response flow to present users with a pre-response depth-selection menu (25/50/75/100%) backed by heuristic token estimates. The skill is zero-dependency (pure Markdown), bilingual (EN/ES), and carries session-level memory of the chosen depth level within a conversation. Previous review concerns are all resolved in this version:
Remaining minor issues found in this pass:
Confidence Score: 5/5Safe to merge; all previous P1 issues are resolved and only minor P2 style improvements remain. All five issues flagged in the previous review round have been addressed in this version. The two remaining findings are both P2: bare digit shortcuts that risk infrequent false positives, and a small gap between the frontmatter trigger list and the shortcuts table. Neither blocks correct operation of the skill in the common case. skills/token-budget-advisor/SKILL.md — shortcuts table and frontmatter trigger list have minor inconsistencies worth tidying up. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([User message]) --> B{Skill triggered?}
B -- "No (domain token / trivial answer / level already set)" --> Z([Normal response])
B -- "Yes" --> C{Shortcut signal in message?}
C -- "Yes (25%/50%/75%/100% brief/tldr/exhaustive…)" --> D[Apply level immediately]
C -- "No" --> E[Step 1: Estimate input tokens\nword_count×1.3 or char_count/4]
E --> F[Step 2: Classify complexity & compute response window\nmin=input×mult_min, max=input×mult_max]
F --> G[Step 3: Present depth menu with per-level token estimates]
G --> H{User picks level 1-4 or 25%/50%/75%/100%}
H --> D
D --> I[Step 4: Respond at chosen depth level]
I --> J{Subsequent messages this session?}
J -- "Level unchanged" --> K[Maintain level silently]
J -- "User changes level" --> D
K --> I
Reviews (4): Last reviewed commit: "Merge origin/main into Xabilimon1/main" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Adds a new community skill, token-budget-advisor (TBA), intended to intercept responses when users want to control depth/length and present 4 depth options with estimated token counts before answering.
Changes:
- Introduces a new skill definition and workflow for estimating input tokens and mapping response depth levels to token budgets.
- Adds bilingual (EN/ES) trigger guidance and shortcut handling for pre-selected depth levels.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| DO NOT TRIGGER when: user has already specified a level in the current | ||
| session (maintain it) or the request is clearly a one-word answer. |
There was a problem hiding this comment.
The frontmatter says “DO NOT TRIGGER when user has already specified a level in the current session”, but the body later requires maintaining that level silently for subsequent responses. If the router follows frontmatter, the skill likely won’t run on follow-ups, so it can’t enforce the previously selected depth. Consider changing this to “don’t re-prompt when a level is already set; just respond at that level” (i.e., still activate/apply the skill, but skip Step 3).
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
skills/token-budget-advisor/SKILL.md (1)
38-50: Consider aligning token calibration withskills/context-budgetto avoid cross-skill drift.This table diverges from the repository’s existing calibration guidance, which can produce inconsistent estimates across skills. Prefer reusing the canonical rule (or explicitly link and justify the override).
Based on learnings: Context snippet
skills/context-budget/SKILL.md:131uses canonical estimation (words × 1.3for prose,chars / 4for code-heavy files).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/token-budget-advisor/SKILL.md` around lines 38 - 50, Update the token-calibration guidance in skills/token-budget-advisor/SKILL.md to match the repository canonical rules used in skills/context-budget: use prose estimation as "words × 1.3" and code-heavy estimation as "chars / 4", or else add an explicit justification and link to skills/context-budget/SKILL.md:131 explaining why these per-type ratios differ; change the table entries or add a note referencing the canonical rule so all skills use a consistent calibration source.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/token-budget-advisor/SKILL.md`:
- Around line 32-33: In skills/token-budget-advisor/SKILL.md the documentation
uses a "Workflow" header instead of the required "How It Works" and lacks an
"Examples" section; update the file by adding an explicit "How It Works" header
(you may move or copy the existing "Workflow" content under this new header) and
add a new "Examples" section containing several short trigger and non-trigger
example prompts illustrating when to use the skill and when not to, while
keeping the existing "When to Use" content unchanged; ensure headers are exactly
"How It Works" and "Examples" so the skill-doc validation recognizes them.
- Around line 88-90: The percentage math for the level token estimates is
incorrect: update the formulas shown (`min + (max - min) × 0.15` and `min + (max
- min) × 0.45`) to match their labels by replacing 0.15 with 0.25 and 0.45 with
0.5 so they read `min + (max - min) × 0.25` and `min + (max - min) × 0.5` (leave
the 75% line `min + (max - min) × 0.75` unchanged).
---
Nitpick comments:
In `@skills/token-budget-advisor/SKILL.md`:
- Around line 38-50: Update the token-calibration guidance in
skills/token-budget-advisor/SKILL.md to match the repository canonical rules
used in skills/context-budget: use prose estimation as "words × 1.3" and
code-heavy estimation as "chars / 4", or else add an explicit justification and
link to skills/context-budget/SKILL.md:131 explaining why these per-type ratios
differ; change the table entries or add a note referencing the canonical rule so
all skills use a consistent calibration source.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 582c3ed5-e1ae-4889-9cd3-9d7f064bbf93
📒 Files selected for processing (1)
skills/token-budget-advisor/SKILL.md
There was a problem hiding this comment.
4 issues found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="skills/token-budget-advisor/SKILL.md">
<violation number="1" location="skills/token-budget-advisor/SKILL.md:8">
P2: Use more specific token-control phrases instead of the bare `"tokens"` trigger to avoid activating this skill on unrelated requests like JWT/OAuth token questions.</violation>
<violation number="2" location="skills/token-budget-advisor/SKILL.md:88">
P2: Align the interpolation factors with the advertised levels; using `0.15` and `0.45` for the 25%/50% tiers produces estimates that do not match the percentages shown to users.</violation>
<violation number="3" location="skills/token-budget-advisor/SKILL.md:110">
P2: Remove the standalone `"complete"` shortcut; it commonly appears in task instructions and can silently set depth to 75% unintentionally.</violation>
<violation number="4" location="skills/token-budget-advisor/SKILL.md:122">
P1: Documentation instructs users to execute an external `npx` package, creating avoidable supply-chain risk from unvetted code.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
skills/token-budget-advisor/SKILL.md (1)
32-33:⚠️ Potential issue | 🟠 MajorAdd explicit
How It WorksandExamplesheaders to meet skill-doc format requirements.At Line 32,
Workflowshould be renamed toHow It Works, and an explicitExamplessection is still missing in this file.Suggested doc patch
-## Workflow +## How It Works ... +## Examples + +### Trigger examples +- "Give me the TL;DR" +- "Responde al 50%" +- "I want to control token usage" + +### Non-trigger examples +- "Capital of France?" +- "2+2?"As per coding guidelines:
skills/**/*.md: Skills must be formatted as Markdown files with clear sections including 'When to Use', 'How It Works', and 'Examples'Also applies to: 102-122
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/token-budget-advisor/SKILL.md` around lines 32 - 33, Rename the "Workflow" header to "How It Works" and add an explicit "Examples" section in SKILL.md to satisfy the skills markdown format (ensure the file contains "When to Use", "How It Works", and "Examples" headers); update any content under the current "Workflow" heading to remain under the new "How It Works" header and create one or more short usage examples under the new "Examples" header demonstrating typical inputs/output or expected behavior so the document matches the required structure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/token-budget-advisor/SKILL.md`:
- Around line 106-112: Replace the duplicated "75%" row in the mapping table
(the row containing "75%" / "detailed" / "thorough") with a proper "100%"
mapping so the table covers 25/50/75/100; specifically remove the duplicate 75%
entry and add a new row like "100%" / "exhaustive" / "full" (or similar
synonyms) so the SKILL.md table entries "25%"/"50%"/"75%"/"100%" are unique and
consistent with Step 3.
---
Duplicate comments:
In `@skills/token-budget-advisor/SKILL.md`:
- Around line 32-33: Rename the "Workflow" header to "How It Works" and add an
explicit "Examples" section in SKILL.md to satisfy the skills markdown format
(ensure the file contains "When to Use", "How It Works", and "Examples"
headers); update any content under the current "Workflow" heading to remain
under the new "How It Works" header and create one or more short usage examples
under the new "Examples" header demonstrating typical inputs/output or expected
behavior so the document matches the required structure.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e5a653dd-c610-4dec-aad8-c1dcad27c114
📒 Files selected for processing (1)
skills/token-budget-advisor/SKILL.md
There was a problem hiding this comment.
♻️ Duplicate comments (2)
skills/token-budget-advisor/SKILL.md (2)
31-31:⚠️ Potential issue | 🟠 MajorRename "Workflow" to "How It Works" to satisfy skill documentation requirements.
The required section header is "How It Works", not "Workflow". Please update the header on Line 31.
As per coding guidelines: Skills must be formatted as Markdown files with clear sections including 'When to Use', 'How It Works', and 'Examples'
📝 Proposed fix
-## Workflow +## How It Works🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/token-budget-advisor/SKILL.md` at line 31, Rename the Markdown section header "Workflow" to "How It Works" in SKILL.md to comply with skill documentation requirements; locate the header currently reading "## Workflow" and replace it with "## How It Works" so the file contains the required 'When to Use', 'How It Works', and 'Examples' sections.
114-121:⚠️ Potential issue | 🟠 MajorAdd an "Examples" section to satisfy skill documentation requirements.
The file lacks the required "Examples" section. Please add concrete examples showing when this skill should and should not trigger.
As per coding guidelines: Skills must be formatted as Markdown files with clear sections including 'When to Use', 'How It Works', and 'Examples'
📋 Suggested Examples section to add after Line 121
## Examples ### Triggers - "How many tokens will your answer use?" - "Give me the tldr version" - "Respond at 50% depth" - "I want to control how much you write" - "Dame la versión corta" (Spanish: "Give me the short version") ### Does Not Trigger - "What is 2+2?" (trivially short answer) - Follow-up questions when user already chose a level earlier in the session🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/token-budget-advisor/SKILL.md` around lines 114 - 121, Add a new "## Examples" Markdown section into SKILL.md (place it after the existing "## Precision note" / before "## Source") that includes concrete "Triggers" and "Does Not Trigger" bullet lists: under "Triggers" add phrases like "How many tokens will your answer use?", "Give me the tldr version", "Respond at 50% depth", "I want to control how much you write", and a non-English example "Dame la versión corta"; under "Does Not Trigger" add examples like "What is 2+2?" and "Follow-up questions when user already chose a level earlier in the session". Ensure the new section title is exactly "## Examples" so it meets the required documentation headings alongside the existing "When to Use" and "How It Works" sections.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@skills/token-budget-advisor/SKILL.md`:
- Line 31: Rename the Markdown section header "Workflow" to "How It Works" in
SKILL.md to comply with skill documentation requirements; locate the header
currently reading "## Workflow" and replace it with "## How It Works" so the
file contains the required 'When to Use', 'How It Works', and 'Examples'
sections.
- Around line 114-121: Add a new "## Examples" Markdown section into SKILL.md
(place it after the existing "## Precision note" / before "## Source") that
includes concrete "Triggers" and "Does Not Trigger" bullet lists: under
"Triggers" add phrases like "How many tokens will your answer use?", "Give me
the tldr version", "Respond at 50% depth", "I want to control how much you
write", and a non-English example "Dame la versión corta"; under "Does Not
Trigger" add examples like "What is 2+2?" and "Follow-up questions when user
already chose a level earlier in the session". Ensure the new section title is
exactly "## Examples" so it meets the required documentation headings alongside
the existing "When to Use" and "How It Works" sections.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 75de320e-4160-494f-a148-56354a972dfa
📒 Files selected for processing (1)
skills/token-budget-advisor/SKILL.md
|
thanks, queued for review. |
|
Analysis Failed
Troubleshooting
Retry: |
Add skill: token-budget-advisor (TBA)
Summary
Adds a new community skill: Token Budget Advisor (TBA).
This skill intercepts the response flow to offer the user an informed choice about response depth — before Claude answers. The user sees estimated token counts for 4 depth levels and picks what they actually need.
What it does
Trigger keywords
tokens,token budget,profundidad,short version,tldr,brief,al 25%,exhaustive,quiero controlar cuánto usas, and any variant where the user wants to control depth/length.Design
Full version
The standalone TBA repo includes a Python estimator script for more precise token counts and an npx installer:
npx token-budget-advisorThe ECC skill is a self-contained version that works with no external dependencies.
Test plan
🤖 Generated with Claude Code
Summary by cubic
Add new community skill
token-budget-advisorthat pauses before answering so users pick response depth (25/50/75/100%) with token estimates. Triggers and estimation were hardened to improve accuracy and avoid false positives.skills/context-budgetguidance for estimates (prose: word_count×1.3; code/mixed: char_count/4) with complexity ranges; respects the model’s output-token limit; shows ~85–90% accuracy (±15%) note.manifests/install-modules.jsonand docs counters updated to 30 agents / 135 skills.Written for commit b7a82cf. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation