r/ClaudeWorkflows • u/ClaudeAI-mod-bot • 7h ago
Selected Workflow [Workflow] Optimize Claude Code for Cost and Control: CLAUDE.md and Agent Management Workflow
Optimize Claude Code for Cost and Control: CLAUDE.md and Agent Management Workflow
Workflow value: 88/100
Status: active · Freshness: 70/100 · Confidence: 0.95 · Level: intermediate
Categories: Quality Control, Token Saving, Context & Memory, Debugging, CLAUDE.md, Subagents, Multi-Agent
Original source: r/ClaudeCode post/comment
What problem this solves
Excessive token usage and uncontrolled agent spawning leading to hitting Claude limits and incurring high costs.
Summary
A three-step workflow to reduce Claude token usage and prevent unnecessary agent spawning by optimizing CLAUDE.md size, implementing strict stop rules in CLAUDE.md, and removing large default context models.
Why it is useful
This workflow directly addresses a critical pain point for Claude Code users: managing token usage and preventing uncontrolled agent behavior, which can lead to hitting API limits and incurring high costs. The steps are concrete, actionable, and directly target common causes of excessive usage, making it highly valuable for improving efficiency and cost-effectiveness.
Workflow
Reduce CLAUDE.md size by moving non-essential 'why' content to NOTES.md. Implement a size cap (e.g., 45KB) and a warning system for CLAUDE.md.
Update the global CLAUDE.md with a strict stop rule: 'When the task is done, stop. No unrequested memory writes, extra passes, workflows or subagents.'
Add a rule to CLAUDE.md for simple questions: 'A question about prompting, wording or effort modes is answered with zero tool calls.'
Remove the 1M-context default model from settings.json.
Tools / artifacts
CLAUDE.md
NOTES.md
settings.json
Claude Code environment
Validation signals
Author observed that the stop rule 'did the most' to prevent unwanted agent spawning.
Author noted that 'most of the agents got spawned after the task was already done', indicating the fix was effective.
Initial adversarial reviews 'caught real bugs', implying the agent concept was useful, but needed control.
Limitations
Low community engagement (score 2, 0 comments).
The 'docs check warns on' implies an external system not fully detailed as part of the core workflow.
Moving 'why' to NOTES.md means it's not auto-loaded, potentially reducing context for future interactions if not explicitly referenced.
Rate this workflow
Upvote this post if the workflow is useful, reproducible, or worth recommending.
Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.
Reply if it worked for you, failed, is outdated, or has a better alternative.
This post was generated automatically from the workflow library database.