agnt-prune
Prune AGENTS.md / CLAUDE.md so it only contains non-obvious, failure-prone decisions and hidden constraints.
steps
- Find the project root (
.git,package.json,go.mod, or current working directory) - Look for
AGENTS.mdorCLAUDE.md(resolve symlinks). If neither exists, tell the user and stop - Read the full file content
- Read the codebase to understand what can be inferred from the code itself
- Apply this pruning rule to the content:
Remove everything from the file that can be inferred from the codebase, including high-level architecture descriptions, file trees, CLI usage, build commands, and examples of standard behavior. Keep only non-obvious, failure-prone decisions and hidden constraints that are not explicit in the code but would cause mistakes if misunderstood. The final file should read like a sharp-edges and gotchas document, not a project overview.
- Preserve the header comment if it exists:
<!-- Do not edit or remove this section -->
This document exists for non-obvious, error-prone shortcomings in the codebase, the model, or the tooling that an agent cannot figure out by reading the code alone. No architecture overviews, file trees, build commands, or standard behavior. When you encounter something that belongs here, first consider whether a code change could eliminate it and suggest that to the user. Only document it here if it can't be reasonably fixed.
---
- If the header comment does not exist, add it at the top of the file
- Show the user a diff of what will be removed and ask for confirmation before writing
- Write the pruned content back to the same file