Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
docs(relayfile): Guides section — PR review bot walkthrough (local + cloud) and a copy-paste agent brief#59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
d65adea5f15280cb5ef2d839cb63b20e1ab592cecaFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -23,16 +23,24 @@ Every change — webhook, sync, or another agent's write — surfaces as the sam | ||
| ```json | ||
| { | ||
| "eventId": "evt_01HQ8K7M2YV3R0XW9F4ZB6T2QA", | ||
| "type": "file.updated", | ||
| "path": "/linear/issues/AGE-16__87389837-62b1-4e1a-a237-59218bab2974.json", | ||
| "revision": "rev_42", | ||
| "provider": "linear", | ||
| "origin": "provider_sync", | ||
| "timestamp": "2026-05-13T14:32:01Z" | ||
| "eventId": "evt_2507297", | ||
| "type": "file.created", | ||
| "path": "/runs/pr-59/findings/security.json", | ||
| "revision": "rev_2935117", | ||
| "provider": "runs", | ||
| "origin": "agent_write", | ||
cubic-dev-ai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "contentType": "application/json", | ||
| "contentHash": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", | ||
| "content": "{}", | ||
| "inlineContent": true, | ||
| "encoding": "utf-8", | ||
| "correlationId": "lt-1-1788520629", | ||
| "timestamp": "2026-09-04T11:17:09.694Z" | ||
| } | ||
| ``` | ||
| Small files arrive with their content inlined (`inlineContent: true`), so a handler often needs no follow-up read. `correlationId` carries through from the write that caused the event, which is how you tie an event back to the request that produced it. | ||
| - **`type`** is one of `file.created`, `file.updated`, `file.deleted`. | ||
| - **`path`** is the canonical file that changed. The path itself carries context — you know which provider and which record without parsing a payload. | ||
| - **`revision`** monotonically increases per file. Use it to order events and to fetch the prior state for a diff. | ||
| @@ -49,13 +57,15 @@ relayfile listen \ | ||
| --run "claude --print 'Triage this: {{path}}'" | ||
| ``` | ||
| `relayfile listen [WORKSPACE] [--provider PROVIDER] [--path GLOB] [--event TYPE] [--run CMD] [--format text|json] [--background]` streams the workspace's event feed. `--run` substitutes `{{path}}`, `{{type}}`, `{{provider}}`, and `{{revision}}` as single values, plus `{{event}}` for the whole event as space-separated `key:value` pairs — quote that one, or its dozen-odd tokens splatter across the command's arguments. `--format json` prints one event object per line, for piping into anything that isn't a shell command. To fan events out to a channel instead of a local process, bind the glob to a webhook with `relayfile integration bind <provider> <glob> --channel … --webhook … --webhook-token …`. | ||
| Or from the SDK with `onWrite`, which subscribes over the same WebSocket stream and dispatches by pattern: | ||
| ```typescript | ||
| import { onWrite } from '@relayfile/sdk'; | ||
| onWrite('/linear/issues/**', async (event) => { | ||
| if (event.source === 'agent') return; // ignore our own writes | ||
| if (event.origin === 'agent_write') return; // ignore our own writes | ||
| await agent.handle(event); | ||
| }, { client, workspaceId, operations: ['create', 'update'] }); | ||
| ``` | ||
| @@ -67,6 +77,7 @@ See [Agents](/docs/file/agents) for the framework helpers built on this. | ||
| - **At-least-once.** Events can repeat. Deduplicate on `eventId`; treat handlers as idempotent. | ||
| - **Ordering.** Per file, `revision` is the source of truth — wall-clock `timestamp` can be close together under bursty traffic. | ||
| - **Catch-up.** A subscriber that connects with a cursor receives the events it missed while disconnected, so a restart doesn't drop changes. If the WebSocket can't open, the SDK degrades to HTTP polling rather than going silent. | ||
| - **Reconnect.** Long-lived subscribers do get dropped — a busy workspace can end a stream mid-message — and a reconnect storm is answered with `429` on the WebSocket handshake. Supervise the subscriber (`relayfile listen --background`, or `relayfile supervisor install`) and back off between reconnects rather than looping immediately. | ||
| <CardGroup cols={2}> | ||
| <Card title="Real-time sync" href="/docs/file/realtime-sync"> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -56,13 +56,16 @@ Writes are durable: they're recorded in Relayfile's writeback queue and processe | ||
| ## Discovering schemas in-tree | ||
| You don't need an out-of-band schema registry. Per-resource schemas are discoverable in the tree itself at `<resource>/.schema.json`: | ||
| You don't need an out-of-band schema registry. Every writable resource advertises a JSON Schema and a create example in the workspace's own `/discovery` tree, whose paths carry literal placeholder segments: | ||
cubic-dev-ai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ```bash | ||
| cat mount/linear/issues/.schema.json | ||
| cat mount/discovery/github/.adapter.md # operations + ID patterns | ||
| cat mount/discovery/linear/issues/.schema.json # full record schema | ||
| cat mount/discovery/linear/issues/.create.example.json # minimal create payload | ||
| cat "mount/discovery/github/repos/{owner}/{repo}/pulls/{pullNumber}/reviews/.schema.json" | ||
| ``` | ||
| An agent that wants to create or patch a record reads the adjacent schema file to learn the expected shape, then writes a conforming JSON file. This keeps the contract co-located with the data — the same self-describing principle as [`LAYOUT.md` and `.layout.md`](/docs/file/mount-layout). | ||
| `.adapter.md` is the per-provider contract: which resources are writable, the ID pattern that decides whether a filename is a canonical record or a create draft, and which operations each resource supports. `.schema.json` is JSON Schema draft 2020-12 for the full synced record; fields marked `readOnly` are server-managed and are rejected on write. Read them before composing a payload — the same self-describing principle as [`LAYOUT.md`](/docs/file/mount-layout). | ||
| The exact write semantics and field mapping per provider are defined by the [adapters](/docs/file/adapters-and-providers), which own webhook-to-path mapping and writeback behavior. | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.