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

Codex Skill

Install or update the user-scoped Codex 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 C:\Users\PaulEllis\.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.2.tar.gz (29.4 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.2-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: imap_agent_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 29.4 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.2.tar.gz
Algorithm Hash digest
SHA256 ab78267feb1c5b215b97d90f900ac1256245163b653ac17d4bfa0a0ba659cf83
MD5 0bbfcd181d4f5f7a6d44bb7b05eafaed
BLAKE2b-256 6889edb6ac8f6db5f318f507dc1657d0cef9c89d12cdf1f3824a72882f6f29c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for imap_agent_cli-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: imap_agent_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a2d08bcb124a1629c9ff80136b63a88201055bbeb71ef664bb06567a115fe82
MD5 3d12ee96441884f46259949addce1e42
BLAKE2b-256 6107a3d1543c197cdd541c4735ebabb50b7453e694816fd5a7e497cf7d687660

See more details on using hashes here.

Provenance

The following attestation bundles were made for imap_agent_cli-0.1.2-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