Reduce token usage while maintaining quality through project setup, model selection, and workflow optimization.
Token usage isn’t just about cost—it’s about feedback loop speed and context window limits. This guide shows you how to get more done with fewer tokens through project optimization, smart model selection, and workflow patterns.
Using Factory App? These strategies apply to both CLI and Factory App. You can view your project’s readiness score in the Agent Readiness Dashboard.
Slow or flaky tests are the #1 cause of wasted tokens. Each retry costs a full response cycle.
Test Characteristic
Impact on Tokens
Fast tests (< 30s)
Droid verifies changes immediately
Slow tests (> 2min)
Droid may skip verification or waste context waiting
Flaky tests
False failures cause debugging cycles
No tests
Droid can’t verify changes, more back-and-forth
Action items:
Copy
## In your AGENTS.md## Testing- Run single file: `npm test -- path/to/file.test.ts`- Run fast smoke tests: `npm test -- --testPathPattern=smoke`- Full suite takes ~3 minutes, use `--bail` for early exit on failure
When Droid can catch errors immediately, it fixes them in the same turn instead of waiting for you to report them.
Copy
## In your AGENTS.md## Validation Commands- Lint (auto-fix): `npm run lint:fix`- Type check: `npm run typecheck`- Full validation: `npm run validate` (lint + typecheck + test)Always run `npm run lint:fix` after making changes.
Document your file organization so Droid doesn’t waste tokens exploring:
Copy
## In your AGENTS.md## Project Structure- `src/components/` - React components (one per file)- `src/hooks/` - Custom React hooks- `src/services/` - API and business logic- `src/types/` - TypeScript type definitions- `tests/` - Test files mirror src/ structureWhen adding a new component:1. Create component in `src/components/ComponentName/`2. Add index.ts for exports3. Add ComponentName.test.tsx in same directory
Use Specification Mode (Shift+Tab or /spec) to plan before implementing.Without Spec Mode:
Copy
Turn 1: Start implementing → wrong approach → wasted tokensTurn 2: Undo and try different approach → more tokensTurn 3: Finally get it rightTotal: 3 turns of implementation tokens
With Spec Mode:
Copy
Turn 1: Plan with exploration → correct approach identifiedTurn 2: Implement correctlyTotal: 1 turn of planning + 1 turn of implementation
Use Spec Mode (Shift+Tab or /spec) for any task that:
Turn 1: "Add logging to userService"Turn 2: "Add logging to orderService"Turn 3: "Add logging to paymentService"(3 turns, context rebuilt each time)
Efficient:
Copy
Turn 1: "Add structured logging to all services in src/services/. Use the pattern from src/lib/logger.ts. Services: user, order, payment."(1 turn, pattern established once)
1. Set up your project └─ AGENTS.md with commands └─ Fast tests └─ Linting configured └─ IDE plugin installed2. Start each task right └─ Use Spec Mode for complex work └─ Be specific about the goal └─ Reference existing patterns3. Choose the right model └─ Simple → Haiku/Droid Core └─ Standard → Codex/Sonnet └─ Complex → Opus (with reasoning)4. Monitor and adjust └─ Check /cost periodically └─ Identify expensive patterns └─ Refine your approach