Video summary
Incolla Questo su Claude Code e Non Finirai MAI Più i Token
Main summary
Key takeaways
Video topic
How to drastically reduce “Claude Code” token usage using a structured set of tactics (10 steps), with emphasis on:
- measuring context usage
- avoiding common “token-saving” myths
- understanding trade-offs (e.g., quality vs. cost)
Core measurement / monitoring (must-do before optimizing)
Use Claude Code’s built-in usage/context indicators:
/usage- The status line / context occupancy display
These show:
- how much of the context window is used
- where the consumption comes from (which “skills” / components)
Hidden cost to watch
Starting a new chat still shows non-zero usage due to:
- memory/system prompt
- loaded MCP servers consuming context even if unused
Practical usage guideline
- Keep usage in a typical range (speaker suggests ~3–6%)
- If you start around ~20%, that may indicate waste
Status line customization
In the terminal, customize the status line to display context usage, session limit, and weekly limit.
Quick “do it today” techniques (high impact, low complexity)
-
/clearon every task switch- Reset conversation history rather than mixing unrelated tasks.
- Demonstrated that switching tasks without clearing increases context usage.
-
Choose model + effort only once (at chat start)
- Changing model/effort mid-conversation forces the agent to effectively reprocess context for the new configuration, increasing token use.
-
Avoid “
/compact” (summarization) as a default- The speaker argues it’s common but expensive:
- it can consume many tokens
- it may remove information you still need
- you lose control over what gets summarized
- Suggested alternative:
rewind
- The speaker argues it’s common but expensive:
-
Use
rewindinstead ofcompact- Rewinds the conversation “tape” to a prior point (speaker’s claim: without consuming tokens).
- Lets you change direction while reusing earlier state efficiently.
-
Use “handoff files” when you truly need continuity
- A controlled summary you define (goal, what was tried, problems, decisions, files touched, where to go next).
- Intended to avoid giving summarization freedom to Claude (i.e., less “ball is in Claude’s court” behavior).
Planning/iteration features to save tokens during creation
- Use ASCII/preview diagrams before generating UI/graphics
- Build lightweight diagrams first (low token cost) to validate structure and styling choices.
- Reduces wasted generation when the first “real” output style is wrong.
Example uses include:
- generating whiteboard previews
- previewing e-commerce page layouts (hero, nav, product sections, bag/mobile variants)
“Do it once” setup optimizations (ongoing savings)
-
Disable unused MCPs
- Deleting MCP servers you don’t use reduces baseline context consumption.
-
Treat
cloud.mdas an “index” (keep it short)cloud.mdis read repeatedly; if it’s large, it adds large token overhead each turn.- Rule of thumb (from Anthropic docs mentioned by the speaker): keep
cloud.mdunder ~200 lines, structured like an index.
-
Use
cloud.mdper folder (nested indexing)- Inspired by Andrew Karpathy’s “second brain” ideas:
- keep a small global
cloud.md - load detailed folder prompts only when relevant
- keep a small global
- Inspired by Andrew Karpathy’s “second brain” ideas:
-
Archive unused skills and shorten descriptions
- Unused skills can still load and consume context when summoned broadly (e.g., via tool loading).
- Shortened skill descriptions reduce token overhead.
-
Reduce PDF ingestion cost via hooks (extract text deterministically)
- Claim: processing each PDF page can cost ~1500–3000 tokens/page.
- Speaker built a deterministic hook/rule:
- triggers when a PDF is loaded
- runs a script to extract text
- avoids reading the full PDF content
- Reported savings from tests:
- ~500–600k tokens vs. ~150k tokens on a large PDF (about 3–4× savings)
Model selection + workflow fit (quality/cost trade-offs)
-
Use frontier models for complex coding; use cheaper ones for routine tasks
- Speaker suggests using top-tier models for production-grade, complex software to reduce rework.
- For agent workflows (skills/routines/tools/browser actions), IQ/Sonnet may be sufficient.
-
Scheduled task audit
- Review background routines/sub-agents that may quietly burn token budgets.
- Optimize by:
- removing ineffective tasks
- switching to more economical models
Explicit “don’ts” / myths called out
- Don’t use
/compact(called out as most expensive). - Don’t screenshot text when you can paste it (scripts can extract text instead, and that’s token-light/near-zero).
- Avoid uploading raw PDFs when you only need text (use the extraction hook).
- Be skeptical of tools promising ~90% token savings
- Speaker tested Caveman/RTK-like tools and claims:
- they often skip information
- quality degrades
- savings aren’t predictable
- Speaker tested Caveman/RTK-like tools and claims:
Architecture: CLI vs MCP (major efficiency concept)
MCPs can be expensive because they:
- bundle many API methods
- may include large human-readable responses that bloat context
Prefer CLI-style tools/commands (referred to as “CLI/CLIs” in the video, and a “CLE” concept is mentioned):
- CLI calls are more minimal—avoid loading everything at startup.
Quantitative example (speaker’s claim)
- MCP for a tool: ~26,000 tokens baseline
- CLI: ~40 tokens plus a small
cloud.mdreference
Retrieval efficiency: graph tools
Recommended approaches depending on content type:
- Code Graph: best for code repositories (optimized for code)
- Graphify: best for “brain-like” knowledge (PDFs/images/markdown/Obsidian outputs converted into graph)
Warning: for fewer than ~500 files, building graphs may cost more than it saves.
Convert AI work into deterministic code whenever possible
Core principle
- Tokens are “paid” for AI reasoning
- Scripts consume near-zero tokens and run deterministically
Strategy
- audit workflows to identify portions that can become scripts
- implement them as deterministic hooks (triggered by events like file upload)
- reduce repeated prompt execution
Speaker frames this as “repeatable execution is code” (attributed to a CTO of ClickUp).
Sub-agents (use sparingly)
Sub-agents may look efficient due to small visible outputs, but each can include:
- its own system prompt
- its own memory/tool permissions
- additional context overhead
Recommendation:
- use sub-agents for bulk actions requiring independent reads/analysis (e.g., many files/sources)
- otherwise avoid due to hidden overhead
Product/company framing (minor, but present)
The speaker describes Mart:
- trains teams on practical AI tools including “Claude Code,” “Cloud Cowork,” “Codex”
- then acts as a strategic partner building customized AI solutions
- offers coaching/implementation + process analysis
Main speakers / sources
- Main speaker: video author (software engineer; founder/operator of Mart)
- Referenced external sources/people:
- Anthropic documentation (keeping
cloud.mdunder ~200 lines) - Andrej/Andrew Karpathy (nested indexing / “second brain” inspiration)
- CTO of ClickUp (guideline about implementing logic in code)
- Anthropic documentation (keeping