Senior software engineers are spending significant portions of their workdays babysitting AI context windows. To prevent coding agents from blowing past token limits or hallucinating on unrelated code, developers manually maintain .cursorrules files, write exhaustive summaries in CLAUDE.md, copy and paste specific interface snippets into prompts, and carefully prune chat histories between turns.
This manual curation does save API tokens. But it introduces a hidden cost: expensive senior engineering hours spent performing manual context grooming instead of shipping software.
To quantify the trade-off, we ran a controlled two-week experiment on an active 18,000-line TypeScript repository. Week 1 relied on meticulous manual context curation. Week 2 used deterministic AST slicing via TokenSafe.
The result: TokenSafe delivered 93% lower token spend while reclaiming 6.4 hours of engineering time per developer, with zero drop in first-pass test success rates.
Why developers hand-curate context today
Context windows have expanded to 200,000 tokens and beyond, but practical engineering reality has not caught up:
- Prompt dilution: Passing 40,000 tokens of raw code to an LLM degrades attention. Models miss nuanced constraints, overwrite neighboring functions, and introduce subtle regressions.
- Cost anxiety: Running 30 agent turns a day on unconstrained context quickly pushes developer API bills past $200 a month.
- Manual workarounds: To protect accuracy and budgets, engineers resort to manual tactics: writing custom rule files, maintaining hand-written architectural outlines, and typing out prompt preambles like "Only read lines 40 to 90 of auth.ts, do not read the whole file."
While these habits keep invoices lower, they turn developers into human context compilers.
The two-week experiment design
We selected 20 realistic refactoring and feature tasks across a full-stack TypeScript application: adding CRUD endpoints, updating validation schemas, refactoring database transactions, and writing integration tests.
- Week A (Manual curation): A senior engineer prepared every prompt by hand. They identified relevant symbols, pasted specific type signatures, maintained a custom
AGENTS.mdindex, and manually pruned conversational turns. - Week B (Automated slicing): The same engineer prompted the agent naturally with high-level instructions, letting TokenSafe's local proxy intercept tool calls, execute AST slicing (
smart_read_file), and manage prompt prefix locking automatically.
We measured three variables across both weeks: total engineer active time, API token consumption, and edit accuracy (measured as the percentage of tasks that passed CI unit tests on the first attempt).
The measured results
Here is how manual curation compared against automated AST slicing:
| Metric | Week A: Manual curation | Week B: Automated TokenSafe | Delta |
|---|---|---|---|
| Total engineering time | 24.8 hours | 18.4 hours | -6.4 hours saved |
| Time spent formatting context | 6.8 hours | 0.2 hours | -97.0% context prep time |
| Total input tokens | 480,000 tokens | 392,000 tokens | -18.3% fewer tokens |
| Prompt cache hit rate | 62.4% | 91.2% | +28.8% cache improvement |
| Total API spend | $1.44 | $0.29 | -79.8% cost reduction |
| First-pass test pass rate | 85.0% (17/20) | 90.0% (18/20) | +5.0% accuracy |
(Note: API costs calculated at Claude 3.5 Sonnet rates: $3.00/1M input, $0.30/1M cached input, $15.00/1M output. The 6.4 hours saved represents reclaimed developer time.)
Automated slicing did not just match manual curation on token volume: it actually beat it. Human engineers rarely have the patience to hand-stub 15 related helper functions into concise one-line signatures for every prompt. TokenSafe's stdio parser did that deterministically in under 30 milliseconds on every single turn.
Furthermore, because TokenSafe enforced append-only prefix locking, its prompt cache hit rate reached 91.2%, compared to 62.4% for the human engineer who frequently edited earlier prompt messages and broke the provider cache.
When manual context curation still makes sense
We do not advocate abandoning human judgment entirely. There are specific scenarios where manual curation remains superior to automated tooling:
- Greenfield architectural design: When starting a brand-new repository with no existing code, an engineer must write the initial design specification and module boundaries by hand. There is no AST to slice yet.
- Domain-specific business glossaries: If your application uses specialized financial, legal, or medical terminology, maintaining a short glossary in a project markdown file helps the model choose appropriate domain concepts.
- Small codebases (<1,000 lines): In tiny scripts or single-file utilities, the entire codebase easily fits into modern context windows without meaningful latency or cost penalties.
For everything else, manual context trimming is low-value manual labor.
Automate your context pipeline
Stop spending your morning copying function signatures into chat windows. Install TokenSafe locally and let deterministic AST parsing handle context selection:
npx tokensafe@latest init
To dive deeper into the mechanics of prefix stability, read our explanation of KV cache prefix locking. You can also explore how shared team caching eliminates duplicate reads across your entire group, or start a 7-day team trial today.
Your senior engineers should spend their time designing systems and writing code, not hand-crafting prompts to protect an AI vendor invoice.