You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In M1-M3 the cap-token system is flat: an actor gets a cap, uses it directly. Delegation is schema-only (returns not_implemented_in_v1). For M4, we light it up — a parent agent issues a narrowed cap to a child sub-agent, with explicit scope reduction, TTL inheritance, revocation cascade, and full audit chain reconstruction.
Per milestones-roadmap.md §5, this is the depth that lets the first enterprise customer (regulated B2B brand-owner) actually deploy AgentKeys for multi-agent scenarios. Without delegation, every agent in a fleet needs its own first-class cap-mint flow — which doesn't scale and doesn't audit.
The corrected design from agent-iam-strategy.md §3.3`: delegation is implicit-in-cap-tokens by default; explicit delegation activates only after vendor proves M2-tier traction. This issue ships explicit delegation.
Scope (M4)
Cap-token format extensions
Add parent_cap_id: CapId (the cap this one was delegated from; null for root caps)
Add delegation_chain_depth: u8 (0 for root; +1 per delegation hop)
Add narrowed_scope: Scope (the explicit scope; MUST be ⊆ parent_cap's scope)
Delegation isn't in arch.md yet. Land a new arch.md §X "Delegation chains" section as part of this issue. Per CLAUDE.md architecture-as-source-of-truth policy: if it's an invariant, it lives in arch.md.
The new section covers:
Delegation grammar (scope ⊆ parent_scope etc.)
Maximum depth + rationale
Revocation cascade semantics
Audit chain reconstruction
Interaction with per-data-class isolation (delegation preserves data_class; can't cross classes)
Interaction with per-actor isolation (delegation preserves actor_omni; cross-actor delegation is a different ceremony, M5+)
Revocation cascade latency too high (worker-side check on every use is slow)
Worker caches root cap_id status with short TTL (~5s); cascade is bounded by cache TTL; documented as "bounded offline revocation" same as #110-pattern caps
Audit chain reconstruction at depth N is slow
Index audit rows by delegation_root_cap_id; reconstruction is a single index scan
Delegation surface tempts operators to use it where straight cap-mint would be simpler
Documentation: "use delegation when you need scope narrowing or cascade revocation; otherwise mint a fresh cap" — example matrix in arch.md §X
Scope-subset check is wrong (allows privilege escalation in edge cases)
Property test: random valid (parent, narrowed) pairs always pass subset; random invalid pairs always reject — minimum 1000 generated cases
Read agent-iam-strategy.md §3.3 first — the corrected design (delegation is preview-only in v1) is the framing this issue ships
arch.md update is part of this issue, not a follow-up. If you ship the code without arch.md, future operators won't know the delegation grammar.
Per CLAUDE.md "Architecture-as-source-of-truth policy": re-read arch.md after every commit to verify it still matches the implementation
The scope-subset check is the most-likely-to-be-wrong piece. Property-based testing is non-negotiable here (use proptest for Rust; minimum 1000 cases).
Watch for: don't accidentally allow delegation across data_classes. The cap-token's data_class field is signed; delegation must preserve it. If you find yourself writing data_class: new_data_class, stop — that's a different ceremony (M5+).
Use the /agentkeys-issue-create skill for follow-up issues (e.g., delegation graph UI visualization, cross-actor delegation in M5)
Context
In M1-M3 the cap-token system is flat: an actor gets a cap, uses it directly. Delegation is schema-only (returns
not_implemented_in_v1). For M4, we light it up — a parent agent issues a narrowed cap to a child sub-agent, with explicit scope reduction, TTL inheritance, revocation cascade, and full audit chain reconstruction.Per
milestones-roadmap.md§5, this is the depth that lets the first enterprise customer (regulated B2B brand-owner) actually deploy AgentKeys for multi-agent scenarios. Without delegation, every agent in a fleet needs its own first-class cap-mint flow — which doesn't scale and doesn't audit.The corrected design from
agent-iam-strategy.md§3.3`: delegation is implicit-in-cap-tokens by default; explicit delegation activates only after vendor proves M2-tier traction. This issue ships explicit delegation.Scope (M4)
Cap-token format extensions
parent_cap_id: CapId(the cap this one was delegated from; null for root caps)delegation_chain_depth: u8(0 for root; +1 per delegation hop)narrowed_scope: Scope(the explicit scope; MUST be ⊆ parent_cap's scope)Broker enforcement
narrowed_scope ⊆ parent_scopeANDnarrowed_ttl ≤ parent_ttl_remainingANDdelegation_chain_depth + 1 ≤ MAX_DEPTHMAX_DEPTHenv-configurable (default 3)DelegationPrivilegeEscalation/DelegationDepthExceededif violatedRevocation cascade
Audit chain
[root_cap_id, intermediate_cap_id_1, intermediate_cap_id_2, ...]arch.md update (deliverable)
Delegation isn't in arch.md yet. Land a new arch.md §X "Delegation chains" section as part of this issue. Per CLAUDE.md architecture-as-source-of-truth policy: if it's an invariant, it lives in arch.md.
The new section covers:
Out of scope (defer)
Acceptance criteria
parent_cap_idsetDelegationPrivilegeEscalation— verified by negative testMAX_DEPTHenforced: delegation chain of depth N+1 (where N = MAX_DEPTH) rejected withDelegationDepthExceededCapRevokedViaParentwithin 200ms of root revocation)delegation.grant,delegation.revoke,approval.request) now return real results (notnot_implemented_in_v1)Risks
delegation_root_cap_id; reconstruction is a single index scanReferences
docs/spec/plans/milestones-roadmap.md§5 (M4 scope — capability + revocation depth)docs/research/agent-iam-strategy.md§3.3 (corrected delegation design — schema/preview in v1, active in v2/M4)docs/arch.md§17 (per-actor + per-data-class isolation invariants — delegation must preserve)Effort
~2-3 weeks (includes arch.md design work). Sequencing:
Pickup notes for the next agent / developer
agent-iam-strategy.md§3.3 first — the corrected design (delegation is preview-only in v1) is the framing this issue shipsproptestfor Rust; minimum 1000 cases).data_classfield is signed; delegation must preserve it. If you find yourself writingdata_class: new_data_class, stop — that's a different ceremony (M5+)./agentkeys-issue-createskill for follow-up issues (e.g., delegation graph UI visualization, cross-actor delegation in M5)