Skip to content

feat: lint anchor_drift / anchor_missing — detect staleness from code drift, not age #147

Closed

Description

@jflowers

Part of #153. Depends on #146.

Summary

lint currently treats a decision as stale after 30 days (tools/lint.go, staleDecisionThreshold). Age is a weak proxy: a week-old learning can be wrong after one merge, and a year-old one can still be exact. Detect staleness from code drift instead.

Proposal

Depends on the temporal-validity fields (as_of, evidence).

  • anchor_missing — a cited path doesn't exist at as_of, or a <repo>#<n> citation doesn't resolve.
  • anchor_drift — a cited path changed between as_of and HEAD → mark the entry stale-unverified, including validated entries (demotion of validity is automatic; tier promotion stays human).
  • Keep the age check as a secondary hint, not the primary signal.
  • Entirely deterministic: git + path existence, no model.

Evidence

In the KB effort this was the "existence pre-pass": it resolved every path and PR/issue citation at the pins and queued exactly the claims whose cited files had changed in the window (4 paths → 6 claims) for deep re-verification. It also found that a third of the #N citations were issues, not PRs, in the shared number space.

Related existing work

  • Content sanitizer (sanitize/): sanitize.ContentDrift already flags page content-hash changes between index cycles. That is drift in indexed content; this issue is drift in the code a claim cites. Complementary — consider reusing its hashing and Finding plumbing, and name the lint kinds so the two aren't confused.
  • Spec 013 (knowledge-compile) defines the 30-day stale_decision check. This issue demotes it to a secondary hint, which changes spec-defined behavior; the spec should be amended alongside.

Acceptance

  • lint reports anchor_missing / anchor_drift with the entry identity, the anchor, and the commit range.
  • lint --fix (or an equivalent) can set validity: stale-unverified; it never changes tier or deletes content.

Activity

  1. added
    enhancement
    on Nov 3, 2026
  2. 3 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions