mailbox-check

mailbox-check is a command for Claude Code from alifanov/darkflow. It costs 23 tokens per session (1,280 once invoked), scanned A, original, MIT.

An automated mailbox check that reads new messages through IMAP, creates tasks from them, and sends approved replies through SMTP. IMAP receives email and SMTP sends it.

In plain words
What is it for?
Use it to turn new mailbox messages into work items and send replies that have already been approved.
Why use it?
It connects incoming email with the project’s task workflow while requiring approval before replies are sent.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/alifanov/darkflow/mailbox-check
Clone the repo
git clone --depth 1 https://github.com/alifanov/darkflow

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mailbox-check

README.md
[![agentmods](https://agentmods.dev/badge/commands/alifanov/darkflow/mailbox-check.svg)](https://agentmods.dev/commands/alifanov/darkflow/mailbox-check)
Your own site
<a href="https://agentmods.dev/commands/alifanov/darkflow/mailbox-check"><img src="https://agentmods.dev/badge/commands/alifanov/darkflow/mailbox-check.svg" alt="Measured on agentmods" height="20"></a>
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,280 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00023 $0.01280
Opus 5 $0.00012 $0.00640
Sonnet 5 $0.00005 $0.00256
Haiku 4.5 $0.00002 $0.00128

Measured 5d ago against content hash 7aa57ac0c843, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mailbox-check scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/.claude/commands/darkflow/mailbox-check.md · 126 lines

How it starts

The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Note — cheap pre-flight. The dispatcher (darkflow-run.sh) runs a read-only IMAP unseen-count (fetch.py --count) and a df task list for approved reply tasks before launching this agent. If there's no new mail and no reply pending, it skips this agent entirely — so on a quiet inbox you are not invoked. When you are invoked there is real work (new mail and/or replies to send); proceed with the full steps below.

Step 1 — Read config

Load the project config (contract in .darkflow.d/claude.mdProject config). Uses: language, branch, mergeStrategy.

Load mailbox credentials from .env (the project's main env; .env.darkflow is a legacy fallback):

set -a; [ -f .env.darkflow ] && source .env.darkflow; [ -f .env ] && source .env; set +a

If MAILBOX_IMAP_HOST is empty after sourcing — stop and print "mailbox not configured — add MAILBOX_IMAP_* vars to .env".

Step 2 — Send approved replies

Find all open tasks with status:approved, source:mailbox, action:reply:

~/.darkflow/df task list --status approved --source mailbox --action reply --state open

For each such task:

  1. Extract email metadata from the task body (look for the structured block added in Step 4):

    • To — value of From: field in the task body (reply goes back to the sender)
    • SubjectRe: + original subject from Subject: field
    • Message-ID — value of Message-ID: field for threading
  2. Check if there are any human comments on the task. If yes — include them as the reply body context (the human may have added instructions or draft text). If not — write a polite, short acknowledgement in language that the message was received and is being handled.

  3. Write the reply body to a temp file:

    cat > /tmp/darkflow_reply_$number.txt << 'EOF'
    <reply text here>
    EOF
    
  4. Send the reply:

    python3 ~/.darkflow/mailbox/send.py \
      --to "<From address from task>" \
      --subject "Re: <original subject>" \
      --in-reply-to "<message-id from task>" \
      --body-file /tmp/darkflow_reply_$number.txt
    

Read the full file on GitHub · 126 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 126 lines · 23 tokens per session scan A 7aa57ac0c843

Subscribe to this mod's changes

mailbox-check is a command published in the GitHub repository alifanov/darkflow (2 stars, last pushed 6d ago), licensed MIT. It adds 23 tokens to every session and 1,280 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.