After the Codex promo ended and the real quotas kicked in I stared at my daily Codex burn limits faster.
So I found a system to reduce the amount of tokens I spend without effecting the speed.
One day: 245 million tokens
The next day after locking down my system: 28 million
Here’s exactly what I changed:
Step 1: Never Feed Raw Data, Always Pre-Compact It First
Codex doesn’t need your 40MB trade log massive JSON market dump or full repo every single turn. I now make it generate one-time helper scripts that create “needle maps”:
- compact_logs.py → filters by timestamp/symbol/keyword and spits out only top N anomalies
- summarize_data.py → extracts relevant columns, row counts, samples, and key stats
- repo_map.py → builds a clean overview of entry points, config, core flows (skipping venv, node_modules, builds, etc.)
Feed it 200-500 tokens of distilled insight instead of 10k+ of noise.
Build once, reuse forever.
Step 2: Aggressively Limit Every Command Output
Default output is lethal:
- git status
- ls -la
- cat file
- python script. py
can explode context instantly.
I now bake limits into every instruction:
1head -n 50, tail -n 50, grep "ERROR" | head -n 3023Write full results to temp files and only inspect ranges45Add --limit 100 flags everywhere
Step 3: Build a Living Handoff File (Your Project Brain)
Stop letting agents rediscover everything every session.
I keep a tight HANDOFF.md (under 1k tokens) that holds:
- Current goal + success metrics
- Key files & recent decisions
- Commands already run + outcomes
- Known issues and “do not re-read” list
- Next steps
End every session with: “Compact current findings into HANDOFF.md strip dead ends, keep only actionable facts.”
Step 4: Explicit “Do Not” Instructions Save Massive Tokens
Agents love to wander so I set hard walls:
- “Skip node_modules, .venv, dist, logs/archive, generated files and any cache dir”
- “Summarize before opening any new file”
- “Never paste full source unless I explicitly say so”
- “Only inspect files needed for this exact task”
Drop these into your AGENTS.md once and watch re-reads collapse.
Step 5: Demand Summaries, Diffs and Snippets
Bad prompt:
1Read this file and explain it.
Good prompt:
1Locate the risk engine’s position sizing logic. Show only that function + 3 lines above/below. Explain the edge case in one paragraph.
Or
1Build a 1-page repo map: entry points, config, main data flows and backtest commands. Skip vendor dirs.
Targeted asks = tiny context windows
Step 6: Make Codex Compact Its Own Context Periodically
Every 4-5 turns I drop:
1Summarize our progress into a tight handoff note. Remove repetitions and failed paths. Keep only what’s needed to continue.
Conversation stays lean even as it grows.
Step 7: Kill Verbosity by Default
1Be concise. Output only the patch + one-sentence reason. No restating the plan unless it changed. No fluff.
This one rule alone slashes output tokens hard.
Useful Commands & Helper Scripts I Deploy Daily
These are the exact one-liners and scripts I copy-paste or have Codex generate on day one of any project.
Core limiting commands I force on every tool call:
1# Safe file inspection2head -n 80 somefile.py | cat3tail -n 80 somefile.py | cat4grep -n "KEYWORD" file.py | head -n 4056# Git without the firehose7git status --porcelain | head -n 308git log --oneline -159git diff --name-only | head -n 201011# Data & logs (trading-specific)12tail -n 200 market_log.json | jq '.[-50:]' | head -n 10013python -c "import pandas as pd; df = pd.read_csv('trades.csv'); print(df.head(20).to_string())" | head -n 1501415# Write-then-inspect pattern16python analyze_backtest.py > temp_results.txt 2>&117head -c 8000 temp_results.txt # byte cap for safety
**
Helper scripts I always ask Codex to create first (then run them myself):**
- compact_logs.py → python compact_logs.py --symbol BTC --hours 24 > summary.txt
- repo_map.py → python repo_map.py > HANDOFF.md (updates the brain file)
- scan_errors.py → python scan_errors.py --limit 30 > errors.txt
- summarize_json.py → python summarize_json.py market_snapshot.json > needle.txt
One killer AGENTS.md rule I live by (byte-cap everything unknown):
1## Command Output Protection2Any command with unknown or potentially large output MUST be byte-capped.3Default: COMMAND 2>&1 | head -c 60004If more is needed, write to temp file and I will inspect ranges only.
Prompt template I reuse for data-heavy tasks:
1First run compact_logs.py or summarize_data.py to create a <500-token needle map. Then analyze only that. Never read the raw file directly.
These commands and scripts alone cut my daily burn by another 30-40% on top of the big workflow changes.
**My New Rule of Thumb
Don’t let Codex read raw data if a 50-line summary would suffice**
The helpers I built in the first week pay for themselves every single hour.
Token efficiency wasn't a model problem instead It’s a systems problem, just nail the context discipline and you’ll get 8-10x more done inside the same quota.
I also build www.RedLeads.app so I find users for the things I ship faster. Join me in speedrunning to $10k MRR by vibecoding cool systems and tools.
Thank You :)





