What the plugin's hooks do
They act only in a project with a real .marvin/ directory. Everywhere else they exit silently.
The hooks
| Hook | Runs on | What it does |
|---|---|---|
| Session start | SessionStart | Flags version drift and kit-file drift (manifest); adds the kit core when no mod does; adds the update rules under another output style; prints the resource gate's path (Resource gate: bash '…'). |
User-update gateupdate_gate: advise | block | off | UserPromptSubmit, Stop | Checks Marvin's messages against the update format. |
| Sub-agent rules | SubagentStart | Gives every marvin:* persona a constant rules block. |
| Sub-agent gate | SubagentStop | Sends back, once, a final message missing a reserved line or over 25 lines. |
| Brief lint | PreToolUse on Agent | Advises when a brief lacks its run-report path, FINAL MESSAGE spec, DoD or DATA: line (the data boundary). |
Context laddercontext_window_ktokens | PostToolUse, UserPromptSubmit | Speaks at 70 / 80 / 90 % of the window and the 400k / 700k budgets. |
Worktree marker and sweepworktree_sweep: on | check | off | SubagentStop, SessionStart | Marks agent worktrees as Marvin's, then removes finished marked ones. |
| Run-state sync | SessionStart, PostToolUse, SubagentStop, Stop | Keeps ledgers, briefs and run reports in .marvin/runs/<session>/<KEY>/. |
| Docker sweep | SessionStart | Removes throwaway Docker resources whose worktree is gone. |
Docker lintdocker_lint: advise | off | PreToolUse on Bash | Advises when a Docker command lacks Marvin's labels or a project name. |
Resource gateresource_gate: block | advise | off | PreToolUse on Bash | Holds a heavy command (tests, a Docker build or stack) run outside the machine-wide queue, and says how to run it through the gate. |
Ticket lintticket_lint: advise | block | off | PreToolUse on tracker writes | Checks a ticket's labels against the registry before it is written. |
Persona scopepersona_scope: block | advise | off | PreToolUse on writes, Bash, Read, Grep, Glob | Keeps validators and the researcher to their run folder, and every marvin:* sub-agent off agent config and credentials. File tools are checked fully; Bash is best-effort (what it covers). |
Each mode key lives in .marvin/PROJECT-INFO.md and is listed on Settings.
What they never do
- Echo message, command or ticket content.
- Block on a parse failure, except the persona scope: a command it cannot read that names a guarded path is refused.
- Touch a worktree Marvin did not mark, or a running container.
- Write through a symlink under
.marvin/.
Turning them off
A hook with a mode key turns off with off. Otherwise disable the whole plugin with /plugin disable marvin, or all hooks with "disableAllHooks": true. Editing hooks/hooks.json in the plugin cache does not survive an update.
Details: hooks/hooks.json, worktrees.md, ticket-filing.md, tidying.md.