Skip to content

[FEATURE] Per-workflow cost surfacing, historical trends, and configurable budget warnings #189

@JoshLuedeman

Description

@JoshLuedeman

Problem It Solves

Closes gap: #176

Cost data is collected (LogWithCost() in internal/metrics/metrics.go) but never surfaced in any CLI output. Teams have no visibility into what their workflows cost, which types are most expensive, or whether they are approaching a spending limit.

Proposed Behavior

teamwork metrics summary gains cost section

Cost Summary (last 30 days)
  Total:              $47.23
  This week:          $12.80
  7-day trend:        ↑ 18% vs prior week

  By workflow type:
    feature            $28.41  (60%)   avg $2.03/workflow
    hotfix             $9.18   (19%)   avg $4.59/workflow  ← expensive
    bugfix             $6.12   (13%)   avg $0.87/workflow
    release            $3.52   (7%)    avg $3.52/workflow

  By role:
    coder              $18.20  (39%)
    architect          $10.44  (22%)
    tester             $8.91   (19%)

teamwork start shows cost estimate

$ teamwork start feature
Starting feature workflow...
Estimated cost: $1.50–$3.20 (based on 14 prior feature workflows, median: $2.03)
✓ Workflow wf-043 started.

Budget configuration in config.yaml

cost:
  monthly_budget_usd: 50.00
  warn_at_percent: 80        # warn when 80% consumed
  block_at_percent: 100      # prompt for confirmation at 100%

When the warning threshold is hit, teamwork start prepends:

⚠️  Budget warning: $41.20 of $50.00 monthly budget consumed (82%).

When the block threshold is hit, teamwork start requires --override-budget to proceed.

New teamwork metrics cost command

teamwork metrics cost --since 7d --by workflow-type
teamwork metrics cost --workflow wf-042   # cost breakdown for a single workflow

Dependencies

  • internal/metrics/metrics.go Summary struct gains cost aggregations by type and role
  • teamwork start reads historical metrics to compute estimate range
  • Config schema gains cost section (internal/config/config.go)
  • Budget check runs in teamwork start before state file creation

Complexity Estimate

Medium — 4 files: metrics cost aggregation, config schema, start command budget check, new metrics cost command, tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeature-requestA new capability proposed through forward-looking design or gap analysis

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions