Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/music-programmer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import type { AudioClip, Harness, MusicContext, MusicProvider, TrackCandidate, T
import { musicTools, type StreamProbe } from './music-tools.ts'
import { FIND_MUSIC_INSTRUCTION, MUSIC_CONTEXT_HEADER } from './prompts.ts'

// Enough turns for search -> (maybe refine) -> judge -> submit, and a couple of
// pick-agains if a ref will not resolve.
const DEFAULT_MAX_TURNS = 6
// Enough turns for several searches -> judge -> submit, and a couple of
// pick-agains if a ref will not resolve: a real pick can spend 5 searches
// before submitting, so the budget leaves headroom beyond that.
const DEFAULT_MAX_TURNS = 8

// Context insertion (spec 03-01 §2.5), the one place a MusicContext becomes
// prompt text: the stable persona goes to the system prompt so repeated calls hit
Expand Down
3 changes: 3 additions & 0 deletions src/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ reason.
Guidance:
- Prefer official audio / studio versions; avoid hour-long loops, low-quality
re-uploads, and live or cover versions unless they clearly fit the moment.
- Pick a song with vocals — someone singing. Avoid instrumental-only tracks
(light/background music, lofi beats, piano versions) unless the listener
explicitly asked for instrumental.
- Match the listener's taste and language as expressed by the persona.
- Do not repeat something already noted as recently played.
- If your pick fails to resolve, pick another candidate and submit again.
Expand Down
4 changes: 3 additions & 1 deletion test/music-programmer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ describe('MusicProgrammer.nextTrack', () => {
expect(task.systemPrompt).toBe(ctx.persona)
expect(task.prompt).toContain('FIND-MUSIC-INSTRUCTION')
expect(task.prompt).toContain(ctx.situation)
expect(task.maxTurns).toBeGreaterThan(1) // room for search -> judge -> submit
// Room for several searches -> judge -> submit: a real pick can spend 5
// searches before submitting, so the default must leave headroom.
expect(task.maxTurns).toBeGreaterThanOrEqual(8)
})

it('exposes exactly the two music tools and nothing else', async () => {
Expand Down
1 change: 1 addition & 0 deletions test/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('music prompts', () => {
expect(FIND_MUSIC_INSTRUCTION).toContain('search_music')
expect(FIND_MUSIC_INSTRUCTION).toContain('submit_pick')
expect(FIND_MUSIC_INSTRUCTION).toContain('announce')
expect(FIND_MUSIC_INSTRUCTION).toContain('vocals')
})

it('renders the recent turns and the music-break intent', () => {
Expand Down
Loading