Skip to content

Commit c8c6d4a

Browse files
docs: update backlog tasks
1 parent 765c54d commit c8c6d4a

5 files changed

+114
-0
lines changed

backlog/tasks/task-306 - CI-Build-Time-Iteration-Linux-prebaked-image-macOS-runner-broadening.md renamed to backlog/completed/task-306 - CI-Build-Time-Iteration-Linux-prebaked-image-macOS-runner-broadening.md

File renamed without changes.

backlog/tasks/task-307 - Add-structured-JSONL-logging-temperature-control-and-think-toggle-to-scripts-agent.py.md renamed to backlog/completed/task-307 - Add-structured-JSONL-logging-temperature-control-and-think-toggle-to-scripts-agent.py.md

File renamed without changes.

backlog/tasks/task-308 - Fix-agent-created-playlists-not-appearing-in-sidebar.md renamed to backlog/completed/task-308 - Fix-agent-created-playlists-not-appearing-in-sidebar.md

File renamed without changes.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
id: TASK-310
3+
title: Add lyrics-based validation to agent playlist generation
4+
status: In Progress
5+
assignee: []
6+
created_date: '2026-04-04 08:54'
7+
updated_date: '2026-04-04 08:56'
8+
labels:
9+
- agent
10+
- quality
11+
- bug
12+
dependencies: []
13+
references:
14+
- src-tauri/src/agent.rs
15+
- docs/agent.md
16+
priority: medium
17+
---
18+
19+
## Description
20+
21+
<!-- SECTION:DESCRIPTION:BEGIN -->
22+
The local LLM (qwen) hallucinated when given the prompt "instrumental tracks only" -- it returned a playlist of 22 tracks (named "Instrumental Horizons") that are overwhelmingly vocal tracks (Ellie Goulding, Grimes, Weezer, Mother Mother, Cults, etc.). The model has no way to determine whether a track is actually instrumental; it just matched Last.fm tags like "instrumental", "post-rock", "electronic" and assumed those artists' tracks are instrumental.
23+
24+
Since the LLM cannot be trusted to make this determination from Last.fm metadata alone, add a post-generation validation step that uses the existing lyrics lookup (lrclib) to check whether each track in the generated playlist actually has lyrics. If lyrics are found, the track is not instrumental and should be filtered out.
25+
26+
This applies specifically to prompts that request instrumental/no-vocals content, not to all playlist generation.
27+
28+
**Observed behavior (2026-04-04):**
29+
- Prompt: "instrumental tracks only"
30+
- Result: 22 tracks, nearly all with vocals
31+
- Artists included: Ellie Goulding, Grimes, Weezer, Cults, MGMT, Mother Mother -- none instrumental
32+
<!-- SECTION:DESCRIPTION:END -->
33+
34+
## Acceptance Criteria
35+
<!-- AC:BEGIN -->
36+
- [ ] #1 When the agent prompt implies instrumental-only tracks, each candidate track is checked for lyrics before inclusion
37+
- [ ] #2 Check the local SQLite db for cached lyrics first -- if the track has been played before, lyrics should already be stored
38+
- [ ] #3 Only call the lrclib API for tracks with no cached lyrics in the db
39+
- [ ] #4 Tracks with lyrics found (cached or fetched) are excluded from the final playlist
40+
- [ ] #5 Tracks where no lyrics exist (or lrclib returns instrumental flag) are kept
41+
- [ ] #6 The validation does not run for non-instrumental prompts (no performance penalty for normal playlists)
42+
- [ ] #7 If filtering removes too many tracks, the agent is informed and can search for more candidates
43+
<!-- AC:END -->
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
id: TASK-311
3+
title: >-
4+
Refactor Genius to preview/refine/approve flow instead of one-shot playlist
5+
creation
6+
status: In Progress
7+
assignee: []
8+
created_date: '2026-04-04 08:59'
9+
updated_date: '2026-04-04 09:07'
10+
labels:
11+
- genius
12+
- ux
13+
- refactor
14+
dependencies: []
15+
references:
16+
- docs/agent.md
17+
- docs/genius.md
18+
- crates/mt-tauri/src/agent/mod.rs
19+
- app/frontend/js/components/genius-browser.js
20+
priority: medium
21+
---
22+
23+
## Description
24+
25+
<!-- SECTION:DESCRIPTION:BEGIN -->
26+
Currently, Genius one-shots playlist creation: the user enters a prompt, the agent generates tracks, and a playlist is immediately persisted to the database. There is no opportunity to preview, refine, or reject the result before it's saved.
27+
28+
Refactor the flow into a multi-step dialogue:
29+
30+
1. **Generate** — User submits a prompt, agent generates a candidate track list (as today)
31+
2. **Preview** — Display the candidate tracks in the UI *without* persisting to the database. User can see track names, artists, and any other relevant metadata
32+
3. **Refine** — User can provide feedback (e.g., "remove the jazz tracks", "add more Radiohead", "make it longer") which triggers another agent turn to revise the candidate list. This can repeat multiple times
33+
4. **Approve** — User explicitly approves the final track list, at which point the playlist is created in the database
34+
35+
### Backend changes (Rust)
36+
37+
- Split `agent_generate_playlist` into two phases:
38+
- **Generate/refine phase**: Returns a candidate `AgentResponse` with track list but does NOT persist to database
39+
- **Approve phase**: New Tauri command (e.g., `agent_approve_playlist`) that accepts the finalized track IDs and creates the playlist
40+
- Support multi-turn refinement: the agent needs conversational context (prior turns) to refine intelligently. Consider whether to maintain session state in the backend or pass conversation history from the frontend
41+
- `shuffle_spread_artists()` should run at approve time, not generate time
42+
43+
### Frontend changes (Alpine.js)
44+
45+
- After generation, show a preview panel with the candidate tracks (not a toast)
46+
- Provide UI for:
47+
- Approving the playlist (triggers persist)
48+
- Entering refinement feedback (triggers another agent turn with context)
49+
- Canceling/discarding the candidate
50+
- Track list in preview should show enough metadata for the user to evaluate quality (title, artist, album, duration)
51+
- Consider drag-to-reorder or remove-individual-tracks in the preview
52+
53+
### Key files
54+
55+
- `crates/mt-tauri/src/agent/mod.rs` — agent orchestration, `agent_generate_playlist`, `parse_agent_response`, `shuffle_spread_artists`
56+
- `app/frontend/js/components/genius-browser.js` — Alpine.js component, generation flow
57+
- `app/frontend/js/api/agent.js` — Tauri IPC bridge
58+
- `app/frontend/views/genius.html` — Genius view template
59+
<!-- SECTION:DESCRIPTION:END -->
60+
61+
## Acceptance Criteria
62+
<!-- AC:BEGIN -->
63+
- [ ] #1 Submitting a Genius prompt returns a candidate track list without creating a playlist in the database
64+
- [ ] #2 Candidate tracks are displayed in a preview panel showing title, artist, album, and duration
65+
- [ ] #3 User can enter refinement feedback that sends another agent turn with conversational context, updating the preview
66+
- [ ] #4 Refinement can be repeated multiple times before approving
67+
- [ ] #5 User can approve the candidate, which persists the playlist to the database and emits PlaylistsUpdatedEvent
68+
- [ ] #6 User can discard/cancel a candidate without any database side effects
69+
- [ ] #7 shuffle_spread_artists runs at approve time, not generate time
70+
- [ ] #8 Existing one-shot behavior is fully replaced (no legacy path)
71+
<!-- AC:END -->

0 commit comments

Comments
 (0)