Skip to content

feat(proof): follow git renames in --path and flag stale code anchors - #298

Draft
tonyketcham wants to merge 1 commit into
claude/agent-memory-context-potency-6sniud-p3-benchfrom
claude/agent-memory-context-potency-6sniud-p3-reads
Draft

tonyketcham wants to merge 1 commit into
claude/agent-memory-context-potency-6sniud-p3-benchfrom
claude/agent-memory-context-potency-6sniud-p3-reads

Conversation

@tonyketcham

Copy link
Copy Markdown
Collaborator

Stacked on #297.

What

Code anchors in Proof go stale when a refactor moves code and nobody updates Proof. Today find --path on a moved file finds nothing, and cards still show the old path with no warning. These reads now ask git what happened.

  • find --path <file|dir> also matches records on the target's former names.
    • A file's former names come from git log --follow -M. A copy counts only when the same commit took lines out of the source, so a module split counts and a template copy does not. The walk stops at the commit that added the current name.
    • A folder move is inferred from the file renames into it, and only when the old folder is gone and more than half of its files moved. Moves are followed up to 4 hops.
    • An anchor on a former name counts only if its sha comes before the move, so a later file that reuses the old name doesn't inherit records.
  • A path gone from HEAD still returns its records, and says where it went: renamed to X in <sha>, or deleted in <sha>.
  • Stale-anchor notes appear wherever a code Citation prints (find cards, get). Each anchor path#symbol@sha is checked against HEAD and the working tree:
    • the path is gone, and where it went;
    • the symbol is no longer a whole word in the file, with the commit that removed or renamed it;
    • the file differs from the anchor's sha, with the commits that touched it since. This means the file changed, not necessarily the anchored lines; a rename-only change prints nothing.
  • Bounds: git work is cached per read and capped at 60 calls. Pickaxe walks stop 500 commits back. Nothing fetches. The git work measures 25–53 ms per read on the 10x bed.
  • Docs: SKILL.md and reference.md say what each note means and which walks are uncapped.

Offline gate (10x refactor bed, today's reads → these reads)

Changes were chosen on the tune split. Holdout was scored once, at the end.

Split Evidence in top 5 Answer on the cards
Tune 18/38 → 25/38 9/25 → 17/25
Holdout 21/36 → 24/36 9/21 → 12/21
  • No holdout question got worse.
  • On the non-refactor 10x bed, no score changed. Seven cards gained a correct "changed since" line.

Checks

  • pnpm build, pnpm typecheck, prettier, skills:sync and skills:check pass.
  • AVA: 299 tests pass, including 14 new ones on small git repos (rename, folder move, symbol rename, split, reused path, squash, swapped call, uncommitted code).
  • eslint fails to load a rule in this environment; CI runs it.

The paid rerun comes next.


Generated by Claude Code

`proof find --path` now matches records on a file's or folder's former
names, found from git history at HEAD (`log --follow -M`, folder moves
inferred from file renames when most of the old folder moved), and a path
gone from HEAD reports where it went. Wherever a code Citation prints, its
anchor is checked against HEAD and the working tree: a gone path, a symbol
no longer in the file (with the commit that removed or renamed it), and
commits that changed the file since the anchor.

Git work is cached per read and capped at 60 calls, pickaxe walks stop
500 commits back, and nothing fetches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVVnhYL1Bz7mCfEKDoyLMW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants