Skip to content

Optimize feature loop: reduce token usage and improve speed #145

@federiconeri

Description

@federiconeri

Overview

The feature loop runs 13+ claude -p sessions per feature. Each session starts fresh, re-sends full prompt templates, and causes Claude to re-read the same @file references. This results in high cached token volume, unnecessary wall-clock time, and elevated API costs.

Current Baseline (per feature loop)

Metric Value
Total duration ~30-40 min
Claude sessions ~13
Total cost ~$12.40
Cached token volume ~3.1M (73% of total)

Expected After Optimization

Metric Value Improvement
Total duration ~24-32 min ~6-8 min faster (20%)
Claude sessions ~8-9 4-5 fewer sessions
Total cost ~$8-9 ~$3.50-4.50 saved (28-36%)
Cached token volume ~2.0-2.3M ~30-35% reduction

Sub-issues (ordered by impact)

P1 — High Impact

P2 — Medium Impact

P3 — Lower Impact (prompt trimming & small fixes)

Savings Breakdown

Optimization Cost Saved Time Saved
--resume for implementation loop ~$2.00 ~1.5 min
Merge verification into review ~$1.80 ~1.5 min
--resume for E2E/review loops ~$0.80 ~1 min
Targeted E2E fix prompt ~$0.50 ~45s
Trim PROMPT_e2e.md ~$0.10
Trim PROMPT_feature.md ~$0.10
Trim PROMPT.md + review prompts ~$0.20
Loop inefficiencies (sleep, config, tests) ~30s
Total ~$3.50-4.50 ~6-8 min

Over 10 features: ~$35-45 saved and ~1 hour less wall-clock time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement to existing featureperformancePerformance optimization

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions