Agent-first IMAP CLI for safe email search, read, attachment download, and draft creation
Project description
imap-agent-cli
imap-agent-cli is an agent-first IMAP CLI for safe email search, read, attachment download, and draft creation.
It can inspect mailboxes and append messages to Drafts. It cannot send email, delete messages, move messages, archive messages, change labels, alter flags, or mark messages read/unread.
Status
This repo is under active development. The behavior target is defined in spec.md.
Quick Start
Single-profile env-var setup:
IMAP_AGENT_CLI_HOST=imap.example.com
IMAP_AGENT_CLI_PORT=993
IMAP_AGENT_CLI_USERNAME=me@example.com
IMAP_AGENT_CLI_PASSWORD=...
IMAP_AGENT_CLI_TLS=true
Local development:
uv run ./imap_agent_cli.py --help
uv run ./imap_agent_cli.py folders
uv run ./imap_agent_cli.py search --subject invoice
Packaged execution:
uvx imap-agent-cli --help
Examples
imap-agent-cli folders
imap-agent-cli search --folder INBOX --subject "invoice" --max-results 10
imap-agent-cli read --folder INBOX --uid 12345 --body-format html
imap-agent-cli attachments --folder INBOX --uid 12345
imap-agent-cli attachments download --folder INBOX --uid 12345 --part-id 2 --output-dir C:\tmp\email-attachments
imap-agent-cli draft create --to person@example.com --subject "Hello" --body "Draft only."
imap-agent-cli draft reply --folder INBOX --uid 12345 --body "Thanks. I will review this."
All command payloads are JSON on stdout. Diagnostics and errors go to stderr.
Config
Create a starter config:
imap-agent-cli config init
Add a named profile:
imap-agent-cli config add-profile work --host imap.example.com --port 993 --username me@example.com --password-env IMAP_AGENT_CLI_WORK_PASSWORD
imap-agent-cli config set-default-profile work
Config path:
~/.imap-agent-cli/config.toml
Secrets should stay in environment variables, not the config file.
Safety Boundary
Allowed:
- list folders
- search messages
- read messages with no-seen fetch behavior
- list/download attachments only when requested
- append new messages to Drafts
Not allowed:
- send
- delete
- move
- archive
- flag/star
- mark read/unread
- create/delete/rename folders
Testing
No-network unit tests:
python -m unittest discover -v
Package build:
uv build --no-sources
The spec targets pymap for future local IMAP integration tests on Windows without Docker.
Opt-in local IMAP integration test:
$env:IMAP_AGENT_CLI_TEST_PYMAP = "1"
uv run --extra test python -m unittest tests.test_pymap_integration -v
The integration test starts pymap dict --demo-data locally and logs in with demouser / demopass.
Publishing
The GitHub Actions workflow is .github/workflows/publish.yml.
PyPI Trusted Publishing values:
Project: imap-agent-cli
Owner: pseudosavant
Repository: imap-agent-cli
Workflow: publish.yml
Environment: pypi
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imap_agent_cli-0.1.0.tar.gz.
File metadata
- Download URL: imap_agent_cli-0.1.0.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89be0c81a4279a8651ecdff8b2be7956d423b9865547c5c2ce3c48c8158e18db
|
|
| MD5 |
6e1b2012fdc5423df340cd54967135a2
|
|
| BLAKE2b-256 |
deec5a48cc4c99d3573cca4adf300c082ad321dd610309563f5b2c756b585193
|
Provenance
The following attestation bundles were made for imap_agent_cli-0.1.0.tar.gz:
Publisher:
publish.yml on pseudosavant/imap-agent-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imap_agent_cli-0.1.0.tar.gz -
Subject digest:
89be0c81a4279a8651ecdff8b2be7956d423b9865547c5c2ce3c48c8158e18db - Sigstore transparency entry: 1761485866
- Sigstore integration time:
-
Permalink:
pseudosavant/imap-agent-cli@5a8d6cf4b2389619bf6cd525e1345ea7cb602de6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pseudosavant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5a8d6cf4b2389619bf6cd525e1345ea7cb602de6 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file imap_agent_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: imap_agent_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e42dc24d7f21f730a7ca85766f3d90c7df14a7a4e748ab908f2724e481a834f
|
|
| MD5 |
90cecd43188c7a69d1525d82fcabbd60
|
|
| BLAKE2b-256 |
e454841dbe5cdb822877d4ca2fb5ff175c860aa32bcb32884fd53737663589a4
|
Provenance
The following attestation bundles were made for imap_agent_cli-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on pseudosavant/imap-agent-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imap_agent_cli-0.1.0-py3-none-any.whl -
Subject digest:
4e42dc24d7f21f730a7ca85766f3d90c7df14a7a4e748ab908f2724e481a834f - Sigstore transparency entry: 1761485970
- Sigstore integration time:
-
Permalink:
pseudosavant/imap-agent-cli@5a8d6cf4b2389619bf6cd525e1345ea7cb602de6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pseudosavant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5a8d6cf4b2389619bf6cd525e1345ea7cb602de6 -
Trigger Event:
workflow_dispatch
-
Statement type: