Skip to content

fix: unreliable CLAUDE.md → AGENTS.md prose pointer; issue title standard - #260

Merged
pacphi merged 2 commits into
mainfrom
fix/claude-agents-md-consistency
Sep 28, 2026
Merged

pacphi merged 2 commits into
mainfrom
fix/claude-agents-md-consistency

Conversation

@pacphi

@pacphi pacphi commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Issue title standard: documented a Conventional-Commits-style prefix standard for GitHub issue titles in AGENTS.md (feat/fix/docs/style/refactor/perf/test/chore, plus tracking/research extensions used only for issues) and retitled the 13 currently-open issues to conform.
  • CLAUDE.md ↔ AGENTS.md: this repo's own CLAUDE.md used a prose sentence ("Read AGENTS.md for...") to point at AGENTS.md. Per Claude Code's own docs, that only loads if Claude decides to open the file — not guaranteed every session, unlike an @AGENTS.md import. Replaced it with the sentineled @AGENTS.md block ak setup --project already generates for fresh projects, so this repo now dogfoods what the tool itself produces.
  • ak setup --project / ak sync fix: found that the reconciliation in project-guidance.mjs only ever fills in the @AGENTS.md reference when CLAUDE.md is completely empty — any non-empty hand-authored CLAUDE.md (exactly this repo's prior state) is left untouched forever, even carrying the same known-unreliable prose pattern. Added hasStaleAgentsPointer/migrateStaleAgentsPointer: an additive, idempotent migration that inserts the reliable @AGENTS.md import alongside existing prose without ever deleting user content. Wired into both ak setup --project (existing reconcileProjectGuidance call) and ak sync (new call in the blocks step), since setup only runs once per project and sync is the only path an already-set-up project would see this fix through.

Test plan

  • node --test tests/kit/project-guidance.test.mjs tests/kit/guidance-targets.test.mjs tests/kit/blocks-drift-parity.test.mjs — 40/40 passing, including new idempotency tests for both the setup and sync migration paths
  • npx tsc -p tsconfig.json — clean
  • npx eslint on all changed files — 0 errors (2 pre-existing complexity warnings in setup.mjs, unrelated to this change, confirmed present on main before this branch)

🤖 Generated with Claude Code

pacphi and others added 2 commits September 28, 2026 16:07
…standard

CLAUDE.md's "Read [AGENTS.md](AGENTS.md) for..." sentence only loads if
Claude decides to open the file — not guaranteed every session, per
Claude Code's own docs. Replaced with the sentineled @AGENTS.md import
ak setup --project already generates for fresh projects, so this repo's
own dogfooding matches what the tool produces.

ak setup --project's reconciliation only fills in the @AGENTS.md
reference when CLAUDE.md is empty; a non-empty hand-authored CLAUDE.md
(like this repo had) is left untouched forever, even with the same
stale prose pattern. Added detection for that known-unreliable pointer
(project-guidance.mjs) and an additive, idempotent migration that adds
the reliable import alongside the existing prose without deleting it —
wired into both ak setup --project and ak sync, since setup only runs
once per project and sync is how an already-set-up project would ever
see this fix.

Also documents a Conventional-Commits-style issue title standard in
AGENTS.md (feat/fix/chore/... plus tracking/research) and retitles the
13 currently-open GitHub issues to conform.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The CI failure on PR #260 (ubuntu-latest, node 26) was unrelated to that
PR's diff: tests/kit/upstream-watch-ledger-branch.test.mjs crashed with
an uncaught "Error: write EPIPE", reported as async activity after the
test had already ended.

Root cause: runWithInput spawns git with stdio: ['pipe', 'pipe', 'pipe']
and writes to child.stdin, but never attached an 'error' listener to
that stream. A command that exits before draining stdin (e.g. `git
hash-object -w --stdin` on an empty blob) closes the pipe's read end;
the next write then fails with EPIPE, which Node raises as an unhandled
stream error rather than a promise rejection — an uncaughtException
that can surface asynchronously, attributed to whatever test happens to
be running at that moment. The real outcome was already available via
the 'close' event, so the write failure itself is safe to ignore.

Added a regression test that reliably reproduces this without CI-only
timing: a payload larger than the OS pipe buffer forces the write to
block on drain long enough for a child that exits immediately to land
mid-write, every run. Verified failing before the fix (3/3 runs) and
passing after (3/3 runs).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pacphi
pacphi merged commit ad0170d into main Sep 28, 2026
18 checks passed
@pacphi
pacphi deleted the fix/claude-agents-md-consistency branch September 28, 2026 23:29
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