cat ~/production/school-timetabling-system/REPORT.md

School Timetabling System

Conflict-free timetable generation across grades, sections, teachers and subjects, using a language model constrained by a hard specification and checked by real code.

role Tech Lead, Backendtimeline 2025category platformclient A private school group

Problem

Building a school timetable by hand takes days and still produces conflicts: a teacher double-booked across sections, a subject scheduled with no available teacher. The constraint set is small to state and painful to satisfy.

Approach

Treated the prompt as a specification rather than a request. It states the hard constraint, then immediately states what is deliberately not a conflict, because a model told no two classes at once over-generalises into no subject twice at once and produces unusable sparse timetables. It teaches by counterexample and specifies an algorithm rather than an outcome. Generated output is then validated against the constraint set by ordinary code before being accepted.

Outcome

A term timetable generates in minutes, with teacher conflicts rejected programmatically rather than discovered in the first week of term.

230Constraint spec · lines of specification
49Route declarations
IndependentValidation · generator output is not trusted
architecture --explain

How it's built

Constraint specification, batched generation with staged temperature, three-layer response parser, independent conflict validator, retry with feedback. The validator is deliberately separate from the generator.

Validate the output independently rather than trusting the generator

A model producing well-formed, confident, conflicting output is the expected failure mode, not an edge case. Conflict detection runs as ordinary code against the result.

The constraint logic exists twice, once as specification and once as code, duplication that buys the ability to reject a wrong answer.

Staged temperature across retries

The first attempt runs near-deterministic. Retries widen slightly, because a strictly deterministic retry reproduces the same conflict.

Later attempts are less predictable, which the validator absorbs.

related --by-stack

Adjacent systems

REL-001 / platform

Freelance Marketplace with Escrow

Two-sided marketplace for architecture and design work: the platform holds the money until delivery is confirmed, with bidding happening in real-time chat.

REL-002 / platform

Vehicle Rental Platform

Rent a scooter or e-bike from an app: scan the QR, the physical lock opens over cellular, ride, park in a permitted zone, pay by the minute from a prepaid wallet.

REL-003 / platform

Offline-First Pharmacy Platform

A pharmacy management system that keeps selling when the internet drops, then reconciles every till operation exactly once when it returns.