Context
Relayfile now has a draft cross-repo spec for mapping MCP-style per-user governance onto Relayfile's filesystem model:
- Source repo:
AgentWorkforce/relayfile
- Branch:
codex/productized-cloud-mount-relayfile
- Spec path:
docs/per-user-governance-contract.md
The core framing is:
MCP governs per-user tool calls. Relayfile governs per-user filesystem paths and writeback operations.
This issue tracks the relayauth side of that contract.
Why this matters
The Scalekit-style MCP-vs-CLI argument is right that customer-facing agents need governance properties that plain CLI does not provide:
- per-user authorization
- tenant isolation
- explicit boundaries
- revocation
- structured audit
- attribution back to a human sponsor
Relayfile can provide those properties through file paths rather than MCP tool calls, but only if relayauth is the authority for agent identity, scoped tokens, delegation, policy, revocation, and audit semantics.
Relayauth-owned requirements
Relayauth owns identity, token, scope, RBAC, policy, revocation, and audit semantics.
Required changes from the spec:
- Ensure token format supports
org, wks, sponsorId, sponsorChain, jti, aud, exp, and delegated parentTokenId.
- Ensure scope matching supports all Relayfile scope families used by the governance contract:
relayfile:fs:*:<path>
relayfile:ops:*:<path>
relayfile:sync:*:<path>
relayfile:integration:*:<path>
- Provide APIs for child-token issuance with subset enforcement.
- Reject delegation attempts where child scopes exceed the parent token/effective identity boundary.
- Emit audit events for attempted delegation escalation.
- Expose token, session, and identity revocation APIs that Relayfile can honor.
- Keep public
@relayauth/* packages platform-agnostic; Cloudflare storage, KV, D1, and Durable Object implementations belong in AgentWorkforce/cloud under packages/relayauth.
Token shape expected by Relayfile
{
"sub": "agent_review_bot",
"org": "org_acme",
"wks": "ws_acme_support",
"sponsorId": "user_jane",
"sponsorChain": ["user_jane", "agent_lead", "agent_review_bot"],
"scopes": [
"relayfile:fs:read:/github/repos/acme/api/pulls/*",
"relayfile:fs:write:/github/repos/acme/api/pulls/*/reviews/*",
"relayfile:ops:read:/github/*"
],
"aud": ["relayfile"],
"exp": 1772004000,
"jti": "tok_example",
"parentTokenId": "tok_parent_if_delegated"
}
Delegation acceptance case
Given a lead token with:
relayfile:fs:read:/github/*
relayfile:fs:write:/github/*/reviews/*
When the lead invites a sub-agent requesting:
relayfile:fs:read:/github/repos/acme/api/pulls/*
Then relayauth should issue a child token with:
- narrowed scopes
- expiry no later than the parent token
- sponsor chain extended with the child agent
parentTokenId set
- audit event recording issuance
Delegation denial case
Given the same lead token, when the lead invites a sub-agent requesting:
relayfile:fs:write:/slack/*
Then relayauth must reject issuance and emit an audit event for attempted escalation.
Audit fields Relayfile needs
For each token issuance, validation, scope check, denial, and revocation, Relayfile needs enough audit context to correlate with its own VFS/writeback logs:
interface GovernanceAuditContext {
requestId: string;
correlationId: string;
orgId: string;
workspaceId: string;
agentId: string;
sponsorId: string;
sponsorChain: string[];
tokenId: string;
requestedScope: string;
matchedScope?: string;
result: "allowed" | "denied" | "error";
reason?: string;
}
Open questions for relayauth
- Are
relayfile:ops, relayfile:sync, and relayfile:integration valid resource families under the existing scope parser, or do they need explicit resource/action validation updates?
- Should child-token issuance be modeled as a token endpoint option, a dedicated delegation endpoint, or an identity lifecycle operation?
- What is the expected revocation propagation SLA Relayfile should document for local mounts?
- Should attempted provider-connection access denials be represented as relayauth
scope.denied events, Relayfile audit events, or both?
Cross-repo follow-up
The Relayfile spec assigns work across:
AgentWorkforce/relayfile: filesystem enforcement, writeback metadata, generated _PERMISSIONS.md
AgentWorkforce/relayauth: identity, scopes, delegation, revocation, audit
AgentWorkforce/cloud: hosted provider connections and Cloudflare relayauth deployment
AgentWorkforce/relayfile-providers: provider credential resolution
AgentWorkforce/relayfile-adapters: writeback policy definitions
AgentWorkforce/relaycast: identity/correlation in invites
Context
Relayfile now has a draft cross-repo spec for mapping MCP-style per-user governance onto Relayfile's filesystem model:
AgentWorkforce/relayfilecodex/productized-cloud-mount-relayfiledocs/per-user-governance-contract.mdThe core framing is:
This issue tracks the
relayauthside of that contract.Why this matters
The Scalekit-style MCP-vs-CLI argument is right that customer-facing agents need governance properties that plain CLI does not provide:
Relayfile can provide those properties through file paths rather than MCP tool calls, but only if relayauth is the authority for agent identity, scoped tokens, delegation, policy, revocation, and audit semantics.
Relayauth-owned requirements
Relayauth owns identity, token, scope, RBAC, policy, revocation, and audit semantics.
Required changes from the spec:
org,wks,sponsorId,sponsorChain,jti,aud,exp, and delegatedparentTokenId.relayfile:fs:*:<path>relayfile:ops:*:<path>relayfile:sync:*:<path>relayfile:integration:*:<path>@relayauth/*packages platform-agnostic; Cloudflare storage, KV, D1, and Durable Object implementations belong inAgentWorkforce/cloudunderpackages/relayauth.Token shape expected by Relayfile
{ "sub": "agent_review_bot", "org": "org_acme", "wks": "ws_acme_support", "sponsorId": "user_jane", "sponsorChain": ["user_jane", "agent_lead", "agent_review_bot"], "scopes": [ "relayfile:fs:read:/github/repos/acme/api/pulls/*", "relayfile:fs:write:/github/repos/acme/api/pulls/*/reviews/*", "relayfile:ops:read:/github/*" ], "aud": ["relayfile"], "exp": 1772004000, "jti": "tok_example", "parentTokenId": "tok_parent_if_delegated" }Delegation acceptance case
Given a lead token with:
When the lead invites a sub-agent requesting:
Then relayauth should issue a child token with:
parentTokenIdsetDelegation denial case
Given the same lead token, when the lead invites a sub-agent requesting:
Then relayauth must reject issuance and emit an audit event for attempted escalation.
Audit fields Relayfile needs
For each token issuance, validation, scope check, denial, and revocation, Relayfile needs enough audit context to correlate with its own VFS/writeback logs:
Open questions for relayauth
relayfile:ops,relayfile:sync, andrelayfile:integrationvalid resource families under the existing scope parser, or do they need explicit resource/action validation updates?scope.deniedevents, Relayfile audit events, or both?Cross-repo follow-up
The Relayfile spec assigns work across:
AgentWorkforce/relayfile: filesystem enforcement, writeback metadata, generated_PERMISSIONS.mdAgentWorkforce/relayauth: identity, scopes, delegation, revocation, auditAgentWorkforce/cloud: hosted provider connections and Cloudflare relayauth deploymentAgentWorkforce/relayfile-providers: provider credential resolutionAgentWorkforce/relayfile-adapters: writeback policy definitionsAgentWorkforce/relaycast: identity/correlation in invites