← All work

Ambiance: a local-AI playlist curator

Describe a mood, and a local LLM builds a playlist from songs you already love.

Independent2026built with Claude Code✓ passed
A real curate in the Ambiance web app. A mood description of Dune Parts One and Two is entered. Inspect reads its themes (destiny, vengeance, war, prophecy) and moods (tense, dark, ominous, tragic). The curator then builds a seven-song arc, Dune: The Sands of Destiny, with a reason for each pick, and publishes it to Spotify.
A real curate from a Dune description: inspect, curate an arc, publish. Listen to the playlist on Spotify.

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

Stage one builds the library once: sync liked songs and lyrics, distill each song into a compact profile with a local LLM, and embed it into a semantic index stored in SQLite. Stage two runs for every playlist: describe a mood, inspect it, take a similarity pool from the index, let the curator LLM build an arc, apply a quality floor, review a draft and publish. Music services sit behind a provider interface.
Two stages: build the library once, then curate as often as you like.
  • 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.

RustaxumSQLiteTypeScriptReactOllama (qwen2.5 7B)nomic-embed-textLRCLIBSpotify Web API