Delegated authority / Constitutive Action Kernel
Keep permission attached to the action.
The Kernel is a small Rust library. It sits between the terms and the power to act, and checks that each exact act is fully agreed before anything happens. The decision and what actually happened are recorded separately.
When would I use it?
When your code says yes, and it’s still wrong.
The card can pay, so the room gets booked. Nothing here knows that Alice agreed to stay under €200 a night, or that anything over that needs her yes.
If you have a line like this, and you know a case it gets wrong, that’s when.
If one party sets the rules, does the act, and is the only one who’ll ever ask what happened, an ordinary permission check may be enough. When not to use it →
if card.can_pay(total) {
book(room);
}Why would I use it?
Because a flag doesn’t know what was agreed.
Alice says yes to €220, so you set approved. Then the hotel raises the price to €240. The flag is still true, and the room gets booked.
With the Kernel, her yes belongs to that exact booking, on those exact terms. At €240 she hasn’t said yes, so she’s asked again.
if card.can_pay(total) && booking.approved {
book(room);
}Alice says yes to €220: Permitted
Hotel B raises the price to €240: DecisionRequiredHow would I use it?
Put the check where the booking is made.
That’s the hotel’s desk. Your one if becomes four answers, and only Permitted books the room.
book is the only function that makes a booking, and it checks again before it does. If the booking changed after the answer, it doesn’t go through.
let admission = desk.admit(&booking);
match admission.decision.kind {
Permitted => confirm(desk.book(&booking, &admission)?),
DecisionRequired => ask_alice(&booking),
Prevented => decline(&admission.decision.reasons),
Indeterminate => find_what_is_missing(&admission.decision.reasons),
}The Kernel is the small part.
Most of the work is getting every applicable condition and verified evidence to it. evaluate is the Kernel. snapshot is yours to write, and in this example it’s about 100 lines.
It checks five things. This is one of them: what was checked, the result, the reason, and the evidence it rests on. The evidence is Alice’s terms, and they count only if her signature verifies.
fn admit(&self, proposal: &Proposal) -> Admission {
let (action, snapshot) = self.snapshot(proposal);
evaluate(&action, &snapshot)
}assess(
"cancellation-is-inside-guest-terms",
pass(proposal.free_cancellation || !guest.free_cancellation_required),
"the guest's terms require free cancellation",
&["guest-terms"],
),Run the booking.
You need Rust 1.99 or newer, and a copy of the Kernel. The signatures are really checked. The keys, the list of whose key is whose, the card and the storage are simulated.
The library is in Rust. The pattern isn’t: the check goes wherever the act takes effect, whatever that’s written in.
cargo run --locked --example v1_signed_booking1. Hotel A, €180, free cancellation: Permitted
2. Hotel B, €220, free cancellation: DecisionRequired
3. The agent says yes in Alice's name: DecisionRequired
4. Alice says yes to €220: Permitted
5. Hotel B raises the price to €240: DecisionRequired
6. Hotel C, €150, non-refundable: Prevented
7. A €900 suite, on altered terms: IndeterminateSame Kernel, two sources of authority
Your host decides
who must commit.
The Kernel does not decide where authority comes from. Another example uses a task board, and runs the same task twice, with the same Kernel, signer and adapter. Only the host’s gate profile differs: whether the person bound by a change must accept its exact terms.
Manager control
- Charlie, who manages the board, moves task-7 from Bob to Carol. His signature alone is enough:
Permitted. - He moves her deadline from 1 December to 24 November. It takes effect on his signature alone.
- Carol is committed rather than committing. The profile has no place for her acceptance.
Commitment
- The same signed move is held until Carol accepts the task’s exact terms:
DecisionRequired, thenPermitted. - Charlie’s deadline change is held, because her acceptance covered the old terms. When she refuses it:
Prevented. - A different deadline that she accepts goes through. New terms apply because she committed to them.
cargo run --locked --example v1_authority_sourcesWhere it fits
The application holds
the power to act.
Your agent proposes an action. Your application supplies the conditions and verified evidence, and its adapter dispatches only the admitted effect. The Kernel checks them against the terms, for the exact proposal.
The Kernel checks
- The exact action and its versioned context.
- Required conditions and supplied evidence bindings.
- Supplied acceptance records for the exact proposal and terms.
- Structural links between a decision and a receipt.
Your application supplies
- Authenticated identities and verified evidence.
- The complete set of applicable conditions.
- Controlled credentials, dispatch and durable reservation.
- Truthful outcomes, replay handling and recovery.
The Kernel’s API is constitutive_action::v1. It returns four outcomes: Permitted, Prevented, DecisionRequired and Indeterminate. Only Permitted carries execution authority. Your application reserves the execution attempt before dispatch.