Repository navigation
feat(core): duplicate-reads, junk-reads, context-bloat detectors over fingerprints (phase 5) - #824
Merged
Merged
Conversation
… fingerprints (phase 5)
Redesign the three token-waste detectors as pure @codeburn/core detectors that
consume an ObservationEnvelope of fingerprinted resource refs (never raw paths):
- Envelope schema 0.2.0: CallObservation gains optional resourceReads /
resourceEdits (ResourceRef = {resourceId 16-hex, resourceClass}). claude/codex
toObservations fingerprint toolSequence file paths into these; raw paths never
cross the boundary. Keep observation-0.1.0.json frozen; emit 0.2.0.
- Host privacy key (D1): sync keystore under the codeburn config dir, random
32-byte key generated on first use, stable across runs, never emitted.
- core/detectors: junk-reads, duplicate-reads, context-bloat — pure, zero
fs/env, each emitting Finding[] with confidence(basis), machine-readable
evidence, algorithmVersion.
- optimize.ts delegates the three to core, mapping Finding -> WasteFinding;
display strings, fix payloads and trend stay host-derived.
Numbers parity: all optimize tests pass unchanged; frozen-corpus optimize JSON
(3552 sessions) is byte-identical PRE vs POST.
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.
Phase 5 of #809. Three detectors REDESIGNED (not moved) into packages/core/src/detectors, consuming the minimized envelope via resource fingerprints — raw paths never enter core; the CLI maps Findings to its display shapes and derives fix payloads from a host-side resourceId→path reverse map (D5-A). Every Finding carries machine evidence, confidence-with-basis, algorithmVersion 1.0.0.
Schema 0.2.0: CallObservation gains resourceReads/resourceEdits (16-hex refs + class), 0.1.0 kept frozen with drift tests for both. D1 keystore materialized: per-install random key at the config dir, 0600, never printed. Smuggling tests extended: paths planted in tool sequences emerge only as refs.
Numbers parity HELD — no re-baseline needed: all 145 optimize tests unchanged; frozen-corpus optimize output byte-identical (13,186 bytes; read-edit-ratio 7630/5619, redundant-rereads 2239 — real findings, exact match; independently re-verified in review). The junk-reads predicate was redesigned from path-regex to resource classes and, after review feedback, the classifier was extended so the class set is a PROVEN strict superset of the legacy regex (every legacy token programmatically classified; sole exception shown unrealizable). Core suite 135, root 2254, tsc clean, import-smoke covers ./detectors (purity: zero I/O).