Presets
A preset returns a complete Rule — id, description, formula — from a name and the thing it is about. This is the layer
most rule sets are written entirely in.
requireBefore
Section titled “requireBefore”Presets.requireBefore('restartService', 'queryMetrics')restartService may not run before queryMetrics has returned. The first argument is read as a call and the second as a
result, because “before” means the prerequisite finished.
the formula it compiles to
G(toolCall(restartService) -> O toolResult(queryMetrics))requireHumanBefore
Section titled “requireHumanBefore”Presets.requireHumanBefore('restartService')A person must have been asked, and must have answered, before this runs.
the formula it compiles to
G(toolCall(restartService) -> O runResume)It is written against the run’s lifecycle rather than against a tool on purpose: a completed human approval is a resume, and there is no tool an agent can call to manufacture one.
neverAfter
Section titled “neverAfter”Presets.neverAfter('publish', 'edit')Once publish has run, edit never may.
the formula it compiles to
G(O toolCall(publish) -> !toolCall(edit))respondWithin
Section titled “respondWithin”Presets.respondWithin('fetch', 'fetch', { within: 3 })Every fetch call is answered within three events. The window defaults to DEFAULT_WITHIN, which is 20.
the formula it compiles to
G(toolCall(fetch) -> F<=3 toolResult(fetch))Passing the tool instead of its name
Section titled “Passing the tool instead of its name”Every preset takes the tool itself wherever it takes a name:
Presets.requireBefore(restartService, queryMetrics)The rule is identical — same formula, same generated id — but a typo or a rename is now a compile error rather than a rule that quietly stops matching. Propositions is the argument for preferring it, and the cases where a string is still the right answer.
Passing a proposition instead of a name
Section titled “Passing a proposition instead of a name”Where the default reading is not what you mean, hand the preset a proposition and it uses that:
Presets.requireHumanBefore(P.stepStart('restartService'))the formula it compiles to
G(stepStart(restartService) -> O runResume)This is how a rule about a step rather than a tool is written, and how a payload condition gets into a preset:
P.toolCall('refund', { amount: P.gt(1000) }) reads the same way everywhere a name does.
Options
Section titled “Options”Every preset takes { id, description, mode }.
Presets.requireBefore('restartService', 'queryMetrics', { id: 'SEC-01', description: 'restartService may not run before queryMetrics has returned', mode: 'deny',})Without an id, one is generated — PRESET/require-before/restartService,
PRESET/never-after/publish-edit — stable and readable, so a rule you never named still says what it is in a report.
Enforcement is never switched on by a preset. A mode arrives only when you ask for one, which means a rule set you have just written cannot stop anything until you have decided it should.