PLOWSHARE
RELAY / INTERNAL MESSAGINGDURABLE FACTS, INDEPENDENT SUBSCRIBERS

Publish once.
Keep work connected.

Relay is Plowshare’s internal durable publication broker. It carries typed facts through scoped topics, gives each subscriber its own position and retains the branches that route an event into work.

A fact becomes
available to work.

Use Relay when several independent consumers need to react to the same committed event. Each subscription progresses at its own pace.

  1. Publish a typed fact

    A publisher appends an event to a project or system topic. Lifecycle notices follow committed changes through a transactional outbox; rolled-back changes produce no notice.

  2. Admit input for each subscriber

    The server copies the event payload and selected routes into durable branches before advancing that subscriber’s seen position. One subscriber’s position does not advance another’s.

  3. Dispatch the selected branches

    A branch can submit an agent job, run a pinned JavaScript handler, start a granted orchestration or forward the original payload to another topic in the same project.

  4. Follow the owning result

    Seen means the input became available. An ACCEPTED work branch records the receiver’s receipt. Follow that job or orchestration and its conversation for completion and actual effects.

Choose the contract for your exchange.

Direct agent messaging provides addressed conversations and correlated replies. Relay provides topic subscriptions and independent fan-out. Messaging and Board wakes use Relay internally while their owning inboxes, histories and recovery rules remain in place.

Address an assistant and follow its reply →

Keep events
in their scope.

Topic scope and payload type are part of the contract. Lifecycle events carry references; their original content stays in the owning system.

Built-in Relay publications
Topic familyWhat it carriesScope
schedule.dueA due schedule occurrence; the built-in subscriber admits its existing firing.Owning schedule scope
job.started, job.endedJob reference, persisted agent definition and actual lifecycle state.Project, or system for global jobs
approval.*, orchestration.*Approval decisions, run changes, questions and child completion references.Owning project, or system for a global conductor
board.*Public topic, post, resolution and closure references.Board project
message.* lifecycle and native wake topicsPrivate mailbox lifecycle and already admitted wake references.Server-private system scope

The asterisks above group related names; subscriptions select exact topics. Lifecycle notices include no message body, command, question text, answer or orchestration result. Private messaging topics preserve account-private visibility.

Routing preserves authority

Dispatch checks current project access, exported agents, orchestration grants and remote session ownership. A cross-project work destination also needs the existing two-sided messaging route authority. A routing file cannot grant tools or access.

Personal and system visibility

Project inspection requires live access. Personal logs are owner-only; system inspection requires server administration. Private execution receipts and conversation links are returned only to their submitting owner.

Exact topic names, payloads and scope rules ↗

Select subscriptions.
Declare their routes.

Create Relay/ in the project’s effective definitions tier. Explicit activation selects packages; other folders are ignored.

For this example, create Relay/active.json and Relay/notices/routes.js. The project must have an exported, served code_reviewer agent with the tools and limits needed for the assignment.

Relay/active.json
{"version":1,"active":["notices"]}
Relay/notices/routes.js
export const manifest = {
  version: 1,
  subscriptions: [
    {name: 'due', topic: 'schedule.due',
     kind: 'schedule.due', start: 'latest'}
  ]
};

export function route(event) {
  return [{
    name: 'review',
    receiver: 'agent.run',
    work: {agent: 'code_reviewer'}
  }];
}

This creates subscriber relay.notices.due. Its initial latest position starts with future publications; oldest-retained includes available retained history. Existing subscribers keep their durable position. The example selects every new due occurrence in this scope; use the event payload to filter when only selected schedules should cause work.

Bounded routing

The synchronous ES module has no host, filesystem, network or import access. It returns zero to 32 uniquely named branches. Supported subscription payload families are empty, text, schedule.due and lifecycle.

Choose a receiver

agent.run selects an agent. orchestration.start selects an agent and granted definition. script.run selects an agent and a handler under the package’s scripts/ folder. relay.publish forwards the original typed payload using publishTo.

Handlers retain their source and permissions.

A script handler uses the existing durable script driver. Admission pins its source; later edits affect future work. Commands, results and source hashes remain inspectable, and the selected agent supplies normal grants, hooks, approvals, cancellation and budgets.

Handler examples and full routing grammar ↗

Activate work
deliberately.

A project route declares what to do. Automatic project subscriptions also need an explicit project/account binding in server configuration; the default binding list is empty.

One bounded pass

relay.process runs an authenticated pass with Contributor access. It admits at most one publication per subscription, with overall limits of 32 inputs and 32 branch dispatches, or a requested lower limit. A subscription with another live owner is skipped.

Automatic workers

Configured workers supervise active packages and consume each subscription independently. Database leases fence ownership. Committed publications signal local workers; startup and fallback reads recover missed signals. Server bindings change on restart, while project activation changes are detected during configuration checks.

Invalid configuration, lost access or offline definition sources pause work while retaining input. Removing an active package stops its automatic workers and preserves its offsets and branches for reactivation. The scheduler’s compatibility subscriber operates independently of these project bindings.

Worker configuration, limits and supervision ↗

Read the log.
Follow the receipt.

The desktop Relay page shows scoped publications, retention policy, gaps, seen positions, recent deliveries and pinned source hashes. It can open owned execution trajectories.

Authenticated Relay operations
OperationPurpose
relay.topicsList existing topics in a selected project or authorized system scope.
relay.logRead publications, subscriber positions, gaps and recent branches.
relay.processPerform a bounded admission and dispatch pass for a project.
relay.operateApply an explicit manager control to an inspected project topic or subscription.

Java’s RelayClient, the shared TypeScript client and CLI expose these operations. CLI commands are relay topics, relay log, relay process and relay operate, using their normal JSON payloads and an explicitly configured server connection.

Reads preserve processing state.

Refreshing and paging never create a subscriber, advance its position or acknowledge a gap. Positions and pagination cursors are decimal strings. A recent branch can remain visible after its original publication expires; its receiver receipt is the path to the owning result.

Request shapes, paging and client contracts ↗

Keep gaps and
uncertainty visible.

Topic retention defaults to four days. Optional Relay/topics.json sets project topic policies. Expiry records a boundary; lagging subscriptions report a gap.

Retained input survives expiry

Already admitted payloads and branches survive topic expiry. A gap stops new admission for that subscription while its existing branches can still dispatch. Reading or processing never acknowledges the gap.

Unknown effects stay unknown

A dispatch intent with an unknown outcome becomes UNCERTAIN. A lost acknowledgment or expired lease cannot authorize blind replay. Read-only reconciliation checks the owning receiver receipt; an absent receipt still leaves the effect unknown.

Explicit recovery controls
ActionMeaning
ACKNOWLEDGE_GAPAdvance only through the exact inspected expired boundary.
RECONCILERecord a known resolution from the owning receiver receipt.
ABANDONAbandon ready or uncertain branch handling; an unknown effect remains ABANDONED_UNCERTAIN. Receiver work is not cancelled.
REMOVE_SUBSCRIPTION, REMOVE_TOPICRemove inactive, empty metadata only when the required configuration and retained-state checks pass.

Controls require project Manager access, or the exact Personal owner, an explicit reason, a stable UUID request ID and generations from current inspection. Branch controls also check state and fence. System topics and built-in subscribers stay under their owning runtime’s control.

Retention, recovery and operational control reference ↗