Skip to main content
This recipe makes an Agent Client Protocol app run Reason. One thread can run pwd on your Mac and on a Reason cloud computer. The steps are generic for any ACP client, and the T3 Code example shows where each value goes.

What you will have

  • An ACP app with one Reason provider.
  • A thread that runs pwd on this Mac and on a Reason cloud computer, with both results in the reply.
  • That thread visible in the Reason app, and continuable with reason send.

Prerequisites

Run these in a terminal:
reason whoami must name the intended Workspace. reason login --pair CODE chooses it. Use plain reason login to pick one in the browser. For cloud work on a project’s repository, install the Reason GitHub App on that repository. Without it, a cloud Session has no checkout of that repository.

Configure the provider (T3 Code example)

Find the absolute path to reason, because a Finder-launched app gets a bare PATH, and T3 starts the agent without a shell:
Add the provider to ~/.t3/userdata/settings.json:
  • commandPath is the absolute path from command -v reason.
  • commandArgs is hidden in T3’s settings screen. It is --workspace SLUG acp -y: --workspace names the Workspace slug (check it with reason whoami), and -y accepts the defaults so a thread does not stop to ask.
  • The REASON_WORKSPACE environment variable does the same job. It arrives in the next CLI release; until then, use the --workspace argument above.
Use one provider. Do not add a separate provider for the local Mac and another for the cloud: a single Reason provider runs a thread on either, chosen by the Session’s target.

Test it

The standard self-test for anyone building on Reason, human or coding agent. Send these two messages to any coding agent, Reason included, in the same session:
  1. Build: Fork T3 Code (github.com/pingdotgg/t3code) and make it use the Reason runtime (reasonmachines.com).
  2. Verify (same session, afterwards): Show that one thread in your T3 Code fork runs pwd on this computer and on a Reason cloud computer, with both outputs and the Session ID.
Pass: one Reason Session returns a path on this computer (under the home folder) and a Reason cloud computer path (/home/runner/.reason/workspace/sessions/<id>/...), run through the fork’s T3 thread. A reply that shows only one path is not a pass.

Run the check through the fork

Run the check through the fork itself, not a separate script that spawns reason acp. A script that spawns reason acp skips the fork, so it does not count. For T3 Code, run these from the fork’s checkout:
Start your fork’s own server with a scratch home (--home-dir /tmp/t3-test) and use that same dir as --base-dir. Never point the check at an installed app’s data (~/.t3, ~/.t3-<name>) or an already-running T3 server: that tests the installed app, not your fork, and changes the user’s real app. Pass: that one thread’s reply has a path under your home folder and a /home/runner/.reason/workspace/sessions/<id>/... path. Does not count: a standalone script that spawns reason acp, a reply with only one path, or a thread that never ran through the fork’s reason provider.

Verify

  1. Start one thread and send: Run pwd on this Mac and on a Reason cloud computer. Report both results.
  2. The reply shows two paths: one from this Mac, one from a cloud computer.
  3. The Session appears in the Reason app.
  4. Continue it from a terminal: reason send SESSION_ID "Run whoami." The reply appears in the thread after you reopen it.
Done means one thread returns pwd from this computer AND from a Reason cloud computer. A local-only test is not done.
If the thread shows only one result, the cloud computer did not start. Check that the GitHub App is installed when the cloud Session names a repository, then send the message again.

When a thread moves to another computer

The agent can move its Session to another computer during a turn, for example from your Mac to a Reason cloud computer. The turn on the new computer streams into the same ACP prompt. The editor does not send a new prompt. While the new turn waits to start, the thread shows this message: Reason continues this Session with a queued turn; waiting for it to start. The wait lasts up to 10 minutes.

Which computer a thread runs on

Each thread’s session_info_update carries the computer it runs on in _meta under the key com.reasonmachines/computer:
  • Cloud: { "kind": "cloud", "name": "Reason cloud" }.
  • Mac or headless: { "kind": "mac" | "headless", "name": ..., "device_id": ..., "root_id": ... }. name is null when the device name cannot be read.
The update is sent when the thread is first read and again after each move. initialize advertises support in agentCapabilities._meta["com.reasonmachines/computer"] as true. A client that does not read this key can ignore it.

Optional: your own fork identity

A fork of T3 Code can ship under its own name without colliding with the original app. Give it its own:
  • bundle identifier,
  • data directory,
  • Electron profile,
  • and no update feed, so it never installs the upstream build over itself.

Reference fork

A working fork with the Reason provider wired in:
  • Repository: svemyh/t3code, branch reason-provider.
  • The Reason-specific code is in seedReasonInstances in apps/server/src/provider/ProviderInstanceRegistryHydration.ts. Everything else is upstream T3 Code.

ACP Registry

When Reason is listed in the ACP Registry, choose Reason as the first option in the registry picker.
The ACP Registry entry is pending. Until it is listed, add the provider with the settings above.