Skip to content

An engine write is not product movement - #52

Merged
dimeloper merged 1 commit into
mainfrom
fix/rendered-files-are-not-product-docs
Sep 22, 2026
Merged

dimeloper merged 1 commit into
mainfrom
fix/rendered-files-are-not-product-docs

Conversation

@dimeloper

Copy link
Copy Markdown
Owner

Found by using v0.59.0's own audit: re-sourcing eleven stale context/ files
surfaced that one of the four projects was not stale at all. The commit that
aged it was the commit that onboarded the repo into this engine.

STALE  projects/babypath/context/audience.md
       reviewed 2026-09-12, sources last moved babypath-app d427cbbb0 2026-09-21

$ git show --stat d427cbb
chore: onboard the app into second-brain-workflow as shared
 .claude/rules/*.md  | …
 CLAUDE.md           | 2 ++     ← this is why

Tier 1 of the context survey is "what the product is for, in the team's own
words"
and lists CLAUDE.md and AGENTS.md. In an onboarded repo those are
frequently our own output — 8 of the 31 agent files across this machine's
registered repos carry the marker
. So a render moves a "product doc", and
check-context-freshness.py reports drift nobody caused. It recurs on every
re-render, across every onboarded repo.

Same shape as the v0.55.0 rule-budget defect, and the third instance of it: a
correct computation over the wrong input set.

Why not just drop those filenames from tier 1

Because a hand-written AGENTS.md is a genuine product doc — often the
clearest statement a repo has of how its team works — and render.py
deliberately refuses to overwrite one. 23 of those 31 files are hand-written.
Dropping the names would throw away real evidence to silence a false positive.

Name alone cannot separate the two. Provenance can, and it is the same question
render.py already asks before it writes.

Two shapes, because the engine writes two ways

A whole file it owns carries the marker → dropped from the survey. It is not
evidence about the product in any tier.

An @AGENTS.md import prepended to a CLAUDE.md the repo owns carries no
marker, correctly, because that file really is hand-written. This was the
babypath case, and it is the one my first diagnosis missed — the marker alone
would not have fixed it. So the file stays a source and the commit is
skipped: a commit whose only changes to tier sources are engine-written lines is
not product movement, and the check walks back to the last one that is.

A commit that cannot be read is never treated as ours. A real product change
must not be able to hide behind a failed git show.

lib/provenance.py

One definition, because there are now two consumers asking for opposite reasons:
render.py asks what may I overwrite, the survey asks what counts as
evidence
. render.py and lib/registry.py take MARKER from it instead of
carrying copies. lib/registry.sh keeps its own because it is shell, and
test-repo-registry.sh still guards that one against drift — that test is what
caught the move, which is the argument for it existing.

Testing

make lint clean, 41 suites pass, test-render.sh 149 assertions green across
the refactor.

Five new assertions in test-context-freshness.sh, all confirmed failing
against the pre-fix code
, covering both shapes and the case that must keep
working:

FAIL an engine-only commit does not make a context stale
FAIL the onboarding commit is not read as product movement
FAIL and the date shown is the last real product commit
FAIL a marked AGENTS.md is not counted as a product doc
FAIL a generated AGENTS.md does not age a context file

The third of those matters most: a real product commit that lands behind an
engine write is still found and still reports STALE. The fix must not swallow
movement, only ignore our own.

One pre-existing failure, in a git worktree only: doctor.sh reads .git as a
file there. Passes in a normal checkout and in CI; already tracked.

🤖 Generated with Claude Code

Tier 1 of the context survey is "what the product is for, in the team's own
words", and it lists CLAUDE.md and AGENTS.md. In an onboarded repo those are
frequently this engine's own output — 8 of the 31 agent files across this
machine's registered repos carry the marker. So onboarding a repo, and every
later re-render, moved a "product doc" and marked that repo's whole context/
stale with no product fact changed. On 2026-09-22 `d427cbb`, "chore: onboard
the app into second-brain-workflow as shared", did that to all three of
babypath-app's context files.

Dropping those filenames from the tier would be the wrong fix. A hand-written
AGENTS.md is a genuine product doc — often the clearest statement a repo has of
how its team works — and render.py already refuses to overwrite one. Name alone
cannot tell the two apart; provenance can, and it is the question render.py
asks before writing.

Two shapes, because the engine writes two ways. A whole file it owns carries
the marker and leaves the survey. An `@AGENTS.md` import prepended to a
CLAUDE.md the repo owns carries none, because that file really is hand-written
— so the file stays a source and the *commit* is skipped, and the check walks
back to the last commit that changed something a person wrote.

A commit that cannot be read is never treated as ours: a real product change
must not be able to hide behind a failed `git show`.

Same shape as the v0.55.0 rule-budget defect, and the third instance of it: a
correct computation over the wrong input set.
@dimeloper
dimeloper merged commit 56f3114 into main Sep 22, 2026
4 checks passed
@dimeloper
dimeloper deleted the fix/rendered-files-are-not-product-docs branch September 22, 2026 10:50
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.

1 participant