Skip to content

Claude Code Official Province Token Guide: 11 Tips to Make Your Balance Last

Aug 15, 14:04

According to Watchful Beating's monitoring, Anthropic has released the Claude Code Efficiency Token Guide. The key takeaway is: the longer the context, the more expensive each subsequent round. Chat, files, and command outputs will continue to consume tokens, causing the quota to deplete faster.

Summarized below are the 11 most practical tips:

1. Switch tasks using /clear. Clear the context after completing a task. If you are continuing the same task and the previous content is no longer needed, use /compact to compress. The longer the conversation, the more expensive it becomes as each round reintroduces the previous content.

2. Choose the model and effort at the beginning. Executing /model or /effort midway will flush the prompt cache, requiring the entire context to be reprocessed in the next round. The same applies to Fast mode; it is best to enable it at the start.

3. Before leaving, execute /compact. A subscriber's cache expires after about 1 hour, while the API Key cache defaults to about 5 minutes. Upon returning after the cache has expired, the next round usually requires a full reprocessing of the context. It is more cost-effective to compress while the cache is still active.

4. If the recent rounds deviate, use /rewind. It only removes the last few rounds, allowing the previous cache to remain usable. /compact will rewrite the entire conversation, incurring higher costs.

5. Directly reference files using @filename. Claude will receive the file directly in the first round, eliminating the need for a Read or search operation. Typically, a file only needs to be @ once; repeating @ may mistakenly include the same file again in the context.

6. Be specific in prompts. Rather than saying "the test failed," directly inform Claude which test and which file. Otherwise, Claude may need to first grep, search, and read multiple files, with these results continuing to occupy the context in each subsequent round.

7. Minimize test and log outputs. Outputs from build processes, tests, and git logs will persist in the context. You can add a quiet parameter to only output errors or use tail for truncation. Claude Code automatically writes command outputs exceeding 30,000 characters to a file, leaving only a summary and path in the session.

8. Use /context to check the initial overhead. At the start of a new session, you can see how much of the context CLAUDE.md, MCP, and tool definitions occupy. CLAUDE.md should only contain general rules, while specific processes should be placed in Skills loaded on demand, and unused MCPs should be disabled using /mcp.

9. For simple tasks, use smaller models and lower effort. Large model inputs and outputs are more expensive, and thinking also consumes output tokens. For purely execution-based tasks, there is no need to always use the highest-tier models and maximum inference intensity.

10. Delegate large logs to subagents, but avoid overusing them for small tasks. Subagents have independent contexts and only bring back the final results to the main session, making them suitable for reading extensive logs and document searches. However, they need to re-read files and run multiple rounds themselves, which could make small tasks more expensive. Tasks like searching and reading logs can also specify Haiku or Sonnet.

11. It is best to initiate /loop in a separate session. Each loop is a complete round, carrying all the context of the current session repeatedly. If the interval exceeds the cache time, an additional cache expiration may occur. It is recommended to open a new terminal according to official advice, dedicating a clean session specifically for running loops.

Anthropic's ultimate advice boils down to: avoid stuffing unnecessary content, promptly clear tasks, and avoid prolonging sessions.

Source