Expand description
Settings/permissions scope hierarchy + the narrowing rule (R0 invariant). Settings/permissions scope hierarchy and the narrowing rule.
Adopted from the donor graphshell settings_and_permissions_spine_spec.md
(per the adoption roadmap
R0). This is the host-agnostic policy core: the scope vocabulary plus the
resolution rule. Storage of per-scope values and the host wiring that gates
surfaces/mods consume this; they are not here.
§The five scopes
SettingScope is a hierarchy from broadest to narrowest, grounded in
Mere’s own structure (a persona owns sessions; a session/window hosts graphs;
a graph hosts surfaces/tiles):
App— installation-wide defaults.Persona— one human’s persona (work / research / throwaway).Session— a session, i.e. a graph-shaped window.Graph— a specific graph (orrery / moot) within a session.Surface— a tile / pane / surface within a graph.
The same hierarchy serves settings (where the narrower scope simply
overrides) and permissions (where the narrower scope may only narrow).
This module implements the permission resolution; a settings-override
resolver is a future sibling that reuses SettingScope.
§The narrowing rule (the R0 invariant)
A narrower scope can only narrow a permission, never broaden it. No persona, session, graph, or surface can grant itself more than a broader scope allows. This is defense in depth: tighten centrally and trust that nothing downstream loosens it.
The rule is enforced structurally, not by convention: resolve_permission
returns the most restrictive opinion across the chain
(Allow < Prompt < Deny). Because resolution is a maximum over
restrictiveness, a narrower scope’s Allow can never override a broader
scope’s Deny — there is no code path that broadens.
This supersedes the earlier capability-gate-catalogue “first-match-wins”
framing for permissions (first-match can let an earlier, broader opinion win
over a stricter later one — wrong direction for security). RequireConsent
from that brief is preserved as the Permission::Prompt middle state.
Structs§
- Resolved
Permission - The outcome of
resolve_permission. - Scoped
Permission - One scope’s opinion in a resolution chain.
Enums§
- Permission
- A permission opinion at one scope.
- Setting
Scope - The scope a setting or permission is declared at, broadest to narrowest.
The discriminant order is the breadth order (
Appbroadest).
Functions§
- resolve_
permission - Resolve a permission across a scope
chainper the narrowing rule: the effective permission is the most restrictive non-Permission::Inheritopinion in the chain.defaultapplies when every scope inherits.