Chinese content用 pre-commit hook 限制文件不超过 5000 token,防止 Agent 改不动大文件
Matt Pocock 提了个实用招:让 Agent 自己写个 git hook,文件超 5000 token 就不让提交,报错还教你怎么拆,代码库干净多了。
Matt Pocock 提了个实用招:让 Agent 自己写个 git hook,文件超 5000 token 就不让提交,报错还教你怎么拆,代码库干净多了。
Instructions in AGENTS.md are advisory; a git pre-commit hook turns them into a hard gate the agent cannot bypass, closing the gap between documented and enforced conventions. Developers running Claude Code, Cursor or similar coding agents can adapt this pattern to any team rule they want enforced automatically. It is a concrete alternative to prompt-based guardrails that quietly degrade over time.