agentleFS
ChiefStarKidChiefStarKid/claude-outlook-bridge/AGENTS.md

claude-outlook-bridge

AGENTS.md1 starsChanged 6 months agoMITView on GitHub

Instructions for coding agents (Claude Code, Cursor, Aider, etc.) wiring this bridge into a user's project. claude-outlook-bridge is a single Python file (outlook_bridge.py) that an agent invokes via Bash to read and send email through the user's already-open Outlook Desktop App on Windows. No auth setup. All output is JSON on stdout; errors exit non-zero with {"error": "..."}. When a user asks you to set up Outlook access in their project, do all of the following: If this returns folder…

  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,266 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When a user asks you to set up Outlook access in their project, do all of the following:

    line 11
  2. Distinctive:

    Smoke test: before wiring it in:

    line 19
  3. Very specific:

    If this returns folder JSON, Outlook is reachable.

    line 23
  4. Very specific:

    Don't loop list to scrape the inbox: Use search with a query. Repeated list calls bloat context.

    line 76
  5. Distinctive:

    Don't assume Outlook is open: If a command errors with a COM dispatch failure, surface the error to the user instead of retrying.

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Instructions for coding agents (Claude Code, Cursor, Aider, etc.) wiring this bridge into a user's project.

What this is

claude-outlook-bridge is a single Python file (outlook_bridge.py) that an agent invokes via Bash to read and send email through the user's already-open Outlook Desktop App on Windows. No auth setup. All output is JSON on stdout; errors exit non-zero with {"error": "..."}.

Auto-wire checklist

When a user asks you to set up Outlook access in their project, do all of the following:

  1. Clone or download to a stable path. Recommend ~/.claude/outlook-bridge/ so the script can be shared across projects:
    git clone https://github.com/ChiefStarKid/claude-outlook-bridge.git ~/.claude/outlook-bridge
    pip install -r ~/.claude/outlook-bridge/requirements.txt
  2. Smoke test before wiring it in:
    python ~/.claude/outlook-bridge/outlook_bridge.py folders --pretty
    If this returns folder JSON, Outlook is reachable. If it errors, Outlook isn't open or pywin32 isn't installed — fix before continuing.
  3. Add the permission to the project's .claude/settings.json (create the file if missing):
    {
      "permissions": {
        "allow": ["Bash(python *outlook_bridge.py*:*)"]
      }
    }
  4. Add a CLAUDE.md snippet so the assistant knows the bridge exists and the safety rules:
    ## Outlook email access
    
    Outlook is reachable via:
    `python ~/.claude/outlook-bridge/outlook_bridge.py <command> [flags]`
    
    Commands: `folders`, `list`, `search`, `read`, `open`, `send`, `reply`, `forward`, `move`, `delete`, `cal-list`.
    All output is JSON. Use `--pretty` for human display.
    
    **Safety:** `send`, `reply`, `forward` all save to Drafts by default.
    NEVER pass `--confirm-send` unless the user explicitly asks to send in the
    current turn. The old `--draft` flag still works but is now a no-op.

Command manifest

CommandRequired argsSide effectsIdempotentNotes
folders—noneyesReturns full folder tree as JSON.
list—noneyes`--folder <namepath> --count <n>. Returns array of {EntryID, Subject, From, ReceivedTime, ...}`.
search<query>noneyesFull-text across subject/body/sender/recipient. Same flags as list.
read<entry_id>noneyesReturns full body + attachment metadata. EntryID comes from list/search.
open<entry_id>opens native Outlook window; --screenshot writes a PNGyesGDI screen grab, not a Playwright screenshot — requires an active, unlocked session. Returns screenshot_error on failure.
send--to --subject --bodysaved to Drafts unless --confirm-sendno--attach FILE ... for local file attachments. Confirm with user before adding --confirm-send.
reply<entry_id> --bodysaved to Drafts unless --confirm-sendnoNever pass --confirm-send by default. --all for reply-all. --attach FILE ... for local files, --attach-email ID ... for other Outlook items as .msg.
forward<entry_id> --tosaved to Drafts unless --confirm-sendnoNever pass --confirm-send by default. --body adds an optional note. --attach FILE ... for local file attachments.
move<entry_id> --foldermutates mailbox stateyes (same target)Folder path supports nesting (Projects/Client).
delete<entry_id>moves to Deleted ItemsyesRecoverable from Deleted Items.
cal-list--from --tononeyesDates YYYY-MM-DD. --cal <name> for shared calendars (requires config).

Output contract

  • Success: JSON object or array on stdout, exit 0.
  • Failure: {"error": "<message>"} on stdout, exit 1.
  • --pretty reformats stdout but does not change the schema. Do not pass --pretty when piping to another command — parse the compact JSON directly.

Hard rules for agents

  1. Never pass --confirm-send on send, reply, or forward by default — they save to Drafts otherwise. Only add it when the user has explicitly said "send" in the current turn.
  2. Confirm before --confirm-send. State the recipients, subject, and a one-line body summary, and wait for the user to approve.
  3. Confirm before delete of anything that wasn't obviously transient (e.g. a notification the user told you to clean up).
  4. Don't loop list to scrape the inbox. Use search with a query. Repeated list calls bloat context.
  5. Pass EntryIDs through verbatim. They're opaque tokens — don't truncate, normalise, or quote-escape them.
  6. Don't assume Outlook is open. If a command errors with a COM dispatch failure, surface the error to the user instead of retrying.

Repo

Canonical source: https://github.com/ChiefStarKid/claude-outlook-bridge

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.