ce-compound: line-number citations go stale quickly, and are checked against the working tree even when it holds unrelated changes
ce-compound's capture step asks the drafter to "cite file:line alongside the claim" from the current tree (skills/ce-compound/references/research.md, Phase 1 draft step), and grounding-validation.md says code-behavior claims verify against the local working tree. This causes two problems.
-
Line numbers go stale whenever lines are added or removed above them. In one repo using ce-compound, a single refresh pull request updated 70 learnings, most of them only to move line numbers, and a second branch existed just to update one learning's citations again. Neither change corrected anything a reader needed. The code had moved, and the numbers had not.
validate-doc-claims.pystrips:linesuffixes before checking, so nothing flags a stale number until someone reads it. -
The working tree is not always the tree the learning will merge into. In a GitButler workspace, or any checkout with other unmerged work applied, the working tree includes changes that are not part of the learning's pull request. In one session, a capture wrote line numbers that were 4-7 lines off from the base branch, and a refresh investigation recommended "correcting" about ten citations that were right on the base branch to the working-tree values. On an ordinary feature branch this does not arise, because the learning merges with the code it cites.
Suggested changes:
- Prefer symbol anchors (function, class, or config key names) over line numbers when citing code in a learning, and keep
file:linefor cases where no symbol identifies the spot. - When HEAD is not the default branch's tip, verify code-behavior citations against the merge base or the default branch, as
validate-doc-claims.pyalready does for paths, and state which tree was used. - In refresh, do not classify a citation as drifted when it matches the default branch.