PlanPilot — AI Production Scheduling Copilot
LLM copilot layered over Google OR-Tools CP-SAT with 5-stage rule validation, zero-hallucination citations, and DuckDB ERP onboarding.
90.91%
NL Rule Exact Match
100.0% schema valid across 65 gold rules
100% (25/25)
Root-Cause Attribution
0.11 ms p50 backward critical-chain trace
100.0%
Hallucination Rejection
Adversarial altered-number checks blocked
100.0%
ERP Defect Detection F1
30 ERP cases; 120.11 ms p50 DuckDB profiling
The Problem
Factory schedulers rely on mathematical constraint solvers like CP-SAT, yet converting shop-floor operating rules into solver constraints, cleaning messy SAP CSVs, and explaining why an order slipped normally require deep operations-research expertise—and raw LLMs hallucinate numbers.
What I Built
Engineered a full-stack AI copilot around OR-Tools CP-SAT. It parses plain-English rules into validated solver constraints, traces lateness root causes deterministically before LLM narration, profiles ERP extracts in DuckDB, and ranks schedule trade-offs via MAUT.
Technical Architecture
A Streamlit workspace and Typer CLI talk to a FastAPI gateway backed by PostgreSQL 16 and Arq/Redis workers. Natural-language rules pass a 5-stage deterministic gate (schema, fuzzy entity match, semantic bounds, DFS cycle check, trial solve), while schedule explanations require regex verification against solver-extracted atomic facts.
NL Rule → 5-Stage Gate
Pydantic schema, fuzzy entity linking, semantic bounds, DFS cycle check, CP-SAT trial solve.
DuckDB ERP Onboarding
Zero-copy SQL profiling of SAP-style CSVs + 3-color DFS BOM cycle detection.
OR-Tools CP-SAT + Arq
Async Redis/Arq workers compute optimal schedules persisted to PostgreSQL 16.
Grounded Citation Verifier
Backward critical-chain tracer extracts [F1]/[F2] facts; regex guard blocks hallucinations.
Verification & Key Takeaways
- 170 unit and integration tests passing offline without live LLM calls via SHA-256 cached responses.
- Multi-Attribute Utility Theory (MAUT) comparison lets planners weigh OTD%, makespan, tardiness, and setups interactively.
- Shipped with strict mypy typing, ruff linting, Docker Compose stack, and Typer CLI.