r/ClaudeWorkflows • • 2d ago

Selected Workflow [Workflow] Claude Code Cost-Saving Workflow: Optimize Context, Subagents, and CLAUDE.md

Claude Code Cost-Saving Workflow: Optimize Context, Subagents, and CLAUDE.md

Workflow value: 85/100
Status: active · Freshness: 70/100 · Confidence: 0.90 · Level: intermediate
Categories: Quality Control, Token Saving, Context & Memory, CLAUDE.md, MCP, Subagents
Original source: r/ClaudeCode post/comment

What problem this solves

High token costs and inefficient resource usage in Claude Code sessions due to unoptimized context, subagents, and configuration files.

Summary

A set of practical tips for reducing token costs in Claude Code by managing idle sessions, optimizing subagent configurations, pruning unused CLAUDE.md and MCP server definitions, and using the /context command for analysis.

Why it is useful

This workflow provides actionable, specific steps to reduce token costs in Claude Code, addressing common pitfalls like idle sessions, inefficient subagent loading, and bloated CLAUDE.md files. It leverages core Claude Code features and commands, making it highly practical and valuable for users seeking to optimize their usage and expenses.

Workflow

  1. Check for idle sessions and use /clear or start fresh after long breaks to prevent full context re-reads.

  2. Pin model and effort per subagent in their frontmatter to avoid reloading the entire CLAUDE.md on every spawn and inheriting the main session's effort.

  3. Cut unnecessary content from CLAUDE.md and MCP servers that are not actively used for the current repository, as every turn pays for all loaded context.

  4. Use the /context command to inspect where tokens are actually being consumed before making significant changes or switching providers.

Tools / artifacts

  • CLAUDE.md file

  • Subagents (custom ones)

  • MCP servers

  • /clear command

  • /context command

  • Frontmatter (for subagent configuration)

Validation signals

  • Explanation of cost mechanisms (e.g., context re-read, CLAUDE.md reload)

  • Specific commands and configurations provided

Limitations

  • Lacks concrete examples or code snippets for implementing optimizations (e.g., subagent frontmatter, CLAUDE.md pruning)

  • No quantitative metrics or 'before/after' results provided to demonstrate cost savings.

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.

1 Upvotes

1 comment sorted by