Update docs to reflect stages 1-4 complete and working email reply

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 03:46:56 +00:00
parent 7ddfcbecf4
commit fc3a91384a
2 changed files with 15 additions and 15 deletions

View File

@@ -3,8 +3,7 @@
> **Experimental** — this is a work in progress and the architecture is still evolving. > **Experimental** — this is a work in progress and the architecture is still evolving.
An IMAP bridge that forwards emails from a trusted sender as prompts to a running An IMAP bridge that forwards emails from a trusted sender as prompts to a running
[Claude Code](https://claude.ai/code) instance. Send an email, get a response in [Claude Code](https://claude.ai/code) instance, and sends replies back via email.
your terminal.
## How it works ## How it works
@@ -12,16 +11,17 @@ your terminal.
2. Filters by a configured sender address 2. Filters by a configured sender address
3. Formats the email as a prompt and dispatches it to Claude Code via an external 3. Formats the email as a prompt and dispatches it to Claude Code via an external
paste utility paste utility
4. Claude Code reads and responds in the terminal as normal 4. Claude Code processes the message and replies via the CCC `send-email` action
## Dependencies ## Dependencies
- [imapflow](https://imapflow.com/) — IMAP client - [imapflow](https://imapflow.com/) — IMAP client
- [mailparser](https://nodemailer.com/extras/mailparser/) — email parsing - [mailparser](https://nodemailer.com/extras/mailparser/) — email parsing
- An external script to actually deliver the prompt to Claude Code's terminal window. - An external script to deliver the prompt to Claude Code's terminal window.
This tool has been tested with This tool has been tested with
[claude-code-conduit](https://gitea.efforting.tech/mikael-lovqvists-claude-agent/claude-code-conduit) [claude-code-conduit](https://gitea.efforting.tech/mikael-lovqvists-claude-agent/claude-code-conduit)
and a companion paste utility that targets the correct Konsole window via xdotool. and a companion paste utility that targets the correct Konsole window via xdotool.
CCC also provides the `send-email` action used for replies.
## Configuration ## Configuration
@@ -59,6 +59,5 @@ node mail-buddy.mjs
falls back to 45s polling) falls back to 45s polling)
- The paste mechanism steals window focus on every message; a cleaner PTY-based - The paste mechanism steals window focus on every message; a cleaner PTY-based
approach is planned approach is planned
- No email reply capability yet — Claude can only respond in the terminal for now
- Sender filtering is substring-based, not cryptographically verified (DKIM - Sender filtering is substring-based, not cryptographically verified (DKIM
checking is planned) checking is planned)

21
plan.md
View File

@@ -29,21 +29,22 @@ For now, `allowed_sender` substring match is sufficient for exploration. Worth a
## Implementation Stages ## Implementation Stages
### Stage 1 — Explore the message object (current) ### Stage 1 — Explore the message object
Receive a message and `inspect()` the full imapflow msg object to understand what Receive a message and `inspect()` the full imapflow msg object to understand what
data is available (headers, body parts, envelope, flags, etc.). data is available (headers, body parts, envelope, flags, etc.).
### Stage 2 — Prompt construction ### Stage 2 — Prompt construction
Parse the message into a well-formed prompt: sender, subject, body. Prefix with Parse the message into a well-formed prompt using `mailparser`. Use HTML body for
instructions telling Claude to reply via the CCC `send-email` action. better encoding/structure fidelity. Instruct Claude to reply via CCC per
`email_protocol.md`.
### Stage 3 — CCC send-email action ### Stage 3 — CCC send-email action
Extend `claude-code-conduit` with a `send-email` action (SMTP). Claude calls it as `send-email` action already existed in `claude-code-conduit` with full SMTP,
a tool with recipient, subject, and body. permission store, and topic-based access control. Tested and working end-to-end.
### Stage 4 — Wire it together ### Stage 4 — Wire it together
Replace the `inspect()` call with `make_prompt` + `send_to_claude`. End-to-end flow: `make_prompt` + `send_to_claude` wired up. Full flow working:
email in → Claude processes → email out. email in → Claude processes → replies via CCC send-email → email out.
### Stage 5 — Adaptive polling ### Stage 5 — Adaptive polling
High/low frequency mode: switch to fast polling (e.g. 10s) when a message arrives, High/low frequency mode: switch to fast polling (e.g. 10s) when a message arrives,