Backend + AI Case study 02
DriftGuard
A local-first agent that learns what your data should look like, catches breaking changes before they spread, and proposes repairs a person approves. The AI never executes code.
01 Overview
- Type
- Local-first agent
- Date
- August 2026
- Stack
- Python · FastAPI · Next.js
- AI
- Schema-constrained OpenAI
Data pipelines break quietly when a field gets renamed or a format changes, and the damage spreads into every app downstream. AI can suggest fixes, but nobody should let it rewrite data unsupervised.
DriftGuard infers data contracts from trusted CSV/JSON samples, detects breaking schema and data-quality changes, and proposes repairs that stay previewable, approvable and reversible.
02 What I built
- Built a local-first reliability agent that infers data contracts from trusted CSV/JSON samples and detects breaking schema and data-quality changes before they propagate.
- Architected a hybrid repair engine: deterministic field matching first, schema-constrained OpenAI reasoning only for ambiguous mappings.
- Every AI suggestion compiles to an allowlisted transformation DSL rather than executing generated code.
- Developed checksummed source preservation, isolated repair previews, deterministic validation, human approval, rollback, append-only audit trails and feedback-driven proposal ranking.
- Verified the workflow with pytest, Playwright, Docker, CI and a reproducible corruption benchmark.
03 How a repair happens
Nothing touches your data until a person says yes, and every step can be undone.
Infer what valid data looks like from trusted CSV/JSON samples.
Catch drift, match fields deterministically, ask the model only when it's ambiguous, and express every fix in the allowlisted DSL.
Preview in isolation, approve, keep an append-only audit trail, and roll back anytime.
04 What I cared about
AI with guardrails
The model can only propose operations from a fixed allowlist. It never writes or runs code, so a bad suggestion can't do anything outside that box.
Your source data is sacred
Sources are checksummed and preserved; repairs run on isolated previews, and every change is logged and reversible.
Proof, not vibes
A reproducible corruption benchmark plus pytest, Playwright and CI show the repairs behave, not just that they demo well.
05 Next
Next case study: ChartUPP →