An AI-powered macOS automation agent that can perform computer tasks by analyzing screenshots and executing actions. Built with TypeScript and Claude AI.
- π€ AI-Powered Automation: Uses Claude AI to understand screenshots and decide actions
- π₯οΈ macOS Integration: Native screen capture and system automation
- π― Precise Actions: Click, type, scroll, and navigate with pixel-perfect accuracy
- π Smart Recovery: Detects stuck patterns and applies recovery actions
- π Performance Monitoring: Real-time metrics and optimization
- π Toast Notifications: Visual feedback during operation
- macOS (tested on macOS 14+)
- Node.js 18+
- Anthropic API key
-
Clone the repository
git clone https://github.com/KindredSM/percepta.git cd percepta -
Install dependencies (includes building native components)
npm install
-
Set up environment variables
cp env.example .env # Edit .env and add your ANTHROPIC_API_KEY -
Set up the agent command (optional, for convenience)
# Make the agent script executable chmod +x agent # Add to your PATH (choose one method): # Method 1: Add to shell profile echo 'export PATH="'$(pwd)':$PATH"' >> ~/.zshrc source ~/.zshrc # Method 2: Create symlink (if you have write access) sudo ln -sf "$(pwd)/agent" /usr/local/bin/agent
# Run with a goal
npx tsx src/cli.ts "open calculator"
# Run with custom steps
npx tsx src/cli.ts "take a screenshot" --steps 10
# Using the agent command (after setup)
agent "open safari and go to google.com"# Start the server
npm run dev
# Send a request
curl -X POST http://localhost:3030/agent/start \
-H "Content-Type: application/json" \
-d '{"goal": "open calculator", "steps": 5}'# Open applications
agent "open calculator"
agent "launch safari"
# Web navigation
agent "go to github.com"
agent "search for 'typescript' on google"
# File operations
agent "create a new text file called hello.txt"
agent "take a screenshot"
# Form filling
agent "sign up for a new account on example.com"src/ # TypeScript core
βββ index.ts # HTTP server entry point
βββ cli.ts # Command line interface
βββ config.ts # Configuration management
βββ orchestrator/
β βββ loop.ts # Main agent loop logic
βββ routes/
β βββ agent.ts # HTTP API routes
βββ services/
β βββ actuator.ts # Action execution
β βββ screen.ts # Screen capture
β βββ visionProvider.ts # AI integration
β βββ toast.ts # Notifications
β βββ logger.ts # Logging
β βββ performance.ts # Metrics
βββ types/
βββ action.ts # Type definitions
native/ # Swift UI components
βββ ToastOverlay/ # Toast notification system
βββ MenuBarAgent/ # Menu bar integration
βββ Makefile # Build system
βββ dev.sh # Development scripts
The project uses optimized defaults and requires minimal configuration:
ANTHROPIC_API_KEY: Your Anthropic API key
DEBUG_RESPONSES: Set to1to enable debug logging
For advanced customization, you can modify src/config.ts directly.
# Unified build system (recommended)
make # Build everything (TypeScript + Swift)
make setup # Install dependencies (includes build)
make dev # Start development server
make watch-native # Watch Swift components for changes
make clean # Clean all build artifacts
# npm scripts (alternative)
npm run dev # Start development server
npm run build # Build TypeScript + Swift components
npm run build:native # Build Swift components only
npm run lint # Run ESLint
npm start # Start production server- TypeScript: Modern ES modules with strict typing
- Koa: Lightweight HTTP framework
- Zod: Runtime type validation
- Anthropic SDK: Claude AI integration
- Swift: Native macOS UI components (toast notifications, menu bar)
The project includes Swift components for native macOS integration:
- ToastOverlay: Shows progress notifications during agent operation
- MenuBarAgent: Menu bar integration for quick access
Build automatically included when you run npm install.
The MenuBarAgent provides a menu bar icon for quick access to Percepta. After building:
-
Run the MenuBarAgent:
cd native/MenuBarAgent && ./MenuBarAgent
-
Grant permissions (if prompted):
- Go to System Preferences β Security & Privacy β Privacy β Accessibility
- Add MenuBarAgent and allow it
-
Look for the menu bar icon (usually appears in the top-right menu bar)
Note: If the MenuBarAgent doesn't appear, check:
- macOS Accessibility permissions are granted
- Menu bar has space available
- No other MenuBarAgent processes are running (
ps aux | grep MenuBarAgent)
For development:
make watch-native # Watch Swift components for changes
make test-native # Test Swift componentsSee native/README.md for detailed Swift development instructions.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.
Percepta - From "perception" + "automation", representing the agent's ability to perceive and act on visual information.
- API keys are stored in environment variables
- No sensitive data is logged
- Actions are sandboxed to user permissions
-
"ANTHROPIC_API_KEY not set"
- Ensure your
.envfile contains the API key
- Ensure your
-
Permission errors
- Grant accessibility permissions to Terminal/your IDE
- Enable screen recording permissions
-
Build errors
- Ensure Node.js 18+ is installed
- Run
npm installto install dependencies
Set DEBUG_RESPONSES=1 to see raw AI responses:
DEBUG_RESPONSES=1 agent "your goal here"