Status: exploratory design – subject to change
Purpose: capture current architecture and decisions so context is not lost
Envoy is an email‑native LLM agent that:
- reads and sends email
- maintains structured long‑term memory
- reasons using GPT API calls (stateless)
- updates memory explicitly
- behaves like a human mailbox user (not a message queue)
Key priorities:
- determinism
- inspectability
- efficiency of context window
- simple tooling
- minimal “magic”
GPT API (stateless reasoning)
↑
│
Envoy Orchestrator
(Python control logic)
↑
┌─────────────────┴─────────────────┐
│ │
IMAP Mailbox GData Notes Server
(conversation + tasks) (persistent knowledge)
- reasoning only
- no memory
- produces:
- replies
- memory updates
- actions
- fetch mail
- classify
- gather context
- call GPT
- apply memory writes
- send replies
- move/delete mail
- conversations
- working set
- inter‑agent messaging
- short/medium‑term context
- long‑term knowledge
- structured state
- durable truth
| Layer | Role |
|---|---|
| GPT | thinking |
| communication | |
| Notes DB | memory |
| Python | control & safety |
- GPT is stateless
- all memory lives outside the model
- context is reconstructed per call
| Layer | Time span |
|---|---|
| GPT context | seconds |
| days/weeks | |
| Notes | months/years |
IMAP chosen because it provides:
- folders
- partial fetch
- server‑side search
- persistent messages
- multiple clients/agents
- “workspace” semantics
POP3 remains suitable for queue‑style systems (e.g. PopIt3 jobs), but not for Envoy’s conversational model.
Email is not truth storage.
Email is:
- conversation
- working memory
- tasks/events
- coordination between agents
Truth and durable knowledge belong in Notes.
Examples:
- run job
- summarise thread
- scheduled reminders
- inter‑agent RPC
Lifecycle:
process → update notes → delete
Examples:
- design discussion
- planning
- project talk
Lifecycle:
Active → summarised → archived → optional delete
Inbox/
Active/
Tasks/
Agents/
Archive/
Done/
- Inbox – new mail
- Active – ongoing threads
- Tasks – machine actions
- Agents – internal traffic
- Archive – dormant history
- Done – safe to purge
Threads are first‑class.
Thread defined by:
- Message‑ID
- In‑Reply‑To
- References
Each thread has:
- short summary
- longer summary
- index of messages
Stored in Notes.
Example:
/threads/envoy-design/
summary_short
summary_long
message_index
decisions
tasks
Never load entire mailbox.
Layered retrieval:
always loaded
tiny orientation context
optional
fetched only if explicitly needed
This keeps token use minimal.
Notes are the primary state store.
Characteristics:
- JSON documents
- hierarchical keys
- atomic updates
- effectively unbounded size
/projects/*
/people/*
/preferences/*
/threads/*
/tasks/*
/envoy/state/*
- all durable facts live here
- emails only trigger updates
- system must be rebuildable from notes
For each new message:
1. classify type 2. fetch required notes keys 3. fetch minimal email context 4. call GPT 5. apply writes to notes 6. send reply 7. move/delete message
Model returns structured output:
{
"reply": "...",
"reads": ["keys"],
"writes": [
{"op": "PUT", "key": "...", "value": {...}}
],
"actions": []
}
Orchestrator validates and executes.
Email also acts as a message bus.
Agents may send mail to:
- themselves
- other agents
- humans
Enables:
- deferred tasks
- coordination
- retries
- distributed behaviour
SMTP effectively becomes actor messaging.
kept in Active/
move to Archive/
summarise → archive → optional delete
delete immediately after success
- explicit state > implicit memory
- small context > large history
- inspectable systems > hidden magic
- structured data > free text
- deterministic behaviour > heuristics
- exact IMAP library choice
- thread completion detection
- summary format
- memory schema details
- scheduling mechanism
- concurrency rules between agents
- security/authentication for agents
Envoy is:
An email‑native, stateless‑LLM agent with structured persistent memory,
using IMAP as a conversational workspace and GData as the cognitive store.