feat(daemon): Session 9 — cost tracking and daily guardrails (Daemon Spec Phase F)
Add token estimation, daily cost accumulation in daemon-cost.json (UTC-date keyed, auto-resets each calendar day), and configurable max_cost_per_day_usd cap enforcement. The daemon skips consolidation passes when the cap is met but stays alive. getDaemonStatus now surfaces cost_today_usd and cost_cap_usd.
New files: lib/daemon-cost.mjs — estimateTokens, computeCallCost, getDailyCost, recordCallCost, resetDailyCost test/daemon-cost.test.mjs — 46 unit tests
Modified: lib/daemon.mjs — trackedLlmFn wrapper, cost-cap guard in loop, cost fields in getDaemonStatus test/daemon.test.mjs — 18 integration tests (Phase F: Cost Guards), 1 updated test (wrapper semantics)
949 tests passing, 0 failing (59 new tests, 890 baseline preserved).
0 comments
muse hub commit comment sha256:206a58cf2d6f133cad70fc717cb4effba7ff3a32d8cf6b02f501a8bedc32aaad --body "your comment"
No comments yet. Be the first to start the discussion.