enrich commands¶
Add genre, mood and language metadata to tracks with an LLM, and back it up. Enrichment powers the --genre,
--mood and --locale filters of playlist history.
enrich tracks¶
Enriches tracks with AI-inferred genre, mood and locales (sung languages) metadata.
| Option | Default | Description |
|---|---|---|
--email |
MUSEFLOW_CLI_DEFAULT_EMAIL |
User email address. |
--only-genre |
off | Enrich genre tags only. |
--only-mood |
off | Enrich mood labels only. |
--only-locale |
off | Enrich locales (sung languages) only. |
--input |
none | YAML file listing the tracks to enrich by fingerprint, in the enrich export format (the other fields are ignored). Only these tracks are processed. |
--force |
off | Re-enrich tracks that already have the requested fields. |
--batch-size |
200 |
Number of tracks per LLM request. |
--model |
OPENROUTER_ENRICHER__MODEL |
OpenRouter model id for this run (e.g. google/gemini-3.1-flash-lite). It must support structured outputs: the command checks the model against the OpenRouter catalog before any call, and stops with a suggestion on a typo. |
--verbose |
off | Show the LLM usage per step and model instead of a one-line total. |
--limit |
none | Maximum number of tracks to process. |
Without any --only-* flag, all three fields are enriched. The flags can be combined. By default only tracks
missing a requested field are processed, so the command is safe to re-run after a new import.
With --input and --force, the same tracks are enriched again on every run: a fixed sample to compare models or
reasoning efforts on, before reading the cost with llm usage --by model --by effort. Cut the sample from an
enrich export file. Each run overwrites the sample's tags: export them between runs to keep each result.
Prerequisites. Imported tracks and an OpenRouter API key (OPENROUTER_API_KEY). This command calls the LLM: use --limit to try it
on a small sample first.
Genres follow a three-level taxonomy (macro genre, sub-genre, optional micro tag), moods are picked among 12
labels, and the locales are the ISO 639-1 codes of every language sung in the track. A track with no sung language (instrumental, or no reliable signal) gets an empty list and is not sent to the model again unless you pass --force. See the
allowed values.
Examples
museflow enrich tracks --limit 200
museflow enrich tracks --only-mood --force
museflow enrich tracks --limit 20 --model openai/gpt-5-mini
museflow enrich tracks --input sample.yaml --force --model openai/gpt-5-mini
Output. While it runs, a progress bar on stderr counts the tracks gone through, with the time left; a failed or
partial batch prints its warning above it, and a ✓ Tracks enriched line ends it. Then Enriched N track(s)., plus a
warning when some batches failed (a re-run processes the missing tracks), or No tracks to enrich.. With --input, a
warning counts the fingerprints that match none of the user's tracks. When every batch failed, it prints
No track enriched: N batch(es) failed and exits with code 1. Last, one line gives the LLM calls, their cost and the
elapsed time, whatever the outcome; with --verbose, an LLM usage table details the calls, tokens, cost and time.
When it stops early. The command stops instead of running on, so it does not keep paying for calls that cannot succeed:
- at once, when OpenRouter refuses the request for a reason every batch shares: invalid API key, no credits left or key limit reached, unknown model, a request the model refuses (such as its response schema), no provider available, a lasting outage or a rate limit;
- after 3 failed batches in a row, whatever the cause; the message names the last one.
It prints Enrichment stopped at batch N/M after X track(s): <reason> and exits with code 1. The tracks enriched
before the stop are saved: fix the cause, then run the same command again; tracks already enriched are skipped. With
--force, a new run starts over from the first track.
enrich export¶
Exports the genres, moods and locales of all enriched tracks to a YAML file, keyed by track fingerprint.
| Option | Default | Description |
|---|---|---|
--email |
MUSEFLOW_CLI_DEFAULT_EMAIL |
User email address. |
--output |
required | Path to the output YAML file. |
Output. Exported enrichment for N track(s) to <path>.
enrich import¶
Restores genres, moods and locales from a YAML file produced by enrich export, without calling the LLM.
| Option | Default | Description |
|---|---|---|
--email |
MUSEFLOW_CLI_DEFAULT_EMAIL |
User email address. |
--input |
required | Path to the input YAML file. |
Tracks must already exist in the library.
Output. Imported enrichment for N track(s) (K fingerprints not found in DB)..