Delegation Policy

Approve the same low-risk request three times in a row and you will naturally tell your agent, "Stop asking me about these." The trouble with saying that in a chat message is that tomorrow's replacement agent never saw the chat, while today's worker stretches your casual "yes" to cover something risky you never meant to hand over.

Delegation Policy turns a requester's standing instructions into durable, role-bound hub records with explicit scope, exceptions, and an automatic expiry date. Before executing a guarded action, the hub verifies facts from its own records, honors reservations above all permissive rules, and commits an immutable Policy use receipt in the exact same transaction. Reach for it whenever you keep giving the same answer to a recurring class of actions or decisions.

Group Decision rights
Also known as Standing Approval, Delegated Authority, Permission Rules
Core rule Reservations win, missing facts ask, and every act logs a use
Defines records Policy, Policy use

Why "just stop asking me" breaks both ways

Whether agents are approving routine vendor invoices, publishing reviewed documentation, triaging support credits, or merging bug fixes before a release, asking the requester every single time wastes her attention. Yet waving permission away in a chat message fails in two opposite directions at once:

First, it evaporates across sessions. When a lead agent is replaced the next day, the new session never saw yesterday's conversation and resumes asking the exact same questions. Second, it quietly overreaches. Without stated exceptions or an end date, an agent that did see the message applies it to edge cases — a schema migration, a recurring contract, a production billing change — that the requester would never have pre-approved, leaving no structured log of what happened in her name.

Delegation Policy fixes both failures with four structural guarantees enforced by the hub:

  1. Policies bind to roles, not individual sessions. Granting a rule to lead_agent or worker means tomorrow's replacement agent inherits the exact same boundary automatically.
  2. Every permissive rule carries explicit conditions, exceptions, and an expiry date. Standing permissions (allow) and delegated judgment scopes (decide) expire automatically unless renewed, while reservations (reserve) can hold indefinitely.
  3. The hub gathers the facts and enforces fail-closed precedence. A reserving policy always overrides any permissive policy, and a missing fact always falls back to asking the requester.
  4. Every covered act writes an immutable Policy use in the same transaction, linking the action back to the requester's exact words and the facts matched at that moment.

Why require an expiry date on allow and decide policies, but allow reserve policies to last forever? Because forgetting to renew a temporary permission merely produces one extra question — whereas an expiring reservation would silently hand a high-stakes decision back to a broader standing permission without warning.

Chat instruction "Stop asking me about merges" Buried in one chat; no limits or end date New lead agent Never saw the chat; asks all over again Old worker Merges a schema change silently No record of what ran under it Never expires; relies on agent memory Both noise and silent overreach Requester revokes trust completely Delegation Policy Role-bound policy with end date Scope, conditions, exceptions & expires_at Hub checks facts from own records Reservations win; missing facts ask Covered Act + log policy use Not covered Hold & ask requester Survives agent restarts safely Every act logs an immutable receipt
A chat instruction fails both when a replacement agent misses it and when an existing agent stretches it past your intent. A hub-enforced Delegation Policy survives restarts, stops at declared exceptions and expiry, and logs every use atomically.

Architecture and participants

Only the human Requester may grant, replace, or revoke a Policy. Whenever an agent attempts a guarded action — or the lead agent exercises judgment inside its decision scope — the Hub gathers facts from its own records (such as checker findings or changed resources), runs the pure PolicyCheck function, and either executes and logs atomically or holds the action pending for human input.

Requester Grants, replaces, revokes Hub Checks facts & executes Lead agent & Workers Request actions by role Hub policy check & durable records Policies in force allow, decide, reserve, gate (immutable rows) Policy check Pure rule check: reserve > unknown > allow Hub-gathered facts Checker verdicts, files, never agent self-report covered reserved / unknown / not_covered Execute + write Policy use One transaction commits action, policy_id, matched facts & summary Leave pending & ask Requester No Policy use written; action waits for explicit human authorization
The policy check is a pure evaluation over active policies and hub-gathered facts. Only a covered verdict executes the action and commits a Policy use; reserved, unknown, and uncovered attempts stay pending.
Requester
The sole party authorized to grant, replace, or revoke policies. States each rule in plain language, confirms the structured scope the hub parsed, and inspects policy uses on her own schedule.
Hub
Stores immutable Policy rows, gathers verifiable facts from its own records, runs PolicyCheck, commits covered actions alongside a Policy use, and blocks uncovered or reserved actions.
Lead agent
Requests guarded actions through the hub and settles worker questions inside its decide scope. Because policies target the role, any replacement lead agent inherits the same boundaries.
Checker
Records independent review findings in the hub that policies can require as verified conditions (for example, checker_approved: true).
Policy & Policy use
Policy captures who granted authority, the role, effect (allow, decide, reserve, or gate), scope, words, and expiry. Policy use is the immutable log of one authorized act and the exact facts matched.

Execution flow

Toggle between the normal path — where a standing policy covers an action and executes it with an atomic receipt — and the exception and expiry path — where an excluded change and an expired policy both safely fall back to asking the requester.

Requester Hub Lead agent Worker 1. Grant scoped merge policy (ends Fri 5pm) 2. Confirm parsed scope & exceptions 3. Next day: PR 412 approved by Checker 4. Request merge of PR 412 5. Gather facts & run PolicyCheck bug_fix, approved, no schema change → covered 6. Merge PR 412 & write Policy use Committed together in one atomic transaction 7. Merged under policy use u1 8. Later: Requester inspects policy uses (no interrupt)

The requester grants the policy once and confirms how the hub parsed its conditions. The next day, the hub verifies facts from its own records, executes the covered action, and writes one Policy use in the same transaction.

Missing reservation facts: If an in-force reserve policy names a fact (such as payment_code) that the hub cannot verify from its records, PolicyCheck returns unknown and blocks any broader allow policy from firing.

Concrete examples

Delegation Policy governs any recurring operational, financial, editorial, or engineering decision where a hub sits between an agent and the action.

Example 1 — Vendor procurement & marketing invoices

No code or unit tests
Policy granted
"Until December 31, the lead agent may approve freelance copywriting invoices under $250 that passed finance verification, unless they create a recurring subscription. Reserve all legal contract signatures for me indefinitely."
Covered use
A verified $180 one-off copywriting invoice matches every condition and triggers no exception. The hub approves payment and commits a Policy use capturing the invoice ID, amount, and verification record.
Boundary caught
A $190 invoice marked recurring: true hits the exception; the hub holds payment and routes a question to the marketing director. On January 1, the policy expires automatically and all invoices ask again until renewed.

Example 2 — Pre-release bug-fix merges & decision scope

Software engineering
Policies granted
Allow policy: "In acme/api, the lead agent may merge any bug fix a checker approved unless it changes the database schema. Ends Friday 5:00 p.m."
Decide policy: "For 'Retry failed webhooks', the lead agent may settle internal implementation choices invisible to customers until November 30."
Reserve policy: "Always ask me about customer data retention or changes touching payment code."
Covered use
On Thursday morning, PR 412 (checker-approved bug fix, no schema file) merges automatically and logs Policy use use_1 — even though a fresh lead agent started that day.
Exceptions & expiry
PR 415 adds a column to orders → schema exception fires → held for requester. Saturday's PR 421 arrives after Friday 5:00 p.m. → expired → held for requester with a renewal prompt.

What this pattern is NOT — Irreversible high-damage acts or uncheckable prompts

Negative example
Situation
Pre-approving permanent deletion of customer databases or wire transfers, or writing a policy whose condition is "merge if the diff looks low-risk to the agent."
Why skip it
When one mistake is expensive and cannot be undone, asking every time is far cheaper than one mistaken pre-approval — keep those actions reserved and guard them with Policy Gate. And never create a policy whose conditions the hub cannot verify from its own durable records.

When to use and when to skip

Use Delegation Policy when

  • The requester repeatedly receives the same class of ask and keeps giving the same approval.
  • Agents restart or rotate across sessions, so standing rules must outlive any single chat.
  • The hub sits in the execution path (holding credentials or performing the merge, payment, or publish itself).
  • Every condition and exception in the rule can be checked from facts stored in the hub.

Skip it when

  • One person watches one agent live in a single session — a one-click session allow is enough.
  • A single mistaken action is irreversible and high-cost (deleting customer data, large payouts).
  • The hub cannot independently verify the policy's facts and would have to trust the agent's word.
  • You need to accept a finished request on the requester's behalf — keep final acceptance separate and reserved by default.

Data model and hub invariants

Delegation Policy defines two immutable tables — policies and policy_uses — and links to Party and Request (Orchestrator-Workers), Job (Durable Job), and Question (Self-Contained Question). The action, resource, conditions, and exceptions columns together define a policy's scope.

Party PK id (grantor / actor) Request PK id (optional scope) Job PK id (Durable Job) Question PK id (source/settled) Policy PK id (uuid) FK granted_by_id → Party FK request_id? → Request grantee_kind effect (allow|decide|...) action, resource conditions (jsonb) exceptions (jsonb) gate_rules? (jsonb) statement (text) FK source_question_id? FK replaces_id? → Policy granted_at expires_at? revoked_at? Immutable; replace via replaces_id Policy use PK id (uuid) FK policy_id → Policy FK request_id → Request FK job_id? → Job FK actor_id → Party FK question_id? → Question resource (text) facts (jsonb) summary (text) used_at (timestamptz) 1 n 1? n 1? n 1? n 1 n authorizes Replacement chain (1? → 1?) New Policy sets replaces_id & revokes old
One human Party grants each immutable Policy. Replacing a policy inserts a new row pointing to the old one via replaces_id. Every authorized action writes one Policy use capturing the matched facts.

Table: policies

Column Postgres type Nullability Notes
iduuidNOT NULL, PKUnique policy identifier.
granted_by_iduuidNOT NULL, FKReferences parties(id); must be a human party.
request_iduuidNULLABLE, FKReferences requests(id); NULL means all requests of the grantor.
grantee_kindtextNOT NULLCHECK (grantee_kind IN ('lead_agent', 'worker', 'any_agent')).
effecttextNOT NULLCHECK (effect IN ('allow', 'decide', 'reserve', 'gate')).
actiontextNOT NULLShort fixed code such as merge_pull_request or choose_implementation.
resourcetextNOT NULLTarget resource (e.g. acme/api) or any.
conditionsjsonbNOT NULLFact key-value map that must all hold; defaults to '{}'.
exceptionsjsonbNOT NULLJSON array of condition maps; if any holds, policy does not apply; defaults to '[]'.
gate_rulesjsonbNULLABLEOrdered Policy Gate rules; non-null iff effect = 'gate'.
statementtextNOT NULLThe requester's own plain-English words.
source_question_iduuidNULLABLE, FKReferences questions(id) when created from a recurring answer.
replaces_iduuidNULLABLE, FKReferences policies(id); forms an immutable replacement chain.
granted_attimestamptzNOT NULLTime when the policy takes effect.
expires_attimestamptzNULLABLERequired when effect IN ('allow', 'decide'); optional for reserve/gate.
revoked_attimestamptzNULLABLESet atomically when withdrawn or replaced.

Table: policy_uses

Column Postgres type Nullability Notes
iduuidNOT NULL, PKUnique policy use identifier.
policy_iduuidNOT NULL, FKReferences policies(id); must be an in-force allow or decide policy.
request_iduuidNOT NULL, FKReferences requests(id); request the action belongs to.
job_iduuidNULLABLE, FKReferences jobs(id); when set, must belong to request_id.
actor_iduuidNOT NULL, FKReferences parties(id); the agent that acted.
question_iduuidNULLABLE, FKReferences questions(id); set when the use settled an open question.
resourcetextNOT NULLExact resource acted on (for example, acme/api).
factsjsonbNOT NULLSnapshot of hub-gathered facts matched at used_at for later replay.
summarytextNOT NULLOne-sentence human-readable summary of what was done or decided.
used_attimestamptzNOT NULLTimestamp of the authorized action.

Nine hub invariants

  1. 01
    Permissive policies require an expiry date Database constraint

    CHECK (effect IN ('reserve', 'gate') OR expires_at IS NOT NULL) enforces expiry_required so no standing permission lasts indefinitely by accident.

  2. 02
    Decision-scope policies target only the lead agent Database constraint

    CHECK (effect <> 'decide' OR grantee_kind = 'lead_agent') enforces decide_requires_lead_agent, keeping judgment calls with the accountable lead.

  3. 03
    Gate rules present if and only if effect is gate Database constraint

    CHECK ((effect = 'gate') = (gate_rules IS NOT NULL)) enforces gate_rules_mismatch; gate policies store rules for Policy Gate and never authorize an action via policy_uses.

  4. 04
    Job reference on a policy use belongs to the same request Database constraint

    A composite foreign key (request_id, job_id) referencing jobs(request_id, id) ensures a policy use cannot attach to a job from an unrelated request.

  5. 05
    Only a human requester may grant, replace, or revoke a policy Hub guard

    grant verifies grantor_kind == human and rejects agents with only_requester_may_grant. An agent may suggest wording, never authorize itself.

  6. 06
    Policies are never edited in place Hub guard

    Updating a policy inserts a new row with replaces_id and sets revoked_at on the prior row in the same transaction, preserving historical audit integrity for past uses.

  7. 07
    Reserving policies always win over permissive policies Hub guard

    PolicyCheck.check evaluates active reserve policies first. If one applies (reserved) or cannot be ruled out due to a missing fact (unknown), no allow or decide policy may cover the attempt.

  8. 08
    Every covered act commits its Policy use atomically Hub guard

    When PolicyCheck returns covered, the hub writes the Policy use (pointing to the active policy and matching facts) in the exact same transaction as the action or lead decision.

  9. 09
    Policy uses are append-only and never edited or deleted Hub guard

    Once committed, a Policy use is immutable so Decision Audit can always trace a verdict of "should have asked me" back to the exact policy and facts.

Reference implementation

The pure PolicyCheck evaluator and hub guard wrapper in Lean, TypeScript, Python, and Elixir. Notice how missing facts automatically fail closed for both permissive and reserving policies.

-- Pure PolicyCheck and Hub guards for Delegation Policy
inductive GranteeKind where
  | leadAgent | worker | anyAgent
  deriving Repr, BEq, DecidableEq

inductive ActorKind where
  | leadAgent | worker
  deriving Repr, BEq, DecidableEq

inductive GrantorKind where
  | human | agent
  deriving Repr, BEq, DecidableEq

inductive PolicyEffect where
  | allow | decide | reserve | gate
  deriving Repr, BEq, DecidableEq

inductive HubError where
  | onlyRequesterMayGrant | expiryRequired | decideRequiresLeadAgent | gateRulesMismatch
  deriving Repr, BEq

-- Facts and conditions are key/value pairs; values are strings here for simplicity.
abbrev Facts := List (String × String)

-- Timestamps are Unix seconds, passed in by the caller.
structure Policy where
  id : String
  grantedById : String
  requestId : Option String := none
  granteeKind : GranteeKind
  effect : PolicyEffect
  action : String
  resource : String
  conditions : Facts := []
  exceptions : List Facts := []
  gateRules : Option Facts := none
  statement : String
  grantedAt : Nat
  expiresAt : Option Nat := none
  revokedAt : Option Nat := none
  deriving Repr

structure Attempt where
  id : String
  actorId : String
  actorKind : ActorKind
  requestId : String
  jobId : Option String := none
  action : String
  resource : String
  facts : Facts
  summary : String
  deriving Repr

structure PolicyUse where
  id : String
  policyId : String
  requestId : String
  jobId : Option String
  actorId : String
  resource : String
  facts : Facts
  summary : String
  usedAt : Nat
  deriving Repr

inductive CheckResult where
  | covered (policy : Policy)
  | reserved (policy : Policy)
  | unknown (policy : Policy)
  | notCovered
  deriving Repr

namespace PolicyCheck

def inForce (p : Policy) (now : Nat) : Bool :=
  p.grantedAt <= now && p.revokedAt.isNone && p.expiresAt.all (now < ·)

def granteeMatches : GranteeKind → ActorKind → Bool
  | .anyAgent, _ => true
  | .leadAgent, .leadAgent => true
  | .worker, .worker => true
  | _, _ => false

def fits (p : Policy) (a : Attempt) : Bool :=
  granteeMatches p.granteeKind a.actorKind &&
    p.requestId.all (· == a.requestId) &&
    p.action == a.action &&
    (p.resource == a.resource || p.resource == "any")

-- Every key a condition or exception mentions is present in the facts.
def known (p : Policy) (facts : Facts) : Bool :=
  (p.conditions :: p.exceptions).flatMap (·.map Prod.fst)
    |>.all fun k => (facts.lookup k).isSome

def holds (wanted facts : Facts) : Bool :=
  wanted.all fun (k, v) => facts.lookup k == some v

def applies (p : Policy) (facts : Facts) : Bool :=
  known p facts && holds p.conditions facts && !p.exceptions.any (holds · facts)

def check (policies : List Policy) (a : Attempt) (now : Nat) : CheckResult :=
  let fitting := policies.filter fun p => inForce p now && fits p a
  let reserving := fitting.filter (·.effect == .reserve)
  let permitting := fitting.filter fun p => p.effect == .allow || p.effect == .decide
  if let some p := reserving.find? (applies · a.facts) then .reserved p
  else if let some p := reserving.find? (!known · a.facts) then .unknown p
  else if let some p := permitting.find? (applies · a.facts) then .covered p
  else .notCovered

end PolicyCheck

structure Hub where
  policies : List Policy := []
  uses : List PolicyUse := []
  deriving Repr

inductive AttemptResult (α : Type) where
  | ok (useId : String) (result : α)
  | askRequester (grantorId : String)
  -- reason is "unknown" or "not_covered"; policyId names the reserve rule that lacked facts.
  | ask (reason : String) (policyId : Option String)
  deriving Repr

namespace PolicyHub

def grant (hub : Hub) (p : Policy) (grantorKind : GrantorKind) : Except HubError Hub := do
  unless grantorKind == .human do throw .onlyRequesterMayGrant
  if (p.effect == .allow || p.effect == .decide) && p.expiresAt.isNone then
    throw .expiryRequired
  if p.effect == .decide && p.granteeKind != .leadAgent then throw .decideRequiresLeadAgent
  if (p.effect == .gate) != p.gateRules.isSome then throw .gateRulesMismatch
  return { hub with policies := p :: hub.policies }

def attempt {α : Type} (hub : Hub) (a : Attempt) (now : Nat) (act : PolicyUse → α) :
    AttemptResult α × Hub :=
  match PolicyCheck.check hub.policies a now with
  | .covered policy =>
    let use : PolicyUse :=
      { id := a.id, policyId := policy.id, requestId := a.requestId, jobId := a.jobId,
        actorId := a.actorId, resource := a.resource, facts := a.facts,
        summary := a.summary, usedAt := now }
    -- In a real hub, action execution and PolicyUse insert share one DB transaction.
    (.ok use.id (act use), { hub with uses := use :: hub.uses })
  | .reserved policy => (.askRequester policy.grantedById, hub)
  | .unknown policy => (.ask "unknown" (some policy.id), hub)
  | .notCovered => (.ask "not_covered" none, hub)

end PolicyHub

-- An agent can never grant a policy, whatever the policy says.
theorem agent_cannot_grant (hub : Hub) (p : Policy) :
    PolicyHub.grant hub p .agent = .error .onlyRequesterMayGrant := by
  rfl

Execution trace

Walking Example 2 (Acme API pre-release bug-fix merges) through these guards shows grant validation, a covered merge writing use_1, a schema exception, post-expiry rejection, and a reservation blocking an allow policy when a fact is missing:

Execution trace: Example 2 (Acme API bug-fix merges, schema exception, expiry & reservation precedence)
1. hub.grant(pol_merge_api, grantorKind: "agent")
   -> error: only_requester_may_grant (agents can propose policies, never grant them)

2. hub.grant({ ...pol_merge_api, effect: "allow", expiresAt: null }, grantorKind: "human")
   -> error: expiry_required (every allow or decide policy must have an end date)

3. hub.grant(pol_merge_api, grantorKind: "human")
   -> ok (allow merge_pull_request on "acme/api" if bug_fix & checker_approved, except changes_schema, ends Fri 17:00Z)

4. # Thursday 10:20Z — PR 412 (bug_fix, checker_approved=true, changes_schema=false)
   hub.attempt(attempt_pr_412, new Date("2026-11-19T10:20:00Z"), mergeFn)
   -> { status: "ok", useId: "use_1", result: "merged PR 412 under pol_merge_api" }

5. # Thursday 14:00Z — PR 415 (changes_schema=true hits exception)
   hub.attempt(attempt_pr_415_schema, new Date("2026-11-19T14:00:00Z"), mergeFn)
   -> { status: "ask", reason: "not_covered", policyId: null } (no merge executed; no Policy use written)

6. # Saturday 09:30Z — PR 421 after Friday 17:00Z expiry
   hub.attempt(attempt_pr_421, new Date("2026-11-21T09:30:00Z"), mergeFn)
   -> { status: "ask", reason: "not_covered", policyId: null } (policy expired; requester asked & offered renewal)

7. # Reserving policy on payment_code=true with fact missing from hub records:
   hub.grant(pol_reserve_payment, grantorKind: "human")
   hub.attempt(attempt_pr_412_no_payment_fact, new Date("2026-11-19T10:30:00Z"), mergeFn)
   -> { status: "ask", reason: "unknown", policyId: "pol_reserve_payment" } (missing reservation fact blocks allow)

Tradeoffs and practical guidance

Delegation Policy removes repetitive interruptions and outlives disposable agent sessions, but it shifts risk from interruption fatigue to rule design:

  • Broad policies hide unexpected edge cases: one overly permissive rule can authorize a costly mistake that outweighs dozens of saved questions. Keep scopes narrow, require explicit expiry dates, and always pair with Decision Audit.
  • Policy sprawl takes tending: overlapping, expired, or stale policies add cognitive load. Show the requester a concise list of active policies with usage counts and flag overlaps at grant time.
  • Fewer questions prove nothing on their own: a quiet inbox could reflect healthy delegation or silent misbehavior; only auditing sampled uses tells the two apart.

Practical implementation notes

  • Keep the action vocabulary short and fixed: tie each action code directly to one hub tool call where possible. For decide policies where the lead agent classifies its own judgment, review those uses more closely in Decision Audit.
  • Show parsed conditions back in one sentence: when the requester states a policy in plain language, display the exact structured scope, exceptions, and expiry back to her before activating it.
  • Treat missing facts as "ask": if the hub cannot verify a condition from its own durable state, never let the agent fill in the fact on its own behalf.
  • Separate step permission from final acceptance: letting a lead agent merge or publish an intermediate step does not mean it may accept the whole finished request for the requester — keep final acceptance reserved unless explicitly delegated.

Known uses and related patterns

  • Claude Code permission rules: stores durable allow, ask, and deny rules for tool calls across sessions so choosing "Yes, and don't ask again" scopes future runs in that repository.
  • Unix sudo (sudoers): scopes delegated commands to specific users and hosts, supports time-bounded credentials and password waivers, and logs every authorized and denied attempt.
  • Open Policy Agent (OPA): evaluates declarative policies against structured input facts and emits decision logs recording the policy bundle revision, inputs, and outcome for later replay.
  • LangChain human-in-the-loop middleware: inspects tool-call arguments to either execute automatically or pause for human approval based on configured rules.
  • Volgenic: enforces repository-level merge and shipping rules and time-bounded approval grants in the hub so agents act within explicit standing boundaries.
  • Contrast with XACML PDP/PEP: PolicyCheck acts as the Policy Decision Point and the hub's atomic executor acts as the Policy Enforcement Point, adding human-authored plain-language statements, mandatory expiry on permissive rules, and immutable Policy use receipts.

Related patterns

  • Escalation Chain — checks reserving policies first, applies allow policies at stop 2, and uses decide policies to define the lead agent's scope at stop 3.
  • Decision Audit — samples logged policy uses so the requester can widen, narrow, or revoke policies based on real verdicts.
  • Policy Gate — enforces guarded transitions using the ordered rules stored in a policy with effect = 'gate', writing a Gate decision rather than a Policy use.
  • Orchestrator-Workers — defines the Party and Request records referenced by policies and policy uses.
  • Tracked Answer — turns a recurring human reply ("do this every time") into a durable Policy via source_question_id.
  • Durable Job & Self-Contained Question — define the Job and Question records linked by a Policy use.