Governance
Permissions live in the protocol, not bolted on. Every act produces a record. Without a matching allow, the answer is no.
Overview
Governance decides who may do what in your workspace. Permission rules are records, and every action leaves a record, so there is no separate access system or audit log to keep in step. To change a permission, you add or edit a rule; the next request follows it. No restart is needed.
Three things hold:
- Rules live next to the data they govern.
- The record of what happened is the audit log.
- Without a rule that says yes, the answer is no.
Permissions are rules you write
A permission rule is a LEARN record on the th_engine_config thread with body.topic: "permission_rule". It has a name, a namespace, an expression, an action (allow or deny), a priority, and an enabled flag.
{
"act": "LEARN",
"actor": "did:sync:user:alice",
"thread": "th_engine_config",
"body": {
"topic": "permission_rule",
"name": "users_approve_own_tasks",
"namespace": "default",
"expression": "current_actor().startsWith(\"did:sync:user:\") && resource == \"task_approve\" && record.body.assigned_to == current_actor()",
"action": "allow",
"priority": 100,
"enabled": true
}
}You don't usually write this JSON by hand: spl config add-permission-rule builds the record and posts it.
A new rule applies to the next request. Expressions in a permission rule can use record, resource (the thing being requested, such as "record_write" or "task_approve"), current_actor(), trust(), task(), system, now(), and the three fleet functions described below. See the Expressions guide for the full list.
Allow, deny, and what wins
Each rule has one action and one priority. Rules are checked in descending priority order. The first rule whose predicate returns true decides, allow or deny, depending on the rule's action. If no rule matches, the answer is deny.
priority 200 deny actor.startsWith("did:sync:agent:") && resource == "record_delete"
priority 100 allow current_actor().startsWith("did:sync:user:") && resource == "task_approve"
priority 50 allow resource == "record_read"
↓
A user trying to read a record → rule 3 matches → ALLOW
An agent trying to delete → rule 1 matches → DENY
A service touching a custom op → no match → DENY (fail-closed)A high-priority deny beats every lower-priority allow. You can add allow rules at lower priorities without widening access past a deny, and a deliberate deny ("agents can't delete records, ever") cannot be undone by an allow rule below it.
When permissions are enabled but you've added no rules, every gated request returns 403. This is intentional: until you've said what's allowed, nothing is. Most workspaces start with two or three broad allow rules covering normal traffic, then add deny rules for the things that must never happen. See the keyring guide for the typical bootstrap.
A note on broken rules: if a permission rule's expression is invalid or fails when checked, it is skipped (with a warning in the log) rather than treated as allow or deny. A bad rule does not silently flip enforcement in either direction.
Every act is an audit entry
All eight act types (INTEND, DO, KNOW, LEARN, GET, PUT, CALL, MAP) produce records. Records cannot be changed after they are written, can be verified, and are signed when authentication is on. The record log is where audit events start, not a copy of them.
- Tampering shows. Any change to a record is detectable, and anyone holding the log can verify it.
- Nothing is missing. Anything that did not produce a record did not happen. Permission denials, approvals, pulls from paired workspaces and run results are all records.
- Audit questions are ordinary queries. "What did this actor do?" or "Show me every denial in the last 24 hours" are queries on the log. There is no separate audit store.
Concretely:
spl audit exportdumps the audit-relevant slice of the record log to JSON or NDJSON, with category and time filters.spl thread records <id>walks the records on any thread, useful when investigating an incident.spl debug replay <thread>walks the records with the status changes marked, so you can see what happened and what state the thread was in at each step.
How governance composes with the rest of Syncropel
Namespaces define where rules attach. A permission rule carries a namespace field, and namespaces form a hierarchy. Child rules can override parent rules of the same name, but cannot break the parent's deny rules. See Namespaces for the narrowing model.
Records are what governance is about. Every gated operation asks whether a record may be written or an action may run. See Records for the unit, Threads for how records are scoped.
Actors are who governance keys on. A permission rule can ask trust(current_actor(), "ops") > 0.7 or current_actor().startsWith("did:sync:user:"). The DID is the stable handle; trust is the evidence of how their work has gone. See Actors and Trust.
Federation extends governance via consent. When records cross workspace boundaries, a consent grant decides what flows through. Pairing two workspaces does not by itself grant access: you also need a matching consent grant. See Federation and the Consent guide.
Fleet-level kill switches
Some governance decisions are about halting activity across the whole system, not approving individual operations. The state lives on the reserved thread th_fleet_control. Permission rules can read it with three functions:
fleet_emergency_active(): the workspace-wide emergency stop is on. Returnsbool.fleet_frozen_namespaces(): namespaces currently under soft or hard freeze. Returnslist<string>.fleet_hard_frozen_past_grace(): namespaces whose hard freeze has passed its grace window. Returnslist<string>.
A common pattern is the standing rule that denies new effectful records in any frozen namespace:
!fleet_frozen_namespaces().exists(ns,
record.body.namespace == ns &&
(record.act == "INTEND" || record.act == "DO" || record.act == "CALL"))Stopping everything works the same way as any other permission: switching it on is a record, and the next request sees it.
Known limits
- Every gated request is checked by the workspace itself. Signed per-session permissions that an executor could check offline are not supported.
- A namespace's
policyfield is stored as plain text. Syncropel checks that a namespace exists and is active, but does not compare permissions between parent and child namespaces.
What's next
- Namespaces: where permission rules apply.
- Records: the unit of audit.
- Actors: the identities permissions apply to.
- Federation: sharing across workspaces through consent.
- Expressions guide: the expression language.
- Consent guide: controlling what is shared across namespaces.
- Keyring guide: enabling permissions on a new workspace.