Hackathon build, 2026
DimSum
Turns a campus operator's plain-English notes into the cheapest 24-hour power plan that provably breaks no rules.
- Role
- Interpreter and guardrails
- Type
- Hackathon build, 2026
- Status
- Live

- Problem
A campus operator writes notes in plain English, and only some of them are instructions: one says solar will drop to 20 percent after lunch, the next says the cafeteria menu changes tomorrow. Acting on the wrong one is expensive. Handing the whole job to a language model is worse, because what comes back is a plausible schedule that quietly violates a battery reserve.
- What we built
Six stages, each one distrusting the stage before it. The model never writes the schedule; it only emits flat fields, never a nested object, so a malformed response cannot reach the solver, and the guardrails assemble the structure themselves rather than taking the model's word for whether a directive even applies. A linear program decides the plan, and a final validator written from the problem statement rather than copied from the optimizer replays every check on the result. Where the program is infeasible, the softest families of directive are dropped in order until it is not.
- My part
I built stages two and three: the Gemini call that turns each note into a structured directive, and the deterministic guardrail layer that repairs or discards what comes back. That includes the retry ladder and the regex fallback for when the model is rate limited, and the extractor cases for notes that wrap past midnight or mix units. Dropping the thinking config cut median model latency from about 5.7 seconds to 2.3 without costing accuracy.
- How it works
- 1Energy data and operator notes, checked against a Zod schema
- 2Gemini turns each note into a flat, structured directive
- 3Guardrails repair the unsafe ones and discard the rest
- 4HiGHS solves a linear program for the cheapest legal plan
- 5A second validator replays all twelve checks independently
- 6Totals recomputed from the hourly plan, never carried over
- Result
Deployed and runnable on the organisers' published scenarios, all ten reproducing the reference cost exactly, with 22 of 22 guardrail tests, 18 of 18 extractor tests and 53 unit tests across the optimizer and validator.
- Stack
Bun, TypeScript, Gemini API, HiGHS, Zod