An AI app that helps you work through an overflowing inbox, built so that your email never
leaves your machine and your mail server. The design and its security requirements are in
SPEC.md.
your Mac
┌──────────────────────────────────────────────────────────────────────────┐
│ triage (host tool) local LLM server web view / browser │
│ │ creates containers, (llama-server, GPU, │ │
│ │ holds secrets, no network access) │ │
│ │ asks for approval ▲ │ │
│ ┌─┼─────────────────────────────┼──────────────────────┼───────────────┐ │
│ │ ▼ Docker │ ▼ │ │
│ │ ┌───────────────┐ ┌────────┴───────────────────────────────┐ │ │
│ │ │ email sandbox │──▶│ gateway (trusted) │──────┼─┼──▶ IMAP servers
│ │ │ the app │ │ holds credentials, allows only a │ │ │
│ │ │ no network │ │ fixed set of mailbox operations, │ │ │
│ │ └───────────────┘ │ relays to the LLM and the web view │ │ │
│ │ ▲ └────────────────────────────────────────┘ │ │
│ │ │ app image, built from committed source │ │
│ │ ┌───────────────┐ │ │
│ │ │ coding sandbox│───────────────────────────────────────────────────┼─┼──▶ internet,
│ │ │ coding agent │ no email data, no credentials │ │ coding model
│ │ └───────────────┘ │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────┘
| Directory | Contents |
|---|---|
app/ |
The app that runs in the email sandbox. The coding agent changes this. |
trusted/ |
The trusted base: gateway/, the host tool host/, the LLM sandbox llm/ |
coding/ |
The image of the coding sandbox |
docs/ |
gateway-api.md: the contract between app and gateway |
This is an early version. What exists, and how far it has been tested:
| Part | State |
|---|---|
| Gateway | Implemented; tested against a real IMAP server (Dovecot) |
| App: sync, parsing, search | Implemented; tested against the real gateway and Dovecot |
| App: assistant, policy, analysis, web interface | Implemented; tested with a scripted stand-in for the model, and in a browser through the real gateway's relay. With a real model it has been tried on made-up mail only (see "Trying a model" below): with a small model, and on a Mac with a model of 20B parameters (December 2026, five rounds). In the fifth round that model passed question, action, attachment, app-change, internships, analysis, and three times out of three later-chat (the assistant's search gives the newest first since the fourth round) and policy-inbox. Three scenarios it did not pass, and what was changed for them has not been tried with it since. In policy-button (once of three) and in later, it wrote every draft that a rule asked for and did not always arrange what the same rule says is to happen later, or asked for it without the number of days and was refused. The number of days can no longer be left out of such a request, and where the model has arranged nothing, it is now asked in a fixed form what the policy says for later; a message that arrives is also first held against the question whether a rule applies, as mail that is there has been since the fourth round. In full-inbox the step that sorts requests did not recognise the request, the model then went through the messages that had a word of its choosing, and missed four of seven; the tool for going through messages takes no such word any more. The button "Apply to the inbox now" has been used on real mail twice, on an inbox of about two hundred messages (about ten minutes, the first time), with the right result "on the whole" and "mostly"; since the fifth round it goes through all of them itself and ends with one line whose numbers add up. Asked what you had sent to an address, it found nothing though your mail program did: the messages were older than the three months that are kept here, and the model had named the folder with its account in front, which no folder is called. The assistant now looks on the mail server for older mail, and knows a folder by that name too (scenario older; not tried with that model). The small model passes all of these scenarios as they are now. Later in December 2026: a rule of yours that archives a message and drafts a reply often left the message archived and no reply. The models tried do it in the order in which the rule says it, and the app forgot a message once it had moved it, so the draft was refused, and the refusal was not shown. A moved message stays known now, and a reply that could not be drafted is said (scenario policy-reply: the small model moves first, then drafts, for each of four messages, and passes; not tried with your model). A message for the coding agent that follows other things in a conversation now comes with a few sentences about them, written by the model (scenario app-change-context; the small model's sentences had nothing of the mail in them, once; not tried with your model) |
Host tool triage |
Implemented; its logic is unit-tested. On macOS (December 2026) the wrapper app, which starts everything with the same code as triage up, runs the three sandboxes in Docker, and triage down removes them, and ends a model server that was left behind. triage model-server, which listens for the model's server, ends that server when it is itself ended with SIGTERM or SIGHUP (fourth round; before that the server was left running). triage up itself, with a browser, is not among the things that were tried then |
| Container images | Built with Docker on macOS, and in use there. Looked at while running (December 2026): the email sandbox runs as an ordinary user with a read-only file system, without capabilities, without published ports and without the Docker socket, on an internal network that it shares with the gateway only; from inside it the gateway is reachable, and the internet and the Mac are not, by number or by name |
| LLM sandbox profile | Tried on macOS 27.2 (December 2026, two rounds) with a probe program in place of the server. Refused, as intended: connections by TCP and UDP (also to this machine), looking up a host name, asking Launch Services to open an address (no browser tab appeared), reading the home directory outside the model directory, writing outside temporary directories, starting other programs, listening on another port. The real server (llama.cpp build 12774, a model with 20B parameters) runs in the sandbox at about 34 tokens per second, listening on 127.0.0.1 only. Since then the profile has changed in two ways. It refuses the lookup of every system service except the one that compiles programs for the GPU, and a few more things; the server ran like that in a test, for a few minutes. And it allows no network at all: the tests had shown that a program in the sandbox could listen on the server's port on all interfaces (a rule for listening names a port, not an address), so the server now listens on a Unix socket, and a relay outside the sandbox listens on the port, on 127.0.0.1 only, and passes connections on. A sandbox without network and with a socket was tried on macOS with the real server, at full speed. Third round (macOS 27.2.1): the profile as it is now passes every probe, including that the sandbox can listen on its one socket and on no other, and on no port; the real server runs in it behind the relay at the same speed (34 tokens per second, also after ten minutes without a request), answers piece by piece, and nothing but the relay listens, on 127.0.0.1. It has not been watched for longer than that. Fourth round (macOS 27.2.1): with that profile every start of the server paused for seven to eight seconds before it loaded the model, having its programs for the GPU compiled again each time: in the sandbox Metal could not find the user's directory for caches. With one of two services in reach the pause was gone (0.08 seconds), each tried alone in a copy of the profile; the other nine that the server asks for made no difference. The profile now allows one of them, com.apple.bsd.dirhelper, which makes that directory when it is missing, and still refuses the other, which answers questions about user accounts. Fifth round (macOS 27.2.1): with the profile as it is now, three starts of the server paused for 0.03 to 0.14 seconds, and it was listening after one to three seconds; in the sandbox a program is told the same directory for caches as outside it, and gets an error instead if the line for dirhelper is taken out; entries in Metal's part of that directory were written while the servers started (seen by their times; nobody has read them, and other programs use Metal too); and asking Launch Services to open an address still fails. Not achieved: for kinds of operation that the profile does not name (devices, shared memory and the like) it still starts from "everything allowed". The system's log does not record everything the sandbox refuses |
Wrapper app email-triage |
First version (see "The wrapper app" below). Its windows, the approval of a request and the confinement of the web view have been tried on Linux with stand-ins for Docker and the gateway. On macOS (WebKit 22625.2.8) its self-test failed twice and passes now, and the wrapper starts, runs the self-test by itself, starts the local model's server, shows the app, and keeps running across sleep. Opening links from emails in the browser (after asking), the window for the mail accounts, and starting and stopping the local model's server (with stand-ins for sandbox-exec and llama-server) have been tried on Linux. Confirmed on macOS 27.2 (December 2026, WebKit 22625.2.8): the self-test passes and its control fails as it should; make-app.sh makes an application that is signed, starts from the Finder and passes --check; the app shows the model loading and then ready; copy and paste; a link opens in the browser after the wrapper has asked, and the app's window stays where it is; the accounts window; the "Local Model ..." window stops and starts the server; Cmd-R; quitting or closing the window removes the containers and ends the model's server within seconds. Confirmed there in a second round (macOS 27.2.1): the self-test runs as a step of make-app.sh and passes; a change request appears in a window of the wrapper with its exact text, and shows in the chat as rejected when the window is closed, or as approved, with the coding agent's answer below it; when the wrapper is killed, the model's server ends within a second; when the process that watches over the server is killed with it, the server stays, and is ended by triage down or at the next start. In both cases the containers stay; triage down removes them, and the application starts again with them there. Confirmed in a third round, with the server on a Unix socket: the application starts its server, only the application listens (on 127.0.0.1), the socket is in a directory of its own under the user's temporary directory that only the user can enter, and quitting removes containers, server and directory within seconds. Since then (December 2026) the text in the approval window can be changed before it is approved; that has been tried on Linux only, in a real web view with stand-ins for Docker and the gateway |
| OAuth login (Gmail, Microsoft 365) | Gateway side implemented, untested against real providers; no consent flow in the host tool yet |
| Attachments | What a file says can be read, by the assistant and by you, as text (see "Attachments" below). Tested with made-up files and a scripted model, and with a small real model on a made-up PDF; not yet with files from real mail. Opening or saving a file is not built |
| Scripts written by the local LLM, automatic dependency updates | Not started |
With triage up and a normal browser, two of the specification's requirements are not met: a
browser does not stop a page from navigating elsewhere, and the approval of change requests
happens in the terminal rather than in a window. The wrapper app is meant to meet both, once it
has passed its self-test on your machine.
Other known gaps: a rule of the policy can wait for a few kinds of later event only (see "Rules about what happens later" below), and a request about many messages at once cannot arrange anything for later; older mail can be looked for on the mail server only with plain ASCII words (see "What the assistant can find" below); text that an email or an attached file hides from human readers is still visible to the model; the text of attachments is not searched, and the background analysis and requests about many messages at once do not look into attachments; and a drafted reply quotes the message it answers as plain text, also when that message is in HTML (the specification requires drafts to be plain text).
To see the interface without any of the setup below, with made-up mail and a pretend model:
cd app && uv run python -m triage.testing.demo --port 8765You need Docker Desktop, the Rust toolchain
(rustup.rs), and, for the local model, llama.cpp (brew install llama.cpp).
The coding agent can write to the working tree it is given, including its .git directory. The
trusted base must therefore be built from a copy that the agent cannot touch:
git clone <url> ~/src/triage # the working copy; the coding agent works here
git clone <url> ~/src/triage-trusted # a reviewed copy, for the trusted base onlyNever run Git or build tools on the host inside ~/src/triage once the coding agent has been
working in it: Git hooks, Git configuration and build scripts can run code. To look at what the
agent did, fetch into the reviewed copy (git -C ~/src/triage-trusted fetch) and read it there.
cd ~/src/triage-trusted/trusted
cargo install --locked --path host # installs the `triage` command
triage init --repo ~/src/triage
triage build-gateway # builds the gateway image from this reviewed copyWhen the trusted base changes upstream or the coding agent proposes a change to trusted/,
review the difference in the reviewed copy, then repeat this step. Nothing else ever rebuilds it.
triage account addCredentials are stored in your macOS Keychain and handed to the gateway when it starts. They are never visible inside the email sandbox or the coding sandbox. For Gmail, use an app password for now. (The wrapper app has a window for this as well: see "The wrapper app" below.)
The model runs directly on your Mac (containers cannot use the GPU), in a macOS sandbox that gives it no network access.
Download a model in GGUF format that supports tool calls, into a directory that contains nothing else: the sandboxed model server can read that directory, and nothing else in your home directory. On a Mac with 32 GB of memory, of which the model should use less than half, a reasonable first choice is gpt-oss-20b (a 12 GB download, about 13 GB of memory while running):
mkdir -p ~/models
curl -L -C - -o ~/models/gpt-oss-20b-MXFP4.gguf \
https://huggingface.co/ggml-org/gpt-oss-20b-GGUF/resolve/main/gpt-oss-20b-MXFP4.gguf(If the download is interrupted, the same command resumes it.) The app has been used on a Mac
with a model of this size, which answers at about 34 tokens per second there; with other
models, expect to experiment. A smaller alternative is
gemma-4-12b-it-Q6_K.gguf from unsloth/gemma-4-12b-it-GGUF (10 GB).
With the wrapper app (see "The wrapper app" below), that is nearly all: tell it which file to use, and it starts the model's server whenever it starts, and stops it when you quit.
triage init --repo ~/src/triage --llm-model ~/models/gpt-oss-20b-MXFP4.ggufThe file can also be chosen, and changed, in the wrapper's "Local model" window. There is no key to make up and no port to choose: the wrapper does both afresh at every start.
With triage up, you run the model's server yourself, in three more steps.
Make up an API key. It is a password that you invent, not something you get from a provider: the gateway presents it to the model server, so that nothing else on your machine (the coding sandbox, for instance) can use the model. Generate one and store it in the Keychain:
openssl rand -hex 32 # prints a random key; copy it
triage secret llm-api-key # paste it at the promptYou do not need to keep the key anywhere else.
Tell the host tool which port the model server will use:
triage init --repo ~/src/triage --llm-port 8012Run the model server in a terminal window of its own, and leave it running:
~/src/triage-trusted/trusted/llm/run-llm.sh ~/models/gpt-oss-20b-MXFP4.gguf 8012The script reads the key from the Keychain (macOS may ask you to allow that) and runs
llama-server in the sandbox. It is ready when it prints that it is listening. The sandbox
has no network: the server listens on a Unix socket (a file, in a directory under
/private/tmp that is made for the run and removed after it), and the script has
triage model-server listen on the port, on 127.0.0.1 only, and pass each connection on to
the socket. So the triage command must be installed, from the same reviewed copy as the
script. Ending the script with Ctrl-C ends the server and removes the directory, and so does
ending triage model-server (tried on a Mac with SIGTERM and SIGHUP). What
the sandbox has refused a program is sometimes in the system's log, and sometimes not: on the
Mac where this was tried, the log had lines for a probe program and none for the server, which
was refused things all the same. So when the server does not run, read what it prints as well:
/usr/bin/log show --last 15m --predicate 'subsystem == "com.apple.sandbox.reporting" AND eventMessage CONTAINS "llama-server"'If both a model file and a port are set, the wrapper uses a server that already answers on that port when it starts (one that you started by hand), and starts its own otherwise.
Docker Desktop has a memory limit of its own for the containers (Settings → Resources). About 8 GB should be enough for this app; lower the limit if it is set higher and memory is tight.
triage upThis builds the coding sandbox and the app, starts the containers, and prints the address of the
web interface. Keep it running: it is where you approve (or refuse) every message that the app
wants to send to the coding agent, after reading its exact text. triage coding-login logs the
coding agent in to your Claude account the first time; alternatively store an API key with
triage secret coding-api-key.
triage account add and triage account remove take effect at once, also while everything is
running: the app starts downloading a new account's mail by itself, and drops its copy of a
removed account's mail. Other settings (triage init, triage secret, triage grant) take
effect when triage up next starts. Each start prints a new address: a browser window from
before the restart is no longer connected, and has to be closed or pointed at the new address.
Your data lives in ~/.triage: cache/ (local copy of your mail and its index), config/
(settings and your policy), gateway/ (the log of every change made to your mailboxes).
email-triage does what triage up does, in a window instead of a terminal and a browser:
- It shows the app's web interface in a window that can reach the app and nothing else. All traffic of that window goes through a small proxy inside the wrapper, which passes on requests for the app and refuses the rest. On macOS, where the web view does not use a proxy for addresses on the same machine, WebKit is additionally given a content rule list that blocks every address but the app's, and the app is only loaded once that list is in place. WebKit is also told not to open connections ahead of time (it otherwise connects to a link's address the moment the link is clicked, before anyone is asked), and to keep nothing on disk; the first of these uses a WebKit setting that Apple has not published, and the wrapper refuses to show the app if the setting is not there. Navigating elsewhere, opening windows, downloads, camera, microphone and the interfaces that do not go through proxies (WebRTC, WebTransport) are switched off, and pages have no channel to the wrapper except the one for links, below. On macOS, WebRTC and WebTransport are switched off in WebKit itself, because WebTransport is also offered inside workers, where the wrapper cannot remove it by script; so are service workers and shared workers, which run outside the page. These, too, are settings that Apple has not published.
- A link in an email opens in your browser, after the wrapper has asked. The window that shows
the app still goes nowhere: when a page in it tries to go to another address or to open a
window on one, the wrapper stops that and takes it as a request to open a link. It then shows,
in a window of its own, the name of the site and the whole address, and hands the address to
your browser only if you choose "Open in browser" there. That choice is the click that counts,
since a page can pretend that a link was clicked. Only one such question is open at a time,
and a yes in the moment the window appears is ignored, so that it cannot be put under a click
meant for something else. Only
httpandhttpsaddresses with an ordinary site name are offered: none with a user name before the site, none to numeric addresses or to this computer; for a link that is refused, a window says why. An address can carry a little information out of your mail, which is why you see all of it first. In an ordinary browser (triage up) links in emails stay dead. Text written by the model never contains links. - Before a message goes to the coding agent, a window of the wrapper's own shows its exact text and asks. The text is in a field in which you can change it (take out a name, add what is missing): what is sent is the text as you leave it, and the app then shows that as what was sent. A text that you changed is held to the same rules as one from the app (plain text, at most 4,000 characters, nothing invisible); if it breaks one, the window comes back with your text and says why. Closing that window, or quitting, means no. What was decided, and then what the coding agent answers, appears in the app under the request (in the chat, if that is where it was made); everything the agent said is under "App changes". A request that you make in the chat is passed on in your own words. If the conversation went on before it, the model on this computer adds a few sentences below them, marked as its own, about what went before ("please fix this" says nothing to an agent that has not seen the conversation). It is shown what you saw of the conversation, not what the mail says, is told to leave out names, addresses and everything from the mail, and addresses and links are taken out of what it writes; but it has read your mail, so read that part too before you approve. The first message of a conversation is passed on as it is.
- Mail accounts are added, changed and removed in a window of the wrapper's own: "Mail
Accounts ..." in the application menu (Cmd-,), or the link under the progress while it starts.
It does what
triage accountdoes, with the same checks, and a change takes effect at once if the gateway is running. A stored password is never shown again; to change an account without changing its password, leave the password empty. The pages of this window run no scripts: a form is read by the wrapper from the address that the page tries to go to, and nothing is loaded. The app's window cannot reach them. - The local model's server is started by the wrapper, if a model file has been chosen
(
triage init --llm-model, or the "Local model" window: "Local Model ..." in the application menu, or the link under the progress while it starts). It runsllama-serverin the same sandbox, and with the same options, astrusted/llm/run-llm.sh; the sandbox profile is built into the wrapper. The server listens on a Unix socket in a directory of its own under your temporary directory, and the small process that watches over the server also listens on a port (on 127.0.0.1 only) and passes connections on to the socket. The key that protects the server is made up at every start and exists only in the memory of the wrapper, the server and the gateway. The model loads while the containers start; the app says "Local model ready" in its status area once it is there. The window shows whether the server is running, stops it (which frees its memory) and starts it again, and takes another model file, which must be in a directory of its own, because the server can read all of that directory. If the server ends by itself, the window opens and shows what the server printed last, which is also kept in~/.triage/llm.log. The server ends with the wrapper, also when the wrapper is killed: a small second process of the same name watches over it. Only if that process is killed in the same moment (killall -KILL email-triagedoes that) does the server stay, with its memory; the next start of the wrapper ends it, and so doestriage down. - Quitting (closing the main window, or Cmd-Q) stops and removes the containers, and ends the
model's server. If the wrapper is killed instead, the containers keep running until it is
started again or
triage downis run. - Cmd-R loads the app's window afresh.
It is part of the trusted base, so build it from the reviewed copy. It needs macOS 14 or later.
Whether the confinement holds depends on how the system's web view behaves, and that can change
with an update of the system. So the wrapper has a self-test, which takes about half a
minute, during which a window opens and closes by itself. The wrapper remembers which version
of the system's web view and which build of itself the self-test last passed with (in
~/.triage/wrapper-self-test.json), and does not show the app with any other:
make-app.sh(below) runs the self-test as part of the build, with the program it has just built. If it does not pass, the application is not installed.email-triage --checkdoes the same for a program built in another way.- At start, the wrapper looks at what is remembered. If it fits, the app starts at once. If it
does not (the system's web view was updated, or the program was built without the check),
the wrapper runs the self-test itself, before anything else; if it does not pass, nothing is
started and the app is not shown. The output of that run is in
~/.triage/wrapper-self-test.log.
You can also run the self-test by hand, with its control:
cd ~/src/triage-trusted/trusted/wrapper
cargo run --release -- --self-test # must end with PASSED
cargo run --release -- --self-test-control # must end with "The control worked"On Linux it passes. On macOS (WebKit 22625.2.8) it failed twice before it passed. First, requests for other ports of the same machine got through; the content rule list stopped those. Then a click on a link still opened a connection to another port of the same machine, over which nothing was sent; switching off connections ahead of time stopped that. The control of that passing run then showed that WebTransport sends datagrams, and it is offered inside workers, which the self-test did not try. Workers are tried now and those features are switched off, and that version passes as well.
To install and start it:
cd ~/src/triage-trusted/trusted/wrapper
cargo install --locked --path . # installs the `email-triage` command
email-triage --check # the self-test, now and not at the first start
email-triage # instead of `triage up`; stop that firstOr make it an application that starts from the Finder, the Dock or Spotlight:
cd ~/src/triage-trusted/trusted/wrapper
./make-app.sh # makes ~/Applications/Email Triage.appmake-app.sh builds the same program, puts it, with an icon, into an application bundle
(another directory can be given as its argument), and runs its self-test. Run it again after
each change to the trusted base that you have reviewed. The application is a different file
from the email-triage command, so the self-test is run for each of them, and the application
asks again for access to the Keychain. Started this way it has no terminal: what it would print
is in its windows. If the application does not start, the command still does, and says why.
The self-test shows a page that tries to reach a second server in every way a page has, in a web
view set up like the one for the app; the control does the same without the restrictions, to
show that the test can fail. The second server counts a connection as reached even if nothing
is sent over it. Both use no mail and no network beyond your machine, and their output is safe
to share. If the self-test does not pass, keep using triage up.
What the self-test cannot see is a name lookup (DNS): it would not notice if the web view looked up the name of another machine without connecting to it.
The first start asks for access to the Keychain entries that triage created, because it is a
different program. The rest of setting things up (triage init, triage secret,
triage build-gateway) and triage coding-login still happen on the command line. If the
coding sandbox image has to be built, that happens
during the first start without visible progress, and takes several minutes.
It is built on wry and tao, the web view and window libraries underneath Tauri, without the
Tauri framework: that is about a third of the dependencies, and no bridge between pages and
native code. Their versions are pinned exactly. trusted/tools/dependency-age.py lists locked
crates that were published less than seven days ago.
How well the assistant works depends on the model, and the tests cannot tell you: they use a scripted stand-in. To see what your model does, run the assistant's evaluation against the running model server. It uses made-up mail in an in-memory mailbox and touches nothing of yours, so its output is safe to share when asking for help:
cd ~/src/triage-trusted/app # the reviewed copy; needs uv (brew install uv)
TRIAGE_LLM_API_KEY=$(security find-generic-password -s email-triage -a llm-api-key -w) \
uv run python -m triage.testing.evaluate --url http://127.0.0.1:8012This needs a model server that you started by hand (run-llm.sh, see "Start the local model"
above), with the key from the Keychain. The server that the wrapper app starts cannot be used
for it: only the wrapper and the gateway know its key. Quit the wrapper first, or stop its
model in the "Local model" window, so that two copies of the model are not in memory at once.
It gives the assistant a few tasks (answer a question, answer one from an attached PDF, move one message, find what you sent to someone, find something you sent more than a year ago, pass a message on to the coding agent instead of carrying it out, and say what went before it in the conversation without anything from the mail, apply a policy with rules about what happens later, arrange something for later that is asked for in the chat, apply the policy to the mail that is already in the inbox (asked for in the chat, and with the button), carry out a rule that archives a message and drafts a reply to it, deal with every request of a kind in a full inbox, analyse new messages), prints what the assistant did, and checks the mailbox afterwards. Name one or more scenarios after the command to run only those. The lines that begin with an arrow are what the model itself sent: each call of a tool with what it was given, and each answer that it had to give in a fixed form (such as whether a rule of the policy applies to a message). When a check fails, that is where the reason is.
The app keeps a copy of your mail on this computer, and the assistant searches that copy: all of the inbox, and of every other folder what arrived in the last three months. Your mail program and the webmail search everything that the mail server has, so they can find what the assistant at first does not.
For anything older, the assistant asks the mail server:
- by itself, when a search finds nothing on this computer;
- when the model sets the option for it, which it is told to do when you ask about something long ago, or for everything of a kind. Saying so helps: "... more than a year ago", or "also look for older mail". A search that found something here tells the model that older mail was not looked at.
The step in the conversation then ends in "also on the mail server", and the lines above it name the folders as they are looked in. What the server finds is fetched (the newest 25 of a folder, 75 in all, for one search) and kept on this computer for 30 days, or longer if it is found again; until then it can be read, searched and acted on like any other mail.
What limits it: the inbox is not asked for (all of it is here), and neither are drafts, junk and trash unless the search names them; at most 30 folders are looked in; the server finds a word anywhere in a message, the copy here only as a whole word, so a few messages may be fetched and then not shown; and the gateway takes only plain ASCII words for the server, so a search for a word with an accent stays on this computer, and says so.
The policy is a text; saving it does nothing to your mail by itself. Its rules are carried out on two occasions.
When mail arrives, if "Apply the policy to new mail automatically" is ticked in the Policy view (it is not, to begin with). Each message that newly arrives in an inbox is then put before the model with the policy, once. A message counts as newly arrived while it is unread and not older than two days. So mail that was already there when you ticked the box, mail that you have read elsewhere before the app saw it, and mail that arrived before you wrote or changed a rule, are all left as they are.
When you ask for it: the button "Apply to the inbox now" in the Policy view goes through the mail that is in your inbox, read or not, the newest first, and puts each message before the model with the policy as it is saved. This is what to do after changing the policy. It looks at the newest 300 messages of the inbox at most, in one go, and says so if there are more; the older ones are then not looked at. It happens in a conversation of its own, where every message th 8E78 at something was done to is listed, and where it can be stopped. Asking in the chat ("apply the policy to the messages in the inbox", or "... of the last week") does the same; there the model first has to recognise what you are asking for, which the button spares it. What a rule arranges for later on such an occasion does not wait for the box to be ticked, since you asked for it. A message that is still in the inbox when you press the button a second time is dealt with a second time: a rule that drafts a reply drafts another.
On both occasions a message goes through up to three steps, each a question of its own to the model:
- Does a rule apply? The model is asked that one thing, and which rule, and answers in a fixed form. If none does, the message is left alone, and the model is never given the means to do anything to it. (Asked everything at once, a small model reached for a tool at messages that no rule was about, and deleted a message that told it to.)
- Carry it out. The model is given the message again, with the policy and the tools to move, flag, mark or draft a reply, and one to arrange what a rule says is to happen later (see "Rules about what happens later" below). What it named as the rule in the first step is not passed on: when it was, a model of 20B parameters carried out only the first half of a rule of two sentences. Once a move is arranged for later, the same move is refused for now: a small model arranged it as the rule said, and then did it anyway. A message that the model has moved is still the message that it may act on: a rule that says "archive it and draft a reply" is carried out in that order by the models tried, and the reply is then drafted to the message in the archive; a moved message is not moved a second time, and nothing is arranged for it. (Until December 2026 the app forgot a message once it had moved it, refused the draft, and did not say so: the message was archived, and there was no reply.) If a reply that the model set out to draft does not exist in the end, the line about that message says so.
- Is anything left for later? If the model has arranged nothing in the second step, and the message is still where it was, it is asked what the policy says is to happen to the message later, and answers in a fixed form again; the app arranges what the answer lists, provided that the sentence which the model gives as its reason is in your policy. (The same model wrote every draft that a rule asked for, and after about one draft in three did not arrange what the rule says is to happen once the draft is gone.)
Days in a rule are counted from the day the message arrived: for a message that has been there for longer, what the rule says is done the next time the app looks.
Either way, everything that is done goes through the gateway, is listed under Activity, and
can be undone there; a message that a rule deletes goes to the trash, not away. Two scenarios
of the evaluation above try the second occasion with your model, on made-up mail that includes
a message which tells the model to delete everything: policy-inbox (the request in the
chat, with rules that delete) and policy-button (the button, with rules that take some
judgement, ask for replies and arrange things for later). A third, policy-reply, has a rule
that archives a message and drafts a reply to it, both at once.
Under Activity, each entry says which message it was about (who it is from and what it is called; of several, the first) and shows the messages where they are now. A message that this app has moved stays in the copy on this computer for thirty days whatever its age, and one that the copy no longer has is fetched from the mail server when the list is shown, so that an old message which a rule has archived can still be looked at and moved back. An undo is shown at the entry that it undid, which then says "undone"; the move back is in the gateway's log like every other operation, and is not listed as something new.
The policy is applied to a message when it arrives. A rule can also say what is to happen later, for example: "When somebody asks me about X, draft an answer saying Y. When I have sent or deleted the draft, move their message to the archive." The model does not wait for that. When it applies such a rule it writes the draft, and arranges the rest: what is to be done to which message, and what to wait for. From then on no model is involved: each time the app has fetched mail (every five minutes), it looks whether the thing has happened, and if so does what was arranged.
What can be waited for:
- The draft reply to the message has been sent or deleted, which is to say that your drafts folder no longer holds a reply to it. A draft that you edit is still the draft.
- You have replied to the message: a reply is in your sent folder, or your mail program has marked the message as answered.
- A number of days have passed since the message arrived.
What can then be done is to move the message, to flag it or remove its flag, and to mark it as read or unread. You can ask for the same in the chat ("archive this once I have replied").
Everything that is waiting is listed at the top of the Activity view, and can be cancelled there. What was done appears in the "Automatic actions" conversation and in the activity log, where it can be undone like everything else. If you move or delete the message yourself in the meantime, nothing more is done to it; and for a message that a rule moves away at once, nothing can be arranged. What a rule of the policy led to waits while "Apply the policy to new mail automatically" is switched off, and something that is waited for and never happens is given up after half a year.
Whether your model reads such rules the way you mean them is worth trying: the scenarios
later (rules of a policy) and later-chat (a request in the chat) of the evaluation above
do that, on made-up mail.
The files that come with a message are listed in the viewer. For those that hold text, "Show text" shows what the file says, and the assistant can read the same text when a question or a rule of your policy depends on it ("how much is the invoice for?").
The formats: PDF, Word, Excel and PowerPoint files (docx, xlsx, pptx), OpenDocument files, plain text of all kinds, HTML, and attached messages. Pictures are not read, so a scanned letter is a file without text; the older Office formats (doc, xls, ppt) and archives are not read either.
A file is from a stranger, like the message, and is handled accordingly:
- It never leaves the email sandbox. The interface is not sent the file, only the text that was found in it, and shows that as text. There is no way yet to open a file in another program or to save it; that needs a way out of the sandbox, which is a change to the trusted base and has not been designed.
- Each file is read in a process of its own that limits its own time (30 seconds), memory and output before it has seen the file. A file made to hang or exhaust a parser costs that process; you are told that the file could not be read.
- Nothing in a file is run or fetched: no macros, no scripts, no remote content.
- What a file says is given to the model marked as quoted material, like the text of a message. A file can still try to talk the model into something, as a message can; the model can do no more with it than with a message (see the specification's threat model).
- Text that a document hides from its readers (white on white, or behind a picture) is text to the model all the same. Only what a Word document marks as hidden is skipped.
Long files are read up to a limit (300 pages of a PDF, 5,000 rows of a spreadsheet, 400,000
characters), and the assistant takes a long text in pieces. Whether your model looks into an
attachment when it should is what the scenario attachment of the evaluation tries.
A reply that the assistant drafts has the new text on top and the message it answers quoted below, laid out the way Apple Mail lays out a plain-text reply:
Thank you, Thursday works for me.
> On 19 Nov 2026, at 12:00, Kim Placeholder <kim@example.net> wrote:
>
> Are you free for lunch on Thursday?
How the date in that line is written depends on the settings of your Mac, which the email sandbox cannot see. The app therefore copies the form used by the newest replies in your sent mail, and uses the time zone that your browser reports.
This layout has been compared with several hundred replies written by Mail 16 on a Mac (set to
British English with a 24-hour clock), and matches them in the form of the line above the
quotation, the quote marks and the empty lines. It has not been compared with other versions or
settings. To compare it with your own sent mail without showing that mail to anybody, run this
while triage up is running:
docker exec triage-app /opt/venv/bin/python -m triage.reply_reportIt reads the local copy of your sent mail inside the email sandbox and prints a description of
structure only: counts, names of MIME types, header fields and HTML elements, and the shape of
the line above a quotation, in which every word is replaced by Xx, every digit by 9 and
every address by ADDR. It prints no text, name, address, date, subject or folder name. Look
through it before you pass it on.
The coding sandbox image (coding/Dockerfile) has everything needed:
cd trusted && cargo test && cargo clippy --all-targets && cargo fmt --check
cd trusted && cargo build -p triage-gateway
cd trusted/wrapper && cargo test && cargo clippy --all-targets # needs libwebkit2gtk-4.1-dev
cd trusted/wrapper && xvfb-run -a cargo run -- --self-test # and xvfb, on Linux
cd app && TRIAGE_GATEWAY_BIN=../trusted/target/debug/triage-gateway uv run pytest
cd app && uv run ruff check && uv run ruff format --check && uv run mypy- The gateway's integration tests start a throwaway Dovecot server and need the
dovecotbinary (Debian packagedovecot-imapd). - With
TRIAGE_GATEWAY_BINset, the app's tests include end-to-end tests against the real gateway and Dovecot. Without it they are skipped. - The interface tests drive Chromium (
/usr/bin/chromium) and are skipped if it is missing.
All test data is synthetic; never add real email to this repository.