Hooks: running your own scripts around the agent
Shell scripts that fire at points in the agent's lifecycle — formatting after an edit, blocking a dangerous command, logging what happened.
Updated September 2, 2026
Hooks are your scripts, run by the agent at defined points. They are how you enforce something mechanically rather than asking the model to remember it.
Where they live
.toolsxpo/hooks/ in your repository
~/.toolsxpo/hooks/ on your machine
Enable them under Settings → Editor → Hooks. The setting is on by default, but it does nothing until you have written a hook — there is nothing to run.
What they are good for
Formatting after edits. Run your formatter on the changed file so the agent never has to think about style, and never burns a turn fixing it.
Blocking dangerous commands. A hook that inspects a command before it runs can refuse rm -rf, a production deploy, or anything touching a path you care about. A rule asks the model not to; a hook makes it impossible.
Logging. Record what the agent did, for review or audit.
Why a hook beats a rule for enforcement
A rule is advice to a language model. It is followed most of the time.
A hook is code. It runs every time, regardless of what the model intended. For anything where "most of the time" is not good enough, use a hook.
They execute arbitrary code
Hooks run with your permissions. Treat a hook file the way you would treat any script in your repository — review it before enabling, especially in a project you did not write.
This is why hooks do nothing until you create one, and why the setting is worth knowing about even though it is on by default.
See also
Related
Quickstart: your first task with ToolsXpo Code
Install the extension, sign in from your browser, and give the agent its first task — about five minutes end to end.
Choosing a model
What the model picker shows you, why some models are greyed out, and how to search a catalogue of hundreds with filters.
What an agent task costs
How a ToolsXpo Code request is priced, what makes one task cheaper than another, and where to see what you spent.
Agent and scout tiers
Two reserved names — toolsxpo-agent and toolsxpo-scout — that let your workspace decide which model runs, without pinning it into the extension.