Skip to content

writing-plans: add output budget guardrails to avoid token overflow - #638

Closed
stablegenius49 wants to merge 1 commit into
obra:mainfrom
stablegenius49:pr-factory/issue-227-write-plan-token-guard
Closed

stablegenius49 wants to merge 1 commit into
obra:mainfrom
stablegenius49:pr-factory/issue-227-write-plan-token-guard

Conversation

@stablegenius49

Copy link
Copy Markdown
Contributor

Summary\n- add an Output Budget Guardrails section to the writing-plans skill\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 reports write-plan responses frequently exceeding Claude Code output limits. These guardrails keep plans actionable while reducing oversized responses.\n\n## Validation\n- ran markdown sanity check for skills/writing-plans/SKILL.md front matter and section presence\n- ran git diff --check\n\nCloses #227

@coderabbitai

coderabbitai Bot commented Mar 6, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Write-Plan Skill Documentation
skills/writing-plans/SKILL.md
Added "Output Budget Guardrails" section with conciseness targets and task sizing guidance; introduced templated "Plan Document Header" with structured format example; updated Remember section to emphasize concrete snippets while avoiding full-file dumps.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 With token limits conquered, clear and lean,
Our plans now sparkle, crisp and keen,
Guardrails guide each snippet small,
No more walls—just wisdom's call!
Concise and bright, we hop along, ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding output budget guardrails to the writing-plans skill to prevent token overflow issues.
Description check ✅ Passed The description is directly related to the changeset, explaining the new Output Budget Guardrails section and its purpose in addressing token overflow issues.
Linked Issues check ✅ Passed The PR directly addresses Issue #227 by adding output budget guardrails to constrain plan size, preventing responses from exceeding the 32,000 token limit mentioned in the issue.
Out of Scope Changes check ✅ Passed All changes are focused on the writing-plans skill documentation and directly relate to the stated objective of preventing token overflow by adding guardrails and guidance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 here

This 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

📥 Commits

Reviewing files that changed from the base of the PR and between e4a2375 and b85e192.

📒 Files selected for processing (1)
  • skills/writing-plans/SKILL.md

Comment on lines +29 to +38
## 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

IgorTavcar added a commit to IgorTavcar/superpowers that referenced this pull request Mar 9, 2026
…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]>
@obra

obra commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Hi,

This change does not look like a good fit for superpowers

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.

2 participants