Setup
himalaya, an email CLI, reads the inbox, saves drafts and sends.Files
Slack is mounted read-only at
/slack, files included.Policy
A policy script,
guard.py, checks every reply and holds each send for a person.mirage CLI, a Slack bot, a mailbox and two keys,
SLACK_BOT_TOKEN and MAIL_PASSWORD.
Slack and a mailbox
Slack and a mailbox
Slack. A bot with A real mailbox comes with Then send the customer’s email to the support address:
channels:read, channels:history and files:read,
plus groups:read and groups:history for a private channel. See
Slack. Invite it to #incidents, and post the note
above with the CSV as a message in the channel, not as a reply in a
thread: the mount shows a channel’s messages, not its threads.Mail. Any IMAP and SMTP account works; see Email.
To try the example without one, run GreenMail,
a mail server for tests, in Docker. It takes any password and keeps every
message on your machine, so nothing reaches a real inbox:Drafts and Sent folders. GreenMail starts with
none, so create them:MAIL_PASSWORD can be anything for GreenMail.Installation
Installation
The policy runs on Monty, a small sandboxed
Python interpreter:
- pip
- npm
workspace.yaml
workspace.yaml
workspace.yaml mounts Slack read-only, keeps /workspace in memory and
installs himalaya with the support account. With your own mailbox, set its
hosts and username, and drop the two ports and use_ssl.The support profile is what every terminal gets. Its allow list leaves
the agent the text tools it needs and three mail commands, to list, read
and reply: no compose, forward, delete or raw send. Its policy,
guard.py, judges each reply before it runs:workspace.yaml
guard.py
guard.py
guard.py sees each command after the shell has expanded it, so a variable
or a glob cannot hide a recipient or a path. It judges only
himalaya message reply, the one way the profile lets the agent write
mail, with one rule per function:hides_a_flag_value: a flag must be written apart from its value, as--attach FILE, not--attach=FILEor-tADDR, so the rules below see every value.adds_a_recipient: a reply goes to whoever wrote in, and no one else, so--to,--ccand--bccare refused.attaches_a_bad_report: an attachment must be a report the agent built in/workspace/outbox/, never a file straight from Slack, andcustomers_inreads its first column to check that it holds one customer.sends_now:--sendasks a person. Without it, a reply is only saved toDrafts.
guard.py
mirage daemon restart
stops a server that started without them.
Example
A customer emails the support inbox about a calendar sync failure the team already dealt with, and asks which of their appointments it hit. The answer is in Slack, where an engineer posted this in the#incidents channel with
a CSV of every customer’s affected events:
Incident 2026-11-16: calendar sync failed 06:10–07:40 UTC for Northwind Health, Harbor Dental and Lakeside Physio.The CSV has one row per event, with the customer first:
Cause: an expired Google token on our side; no data was lost.
Fix: token rotated, sync re-run for the window, every affected event is back.
Affected events for all three customers attached. Share each customer only their own.
📎affected-events.csv
These are the commands the agent runs, in the
agent terminal Setup
created. Your agent sends each one with mirage shell -s agent, or through MCP, the
HTTP API, RPC or SSH.
1
Read the email
The new email is message 1 in the inbox.Priya Shah, at Northwind Health, asks which appointments the sync failure hit.
2
Find the note in Slack
A Slack channel is a folder under The engineer’s note. The agent keeps the attached CSV’s path as
/slack, with the day’s messages and the files shared that day.$events.3
Keep only this customer's rows
The agent copies the CSV’s header and Northwind Health’s rows into a report, 214 appointments: 77 at Bellevue, 75 at Tacoma and 62 at Everett.
$report, in /workspace/outbox/.4
Save the reply as a draft
The agent writes the reply to The draft waits in
/workspace/reply.txt, then saves it with the report attached.Drafts. Nothing has been sent.5
Mistakes are refused
If the agent copies someone in, attaches the raw CSV, or deletes mail, the command is refused before it runs. Each prints
himalaya: Permission denied and the reason:6
Send once a person approves
A person approves from their own terminal, with the ask ID the refusal printed, and the same command then sends:
Full commands
Full commands
Each line runs in the agent’s terminal with
mirage shell -s agent, which
keeps variables such as $report from one call to the next.himalaya supports, see
himalaya. For more on asks, see
Policies and Scripts.