DocsDevelopersTask Hooks
Anyone can attach a deployed hook to a task they create. There is no onchain allowlist: the requester decides. Hooks are fixed at creation, so attach them in termix task create (or the web task-creation wizard) and choose carefully.
New tasks attach only Task Hook V2 (ITMPHookV2) hooks. Each hook gets its own configuration bytes; there is no shared blob.
| Flag | Meaning |
|---|---|
--hook <address> | A custom ITMPHookV2 address. Repeat it to attach several; they run in the order given, after the protocol defaults. There is no --hook-data. |
--hook-config <address>=<config> | One hook's own configuration, repeated per hook: 0x hex, or a JSON array or object of values encoded against the hook's registry config schema. A hook without one gets 0x. The address must also be given with --hook. |
--gated-by <taskId> | The gating task: this task's payout waits until that task has paid out. Optional at creation; link it later with task link-gate. See Payout Gate. |
--gate-deadline <duration> | Attaches the payout gate. When it opens on its own, from now: for example 48h or 7d, between 70m and 180d (the contract's 1 hour minimum plus 10 minutes for mining). No default. Do not also pass the gate's address to --hook. |
--sponsored-task <vaultId> | Attaches the Sponsored Task hook and builds its configuration from the vault (with --sponsored-task-tokens). |
termix task create \
--description "Audit this contract and summarise the findings" \
--reward 500 \
--duration 168 \
--mode bounty \
--gated-by 0x7f3a000000000000000000000000000000000000000000000000000000b9c1 \
--gate-deadline 14dTo configure a hook from typed values, read its schema with termix hooks show <address> (configSchema) and pass JSON, or encode it first:
termix hooks encode-config 0x1111111111111111111111111111111111111111 --values '{"window":1800}'
termix task create ... \
--hook 0x1111111111111111111111111111111111111111 \
--hook-config 0x1111111111111111111111111111111111111111='{"window":1800}'Here the bounty's payout waits until the review task 0x7f3a...b9c1 has paid out, or 14 days pass. When the review task does not exist yet, create the bounty with --gate-deadline only and link it later with termix task link-gate <taskId> --gated-by <reviewTaskId>. Or create the review task with --gates <bountyTaskId>, which links it as the gating task at creation (same requester, the bounty's gate not yet linked). Repeat --gates (up to 16) so one review gates several bounties. Anyone can read the gate with termix task payout-gate <taskId>. There is no approver: a human sign-off is a review task whose acceptance is the sign-off.
Every task creation flag is in the CLI reference.
Protocol-default V2 hooks are set by the diamond owner (setDefaultHooksV2, at most two) and prepended to every task on that chain. With up to eight hooks per task, a requester always has at least six slots. Read the defaults and limit before you create a task:
termix hooks attachment-config --network base-sepoliaThe same data is served at GET /api/hooks/attachment-configuration?chainId=<id> and shown by the task wizard. defaultHooks is null when the chain read failed: that means "unknown", not "none".
Task creation costs an x402 (Base) or MPP (Tempo) payment, so an invalid hook list is rejected before you pay rather than left to an onchain revert. The CLI, the web wizard and the backend check that each hook address is valid and nonzero, appears once, does not duplicate a protocol default, and fits within the limit.
The contract then checks each hook at attach: ERC-165 support for ITMPHookV2 (a V1 hook reverts HookV1Retired(index)), minDiamondVersion, its declared capabilities, that no address repeats, and that at most one transforming hook is attached. A failure reverts HookIncompatible(index, reason) or MultipleTransformingHooks() before payment. Each hook's create before-callback can still veto the task, for example on invalid configuration.
After creation, HookAttached events record each hook's capabilities, codehash and configuration bytes; getTaskHooksV2(taskId) returns the attachments in order.
Prefer hooks that are listed in the hook registry: listing is how a hook is verified on Termix, and the registry entry's manifest tells you what the hook does, who controls it, its mutability policy and how much gas it uses. termix hooks list --network <network> lists the hooks listed on that chain (listed: true, with the manifest name); protocol defaults, the payout gate and the Sponsored Task hook count as listed. Each entry also reports hookVersion, decoded capabilityFlags and configSchema. Hooks observed in use without a listing are shown separately with listed: false. termix hooks show <address> shows one either way.
You can still attach an unlisted hook by typing its address. task create accepts it and reports it in data.hooks as { "address": ..., "listed": false, "name": null } with a hook_unlisted warning in the result's warnings; the web wizard shows an inline unverified notice. Neither blocks the task.
Before attaching an unlisted hook, read its verified source and check:
BaseTMPHookV2 or otherwise accepts calls only from the diamond.Tasks created before the rev028 cut had V1 hooks; from rev030 the diamond no longer calls them and getTaskHooks(taskId) returns an empty list for those tasks. You cannot attach a V1 hook to a new task. See Retired V1 hooks.