Skip to main content

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 ./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.

Agent Skill

Install or update the user-scoped imap skill:

imap-agent-cli install-skill

This writes:

~/.agents/skills/imap/SKILL.md

Remove the managed skill:

imap-agent-cli remove-skill

Use --skills-dir PATH to install into a nonstandard skills directory, for example:

imap-agent-cli install-skill --skills-dir ~/.agents/skills

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

imap_agent_cli-0.1.3.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imap_agent_cli-0.1.3-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file imap_agent_cli-0.1.3.tar.gz.

File metadata

  • Download URL: imap_agent_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imap_agent_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c1f62d9edcca6282430898f14f0fe914fa0c2424c2f746b2e756ce5b675b8c9b
MD5 ff9a9d0620ee2bf414b56c4857c612ed
BLAKE2b-256 c2bf42d72074704d10e0d1065c6972b76c7ab2f56d207c79c8c4c2e76ae01d0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for imap_agent_cli-0.1.3.tar.gz:

Publisher: publish.yml on pseudosavant/imap-agent-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imap_agent_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: imap_agent_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imap_agent_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa00f413caf57c53f3893e4923d9ddf309c932423080eb70d800e44ee16083a
MD5 07f65dc8930adf086c1e946b2c3a4348
BLAKE2b-256 7cc568fb88e05565fb4c339f73ee580186e1345e750fa6ae1f8c5ae603a1c6a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for imap_agent_cli-0.1.3-py3-none-any.whl:

Publisher: publish.yml on pseudosavant/imap-agent-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page