partly implementedProfilecpuQualifiedcpu

17. Grants and approvals

Status: partly implemented. Core permission matching and #authority bypass-immune member approval policy (`openagents/core/permissions.coax`, `openagents/core/perm_match.coax`, `openagents/core/members.coax`, #14057), Desktop interactive permission cards (`apps/openagents-desktop/page/permit.coax`), and HTTP protobuf agent grants (`coax/web/api/agent-policy.coax`, `coax/web/api/agent-wire.coax`) pass on cpu. Remaining: unified NIP-CAP/NIP-POL protobuf schemas and mobile/web approval sheet parity (openagents/agent/grants.coax).

Premise

The front can now choose a member. This chapter says what that member may do. A description grants nothing, a grant is its own record, and any effect on the world waits for your approval.

Draft

The broader an agent is, the harder it is to say what it may do. This is the sixth pressure, authority, and a composition answers it by making permission as specific as its members.

Three things stay separate. A description says what a member can do. A grant says that this member may do it, here, for you. An approval is your yes to one action. Describing a member grants nothing. Installing one grants nothing. A plan that needs a grant you haven't given stops and asks.

Effects are sorted by what they touch. Reading your files, writing to them, running a command, sending a message in your name and moving money each need their own grant. Money always needs an approval for the specific payment (chapter 33).

The person who owns a computer sets its policy. A paired phone can ask that computer to do something, but it can't widen what the owner allowed. Keys stay on the device that holds them.

An agent that acts for you has its own key and a grant you approve: scopes, spend caps in sats and an expiry. An agent can never widen its own grant. That grant is the first record in this book whose schema is in use (chapter 5).

Episode 250 is the reason for this chapter. Agents invented commands and reported the wrong model, and the fix was typed capabilities and controls backed by evidence. The Coder book builds the sandbox and approval prompt for a coding session. This chapter uses the same pieces for every member.

What we build

A plan for what this chapter ships once the draft is approved:

  • Grant records, kept apart from member descriptions.
  • An approval step that every surface draws the same way: what will happen, to what, and what it costs.
  • A refusal as a normal result with a reason, for a plan that asks for more than it was given.

It builds on what exists today:

On the protocol (chapter 65):

RecordSchemaCarriageToday
A member's grantopenagents.capability.v1 Grant (spec 19.3)Nostr: a private record in a kind 3188 envelope (NIP-CAP)Spec sketch; no .proto file. coax/lib/nostr/cap handles the NIP's JSON
Approval of one actionopenagents.policy.v1 ApprovalRequest, ApprovalDecision (spec 19.2)Nostr: a private record in a kind 3188 envelope (NIP-POL)Spec sketch; no .proto file
What an agent may do in its owner's nameopenagents.account.v1alpha1 GrantRequest, Grant (`agents.proto`)HTTP, as binary protobufIn use: the generated codec coax/web/api/agent-wire.coax (chapter 5)

The chapter's check

  • Source: the grant records in openagents/agent/grants.coax and the shared approval step, with a fake member whose one effect writes a file.
  • Trace: installing the member leaves state grants empty. A plan that needs the write opens the approval step, and tree shows what will happen, to what file and the cost. tap approval.approve lets the member write the file once, and logs records the grant and the approval as separate lines.
  • Refusal: a plan that asks for more than the grant gives returns a refusal result with its reason, such as `refused: no grant for files.write`, and the file is not written. A paired phone that asks to widen the owner's policy gets the same kind of refusal.
  • Independent check: chapter 5's existing checks on the agent grant codec, coax/web/api/agent-wire.coax, show an agent can't widen its own grant. The approval step's text in tree is the same on web and on the iPhone simulator.

Planned paths: openagents/agent/grants.coax.

Sources

Open questions for the owner

  1. Which grants can a person give once and keep, and which ask every time?