22 Commits
Author SHA1 Message Date
mhattingpete 3268a360fe Add badges to README and keywords to pyproject.toml
Add Python version, license, and last-commit badges for visibility.
Add keywords for PyPI discoverability.
2026-03-06 11:13:50 +01:00
mhattingpete aff0cb0a76 Update CLAUDE.md with GitHub MCP server and sandbox exceptions
- Add sandbox exceptions section (git commands, uv run)
- Add github.py to MCP servers table
- Update watcher.py description to include GitHubPRWatcher
- Add 'pai watch github' to commands list
2026-02-01 21:04:54 +01:00
mhattingpete cdab6312cb Add GitHub PR review automation with Claude Code integration
- 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
2026-02-01 21:04:05 +01:00
mhattingpete af7923f7a8 Merge origin/main 2026-01-30 09:31:05 +01:00
mhattingpeteandClaude 7b024d90df Add bash automation feature implementation plan (#2)
Design for LLM-generated sandboxed bash scripts with:
- Strong sandbox (bubblewrap/firejail) with capability enforcement
- First-run approval flow with hash verification
- Shell-escaped variable injection
- MCP server architecture (pai_mcp/bash.py)
- Full intent engine integration

https://claude.ai/code/session_015Rf1X4gKkW26be9osbGPiu

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-28 22:04:12 +01:00
mhattingpeteandClaude 46770830de Update CLAUDE.md with comprehensive codebase documentation (#1)
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>
2026-01-28 22:02:38 +01:00
mhattingpete aee94f5347 Simplify CLI structure from 15 to 7 commands
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.
2026-01-25 20:52:43 +01:00
mhattingpete 7cc6604404 Add LLM-based email classification action
- 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
2026-01-24 14:41:47 +01:00
mhattingpete 7f6ae3267b Add Outlook connector to ROADMAP completed 2026-01-23 12:58:17 +01:00
mhattingpete 2977ba4cd8 Add Outlook MCP server integration 2026-01-22 15:34:28 +01:00
mhattingpete 1910cb4c17 Update ROADMAP with MCP architecture 2026-01-22 15:24:33 +01:00
mhattingpete 635fd8ada8 Flatten MCP structure: gmail/server.py -> gmail.py 2026-01-22 10:51:04 +01:00
mhattingpete 7f0949f048 Update README with MCP commands and configuration
- Add pai mcp list/call command documentation
- Add mcp.json to config directory structure
- Add mcp.json configuration example
2026-01-22 10:48:20 +01:00
mhattingpete efdce6935b Add MCP CLI commands and update watcher to use MCP
- 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
2026-01-22 10:47:06 +01:00
mhattingpete f74b07ef18 Update CLAUDE.md for MCP architecture
- Add Connectors pattern: use MCP servers, not direct API calls
- Add executor.py and mcp.py to file responsibilities
- Add MCP Servers section documenting pai_mcp/ structure
- Update folder nesting rule for pai_mcp/
- Add don't: no legacy/fallback code paths
2026-01-22 10:39:50 +01:00
mhattingpete 1bca31e29c Add MCP client manager and reorganize Gmail MCP server
- Add pai_mcp/ directory for MCP servers (flat structure)
- Add src/pai/mcp.py: MCP client manager with tool routing
- Move Gmail MCP server from src/pai/gmail_mcp.py to pai_mcp/gmail/
- Remove legacy EmailActionExecutor, now MCP-only execution
- Update tests to mock MCP manager for isolation
2026-01-22 10:38:59 +01:00
mhattingpete b9714e3add Add project roadmap 2026-01-21 21:33:29 +01:00
mhattingpete 88ae37dfda Add automatic trigger system (Phase 5): email watcher with polling
- 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
2026-01-21 12:17:49 +01:00
mhattingpete c6b902f8b1 Add Execution Engine (Phase 4): run, activate, pause, history, delete
- 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
2026-01-21 12:09:49 +01:00
mhattingpete 371cb2b3ab Add Gmail connector (Phase 3): OAuth, search, entity extraction
- Gmail client with OAuth flow and token storage
- Email search with Gmail query syntax
- Entity extraction (clients, people) from email domains
- CLI commands: connect, emails, entities
- Added Google API dependencies
- README with usage documentation
- 11 new tests for Gmail module
2026-01-21 11:19:11 +01:00
mhattingpete 47f4e63680 Add Intent Engine (Phase 2): parse → clarify → plan pipeline
- Create intent.py with IntentEngine class implementing three stages:
  - Parse: NL → IntentGraph with confidence scores and ambiguity detection
  - Clarify: Generate targeted questions, apply answers
  - Plan: IntentGraph → executable Automation spec

- Wire intent command to CLI with --local, --plan, --save flags

- Improve LlamaCppProvider reliability for local models:
  - Two-call strategy: generate NL first, then convert to JSON
  - Flexible option parsing (strings or {label,value} objects)
  - Invalid enum fallback for error handlers

- Add 7 tests covering full pipeline with mock provider
2026-01-21 11:00:15 +01:00
mhattingpete 6f2958ede5 Initial commit: PAI Phase 1 foundation
- Flat project structure with uv package management
- Pydantic models for Automation, Entity, Execution, Intent
- Async SQLite database wrapper with full schema
- LLM provider abstraction (Claude + llama.cpp)
- Typer CLI with init/config/status/list/intent commands
- Pydantic Settings for type-safe configuration
2026-01-21 10:22:06 +01:00