Let's Go Gaffer
Set out to learn Go · ended up shipping a live AI assistant for Fantasy Premier League
0.516
Rank correlation vs 0.400 baseline (backtest)
22/22
Assistant eval cases passing
0.20 s
API p95 latency (Datadog APM)
6/6
Gameweeks the model beat recent form
situation
I wanted to learn Go properly — not tutorials, but the way it is used in production: the standard library first, contexts on every call, small interfaces, wrapped errors, table-driven tests and goroutines that always shut down. I needed a problem big enough to force all of that, so I picked one I care about every week: my Fantasy Premier League team.
challenge
A toy would not teach me much, so I held it to production standards. LLM assistants sound confident about lineups and transfers but get the arithmetic and FPL's rules wrong, so mine had to be trustworthy: every number computed and explainable. Then it had to run as a real public service — sign-in, per-user data, cost limits, monitoring — on a student cloud budget.
solution
Each stage taught one part of Go: the FPL API client (net/http, retries, rate limiting), the expected-points model and lineup optimizer (pure functions under table-driven tests), news ingestion into Postgres and pgvector (pgx, worker pools), Claude tool calling (streaming, encoding/json), then Temporal workflows (concurrency with clean shutdown). One rule held throughout: the LLM never does maths or checks rules — Go does, and Claude only narrates the results. What started as a Go exercise now runs live on Azure Kubernetes, deployed by Terraform and GitHub Actions and monitored in Datadog.
KEY CONTRIBUTIONS
- Expected-points model backtested on gameweeks it never saw: rank correlation 0.516 vs 0.400 for a season-average baseline and 0.343 for recent form, with lower error (MAE 1.89 vs 2.08)
- LLM never does maths or rule checks — Claude calls Go tools for lineups, transfers and chips, and grounding checks flag any number, citation or club the tools didn't return
- RAG over team news from BBC, Sky, the Guardian and more: Voyage embeddings in Postgres + pgvector, refreshed every 30 minutes by Temporal workflows
- Temporal workflows for scheduled news, per-player watch alerts to each user's inbox, a gameweek briefing and a nightly eval of the assistant
- Terraform on Azure (AKS with autoscaling, managed Postgres, DNS); sign-in through Dex with GitHub, Google or Microsoft, per-user daily limits, and AES-256-GCM-encrypted user settings
- GitHub Actions with OIDC (no stored cloud keys), a Terraform plan on every PR, and an isolated preview environment per pull request that is torn down on merge
- OpenTelemetry traces and metrics into Datadog with logs tied to traces; dashboards, monitors and a 99% availability SLO kept as code
EQUIPMENT MANIFEST