refactor: both tools import the same fragments; scope code comments by path
Codex reads ~/.codex/AGENTS.md, not ~/.agents/AGENTS.md, so the file generated there last commit was inert. Both tools support @path imports, which removes the generate-and-drift step entirely. code-comments.md moves to ~/.claude/rules/ with paths frontmatter, so its 24 lines load only when a source file is read.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"""PostToolUse nudge for code comments: Write / Edit / MultiEdit.
|
||||
|
||||
Lints ONLY the newly-added text against the "Code comments" contract in
|
||||
~/.claude/writing.md, so legacy files are not re-flagged on every touch.
|
||||
~/.claude/rules/code-comments.md, so legacy files are not re-flagged on every touch.
|
||||
|
||||
Exit 0 = silent. Exit 2 = stderr goes back to Claude as feedback; the edit is
|
||||
already applied, so this is a revise-it nudge, not a block.
|
||||
@@ -157,7 +157,7 @@ def main():
|
||||
name = os.path.basename(path)
|
||||
|
||||
if problems:
|
||||
lines = [f"Comment contract (~/.claude/writing.md) — {name}:", ""]
|
||||
lines = [f"Comment contract (~/.claude/rules/code-comments.md) — {name}:", ""]
|
||||
lines += [f" - {p}" for p in problems + notes]
|
||||
lines += ["", "Trim what you just wrote, or say why it stays."]
|
||||
print("\n".join(lines), file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user