EXTEND
Hooks
Hooks are your own commands, run by Uno at fixed points in a turn. They are how you make something happen every time, rather than when the model remembers.
IN ONE LINEClaude Code's hook contract: JSON on stdin, exit code 2 blocks. Five events. Hooks can only make things stricter.
{
"hooks": {
"PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "~/bin/no-rm.sh", "timeout": 10 }] }],
"PostToolUse": [{ "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "npx prettier --write \"$(jq -r .tool_input.path)\"" }] }]
}
}
#!/bin/sh
# ~/bin/no-rm.sh: refuse any shell command that contains rm -rf
if jq -r .tool_input.command | grep -q 'rm -rf'; then
echo "rm -rf is not allowed here; delete files one by one" >&2
exit 2
fi
| Event | When | Exit 2, or "decision": "block" |
|---|---|---|
PreToolUse | before a tool runs | the call is not run; the reason reaches the model |
PostToolUse | after it ran | the result is marked as an error, with the reason |
UserPromptSubmit | when you send a prompt | the prompt is not sent; you see why |
Stop | when the model is about to finish | it carries on with the reason, at most three times |
SessionStart | once per run | nothing to block; output is added as context |
- Hooks live in
~/.config/uno/settings.json,.uno/settings.jsonor.claude/settings.json; project ones only afteruno trust. - Matchers use Claude Code's tool names:
Bashisbash,Editcoverseditandapply_patch. Uno's edit input ispathandedits, notfile_path. - A
PreToolUsehook that times out or cannot start blocks the call. Default timeout 30 s. - Hooks run outside the sandbox, in the project folder, without your API keys.
Use cases
Format on every edit
PostToolUse on Edit|Write runs your formatter. No more "please run prettier".
"matcher": "Edit|Write"Don't stop with red tests
A Stop hook runs the tests and blocks with the failures, so Uno keeps going.
"Stop": [{ … "command": "./check.sh" }]Company policy
PreToolUse checks every command against your list, in your language.
"matcher": "Bash"Fresh context at start
SessionStart prints today's on-call notes or open incidents into the conversation.
"SessionStart": [ … ]DESIGN DECISION · D10
Claude Code's contract, so existing hooks work unchanged. Unlike Claude Code, a slow or broken PreToolUse hook blocks rather than lets the call through: a policy check that does not answer is no policy. And a hook can only tighten: allow from a hook changes nothing.