Skip to main content

Module rule_of_two

Module rule_of_two 

Source
Expand description

The Rule of Two, made checkable (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §6.2 and §6.3).

A drone that reads outside text (a pull request title, a CI log, a webhook body, an API response, an agent’s reply) must not let it reach a node that changes the world without a person in between. This reads a graph, before it is turned on, and says which nodes break that. Two rules:

  • Writes outside. An API call that is not a read, a command, an Agent block that may run commands, and a call to another drone are nodes that change things outside AgentMux. One of them may not read a value that is outside text unless an Approval block stands on every path from where that text came in to the node.
  • Where outside text may not go. Never into a header name, the address (scheme and host) of a request that carries a credential or changes something, a Vault credential, the target of a Message or a Task, or the place a command runs, however it got there. It may go into the text of a Message, a Task or a Notify: those say it is data.

What counts as outside text is the engine’s own rule (scheduler::mark_bits), read from the graph instead of a run: the trigger’s fields that its schema does not call clean (payload_schema), and the output of an API call, an Agent, a Message reply, an app query, a command, a callee and an event wait, and whatever a Response, Variables, Transform, For-each or Join makes from them. A Condition, a Once, an Approval, a Task, a Notify and a Spawn give nothing outside. An Approval is the one thing that clears it: a person read the card.

It is conservative. A reference it cannot place on a path counts as unapproved, and nothing here promises a graph that passes is safe, only that it does not skip the person where the spec says the person must be.

Structs§

Finding
One node that breaks a rule, and why, in words for the person.
Flow 🔒
What the check knows about a graph.

Constants§

CALL_DEPTH 🔒
How deep a chain of Drone blocks calling drones is followed.

Functions§

address_of 🔒
The part of a request address that names where it goes: the scheme and the host. The request is made the way a browser reads a URL, so any run of slashes or backslashes after the scheme (https:/x, https:///x) is one //, and a backslash ends the host as a slash does. A delimiter inside a {{reference | filter:arg}}, or a : inside one, does not count.
agents_reading_outside
The Agent blocks of graph that read text from outside with no Approval on the way: the ones the turn-on prompt names.
callee_fields 🔒
What a drone reads as {{trigger.*}} when another drone calls it: the names the caller passes. What a caller passes that is outside text is the caller’s own finding (its Drone block reads it), so these count as clean here.
calls
Whether graph calls the drone id as it is saved now, directly or through the drones it calls (a pinned version is followed as pinned).
check
Every way graph breaks the Rule of Two when its trigger has fields.
check_callees 🔒
check_tree
check, and the same for every drone graph calls, however deep, a pinned version as pinned: moving a graph into a drone it calls does not get it past the rule. A finding in a callee names it.
forbidden_places 🔒
The places in node that outside text may not choose, each with what it is.
join 🔒
kind_of 🔒
refs_in 🔒
Every {{reference}} in text, as the path it names (a filter after | is not part of it).
refuse
The findings as one message for a refusal, or Ok when there are none.
scheme_end 🔒
Where the scheme ends: just after the first : that is not inside a {{reference}}.
sends_credential 🔒
Whether a request carries a credential: its auth, a header that names one (Authorization, a key, a token, a cookie) or whose value reads the environment or the Vault, or any text in it that reads them.
texts_of 🔒
Every text a node holds, with the name of the field it is in.
writes_outside 🔒
Whether node changes things outside AgentMux. A Drone block is counted: what the callee does is not known here.

Type Aliases§

LoadDrone
A drone load finds by id (and saved version): its name and graph.