<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1" -->

---
title: How to reduce token usage in Claude Code, Codex, and Cursor
description: An analysis of 1,674 AI coding agent sessions across Claude Code, Codex, and Cursor found that 94.2% of tokens were cache reads (re-sent context) while agent...
canonical: https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to reduce token usage in Claude Code, Codex, and Cursor | daily.dev
og:description: An analysis of 1,674 AI coding agent sessions across Claude Code, Codex, and Cursor found that 94.2% of tokens were cache reads (re-sent context) while agent...
og:url: https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1
og:image: https://api.daily.dev/og/posts/SIHx6zqU1.png
og:image:alt: How to reduce token usage in Claude Code, Codex, and Cursor
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to reduce token usage in Claude Code, Codex, and Cursor

**[SwiftLee](https://daily.dev/sources/avanderlee)** · 16 min read · 0 upvotes · 0 comments

## Summary

An analysis of 1,674 AI coding agent sessions across Claude Code, Codex, and Cursor found that 94.2% of tokens were cache reads (re-sent context) while agent replies made up only 0.6%. The biggest waste came from unfiltered xcodebuild/swift test output, full-file re-reads, duplicate skill loads, and subagents inheriting the main model unnecessarily. A global hook script that pipes raw xcodebuild output through the xcsift tool, plus 10 globally-applied agent rules (search before reading, narrow tests first, single-command waits, accessibility tree over screenshots, scoped skills, small models for subagents, check-before-coding, concise replies, stop after two failed attempts, delegate to subagents), are presented as fixes. Also discusses trimming AGENTS.md files, avoiding duplicate Agent Skills, and evaluates community projects Caveman and Ponytail.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.avanderlee.com/ai-development/reduce-token-usage-claude-code-codex-cursor>

## Questions this post answers

### How can I reduce token usage from xcodebuild output when using an AI coding agent?

Pipe xcodebuild output through the xcsift command-line tool, e.g. `xcodebuild test ... 2>&1 | xcsift -f toon -w`, which parses the output into a compact summary keeping errors, warnings, and test results while dropping the rest. One measured clean test run of a Mac app went from about 406,500 estimated tokens to about 168 tokens. Installing it via Homebrew and wiring it into a global pre-tool-use hook applies the filter automatically across every project.

_daily.dev surfaces practical fixes like this for developers tuning agent context costs across projects._

### What percentage of AI coding agent token usage comes from cache reads versus actual replies?

In an analysis of 1,674 agent sessions across Claude Code, Codex, and Cursor, 94.2% of all tokens were cache reads—context being re-sent with every step—while output tokens (the agent's actual replies) accounted for only 0.6%. This means optimizing reply length has minimal impact; the real savings come from reducing what gets re-read, such as full files, build logs, and duplicate skill loads.

_developers weighing where to focus token-saving efforts can track findings like this on daily.dev._

### Does using a cheaper AI model actually reduce total token usage in coding agents?

Not necessarily. A cheaper model can end up using more tokens overall if it needs extra attempts to fix an issue, since every step re-sends the full context—so a model needing three attempts re-reads that context three times. Cheaper models also often have smaller context windows, causing more frequent summarization and resets, which forces re-reading files and rules again, further increasing total usage.

_anyone deciding between agent models for cost versus reliability can follow this kind of tradeoff analysis on daily.dev._

## Similar posts on daily.dev

- [7 ways I make Claude Code use fewer tokens without hurting the results](https://daily.dev/posts/7-ways-i-make-claude-code-use-fewer-tokens-without-hurting-the-results-s1mmfwq7r) · XDA Developers · 1 upvotes · 0 comments
- [Audit your Agent files](https://daily.dev/posts/audit-your-agent-files-5pwynuy9w) · Addy Osmani · 9 upvotes · 0 comments
- [Maximize AI Efficiency: Reduce Token Use in Claude Pro](https://daily.dev/posts/maximize-ai-efficiency-reduce-token-use-in-claude-pro-vwm1wdmka) · Sergio Lema · 1 upvotes · 0 comments
- [AGENTS.md Optimization: Context Linting for Coding Agents](https://daily.dev/posts/agents-md-optimization-context-linting-for-coding-agents-mb705ug5n) · SitePoint · 1 upvotes · 0 comments

---

Tags: [#claude-code](https://daily.dev/tags/claude-code), [#openai-codex](https://daily.dev/tags/openai-codex), [#context-engineering](https://daily.dev/tags/context-engineering)

[View this post on daily.dev](https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to reduce token usage in Claude Code, Codex, and Cursor","url":"https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1"},"datePublished":"2026-09-28T12:53:20.868Z","dateModified":"2026-09-29T09:44:12.349Z","description":"An analysis of 1,674 AI coding agent sessions across Claude Code, Codex, and Cursor found that 94.2% of tokens were cache reads (re-sent context) while agent...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/97785b599f5ad041cf6bbb14a90835a7?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/97785b599f5ad041cf6bbb14a90835a7?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"SwiftLee","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SwiftLee","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/407bdbf78c69402985a468cb336a76ae","url":"https://daily.dev/sources/avanderlee"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"claude-code,openai-codex,context-engineering","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SwiftLee","item":"https://daily.dev/sources/avanderlee"},{"@type":"ListItem","position":3,"name":"How to reduce token usage in Claude Code, Codex, and Cursor"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-reduce-token-usage-in-claude-code-codex-and-cursor-sihx6zqu1#faq","mainEntity":[{"@type":"Question","name":"How can I reduce token usage from xcodebuild output when using an AI coding agent?","acceptedAnswer":{"@type":"Answer","text":"Pipe xcodebuild output through the xcsift command-line tool, e.g. `xcodebuild test ... 2\u003e\u00261 | xcsift -f toon -w`, which parses the output into a compact summary keeping errors, warnings, and test results while dropping the rest. One measured clean test run of a Mac app went from about 406,500 estimated tokens to about 168 tokens. Installing it via Homebrew and wiring it into a global pre-tool-use hook applies the filter automatically across every project. daily.dev surfaces practical fixes like this for developers tuning agent context costs across projects."}},{"@type":"Question","name":"What percentage of AI coding agent token usage comes from cache reads versus actual replies?","acceptedAnswer":{"@type":"Answer","text":"In an analysis of 1,674 agent sessions across Claude Code, Codex, and Cursor, 94.2% of all tokens were cache reads—context being re-sent with every step—while output tokens (the agent's actual replies) accounted for only 0.6%. This means optimizing reply length has minimal impact; the real savings come from reducing what gets re-read, such as full files, build logs, and duplicate skill loads. developers weighing where to focus token-saving efforts can track findings like this on daily.dev."}},{"@type":"Question","name":"Does using a cheaper AI model actually reduce total token usage in coding agents?","acceptedAnswer":{"@type":"Answer","text":"Not necessarily. A cheaper model can end up using more tokens overall if it needs extra attempts to fix an issue, since every step re-sends the full context—so a model needing three attempts re-reads that context three times. Cheaper models also often have smaller context windows, causing more frequent summarization and resets, which forces re-reading files and rules again, further increasing total usage. anyone deciding between agent models for cost versus reliability can follow this kind of tradeoff analysis on daily.dev."}}]}
```

