Docs › Loops
Hooks
A command your agents run when something happens in their sessions.
Where Settings › Loops › Hooks
Agents use it
1 min read
How it works
- Open Settings, then Loops, and choose New hook from the Hooks heading's menu.
- Pick When it runs: Before a tool runs, After a tool runs, When you send a message, When a session starts, When a session ends or When a turn ends.
- For a tool's event, For tools matching narrows it to some tools. Left empty, it runs for Every tool.
- Write the command under Run, pick the agents it is for under Available to, and press Create.
Good to know
- A hook is stopped after 30 seconds. Before a tool runs, exit code 2 stops the tool.
- A hook an agent adds is written nowhere until you allow it. A toast says A hook is waiting for you, and its row says Added by an agent, with Review and Allow.
- Hooks are kept in each agent's own files in your home folder, and Origami keeps no copy.