feat(cli): shared hook efficacy ledger + read-after-served adoption KPI#777
Merged
Conversation
The sessions.db injections table becomes the shared ledger for every hook surface: new surface/category/chars columns (migrated in place on both the hook-side opener and the staging store), the Grep/Glob enrichments now log their firings, and the decisions miner is scoped to decision-surface rows so the new measurement rows never reach it. New augment_cmd/served_reads.py rides that ledger: PostToolUse on repowise MCP tools records which file line-ranges a response actually served (source bytes only, never skeletons or signatures), and a later Read whose window those ranges substantially cover logs one read_after_served row per file per session. Nothing is ever injected at that moment: served-then-read means the MCP answer did not land, and the row is the adoption metric, not a nag. The PostToolUse matcher is widened to repowise MCP tool names so served content is observable; unknown payload shapes are skipped, never guessed. Claude-Session: https://claude.ai/code/session_01AbCVfR5FFEvDxRvJU7DmsW
|
✅ Health: 7.6 (unchanged) 📋 At a glance
🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔎 More signals (2)🔥 Hotspots touched (5)
2 more
🔗 Hidden coupling (1 file)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-11 10:02 UTC |
swati510
approved these changes
Jul 11, 2026
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.
What
Turns the sessions.db
injectionstable into a shared efficacy ledger for every augment hook surface, and adds the read-after-served adoption metric on top of it.Ledger (
core/sessions/staging.py,augment_cmd/decision_inject.py)surface/category/charscolumns, migrated in place by both writers (hook-side stdlib opener and the staging store), so sidecars created by either side first stay compatible.decision/session_start/edit_notice); the Grep/Glob enrichments (rescue, triage, flood digest) now log each firing with its size.Read-after-served KPI (
augment_cmd/served_reads.py, new)read_after_servedrow per file per session (chars=0, measurement only). Nothing is ever injected at that moment.mcp__.*[Rr]epowise.*__.*(installer migrates existing installs in place; plugin hooks.json updated) so served content is observable at all.Why
Served-then-read is the most diagnostic signal we have for whether MCP answers actually land: a Read of content the tools already served means the answer did not stick. This ledger lets that number, and the used-vs-ignored rate of every other hook enrichment, be tracked per session so guidance that gets ignored can eventually prune itself instead of accumulating as noise.
Notes
Testing
tests/unit/cli/test_augment_served_reads.py: coverage math (union of disjoint serves, offset windows, partial coverage stays silent), once-per-file-per-session dedup, unknown-shape refusal on both the Read and MCP sides, search-surface logging with content-hash dedup, and legacy-sidecar migration through both writers.