How vishalbasker/gmail-triage-agent works
This repository implements a Gmail draft-response workflow with three orchestration modes: a fixed fetch/triage workflow, instruction-driven thread matching and drafting, and personal calendar blocking. In live use, a Claude Code session mediates Gmail and Calendar MCP operations; Python clients receive data or queue proposed writes rather than making those calls themselves. The graph preserves independent meeting analysis, conflict checks, and the guarded hold-creation path. Some orchestrator and Calendar-agent source was excerpted only partially, so only documented or directly shown wiring is included.
Main entry points: orchestrator.py Mode orchestrator · logger.py Decision logger · llm_client.py LLM client · draft_agent.py Draft replies
Components 18
Workflow orchestration
- Mode orchestrator
orchestrator.py
Judgment agents
- Fetch and normalize
agents/fetch_agent.py - Reply triage
agents/triage_agent.py - Thread matching
agents/thread_match_agent.py - Draft replies
agents/draft_agent.py - Meeting proposals
agents/calendar_agent.py - Block scheduling
agents/scheduler_agent.py
Skills and clients
- LLM client
skills/llm_client.py - Gmail client
skills/gmail_client.py - Calendar client
skills/calendar_client.py - Decision logger
skills/logger.py - Run logs
logs
External systems
- Gmail MCP
- Calendar MCP
- Claude API
Other components
- User
- Claude Code session
- Manual review
Connections 36
- User → Mode orchestrator: supplies request
- Mode orchestrator → Fetch and normalize: runs fetch
- Fetch and normalize → Gmail client: lists messages
- Mode orchestrator → Reply triage: runs fixed triage
- Mode orchestrator → Meeting proposals: runs meeting analysis
- Mode orchestrator → Draft replies: runs reply drafting
- Mode orchestrator → Thread matching: runs instruction match
- Mode orchestrator → Block scheduling: runs block analysis
- Mode orchestrator → Calendar client: creates hold
- Reply triage → LLM client: requests judgment
- Thread matching → LLM client: requests match
- Draft replies → LLM client: requests reply text
- Meeting proposals → LLM client: requests meeting judgment
- Block scheduling → LLM client: requests block extraction
- Draft replies → Gmail client: creates draft
- Draft replies → Gmail client: checks existing draft
- Meeting proposals → Calendar client: checks conflicts
- Block scheduling → Calendar client: checks conflicts
- LLM client → Claude API: calls when live
- Claude Code session → Gmail MCP: calls live tools
- Claude Code session → Calendar MCP: calls live tools
- Claude Code session → Gmail client: feeds messages
- Claude Code session → Calendar client: feeds events
- Gmail client → Claude Code session: provides pending drafts
- Calendar client → Claude Code session: provides pending holds
- Claude Code session → Gmail MCP: creates live drafts
- Claude Code session → Calendar MCP: creates live hold
- Meeting proposals → Manual review: surfaces proposals
- Mode orchestrator → Decision logger: starts run log
- Fetch and normalize → Decision logger: logs decision
- Reply triage → Decision logger: logs decision
- Thread matching → Decision logger: logs match
- Draft replies → Decision logger: logs draft
- Meeting proposals → Decision logger: logs proposal
- Block scheduling → Decision logger: logs decision
- Decision logger → Run logs: writes JSONL