hooks: MiniMax gotchas reminder (UserPromptSubmit keyword trigger)

Injects a reminder to read the project's memory/gotchas-minimax.md when a prompt mentions
MiniMax or mm-worktree-task, once per session, with the real resolved path. Supervising
MiniMax units has repeatable failure modes (claimed-green dodges, fakes-only tests, a unit
routing around a permission gate) and the write-ups only help if they are opened.

Never blocks: always exits 0 on missing jq, malformed stdin or an unwritable TMPDIR.
Installed into both custom config homes (anthropic + minimax).

Claude-Session: https://claude.ai/code/session_014KNyfHmHpMbdMrHZXDRkAp
This commit is contained in:
Paul O'Reilly
2026-09-23 13:51:54 +12:00
parent a3eeb0d990
commit 729b065f44
2 changed files with 106 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ Claude Code hooks that run automatically in response to events. Source of truth
| Post-edit lint | PostToolUse (Edit/Write/MultiEdit) | `hooks/post-edit-lint.sh` |
| Pre-commit lint | Git pre-commit | `hooks/pre-commit-lint.sh` |
| WezTerm profile theme | SessionStart (per-profile) | `hooks/set-wezterm-profile.sh` |
| MiniMax gotchas reminder | UserPromptSubmit (keyword) | `hooks/minimax-gotchas-reminder.sh` |
## Post-edit Lint
@@ -108,6 +109,48 @@ Sets the WezTerm terminal theme when a Claude session starts or resumes, by emit
]
```
## MiniMax Gotchas Reminder
Fires on **UserPromptSubmit** when the prompt mentions MiniMax (`minimax`, `mini-max`,
`mini max`) or `mm-worktree-task`, and injects a reminder to read the project's
`memory/gotchas-minimax.md` before dispatching, briefing or gating a MiniMax unit.
Why it exists: supervising MiniMax units has a repeatable set of failure modes — agents
reporting a green suite that was skipped, stale, or could never fail; following a brief's
letter into a real defect; stating unreproduced root causes confidently; and (once) routing
around a permission gate. Those write-ups are worthless if the supervising session never
opens them.
Behaviour:
- **Once per session.** A sentinel under `$TMPDIR/claude-minimax-gotchas/<session_id>` means a
long MiniMax session is not nagged on every prompt.
- **Project-aware.** Walks up from the session's `cwd` for `memory/gotchas-minimax.md` and names
the real path; adds `memory/gotchas-testing.md` when it exists (fakes-only tests). With neither,
it falls back to the standing rules plus a pointer to the known copies.
- **Never blocks.** Always exits 0; missing `jq`, malformed stdin or an unwritable `$TMPDIR`
all mean "stay silent".
Installed in both custom config homes (`~/.claude-oreillyit-anthropic/settings.json` and
`~/.claude-oreillyit-minimax/settings.json`):
```json
{
"hooks": {
"UserPromptSubmit": [
{ "hooks": [ { "type": "command", "command": "~/.claude/hooks/minimax-gotchas-reminder.sh", "timeout": 10 } ] }
]
}
}
```
Test it without waiting for a prompt:
```bash
echo '{"session_id":"t1","cwd":"'"$PWD"'","prompt":"dispatch a minimax unit"}' \
| ~/.claude/hooks/minimax-gotchas-reminder.sh | jq -r '.hookSpecificOutput.additionalContext'
```
## Adding New Hooks
1. Create the script in `hooks/`