Operations
AI Change Proposals & Human Approval Queue
Let AI agents validate and stage mutating operations with propose.* scopes, optimistic beforeHash concurrency checks, and human review in /admin/proposals.
AI Change Proposals & Human Approval Queue
phramecms/proposal (ProposalModule) lets AI agents prepare validated, diffed changes to sensitive configuration, content models, or content without holding live write permissions. Every staged change lands in the phrame_proposals queue and is applied live only after an authorized human reviewer approves it.
How propose.* Scopes Work
Granting an agent a propose.<permission> scope lets it simulate and stage an operation via proposal.create, while still denying direct live writes:
- When an actor calls
proposal.createwith a targetoperationandinput,ProposalCreateOperationchecks that the target operation:- is not itself a
proposal.*operation (recursive proposals are forbidden), - declares
mutatesState: true, and - declares
supportsDryRun: true.
- is not itself a
- If the calling actor holds any
propose.*scopes,ProposalCreateOperationwraps the actor inPhrameCms\Proposal\Security\ProposalPreviewActor, which promotespropose.<perm>to<perm>exclusively for a singledryRun: trueexecution onOperationBus. OperationBusruns full policy checks, JSON Schema validation, and dry-run diff calculation against live state without persisting anything.ProposalCreateOperationpersists aProposal(prop_<hex>) withstatus: pending, the computed canonicaldiff,beforeHash,afterHash,reason,proposedBy,proposedByType, andonBehalfOf.
Security invariant: ProposalPreviewActor is never used during live execution (dryRun: false). When a human later calls proposal.approve, the target operation executes strictly under the approving reviewer's identity and live permissions — so an agent holding proposal.create and propose.* can neither bypass the queue nor self-approve.
Minting a Propose-Only AI Agent Token
Grant proposal.create, proposal.read, any needed read scopes, and only the exact propose.<perm> scopes the agent is allowed to stage (omit live write scopes and omit proposal.review):
./bin/phrame site:install \
--issue-agent-token \
--agent-name=proposal-assistant \
--agent-scopes='schema.read,config.admin.settings.read,proposal.create,proposal.read,propose.config.admin.settings.write,propose.schema.modify' \
--jsonProposal Lifecycle & Operations
A proposal moves from pending (ProposalStatus::Pending) to one of three terminal states: approved, rejected, or cancelled.
| Operation | MCP Tool | Required Permission | Dry-Run | Input Fields |
|---|---|---|---|---|
proposal.create |
proposal_create |
proposal.create (+ target permission or propose.<perm> for dry-run) |
Yes | operation (required), input (required object), reason (optional, max 1000 chars) |
proposal.list |
proposal_list |
proposal.read |
No | status (pending|approved|rejected|cancelled), operation, proposed_by, limit (1–200), offset |
proposal.get |
proposal_get |
proposal.read |
No | id (required) |
proposal.approve |
proposal_approve |
proposal.review (+ target operation's live permissions) |
Yes | id (required), review_note (optional), force (optional boolean, default false) |
proposal.reject |
proposal_reject |
proposal.review |
No | id (required), review_note (optional) |
proposal.cancel |
proposal_cancel |
proposal.create (original proposer); proposal.create + proposal.review (cancelling another actor's proposal) |
No | id (required), reason (optional) |
MCP Resources for Agents
When ProposalModule is active and the agent holds proposal.read, ProposalResourceProvider exposes two read-only MCP resources:
phrame://proposals/pending— Pending proposals awaiting human review.phrame://proposals/recent— Recent proposals across all statuses, including rejected proposals with humanreview_notefeedback so agents can revise and resubmit.
Staging a Proposal Example
Over Streamable HTTP MCP (POST /mcp), an agent with proposal.create and propose.config.admin.settings.write stages a branding update:
curl -fsS -X POST http://127.0.0.1:8080/mcp \
-H "Authorization: Bearer <AGENT_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "proposal_create",
"arguments": {
"operation": "config.set",
"input": {
"name": "admin.settings",
"data": {
"brand_name": "Acme CMS",
"theme": "default"
}
},
"reason": "Update Admin UI brand name for Q4 rebrand"
}
}
}'The same operation can be invoked from the CLI via ./bin/phrame op:run proposal.create.
Optimistic Concurrency (beforeHash)
When a proposal is created, ProposalCreateOperation stores the target's beforeHash returned by the dry-run simulation.
When a reviewer approves the proposal (proposal.approve):
ProposalApproveOperationfirst re-runs the target operation indryRun: truemode as the approving actor to verify live permissions and compute a freshactual_before_hashandfreshDiff.- It compares
actual_before_hashagainst the storedproposal.beforeHash:- If they match, the target operation executes live (
dryRun: false) throughOperationBus, recording both the live operation's audit entry and theproposal.approveaudit entry with the sameappliedCorrelationId. - If the underlying state changed while the proposal was waiting (
stale: true) andforceisfalse,ProposalApproveOperationaborts without mutating state and throwsProposalConflictException(rendered as HTTP409 Conflictin/admin/proposalsalongside the fresh diff). - Reviewers can pass
dry_run: truetoproposal.approveat any time to re-check staleness and inspect the fresh diff before deciding whether to approve, reject, or explicitly passforce: true.
- If they match, the target operation executes live (
Reviewing Proposals in /admin/proposals
Human administrators sign in to the Admin UI and open /admin/proposals (ProposalAdminController):
- Queue view (
GET /admin/proposals): Filter by status tab (pending,approved,rejected,cancelled,all) with live status counts and pagination. - Detail view (
GET /admin/proposals/{id}): Inspect the target operation, canonical JSON input, stored diff, proposing agent display label,on_behalf_ofhuman attribution, andbeforeHash/afterHash. - Dry-run re-check & Approve (
POST /admin/proposals/{id}/approve): Re-check the proposal against current state (dry_run), or apply live with an optionalreview_note. If a409 Conflictoccurs due to a stalebeforeHash, the page renders the fresh diff against current state so the reviewer can confirm before choosing Force Approve & Apply (force=1). - Reject (
POST /admin/proposals/{id}/reject): Mark the proposalrejectedwith an optionalreview_notethat the proposing agent can read back viaproposal.getorphrame://proposals/recent.
Related Guides
- Users, RBAC, and AI Agent Tokens — Issuing least-privilege tokens and reviewing the immutable audit trail.
- Configuration Sync — Exporting approved configuration changes back into
config/sync/. - Architecture Overview — Understanding the
OperationBuspipeline behind proposal previews and approvals.