Repository navigation
fix(scripts): refuse CLAUDE.md promotion when a repo guards it by literal path - #1346
Closed
wongsuwarn wants to merge 1 commit into
Closed
wongsuwarn wants to merge 1 commit into
wongsuwarn wants to merge 1 commit into
Conversation
…eral path A repo whose own automation runs unattended agent turns against itself can hardcode a --disallowedTools entry naming CLAUDE.md to stop stray edits to its own constitution. Promoting CLAUDE.md to AGENTS.md in that repo would move the real content out while the guard kept matching only the now-empty symlink, silently defeating the protection - caught and reverted by hand in the brain vault (2026-07-30) after exactly this happened. Detection is narrow and scoped to the one confirmed pattern: a git-tracked file mentioning both disallowedTools and CLAUDE.md together. It is not general guard-mechanism detection.
Author
|
Opened in error against kunchenguid/firstmate. This was meant for our own firstmate (wongsuwarn/firstmate), where the change already landed. Not an upstream contribution. Closing; can be reopened if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fm-ensure-agents-md.shpromotes a bareCLAUDE.mdintoAGENTS.md(with a symlink left behind) whenever a project has onlyCLAUDE.mdand noAGENTS.mdyet.--disallowedToolsentry namingCLAUDE.mdby literal path (to stop unattended agent turns from editing their own "constitution"), promotion silently defeats that protection: the real content moves toAGENTS.md, but the guard keeps matching only the now-emptyCLAUDE.mdsymlink.has_disallowed_tools_guard_referencing_claude) that refuses promotion when a git-tracked file mentions bothdisallowedToolsandCLAUDE.mdtogether, with an actionable error explaining the fix (point the guard atAGENTS.mdinstead, or promote manually).Test plan
bin/fm-lint.sh bin/fm-ensure-agents-md.sh tests/fm-ensure-agents-md.test.sh(ShellCheck 0.11.0, pinned)bash tests/fm-ensure-agents-md.test.sh- 11/11 passing, including two new tests: one confirming refusal when a--disallowedToolsguard namesCLAUDE.md, one confirming an ordinary README/CONTRIBUTING mention ofCLAUDE.mdalone does not false-trip the heuristic