An advanced calendar application powered by Claude AI and Google OR-Tools CP-SAT solver. Schedule events using natural language and let the system find optimal time slots while respecting your constraints.
- 🤖 Natural Language Scheduling - Chat with Claude AI to schedule events: "Schedule a team meeting tomorrow at 2pm for 30 minutes"
- 🧠 CP-SAT Optimization - Uses Google OR-Tools constraint programming solver for intelligent scheduling
- 📅 Google Calendar Sync - Bidirectional sync with Google Calendar via Composio
- 🔔 Real-time Webhook Sync - Instant updates when Google Calendar changes
- 💾 SQLite Database - Local event persistence with optional cloud sync
- 🎨 Modern UI - React + TypeScript with Radix UI components
- ⚡ Real-time Conflict Detection - Automatically finds free time slots and avoids conflicts
- 🔄 Flexible Task Scheduling - Split tasks into multiple blocks with duration constraints
- Framework: React 18.3 with Vite
- UI Library: Radix UI + Tailwind CSS
- State Management: React Hooks
- API Client: Native Fetch API
- Framework: FastAPI 0.115
- LLM: Anthropic Claude 3.5 Sonnet (via Anthropic SDK)
- Solver: Google OR-Tools CP-SAT 9.10
- Database: SQLAlchemy with SQLite (upgradeable to PostgreSQL)
- Calendar Integration: Google Calendar API
- Node.js 18+ and npm
- Python 3.10+
- Anthropic API Key (for natural language parsing)
- Composio API Key (for Google Calendar sync) - Get one at https://composio.dev
# Install frontend dependencies
npm install
# Install backend dependencies
pip install -r requirements.txtCreate a .env file in the root directory:
cp .env.example .envEdit .env and add your credentials:
# Required: Anthropic API Key
ANTHROPIC_API_KEY=sk-ant-api03-...
# Required for Google Calendar Sync: Composio API Key
COMPOSIO_API_KEY=your_composio_api_key_here
# Database (default SQLite)
DATABASE_URL=sqlite:///./chronos.db
# Optional: Legacy Google Calendar Integration (deprecated)
# GOOGLE_CLIENT_SECRETS_FILE=credentials.jsonCreate .env.local for frontend:
cp .env.frontend.example .env.localEdit if you need to change the API URL:
VITE_API_URL=http://localhost:8000Super simple setup - just 3 steps:
- Sign up for Composio and get your API key (free)
- Add
COMPOSIO_API_KEYto your.envfile - Start the servers and click "Connect Google Calendar" in the left sidebar
That's it! Events will auto-sync bidirectionally. No auth config, no JSON files, no complicated setup.
Quick start: See SIMPLIFIED_SETUP.md Detailed setup: See COMPOSIO_SETUP_UPDATED.md Testing: See TESTING_GUIDE.md
python main.pyThe backend will start on http://localhost:8000
Check health: curl http://localhost:8000/health
npm run devThe frontend will start on http://localhost:3000 (or http://localhost:5173 with newer Vite)
- Open the app and find the AI Assistant panel on the right
- Type a natural language request like:
- "Schedule a meeting with the team tomorrow at 2pm for 30 minutes"
- "I need to study for 2 hours, available Thursday and Friday afternoon"
- "Book dentist appointment next week"
- The system will:
- Parse your request with Claude AI
- Find optimal time slots using CP-SAT solver
- Create events in the database
- Display them in your calendar
The CP-SAT solver respects:
- Work Hours: Default 9am-6pm, Mon-Fri (configurable)
- Buffers: 10-minute gaps between events (configurable)
- Deadlines: Events must be scheduled before deadline
- Availability Windows: Only schedule in specified time ranges
- No Overlaps: Automatically avoids busy times
- Task Splitting: Tasks can be split into multiple blocks
- Get the OAuth URL:
GET http://localhost:8000/composio/auth-url - Open the URL and authorize Google Calendar access
- Check connection:
GET http://localhost:8000/composio/status
The integration provides automatic bidirectional sync:
Local → Google Calendar:
- Events created/updated/deleted in ChronosAI automatically sync to Google Calendar
- No manual action needed!
Google Calendar → Local:
- Manual sync:
POST http://localhost:8000/composio/sync - Or set up webhooks for real-time sync (see COMPOSIO_SETUP.md)
Run the demo:
python examples/composio_sync_example.pyPOST /schedule-and-save- Natural language to scheduled event (end-to-end)POST /parse- Parse natural language to structured formatPOST /schedule_c- Run CP-SAT solver on structured items
GET /events- List all eventsPOST /events- Create eventPATCH /events/{id}- Update eventDELETE /events/{id}- Delete event
GET /calendars- List all calendarsPOST /calendars- Create calendar
GET /composio/auth-url- Get OAuth authorization URLGET /composio/callback- OAuth callback handlerGET /composio/status- Check connection statusPOST /composio/sync- Bidirectional sync (Google ↔ Local)POST /composio/sync-event/{event_id}- Sync specific event to GooglePOST /composio/webhook/{calendar_id}- Setup webhook for real-time syncPOST /composio/webhook-notification- Webhook notification handler
GET /google/auth-url- Get OAuth URLGET /google/callback- OAuth callback handlerGET /google/status- Check connection statusPOST /google/sync- Sync events from Google
ChronosAI/
├── src/ # Frontend React app
│ ├── components/ # React components
│ │ ├── AssistantPanel.tsx # AI chat interface
│ │ ├── WeekView.tsx # Calendar views
│ │ └── ...
│ ├── types/ # TypeScript types
│ ├── utils/ # API client, utilities
│ └── App.tsx # Main app component
├── app/ # Backend Python app
│ ├── api.py # FastAPI endpoints
│ ├── parse_llm.py # Claude AI integration
│ ├── cpsat_solver.py # OR-Tools solver
│ ├── database.py # SQLAlchemy models
│ ├── composio_calendar.py # Composio Google Calendar client
│ ├── sync_service.py # Bidirectional sync service
│ ├── google_calendar.py # Legacy Google API client
│ ├── schemas.py # Pydantic models
│ └── policy.py # Scheduling policies
├── examples/ # Example scripts
│ └── composio_sync_example.py # Composio sync demo
├── main.py # Backend entry point
├── requirements.txt # Python dependencies
├── package.json # Node dependencies
├── COMPOSIO_SETUP.md # Composio setup guide
└── vite.config.ts # Vite configuration
# Backend tests
python -m pytest app/test_*.py
# Or run individual test files
python app/test_http.py
python app/test_inproc.py# Build frontend
npm run build
# Serve with production backend
uvicorn app.api:app --host 0.0.0.0 --port 8000The system implements a CP-SAT first architecture as detailed in the design doc:
- LLM Parsing - Claude converts natural language to structured scheduling contracts
- Constraint Modeling - CP-SAT models events as interval variables with constraints
- Optimization - Minimizes lateness, fragmentation, and context switching
- Conflict Resolution - Automatic minimal relaxation when infeasible
- Persistence - Save to SQLite + optionally sync to Google Calendar
See design doc for full details on the scheduling algorithm.
These are normal - the Python environment needs to be activated. Run:
source venv/bin/activate # macOS/Linux
# or
venv\Scripts\activate # WindowsMake sure the backend is running on port 8000 and frontend on port 3000/5173. CORS is configured for these origins.
The system will fall back to regex parsing if no API key is set. For full natural language understanding, add your Anthropic API key to .env.
Using Composio (recommended):
- Check
COMPOSIO_API_KEYis set in.env - Verify connection:
GET http://localhost:8000/composio/status - Re-authorize if needed:
GET http://localhost:8000/composio/auth-url - Check logs for detailed error messages
- See COMPOSIO_SETUP.md for detailed troubleshooting
Using legacy integration:
- Verify
credentials.jsonexists and is valid - Check OAuth redirect URI matches:
http://localhost:8000/google/callback - Ensure Google Calendar API is enabled in Cloud Console
MIT
- Frontend design inspired by Figma template: Desktop Scheduling App
- Powered by Anthropic Claude
- Optimization by Google OR-Tools