Commit Graph

5 Commits

  • fix(cost-tracker): prefer harness cost.total_cost_usd when statusline writes it
    The transcript-sum estimate diverges from the harness's API-billed cost on
    long sessions and after --resume:
    - the hard-coded rate table cannot represent Opus 4.7's >200K-token 2x tier
      or the 1h-cache 2x tier (under-counts);
    - summing the full transcript double-counts work across --resume boundaries
      while cost.total_cost_usd is per-process.
    
    Both made the bridge file overshoot real cost by 4-5x, which tripped
    ecc-context-monitor's $50 "critical" threshold and made agents halt
    prematurely (observed: $73.99 hook value at $15.61 real harness cost).
    
    This change adds an opt-in contract: if a statusline writes
    {ts, cost_usd} to <tmpdir>/harness-cost-<session_id>.json on each render,
    cost-tracker prefers that authoritative value when fresh (<=300s).
    Behaviour is strictly additive — absent a writer, the transcript-sum path
    is unchanged.
    
    Tests cover both the prefer-fresh-cache and ignore-stale-cache paths.
  • fix: integrate recent hook and docs PRs (#1905)
    Integrates useful changes from #1882, #1884, #1889, #1893, #1898, #1899, and #1903:
    - fix rule install docs to preserve language directories
    - correct Ruby security command examples
    - harden dev-server hook command-substitution parsing
    - add Prisma patterns skill and catalog/package surfaces
    - allow first-time protected config creation while blocking existing configs
    - read cost metrics from Stop hook transcripts
    - emit suggest-compact additionalContext on stdout
    
    Co-authored-by: Jamkris <dltmdgus1412@gmail.com>
    Co-authored-by: Levi-Evan <levishantz@gmail.com>
    Co-authored-by: gaurav0107 <gauravdubey0107@gmail.com>
    Co-authored-by: richm-spp <richard.millar@salarypackagingplus.com.au>
    Co-authored-by: zomia <zomians@outlook.jp>
    Co-authored-by: donghyeun02 <donghyeun02@gmail.com>
  • feat: add ECC statusline observability hooks
    Salvages the useful statusline/context monitor work from stale PR #1504 while preserving the current continuous-learning hook runner wiring.
    
    Adds the metrics bridge, context monitor, statusline script, shared cost/session bridge utilities, and tests. Fixes the reviewed false loop-detection hash collision for non-file tools, avoids default-session cost inflation, sanitizes statusline task lookup, and records hook payload session IDs in cost-tracker.