How bballer333/outlookctl works
1. Overall shape
outlookctl is a Windows-only, local-only Python CLI for automating the classic Outlook desktop client through COM. It is not a network service or a web app; the main runtime boundary is between the CLI process and the already-running Outlook application in the same Windows session.
2. Primary runtime entry point
The executable surface is src/outlookctl/cli.py, which exposes command-line subcommands for email and calendar workflows. The CLI is the orchestration layer: it parses arguments, invokes Outlook automation, applies safety checks for destructive actions, and emits JSON to stdout.
3. Outlook integration boundary
src/outlookctl/outlook_com.py is the core adapter around Outlook COM objects. This is where the repository crosses from Python into Office automation. It encapsulates access to mail, folders, messages, calendar items, attachments, and sending operations against the user’s local Outlook session.
4. Data model layer
src/outlookctl/models.py defines the structured output objects used by the CLI. The repository is built around JSON responses with stable schemas, so these models form the contract between Outlook COM results and downstream consumers such as scripts, LLM agents, and tests.
5. Safety boundary for write actions
src/outlookctl/safety.py introduces a deliberate gate before sending email or meeting invites. The architecture separates “create draft / prepare item” from “actually send,” with explicit confirmation required for dispatching actions. This keeps the tool usable in agent-assisted workflows while reducing accidental sends.
6. Audit trail
src/outlookctl/audit.py records send-related actions locally. This is a small but important subsystem because it creates a trace of sensitive operations without relying on external logging infrastructure. It supports the repo’s security posture: local, inspectable, and tied to the user workstation.
7. User-facing skill integration
The skills/outlook-automation/ tree packages the repository as a Claude Code skill, with reference docs for CLI usage, JSON schema, security, and troubleshooting. tools/install_skill.py installs that skill into Claude Code or Codex locations, making the repository usable both as a standalone CLI and as an AI-agent tool surface.
8. Documentation as part of the architecture
The docs/ directory mirrors the public reference material and explains the same contracts exposed by the CLI and skill. This documentation is operationally important because the system’s behavior depends on Outlook version, COM availability, confirmation semantics, and output schema.
9. Testing boundaries
The tests/ suite focuses on the stable, non-UI parts of the system: models, safety logic, CLI helper behavior, and calendar-related model handling. That suggests the repo’s test strategy is centered on deterministic logic rather than live Outlook automation, which is appropriate given the dependency on a local desktop app.
10. Evaluation assets
The evals/ directory contains scenario prompts for drafting replies, refusing sends, and summarizing. These are not runtime code, but they show the intended agent workflow boundary: the tool is meant to be driven by an assistant that can read, draft, and decide while the repo enforces the final send gate.
11. Dependency and platform constraints
The repo is pinned to Python 3.12+, uses uv for environment management, and depends on Windows COM/pywin32 behavior through Outlook Classic. Those constraints are architectural, not incidental: the entire system assumes local desktop access, same-session Outlook availability, and no Microsoft Graph/OAuth dependency.
12. Information flow to diagram
A useful architecture diagram would show: user or agent invokes the CLI; CLI routes to command handlers; handlers call COM adapter methods; COM returns Outlook entities; entities are mapped into JSON models; unsafe write paths pass through confirmation and audit logging; documentation and skills consume the same CLI/schema contract from the outside.
Main entry points: cli.py CLI · SKILL.md Skill spec · safety.py Safety · models.py Models
Components 20
Source
Core runtime modules for the CLI and Outlook automation adapter.
- CLI · Parses subcommands, orchestrates workflows, and emits JSON output.
src/outlookctl/cli.py - Outlook COM · Wraps Outlook desktop COM objects for mail, calendar, folders, attachments, and send operations.
src/outlookctl/outlook_com.py - Models · Structured response models and stable output contracts.
src/outlookctl/models.py - Safety · Confirmation and policy checks before destructive or dispatching actions.
src/outlookctl/safety.py - Audit · Local trace of send-related actions and sensitive operations.
src/outlookctl/audit.py
Docs
User-facing reference material for the CLI, JSON schema, and safety behavior.
- CLI docs · Rendered documentation for command usage and behavior.
docs/cli.html - Schema docs · Rendered documentation for the JSON response schema.
docs/json-schema.html - Security docs · Rendered documentation for confirmation and safety rules.
docs/security.html
Skill
Claude Code skill packaging and its reference docs.
- Skill spec · Claude Code skill packaging the repository for agent use.
skills/outlook-automation/SKILL.md - Skill CLI · Skill reference for CLI usage.
skills/outlook-automation/reference/cli.md - Skill schema · Skill reference for JSON output schema.
skills/outlook-automation/reference/json-schema.md - Skill security · Skill reference for confirmation and safety behavior.
skills/outlook-automation/reference/security.md
Tests
Deterministic tests for models, safety, and CLI helpers.
- Model tests · Validates structured models and schema behavior.
tests/test_models.py - Safety tests · Exercises confirmation and refusal logic.
tests/test_safety.py - CLI tests · Checks CLI helper behavior and command orchestration.
tests/test_cli_helpers.py - Calendar tests · Covers calendar model handling and related data shapes.
tests/test_calendar_models.py
Evals
Scenario prompts used to exercise assistant workflows.
- Scenarios · Assistant scenarios for drafting, refusal, and summarization workflows.
evals/README.md
Tools
Utility scripts for packaging and installation.
- Install skill · Installs the skill into Claude Code or Codex locations.
tools/install_skill.py
Other components
- Python env · Defines the Python 3.12+ project and dependency/runtime constraints.
pyproject.toml - README · Top-level overview of installation, usage, and constraints.
README.md
Connections 23
- CLI → Outlook COM: reads/writes Outlook · Command handlers call into the COM adapter to interact with local Outlook.
- CLI → Models: returns JSON · CLI transforms Outlook results into stable structured outputs.
- CLI → Safety: gates send · Dispatching actions pass through confirmation and refusal checks.
- CLI → Audit: records actions · Sensitive send-related operations are recorded locally.
- Outlook COM → Models: maps entities · COM objects are converted into structured response models.
- Safety → Audit: triggers trace · Confirmed send paths are logged for auditability.
- README → CLI: documents usage · Project overview describes the command surface and workflows.
- README → Safety: documents policy · Explains confirmation semantics and destructive-action handling.
- CLI docs → CLI: reference · Rendered docs mirror the public CLI behavior.
- Schema docs → Models: reference · Rendered docs mirror the output schema contract.
- Security docs → Safety: reference · Rendered docs explain confirmation and safety rules.
- Skill spec → CLI: packages · The skill exposes the CLI as an agent tool surface.
- Skill spec → Skill CLI: includes · Skill spec includes the CLI reference material.
- Skill spec → Skill schema: includes · Skill spec includes the JSON schema reference.
- Skill spec → Skill security: includes · Skill spec includes the security reference.
- Install skill → Skill spec: installs · Installer copies the skill package into assistant tool locations.
- Model tests → Models: verifies · Tests the stability of structured model output.
- Safety tests → Safety: verifies · Tests refusal and confirmation behavior.
- CLI tests → CLI: verifies · Tests helper behavior around command orchestration.
- Calendar tests → Models: verifies · Tests calendar-related model handling.
- Scenarios → CLI: drives · Scenario prompts are designed to exercise CLI-mediated assistant workflows.
- Python env → CLI: configures runtime · Project metadata pins Python and package dependencies.
- Python env → Outlook COM: platform deps · Declares the Windows/COM-oriented dependency environment.