Skip to content

feat: reap route, reap apm, and gap payload-quality (closes #7 #8 #9)#10

Merged
thousandflowers merged 5 commits into
mainfrom
feat/issues-7-8-9-route-apm-payload
Jun 22, 2026
Merged

feat: reap route, reap apm, and gap payload-quality (closes #7 #8 #9)#10
thousandflowers merged 5 commits into
mainfrom
feat/issues-7-8-9-route-apm-payload

Conversation

@thousandflowers

Copy link
Copy Markdown
Owner

Implements all three open enhancement issues, evidence-driven and reversible, with text/--json/--md parity throughout.

Closes #7 — payload-quality axis (reap gap)

A second utilization axis: when an MCP tool fires, is the result signal or noise? usage.Stats now correlates each mcp__* tool_use with its tool_result and scores the payload (base64 blobs, data URIs, HTML soup, repeated boilerplate) into useful-vs-noise chars. reap gap adds a per-tool quality column and flags ⚑ noisy tools that fire often and return mostly noise — the class load-utilization marks green and mute never catches.

Live: get_viewport_screenshot (81×, ~316 KB base64) → 0% quality, flagged; execute_blender_code (478×, 99%) → correctly clean.

Closes #9 — usage-informed routing (reap route)

Opt-in, secondary to pruning. Organizes the skills that survive a prune into category routers driven by real firing evidence (not BM25/text similarity): frequently-fired skills stay exposed, the rare long tail is pushed behind leaf routers (by namespace, else dominant firing project) loaded on demand. Output is a plan — proposed, never auto-applied; never routes blind (no-evidence skills stay exposed). Leads with the "below ~150 skills native loading is enough" caveat; points at reap mute for the description-stripping half. Flags: --route-threshold, --route-min-skills.

Closes #8 — APM manifest (reap apm)

Read-only: turns a repo's firing evidence into a proposed Microsoft APM apm.yml (skills only, first cut). KEEP→include, REAP→omit, REVIEW→never auto-omit. --diff apm.yml reconciles: suggests adding fired-but-undeclared skills and dropping declared-but-cold ones (REVIEW protected). Upstream coordinates are recovered from apm.lock.yaml when present; otherwise a clearly-marked TODO comment, never an invented coordinate. Hand-emitted YAML (no new dependency).

Quality

Designed and built per-issue, then put through an adversarial multi-agent review (16 agents). Confirmed findings were fixed and locked with regression tests:

  • apm: LoadAPMManifest no longer harvests phantom coordinates from comments/headers/URLs (was self-triggering bogus drops); encodeProject now matches Claude Code's exact [^A-Za-z0-9]→- bucket encoding (repos with ./_/space were silently emitting empty manifests).
  • route: --route-min-skills skip now renders in every format (was leaking prose into --json/--md); deterministic category ordering.
  • payload: flagged-noisy tools sort first so a single 0% anecdote can't outrank a high-volume offender.

Test plan

  • go build ./..., go test ./..., go vet ./... all green
  • New table tests for the noise heuristic, payload scoring, route tiers/categories/token accounting, APM selection/diff/coordinate harvest, plus the three regression tests above
  • Live smoke of reap gap / reap route / reap apm (incl. --json/--md) against real ~/.claude transcripts

🤖 Generated with Claude Code

…n noise

Closes #7. Adds a second utilization axis: when an MCP tool fires, is the
result signal or noise? usage.Stats now correlates each mcp__ tool_use with
its tool_result and scores the payload (base64 blobs, data URIs, HTML soup,
repeated boilerplate) into useful-vs-noise chars. reap gap surfaces a
per-tool quality column and flags 'fires often + mostly noise' tools that
load-utilization marks green. text/--json/--md parity.
Closes #9. Adds an opt-in 'reap route' that organizes skills surviving a
prune into category routers driven by real firing evidence, not text
similarity. Frequently-fired skills stay exposed; the rare long tail is
pushed behind leaf routers (by namespace, else dominant firing project)
loaded on demand. Output is a proposed plan (text/--json/--md), never
auto-applied; never routes blind (no-evidence skills stay exposed). Leads
with the 'below ~150 skills, native loading is enough' caveat and points at
'reap mute' for the description-stripping half.
Closes #8. Adds a read-only 'reap apm' that turns per-repo firing evidence
into a Microsoft APM apm.yml proposal. KEEP→include, REAP→omit, REVIEW→never
auto-omit. --diff <apm.yml> reconciles: suggests adding fired-but-undeclared
skills and dropping declared-but-cold ones (REVIEW protected). Upstream
coordinates are recovered from apm.lock.yaml when present; otherwise a clearly
marked TODO placeholder rather than an invented coordinate. Hand-emitted YAML
(no new dep). text(yaml)/--json/--md. First cut: skills only.
apm:
- LoadAPMManifest only harvests coordinates from dependency list items and
  strips inline comments, so the emitted '# repo:' header, the 'owner/repo/path'
  TODO hint, and URLs no longer inject phantom declared/drop entries (was
  self-triggering bogus drops on the tool's own output).
- encodeProject now mirrors Claude Code's full [^A-Za-z0-9]→'-' bucket encoding,
  so repos whose path has '.', '_' or spaces no longer emit an empty manifest.
- Repo header uses cwd verbatim (encode→decode round-trip corrupted it).
- emit 'apm: []' when there are no active deps so the YAML parses as a list.

route:
- --route-min-skills skip now renders in every format (was leaking prose into
  --json/--md, breaking parity); deterministic category tiebreaker on source;
  dead suffix-merge branch removed; Rate doc corrected.

gap/payload:
- payload rows sort flagged-noisy first so a single 0%% anecdote can't outrank a
  high-volume offender; comment corrected.

Adds regression tests: encodeProject vs CC encoding, manifest round-trip with no
phantom harvest, route skip parity.
@thousandflowers thousandflowers merged commit c8fcd43 into main Jun 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant