fix(instruction-placement): walk nested AGENTS.md paths and scan frontmatter hooks in the shim rule - #5823
Conversation
…tmatter hooks in the shim rule Condition A now checks every directory between the repository root and a nested AGENTS.md, with the ip_entry_points_on_path walk, so an intermediate CLAUDE.local.md keeps the shims. Condition F now scans skill, command and agent hooks: frontmatter for InstructionsLoaded in the repository, config root, plugins root and managed settings directory; an unreadable scope or a source not on disk keeps the shim. Closes #5794 Closes #5800 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 59s —— View job Security review: no issues found
Scope reviewed ( Findings: none. This PR is documentation and test-fixture changes to the
Instruction-surface lens: this diff only tightens conditions A and F (widens what counts as a No GitHub Actions workflow files are touched. |
|
Claude finished @kyle-sexton's task in 4m 50s —— View job Code review complete
Scope reviewed (per the authoritative 5-file list): What I checked directly (not just author-claimed):
Not independently verified: this sandbox's permission system required approval to execute Findings: none blocking. This is a tightly-scoped, well-cross-referenced doc + test fix. The two conditions (A's nested-path walk, F's frontmatter scan) match the upstream doc quotes cited in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8279ae8075
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…le roots in the shim rule Condition F's frontmatter scan now takes each --add-dir directory the operator names as an expected root (the permissions page says --add-dir loads .claude/skills, .claude/commands and .claude/agents), and an unnamed --add-dir set fails F. Optional roots are skipped only when provably absent; an expected or optional root behind a directory that cannot be searched prints UNREADABLE instead of being skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renumber instruction-placement to 0.18.4 above main's 0.18.3, and recast the two new sources.md records into main's pointer-record shape (our decision, a pointer, as-of, recheck trigger; no page text stored). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @kyle-sexton's task in 3m 6s —— View job Code review complete
Scope reviewed: diff What I checked directly:
Not independently verified (no tool execution available to me in this run): the PR body's test-suite and fixture-run claims, and this session could not execute Findings: none blocking. This follow-up commit closes both open Codex P2 comments with a principled fix (expected-vs-optional root distinction, existence vs. provable-absence distinction) rather than a surface patch, and I didn't find a new gap in the updated logic. |
|
Claude finished @kyle-sexton's task in 1m 4s —— View job Security review: no issues found
Scope reviewed ( Findings: none. This is documentation + test-fixture changes to the This head ( Instruction-surface lens: this diff only tightens conditions A and F (widens what counts as a No GitHub Actions workflow files are touched. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d94e3f147
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… mechanics behind pointers fm_scan resolves each root to its canonical directory (cd -P; pwd -P) and scans it with find -L, so a symlinked --add-dir or plugin root and a linked skill are scanned at their targets. A root that cannot be resolved, a dangling link (optional roots included), or a tree find cannot finish, a symlink loop included, prints UNREADABLE. The frontmatter-hooks and nested-path records, and the matching shim-droppable.md prose, now state only the rule's decision plus live pointers, with no restated upstream hook or loader mechanics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Claude finished @kyle-sexton's task in 3m 12s —— View job Security review: no issues found
Scope reviewed ( Findings: none. This remains documentation + test-fixture changes to the What's new since the last reviewed head (
Instruction-surface lens: re-checked against Execution note: this sandbox's permission system declined approval for filesystem operations No GitHub Actions workflow files are touched. |
|
Claude finished @kyle-sexton's task in 3m 55s —— View job Code review complete
Scope reviewed: What I checked directly:
Not independently verified: PR-body-claimed fixture runs for this commit's change (dangling-link, symlink-loop, chmod-000 cases) are author-claimed; I verified by hand-tracing the shell logic against Findings: none blocking. This commit closes both remaining Codex findings with logic that holds up under hand-tracing, and I did not find a new gap it introduces. |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closes #5794
Closes #5800
Summary
The
migrateskill's shim-droppable rule (conditions A to F inplugins/instruction-placement/skills/migrate/reference/shim-droppable.md) missed two blockers,both found by Codex on #5765:
CLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdin a directorybetween the repository root and a nested
AGENTS.md(for examplesvc/CLAUDE.local.mdabovesvc/deep/AGENTS.md) was not checked, so the rule could recommend dropping a shim it should keep.InstructionsLoadedhooks declared in skill, command or agenthooks:frontmatter were not inventoried.Current docs confirm frontmatter hooks can register
InstructionsLoaded, so #5794 is a real fix,not a no-change close. hooks.md, "Hooks in skills and agents": "hooks can be defined directly in
skills and subagents using frontmatter, in the same configuration format as settings-based hooks".
sub-agents.md, "Hooks in subagent frontmatter": "All hook events are supported." Skill hooks are
registered on invocation and run "for the rest of the session". Subagent hooks run while the
subagent runs, or for the whole session under
--agent.Fix
shim-droppable.mdrow A now covers every directory from the root to each nestedAGENTS.md.A new "The nested path walk for condition A" section runs
ip_entry_points_on_path(
scripts/lib/discover.sh:279-288) for each nestedAGENTS.md, adds the readability check thatfunction lacks, and includes the
svc/CLAUDE.local.mdworked example. A non-shimFOUNDrow,or any
UNREADABLErow, fails A.fm_scansnippet that reads only the frontmatter ofskills/*/SKILL.md,commands/*.mdandagents/**/*.mdacross the repository (root and nested.claude/),<config>(which honorsCLAUDE_CONFIG_DIR),<plugins>, the managed settings directory and per-session plugindirectories. An unreadable scope prints
UNREADABLE. That row, aHIT, and any source not ondisk here (claude.ai-synced skills,
--agentsJSON, managed-deployed subagents,--plugin-url)fail F until the operator answers for it.
AGENTS.md, per mode" verdict names the full path.sources.mdgains two four-part records: "Frontmatter hooks andInstructionsLoaded" (hooks,sub-agents and skills pages, fetched 2026-10-02) and "Blockers between the root and a nested
AGENTS.md" (memory page, fetched 2026-10-02). The memory page does not say whether anintermediate file stops a nested load, so the rule treats it as a blocker (fail-closed).
cutover-check.shandremove-shims.shgrade othergates), so the rule text changes. The walk the rule uses as its model gets a regression test.
Verification
discover.test.sh: 3 new cases.ip_entry_points_on_pathlists every entry point fromsvc/deepto the root, nearest first; it reports the intermediatesvc/CLAUDE.local.md; itleaves out a sibling directory's file. 57 cases, 0 failures.
scripts/affected-tests.sh --run: discover, cutover-check (73) and remove-shims (87) all pass.FOUND .../svc/CLAUDE.local.md.fm_scanhit a skill and a CRLF agent that declareInstructionsLoaded, ignored a body-onlymention, and printed
UNREADABLEfor achmod 000root. Over this machine's real<config>and plugins roots it found no hits.
markdownlint-cli2on the changed markdown: 0 issues.check-purged-em-dashes.sh: clean.check-changed-skills.sh origin/main: migrate PASS (SKILL.md unchanged at 472 lines).validate-plugin-contracts.mjs: passes.check-changelog-parity.sh --check-bump origin/mainand
--check-order: pass.Related
🤖 Generated with Claude Code