mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-04 06:21:59 +09:00
* feat(cost): ADR-508 budget file, LiteLLM budget export, per-agent/tool attribution - .claude-flow/cost/budget.json (v1): `ruflo cost budget set --daily/--weekly/--monthly` writes it; the ruflo-mods ladder uses its smallest window when costBudgetUsd is 0. Hostile files (negative usd, unknown periods, oversized arrays) are no budget. Validator in both the mod and the CLI with a parity test. - `ruflo cost budget export --gateway litellm` prints budget_limits (and, with --model, model_max_budget + budget_fallbacks) as YAML or the /key/generate body; --apply posts it to https or loopback only, key from --key-env, redirects refused. --gateway meta-llm fails with a pointer to ADR-508 (no documented budget API). - ruflo-mods costLedger option (default on, ruflo projects only): session.measure deltas charged to subagent type and preceding tool, one line per session in .claude-flow/cost/attribution.jsonl, read by `ruflo cost report`; a gateway budget refusal is toasted once and counted. - Live-validated on Claude Code 2.1.289 (fake LiteLLM on loopback + one haiku run). Co-Authored-By: RuFlo <ruv@ruv.net> * docs(adr): ADR-508 status names PR #4592 Co-Authored-By: RuFlo <ruv@ruv.net> * docs(ruflo-mods): ADR-508 costLedger transcript read, open budget-file and default-on notes Co-Authored-By: RuFlo <ruv@ruv.net> * fix(cost): ADR-508 review — --apply host escape via // path, per-call attribution split - keyGenerateUrl: a base path starting with // (or /\) resolved as a protocol-relative URL and sent the LiteLLM master key to another host (http://localhost//evil.example/ -> http://evil.example/key/generate). Refuse such paths, set the path on a copy of the parsed URL, and require the result to keep the given scheme and host. - Attribution: session.measure fires once per main-thread turn, and a foreground subagent runs inside the main Agent call, so last-tool charging put subagent spend on main/Agent. Split each measured delta evenly across the tool calls completed since the last measurement. - Tests in host event order and for the path escape; both fail on the previous code. ADR, README, cost report header state the estimate rule. Co-Authored-By: RuFlo <ruv@ruv.net> * docs(adr): ADR-508 live run of the per-call attribution split Co-Authored-By: RuFlo <ruv@ruv.net> * chore(plugins): ruflo-mods 0.11.0, cost-tracker 0.31.0 for ADR-508 Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: r <r@x>