UNOUNOCODE

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.
SessionStartonce per run UserPromptSubmitcan drop the prompt PreToolUsecan block the call PostToolUsecan flag the result Stopcan say "keep going" no-rm.sh → exit 2
The turn pauses at each hook. A blocking hook's reason goes to the model, which tries something else.
{
  "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
EventWhenExit 2, or "decision": "block"
PreToolUsebefore a tool runsthe call is not run; the reason reaches the model
PostToolUseafter it ranthe result is marked as an error, with the reason
UserPromptSubmitwhen you send a promptthe prompt is not sent; you see why
Stopwhen the model is about to finishit carries on with the reason, at most three times
SessionStartonce per runnothing to block; output is added as context
  • Hooks live in ~/.config/uno/settings.json, .uno/settings.json or .claude/settings.json; project ones only after uno trust.
  • Matchers use Claude Code's tool names: Bash is bash, Edit covers edit and apply_patch. Uno's edit input is path and edits, not file_path.
  • A PreToolUse hook 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.