feat(stats): add surf stats adoption metrics (#13)#34
Merged
Conversation
Closes #13. The proposal's success/kill criteria (§9.2) hinge on two metrics, and the rubber-stamp rate is the one that distinguishes a working gate from one being routed around. Nothing computed them. - New `surf stats [--since <date>] [--until <date>] [--format human|json]`. Walks each non-merge commit in the window (one commit ≈ one PR), parsing the hub set as it existed at the commit and its parent via git ls-tree/show. - rubber-stamp rate: re-stamp events (a claim's stored hash changed value) where the claim's prose was left untouched. - in-place update rate: claim-touch events (a commit changed an anchored file) where the claim's hash was updated in the same commit. - JSON emits a versioned `{version, since, until, commits, rubber_stamp, in_place}` envelope; `rate` is null when there were no events. - Stats is a history report, not the advisory git used by `check`: it errors (non-zero) when git history is unavailable rather than printing a zero. - New git helpers: log_commits, commit_files, list_files_at (all best-effort). - Heuristic boundaries (one commit per PR, at:-site claim identity, in-place denominator counts any anchored-file edit) documented in docs/guides/stats.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2c34b29 to
c6a53ef
Compare
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
The proposal's falsifiable success/kill criteria (§9.2) hinge on two metrics, and the rubber-stamp rate is the one that distinguishes a working gate from one being routed around. Nothing computed them. This adds
surf stats.Metrics
hash:to a new value), the share where the claim's prose was left untouched. A rising rate is a kill signal.Implementation
--since/--untilwindow (one commit ≈ one PR), parsing the hub set as it existed at the commit and its parent viagit ls-tree+git show, then comparing stored hashes and prose across the pair.git.rs:log_commits,commit_files,list_files_at(sameNone-on-failure pattern as the existing ones).{version, since, until, commits, rubber_stamp, in_place}envelope; each rate is{n, d, rate}withrate: nullwhend == 0.check,statsis a history report: it errors (non-zero) when git history is unavailable rather than printing a misleading zero.Heuristics (surfaced, not hidden)
Documented in
docs/guides/stats.md: one commit = one PR (merges excluded); claim identity is itsat:site(s); the in-place denominator counts any anchored-file edit (including hash-neutral ones), so the reported in-place rate is a floor.Verification
surf statsreturns plausible numbers (55% rubber-stamp, 47% in-place over all history).hubs/cli-stats.md+ anchored the new git helpers inhubs/cli-git.md;surf lint/surf checkstay green (CLI command-list hub updated forstats).Closes #13.
🤖 Generated with Claude Code