Add bin/candidate-digest: script the inv.json/scan.json join #28
Reference in New Issue
Block a user
Delete Branch "fix/issue-24-candidate-digest"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes kotkan/claude-plugin-inference-arbitrage#24.
Summary
The
offload-analystagent was hand-reshapingbin/plugin-inventory'sPluginInventoryandbin/offload-scan'sOffloadScaninto a candidatetable on every audit run — 40.09% of this plugin's own audited spend
(849.5k weighted tokens over 26 invocations).
Adds
bin/candidate-digest inv.json scan.json --json, implementingcandidate_digest(inv, scan) -> list[CandidateRow]exactly as proposed inthe issue. It's a digest, not an auto-filing script (position 3, never
position 1):
boundary-classify'sMIN_INVOCATIONS/MIN_ATTRIBUTED_TURNSandia_store'sMIN_SHARE_OF_SPEND— no new share/invocation thresholdsjudgment_densitybrake (newJUDGMENT_DENSITY_BRAKE = 0.3,chosen to sit clear of the issue's worked example: 0.034 → flagged vs
0.55 → not flagged) so a row that crosses every mechanical threshold but
carries real judgment density comes back with
flags: []has_bin_scriptsuppresses flags entirely for a skill whose owncommand_blocksalready invoke abin/script (the "verb_ratio=0.71backed by a 606-LOC script" example) — conservatively
Falsefor agentrows, since
plugin-inventory's JSON carries no agent body/command-blocktext to check
flagsis explicitly documented as advisory input to the analyst'sreading of the actual n-gram/tool-call shape, never a verdict —
bin/boundary-classifyremains the only place a verdict is computedWired into
skills/offload-audit/SKILL.mdstep 3 andagents/offload-analyst.md§2 so future audit runs call the script insteadof reshaping by hand. Version bumped 0.7.0 → 0.8.0 (new script + agent/skill
instruction changes).
Test plan
tests/candidate-digest.test.sh(new, auto-discovered bytests/run-all.sh): the issue's three worked examples — scriptedskill suppressed via
has_bin_script, a flagged agent row(
judgment_density=0.034), the EDGE case suppressed by the brake(
judgment_density=0.55) — plus a below-MIN_SHARE_OF_SPENDcase anda full
CandidateRowschema check. All pass.tests/run-all.sh) passes, exit 0, no regressions.inv.json/scan.jsonpair from aprior
anxiousaudit (/tmp/anxious-inventory.json+/tmp/anxious-scan.json) — sensible, correctly-sorted output withflags firing only on rows that actually cross every gate.
Fix is complete and self-verified; I believe it's ready to arm for
merge-when-checks-succeed, but leaving that to whoever reviews.