Repository navigation
spec: H3 amendment, the context diff (#119) - #157
Merged
Merged
Conversation
eval/context-diff/diff.py over a run's receipts (FR-004, SC-2). Approved by the owner: C1 (the last receipt in the run with the memory's hash; unknown only when none has it), C2 (a different hashing scheme is "rehashed", never "changed"), C3 (statuses combine, with stated rules), C4 (strict type check in CI). Also stated: flagged judged against the receipt's state, what "source changed" can and cannot say, where the current hashing scheme comes from, a note when ref_ids were cut short, exit codes.
A code chunk is judged by the file record it belongs to (found from the chunk id, so also after its chunk record was deleted): superseded, withdrawn, missing and flagged come from the owner, and source changed compares the file with the owner's content_hash. unknown combines with superseded and withdrawn (read from the store, not a receipt); missing still stands alone. A gone file counts as source changed even without a source_hash. Tests: a chunk of a superseded snapshot, unknown with superseded, a gone file with and without a source_hash.
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.
The design for H3, the context diff (issue #119's FR-004, SC-2), as a spec amendment before any code (D5), approved by the owner on 2026-11-24. Spec only: one section appended to
specs/memkernel-0-15-harness-foundations/spec.md. It leaves #119 open: the H3 build follows, then US4 (the README harness section) and the template note in their own PR.What H3 is
eval/context-diff/diff.py --store … --run <run_id> [--json …], a maintained eval tool like the repeated-mistake count: it reads a run's receipts (H1) from the recall log and reports, per memory the run received, its status against the store now. No server, tool, store or retrieval change.The owner's decisions
unknownonly when no receipt has it.rehashed, and its hash is not compared, so a scheme change (Context rescue S4: supersede suggestions at retain, and canonical hashing (#59) #153) is never "changed content". The current scheme is the installed memkernel'sCONTENT_HASH_SCHEME(sha256-raw, the only one so far).missing,unknownandunchangedstand alone;changedandrehashedexclude each other; every other pair combines.diff.pyjoins CI'smypy --strictbeside the count.Stated for the review (C5–C9)
missing,superseded/withdrawn,changed,rehashed,flagged(judged against the receipt's own state),source changed,unchanged,unknown.source changedcan and cannot say: only that thesourcefile hashes differently (through memkernel's owncompute_content_hash, as revalidation does); not that the memory is wrong, not other files it cites, not a change made and undone; a source outside the project root or unreadable gets no check, reported as such.supersededandsource changed).Review so far
The owner asked that the review's points be in the text before approval: the C3 rules,
flaggedagainst the receipt's state,source changed's limits, the source of the current scheme, the cut-short note. DeepSeek (plan review, two rounds): PASS; its gaps (howflaggedis read, receipts without a hash, scope lookups, exit codes, older stores' scheme, one hashing function, an empty run versus a wrong id) are closed in the text.The owner's fixes (c90a092 → head)
<owner>-chunk-<n>), so also after a superseded snapshot's chunk records were deleted:superseded,withdrawn,missing(only when the owner is gone) andflaggedcome from the owner;source changedcompares the file with the owner'scontent_hash. A chunk is in the tests.unknowncombines withsupersededandwithdrawn(read from the store, not a receipt);missingstill stands alone.source changedeven without asource_hash.supersededis read from, splitting the chunk id and an owner that cannot be found, which scheme applies to a chunk's source check) are in the text.