> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase36-session04-theme-audio-routing-contract/tasks.md).

# Task Checklist

**Session ID**: `phase36-session04-theme-audio-routing-contract` **Total Tasks**: 19 **Estimated Duration**: 3-4 hours **Created**: 2026-06-28

***

## Progress Summary

| Metric          | Value            |
| --------------- | ---------------- |
| Tasks Completed | 19 / 19          |
| Last Updated    | 2026-06-28 17:37 |
| Blockers        | 0                |

***

Legend: `[x]` completed; `[ ]` pending; `[P]` parallelizable; `[SNNMM]` session ref; `TNNN` task ID.

***

## Setup (3 tasks)

* [x] T001 \[S3604] Verify Sessions 01-03 artifacts, current audio docs, current media policy, and no preexisting theme assets before implementation (`.spec_system/specs/phase36-session03-enemy-and-boss-sfx-pack/validation.md`)
* [x] T002 \[S3604] Inspect current Web Audio, renderer adapter, renderer lifecycle, and theme snapshot boundaries for reset, load, start, descend, victory, defeat, and dispose behavior (`src/extensions/ai-rogue/runtime/audio.ts`)
* [x] T003 \[S3604] Create implementation notes for routing decisions, behavioral-quality evidence, tests, docs, and runtime verification (`.spec_system/specs/phase36-session04-theme-audio-routing-contract/implementation-notes.md`)

***

## Foundation (5 tasks)

* [x] T004 \[S3604] \[P] Define typed theme ambience IDs and exhaustive theme-to-ambience mapping with contract basenames for Session 05 (`src/extensions/ai-rogue/runtime/audio.ts`)
* [x] T005 \[S3604] \[P] Align sector theme audio hints with the ambience contract while preserving existing theme labels, pressure, palette, and generation behavior (`src/extensions/ai-rogue/runtime/themes.ts`)
* [x] T006 \[S3604] Add a low-gain ambience lane to the audio engine with cleanup on scope exit for all acquired resources (`src/extensions/ai-rogue/runtime/audio.ts`)
* [x] T007 \[S3604] Add `playThemeAmbience` and `stopThemeAmbience` engine methods with duplicate-trigger prevention while in-flight and silent missing-asset fallback (`src/extensions/ai-rogue/runtime/audio.ts`)
* [x] T008 \[S3604] Document the selected bus, asset location, size policy, fallback behavior, and Session 05 asset contract before wiring assets (`docs/extensions/ai-rogue/game-feel.md`)

***

## Implementation (5 tasks)

* [x] T009 \[S3604] Wire renderer audio adapter theme selection from `snapshot.theme` with exhaustive enum handling and explicit error mapping to no-op fallback (`src/extensions/ai-rogue/runtime/renderer-audio-adapter.ts`)
* [x] T010 \[S3604] Wire renderer start and descend paths so theme ambience changes by sector while depth music continues unchanged (`src/extensions/ai-rogue/runtime/renderer.ts`)
* [x] T011 \[S3604] Wire victory, defeat, reset, load, and destroy cleanup so ambience stops before terminal music or inactive-run states (`src/extensions/ai-rogue/runtime/renderer.ts`)
* [x] T012 \[S3604] Preserve mute and music-volume behavior for the ambience lane without adding persisted browser-state schema or Settings UI changes (`src/extensions/ai-rogue/runtime/audio.ts`)
* [x] T013 \[S3604] Update media policy and Phase 36 Session 04 stub so the implemented routing decision is current and does not describe Session 05 assets as already shipped (`docs/media-policy.md`)

***

## Testing (6 tasks)

* [x] T014 \[S3604] \[P] Write focused audio engine tests for ambience route start, pending unlock, duplicate no-op, stop, dispose, mute/music volume, missing URL, and decode failure cleanup (`src/extensions/ai-rogue/runtime/__tests__/audio.test.ts`)
* [x] T015 \[S3604] \[P] Write renderer audio adapter tests for start, descend theme changes, unchanged theme no-op, victory/defeat stop, and unchanged depth music (`src/extensions/ai-rogue/runtime/__tests__/renderer-audio-adapter.test.ts`)
* [x] T016 \[S3604] \[P] Write theme mapping tests proving every `AiRogueSectorThemeId` resolves to one stable ambience route (`src/extensions/ai-rogue/runtime/__tests__/themes.test.ts`)
* [x] T017 \[S3604] Run focused AI Rogue audio/theme/adapter tests and app TypeScript validation, then record command evidence (`src/extensions/ai-rogue/runtime/__tests__/renderer-audio-adapter.test.ts`)
* [x] T018 \[S3604] Run asset-size validation and confirm no final Session 05 theme audio files were committed in this routing-contract session (`scripts/check-asset-sizes.sh`)
* [x] T019 \[S3604] Complete runtime verification for AI Rogue start/descend and terminal-state audio routing with product-facing UI only and no bridge, remote-loading, or console-error regression (`tests/e2e/ai-rogue-runtime.spec.ts`)

***

## Completion Checklist

* [x] All tasks marked `[x]`
* [x] All tests and checks passing
* [x] All files ASCII-encoded with LF line endings
* [x] implementation-notes.md updated
* [x] Ready for `implement` to start the implement -> creview -> validate sequence

***

## Next Steps

Run the `implement` workflow step.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase36-session04-theme-audio-routing-contract/tasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
