Handling intents
Return explicit decisions and account for request kinds, sources, and delegated operations.
An execution intent describes the operation being checked, its source, and relevant options. The exact path depends on the execution method and runtime.
Inspect the request kind
Common checks include place_order, modify_order, cancel_order, cancel_all_orders, close_position, and close_all_positions. Their options are not interchangeable: placement can supply an order, while close operations can supply a position or positions.
Define which kinds your guard handles and how it treats the others. Do not assume every kind declared in a type is invoked by every runtime method.
Return a Boolean deliberately
The current L3 runtime rejects when the hook result is literal false. A forgotten return, null, or an object such as { allowed: false } does not reject through that direct hook contract.
Return true or false explicitly. Policy objects use their own result shapes internally, but the outer L3 intent export must return the resolved Boolean.
Source rules
Ordinary SJS/bot requests use the enabled hook. L3-originated execution bypasses it. Manual requests override the hook decision in the normal runtime path; the recorded allowed and finalAllowed fields can therefore differ.
These rules do not remove warmup checks, broker validation, or every exceptional failure path. In particular, Agent Lab propagates intent exceptions as run failures. Keep sources truthful rather than using them to force acceptance.
Review delegated operations
Shared simulated closing first checks a close intent, removes matching orders, and then delegates to placement. The placement gets its own check. A per-request quantity guard can allow the close-kind check but reject its closing order.
The most recent decision record may describe that delegated call. Inspect kind, source, and options when reading it rather than assuming one decision per strategy signal.
Continue with state.