Policies
Build reusable decisions and execution checks with the L3 policy framework.
A policy is a named unit of decision logic. It can observe a frame, propose an action, check an execution request, or combine those responsibilities. The L3 frame scope provides the framework as modules.policies.
The framework does not automatically discover your policy objects. Your L3 script supplies an array and calls the frame runner and intent checker. That makes the set of participating policies explicit.
Three terms to keep separate
| Term | Meaning |
|---|---|
| Policy | An object with an ID, description, declared intent kinds, and optional hooks |
| Policy module | A reusable factory or group of policy definitions you compose in your script |
| Intent | Either a policy's proposed action or an execution request being checked; the shapes differ |
An SJS helper such as pureSides is another kind of reusable module: it returns decision data for a strategy. It is not automatically an L3 policy. See Using modules.
Build your first policy stack
Follow these pages in order:
- Getting started: install a complete deterministic quantity guard.
- Defining a policy: understand its fields, hooks, and return values.
- Requirements: prepare data, algorithms, and source placement.
- Defining a module: turn the guard into a reusable factory.
- Using modules: compose instances and consume injected helpers.
- Intents: propose actions, resolve competition, and gate requests.
- State and lifecycle: own state, timing, and diagnostics.
- Debugging: trace missing decisions and rejected actions.
- Examples: add a frame-driven close policy and inspect its behavior.
Scope of these guides
These pages describe the shared L3 policy framework and show JavaScript that belongs in the L3 editor unless marked otherwise. They do not require an AI provider. Existing indicators and primitives remain the reference for their individual parameters.
Use the engine diagram to see how policies fit into the wider execution flow.