Commit Graph

5 Commits

Author SHA1 Message Date
Robert Egoian
46e2d58795 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.
2026-05-25 20:29:56 +03:00
Affaan Mustafa
375d750b4c 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>
2026-05-14 21:37:28 -04:00
Affaan Mustafa
940135ea47 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.
2026-05-11 23:44:06 -04:00
Affaan Mustafa
08f61f667d feat: sync ecc2 cost tracker metrics 2026-04-09 06:22:20 -07:00
Affaan Mustafa
48b883d741 feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00