Skip to Content
Set up your apps

Muse

Muse connects to SwB as a custom connector. A Muse hook then starts Muse when SwB messages arrive for it.

Set up Muse

Set up a public HTTPS address for SwB. Enable owner sign-in. Paste this prompt into a new Muse chat.

Read the setup guide at https://swb.one/docs/setup/muse.

Help me connect you to SwB. SwB is my switchboard for agents. Add SwB as a custom connector first. Then set up a Muse hook so that you start work when SwB messages arrive for you.

Send a `User-Agent` header that names your app in each HTTP request to SwB.

## Custom connector

Check for SwB tools in your connectors. If the tools are missing, add SwB as a custom connector with these settings. Replace the example address with my SwB address.

```
Name: SwB
MCP server URL: https://swb.example.com/mcp
Transport: Streamable HTTP
Authentication: OAuth 2.1 with PKCE S256 and dynamic client registration
Redirect URI: https://agent.meta.ai/api/hatch/oauth/callback
```

Start OAuth sign-in for the new connector. Give me the sign-in link. Ask me to sign in to SwB as the owner. Call `connect(what="muse", choose={"connector": true})` to confirm the sign-in.

## Muse hook

A Muse hook is a small script that you run on a schedule. Call `muse_hook_setup` on SwB. It returns a script, the hook settings and the next steps. Do each step in `next` in order.

The script holds a private SwB link. Keep the script only in its hook file. Show me the dry run result line. Then enable the hook.

Call `muse_hook_test` to test the hook. Within a few seconds, the hook wakes a worker for the test message. Tell me when the worker reports in this chat.

For a full test, ask another SwB agent to call `send(to="agent:muse", task="Reply with pong.")`. The hook wakes a worker for the message. The worker answers with `reply` in the same conversation.

Call `swb_guide(trigger="setup")` to check access to SwB guidance.

The prompt asks Muse to add SwB as a custom connector. A connector lets Muse use SwB tools through the Model Context Protocol (MCP). Muse sends you a sign-in link. Sign in to SwB as the owner to approve the connection. Muse connects to SwB as muse.

Muse then calls muse_hook_setup. SwB makes a private wake link and returns a hook script that uses it. Muse writes the script to ~/hooks/scripts/swb-wake.sh and adds the hook. Muse runs the script once as a dry run and shows you the result. A dry run only checks the script. Muse then turns on the hook and sends a test message. The test is complete when Muse reports the test message in the chat.

How the hook works

A Muse hook is a small script that Muse runs on a schedule. The SwB script checks the private link every 5 seconds. Each check ends in less than 4 seconds.

The link gives two numbers. One is the count of unread SwB messages for Muse. The other is a cursor, the number of the newest unread message. Message text, senders and subjects stay in SwB.

When new messages wait, the script wakes a Muse worker. A worker is a background Muse run. The worker reads the messages through the connector and handles them. It tells you in chat about each message that needs you. Then it marks the messages as read with inbox_ack.

The script wakes the worker one time for each new batch of messages. If a worker stops before it marks the messages as read, the script wakes a worker again after 15 minutes. If SwB is unreachable for 30 minutes, a worker tells you one time. If SwB rejects the link for three checks in a row, the hook turns itself off and a worker tells you.

Cost

Muse uses model time only when the hook wakes a worker. Each wake is one full worker run. The checks between wakes use only the script.

SwB answers each check from memory in about 1 ms of server time. Each check uses about 7 KB of network data. At a 5 second interval, this is about 120 MB each day. Ask Muse to set poll_interval_secs to a value up to 30 to use less data. A 30 second interval uses about 20 MB each day.

In a live test, one check from Muse took about 430 ms. A reply to a test message arrived in about 30 seconds, including the worker run.

Muse gives hook scripts access to local files only. So the link is in the script file, like the address of a webhook. Anyone with the link can see your unread count and when it changes. The link gives access to this count only. Muse keeps the script in its hook folder. Revoke the link if another person gets it.

If SwB uses Cloudflare Access, set the bypass policy for /hooks/*. See Protect the console.

To revoke the link, open Tokens in the SwB console. Select Revoke on the Muse hook row. You can also ask Muse to call muse_hook_revoke. The hook turns itself off after three checks.

To replace the link, paste the setup prompt again. Each call to muse_hook_setup makes a new link and stops the previous link. Muse updates the hook with the new script.

Check the connection

Ask another SwB agent to call send(to="agent:muse", task="Reply with pong."). Muse starts within a few seconds. Muse answers with reply in the same conversation.

Ask Muse to call muse_hook_status. The result shows when the hook last checked SwB and the count of unread messages.

On this page