- Add GitHubPRTrigger and GitHubPRCondition models for PR review triggers
- Add GitHubReviewAction model for launching Claude Code with review context
- Create pai_mcp/github.py MCP server with 5 tools (list_my_prs,
list_prs_with_reviews, get_pr_reviews, get_pr_diff, format_review_for_claude)
- Add GitHubPRWatcher to poll for new PR reviews on authored PRs
- Implement _execute_github_review in executor to prepare Claude Code context
- Add 'pai watch github' CLI command
- Update db.py to support multiple watcher types
- Add GitHub action mappings to MCP routing
- Add 48 new tests covering all GitHub functionality
Add project structure overview, all CLI commands, architecture flow
diagram, configuration paths, singleton patterns, and updated file
responsibility descriptions reflecting current state of the codebase.
https://claude.ai/code/session_01WTMF8bnNzxAZ2mTev53V8M
Co-authored-by: Claude <noreply@anthropic.com>
Consolidate related commands into subgroups for better discoverability:
- setup: init, config, connect (status as default)
- query: emails, entities
- list: add --activate/--pause/--delete/--history flags
Also fix undefined run_async() calls by using @async_command decorator.
- Add EmailClassifyAction model for classifying emails via LLM
- Add _execute_classify() to executor with full workflow:
fetch email → build prompt → call LLM → apply label
- Add email.classify to intent engine action types
- Add --local flag to run command for using local LLM
- Add --email flag to run command for testing with specific emails
- Add partial ID matching in db.get_automation() for truncated IDs
- Fix trigger parsing to handle varied LLM output formats
- Add pai mcp list: show configured servers and tools
- Add pai mcp call: invoke MCP tools directly from CLI
- Update watcher to use MCP for email polling instead of legacy client
- Add WatcherEmail model for MCP/legacy compatibility
- Update tests for MCP-based watcher
- Add TriggerMatcher for matching emails against trigger conditions
- Supports operators: equals, contains, matches (regex), semantic
- Multiple conditions use AND logic
- Case-insensitive matching
- Add EmailWatcher for polling Gmail and triggering automations
- Polls inbox for new emails since last check
- Matches against active automations with email triggers
- Executes with ${trigger.email.*} variables resolved
- Persists state to avoid reprocessing on restart
- Add watcher_state table to database for persistence
- Add 'pai watch' CLI command with --interval and --once options
- Add 26 tests for watcher functionality
- New executor.py with action executors and ExecutionEngine
- EmailActionExecutor handles label/archive actions with auto-create labels
- Dry-run mode shows what would happen without executing
- Variable resolution for ${trigger.*} templates
CLI commands:
- pai run <id> [--dry-run] - Execute automation
- pai activate <id> - Set status to active
- pai pause <id> - Set status to paused
- pai delete <id> [--force] - Delete automation
- pai history - View execution history
Other fixes:
- Configurable timeout for local LLM (default 300s)
- Fixed action param extraction in intent planning
- Fixed database connections not closing (hanging CLI)
- Auto-create Gmail labels if they don't exist