Repository navigation
writing-plans: add output budget guardrails to avoid token overflow - #638
stablegenius49 wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThe write-plan skill documentation was updated to introduce explicit output budget guardrails, including conciseness targets, task caps, and phased outputs, alongside a templated plan header structure to guide more concise plan generation and mitigate token limit constraints. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
skills/writing-plans/SKILL.md (2)
33-33: Line count may not correlate well with token usage.Targeting "~120 lines max" as a proxy for token budget is imprecise. Token count depends on content density, code vs. prose, and language. A 120-line plan with dense code blocks or long variable names could still exceed token limits, while a 150-line plan with concise bullets might fit comfortably.
Consider alternative metrics such as estimating token count directly (many tokenizers are available) or providing more flexible guidance like "aim for concise plans; if a plan feels long, split into phases."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/writing-plans/SKILL.md` at line 33, Replace the hard "Keep plans concise: target **~120 lines max** (excluding blank lines/code fences)" guidance in SKILL.md with a more accurate, flexible instruction: remove the fixed line-count target and instead recommend estimating token usage (mentioning tokenizers or token-count checks) or advise phrasing like "aim for concise plans; split long plans into phases" and note that code density affects tokens; update the single-line guidance so it references token estimation and flexible splitting rather than a strict "~120 lines" limit.
57-98: Consider condensing the example to reduce documentation length.The Task Structure example is comprehensive (42 lines) and helpful, but it makes the skill documentation itself quite verbose. Given that the PR aims to reduce output verbosity, there's some irony in lengthening the documentation.
Consider:
- Condensing the example to show the structure without full code blocks, or
- Moving the detailed example to a separate
examples/directory and referencing it hereThis is a minor documentation quality concern and doesn't affect functionality.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/writing-plans/SKILL.md` around lines 57 - 98, Condense the "Task Structure" example in SKILL.md by replacing the full 42-line code blocks with a concise template showing the sections and placeholders (e.g., the "### Task N: [Component Name]" header and the five steps "Write failing test", "Run to fail", "Implement minimal code", "Run to pass", "Commit") and move the full expanded example into a new examples/ directory (e.g., examples/task-structure.md) with a reference link from SKILL.md; update the SKILL.md section to show only the compact template and a one-line pointer to the detailed example to reduce verbosity while preserving full documentation elsewhere.
🤖 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/writing-plans/SKILL.md`:
- Line 102: The phrase "avoid full-file dumps unless truly necessary" is vague;
update SKILL.md near the "Complete code in plan" wording to add explicit
criteria for when to include full-file implementations vs snippets—e.g., require
full code for new files or new functions, allow targeted executable snippets for
edits to existing well-understood files, and require that any snippet include
necessary context/usage and runnable commands so plans remain compatible with
the "Output Budget Guardrails" and executing-plans guidance. Ensure these
criteria are added as a short, concrete checklist so authors know when to
include complete files versus snippets.
- Around line 29-38: The "Output Budget Guardrails" guidance conflicts with the
executing-plans requirement to provide complete, runnable steps; update the
SKILL.md guardrails to explicitly state that for any plan intended for the
executing-plans skill (refer to the executing-plans rule "Follow plan steps
exactly"/"Don't skip verifications") every task step that the executor must run
must include complete, runnable code and verification commands, while short 5–15
line snippets are only allowed for illustrative/non-executable examples if
clearly labeled as "non-executable example" and never used in executing-plans
plans; ensure the new text names the "Output Budget Guardrails" section and the
executing-plans workflow so authors can determine which format to use.
---
Nitpick comments:
In `@skills/writing-plans/SKILL.md`:
- Line 33: Replace the hard "Keep plans concise: target **~120 lines max**
(excluding blank lines/code fences)" guidance in SKILL.md with a more accurate,
flexible instruction: remove the fixed line-count target and instead recommend
estimating token usage (mentioning tokenizers or token-count checks) or advise
phrasing like "aim for concise plans; split long plans into phases" and note
that code density affects tokens; update the single-line guidance so it
references token estimation and flexible splitting rather than a strict "~120
lines" limit.
- Around line 57-98: Condense the "Task Structure" example in SKILL.md by
replacing the full 42-line code blocks with a concise template showing the
sections and placeholders (e.g., the "### Task N: [Component Name]" header and
the five steps "Write failing test", "Run to fail", "Implement minimal code",
"Run to pass", "Commit") and move the full expanded example into a new examples/
directory (e.g., examples/task-structure.md) with a reference link from
SKILL.md; update the SKILL.md section to show only the compact template and a
one-line pointer to the detailed example to reduce verbosity while preserving
full documentation elsewhere.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: bc4e6e1a-68aa-40e0-8f61-693bc17efa7f
📒 Files selected for processing (1)
skills/writing-plans/SKILL.md
| ## Output Budget Guardrails | ||
|
|
||
| To avoid oversized responses and token overflows: | ||
|
|
||
| - Keep plans concise: target **~120 lines max** (excluding blank lines/code fences) | ||
| - Cap at **10 tasks per response** | ||
| - If work is larger, split into phases and only output **Phase 1** | ||
| - Prefer short, high-signal snippets (5-15 lines) instead of full-file dumps | ||
| - For repetitive tasks, provide one concrete example then reference the same pattern for remaining tasks | ||
|
|
There was a problem hiding this comment.
Potential conflict with executing-plans workflow.
The guardrails instruct authors to "prefer short, high-signal snippets (5-15 lines) instead of full-file dumps" and later (line 102) to "avoid full-file dumps unless truly necessary." However, the executing-plans skill requires plans to be followed exactly with complete, runnable code at each step. If plans contain only illustrative snippets rather than complete implementations, the executing-plans workflow may fail or require the executor to fill in missing details, defeating the purpose of a detailed plan.
Consider clarifying when full implementations are required versus when snippets suffice, or ensure snippets are always complete enough to execute without guesswork. As per the relevant code snippet from skills/executing-plans/SKILL.md:70-76, the executing-plans skill enforces "Follow plan steps exactly" and "Don't skip verifications."
💡 Suggested clarification
## Output Budget Guardrails
To avoid oversized responses and token overflows:
- Keep plans concise: target **~120 lines max** (excluding blank lines/code fences)
- Cap at **10 tasks per response**
- If work is larger, split into phases and only output **Phase 1**
-- Prefer short, high-signal snippets (5-15 lines) instead of full-file dumps
+- Prefer short, high-signal snippets (5-15 lines) instead of full-file dumps, but ensure snippets are complete enough to execute without guesswork
- For repetitive tasks, provide one concrete example then reference the same pattern for remaining tasks🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@skills/writing-plans/SKILL.md` around lines 29 - 38, The "Output Budget
Guardrails" guidance conflicts with the executing-plans requirement to provide
complete, runnable steps; update the SKILL.md guardrails to explicitly state
that for any plan intended for the executing-plans skill (refer to the
executing-plans rule "Follow plan steps exactly"/"Don't skip verifications")
every task step that the executor must run must include complete, runnable code
and verification commands, while short 5–15 line snippets are only allowed for
illustrative/non-executable examples if clearly labeled as "non-executable
example" and never used in executing-plans plans; ensure the new text names the
"Output Budget Guardrails" section and the executing-plans workflow so authors
can determine which format to use.
| ## Remember | ||
| - Exact file paths always | ||
| - Complete code in plan (not "add validation") | ||
| - Include concrete snippets and commands, but avoid full-file dumps unless truly necessary |
There was a problem hiding this comment.
Clarify when full-file dumps are "truly necessary."
The change from "Complete code in plan" to "avoid full-file dumps unless truly necessary" shifts the guidance significantly. The phrase "unless truly necessary" is vague and could lead to inconsistent plan quality.
Consider providing clear criteria for when full implementations are required. For example:
- Always include complete code for new files/functions
- Use snippets only for modifications to existing, well-understood code
- Ensure any snippet can be executed or applied without additional context
This reinforces the conflict flagged in the Output Budget Guardrails section regarding compatibility with executing-plans.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@skills/writing-plans/SKILL.md` at line 102, The phrase "avoid full-file dumps
unless truly necessary" is vague; update SKILL.md near the "Complete code in
plan" wording to add explicit criteria for when to include full-file
implementations vs snippets—e.g., require full code for new files or new
functions, allow targeted executable snippets for edits to existing
well-understood files, and require that any snippet include necessary
context/usage and runnable commands so plans remain compatible with the "Output
Budget Guardrails" and executing-plans guidance. Ensure these criteria are added
as a short, concrete checklist so authors know when to include complete files
versus snippets.
…low (obra#638) Add 120-line max, 10-task cap, phased planning for larger work, and prefer concrete snippets over full-file dumps. Upstream PR: obra#638 Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Hi, This change does not look like a good fit for superpowers |
Summary\n- add an
Output Budget Guardrailssection to thewriting-plansskill\n- cap generated plans to a concise size (task count + line budget)\n- instruct phased planning for large scopes and avoid full-file dumps\n\n## Why\nIssue #227 reportswrite-planresponses frequently exceeding Claude Code output limits. These guardrails keep plans actionable while reducing oversized responses.\n\n## Validation\n- ran markdown sanity check forskills/writing-plans/SKILL.mdfront matter and section presence\n- rangit diff --check\n\nCloses #227