Conversation
Implement Cost Per Successful Task (CPS) tracking based on SLM survey findings from arXiv:2510.03847. CPS = total_spent_cents / successful_tasks and resets daily alongside existing cost counters. - Add `successful_tasks: u64` to `CostState`; reset in `reset_if_new_day` - Add `record_successful_task()`, `cps() -> Option<f64>`, `successful_tasks()` to `CostTracker` - Wire `record_successful_task()` in `utils.rs` after `record_cost_and_cache`; called from `native.rs` (lines 379, 1033) and `plan.rs` (lines 491, 728) - Add `cost_cps_cents: Option<f64>` and `cost_successful_tasks: u64` to `AgentMetrics` - Add spec `048-slm-cost-metrics` documenting SLM applicability and CPS contract Closes #2194
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
record_successful_task(),cps() -> Option<f64>, andsuccessful_tasks() -> u64toCostTrackerinzeph-core— tracks Cost Per Successful Task (CPS) per day, resets at UTC midnight alongside existing cost counters.record_successful_task()after everyrecord_cost_and_cache()call site innative.rsandplan.rs.cost_cps_cents: Option<f64>andcost_successful_tasks: u64toAgentMetrics.slm-mediumQwen-2.5-7B Ollama provider entry to.local/config/testing.toml.048-slm-cost-metricsdocumenting SLM survey findings (arXiv:2510.03847) and CPS metric contract.Based on SLM survey findings: SLMs (1–12B params) are sufficient for tool calling/RAG at 10x–100x lower cost; CPS is the production metric that makes this cost reduction measurable per turn.
Test plan
cargo nextest run -p zeph-core -E 'test(cps)'— 3 new CPS tests passcargo nextest run -p zeph-core --lib— all 23 cost tests passcost_successful_tasks = 3andcost_cps_centsis non-Nonecps()returns None and counter stays 0Closes #2194