Strategic Improvement
Cost intelligence exists but lacks issue-granular tracking. Build a system that attributes token usage and cost to individual issues, stages, and repos, then surfaces optimization opportunities like "refactor issues cost 3x more than bugfix issues" or "review stage costs $2/issue, consider Haiku routing". Enables data-driven cost optimization decisions and feeds the model router (#382).
Acceptance Criteria
- Extend sw-cost.sh to track cost per issue ID, per pipeline stage, per repo
- Store in ~/.shipwright/cost-attribution.json with issue/stage/repo/model breakdown
- Dashboard command (shipwright cost breakdown) showing cost by dimension
- Identify cost outliers: issues or stages >2 standard deviations above mean
- Automated recommendations: suggest model routing changes for expensive stages
- Historical trends: cost per issue over last 30 days with trend line
- Integration with budget system: alert when issue type approaches budget limit
Context
- Priority: P3
- Complexity: standard
- Generated by: Strategic Intelligence Agent
- Strategy alignment: P3: Cost Efficiency & P4: Observability
Strategic Improvement
Cost intelligence exists but lacks issue-granular tracking. Build a system that attributes token usage and cost to individual issues, stages, and repos, then surfaces optimization opportunities like "refactor issues cost 3x more than bugfix issues" or "review stage costs $2/issue, consider Haiku routing". Enables data-driven cost optimization decisions and feeds the model router (#382).
Acceptance Criteria
Context