mash

module
v0.5.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0

README

mash

release CI security checks SLSA Build L2 quick start Ask DeepWiki

mash ("mail mesh") gives each of your AI agent sessions an inbox that keeps its mail. The inbox lives on a NATS server (NATS is an open-source message server). Mail waits (in a single-replica inbox; see durability), signed by its sender, until the recipient has seen it, whether that session is busy, idle or stopped, on this machine or another. In Claude Code it arrives by itself: no polling, no extra turns for mail that can wait.

The key values that mash provides:

  1. Fast, durable, secure mail between agents.
  2. No polling, no blocking, no extra turns.
  3. Location-agnostic.
  4. Agent discovery and presence.
  5. Agent wake on urgent message delivery.

▶ Watch the 2½-minute demo: the setup skill installs mash, then two Claude Code sessions, Bob and Alice, exchange mail, including a wake of an idle session. Recorded on a personal Claude account with Claude Code's development-channels flag, which a personal account needs to wake an idle session, as the setup skill offers. To try it yourself, start at the quick start.

https://github.com/user-attachments/assets/3dcf1c71-196b-4dc9-b915-8ddbcf94202f

mash is deliberately small: one Go binary per agent (an "agent" here is one running Claude Code session, named by you; the docs also call it an endpoint), one outbound connection to one NATS server, no open ports and no per-agent server. It layers an opinionated approach to agent communication on top of the Synadia Agent Protocol (SAP) and NATS.

What each layer does: the stack.

What mash does differently

Mail, kinds and fewer turns

Mail is asynchronous: the recipient does not have to be online when it is sent, and several messages can arrive together in one turn. Each message has a kind: blocker, question, task, result or fyi. A sender can also mark a message urgent; that counts only when the sender is verified. The kind decides when the mail reaches the recipient:

  • A busy session sees new mail with its next tool result, inside the turn it is already taking.
  • An idle session is woken for a blocker, question or task (after 45 seconds by default), and at once for urgent mail.
  • A result or fyi never wakes anyone. It waits for the session's next turn.

For example, an idle agent receives five fyi messages, which wait, then a blocker, which wakes it. All six arrive together in that one turn. Five turns are skipped; with 500K tokens in the context window, each would have read the whole context again, so that is up to 2.5M input tokens not spent. Waking an idle session needs Claude Code to load mash's channel, which depends on your account (wake an idle session). How delivery works, with the local spool and worked examples: receive and wake.

Identity and security

Each mash endpoint is one agent session. Each endpoint is its own NATS user: an NKEY (an ed25519 key pair) and a user JWT, signed by your account's key, that says which subjects the endpoint may use. That gives it one identity on the NATS server. mash signs every message with the sender's key, and the receiver checks the signature against a directory of who holds which name. Every connection to the server uses TLS, so mail is encrypted on the network; the server itself can read it. An endpoint does not have to be an agent: a person at a terminal or a script can hold one and mail agents with mash send and mash inbox (scripts). More: identity, trust and the security model and SECURITY.md.

Today an endpoint can mail any endpoint of the same owner, and no other owner's. Next on the roadmap is a messaging policy: a central set of rules for who may mail whom, so teams that care about security can restrict it. With a well-configured sandbox, it gives finer control over what agents can say to each other, and still allows more complex patterns and topologies.

Location independence and presence

Other agent messaging systems need to know where the remote agent is on the network: a DNS name or an IP address. mash uses NATS, so an agent is found by its name, not its location. Each agent announces that it is online with a heartbeat, and keeps its own connection to the server, reconnecting when it drops, with no polling and no model turns. So there is less network setup, an agent can move to another machine or network without anyone changing their configuration, and firewalls and network address translation (NAT) are simple to handle:

  • An agent behind NAT dials out to the server on TCP 4222 by default; no inbound port is opened on its side.
  • NATS leaf nodes can connect a whole private site to a hub over one outbound link, usually on TCP 7422, carrying messages both ways.
  • mash can connect over secure WebSockets (wss://), usually on port 443, where a firewall allows only that.
  • NATS sends PING and PONG to check that an idle connection is still alive.
  • If a firewall or NAT drops the connection, the agent reconnects outbound and its subscriptions are restored.

If you are an agent

Install the mash-setup plugin and use its setup skill: it asks the person before each step. Never pipe a download into a shell. The person decides every answer.

Why not Claude Code's built-in cross-session messaging? It is tied to one agent host and one user, needs a claude.ai sign-in to reach another machine, holds mail for an offline session only until it reconnects, and describes no sender proof. Use mash when mail must outlive the recipient's session, when you want signed sender proof with trust labels, when you run your own NATS server, or when more than one user or machine is involved. The comparison table is in architecture.md, and comparison.md says when the built-in feature is the better choice.

How mash connects sessions

Two paths, one bus: live traffic (presence, status, live prompts) rides plain NATS and is not stored; mail rides JetStream (the NATS feature that stores messages on the server) and is kept up to 30 days. (details)

Status: v0.5.10, pre-1.0. One host adapter (Claude Code). Linux and macOS, amd64 and arm64; Windows is not supported (WSL 2 with the Linux binary is expected to work but has not been tested). Interfaces may still change before 1.0. Known limits are listed in the comparison.

Get started

mash gives each Claude Code session an inbox. Here two sessions on one machine mail each other. You need Debian or macOS (tested) or Ubuntu (expected to work; see compatibility), git and Claude Code 2.1.312 or newer. The Claude Code part was last run live on 0.5.9. Everything is installed in your home folder, with no sudo.

  1. Add the setup skill:

    claude plugin marketplace add bogworks/mash
    claude plugin install mash-setup@mash
    
  2. In a Claude Code session, say:

    Set mash up on this machine, with two agents: acme.demo.alice and acme.demo.bob.

    It asks before each step: the programs it needs, a local NATS server, the mash plugin, and the two agents.

  3. Start a session as each agent, in two terminals. The setup wrote one command for each agent, so you type one word:

    bob
    alice
    

    They are small files in ~/.local/bin. If your shell says command not found, open a new terminal, or add ~/.local/bin to your PATH (by hand, step 2).

    Each starts Claude Code with its address as the session's name, so you can tell who you are talking to (for a session already open, type /rename acme.demo.alice), and says on its first turn whether mail wakes it when idle. That wake needs Claude Code to load mash's channel, which depends on your account: see wake an idle session. Without it, mail arrives at the session's next prompt or tool call. Claude Code asks whether to trust the folder; choose yes.

  4. In Bob's session, say: "Send alice a note: lunch at noon?" In Alice's, say: "Do I have mail?" She sees two notes from Bob, both verified: the setup's test note, then yours.

Mail waits. Close Alice's session, send again from Bob's, reopen hers, and it is there.

Install the programs yourself

The setup skill above does this for you. To do it by hand, download the install script of the latest release, check it, and run it. It puts mash and mashctl in ~/.local/bin, with no sudo:

BASE=https://github.com/bogworks/mash/releases/latest/download
curl -fsSLO $BASE/install.sh -O $BASE/SHA256SUMS &&
grep ' install.sh$' SHA256SUMS | sha256sum -c - &&  # macOS: shasum -a 256 -c -
bash install.sh

More in docs/install.md.

Check the download

install.sh checks each binary against the release's SHA256SUMS. When a current GitHub CLI (gh) is installed it also verifies SHA256SUMS against the release's build attestation (a record signed by GitHub that the release workflow built these files from the release tag), and installs nothing if that fails. Without gh it installs on the checksums alone and prints a one-line warning on stderr that it checked checksums only and did not verify. gh attestation verify needs a current gh; which version, and where to get it. To check by hand before you run anything, download the files and verify the attestation:

BASE=https://github.com/bogworks/mash/releases/download/v0.5.10
curl -fsSLO $BASE/install.sh -O $BASE/SHA256SUMS -O $BASE/mash.intoto.jsonl &&
gh attestation verify SHA256SUMS -R bogworks/mash --bundle mash.intoto.jsonl \
  --signer-workflow bogworks/mash/.github/workflows/release.yml --source-ref refs/tags/v0.5.10

The rest (checking install.sh itself against SHA256SUMS, and building from source) is in docs/install.md.

Documentation

Synadia Cloud

Synadia Cloud is not supported in 0.5.10 (#876); see docs/synadia.md.

Addresses and the Synadia Agent Protocol

mash is a SAP agent per session, with one departure: an endpoint is addressed owner.group.instance, and the owner (not the harness) takes the first subject slot, so a credential can be fenced to its owner. Details, and what that means for discovery, are in docs/sap.md.

How it works

The design, with every subject, permission and limit, is in docs/specs/2026-10-21-mash-design.md.

Releases

How releases are built and checked: docs/release.md.

Changelog

What changed in each release: CHANGELOG.md.

Contributing

See CONTRIBUTING.md. Everyone taking part follows the Code of Conduct.

License

Apache-2.0. See LICENSE.

Directories

Path Synopsis
cmd
mash command
Command mash is a messaging mesh for agents: a Claude Code channel server (mash serve), and a CLI for people and scripts.
Command mash is a messaging mesh for agents: a Claude Code channel server (mash serve), and a CLI for people and scripts.
mashctl command
Command mashctl administers a mash deployment: it creates the directory and lease buckets, sets endpoint metadata, and prints limits and the NATS permissions an endpoint user needs.
Command mashctl administers a mash deployment: it creates the directory and lease buckets, sets endpoint metadata, and prints limits and the NATS permissions an endpoint user needs.
internal
admin
Package admin provisions mash endpoints: the permission template a NATS user needs, and the streams, consumer and directory record behind it.
Package admin provisions mash endpoints: the permission template a NATS user needs, and the streams, consumer and directory record behind it.
adrindex
Package adrindex generates docs/decisions/INDEX.md from the records' front matter (ADR 0068).
Package adrindex generates docs/decisions/INDEX.md from the records' front matter (ADR 0068).
apply
Package apply is mashctl's view of the account resolver through the system account (ADR 0052): it looks the account JWT up on the servers, pushes a revision of it signed with the operator key, and reads it back to verify.
Package apply is mashctl's view of the account resolver through the system account (ADR 0052): it looks the account JWT up on the servers, pushes a revision of it signed with the operator key, and reads it back to verify.
cellwidth
Package cellwidth measures text in terminal cells: 1 for most characters, 2 for East Asian wide and fullwidth ones and emoji, 0 for combining marks.
Package cellwidth measures text in terminal cells: 1 for most characters, 2 for East Asian wide and fullwidth ones and emoji, 0 for combining marks.
claudesettings
Package claudesettings reads Claude Code's managed settings, read-only, to say whether mash is on the channel allowlist.
Package claudesettings reads Claude Code's managed settings, read-only, to say whether mash is on the channel allowlist.
cliframe
Package cliframe is the frame shared by the mash and mashctl command lines: the global options, accepted anywhere in the arguments, and the error report.
Package cliframe is the frame shared by the mash and mashctl command lines: the global options, accepted anywhere in the arguments, and the error report.
cmdcore
Package cmdcore defines a command once and serves it through both doors: the command line and an MCP tool.
Package cmdcore defines a command once and serves it through both doors: the command line and an MCP tool.
cmdcore/cmds
Package cmds holds the commands defined on cmdcore: each is a params struct, a result struct and a Run, served through both the command line and the MCP tool.
Package cmds holds the commands defined on cmdcore: each is a params struct, a result struct and a Run, served through both the command line and the MCP tool.
cmdcore/render
Package render holds the small text helpers shared by the commands' human output: relative times, aligned tables, the terminal width, colour and plural counts.
Package render holds the small text helpers shared by the commands' human output: relative times, aligned tables, the terminal width, colour and plural counts.
config
Package config loads mash's settings: config.json in the config directory (see ConfigDir), then the environment, which wins.
Package config loads mash's settings: config.json in the config directory (see ConfigDir), then the environment, which wins.
ctl
Package ctl is the admin verb set of mashctl.
Package ctl is the admin verb set of mashctl.
ctlkeys
Package ctlkeys is the key store of mashctl: the account signing seed (and the operator and system keys of a server `mashctl init --local` stood up), kept as 0600 files in a 0700 directory (ADR 0052).
Package ctlkeys is the key store of mashctl: the account signing seed (and the operator and system keys of a server `mashctl init --local` stood up), kept as 0600 files in a 0700 directory (ADR 0052).
endpoint
Package endpoint is one mash endpoint: its NATS connection, identity, lease, inbox and view of the directory.
Package endpoint is one mash endpoint: its NATS connection, identity, lease, inbox and view of the directory.
enroll
Package enroll signs the user credential of an endpoint from a PUBLIC key the endpoint made, so no private key reaches the central host, and records the endpoint (issue record, directory record, inbox).
Package enroll signs the user credential of an endpoint from a PUBLIC key the endpoint made, so no private key reaches the central host, and records the endpoint (issue record, directory record, inbox).
host
Package host isolates what is specific to the agent host a mash session runs in (Claude Code today), so other hosts (Hermes, Pi) can plug in later.
Package host isolates what is specific to the agent host a mash session runs in (Claude Code today), so other hosts (Hermes, Pi) can plug in later.
issue
Package issue is the issue service (REQ-013, ADR 0104): it takes a request that holds a sender's PUBLIC key and the address the key is for, countersigned by the requester on the sender's host, and returns a user JWT for that key, signed with the owner group's scoped signing key and carrying the tags mash's own table gives that address.
Package issue is the issue service (REQ-013, ADR 0104): it takes a request that holds a sender's PUBLIC key and the address the key is for, countersigned by the requester on the sender's host, and returns a user JWT for that key, signed with the owner group's scoped signing key and carrying the tags mash's own table gives that address.
joinfile
Package joinfile is the join file: the one text file whoever runs a mesh hands to a machine that is to join it.
Package joinfile is the join file: the one text file whoever runs a mesh hands to a machine that is to join it.
keycred
Package keycred makes a user key pair.
Package keycred makes a user key pair.
kind
Package kind is a message's kind: what the sender wants of the recipient, which decides whether it wakes an idle session.
Package kind is a message's kind: what the sender wants of the recipient, which decides whether it wakes an idle session.
listset
Package listset turns a list set into scoped-key permission templates and per-sender tags, and refuses to produce anything the NATS server would not enforce exactly as the lists say.
Package listset turns a list set into scoped-key permission templates and per-sender tags, and refuses to produce anything the NATS server would not enforce exactly as the lists say.
mcp
Package mcp is a minimal Model Context Protocol server over stdio, enough to be a Claude Code channel: initialize (declaring claude/channel), tools, ping, and notifications/claude/channel.
Package mcp is a minimal Model Context Protocol server over stdio, enough to be a Claude Code channel: initialize (declaring claude/channel), tools, ping, and notifications/claude/channel.
mint
Package mint makes the NATS user JWT and creds of one endpoint: signed by the account signing key and carrying the endpoint's own permission set (admin.Permissions).
Package mint makes the NATS user JWT and creds of one endpoint: signed by the account signing key and carrying the endpoint's own permission set (admin.Permissions).
namerule
Package namerule reads and applies mash's name-acceptance rule file, name-rule@1 (docs/name-rule.md, ADR 0077).
Package namerule reads and applies mash's name-acceptance rule file, name-rule@1 (docs/name-rule.md, ADR 0077).
natsauth
Package natsauth connects to NATS with a user creds file without turning the client into a signing oracle.
Package natsauth connects to NATS with a user creds file without turning the client into a signing oracle.
natsfixture
Package natsfixture is test fixtures only: nothing in a release binary may import it (isolation_test.go checks).
Package natsfixture is test fixtures only: nothing in a release binary may import it (isolation_test.go checks).
policy
Package policy holds the size limits the JWTs mash makes must fit.
Package policy holds the size limits the JWTs mash makes must fit.
policyapply
Package policyapply is the core of the applied-policy gate (contract mash-messaging-policy REQ-011, draft-3).
Package policyapply is the core of the applied-policy gate (contract mash-messaging-policy REQ-011, draft-3).
policydoc
Package policydoc decodes the list-set document: the one value per account that a policy author keeps and mash applies.
Package policydoc decodes the list-set document: the one value per account that a policy author keeps and mash applies.
policyintake
Package policyintake is the intake of list sets: it watches the key `listset.<account>` of the policy bucket, checks each delivered revision against the account's adoption marker, hands a verified list set to an applier and reports every refusal.
Package policyintake is the intake of list sets: it watches the key `listset.<account>` of the policy bucket, checks each delivered revision against the account's adoption marker, hands a verified list set to an applier and reports every refusal.
policyserve
Package policyserve is the production assembly of the list-set intake: the adapters the intake needs (decode, document in force, refusals, held keys, the write guard), the signer over the key store, the server limits read through the system account, and the Applier that builds everything policyapply.Apply needs for one verified document.
Package policyserve is the production assembly of the list-set intake: the adapters the intake needs (decode, document in force, refusals, held keys, the write guard), the signer over the key store, the server limits read through the system account, and the Applier that builds everything policyapply.Apply needs for one verified document.
policyview
Package policyview is the responder behind `mash policy show` and `mash policy explain` (REQ-010).
Package policyview is the responder behind `mash policy show` and `mash policy explain` (REQ-010).
portable
Package portable holds the portable-code lint: a plain go test that walks the source tree and counts places where product code carries a personal convention (a person's or machine's name, a home or temp path, a foreign GitHub org, an inline long timeout).
Package portable holds the portable-code lint: a plain go test that walks the source tree and counts places where product code carries a personal convention (a person's or machine's name, a home or temp path, a foreign GitHub org, an inline long timeout).
reconcile
Package reconcile is the first-list-set reconcile of an adopted account (AT-015, ADR 0111): it plans, and with a signer executes, the removal of what the account held before its first list set that the list set does not own.
Package reconcile is the first-list-set reconcile of an adopted account (AT-015, ADR 0111): it plans, and with a signer executes, the removal of what the account held before its first list set that the list set does not own.
refgen
Package refgen generates the plain-markdown command reference under docs/reference from the spec files in spec/.
Package refgen generates the plain-markdown command reference under docs/reference from the spec files in spec/.
releasenotes
Package releasenotes is the one place that judges a release's notes (ADR 0105, release standard rule 23): a release's notes and its change-log section are the same text, and it opens with prose before any list.
Package releasenotes is the one place that judges a release's notes (ADR 0105, release standard rule 23): a release's notes and its change-log section are the same text, and it opens with prose before any list.
render
Package render turns mail into the text a Claude session sees: a small batch in full, a large one as a digest of one line per message.
Package render turns mail into the text a Claude session sees: a small batch in full, a large one as a digest of one line per message.
requesterreg
Package requesterreg is the static requester registry: a file that says which requester public key may countersign an issue request for which host and owner group (REQ-013, ADR 0104).
Package requesterreg is the static requester registry: a file that says which requester public key may countersign an issue request for which host and owner group (REQ-013, ADR 0104).
sap
Package sap implements the parts of the Synadia Agent Protocol 0.3 that mash uses: subjects (§2), and sender identity (§13).
Package sap implements the parts of the Synadia Agent Protocol 0.3 that mash uses: subjects (§2), and sender identity (§13).
sapsdk
Package sapsdk reaches the SAP Go SDK's identity package (synadia-agents.go, github.com/bogworks/synadia-agents.go/identity) behind mash's own types.
Package sapsdk reaches the SAP Go SDK's identity package (synadia-agents.go, github.com/bogworks/synadia-agents.go/identity) behind mash's own types.
sapsdk/discovery
Package discovery is the verify step of a discovery answer (S5, REQ-016).
Package discovery is the verify step of a discovery answer (S5, REQ-016).
spool
Package spool is the hand-over between serve and a Claude Code session's hooks (hook delivery, mash v0.2.0).
Package spool is the hand-over between serve and a Claude Code session's hooks (hook delivery, mash v0.2.0).
store
Package store holds mash's JetStream layout: per-endpoint inbox streams, their consumer, and the directory and lease KV buckets (spec section 5).
Package store holds mash's JetStream layout: per-endpoint inbox streams, their consumer, and the directory and lease KV buckets (spec section 5).
testenv
Package testenv runs an in-process nats-server in operator mode for integration tests.
Package testenv runs an in-process nats-server in operator mode for integration tests.
scripts
adrlint command
Command adrlint enforces the architecture decision records under docs/decisions (adr-lint.yml's checker).
Command adrlint enforces the architecture decision records under docs/decisions (adr-lint.yml's checker).
buildrelease command
Command buildrelease builds mash (or mashctl, with -cmd) exactly as a release does and prints "<sha256> <path>".
Command buildrelease builds mash (or mashctl, with -cmd) exactly as a release does and prints "<sha256> <path>".
changelog command
Command changelog keeps CHANGELOG.md out of pull requests (ADR 0068): a user-facing change adds a fragment file changelog.d/<slug>.<kind>.md, and release preparation folds the fragments into CHANGELOG.md.
Command changelog keeps CHANGELOG.md out of pull requests (ADR 0068): a user-facing change adds a fragment file changelog.d/<slug>.<kind>.md, and release preparation folds the fragments into CHANGELOG.md.
dirbench command
Command dirbench is a MEASUREMENT TOOL, not product code (bogworks/mash#43, "directory polling grows with the square of the endpoint count").
Command dirbench is a MEASUREMENT TOOL, not product code (bogworks/mash#43, "directory polling grows with the square of the endpoint count").
doclint command
Command doclint checks that the repository's Markdown files conform to their syntax: the one check a docs-only change needs (ci.yml's docs-lint job; Randy 2026-11-21: "as long as they properly conform to their syntax, I don't see why anything else needs to run").
Command doclint checks that the repository's Markdown files conform to their syntax: the one check a docs-only change needs (ci.yml's docs-lint job; Randy 2026-11-21: "as long as they properly conform to their syntax, I don't see why anything else needs to run").
gate1demo command
Command gate1demo renders the planned (next-release) output changes from the specification's own x-output-next cases, spec/next.json items and rules_next, as Markdown.
Command gate1demo renders the planned (next-release) output changes from the specification's own x-output-next cases, spec/next.json items and rules_next, as Markdown.
liveat command
Command liveat runs the live acceptance tests AT-001 to AT-003 and AT-4 (the security boundaries, at004) of the 0.5.5 endpoint-model contract against a build of this checkout.
Command liveat runs the live acceptance tests AT-001 to AT-003 and AT-4 (the security boundaries, at004) of the 0.5.5 endpoint-model contract against a build of this checkout.
liveat/nodeinit command
Command nodeinit is the only helper in an AT-005 node image.
Command nodeinit is the only helper in an AT-005 node image.
publishcheck command
Command publishcheck is publish-check.yml's checker: "publishing must be deterministic".
Command publishcheck is publish-check.yml's checker: "publishing must be deterministic".
refgen command
Command refgen generates the plain-markdown command reference under docs/reference from the spec files in spec/.
Command refgen generates the plain-markdown command reference under docs/reference from the spec files in spec/.
releasecheck command
Command release-check is mash's release gate.
Command release-check is mash's release gate.
repofiles command
Command repofiles checks that no tracked file under a git checkout is a binary executable, holds binary content, or is over the size limit (internal/release.CheckTrackedFiles, #1247).
Command repofiles checks that no tracked file under a git checkout is a binary executable, holds binary content, or is over the size limit (internal/release.CheckTrackedFiles, #1247).
reviewgate command
Command reviewgate is the verdict engine of the in-session review gate (ADR 0080).
Command reviewgate is the verdict engine of the in-session review gate (ADR 0080).
scrubcheck command
Command scrubcheck is a one-time verification: it finds the words in words.txt in the shipped surfaces.
Command scrubcheck is a one-time verification: it finds the words in words.txt in the shipped surfaces.
storedmail/classify command
Command classify runs mail stored by released mash binaries through sapsdk.Classify.
Command classify runs mail stored by released mash binaries through sapsdk.Classify.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL