Repository navigation
cc-stats: make the skill reliable when an agent runs it - #48
Conversation
A level-1 rehearsal (isolated CODE_CYCLE_HOME, seeded store, real headless
Claude Code sessions) found that the component's numbers were exact but the
skill failed in use:
- Natural-language requests ("muéstrame las estadísticas del toolkit") were
routed to another tool's analytics. The description now names the report's
contents and example requests in any language, and excludes token-savings
analytics.
- One session searched the filesystem, found another checkout's stats.py,
changed into it and reported the wrong repository. The skill now checks only
the project, user and toolkit-checkout runtime paths, never searches, and
runs the component for the current repository with an explicit --cwd.
- Agents summarised the report instead of showing it, and paraphrased counts
wrongly. The reply must now begin with the report's own heading and contain
it verbatim, with at most two sentences of reading after it.
The report also names the repository, says at the top when no telemetry exists
or the period is empty, states model drift as dispatches that reported their
model and ran a different one, and shows daily activity as a one-line
sparkline (weekly beyond 45 days).
Refs #42
Initial review — PR #48
|
| Command | Result |
|---|---|
python3 scripts/validate-package.py |
VALID: 13 skills (6 cycle, 7 supporting)… |
python3 -m unittest tests.test_stats |
OK |
python3 -m unittest discover -s tests |
592/593. The one failure is test_run_cycle.LocalOnlyPolicyTests.test_local_only_rejects_the_live_repository, the known artefact of running from a worktree outside the canonical checkout (it fails the same way on main there); CI passes it. |
_sparkline with a constant 50-day series |
Reproduces REV-001 |
aggregate + render_markdown with only verdict and cycle rows |
Reproduces REV-003 |
Not re-run in this review: the 8 headless agent sessions from the PR description. I read the skill-text changes (REV-002) but did not exercise them at runtime.
CI
gh pr checks 48: 4/4 passed. That is Validate package run twice (push + pull_request), each with Skills, manifests, and Bash installer ✅ and PowerShell installer ✅. None are pending, skipped, or missing.
Residual risks
- Getting the agent to reply with the report verbatim depends on the model following an instruction. The rehearsal reached 8/8 with Sonnet, but other models or hosts may still summarise.
- The weekly sparkline has no test with more than 45 days of real data.
Project verdict: CHANGES_REQUESTED. REV-001 blocks approval; REV-002, REV-003, and REV-004 do not.
Resolution summary — PR #48Result: RESOLVED. The fixes below are on HEAD Findings[REV-001] · medium · resolved · blocks:yes — Partial trailing week in the sparkline reads as a declineDecision: Valid. Weekly buckets now align to the end of the period, placing a partial bucket first. Sparse weekly aggregation also avoids constructing a date string for every day in all-time reports. Verification: A constant 50-day series now renders the recent full weeks at full height; Commit: [REV-002] · low · resolved · blocks:no — The reply rule conflicts with
|
Summary
Fixes from a level-1 rehearsal of
cc-stats: a sandbox repository with the toolkit installed, an isolatedCODE_CYCLE_HOMEseeded with 237 validated rows, and real headless Claude Code sessions (Sonnet) invoking the skill. The component's aggregates matched the seeded data exactly; the failures were in how agents used the skill./, found another checkout'sstats.py,cd'd into it and reported the wrong repository--cwdfor the current repository2/30 measureddrift was read as "measured only 2 of 30"Work item: #42 (end-to-end check with a real cycle still pending).
Verification
python3 scripts/validate-package.py— passedpython3 -m unittest discover -s tests— 593 tests passed (new: empty/quiet-period messages, drift wording, sparkline)git diff --check— passed/cc-stats, two Spanish natural-language requests, "todo el histórico", each twice) — 8/8 loadedcc-stats, used the sandbox runtime with--cwd, passed the right period flag, and replied with the report verbatim forsandbox/cc-stats. Before these changes: 2/4 routed to another tool and 3/4 replied with a summary only.