Adds a predicate to this session's registry. Persisted rules refer to the
predicate by id, and an installed policy pins its version. No R code is
persisted: a session must register a compatible implementation before rules
that use it can be satisfied. A predicate that is not registered, or that is
registered with a different version than the pinned one, fails at
evaluation and produces a finding.
Arguments
- id
Dotted predicate id, for example
"mylab.prereg_match". Undotted ids are reserved for built-in predicates.- fn
A function
fn(subject, args)returningTRUEorFALSE.subjectislist(state, action, candidate, actor), wherestateis the research state before the action.argsholds the condition's arguments.- arguments
Argument names every condition must supply, with a non-
NULLvalue.- version
Implementation version recorded when a policy is installed.
- replace
Replace an existing registration with the same
id.- optional
Argument names a condition may supply.
Details
A host that exposes the research interface to agents must control predicate registration as well as actor identity. This is a protocol, not a sandbox.
Examples
bg_register_rule_predicate(
"mylab.has_label",
function(subject, args) identical(subject$action$label, args$label),
arguments = "label"
)