Skip to content

Feature: expose per-day one-shot data in daily JSON output #279

Closed

Description

@eugene-eee-hongkyu

Description

Currently `codeburn report --format json` exposes one-shot metrics only at the period level via `activities[].oneShotRate` / `oneShotTurns` / `editTurns` / `turns`. The `daily[]` array only carries `date / cost / calls`.

For consumers building daily-resolution efficiency tracking (daily score, streak, heatmap), per-day one-shot data would be valuable.

Current `daily[]` shape

```json
{
"date": "2026-05-09",
"cost": 288.62,
"calls": 1662
}
```

Suggested addition

Either of:

Option A — pre-computed rate
```json
{
"date": "2026-05-09",
"cost": 288.62,
"calls": 1662,
"oneShotRate": 0.89
}
```

Option B — raw counts (more flexible)
```json
{
"date": "2026-05-09",
"cost": 288.62,
"calls": 1662,
"turns": 540,
"oneShotTurns": 480,
"editTurns": 60
}
```

Option B is more flexible — consumers can aggregate over arbitrary windows (7-day rolling avg, weekly, monthly) without re-deriving from activity-level data.

Use case

Daily-resolution efficiency dashboard. Currently we score each day with `cache hit` (from ccusage tokens) + `cost/call` (from codeburn daily). Adding per-day one-shot would let us include the "skill" signal alongside infrastructure (cache) and model selection (cost). Without per-day data the rate becomes noisy when derived from period-level rollups.

Real consumer: https://github.com/eugene-eee-hongkyu/ai-usage-tracker (small-team internal usage tracker, 10 developers).

Note

The data already exists internally — `activities[].oneShotTurns` / `turns` per period. This request is just to surface it bucketed by date in `daily[]`.

Thanks for the great tool!

Activity

  1. self-assigned this
    on May 9, 2026
  2. iamtoruk commented on May 9, 2026

    @iamtoruk
    Member

    Hey @eugene-eee-hongkyu — thanks for the detailed report and especially for naming the consumer (ai-usage-tracker), that helped me lock in the right shape.

    I went with Option B + the pre-computed rate — both raw counts and oneShotRate. Raw counts let you sum across arbitrary windows correctly (you can't average rates), and the pre-computed oneShotRate keeps simple consumers simple. This matches what activities[] and models[] already do in the same JSON output.

    New daily[] shape

    {
      "date": "2026-05-08",
      "cost": 241.27,
      "calls": 2480,
      "turns": 2234,
      "editTurns": 150,
      "oneShotTurns": 146,
      "oneShotRate": 97.3
    }

    Semantics:

    • turns — every classified turn that day
    • editTurns — turns that triggered file edits (Edit/Write/MultiEdit/NotebookEdit/cursor:edit)
    • oneShotTurns — edit turns that succeeded with zero retries
    • oneShotRate — Math.round((oneShotTurns / editTurns) * 1000) / 10. null when editTurns === 0 so a chat-only day doesn't read as 0% one-shot. Heads-up: handle null in your scoring logic.

    Cross-check invariant

    For the same period, sum(daily[].editTurns) === sum(activities[].editTurns) (and same for oneShotTurns, turns). Verified empirically on real data: 940/940 weekly editTurns, 856/856 weekly oneShotTurns, exact match on today as well.

    Validation request

    PR is open at #280. Could you pull the branch and validate against ai-usage-tracker before we merge? Specifically:

    1. Schema matches what your daily scoring needs?
    2. Naming (oneShotRate vs alternatives like oneShotPct) feels right?
    3. The null semantics for chat-only days don't break your aggregator?
    git fetch origin feat/json-daily-oneshot
    git checkout feat/json-daily-oneshot
    npm install && npm run build
    node dist/cli.js --format json --period 7days | jq '.daily[0]'

    Once you confirm it works for your consumer, we'll merge and it'll ship in the next publish.

  3. eugene-eee-hongkyu commented on May 10, 2026

    @eugene-eee-hongkyu
    Author

    Validated feat/json-daily-oneshot against ai-usage-tracker — looks great, ready to merge from our side.

    Validation results

    Built 8682a88 (Strengthen daily/activities reconciliation + CHANGELOG entry) locally and ran against my own 30-day Claude Code data.

    Cross-check invariant — all PASS (-p 30days --format json --provider claude):

    metric sum(daily[]) sum(activities[]) match
    turns 7729 7729 ✅
    editTurns 2326 2326 ✅
    oneShotTurns 1809 1809 ✅

    (week period also passed: 2037 / 406 / 270 across 8 daily rows.)

    Rate formula spot check (5 random days, expecting Math.round((oneShotTurns / editTurns) * 1000) / 10):

    date editTurns oneShotTurns expected actual
    2026-04-10 19 16 84.2 84.2 ✅
    2026-04-13 3 2 66.7 66.7 ✅
    2026-04-14 40 37 92.5 92.5 ✅
    2026-04-15 96 91 94.8 94.8 ✅
    2026-04-16 108 89 82.4 82.4 ✅

    null semantics — couldn't directly validate (no editTurns === 0 days in my 30d data, every active day had at least one edit), but reviewed the code path. Guarding editTurns === 0 → null is exactly what we want for downstream aggregators.

    Feedback on the 3 questions

    1. Schema — both raw counts + pre-computed rate is the right call. Raw counts let us aggregate over arbitrary windows (rolling avg, weekly, historical backfill) without re-deriving from rates. Matching activities[] / models[] shape keeps the JSON consistent.

    2. Naming — oneShotRate matches existing activities[].oneShotRate. Already consistent with codebase convention. No change needed.

    3. Null on chat-only days — actually a feature for us, not a concern. Defaulting to 0% would penalize legitimate chat days and skew rolling averages. We'll guard with editTurns > 0 (or oneShotRate !== null) before folding into our daily efficiency score formula.

    What we'll do once merged

    Adding one-shot as a third signal to our daily efficiency score (currently cache 85 + cost 15, see fb3cc9c). Probably landing at cache 60 + one-shot 25 + cost 15 to treat one-shot as the "skill" axis (cache = infrastructure, cost = model selection, one-shot = clear instructions). Will report back with the resulting distribution across our 10 developers once shipped.

    Thanks for the quick turnaround and for getting the invariants right — the reconciliation guarantee is what makes this safe to consume. 🙏

  4. added a commit that references this issue on May 10, 2026
    3e792f9
  5. iamtoruk commented on May 10, 2026

    @iamtoruk
    Member

    Merged via #280 (d1eb13f). The new turns / editTurns / oneShotTurns / oneShotRate fields on daily[] are on main and will ship in the next npm publish.

    Thanks @eugene-eee-hongkyu for the thorough validation — the empirical reconciliation table you posted made this an easy merge call.

  6. eugene-eee-hongkyu commented on May 10, 2026

    @eugene-eee-hongkyu
    Author

    Awesome — thanks for shipping this. We've already wired our scoring logic for the new fields behind a oneShotRate ?? null guard, so it'll switch on automatically once the package lands on npm.

    Quick question: any rough ETA on the next publish? Just so I can time our team's install.sh re-run and the distribution writeup. No pressure if it's not soon — we're not blocked.

  7. iamtoruk commented on May 10, 2026

    @iamtoruk
    Member

    @eugene-eee-hongkyu Aiming for tomorrow (2026-05-10). Quite a few things have landed since 0.9.7 - multi-Claude-config-dir support, Crush provider, the new `codeburn models` command, the per-day one-shot fields you validated - so I want to revalidate the bundle end-to-end before cutting the tag.

    Will ping you here the moment it is on npm so you can re-run your `install.sh` and roll the writeup. Thanks for guarding behind `oneShotRate ?? null` already - that means there is nothing on your end blocking us either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions