Name. "PostKauz" started as a working title; it was checked and stays (decision of 15.10.2026). Names live in one place,
internal/brand(seedocs/architektur.md, section 8).
An agent-first e-mail client written in Go. It mirrors an existing IMAP mailbox into a local, searchable archive (SQLite + raw .eml files) and exposes it through a CLI and an MCP server, with scopes, risk levels, dry runs, approvals and an append-only audit log. No GUI. The MVP is draft-only: it can write drafts into your Drafts folder, but it never sends mail; a human does that in their usual client.
Status: 0.3.0-rc1 (release candidate of slice 3, not yet tagged; the tag follows the owner's decision D10). In daily use by the author since 26.10.2026. Slice 3 is complete: tags and mailbox actions (mark, move, trash only with a human approval), export, backup and restore, deleting from the local archive, Microsoft mailboxes via OAuth2, and remote access over HTTP-MCP. Acceptances on the author's Windows PC: D7a and D7 passed, D8 parts A to C passed (HTTP-MCP with an API key, from the PC and from a cloud session in the private network); still open: D8 part D (OAuth with Authelia, waits for a server) and D9 (a real Microsoft mailbox). Last published release: 0.2.0-rc8. Slice 2 adds drafts: replies and new mails written by you or an agent, put into your Drafts folder, an approval step that only a human can complete, a check hook, and detection of the mail you then sent yourself. Slice 1: accounts, the IMAP mirror (windowed first sync, incremental sync, sync --watch with IDLE), threads, cleaned message text (HTML to text, hidden text removed and reported, links made visible, quotes stripped), attachments (type check by magic bytes, text extraction in a subprocess), German-aware full-text search (word forms, umlaut and ß spellings, parts of compound words, operators, cursor paging), import from mbox and Maildir (Thunderbird profiles), API keys with roles and scopes, a stdio MCP server for agents such as Claude Code (read-only keys, or drafts with the role assistant), and an append-only audit log with a daily export (SHA-256 hash chain, manifest) that audit verify checks.
- People and small organisations who let AI agents (Claude Code, Cowork, Cursor, Codex CLI) help with their mail and want that access to be controlled and auditable, instead of handing an agent a full mailbox token.
- Self-hosters and script users who want a provider-neutral, local mail mirror with a JSON CLI.
- Privacy-conscious users who keep mail on their own machine and only pass excerpts to a model.
- No GUI before 1.0 (a minimal web UI may follow, on top of a REST API).
- No bulk mail or newsletter sending.
- No agent-owned mailboxes (for that, see OpenAgentEmail and similar projects).
- No archive for chat, calendars or meetings, and no web UI before 1.0 (for that, see msgvault).
- No own verified Google OAuth app ("bring your own client" instead).
- No spam filter.
- No PGP/S/MIME in the MVP.
- CLI, MCP (and later REST) are thin, hand-written adapters over one operation registry (
internal/ops). - Every call runs the same chain: scope, policy, approval, audit, handler. Interfaces cannot bypass it.
- Operations are data: name, JSON schemas, scope, risk level R0-R3, idempotency, handler.
- Two truths: the server is the truth for the current mailbox state; the local database is the truth for archive, index, approvals and audit.
- A provider interface with JMAP semantics sits in front of IMAP (CONDSTORE/QRESYNC where available, IDLE on INBOX).
- Raw mails live in a content-addressed blob store, metadata and full-text index (FTS5) in SQLite.
- SQLite via
modernc.org/sqlite: pure Go, no CGO, cross-compiles to Windows, macOS and Linux. - German-aware search: unicode61 + trigram tokenizers plus an application-side German stemmer.
- Jobs (index, extract, draft push) run from a table, no broker; the only write to the server (a draft into the Drafts folder) happens in
sync, the process that holds the mailbox password, never in the MCP server. - Details:
docs/architektur.md,docs/datenmodell.md(documentation is in German).
You need one file: the program for your system. Nothing else has to be installed (no Go, no Docker, no database server). PDF text extraction is optional (see below).
Take the file for your system from the release page (https://github.com/KNUFFIXX/postkauz/releases) or from dist/ after make release VERSION=…, together with SHA256SUMS:
| System | File | Rename to |
|---|---|---|
| Windows 10/11 (64-bit) | postkauz-windows-amd64.exe |
postkauz.exe |
| Linux (64-bit) | postkauz-linux-amd64 |
postkauz |
| macOS (Apple silicon) | postkauz-darwin-arm64 |
postkauz |
Compare the checksum with the line in SHA256SUMS:
# Windows (PowerShell): put the file into C:\PostKauz first
cd C:\PostKauz
Get-FileHash .\postkauz-windows-amd64.exe -Algorithm SHA256
Rename-Item .\postkauz-windows-amd64.exe postkauz.exe
Unblock-File .\postkauz.exe # removes the "downloaded from the internet" mark (SmartScreen)# Linux
sha256sum postkauz-linux-amd64 && install -Dm755 postkauz-linux-amd64 ~/.local/bin/postkauz
# macOS
shasum -a 256 postkauz-darwin-arm64 && mkdir -p ~/bin && install -m755 postkauz-darwin-arm64 ~/bin/postkauz
xattr -d com.apple.quarantine ~/bin/postkauz # unsigned program: allow it once (Gatekeeper)Optional on Windows: add the folder to your user PATH, then postkauz works in every window:
$p = [Environment]::GetEnvironmentVariable("Path", "User"); [Environment]::SetEnvironmentVariable("Path", "$p;C:\PostKauz", "User")(Open a new PowerShell window afterwards. Without it, call C:\PostKauz\postkauz.exe or .\postkauz.exe in that folder; the examples below write postkauz.)
postkauz version
postkauz doctordoctor shows the configuration file, the data directory (Windows %LOCALAPPDATA%\postkauz, Linux ~/.local/share/postkauz, macOS ~/Library/Application Support/postkauz), the database, the keyring and the optional pdftotext. Expected on a fresh install: database: missing (it is created by the first real command) and keyring: available (Windows Credential Manager), (macOS Keychain) or (Secret Service (D-Bus)). Keep the data directory out of OneDrive, Dropbox or iCloud; doctor warns if it is inside one.
postkauz account add mail --imap imap.example.org:993 --user me@example.org
postkauz account test mailaccount add asks for the password and stores it in the operating system's keyring (never in a file of PostKauz). Port 993 means TLS. Many providers require an app password for IMAP (for example Gmail, iCloud). Microsoft mailboxes (Outlook.com, Microsoft 365) only allow OAuth2: register your own app once (steps in German in docs/betrieb_microsoft.md; PostKauz ships no app of its own), then postkauz account add outlook --imap outlook.office365.com:993 --user you@example.org --auth oauth2 --client-id <your client id> --tenant consumers and postkauz account login outlook (opens the browser; --device-code signs in on another device). Only the refresh token is stored, in the OS keyring; OAuth2 accounts need a keyring (not on servers without one). account test logs in read-only and lists capabilities and folders with their roles (inbox, sent, drafts, …).
A big mailbox (for example a Sent folder with years of attachments) makes the first sync long. To skip very large messages, set a limit in the configuration file (its path: postkauz doctor):
[imap]
max_message_bytes = 10485760 # 10 MiB; default 256 MiB, at least 1 MiBsync then reports N skipped (larger than … bytes, [imap] max_message_bytes) on a line of its own and counts them as errors; after raising the limit, sync --full fetches them.
postkauz sync --full -a mail # first sync: resumable, Ctrl+C and run again continues
postkauz search "Rechnung" -a mail --limit 5
postkauz show <id> # an id from the search resultThe first sync of a mailbox with a few thousand messages takes minutes; very large mailboxes (tens of thousands of messages, many attachments) take longer, mostly limited by your connection. It can be interrupted at any time. Afterwards postkauz sync -a mail only fetches changes; postkauz sync -a mail --watch keeps running and picks up new mail in the inbox within seconds (IDLE). Older archives (Thunderbird, mbox, Maildir) can be imported without touching the server: postkauz import mbox <file or folder> -a mail --mailbox Archive (docs/cli.md, section 2i).
Create a read-only key for the agent and register the MCP server, see Set up MCP in Claude Code:
postkauz key create --name claude-code --role reader --expires 30d
claude mcp add --env POSTKAUZ_KEY=pk_key_... --scope user --transport stdio postkauz -- /full/path/to/postkauz mcpThen set up the daily audit export to a second location. That's it.
| Symptom | Cause and fix |
|---|---|
| Windows: "Windows protected your PC" (SmartScreen) | The program is not signed yet. Run Unblock-File .\postkauz.exe once, or click "More info", then "Run anyway". Check the checksum first (step 1). |
| macOS: "cannot be opened because the developer cannot be verified" | Unsigned program: xattr -d com.apple.quarantine ~/bin/postkauz, or right-click the file in Finder, "Open". The first access to the Keychain asks for permission: choose "Always Allow". |
keyring: unavailable (Linux servers, containers, SSH sessions without a desktop) |
No Secret Service is running. Install and unlock one (GNOME Keyring, KWallet) or keep the password in the environment: export POSTKAUZ_PASSWORD_MAIL='…' and account add … --password-from-env. There is deliberately no silent fallback to a file. |
The hidden password prompt (account add, account set) takes no input, or ends with prompt_timeout |
Seen with 0.2.0 on Windows in Windows Terminal with Windows PowerShell 5.1. Since 0.3.0 the prompt reads the Windows console itself (ReadConsoleW: typing and pasting with Ctrl+V or right-click, umlauts); on every system it gives up after 120 s without input (prompt_timeout, exit 1). Then pass the password on standard input with --password-stdin, for example in PowerShell: copy it, then Get-Clipboard | Select-Object -First 1 | .\postkauz.exe account add <name> --imap <host>:993 --user <address> --password-stdin, then clear the clipboard. POSTKAUZ_PASSWORD_READER=term switches back to the old reader; postkauz internal prompt-probe shows how the input arrived, never the value; it is for known test values only, never type a real password there. |
account test fails with auth |
Wrong user name or password, or the provider wants an app password / has IMAP switched off in its settings. PostKauz never retries a rejected login. |
oauth_refresh, no_token or login_failed (Microsoft account) |
Sign in again with account login <name>; without a browser on the computer use --device-code. token_not_stored means the keyring refused the renewed token: check doctor, then run the command again. |
account test fails with connection (exit code 5) |
Host, port or TLS mode wrong, or a firewall blocks port 993. |
pdftotext: not found |
Optional. Without it PDF attachments get no searchable text (file names still are). Install Poppler (below); the next sync extracts the skipped PDFs. |
sync_running |
Another sync or import of the same account is running (for example sync --watch in another window). |
migration_blocked |
A new version wants to update the database while another process uses it. Stop the other processes first, see Updating. |
database_busy |
Another process is updating the database right now; run the command again when it has finished. |
| Anything else | postkauz doctor and postkauz doctor --secrets; postkauz doctor --blobs=all checks every stored mail and attachment file against its checksum (--blobs alone checks a 1% sample) and never shows their content; error messages and the log (postkauz.log in the data directory) never contain passwords or mail text, so they are safe to share. |
A new version may update the database schema on its first start (with a backup copy next to the database, postkauz.db.pre-NNNN-….bak, readable only by you; after a successful update the two newest copies are kept, older ones are removed). Two versions must never work on the same database at once. Before the first start of a new version, stop every process of the old one:
- the
sync --watchtask (Windows:Stop-ScheduledTaskandDisable-ScheduledTask -TaskName "PostKauz sync watch", see docs/betrieb.md 1.7; Linux:systemctl --user stopof its unit), - the audit export task ("PostKauz audit export": "Disable" until the update is done; Linux:
systemctl --user stop postkauz-audit-export.timer), - the Claude app (it starts the MCP server
postkauz mcp; quit it completely, also from the tray area), - any other
postkauzwindow.
Then replace the program file, run postkauz doctor once (it shows needs_migration), then postkauz accounts list (migrates), and start the tasks and the Claude app again. From 0.3.0-alpha.1b on, every process holds a shared lock (postkauz.db.lock) and a migration refuses with migration_blocked while another process has the database open; versions up to 0.2.0-rc8 do not know this lock, so stopping them by hand stays necessary for that update.
From a source checkout (make build, needs Go 1.27) the program is ./bin/postkauz; installed, it is just postkauz:
make build # builds bin/postkauz (and the alias bin/pk)
./bin/postkauz version --json
./bin/postkauz doctor # paths, keyring, database, schema version
./bin/postkauz account add demo --imap imap.example.org:993 --user demo@example.org # password prompt; stored in the OS keyring
./bin/postkauz account test demo # login, capabilities, mailboxes with roles (read-only)
./bin/postkauz sync -a demo # mirror the mailbox (resumable); --watch keeps running with IDLE
./bin/postkauz mailbox list -a demo
./bin/postkauz show 42 # cleaned text, links with warnings, "hidden text removed" when the HTML hid text
./bin/postkauz thread --message 42 --strip-quotes
./bin/postkauz attach list 42 # detected type, type mismatch, executable, text extraction status
./bin/postkauz attach text 7
./bin/postkauz search "Rechnung" -a demo --limit 5 # finds "Rechnungen", "Abrechnung"; "prüfen" = "pruefen"
./bin/postkauz search 'from:anna has:attachment after:2026-01-01' --json # NDJSON, one line per hit
./bin/postkauz search '"Erdgeschoss links" -Keller' --explain # shows how the query was translated
./bin/postkauz key create --name assistant-1 --role reader # API key for an agent; shown once, only its hash is stored
./bin/postkauz policy show --key assistant-1 # what that key may do
./bin/postkauz audit --since 1h # who called what, never message content
./bin/postkauz audit export --to /mnt/backup/audit && ./bin/postkauz audit verify
./bin/postkauz backup create --to /media/usb/postkauz-backup # unencrypted: use an encrypted drive (see Backup)Without an OS keyring (servers, containers) set POSTKAUZ_PASSWORD_<NAME> and use account add --password-from-env. Configuration and paths: docs/cli.md, section 5; query language: docs/cli.md, section 2d. sync also extracts attachment text and builds the search index; search reads the local mirror only.
PostKauz has no PDF parser of its own (attack surface). If pdftotext from Poppler is on the PATH, it is used in a subprocess with time and size limits; without it PDF attachments are skipped with a reason and their text is not searchable (file names still are). postkauz doctor shows whether it was found (line pdftotext). Since 0.3.0-rc10 you can pin the program in config.toml ([extract], pdftotext = 'C:\Tools\Poppler\bin\pdftotext.exe', single quotes on Windows); PostKauz checks it once with a small built-in PDF on stdin and skips PDFs (instead of failing them) if it is the wrong program, for example the Xpdf pdftotext that comes with Git for Windows. postkauz attach retry extracts failed attachments again. Everything else is built in.
| System | Install |
|---|---|
| Debian, Ubuntu | sudo apt install poppler-utils |
| Fedora | sudo dnf install poppler-utils |
| macOS (Homebrew) | brew install poppler |
| Windows | install Poppler for Windows (for example scoop install poppler) and make sure its bin folder with pdftotext.exe is on the PATH |
After installing, the next sync also extracts the PDFs that were skipped because the tool was missing, and adds their text to the search index.
PostKauz is draft-only: it writes drafts into your Drafts folder; you send them from your usual mail client.
What works (slice 2):
draft new,draft reply(--allfor reply-all) anddraft forwardwith a Markdown (--body-file) or HTML (--html-file) body. Replies getIn-Reply-To,References, theRe:prefix and a quote; forwards get the sameIn-Reply-ToandReferences(since 0.3.0-rc2), so they stay in the thread of the original, also in Gmail; reply-all leaves out your own addresses (account address, aliases, identities).draft reply --no-derive-recipients(since 0.3.0-rc2) creates the reply in the thread without any recipient taken from the original: you add the address yourself once you have decided (draft edit <id> --to …). The Message-ID is fixed when the draft is created. Signature, reply prefix and a style file for agents come from an identity (identity add); attachments from the mirror (attachment id) or from files under[paths] attach_dir.- The next
postkauz syncputs the draft into the Drafts folder (IMAP APPEND, flags\Draft \Seen); a runningsync --watchdoes it within about 10 seconds.draft show <id> --emlprints exactly the bytes of that copy. - Optional approval:
draft request <id>runs your check hook and asks for approval;approve <approval-id>(a human, no key) marks the draftready. The approval is bound to the exact message: any change sends the draft back todraft. - When you have sent the draft from your mail client, the next
syncfinds it in Sent (by its Message-ID, or by recipients, subject, time and text when the client gave it a new Message-ID, or, since 0.3.0-rc3, for a reply or forward you edited before sending: by its In-Reply-To, recipients, time and a similar text once the copy has left the Drafts folder) and marks itsent_by_human(since 0.3.0-rc5 also a new email you extended before sending: by subject, recipients, time and a similar text). A draft whose copy has been gone from the Drafts folder for more than 24 hours without any sent message found is closed asabandoned(copy_gone; setting[draft] copy_gone_after). You can always close a draft yourself withdraft mark-sent <id>ordraft abandon <id>. - Agents with a key of the role
assistantget six MCP tools for drafts: create, change, read and list drafts, submit one for approval, read the state of an approval. Since slice 3, part T2, the role also gets local tags, reading mailbox actions and asking for a sync (mail_tag,mail_list_tags,mail_get_action,mail_list_actions,mail_sync_now), but nothing that changes the server (see the next section; tags reach the server only with[tags] sync_keywords = true).
What never happens: PostKauz never sends mail (there is no SMTP code), never deletes or expunges a message (moving and the trash: see the next section), and never overwrites a draft you changed in your mail client (further changes are refused with draft_taken_over). After a change it puts a new copy into Drafts and leaves the older one there; draft list and draft show warn about it, and you delete it in your mail client or, after a look, with draft cleanup <id> (moves the older copies to the trash; only a human). The MCP server never holds the mailbox password. No API key, whatever its role, can approve, reject, abandon or mark a draft as sent, or manage identities (human_only).
postkauz identity add -a mail --email me@example.org --name "Me" --signature-file signature.txt
postkauz draft reply 42 --body-file answer.md # draft 1 created (status draft, remote pending)
postkauz sync -a mail # puts it into the Drafts folder, then mirrors
postkauz draft show 1 # status, remote: pushed, copies, text
postkauz draft request 1 # check hook, then approval 1 (optional)
postkauz approve 1 # only a human: status ready
# now open the draft in your mail client and send it
postkauz sync -a mail && postkauz draft list # status sent_by_humanThe check hook is a program you name as a list in policy.toml ([draft] check_hook, no shell); the examples check-example.ps1 (Windows PowerShell 5.1) and check-example.sh come with each release and lie in deploy/hooks/. For a German quote line set [draft] quote_line = 'Am {date_numeric} schrieb {from}:' in config.toml. Details: docs/cli.md (sections 2j and 5), docs/versanderkennung.md (how sending is detected), docs/sicherheit.md (section 5).
Slice 3 (since 0.3.0-rc1; built in part T2):
- Tags are local labels in the mirror (
tag add rechnung 42,tag remove,tag list, search withtag:rechnung). They never touch the server unless[tags] sync_keywords = truecopies them as IMAP keywords. - Mark, move, trash change the server:
mark 42 --seen,mark 42 --flagged,move 42 --to Archive(or--role archive),trash 42. The mirror shows the change at once (pendingflags); the server gets it from the process that has the password: the nextpostkauz sync, or a runningsync --watchwithin about 10 seconds (--jobs-interval). Moves use IMAPMOVEonly; a server withoutMOVEgets nothing, and PostKauz never expunges. - Trash needs a human.
trash(andmail_trashfor agents) only files a request (exit code 4,needs_approval);action approve <id>(a human, no key) lets it run,action reject <id>drops it.trash 42 --yesapproves your own request in one step. Nothing is ever deleted for good. action listandaction show <id>show what is queued, done, partial or failed, target by target.- Agents:
mail_tag,mail_list_tags,mail_mark,mail_move,mail_trash,mail_get_action,mail_list_actions, depending on the scopes of the key. Changing the server needs its own scope:mail:markformail_mark,mail:moveandmail:trash(only the rolesoperatorandadminhave them); keys of the rolesassistantandtriagetag locally but never mark, move or trash. The roletriage(read, search, drafts, local tags; no sync, no audit) is meant for unattended night runs.policy.tomllimits moves and the trash for keys ([move] agent_may,[delete] agent_may,bulk_confirm_threshold, per key[keys.<name>]).
postkauz search 'from:billing@example.org after:2026-10-01' --json # pick the ids
postkauz tag add rechnung 42 43
postkauz mark 42 43 --seen
postkauz move 42 43 --to Archive
postkauz trash 44 # request filed, exit 4
postkauz action approve 3 # only a human
postkauz sync -a mail && postkauz action show 3Details: docs/cli.md (section 2k), docs/mcp.md, docs/sicherheit.md.
Slice 3, part T3. PostKauz keeps what was deleted on the server until you remove it yourself; only a human (no --key) can, and agents never see these commands; purge and blob gc never run while a sync or import is running (sync_running). Try each with --dry-run first: it only counts.
-
purge --older-than 180ddeletes messages that were deleted on the server more than 180 days ago, with their text, tags and search index. Imported archive messages and messages a draft refers to always stay. Default period:[retention] deleted_remote_after(none). -
blob gcthen deletes stored files (raw messages, attachments) nothing refers to any more and that are older than[retention] blob_gc_min_age(24 hours); draft attachments always stay. -
audit rotatemoves audit days older than[audit] retain(365 days) into an archive databaseaudit-archive-<from>-<to>.dbnext to the database, but only days that were exported and confirmed byaudit verify(otherwisenot_exported/not_verified).audit verifyandaudit exportkeep working across the archive; keep the file with your backups.
Step by step (German): docs/betrieb.md, section 5; details: docs/cli.md, section 2m.
Slice 3, part T3 (pre-alpha):
- Save an attachment:
attach save <attachment-id> [--subdir invoices/2026]writes the file below[paths] export_dir(default<data dir>/export, seedoctor) and nowhere else: no.., no absolute path, no symbolic link. The name is cleaned (path separators, control characters, Windows device names such asCON), an existing file is never replaced (invoice-2.pdf), and programs or scripts get the ending.blocked. Agents with the scopemail:export(rolesoperator,admin) usemail_save_attachment. - Export the archive (humans only, no key, no MCP tool):
export mbox --to <new folder>writes mboxrd, one file per folder in the Thunderbird layout (Archive.sbd/2024);export eml --to <new folder>writes every message byte for byte as<id>-<sha256>.eml, one folder per mailbox, plusindex.csv(id, Message-ID, date, folder, size, sha256; no subject, no addresses). The target must be new or empty.--mailboxand--sincenarrow it. The export is not encrypted.
postkauz attach save 7 --subdir invoices
postkauz export mbox --to ./export-mbox -a mail
postkauz import mbox ./export-mbox -a other # the same messages, same content_hashDetails: docs/cli.md (section 2n), docs/betrieb.md (section 6, opening the mbox in Thunderbird).
postkauz mcp is an MCP server over stdio. An agent gets its own API key; the tools it sees follow the key's scopes, every call lands in the audit log under the key's name, and every piece of mail content comes wrapped as untrusted data. A reader key only reads; a key of the role assistant can also create drafts and submit them for approval, tag messages locally and ask for a sync. Marking, moving and asking for the trash need the scopes mail:mark, mail:move and mail:trash (roles operator, admin); the sync job carries such actions out, a move to the trash only after a human approved it. Only a human approves drafts and sends them from the mail client; nothing is ever sent, and nothing is deleted for good.
1. Create a key (shown exactly once; only its hash is stored):
postkauz key create --name claude-code --role reader --expires 30dreader may read and search mail and the audit log. For a triage agent without message bodies: --role reader --scopes mail:search. Check what a key may do with postkauz policy show --key claude-code.
2. Register the server. The key goes into the environment variable POSTKAUZ_KEY, never on the command line of the server. With the Claude Code CLI (all options before the server name postkauz, the program after --):
claude mcp add --env POSTKAUZ_KEY=pk_key_... --scope user --transport stdio postkauz -- /usr/local/bin/postkauz mcpOn Windows (PowerShell), with the full path to the program:
claude mcp add --env POSTKAUZ_KEY=pk_key_... --scope user --transport stdio postkauz -- C:\PostKauz\postkauz.exe mcpOr as JSON, for example in a project's .mcp.json (keep that file out of version control, it contains the key):
{
"mcpServers": {
"postkauz": {
"command": "C:\\PostKauz\\postkauz.exe",
"args": ["mcp"],
"env": { "POSTKAUZ_KEY": "pk_key_..." }
}
}
}The Claude desktop app uses the same mcpServers block in claude_desktop_config.json (Windows: %APPDATA%\Claude\claude_desktop_config.json, macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; open it via Settings, Developer, Edit Config) and needs a restart afterwards.
Optional entries in env: POSTKAUZ_DATA_DIR to use another data directory (for example a test database), POSTKAUZ_KEY_FILE instead of POSTKAUZ_KEY (path to a file holding the key; on Linux and macOS it must be readable only by you).
3. Check it. In Claude Code, /mcp lists the server and its tools: mail_search, mail_get_message, mail_get_thread, mail_list_accounts, mail_list_mailboxes, mail_list_attachments, mail_get_attachment_text, mail_audit_log, mail_get_policy (with a key of the role assistant also the six draft tools, see Drafts). Ask something like "Search my mail for invoices and summarise them"; afterwards postkauz audit --since 10m --key-id key:claude-code shows each call with the key name and without any mail text.
The server only reads the local mirror and writes drafts into it; keep it current with postkauz sync (or sync --watch), which also puts the drafts into the Drafts folder. Revoke a key you no longer need: postkauz key revoke claude-code. Note that the client configuration stores the key in plain text in your user profile; use a short expiry and the narrowest role that works. Details: docs/mcp.md, docs/sicherheit.md.
One scheduled task keeps all accounts in sync while you are logged on: postkauz sync --watch --all (one process, one lock per account; an account whose login fails does not stop the others: inside the process it tries again every 30 min, and postkauz doctor shows the account with status error and the reason until a round succeeds). Register-SyncWatch.ps1 registers it and Run-SyncWatch.ps1 restarts the program after a crash or an end (wait 60 s, doubled up to 30 min) and writes a rotating log to <data dir>\logs\sync-watch.log. Exit code 6 (rejected login; the wrapper then always waits 30 min) only comes from a run that watches a single account; with --all a rejected login never ends the process. Both scripts come with each release (deploy/windows/); keep them next to each other. No password goes into the task or the scripts: postkauz reads it from the Windows Credential Manager as usual.
powershell -ExecutionPolicy Bypass -File .\Register-SyncWatch.ps1 -DataDir C:\PostKauz\data -ConfigFile C:\PostKauz\config.tomlAgents cannot sync themselves (the MCP server has no mail password); the MCP tool mail_sync_now (CLI sync request) queues a sync that the running watcher starts within about 10 s. Step-by-step guide (German): docs/betrieb.md.
Slice 3 (since 0.3.0-rc1; built in part T5, acceptance D8 parts A to C passed, part D with OAuth still open). postkauz mcp --http serves the same MCP tools over HTTP for agents on other machines, for example a Claude Code cloud session in your Tailscale network (ADR-010). It is stateless Streamable HTTP (only POST /mcp), listens on 127.0.0.1:8787 by default and knows no mail password; TLS and the private network come from tailscale serve, never from a public port or funnel. Every request brings its own credential:
[http] auth = "key"(default):Authorization: Bearer <API key>, loopback and Tailscale addresses only (put only this machine's own Tailscale address intolisten: 100.64.0.0/10 is the general carrier-grade NAT range, not only Tailscale). Claude Code:claude mcp add --transport http postkauz https://<node>/mcp --header 'Authorization: Bearer ${POSTKAUZ_KEY}', with single quotes in bash and PowerShell. Claude Code expands${POSTKAUZ_KEY}itself when it connects, from its own environment, so the key never lands in~/.claude.json. With double quotes bash would write the key there in plain text, and PowerShell would insert an empty variable of its own.[http] auth = "oauth": an access token of your own authorization server (Authelia 4.39.x recommended, example indeploy/docker/auth/); PostKauz checks it (at+jwt, signature, issuer, expiry, audience) and maps its subject to an API key in[http.principals]. Rights always come from the API key.
Every call is audited with transport: http and the key name, never a token. On a Linux server the sync service gets the mailbox password as a systemd credential (LoadCredential=), never through its environment, and the HTTP service cannot see it; use systemd 257 or newer (for example Debian 13) so that PrivatePIDs= separates the two services completely. Linux services (deploy/systemd/), Docker (deploy/docker/) and the step-by-step guide (German): docs/betrieb.md, section 4.
Claude Desktop on a second PC (since 0.3.0-rc2): Claude Desktop starts only local programs as MCP servers, and its remote connectors run through the vendor's cloud, which cannot reach your Tailscale network. PostKauz brings its own bridge instead of a third-party package such as npx mcp-remote (which needs the key in plain text in the configuration):
postkauz remote add office --url https://office-pc.<tailnet>.ts.net/mcp --config C:\PostKauz\config.toml # hidden prompt for the API key; stored only in the keyring
postkauz remote test office --config C:\PostKauz\config.toml # tools: 20, key: key:second-pc (role assistant)
Then in claude_desktop_config.json: "postkauz": {"command": "C:\\PostKauz\\postkauz.exe", "args": ["mcp", "--remote", "office", "--config", "C:\\PostKauz\\config.toml"]}, with no env and no key. Keep the configuration outside %APPDATA%: Claude Desktop is an app package, and Windows redirects %APPDATA% for the programs it starts. mcp --remote passes every MCP message unchanged to mcp --http on the other PC; it opens no database and knows no mail password. Guide for both PCs (German): docs/betrieb.md, section 4.9.
The audit log is append-only; its real tamper protection is a daily export to a second location (another disk, a network share or a synced folder such as Google Drive). Each day becomes one JSONL file whose lines form a SHA-256 hash chain across all days, plus a manifest (postkauz-audit-manifest.json) with checksum and chain head per file. postkauz audit verify compares the export with the database and the chain and names the first changed line (mismatch, exit code 1). Set the target once in the configuration (postkauz doctor shows its path), for example:
[audit]
export_dir = 'G:\My Drive\PostKauz-Audit'Windows (Task Scheduler, no administrator rights; the script Register-AuditExport.ps1 comes with each release and lies in deploy/windows/; put it next to postkauz.exe or anywhere else):
powershell -ExecutionPolicy Bypass -File .\Register-AuditExport.ps1 -ExePath C:\PostKauz\postkauz.exe -ExportDir "G:\My Drive\PostKauz-Audit"It registers the task "PostKauz audit export" (daily at 12:30, runs as soon as possible after a missed run, only while you are logged on, without a console window), starts it once and checks that the export arrived. The task gets the data directory and configuration file that postkauz doctor shows at that moment (--data-dir, --config), so it works on the same data as your window even if POSTKAUZ_DATA_DIR is only set there. Options: -DataDir C:\PostKauz\data, -At 08:15, -ProfileName <name>, -ShowWindow (if the hidden console is blocked), -Unregister.
If you start PostKauz from a packaged Windows app (for example from a terminal inside the Claude desktop app), Windows may redirect new folders under %LOCALAPPDATA% and %APPDATA% into that app's package folder, where the Task Scheduler does not see them. postkauz doctor warns about this (really: …), and the script refuses to register the task; it also refuses a data directory without a database. Use a data directory outside these folders, for example -DataDir C:\PostKauz\data (and --data-dir or POSTKAUZ_DATA_DIR for your own commands); to keep existing data, copy the folder shown after really: there first. If Windows refuses to run a downloaded script, run Unblock-File .\Register-AuditExport.ps1 first.
Linux (systemd user timer, daily at 12:30 with Persistent=true):
install -Dm644 deploy/systemd/postkauz-audit-export.service deploy/systemd/postkauz-audit-export.timer -t ~/.config/systemd/user/
systemctl --user daemon-reload && systemctl --user enable --now postkauz-audit-export.timer
systemctl --user start postkauz-audit-export.service && postkauz audit verifyThe service expects the program at ~/.local/bin/postkauz; change ExecStart with systemctl --user edit --full postkauz-audit-export.service otherwise. On a server without login sessions also run loginctl enable-linger "$USER". On macOS use launchd or cron with postkauz audit export --quiet.
postkauz doctor shows the last export (line audit:) and warns when days older than two days were not exported.
Test servers (Dovecot, Stalwart, GreenMail) for development: make testmail-up. Never develop against a real mailbox.
A backup is your whole mail archive, unencrypted: PostKauz does not encrypt it. Keep it only on an encrypted drive (BitLocker, LUKS, VeraCrypt) or pipe it into age or restic. Step by step (German): docs/betrieb.md, section 2.
postkauz backup create --to /media/usb/postkauz-backup # database snapshot, all blobs, manifest.json with SHA-256, ENCRYPT-ME.txt
postkauz backup create --to /media/usb/postkauz-backup # again: copies only new blobs ("copied 0" without new mail)
postkauz backup create --tar - | age -r age1... > postkauz.tar.age # same content as a tar stream
postkauz restore --from /media/usb/postkauz-backup --data-dir ~/postkauz-restoredbackup createruns next tosync --watch(consistent snapshot viaVACUUM INTO), is for humans only (no API key, no MCP tool), refuses targets inside the data directory and warns after every run that the backup is not encrypted.restorewrites only into a new or empty folder, never into the configured or default data directory. It checks every file against the manifest first and stops on any difference, leaving nothing behind; then it migrates the database and runsdoctor --blobs=all.- A restored copy is a new instance: new data directory id, so it never reads or moves the keyring entries of the original (store passwords again with
account set <name> --password-stdin); open server jobs, mailbox actions and requests are closed and queued drafts are held, so nothing writes to a mail server on its own.--keep-identitykeeps the id (only to replace a lost data directory). Give the copy its own audit export folder.
PostKauz assumes that every mail may contain instructions aimed at your agent, and that no filter recognises them reliably. Protection therefore lives outside the model. Details and honest limits: docs/sicherheit.md.
- Draft-only. The MVP contains no SMTP code at all (
make guardchecks it). Agents can at most prepare drafts and submit them for approval; only a human approves, and a human sends them in the usual mail client. There is no expunge in the provider interface; agents reach the trash at most (slice 3). - Scopes and roles. Every agent gets its own API key (
key create), only its SHA-256 hash is stored. Roles bundle scopes (reader:mail:read,mail:search,audit:read);--scopescan only narrow a role (for examplemail:searchwithout message bodies). The MCP server lists only the tools the key may use; revoking a key takes effect within seconds, also in a running session.policy show --key <name>shows what a key may do. - Untrusted envelope. Every output with mail content (CLI
show,thread,search,attach; all MCP results) is markeduntrusted: true,source: "email"with a notice to treat it as data. HTML is reduced to text, hidden text is removed and reported, links are listed with warnings, nothing is loaded remotely, control and invisible characters are removed. - Audit. Every call (CLI and MCP, allowed or denied) is written to an append-only table before it runs (fail closed), with key name and parameters but never mail text or search terms. The daily export to a second location with a hash chain and manifest makes later changes visible (
audit verify). - Secrets. Passwords live in the OS keyring or the environment, never in files of PostKauz, logs, audit, error messages,
--jsonoutput or crash reports; a canary test across all output channels runs with everymake check, anddoctor --secretssearches your own installation. - What leaves your computer: PostKauz itself sends nothing anywhere. An agent you connect sees what it reads through its key; use the narrowest role and a short expiry.
- Phase 0: scaffold, ADRs, test servers, spike with
go-imap/v2, go/no-go gate. - S1: accounts, sync, mirror, threads, full-text search, read-only CLI and stdio MCP, audit, mbox/Maildir import.
- S2: drafts (draft-only), policy file, approval states, pre-ready check hook.
- S3 (0.3.0-rc1): tags and mailbox actions, export/backup/restore, deleting from the local archive, Microsoft mailboxes via OAuth2, HTTP MCP with API keys or OAuth 2.1.
- Later: SMTP sending with approval, rules, REST, JMAP. Details and acceptance criteria:
docs/roadmap.md.
See CONTRIBUTING.md. Short version: Go 1.27 with GOTOOLCHAIN=local (ADR-008), small commits (feat:, fix:, docs:, test:, chore:), make check before every commit, no secrets and no personal data in the repository, never test against a real mailbox. Security issues: SECURITY.md.
Apache-2.0, see LICENSE and NOTICE.
PostKauz (Arbeitstitel) ist ein E-Mail-Client für KI-Agenten, ohne Oberfläche: Er spiegelt ein vorhandenes IMAP-Postfach lokal (SQLite plus .eml-Dateien), macht es durchsuchbar und bietet es per Kommandozeile und MCP an. Jeder Agent bekommt einen Schlüssel mit begrenzten Rechten; Aktionen sind nach Risiko gestuft, lassen sich im Trockenlauf prüfen und stehen in einem Audit-Log.
Der MVP ist draft-only: Er legt Entwürfe in den Entwürfe-Ordner, sendet aber nie selbst. Gesendet wird vom Menschen im gewohnten Mailclient.
Stand: 0.3.0-rc1 (Release-Kandidat von Schnitt 3, noch ohne Tag; der Tag folgt der Entscheidung D10 des Betreibers), beim Autor seit 26.10.2026 im täglichen Einsatz. Schnitt 3 ist komplett: Tags und Postfach-Aktionen (Markieren, Verschieben, Papierkorb nur mit Freigabe durch den Menschen), Anhänge ablegen, Export als mbox/EML, Sicherung und Wiederherstellung, Löschkonzept, Microsoft-Postfächer per OAuth2 und Fernzugriff über HTTP-MCP. Abnahmen auf dem Windows-PC des Autors: D7a und D7 bestanden, D8 Teile A bis C bestanden; offen sind D8 Teil D (OAuth mit Authelia, wartet auf einen Server) und D9 (echtes Microsoft-Postfach). Zuletzt veröffentlicht: 0.2.0-rc8.
Nicht-Ziele: keine GUI vor 1.0, kein Massenversand, keine Agenten-Postfächer, keine eigene Google-OAuth-App, kein Spamfilter, kein PGP/S/MIME im MVP.