Skip to content
mierePublic

About

Opinionated agentic experience inside your Slack workspace

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

93 Commits

Folders and files

Repository files navigation

Murtaugh

Murtaugh is a Slack gateway for AI agents. People talk to it in Slack; the agents run on nodes such as Riggs, which connect to it over RAX.

Installing

Releases carry a murtaugh-gateway binary for Apple silicon (aarch64-apple-darwin), Intel Macs (x86_64-apple-darwin) and Linux (x86_64-unknown-linux-gnu). The repository is private, so download with gh:

target=aarch64-apple-darwin
tmp=$(mktemp -d)
gh release download --repo miere/murtaugh --pattern "*-$target.tar.gz*" --dir "$tmp"
(cd "$tmp" \
  && shasum -a 256 -c murtaugh-gateway-*-$target.tar.gz.sha256 \
  && tar -xzf murtaugh-gateway-*-$target.tar.gz)
install -m 0755 "$tmp"/murtaugh-gateway-*-$target/murtaugh-gateway ~/.local/bin/
rm -rf "$tmp"

The empty directory matters: the globs above match every version they find, so a tarball left over from an earlier install would make tar and install pick the wrong one.

~/.local/bin is on the PATH of the LaunchAgent that murtaugh-gateway launchd writes. To build from source instead: cargo install --locked --git ssh://[email protected]/miere/murtaugh murtaugh-gateway.

The macOS release binaries are signed with a self-signed certificate, so the folder and Accessibility approvals macOS asks for survive upgrades. A source build is ad-hoc signed, and macOS treats every one as a new program that has to be approved again.

Creating the Slack app

murtaugh-gateway slack-manifest --name Murtaugh > manifest.json

At https://api.slack.com/apps, choose Create New App → From a manifest and paste it. It turns on Socket Mode and asks for exactly the scopes and events the gateway uses. Two things a manifest cannot do: install the app to your workspace (Install App, which gives you the xoxb- bot token) and create the app-level token (Basic Information → App-Level Tokens, with the connections:write scope, which gives you the xapp- token).

Running the gateway

The gateway reads one small TOML file per alias, by default ~/.config/murtaugh/default/murtaugh.toml (--config PATH points elsewhere). Relative paths in it are resolved against its folder, so each alias keeps its own database, .env and logs apart. It holds only the Slack credentials, where the configuration store lives, and where nodes and clients dial:

[slack]
app_token = "${SLACK_APP_TOKEN}"   # xapp-…, for Socket Mode
bot_token = "${SLACK_BOT_TOKEN}"   # xoxb-…

[database]
backend = "sqlite"                 # or "firestore"
# [database.sqlite]
# path = "murtaugh.db"             # the default, beside this file
# [database.firestore]             # every field optional; Google's default credentials are used
# project_id = "my-project"
# database_id = "(default)"
# collection = "murtaugh"
# credentials_file = "~/sa.json"

[rax]                              # formerly [nodes], which still works
listen = "127.0.0.1:7443"          # put a TLS terminator in front; nodes and clients dial wss://…/rax/v1/link

[log]
level = "info"                     # trace, debug, info, warn or error
format = "text"                    # or "json"
turn_timings = false               # true logs, per turn, how long the node took to accept and answer

${VAR} is read from the environment first, then from env_file (by default a .env beside the file). Unknown keys are an error, and validate names every problem at once.

Only one gateway serves a Slack app at a time. With sqlite that holds across one machine; with firestore it holds across every gateway sharing the collection, and a standby takes over within 30 seconds of the leader dying. A standby refuses nodes with 503, so give each node every gateway's address and it finds the one serving.

murtaugh-gateway validate
murtaugh-gateway run

On macOS, murtaugh-gateway launchd manages a LaunchAgent that starts the gateway at login and restarts it if it stops:

murtaugh-gateway launchd install     # write the LaunchAgent
murtaugh-gateway launchd start       # hand it to launchd
murtaugh-gateway launchd status      # is it loaded, is it running, what did it exit with
murtaugh-gateway launchd restart     # shut the gateway down cleanly, then start it again
murtaugh-gateway launchd stop        # take it off launchd
murtaugh-gateway launchd uninstall   # stop it and delete the LaunchAgent

status is the one to reach for when launchd is being unhelpful — it digs the pid, the last exit code and the log paths out of launchctl print, and tells "never installed" apart from "installed but not loaded":

murtaugh.default is running (pid 4812).
  LaunchAgent: /Users/you/Library/LaunchAgents/murtaugh.default.plist
  last exit:   0
  out log:     /Users/you/Library/Logs/murtaugh/murtaugh.default.out.log
  err log:     /Users/you/Library/Logs/murtaugh/murtaugh.default.err.log

--alias NAME picks which gateway you mean: it names both the job (murtaugh.<alias>) and the configuration at ~/.config/murtaugh/<alias>/murtaugh.toml. It is global, so it goes with run and validate too, and it defaults to default.

install never replaces an existing plist unless you pass --update-existing, and it is the only one of the six that reads a configuration — the others act on the job --alias names, and refuse --config rather than quietly ignoring it.

stop and a plain restart unload the job, which asks the gateway to shut down cleanly: launchd sends SIGTERM and waits out ExitTimeOut (20 seconds unless you set it in the plist) before killing it. murtaugh-gateway launchd restart --force skips the wait and kills the process.

Logs go to ~/Library/Logs/murtaugh/. murtaugh-gateway version --check tells you whether a newer release exists; the repository is private, so set GH_TOKEN (for example GH_TOKEN=$(gh auth token)).

Who may use it

The gateway decides three things: who may use it (allowed users), who may connect nodes (node admins, who hold a grant), and which of their machines may connect (node tokens). Each rests on the one before it. Minting a token grants its owner, and granting someone allows them. Revoking a grant revokes every token that person holds, for good, and disallowing someone takes their grant too. Revoking one node leaves the grant alone, and revoking a grant leaves the person allowed.

The admin does all of this from the app's Home tab. A node admin's Home tab shows their tool approval mode and their own nodes, which they can mint, disable and revoke. A new token goes to its owner by DM. Anyone allowed also sees their client tokens (see below). Everyone else sees only the footer.

Each node's row says what the node is doing, as the node itself reports it: Working, with its open turns and background tasks counted across every gateway it serves, or Idle, which means a restart would interrupt nothing. A node too old to report shows as Connected and is never called idle. Idle is a snapshot, since a new turn can land a moment later. To restart a node safely, disable it, wait for its row to read idle, safe to restart, then restart it.

The same changes work from the CLI, which writes to the store directly and reaches a running gateway within seconds:

murtaugh-gateway admin set U0123ADMIN                 # the only onboarding step
murtaugh-gateway node mint --owner U0456ALICE --name laptop --token-file alice-laptop.token
                                                      # also grants Alice, and allows her
murtaugh-gateway grant approve U0456ALICE             # Alice may run nodes, and use the gateway
murtaugh-gateway user allow U0789BOB                  # Bob may use the gateway
murtaugh-gateway grant revoke U0456ALICE              # her tokens are revoked for good
murtaugh-gateway node revoke <selector>               # one node is disconnected
murtaugh-gateway user token mint --owner U0789BOB --name editor --scope rax --out bob-editor.token
                                                      # a client token; also allows Bob
murtaugh-gateway user token revoke <selector>         # one client is disconnected

A client token, mrtg_user_…, lets a person's own client use the gateway's nodes without running one, such as an editor bridged by murtaugh-client. Anyone allowed may mint one for themselves from the Home tab, and the admin may mint one for anyone. It needs no grant, and it stops working as soon as its owner is no longer allowed. Each token carries one or more scopes, the gateway's entry points it may open; each entry point checks only for its own. Today there is one, rax, the RAX API below (--scope, repeatable, on the CLI; checkboxes on the Home tab).

Tool approvals

Each node owner's tool mode decides how the calls agents make on their nodes are ruled on. allowed-whitelist, the default, runs or refuses a call that one of their rules matches, and puts any other to them as an approval card. always-allowed runs everything, and denied refuses every tool but the ones that only talk to people. Every node owner starts on a read-only whitelist (Read, Glob, Grep and the like), given at startup to owners without rules and when a node is minted.

A rule is a tool's name, or a name and a regular expression its call must match whole: the command for Bash, the path for Read, Write and Edit, the URL for WebFetch, the input as JSON for the rest. Bash(git (status|diff).*) allows those commands only, and a pattern never allows a command chained with ;, &&, |, backticks, $( or a redirect. Deny rules win over allow rules. Ticking "Remember my decision" on an approval card keeps it as a rule: the exact command for a shell call, the whole tool for the rest. The Home tab sets the mode and edits both lists under Manage rules; the CLI does the same:

murtaugh-gateway tools mode U0456ALICE allowed-whitelist
murtaugh-gateway tools allow U0456ALICE 'Bash(git (status|diff).*)'
murtaugh-gateway tools deny U0456ALICE WebFetch
murtaugh-gateway tools show U0456ALICE

A node can dial as soon as its token is minted: the gateway checks the store for a token it has not seen yet. The gateway never shows a token twice. Someone who isn't allowed gets a 🤐 reaction and nothing else. When the admin hands the gateway over, the old admin keeps their machines as a node admin.

Which nodes an allowed person may use is up to each node's owner, through the murtaugh_access metadata their node sends: {"policy": "always_allow"} shares it with everyone allowed on the gateway, and {"policy": "allow_list", "people": [...]} with the people listed. A node that says nothing serves its owner alone. So does a node that declares owner_only at initialize, whatever its metadata says: its agent's credential, such as a Claude subscription, may serve nobody else. Murtaugh offers owner_only, so such a node can connect at all.

A conversation is a Slack thread. It goes to the person's own node with the fewest live sessions, or, if none of theirs is connected, to the least busy node whose owner lets them in. If that node goes away, the next message says so and continues on another node, catching it up from the thread.

The RAX API

A client token also opens the RAX API, on the same listener as nodes: the client dials as a gateway (rax.v1.gateway) and Murtaugh plays the node toward it, relaying each session to a node of the fleet. That is how murtaugh-client acp puts an editor's agent sessions on your machines.

  • A session goes to the same node a Slack thread would, among those that take tool groups.
  • The tools a client lends a session reach the node suffixed with the client's link id, such as openknowledge_x7k2, and only that session may call them. Files the client links reach the node as bridge://<link id>/<uri>, and only a node holding one of the client's sessions may read them.
  • Tool calls are ruled by the node owner's tool mode and rules first. When those leave a call to a person, that person is the node's owner, since the tool runs on their machine: a client of their own asks them in the editor, and anyone else's client waits while the owner gets an approval card in their Slack DM. Sign-ins still go to the node's owner in Slack.
  • Client sessions live in memory and are never pinned. A client that stays away past the link's retention takes its sessions with it, and each person's Home tab lists their live ones.
Crate What it is
murtaugh-gateway The murtaugh-gateway binary.
murtaugh-client The murtaugh-client binary: a person's own client for the RAX API, such as an editor's ACP bridge.
murtaugh-common What both binaries share: credentials, logging that redacts them, the version check, the launchd job.
murtaugh-store Where the gateway keeps its configuration: SQLite on one machine, Firestore for a cluster.
murtaugh-slack A Slack client: Socket Mode and the Web API methods the gateway calls.
slack-sim A fake Slack that validates and records every call, for testing without a workspace.

The workloads API

POST /api/v1/workloads, on the same port as RAX, runs a prompt on one of the caller's nodes and answers in Slack. It needs a client token with the workloads scope, and returns 202 Accepted as soon as the run starts; it never waits for the answer.

curl -X POST https://murtaugh.example.com/api/v1/workloads \
  -H "Authorization: Bearer $(cat ci.token)" \
  -H "Idempotency-Key: nightly-2026-10-07" \
  -d '{"prompt": "Summarise the deploys from yesterday", "target": {"channel": "C0123ABCD"}}'
# 202 {"workload": "…", "channel": "C0123ABCD", "thread_ts": "1791…"}
  • target is {"channel": …} for a new thread, {"channel": …, "thread_ts": …} to continue one (as if its owner had written there), or {"dm": …}, which may only name the token's owner, or "me" for the same.
  • It fails closed, with {"error": …, "message": …}: 401 for no live token, 403 insufficient_scope, 400/413 for a bad body or a prompt over 32 KiB, 403 bot_cannot_post when the bot is not in the channel, 404 thread_not_found, 409 busy when the thread has a turn running, and 503 no_node (with Retry-After) when none of the caller's machines is connected.
  • The run is the token owner's: their nodes, and tool approvals for the node's owner alone, as a card in the node owner's DM, never in the target channel.
  • "output": "quiet" posts nothing of the turn itself: no thinking line, no streamed words, no tool cards. The thread gets what the agent posts with the slack group's send_message tool, the tables and charts it shows with show_table and show_chart, the files it attaches, and any failure notice. The default, "stream", is the usual thread, where send_message refuses: the agent's words already land there.
  • A repeated Idempotency-Key within 24 hours answers with the run it already started.

murtaugh-client

murtaugh-client acp lets an editor that speaks ACP run its agent sessions on your Murtaugh fleet. The editor starts it as an agent over stdio; it dials Murtaugh's RAX API with a client token and relays each session to a node.

Mint a client token from the Home tab (New client token) and save it with Murtaugh's address:

murtaugh-client login --gateway wss://murtaugh.example.com < editor.token

That writes ~/.config/murtaugh/client/default.toml and a default.token beside it, readable by you alone; --profile <alias> keeps several apart. Then point the editor's agent entry at:

murtaugh-client acp --name openknowledge
  • --name is the namespace the editor's tools are lent under: [a-z0-9_], at most 27 characters, acp by default. --gateway and --token-file override the profile.
  • The MCP servers the editor names for a session are connected here, on your machine, and lent to the session as one group; so are the editor's file reads and writes when it offers them. Files the editor links are read through the editor, unsaved changes included.
  • --root <dir>, repeatable, shares a folder from your disk, such as a notes vault, for editors that offer no file system of their own (Obsidian's Agent Client plugin does not). The session is lent read_text_file, write_text_file, edit_text_file and list_directory. A path that resolves outside every root, through .. or a link, is refused. When the editor does offer reads or writes, those still go through it.
  • The agent is told the editor's files are on your machine, not the node's, and which tools reach them, so it does not reach for its own file tools, which would act on the node.
  • A tool call your node's tool rules leave to a person is asked in the editor.
  • Logs go to ~/Library/Logs/murtaugh/client/<profile>.log, never stdout, which carries ACP.

murtaugh-client workload sends a workload from the command line with a profile's token, which needs the workloads scope. It posts to the profile's Murtaugh, prints what was started as JSON, and exits non-zero with Murtaugh's reason when refused:

murtaugh-client workload --channel C0123ABCD "Summarise the deploys from yesterday"
echo "What changed today?" | murtaugh-client workload --dm --quiet --idempotency-key daily-2026-10-08
murtaugh-client workload --channel C0123ABCD --thread 1791355057.511709 "And the day before?"

--dm is your own DM with the bot; --quiet posts only what the agent sends; --profile, --gateway and --token-file work as they do for acp.

Releasing

Push a tag such as v0.1.0. The release workflow builds both binaries for every target, stamps the version from the tag, and publishes the archives with their SHA-256 sums. Both workflows need a RAX_READ_TOKEN secret that can read miere/rax-rs, since Cargo fetches the RAX crates from that private repository.

Testing

cargo test --workspace
FIRESTORE_EMULATOR_HOST=localhost:8080 cargo test -p murtaugh-store   # the Firestore half

About

Opinionated agentic experience inside your Slack workspace

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages