feat: softly demote drifted code claims in the hook worker - #182
Open
divo12 wants to merge 1 commit into
Open
Conversation
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.
Summary
Close the loop between deterministic anchor auditing and durable memory state.
When the existing auto-memory hook worker is due, it now audits each writable repository once. An active
code_verifiedclaim is softly demoted when any anchor has:drifted)missing_file)missing_symbol)Demotion creates a deterministic
truth: unknownreplacement, preserves the claim's wording, kind, intent, andaboutrelationships, and supersedes the verified original. The original remains in history. The supersession metadata records the exact Git SHA and sorted anchor-audit evidence.Why this shape
Issue #90 identifies the missing write action: anchor audit could prove that memory was stale, but the claim remained trusted. The fingerprint work behind #91 also makes same-symbol content changes actionable.
This PR deliberately uses the small existing controller loop instead of reviving the broad freshness engine from #96:
due hook worker -> clean default-branch check -> anchor audit -> one proposal -> applyProposalThat means no second worker, schema migration, checkpoint, reverse index, public flag, managed protocol, or LLM repair path.
Safety and scope
code_verifiedclaims are eligible.Verification
npm run typechecknpm run buildnode scripts/check-anchor-drift-worker.jsnpm testgit diff --checkThe focused integration fixture exercises real fingerprint content drift, missing files, missing symbols, a partially drifted multi-anchor claim, preserved component relationships, superseded history, evidence metadata, checkout gates, and idempotent retry.
A read-only dry construction against the shared managed repository checked 323 active claims and produced 68 unique replacement/supersession pairs from real audit output: 46
drifted, 51missing_file, and 4missing_symbolevidence entries (some claims had multiple issues). Assertions confirmed every replacement wasunknown, preserved wording/kind/intent, omitted anchors and evidence links, and superseded an activecode_verifiedoriginal.applyProposalwas never called under the reader role.Closes #90.