One write path for people, agents, and redelivered requests

How a workspace where AI agents are members keeps one write path for people, agents and redelivered requests: complete mediation, a deputy rule, and deterministic ids as idempotency.

October 20265 min readAgent systemsSecurityPlatformsSession gateway and broker

Tightening black curved strokes ring a small chalk patch above centre, with muddy orange ochre streaks below and flat stone grey corners.
On this page
  1. Folding three services into one write path
  2. Keeping MCP and ACP on the same path
  3. Bounding the confused deputy
  4. Deterministic identity instead of entropy

Small demos prove that a constrained platform can deploy; they cannot prove it hosts a real-time, multi-user product of ordinary size. In a shared workspace with AI teammates, agents must be bound by private rooms, bans, moderation, and audit, yet a bot token or service account routes around policy, and each new integration adds another privileged door. Separately, under at-least-once delivery any request or agent turn can run twice, and random identifiers give a retry no way to recognize work already done.

Complete mediation, bounding the confused deputy, and idempotency through deterministic identity answer both. To test the platform at product scale, I rebuilt the server for Buzz on Ferrite, my cloud platform for single-dependency Rust apps with no sockets, clock, or randomness; Buzz (block/buzz) is Block’s open-source team workspace where every message is a signed Nostr event and AI teammates are channel members. Upstream runs a 60,000-line relay over Postgres, Redis, and S3 alongside separate agent processes. I kept Block’s protocol and client, ported the relay with upstream’s source at hand, and folded the backend into one 90,000-line crate where every write takes a single path, whether from a person, an agent, or a redelivered request, and missing entropy becomes what makes retries harmless.

Folding three services into one write path

Splitting a relay, an agent runtime, and a model gateway into three deployed services joined by private queues and internal service tokens makes sense for independent scaling or releases, but each internal hop creates an authority boundary that duplicates or bypasses the relay’s checks. Folding all three into one Rust crate turns two of those boundaries into plain function calls: agent actions call directly into the relay’s ingest path, and model inference is an async call over the outbound egress handle declared in the app’s manifest, keeping provider keys off every client. One internal queue stays, for agent turns, because at-least-once delivery is what lets a mention survive a crash.

With the caller inside the application, there is no service token and no bot exemption: an agent’s write passes the same checks as a person’s across validation, membership, moderation, rate limits, and audit. Agent keys stay off the wire too. Without randomness, each signing key is HMAC-derived from the relay’s secret and the agent’s name, so a client posts a name, never a key. A create-if-absent ownership claim prevents hijacking, and retiring an agent drops its key while keeping the claim so a reused name cannot post under a retired teammate’s history.

Keeping MCP and ACP on the same path

Complete mediation tends to erode at the perimeter when external integrations arrive. Buzz exposes two: the Model Context Protocol (MCP) for outside agents querying workspace context, and the Agent Client Protocol (ACP) for editors prompting a workspace agent directly. Neither official Rust SDK compiles under Ferrite’s one-dependency rule because both require tokio and OS crates, so both ship as dependency-free source packages sharing one bearer token system.

The MCP package implements the 2026-07-28 revision in server and client roles, an early implementation running eight days after the spec went final; against the deployed app, the specification authors’ conformance suite passes 34 core scenarios with none failing. Both doors keep the single path. MCP tools are read-only and re-authorized per call against the caller’s standing, because the relay holds no member’s signing key and exposing writes would post a person’s words under the relay’s identity. An ACP prompt runs the same turn pipeline as a mention, keeping editor-driven work under the workspace’s rate limits and audit log.

Bounding the confused deputy

Making an agent a member binds it to room membership and bans, yet still leaves a confused deputy: an outside caller who can invoke an agent in a private room can ask it to summarize what it sees.

That gap surfaced on ACP, where an editor prompt once checked only for a valid bearer token, letting any token holder have an agent read out a private room or post under its signature while banned. ACP now requires the requester’s own workspace identity, write standing, and management authority over the agent. Every turn also carries its requester into tool execution under a deputy rule: whether triggered by a mention, an editor prompt, or a scheduled run, an agent reads only what both it and the invoking member may see, and workspace-wide integrations require the requester to be an operator.

Deterministic identity instead of entropy

On Ferrite, HTTP requests, WebSocket frames, and queued turns arrive at least once, and slow HTTP requests may be hedged across stateless instances. In-memory deduplication is off the table, and without an entropy source I could not fall back on random IDs even if I wanted to, so deterministic derivation becomes the deduplication layer. Event IDs are hashes of their Nostr payloads, and agent keys, tool-approval tokens, and OAuth state are HMACs derived from inputs and secrets. With a write’s timestamp reserved under a correlation key, a retried tool call or redelivered request rebuilds byte-identical signed events that the relay has already admitted.

Mention dispatch applies the same property at the queue boundary. The triggering message’s content-derived ID travels on the turn request as its deduplication key; the runtime reads the agent’s session and that ID’s marker in one snapshot, then appends the trigger and writes the marker in a single conditional atomic commit. A racing or redelivered attempt loses the conditional commit or reads the marker and skips, collapsing repeated deliveries into one admitted turn with no crash window between the marker and the work.

Single-use HTTP authentication follows the same rule. Because consecutive requests may reach different instances, each write carries a short-lived, single-use signed authorization header. Rejecting replays looks safe until a hedged write consumes the header, finishes creating a channel, and loses the race back to the caller against a duplicate’s fast “already used” refusal, leaving the channel in the sidebar while its creation dialog reports an error. Single-use semantics mean the action executes at most once, not that a retry errors: after verifying the signature and bindings without ever caching a 401, the first delivery records its response under the header’s ID, and a duplicate waits for an in-flight original and replays that answer rather than reporting a completed write as failed.

Chris Chabot, October 2026