AI Shift Planner

Intelligent workforce scheduling for hospitality venues

Project Overview

An end-to-end scheduling system that automates monthly shift planning for restaurants and bars. The platform combines AI-driven optimization with a user-friendly chat interface, allowing staff to submit availability and admins to manage schedules in real time.

Currently live for Lucky's Bar, the system successfully handles ~20 staff members and generates optimized schedules within 15 seconds using Claude AI.

The Problem

Manual scheduling is error-prone and time-consuming. Staff members have conflicting availability, managers need flexibility for special events, and fairness in shift distribution is hard to achieve manually. A better system was needed—one that respects constraints while optimizing for both business needs and staff preferences.

The Solution

A hybrid architecture combining n8n workflows, Claude AI, and Firestore to create an intelligent, self-service scheduling platform:

  • AI Matching Engine: Claude Haiku generates optimized shift assignments in 10–15 seconds, respecting all constraints
  • Chat Interface: Staff submit availability via a chat bot; admins manage everything without touching code
  • Demand Management: System learns staffing needs per day/shift and adapts to special events (Karaoke, Bingo, etc.)
  • Google Sheets Export: Auto-generated, color-coded schedules published monthly for easy sharing
  • Calendar Integration: RFC-5545 ICS feeds allow staff to subscribe to their schedule in Apple Calendar, Google Calendar, or Outlook
  • Admin Overrides: Vacation blocks, forced assignments, and dynamic shift timing all via chat
  • Session Management: PIN-protected admin mode, persistent user sessions in Firestore
  • Availability Matrix: Dashboard showing who has submitted availability and who hasn't (great for follow-ups)

Technology Stack

n8n (Workflows)
Claude Haiku 4.5
Firestore
Google Sheets
Google Drive
Anthropic SDK
REST APIs
JavaScript
Cloudflare Tunnels

Architecture Highlights

26 Active Workflows: Modular design with specialized tools for scheduling, user management, availability handling, and calendar generation.

Demand Generator: Analyzes week-day patterns, applies special event rules (Bearlounge on first Saturday, Karaoke on Tuesdays), and respects admin overrides to calculate daily staffing needs.

Matching Engine (Claude AI): Receives demand, available candidates, and role preferences. Returns fair assignments with transparent reasoning. Runs serially for reliability (no parallel timing issues).

Single-Trigger Architecture: One chat trigger handles both user and admin modes, differentiated by PIN authentication. Keeps the system maintainable and secure.

Atomic Firestore Updates: Uses updateMask for safe partial updates. Bulk operations and deduplication prevent race conditions.

Live Status

Production: Currently scheduling shifts for Lucky's Bar. Monthly plans are generated automatically, staff manage availability through chat, and admins can adjust in real time.

Stability: Zero known bugs. Auto-refresh of matrices, session cleanup every 15 minutes, and robust error handling across all workflows.

Performance: Plan generation: ~10–15 seconds. Chat latency: <2 seconds. Calendar feed: cached, <1 second for repeat requests.

Key Learnings

  • Auth in Code, Not Prompts: PIN and admin checks must live in a Code node with real string comparison—never in the LLM.
  • Templates Need Prefixes: n8n HTTP jsonBody requires `=` prefix for `{{ }}` expressions to evaluate.
  • Firestore Quota Awareness: Rate-limiting can kick in quickly; batch operations and caching are essential.
  • Cross-Origin Chat Widget: Basic Auth on Custom Domain + n8n hosted chat = CORS issues. Solved with 301 redirect to same-origin.
  • Opt-In Availability: Users must explicitly say they're available; passive silence means unavailable. Prevents unintended assignments.

Future Work

Planned: Admin tools to manage user-level default schedules (e.g., "Anna is always blocked on Mondays", "Chris prefers evening shifts"). Would reduce repetitive availability submissions and improve plan fairness.

← Back to Portfolio