Skip to content

feat: cctrace insights — windowed usage aggregates + the cctrace-insights skill - #107

Merged
lroolle merged 1 commit into
mainfrom
feat/insights
Sep 2, 2026
Merged

feat: cctrace insights — windowed usage aggregates + the cctrace-insights skill#107
lroolle merged 1 commit into
mainfrom
feat/insights

Conversation

@lroolle

@lroolle lroolle commented Sep 1, 2026

Copy link
Copy Markdown
Member

Item 2 of Eric's 2026-08-31 batch: "skillize our cctrace abilities for tracing insights — how's the prompt caching going in the last 7d, where our quota costs went, which session is doing the heaviest work, suggestions for maximizing our subscriptions."

Same division of labor as cctrace title (0.43): cctrace computes, the skill reasons.

The data layer — cctrace insights

cctrace insights [--since 7d] [--scan] [--json] [--data-dir PATH]
  • Fast path (registry exit stats, milliseconds): runs / pairs / tokens / est cost by day, project and client, plus the heaviest runs with their titles and first prompts. On the real store: 77 runs, ≈$1,647 over 7d, top sessions named.
  • --scan streams every in-window trace for what only the wire knows: the cache read/write/uncached split with estimated dollars per component, per-model and per-session weight, and every account-quota poll (5h / 7d / model-scoped windows). Measured: 3.3 GB of 24h traces folded in 4.8 s — cache hit 98%, ≈$140 of ≈$215 was cache reads, quota 7d at 74%.
  • Coverage is part of the output: runs without exit stats, traces on another machine, duplicate pairs deduped across a session file and the sources auto-merge absorbed. Every dollar wears ≈; tokens and quota percentages are wire facts.
  • Pure folds in src/insights.ts (parseWindow / runInWindow / foldRuns / createScanFold), unit-tested on synthetic pairs (7 tests: flat exit-stat fields, window edges, cache-hit share, dedupe, quota min/max/last, the never-cached null).

The skill — skills/cctrace-insights

Triggers on the usage questions, runs insights --json, and writes the report under cctrace's own honesty rules (≈ on every dollar, coverage gaps stated, runs and scan never added together) with evidence-gated recommendations — low cache hit % → look for many short runs instead of continued sessions; a 7d window peaking while 5h idles → batch after the reset; one session dominating → open its Context view's "where the money went".

Verification

bun test 893/0 (7 new). Real-store smoke: fast path and --since 24h --scan outputs in the PR-linked session above.

🤖 Generated with Claude Code

@lroolle
lroolle force-pushed the feat/insights branch 2 times, most recently from fc51e90 to 9a4efb2 Compare September 2, 2026 04:26
…ghts skill

The data layer for 'how is caching going this week / where did the
money and quota go / which session is heavy': foldRuns over the
registry's exit stats (instant), createScanFold streaming the window's
traces for the wire truth — cache split with est $ per component,
per-model, per-session, quota polls. The cctrace-insights skill reads
--json and writes the report; cctrace never reasons (title precedent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lroolle
lroolle merged commit e10f559 into main Sep 2, 2026
1 check passed
@lroolle
lroolle deleted the feat/insights branch September 2, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant