Chronos AI — Intelligent Calendar Planner
A production-grade, AI-augmented calendar and productivity planning system. Features an LLM-powered natural language task scheduler via LangChain & Google Gemini, chronotype-aware energy-level scheduling, smart multi-session task splitting, drag-and-drop focus block management, automated conflict detection and incremental re-planning, RFC 5545 iCalendar export, Slack & Discord status auto-sync, Productivity Analytics with burnout risk detection, Google Calendar OAuth integration, and a comprehensive weekly planner grid with buffer time visualization, multi-calendar channel filtering, and per-block detail modals.
Features
Core Functionality
- AI Schedule Generation: Users describe their week in plain English and the AI automatically generates an optimized focus block schedule, respecting work hours, deadlines, task priorities, and energy profiles
- Task Backlog Management: Full CRUD task management with priority levels (P1–P5), categories (Work, Study, Personal, Health), duration estimates, deadlines, constraints, and status tracking (pending → scheduled → done)
- Weekly Planner Grid: 7-day, hour-by-hour focus block calendar grid with real-time current-time indicator, drag-and-drop rescheduling, block resizing, and click-to-detail modals
- Google Calendar Integration: One-click sync of AI-generated focus blocks directly to Google Calendar as native calendar events via OAuth2
- User Authentication: Secure session-based authentication with NextAuth.js, supporting Google OAuth and demo credentials
Advanced AI Features
- Natural Language Task Parser: Type tasks conversationally (e.g. “Review client proposal 2 hours by Friday, high priority”) and the LangChain + Gemini pipeline automatically extracts task title, duration, deadline, priority, and category — no manual form filling required
- Smart Multi-Session Task Splitting: If a task requires more time than the configured maximum focus block length, the AI automatically chunks it into multiple sessions spread across different days before the deadline, preventing focus fatigue
- Chronotype & Energy-Level Scheduling: Users select an energy profile (Morning Person, Afternoon/Evening, Night Owl, or Flexible). The AI schedules high-priority (P1/P2) deep-work tasks during peak energy windows and lighter tasks (P3–P5) during energy slumps — personalized to each user’s natural rhythm
- Automatic Conflict Re-planning: Continuously polls for calendar conflicts. When a last-minute Google Calendar meeting overlaps with an existing AI focus block, the system automatically triggers an incremental re-schedule — touching only the conflicting blocks, leaving fixed events and completed sessions untouched
- LangChain Scheduling Chain: A multi-step LangChain pipeline (System Prompt → Task Extraction → Planner → Validator → JSON Schema enforcement) transforms free-text goals and backlog tasks into structured, time-bounded schedule blocks
- AI Scheduling Validator: Output from the LLM planner is automatically validated against a Zod schema before being committed — ensuring no malformed blocks are ever surfaced to the user
Interactive Calendar & Drag-and-Drop UX
- Drag-and-Drop Focus Blocks: Users can drag focus blocks between time slots and days directly on the weekly grid. The drop target highlights in real time as blocks are moved
- Block Resize (Duration Adjust): Drag the bottom edge of any focus block to increase or decrease its duration directly on the calendar — without opening a form
- Block Detail Modal: Clicking any focus block opens a rich detail modal showing task title, category, time range, duration, scheduling reasoning from the AI, and a mark-as-done action
- Multi-Calendar Channel Toggles: Filter the calendar view between Work, Study, Personal, Health, and External Calendar channels with distinct color overlays. Any combination of channels can be toggled independently
- Buffer & Commute Time Visualizer: Translucent buffer blocks are automatically rendered between back-to-back focus sessions to visualize breathing room and prevent back-to-back scheduling overload
- Global Search Modal: Keyboard-shortcut-accessible (⌘K / Ctrl+K) search across tasks, categories, and schedule blocks
Productivity Analytics & Burnout Protection
- AI Productivity & Focus Analytics Page: Visual dashboard with total planned focus hours, task completion rate (circular gauge), category time breakdown (Work, Study, Personal, Health), and a 7-day daily workload bar chart
- Burnout Risk Engine: Analyzes each day’s combined focus blocks and calendar meetings. Triggers color-coded risk alerts (🔴 High / ⚠️ Moderate / ✅ Clear) when daily workload exceeds 8 hours or lacks adequate rest breaks, with AI-generated re-balancing recommendations
- Per-Day Workload Breakdown Table: Expandable table showing exact focus hours, meeting hours, total workload, and risk badge per weekday — with contextual alerts explaining why a day was flagged
Integrations & Automation
- Slack Status Auto-Sync: Paste an Incoming Webhook URL under Preferences to automatically push rich Slack status updates (
⛔ In AI Focus Session: "Task Title") with emoji, task title, category, and a branded footer — triggered at focus block start
- Discord Status Auto-Sync: Same one-click webhook integration for Discord servers, dispatching embedded status cards with a color-coded indigo accent, task title, category field, and Chronos AI branding
- Interactive Webhook Testing: Both Slack and Discord webhooks include in-UI
Test Slack / Test Discord buttons that fire a live sample message so users can verify delivery before trusting it for real sessions
- iCal Subscription Feed: A live RFC 5545
.ics subscription URL (/api/calendar/ical) compatible with Apple Calendar, Outlook, Google Calendar, and any mobile calendar client — no Google OAuth required
- Export .ics File: One-click instant download of the current week’s AI schedule as a valid
.ics file from both the Weekly Planner header and the Preferences page
Scheduling Settings & Preferences
- Chronotype Persona Cards: Choose from 4 energy profiles (Morning Person, Afternoon/Evening, Night Owl, Flexible) via interactive persona cards — with automatic peak window pre-fill and manual override controls
- Configurable Work Hours: Set daily work start/end times with 30-minute precision using searchable dropdowns
- Days Off Management: Toggle individual days of the week off via a visual pill grid — no tasks will be scheduled on selected rest days
- Buffer Time Control: Choose inter-block buffer periods (0 / 10 / 15 / 30 minutes) to prevent back-to-back scheduling overload
- Max Focus Block Length: Configure the session length cap (60 / 90 / 120 / 180 minutes) that triggers automatic multi-session task splitting for longer tasks
- Active Profile Summary: A live “Active AI Scheduling Profile” preview chip row reflects every setting change in real time before saving
Tech Stack
Framework & Runtime
- Next.js 14 (App Router, Server Components, Route Handlers) for full-stack rendering
- TypeScript 5 for end-to-end type safety
- React 18 for component rendering with client-side interactivity
AI & LLM Pipeline
- LangChain (
@langchain/core, @langchain/google-genai, @langchain/openai, @langchain/anthropic) for multi-step AI orchestration
- Google Gemini (via LangChain) as the primary LLM for schedule generation and natural language parsing
- Zod for AI output schema validation and structured JSON enforcement
Database & ORM
- PostgreSQL as the primary relational database
- Prisma ORM 5 for type-safe schema management, migrations, and query building
Authentication
- NextAuth.js 4 with Google OAuth provider and demo credentials adapter
Calendar & Scheduling
- Google Calendar API (via
googleapis) for event creation and OAuth2 token management
- date-fns 3 for all date arithmetic, parsing, and formatting
- RFC 5545 iCalendar Generator (custom
lib/ical/icalGenerator.ts) for .ics subscription feeds
Integrations
- Slack Incoming Webhooks for automated status sync
- Discord Incoming Webhooks for automated status sync
UI & Design
- Tailwind CSS v3 for utility-first styling with a custom dark design system
- Lucide React for consistent iconography
- canvas-confetti for celebratory micro-animations on schedule generation
System Architecture
graph TD
subgraph Client ["Next.js App Router (Client)"]
UI["Page Components (Dashboard, Tasks, Calendar, Analytics, Preferences)"]
Grid["WeekCalendarGrid — Drag/Drop, Resize, Channels, Buffers"]
NLBar["NaturalLanguageTaskBar — Task Parser UI"]
Modal["BlockDetailModal — Focus Block Details"]
PrefForm["PreferencesForm — Chronotype, Webhooks, iCal"]
end
subgraph API ["Next.js Route Handlers (Server)"]
ScheduleGen["/api/schedule/generate — AI Schedule Pipeline"]
ConflictCheck["/api/schedule/conflict-check — Polling Detector"]
Replan["/api/schedule/replan — Incremental Replanning"]
TasksAPI["/api/tasks — CRUD Backlog"]
PrefAPI["/api/preferences — User Profile & Integrations"]
AnalyticsAPI["/api/analytics — Focus & Burnout Data"]
ICalAPI["/api/calendar/ical — RFC 5545 Feed"]
SyncAPI["/api/integrations/status-sync — Slack/Discord Webhooks"]
GoogleCalAPI["/api/calendar/* — Google OAuth & Event Sync"]
end
subgraph AI ["AI & LangChain Pipeline"]
Chain["schedulingChain.ts — Multi-step LangChain pipeline"]
Planner["mockPlanner.ts — Chronotype & session-split logic"]
Parser["taskParser.ts — NL → structured task extraction"]
Validator["validator.ts — Zod schema output guard"]
Prompts["prompts.ts — System & user prompt templates"]
end
subgraph Storage ["Data & External"]
DB[(PostgreSQL via Prisma)]
GoogleCal[Google Calendar API]
SlackWebhook[Slack Webhook]
DiscordWebhook[Discord Webhook]
end
UI --> Grid
UI --> NLBar
Grid --> Modal
UI --> PrefForm
NLBar --> Parser
UI --> ScheduleGen
ScheduleGen --> Chain
Chain --> Planner
Chain --> Validator
ConflictCheck --> GoogleCal
Replan --> Chain
SyncAPI --> SlackWebhook
SyncAPI --> DiscordWebhook
GoogleCalAPI --> GoogleCal
ScheduleGen --> DB
TasksAPI --> DB
PrefAPI --> DB
AnalyticsAPI --> DB
AI Scheduling Pipeline
graph LR
subgraph Input
Tasks["Task Backlog (Prisma DB)"]
Prefs["User Preferences (Chronotype, Hours, Buffer)"]
NL["Natural Language Input (optional)"]
end
subgraph Pipeline ["LangChain Scheduling Chain"]
Parse["1. taskParser — NL → structured task"]
Prompt["2. prompts.ts — inject system context"]
LLM["3. Google Gemini — generate schedule blocks"]
Valid["4. validator.ts — Zod schema check"]
Split["5. mockPlanner — multi-session splitter"]
Energy["6. Peak window mapper — chronotype filter"]
end
subgraph Output
Blocks["Proposed Schedule Blocks (JSON)"]
Grid2["WeekCalendarGrid render"]
GCal["Google Calendar sync"]
ICal[".ics Export / Subscription Feed"]
end
Tasks --> Prompt
Prefs --> Prompt
NL --> Parse --> Prompt
Prompt --> LLM --> Valid --> Split --> Energy --> Blocks
Blocks --> Grid2
Blocks --> GCal
Blocks --> ICal
Project Structure
ai-calendar-planner/
├── app/ # Next.js App Router
│ ├── page.tsx # Main Dashboard — schedule generator, conflict alerts
│ ├── layout.tsx # Root layout with NextAuth session provider
│ ├── globals.css # Design system tokens, animations, utility classes
│ ├── analytics/
│ │ └── page.tsx # Productivity & Burnout Analytics dashboard
│ ├── calendar/
│ │ └── page.tsx # Weekly Planner page — full calendar view
│ ├── tasks/
│ │ └── page.tsx # Task backlog management (CRUD)
│ ├── preferences/
│ │ └── page.tsx # Chronotype, webhook, and scheduling preferences
│ ├── auth/
│ │ └── signin/page.tsx # Auth landing page
│ └── api/
│ ├── schedule/
│ │ ├── generate/route.ts # POST — run LangChain AI scheduling pipeline
│ │ ├── conflict-check/ # GET — detect Google Calendar conflicts
│ │ └── replan/route.ts # POST — incremental conflict re-planning
│ ├── tasks/route.ts # GET/POST/PATCH/DELETE — task backlog CRUD
│ ├── preferences/route.ts # GET/POST — user preference profile
│ ├── analytics/route.ts # GET — aggregated focus + burnout analytics
│ ├── calendar/
│ │ ├── ical/route.ts # GET — RFC 5545 .ics subscription feed
│ │ └── sync/route.ts # POST — push blocks to Google Calendar
│ └── integrations/
│ └── status-sync/route.ts # POST — dispatch Slack/Discord webhooks
│
├── components/
│ ├── WeekCalendarGrid.tsx # 7-day focus block grid with drag/drop + resize
│ ├── BlockDetailModal.tsx # Click-to-open focus block detail modal
│ ├── NaturalLanguageTaskBar.tsx # NL task input bar with Gemini AI parsing
│ ├── PreferencesForm.tsx # Chronotype, webhook, and iCal settings form
│ ├── TaskFormModal.tsx # Task create/edit modal with full field controls
│ ├── TaskList.tsx # Filterable task backlog list component
│ ├── ConflictAlert.tsx # Conflict detection banner with re-plan action
│ ├── ScheduleBanner.tsx # Active schedule summary banner
│ ├── GlobalSearchModal.tsx # ⌘K global search overlay
│ ├── Navbar.tsx # Top navigation with active route highlighting
│ ├── Layout.tsx # Sidebar layout with section header
│ ├── CustomSelectDropdown.tsx # Searchable dropdown component
│ ├── CustomDatePicker.tsx # Range date picker component
│ └── Providers.tsx # NextAuth SessionProvider wrapper
│
├── lib/
│ ├── auth.ts # NextAuth config (Google OAuth + demo credentials)
│ ├── db.ts # Prisma client singleton
│ ├── langchain/
│ │ ├── schedulingChain.ts # LangChain multi-step scheduling pipeline
│ │ ├── mockPlanner.ts # Chronotype + session-splitting planning logic
│ │ ├── taskParser.ts # NL → structured task extraction
│ │ ├── validator.ts # Zod schema validation for AI output
│ │ ├── prompts.ts # System & user prompt templates
│ │ └── types.ts # Shared DTOs for schedule blocks & tasks
│ ├── analytics/
│ │ └── burnoutDetector.ts # Per-day workload analysis & burnout risk engine
│ ├── ical/
│ │ └── icalGenerator.ts # RFC 5545 iCalendar feed generator
│ ├── integrations/
│ │ └── statusSync.ts # Slack & Discord Webhook client functions
│ └── google/
│ └── calendarClient.ts # Google Calendar API OAuth2 integration
│
└── prisma/
└── schema.prisma # Database schema (User, Task, Schedule, Preference)
API Reference
| Method |
Endpoint |
Description |
GET |
/api/tasks |
Retrieve all tasks in the user’s backlog |
POST |
/api/tasks |
Create a new task |
PATCH |
/api/tasks/:id |
Update task fields or status |
DELETE |
/api/tasks/:id |
Delete a task from the backlog |
POST |
/api/schedule/generate |
Run full LangChain AI scheduling pipeline |
GET |
/api/schedule/conflict-check |
Poll Google Calendar for scheduling conflicts |
POST |
/api/schedule/replan |
Trigger incremental conflict re-planning |
GET |
/api/preferences |
Fetch user preferences (chronotype, hours, webhooks) |
POST |
/api/preferences |
Save user preference profile |
GET |
/api/analytics |
Fetch focus hours, completion rate, and burnout analysis |
GET |
/api/calendar/ical |
Serve RFC 5545 .ics calendar subscription feed |
POST |
/api/calendar/sync |
Sync AI schedule blocks to Google Calendar |
POST |
/api/integrations/status-sync |
Dispatch Slack / Discord focus status webhook |
Database Schema
model User {
id String @id @default(cuid())
email String @unique
googleAccessToken String?
googleRefreshToken String?
preferences Preference?
tasks Task[]
schedules Schedule[]
}
model Preference {
userId String @unique
workStart String // "09:00"
workEnd String // "18:00"
daysOff String // "Saturday,Sunday"
bufferMinutes Int // 0, 10, 15, 30
maxFocusBlockMin Int // 60, 90, 120, 180
chronotype String // morning, evening, night, flexible
peakStart String // "09:00"
peakEnd String // "12:00"
slackWebhookUrl String?
discordWebhookUrl String?
autoSyncStatus Boolean
}
model Task {
id String @id @default(cuid())
title String
durationMin Int
deadline DateTime?
priority Int // 1 (highest) – 5 (lowest)
category String // Work, Personal, Study, Health
constraints String?
status String // pending, scheduled, done
}
model Schedule {
id String @id @default(cuid())
weekOf DateTime
blocksJson String // JSON array of focus blocks
}
Getting Started
Prerequisites
- Node.js 18+
- PostgreSQL database
- Google Cloud project with Calendar API enabled (for OAuth & Calendar sync)
Installation
git clone https://github.com/Giancyril/Tempo.git
cd Tempo
npm install
Environment Variables
Create a .env file in the project root:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/aicalendar"
# NextAuth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
# Google OAuth & Calendar API
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# AI Provider (choose one or more)
GOOGLE_GENERATIVE_AI_API_KEY="your-gemini-api-key"
OPENAI_API_KEY="your-openai-api-key" # optional
ANTHROPIC_API_KEY="your-anthropic-api-key" # optional
Database Setup
# Push schema to database
npm run db:push
# (Optional) Open Prisma Studio
npm run db:studio
Development Server
npm run dev
Open http://localhost:3000 in your browser.
Production Build
npm run build
npm start
Feature Walkthrough
1. Generating an AI Schedule
- Navigate to the Dashboard
- Describe your week in the text area (e.g. “Finish API integration 3 hours by Thursday, prepare slides 1 hour by Wednesday”)
- Click Generate AI Schedule — the LangChain pipeline classifies each task, applies your chronotype energy window, performs multi-session splitting if needed, and returns time-bounded focus blocks
- The Weekly Planner grid populates with color-coded, draggable focus blocks
2. Natural Language Task Entry
- Use the NL Task Bar at the top of the Tasks page
- Type naturally: “Design mockups 4 hours this Friday P2 Work”
- The Gemini-powered parser extracts
title, durationMin, deadline, priority, and category automatically
- The task is added to your backlog, ready for scheduling
3. Drag-and-Drop & Resize
- Drag any focus block to a new day or time slot on the Weekly Planner grid
- Drag the bottom edge of a block to extend or shorten its duration
- Click any block to open the detail modal with AI reasoning and a mark-as-done action
4. Conflict Detection & Auto-Replan
- After generating a schedule, the system polls Google Calendar every few minutes
- If a meeting is added that overlaps a focus block, a conflict alert banner appears
- Click Auto Replan to trigger an incremental reschedule — only the conflicting session is moved
5. Analytics & Burnout Monitoring
- Navigate to Analytics via the top navigation bar
- View your weekly completion rate, total focus hours, category breakdown, and daily workload distribution
- Days exceeding 8 hours of combined focus + meetings are highlighted with 🔴 High Risk alerts and tailored re-balancing recommendations
6. Slack / Discord Status Sync
- Go to Preferences → Slack & Discord Status Auto-Sync
- Paste your Incoming Webhook URL
- Click Test Slack or Test Discord to verify delivery with a live sample message
- Save Preferences — the system will dispatch a status update whenever a focus block begins
7. iCal Subscription
- Go to Preferences → iCal Subscription & Webhook Export
- Copy the Feed URL and paste it into Apple Calendar (File → New Calendar Subscription) or Outlook (Add Calendar → From Web)
- Alternatively, click Download .ics for a one-time file export, or use the Export .ics button in the Weekly Planner header
评论