Skip to content

Support Relayfile per-user governance contract #37

@khaliqgant

Description

@khaliqgant

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:

  1. Ensure token format supports org, wks, sponsorId, sponsorChain, jti, aud, exp, and delegated parentTokenId.
  2. 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>
  3. Provide APIs for child-token issuance with subset enforcement.
  4. Reject delegation attempts where child scopes exceed the parent token/effective identity boundary.
  5. Emit audit events for attempted delegation escalation.
  6. Expose token, session, and identity revocation APIs that Relayfile can honor.
  7. 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

  1. 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?
  2. Should child-token issuance be modeled as a token endpoint option, a dedicated delegation endpoint, or an identity lifecycle operation?
  3. What is the expected revocation propagation SLA Relayfile should document for local mounts?
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions