feat: spotify-only matching + optional local-LLM gate + google→bandcamp fallback (closes task/drop-musicbrainz-google-fallback, closes task/ollama-classifier)

Source: human-feedback note 01KVDYV3A35B57N15CRBQDXPCH (project/reddit-spotify-linker,
2026-06-18) — "remove the musicbrainz integration and just use spotify"; a google search
for "<name> bandcamp" fallback; and "would a local llm be better able to categorise these
... include instructions for running something suitable via ollama (16GB M2)".

- Remove MusicBrainz entirely (viaMusicBrainz + url-rels + rate-gate; lib relUrls/mbResult).
  Spotify is now the only music API; it both gates by exact-name match and supplies the
  direct artist link.
- Optional ollama LLM gate (OLLAMA_URL enables it, OLLAMA_MODEL default qwen2.5:3b) called
  over plain HTTP -> stays zero npm-dep. It classifies which candidates are real
  artists/albums (the matching-quality lever). Pure prompt/parse logic in new llm.js
  (unit-tested in llm.test.js); the fetch + resolveAll gate wiring live in resolver.js.
- A confirmed name links to its direct Spotify page when available, else a Google search for
  "<name> bandcamp". New "google" primary platform rendered by the extension (styles.css
  blue accent + platform-aware link title in content.js).
- README: drop MusicBrainz; document the two gates + a runnable local-LLM setup for a 16GB
  MacBook M2. AGENTS.md: flip the old "no ML/NER" standing decision per the human override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
paul
2026-06-19 12:50:07 +00:00
co-authored by Claude Opus 4.8
parent b97c82d92e
commit ef57761859
10 changed files with 343 additions and 249 deletions
+14 -5
View File
@@ -8,7 +8,10 @@ is tracked in the **towl** work-item store under project **`reddit-spotify-linke
- `service/` — zero-dependency Node resolver (Node 18+, built-in `fetch`/`http`).
`resolver.js` = the HTTP server; `lib.js` = pure, side-effect-free logic (the
artist-match precision lever) so it's unit-testable; `lib.test.js` = `node:test`.
artist-match precision lever) so it's unit-testable; `llm.js` = pure ollama
prompt/parse helpers (the optional local-LLM gate, HTTP-only — no in-process
model runtime); `lib.test.js` + `llm.test.js` = `node:test`. The only music API
is Spotify (MusicBrainz removed).
- `extension/` — Firefox **MV2** content script (`content.js` + `manifest.json` +
`styles.css`). No build step.
- `scripts/check.sh` — the local check gate.
@@ -56,7 +59,13 @@ fixes small things directly.
- Firefox **MV2** stays — Mozilla has no deprecation timeline; do not migrate to MV3
speculatively.
- **No ML/NER** in the resolver — keep it zero-dep; improve detection with cheap
heuristics + the API exact-match filter.
- Detection precision lever: a candidate links **only** when a music API returns an
artist whose name matches it case-insensitively.
- **Optional local LLM is the recommended better-matching path** (human override,
feedback 2026-06-18 — supersedes the old "no ML/NER" rule). The resolver may call
ollama over HTTP (`OLLAMA_URL` enables it, `OLLAMA_MODEL` defaults `qwen2.5:3b`)
to classify which candidates are real artists/albums. It stays **zero-NPM-dep**:
HTTP only, no in-process model runtime. The heuristic + Spotify exact-match is the
zero-dep default when no LLM is configured.
- Detection precision lever (zero-dep default): a candidate links **only** when
Spotify returns an artist whose name matches it case-insensitively. A confirmed
name links to its Spotify artist page if available, else a "<name> bandcamp"
Google fallback.