Ambiance: a local-AI playlist curator
Describe a mood, and a local LLM builds a playlist from songs you already love.
context
Ambiance is a curator. You describe a mood in plain text (a scene, a story, a season, a feeling), and it builds a playlist of about 90 minutes from your own liked songs, sequenced into an arc. It doesn't discover new music; it rediscovers the music you already love.
problem
To match songs to a mood, Ambiance has to know what each song is about and how it feels. Once I started building, I found that Spotify's API no longer offered audio features, recommendations, genres or popularity. The curator design held up anyway, because it never depended on them: I rebuilt the signal from lyrics. And I gave myself a hard constraint: local models only, with no paid API, on a 6 GB GPU.
build
- Two-stage AI. Each song's lyrics are distilled once, offline, into a compact profile, and embedded into a semantic index. Curation then reasons over short profiles, never raw lyrics, so it fits a small model's context window.
- The pipeline: sync liked songs and lyrics → distill → embed → describe a mood → similarity pool → a curator LLM builds the arc → quality floor → draft → publish.
- Built like a platform.
- Layers: a Rust core library, plus a CLI, an HTTP server and a React/TypeScript web client.
- A versioned contract between server and client, with the TypeScript types generated from Rust.
- A background job system with a one-GPU lock.
- Versioned database migrations with data lineage.
- A provider interface, so other music services can plug in.
decisions hypothesis → measured → decided
- Keywords → meaning. Keyword matching couldn't find a song about a fatal car crash for a grief description. Embeddings ranked it first, and correctly left it out of a "driving" playlist. Matching became semantic, with keywords as the fallback only.
- A small model misread a song. A 3B model read "Heavy Is the Crown" as a hopeless-relationship song. A 7B model read it correctly, as the weight of responsibility. After re-distilling, the two crown songs went from excluded to first and second. I traded speed for accuracy.
- Richer embeddings. Embedding profile plus lyrics, instead of the profile alone, widened score spread by 24% and the on-theme/off-theme gap by 18%. Adopted.
- Turning off my own feature. Blind A/B tests found the re-rank pass no better than curating straight from the similarity pool, and about 4× slower. It's off by default, and the README says why.
results
- About 13,400 lines of Rust and TypeScript and 137 tests.
- 195 commits and 53 merged pull requests since September 2026, each reviewed by me on GitHub.
- A warm curate takes about 36 seconds on a 6 GB GPU.
how I worked with AI
I used Claude Code as the implementation partner. I owned the architecture, the constraints and every design decision, and I reviewed every change as its own pull request before it merged. When a re-rank change quietly dropped the backbone of a playlist, I caught it ("the old playlist was stronger"), and the fix became prune-only.
next what I'd change before hosting it
- Make publish idempotent, so a double-click can't create two playlists.
- Replace the trusted-network identity with real authentication.
- Add a deterministic seed, so A/B tests are reproducible.
- Add a CI workflow for tests, lints and generated-type checks.
Beyond those fixes, hosting would let me move to a thin client, bigger models, and a shared per-song profile cache.
Code: the repository is private. A code walkthrough is available on request.