Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cad0p/pi-steering-hooks/llms.txt
Use this file to discover all available pages before exploring further.
git commit --amend rewrites the last commit’s SHA. That is occasionally useful in a solo workflow, but it creates real problems in review-driven environments: reviewers tracking diffs across pushes lose the SHA anchor for per-line comments, git bisect and git blame results become harder to read, and the amended commit presents as a brand-new revision with no continuity to the previous one. The no-amend rule pack blocks --amend globally so the agent never uses it as a reflexive “clean up the last commit” shortcut.
If you need to fix the content or message of the last commit, the clean alternative is a follow-up commit — git commit -m "fix: ..." — and a squash-merge at the end of review to collapse the chain.
Configuration
DEFAULT_RULES.
The pre-subcommand flag slot
The pattern^git\b(?:\s+-{1,2}[A-Za-z]\S*(?:\s+\S+)?)*\s+commit\b handles git flags that appear before the subcommand:
git -C /path commit --amend— changes the working directory before runningcommitgit -c key=val commit --amend— sets a config value for this invocationgit --git-dir=/x commit --amend— overrides the repository path
sh -c 'git commit --amend' and sudo git commit --amend at the extraction layer, so the regex itself does not need to encode those forms.
cwd-scoped variant
Some teams want to apply the rule selectively — for example, a monorepo where some sub-projects enforce linear history and others are more permissive. Thewhen.cwd clause makes the rule apply only when the effective working directory of the extracted command matches a given pattern.
when.cwd is that it tests against the effective cwd of each extracted command, not the session’s working directory. A command like cd /home/me/projects/personal/site && git commit --amend, run from a completely different session directory, is still caught because the AST walker resolves the cd before evaluating the cwd predicate. In TypeScript form, the same clause is:
Adversarial matrix
| Command | Result |
|---|---|
git commit --amend | 🚫 blocked |
git commit --amend -m "fix" | 🚫 blocked |
git -C /path commit --amend | 🚫 blocked |
git -c user.email=x commit --amend | 🚫 blocked |
sh -c 'git commit --amend' | 🚫 blocked |
git commit -m "fix: typo" | ✅ allowed |
git commit --no-edit | ✅ allowed |
echo 'git commit --amend' | ✅ allowed |
Install
steering.ts and add a when.cwd clause inline on the rule. The JSON form (steering.cwd-scoped.json) is provided as a migration reference and can be converted with: