> 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/phases/phase_36/prd_phase_36.md).

# PRD Phase 36: AI Rogue Audio Asset Finishing

**Status**: Complete **Sessions**: 8 (initial estimate) **Estimated Duration**: 4-8 days

**Progress**: 8/8 sessions completed and validated (100%)

***

## Overview

Phase 36 turns the AI Rogue audio asset opportunity plan into executable spec-system sessions. It validates the current 45-cue SFX baseline, adds the runtime metadata needed for enemy-family audio, generates and wires enemy and boss identity cues, defines and implements sector theme audio, optionally adds adaptive stinger support, and closes with the full audio validation and docs matrix.

The phase must preserve AI Rogue's production default posture, browser-local state, static public-demo boundary, committed media-size policy, provenance requirements, deterministic simulation behavior, autoplay unlock behavior, mute and volume preferences, and silent fallback behavior.

Proper delivery for this phase means every shipped audio feature proves the user's intended outcome end to end in the product, with real execution, visible results, recovery paths, and tests. Scaffolding, mappings, or docs that look complete are not enough unless the behavior is audible in browser review, observable through the AI Rogue runtime, recoverable through mute/fallback paths, and covered by focused validation.

***

## Progress Tracker

| Session | Name                            | Status   | Est. Tasks | Validated  |
| ------- | ------------------------------- | -------- | ---------- | ---------- |
| 01      | Current Audio Balance Audit     | Complete | 21         | 2026-06-28 |
| 02      | Enemy Audio Metadata            | Complete | 20         | 2026-06-28 |
| 03      | Enemy And Boss SFX Pack         | Complete | 23         | 2026-06-28 |
| 04      | Theme Audio Routing Contract    | Complete | 19         | 2026-06-28 |
| 05      | Sector Theme Audio Pack         | Complete | 20         | 2026-06-28 |
| 06      | Adaptive Music Engine Expansion | Complete | 19         | 2026-06-28 |
| 07      | Adaptive Stinger Pack           | Complete | 20         | 2026-06-28 |
| 08      | Final Audio Validation And Docs | Complete | 20         | 2026-06-28 |

***

## Completed Sessions

* Session 01: Current Audio Balance Audit - completed 2026-06-28.
* Session 02: Enemy Audio Metadata - completed 2026-06-28.
* Session 03: Enemy And Boss SFX Pack - completed 2026-06-28.
* Session 04: Theme Audio Routing Contract - completed 2026-06-28.
* Session 05: Sector Theme Audio Pack - completed 2026-06-28.
* Session 06: Adaptive Music Engine Expansion - completed 2026-06-28.
* Session 07: Adaptive Stinger Pack - completed 2026-06-28.
* Session 08: Final Audio Validation And Docs - completed 2026-06-28.

***

## Upcoming Sessions

* None in Phase 36. The next workflow step is `audit` because Phase 36 is complete and the workflow is entering Phase Transition.

## Session 08 Closeout Evidence

Session 08 closeout on 2026-06-28 recorded the final Phase 36 audio validation package:

* Operator sign-off accepted for desktop and mobile manual listening after direct review links were provided for all committed audio files.
* `bun run typecheck` passed.
* Focused audio, combat, and protocol Vitest suites passed.
* AI Rogue runtime and mobile Playwright suites passed.
* `bash scripts/check-asset-sizes.sh` passed.
* Provenance covers all 11 committed music/ambience files and all 64 committed SFX/stinger files.
* `docs/extensions/ai-rogue/game-feel.md` and `docs/media-policy.md` now match the shipped audio pack.
* No Phase 36 closeout change introduced remote loading, hosted writes, collectors, analytics, workers, WebGPU-only behavior, save schema changes, or simulation behavior changes.

Completed workflow gates:

* `creview` reviewed and repaired uncommitted changes.
* `validate` verified session completeness with PASS.
* `updateprd` marked Session 08 and Phase 36 complete.

***

## Objectives

1. Validate the implemented 45-cue audio baseline in desktop and mobile browser play before adding larger asset packs.
2. Add typed audio-routing metadata for enemy families and reduce fragile fallback message checks.
3. Generate, optimize, document, and wire enemy-family and boss SFX while preserving deterministic simulation behavior.
4. Define and implement theme-aware audio routing, then add sector identity assets within media policy.
5. Add adaptive stingers only after the runtime contract is explicit, tested, and judged useful by the balance audit.
6. Reconcile audio docs, provenance, media policy, and validation evidence.

***

## Prerequisites

* Phase 35 completed and validated.
* AI Rogue remains production-enabled by default with `VITE_CLAUDE_OS_ENABLED_EXTENSIONS=none` as the explicit opt-out.
* The current AI Rogue audio baseline includes six music tracks, 45 SFX files, provenance metadata, explicit high-value audio cues, deterministic variants, and asset-size validation.
* Preserve no remote game-content loading, no hosted writes, no collectors, no analytics, no public-demo bridge calls, and no raw private telemetry export.

***

## Folded Source Baseline

This section folds the complete former AI Rogue media-finishing audio source into the Phase 36 canonical PRD. The former ongoing-project note can be deleted without losing audio planning details.

**Checked**: 2026-06-28 **Scope**: `docs/extensions/ai-rogue/` and `src/extensions/ai-rogue/`

This phase tracks the audio side of the `AI Rogue` asset upgrade work: music, ambience, SFX, audio dispatch, provenance, media policy, and validation.

### Relationship To The Visual Plan

Use Phase 36 for:

* Audio generation opportunities.
* Runtime audio engine and dispatch improvements.
* Audio provenance and media-size policy notes.
* Validation that is not specific to visual atlas packing.

Use `.spec_system/PRD/phase_37/` for:

* G1-G8 generated visual source sheets.
* Chroma-key alpha derivatives and SHA-256 records.
* Visual crop selection and cleanup.
* Gameplay/UI atlas packing.
* Sprite, tile, HUD, React icon, fog, and cinematic frame wiring.

### Phase 36 Audio Asset State

AI Rogue now has the Phase 36 shipped audio pack:

| Area             | Current State                                                                                                                     |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| Music            | Six Ogg Opus tracks in `src/assets/ai-rogue/audio/music/`, all under the reviewed 900 KB per-track cap.                           |
| Theme ambience   | Five low-gain Ogg Opus loops in `src/assets/ai-rogue/audio/music/`, all under the reviewed 900 KB per-track cap.                  |
| SFX              | Sixty-four Ogg Opus one-shots or loops in `src/assets/ai-rogue/audio/sfx/`, including seven adaptive stingers.                    |
| Runtime audio    | Direct Web Audio with lazy decode, music crossfades, one-shots, heartbeat loop, mute and volume preferences, and silent fallback. |
| Media validation | `bash scripts/check-asset-sizes.sh` enforces committed asset-size policy.                                                         |

Session 01 implementation review, 2026-06-28:

* Desktop browser instrumentation passed for unlock, title queueing, run-start SFX, sector 1 music, restrained runtime-control UI clicks, Settings mute and volume persistence, and no-Web-Audio silent fallback. The review used `agent-browser` plus Playwright fetch instrumentation because the agent environment does not provide direct acoustic monitoring.
* Mobile 390x844 touch instrumentation passed for compact controls, Start unlock, sector music, a triggered Health Cache SFX, Settings mute and volume persistence, and no horizontal overflow on Play and Settings.
* Deterministic local scenarios emitted protocol pickup/action, terminal, vault, cache, objective, compile-choice, final-defense, and victory cues through supported runtime paths.
* No blocking runtime routing defect was found. The only routing/documentation clarification is that `compile_payload` belongs to the final payload defense; ordinary compile-level readiness uses `objective_unlock`, and selecting a compile upgrade uses `equipment_equip`.
* Objective volume scan follow-ups: review `45_wall_bump_variant_a.ogg` as a loud-fatigue candidate; verify `terminal_open`, `cache_open`, `compile_payload`, `shield_break`, `status_applied`, and `status_cleansed` are audible under music before final closeout.

Implementation update, 2026-06-28:

* SFX expanded from 16 to 45 Ogg Opus files.
* Added a repeatable ElevenLabs generation script at `scripts/generate-ai-rogue-audio-sfx.ts`.
* Added explicit `audioCues` event metadata for high-value terminal, vault, protocol, shield, cache, objective, compile, and final-defense beats.
* Added deterministic variants for hit, enemy defeated, player hurt, shard pickup, UI click, and wall bump.
* Queued the existing title loop for pre-run audio unlock and wired restrained UI click confirmations for runtime controls.
* Updated `src/assets/ai-rogue/audio/sfx/provenance.json` with prompt, request, render, and raw-response metadata.

Important constraints from the existing docs still apply:

* AI Rogue music tracks use the special 900 KB cap.
* Non-music committed assets remain subject to the default `src/assets` size policy.
* No remote game-content loading.
* New audio must keep provenance beside the committed files.
* New cues should respect mute, music volume, SFX volume, autoplay unlock, and silent fallback behavior.
* Run `bash scripts/check-asset-sizes.sh` after every committed media change.

### Highest-Leverage Audio Findings

| Status | Priority | Finding                                                                    | Why It Matters                                                                                                                                       |
| ------ | -------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Done   | P1       | Expand event SFX coverage.                                                 | The 2026-06-28 pass added wall/invalid, shield, hazard/status, protocol, objective, terminal, vault, cache, final-defense, and UI confirmation cues. |
| Done   | P1       | Add SFX variations for high-frequency cues.                                | Hit, enemy defeated, player hurt, shard pickup, UI click, and wall bump now have deterministic variant selection.                                    |
| Done   | P1       | Give enemy families audio identities.                                      | Session 03 added typed family/boss cues and browser proof.                                                                                           |
| Done   | P1       | Add protocol and objective SFX.                                            | Patch Kit, Trace Map, Signal Jammer, Trace Lance, Phase Step, vaults, terminals, keys, and final defense now have explicit cues.                     |
| Done   | P1       | Convert sector themes into audio identity packs.                           | Session 05 added five theme ambience beds routed from `snapshot.theme`.                                                                              |
| Done   | P2       | Wire existing underused title and UI click audio before replacing it.      | The title loop is queued for pre-run unlock, and runtime controls use restrained UI confirmations.                                                   |
| Done   | P2       | Add ambience or adaptive stingers only after the engine contract is clear. | Sessions 06/07 added the request contract, ducking rules, cooldowns, tests, and seven dedicated stingers.                                            |

Session 01 follow-up routing, resolved by Phase 36 closeout:

* Session 02/03 added typed enemy-family metadata and family/boss cue identities.
* Session 08 accepted `45_wall_bump_variant_a.ogg`, quiet milestone cues, and current hazard/status coverage without Phase 36 gain or asset repair.
* Session 04/05 kept primary depth music and added theme-aware ambience beds.
* Session 06/07 added the adaptive request contract, ducking behavior, cooldowns, and dedicated stingers.
* Session 08 re-ran the full audio validation matrix and recorded operator manual-listening sign-off.

### Audio Findings

#### A1. Event Coverage Was Expanded In The 2026-06-28 Pass

Current source reality:

* `runtime/types-simulation.ts` defines `AiRogueSimulationAudioCueId`.
* `runtime/audio.ts` maps 45 committed SFX files, including deterministic variants for high-frequency cues.
* `dispatchEventSound()` first honors explicit `event.audioCues`, then falls back to event-type mapping for older/simple events.
* `combat.ts`, `enemy-effects.ts`, and `simulation.ts` emit explicit cue metadata for terminal, vault, protocol, shield, cache, objective, compile, and final-defense beats.

Implemented in the 2026-06-28 pass:

* Generated and wired focused SFX for wall bump and invalid action.
* Generated and wired player Strike swing and successful strike as separate cues.
* Generated and wired enemy melee hit.
* Generated and wired hazard burn/corruption tick.
* Generated and wired shield absorb and shield break.
* Generated and wired status applied and status cleansed.
* Generated and wired key fragment, vault unlock/open, cache chest open, terminal open, and terminal choice accepted.
* Generated and wired protocol pickup, Patch Kit use, Trace Map reveal, Signal Jammer pulse, Trace Lance fire, and Phase Step jump/land.
* Generated and wired equipment equip, objective unlock, compile payload armed, final defense survived, and save/load/reset UI confirmations.

Phase 36 closeout status:

* Sentry charge/fire and boss charge/fire/hit/shutdown shipped in the enemy-family audio batch.
* More typed metadata could still replace remaining fallback message checks in a future runtime cleanup, but it is not a Phase 36 closeout blocker.

#### A2. Core Variations Were Added

Current source reality:

* `SFX_FILE_BASENAMES` supports one or more files per cue.
* `playSfx()` accepts `variantSeed`; event dispatch hashes stable event IDs so replay-equivalent events choose the same variant without affecting simulation determinism.

Implemented variants:

* `hit`
* `enemy_defeated`
* `player_hurt`
* `shard_pickup`
* `ui_click`
* `wall_bump`

Remaining opportunity:

* Add a second hazard/status variant only if playtesting shows repetition.

#### A3. Enemy Families Have Audio Identities

Current source reality:

* Enemy melee has its own cue.
* Fast, thief, corruption, sentry, and Kernel Sentinel boss events route to typed attack, telegraph, grab/escape, hit, fire, and defeated/shutdown cues.

Implemented assets:

* Small fast enemy attack and defeated cues.
* Thief grab and escape cues.
* Corruption attack and defeated cues.
* Sentry charge and line-fire cues.
* Boss charge, fire, hit, and shutdown cues.

Done:

* Typed metadata and adapter lookup keep routing presentation-only.
* Focused combat/protocol tests and browser proof passed during Phase 36.

#### A4. Sector Themes Have Theme-Aware Ambience

Current source reality:

* `runtime/themes.ts` defines five `audioHint` values.
* `musicTrackForDepth()` maps depth 1, 2, and 3+ to only three sector tracks.
* Victory and defeat have one non-looping track each.
* Theme ambience now routes from `snapshot.theme` through five committed low-gain music-lane loops.

Implemented assets:

* Cold Cache coolant hum and shimmer.
* Corrupted Index glitch bed and narrow data tones.
* Firewall alarm bed and security-field pressure.
* Model Vault restrained sub-bass and archive resonance.
* Kernel Core drive hum and overclocked machine pressure.

Done:

* Added an ambience layer keyed by `snapshot.theme`.
* Kept final ambience loops under `audio/music` and the reviewed 900 KB cap.
* Avoided remote streaming and runtime downloads.

#### A5. Adaptive Music Engine Work Is Implemented

Current source reality:

* `audio.ts` supports adaptive audio requests, cooldown keys, transient ducking, theme ambience ducking, one-shot stingers, and heartbeat behavior.

Implemented assets:

* Dedicated stingers for combat start, low HP, boss reveal, objective unlock, final defense, victory transition, and defeat transition.

Done:

* Added the documented request contract, transient gain behavior, and cooldown protections.
* Added tests and browser/manual closeout evidence.

#### A6. Existing Title And UI Click Audio Are Underused

Current source reality:

* The existing title loop is queued on renderer mount with `playMusic("title")` but does not create an `AudioContext` until `unlock()` runs from a user gesture.
* Runtime controls use `ui_click` for pause/resume, reset, save, and load confirmations.

Done:

* Avoid adding sound to every React button by default; keep audio purposeful.
* Focused audio tests cover title queuing before unlock and explicit cue dispatch.

Resolved by Session 08:

* Manual review accepted the current title loop for shipped pre-run use. Future replacement should happen only in a fresh gameplay tuning session.

#### A7. Audio Dispatch Needs More Structured Event Metadata

Current source reality:

* Many high-value cues now use explicit `event.audioCues`.
* Some fallback paths still infer cues from broad event classes or message text.
* Richer audio identity needs access to actor kind, protocol kind, objective state, status kind, and theme without introducing simulation side effects.

Asset opportunity:

* Treat event metadata as part of the audio asset pipeline:
  * Actor kind for enemy-family cues.
  * Protocol ID for protocol action cues.
  * Status ID for status apply/expire/cleanse cues.
  * Theme ID for ambience or music routing.
  * Objective event kind for vault, terminal, key, compile, and final defense cues.

Likely code changes:

* Continue adding typed fields to existing runtime event objects where appropriate, especially for enemy-family and sector-theme audio.
* Keep the audio adapter as presentation code; do not let sound selection affect deterministic game state.
* Keep tests that prove equivalent events dispatch stable cue IDs.

### Recommended Audio Generation Batches

#### Batch 0. Activate Existing Underused Audio

Status: implemented 2026-06-28.

Goal:

* Use the existing title loop and `ui_click` where they clearly improve the pre-run, settings, or runtime-control experience.

Why first:

* It is the lowest-risk way to test audio unlock, routing, mute, and volume behavior before adding larger replacement packs.

Validation:

* Focused Vitest for audio mapping.
* `bunx playwright test tests/e2e/ai-rogue-runtime.spec.ts`.
* Manual browser check for audio unlock and non-annoying UI click behavior.

#### Batch 1. Core Interaction SFX Pack

Status: compact pass implemented 2026-06-28.

Goal:

* Give common gameplay interactions distinct, short, low-fatigue cues.

Suggested deliverables:

* Wall bump and invalid action.
* Strike swing and successful strike.
* Enemy melee hit.
* Shield absorb and shield break.
* Hazard tick.
* Status applied and status cleansed.
* Shard, health, and reward pickup variations.

Why high value:

* These are frequent enough to define the moment-to-moment audio texture.

#### Batch 2. Protocol And Objective SFX Pack

Status: compact pass implemented 2026-06-28.

Goal:

* Make implemented run systems audible without relying on generic pickup or hit sounds.

Suggested deliverables:

* Protocol pickup cue.
* Patch Kit use.
* Trace Map reveal.
* Signal Jammer pulse.
* Trace Lance fire and impact.
* Phase Step jump and land.
* Key fragment, vault unlock/open, cache open, terminal open, terminal choice accepted, equipment equip, objective unlock, compile payload armed, and final defense survived cues.

Why high value:

* Protocols and objective beats are important decisions; specific audio makes them feel authored.

#### Batch 3. Enemy And Boss Audio Identity Pack

Status: implemented 2026-06-28.

Goal:

* Add family-specific attack, hit, and defeated cues for tactical readability.

Suggested deliverables:

* Small fast enemy ticks.
* Thief grab/escape cue.
* Corruption enemy crackle.
* Sentry charge and line-fire pulse.
* Boss charge, fire, hit, and shutdown sounds.

Why high value:

* Enemy kind can become recognizable by sound, which helps keyboard-heavy and compact-screen play.

#### Batch 4. Sector Theme Ambience Or Music Pack

Status: implemented 2026-06-28 as five low-gain theme ambience beds.

Goal:

* Make each sector theme audible.

Suggested deliverables:

* Five subtle ambience beds, or five theme-specific music loops if the media budget allows it.
* Theme-to-audio routing keyed by `snapshot.theme`.
* Provenance and size-policy notes for every committed file.

Why high value:

* Themes already exist in simulation and text. Audio can make them feel like different spaces without changing gameplay rules.

#### Batch 5. Adaptive Stingers And Engine Expansion

Status: implemented 2026-06-28 with seven dedicated stingers.

Goal:

* Add music moments only after the runtime contract supports them cleanly.

Suggested deliverables:

* Combat start stinger.
* Low HP tension layer or sting.
* Boss reveal sting.
* Objective unlock sting.
* Final defense sting.
* Victory and defeat transition stingers.

Why later:

* This likely needs a second bus, ducking rules, or transient gain automation. That is engine work, not just asset replacement.

### Audio Generation Guardrails

Use these guardrails for every audio batch:

* Generate masters in a scratch location; commit only optimized runtime assets and provenance.
* Keep SFX short and focused, with clean starts and no long tails unless the cue is intentionally ambient.
* Prefer mono 48 kHz Ogg Opus for most SFX unless stereo placement is clearly useful.
* Keep perceived loudness consistent across cue families.
* Keep variations small in count and storage size.
* Do not add sound to every UI action by default; reserve UI sound for actions that benefit from confirmation.
* Do not remote-stream game content.
* Keep deterministic cue selection when using variants.
* Update audio provenance beside the committed files.
* Run `bash scripts/check-asset-sizes.sh` after media changes.

### Source Touchpoints

Audio runtime:

* `src/extensions/ai-rogue/runtime/audio.ts`
* `src/extensions/ai-rogue/runtime/renderer-audio-adapter.ts`
* `src/extensions/ai-rogue/runtime/__tests__/audio.test.ts`
* `src/assets/ai-rogue/audio/music/provenance.json`
* `src/assets/ai-rogue/audio/sfx/provenance.json`

Simulation and event metadata for audio routing:

* `src/extensions/ai-rogue/runtime/combat.ts`
* `src/extensions/ai-rogue/runtime/entities.ts`
* `src/extensions/ai-rogue/runtime/protocols.ts`
* `src/extensions/ai-rogue/runtime/equipment.ts`
* `src/extensions/ai-rogue/runtime/status.ts`
* `src/extensions/ai-rogue/runtime/themes.ts`
* `src/extensions/ai-rogue/runtime/snapshot.ts`

Docs and policy:

* `docs/extensions/ai-rogue/game-feel.md`
* `docs/media-policy.md`

### Validation Checklist For Audio Asset Work

* `bun run typecheck`
* `bun run test -- src/extensions/ai-rogue/runtime/__tests__/audio.test.ts`
* `bun run test -- src/extensions/ai-rogue/runtime/__tests__/combat.test.ts`
* `bun run test -- src/extensions/ai-rogue/runtime/__tests__/protocols.test.ts`
* `bunx playwright test tests/e2e/ai-rogue-runtime.spec.ts`
* `bunx playwright test tests/e2e/ai-rogue-mobile.spec.ts`
* `bash scripts/check-asset-sizes.sh`
* Manual browser check for music unlock, mute behavior, SFX balance, repeated cue fatigue, mobile volume balance, and silent fallback.

### Source Recommended Next Actions

The folded source originally recommended that the next audio-only pass start with one of these. Phase 36 resolved all three by closeout:

1. Manual browser balance review for the 45-cue SFX pack, title loop unlock, UI click restraint, and repeated-combat fatigue - resolved by Session 08 operator sign-off and final validation evidence.
2. Batch 3 enemy-family audio identities, including sentry charge/fire and boss charge/fire/hit/shutdown - resolved by Sessions 02/03.
3. Batch 4 sector-theme ambience or music routing, after deciding whether ambience needs a second bus - resolved by Sessions 04/05 using a low-gain ambience lane.

***

## Planning Assumptions And Resolutions

### Working Assumptions

* The supplied media-finishing split plan is the intended Phase 36 scope. This is supported by the explicit `phasebuild` command argument and by the eight concrete sessions folded into this PRD and the session stubs. It is safe to proceed because the plan is dependency ordered and scoped to AI Rogue audio finishing.
* Phase 35 is complete and is the prerequisite for this phase. This is supported by `.spec_system/state.json`, `.spec_system/PRD/PRD.md`, `.spec_system/CONSIDERATIONS.md`, and `.spec_system/SECURITY-COMPLIANCE.md`. It is safe to proceed because those artifacts record Production Go and no open security or GDPR findings.
* Theme audio planning defaults to five subtle ambience beds unless Session 04 validates that full theme-specific music loops fit the media budget and user experience. Session 05 resolved this with five subtle ambience beds under the music-track cap instead of full replacement loops.
* Adaptive stingers were conditional on Session 01 and Session 06 evidence. Sessions 06/07 resolved this by adding the engine contract before generating seven short stingers, and Session 08 accepted the current pack.

### Conflict Resolutions

* `.spec_system/PRD/PRD.md` and `.spec_system/state.json` ended at completed Phase 35, while the supplied media-finishing plan defines a new eight-session audio phase. The chosen interpretation is that Phase 36 should be created from the supplied plan and the stale master PRD/state should be reconciled. This is best supported because Phase 35 is complete, the command explicitly named the media-finishing plan, and the plan materially defines next-phase scope. Reconciled artifacts: `.spec_system/PRD/PRD.md` and `.spec_system/state.json`.

***

## Technical Considerations

### Architecture

AI Rogue audio remains a presentation-layer concern. Simulation events may expose typed metadata for routing, but audio selection must not affect simulation state, RNG, replay behavior, or save data. The renderer audio adapter should keep autoplay unlock, mute, volume, lazy decode, music crossfades, one-shots, heartbeat loop, and silent fallback behavior intact.

### Technologies

* TypeScript runtime and simulation modules.
* Web Audio API.
* Ogg Opus runtime assets.
* Vitest for audio and simulation tests.
* Playwright for desktop and mobile runtime checks.
* `bash scripts/check-asset-sizes.sh` for media policy validation.

### Risks

* Perceived balance and cue fatigue cannot be validated by headless tests: require manual browser review early and at closeout.
* New audio files can exceed media caps or bundle budget: keep masters out of source, commit only optimized runtime assets, and run asset-size checks after every media change.
* Enemy or theme routing could leak presentation details into deterministic simulation behavior: keep routing metadata typed and one-way toward the audio adapter.
* Adaptive stingers can clutter gameplay: keep them conditional, short, and tested against repeated trigger behavior.

### Relevant Considerations

* \[P34-P35] **AI Rogue is production default-enabled**: Preserve the Production Go posture and explicit `none` disable path.
* \[P31-P35] **Public-demo and AI Rogue gates stay bundled**: Keep asset-size, no-remote, privacy, no-bridge, browser, Pages, and playthrough checks bundled for release validation.
* \[P30/P32/P34-P35] **Route-lazy runtime ownership scales**: Keep audio runtime behavior behind the Play route/local facade and the narrow runtime boundary.
* \[P30/P34-P35] **Visibility gates catch real issues**: Pair focused audio tests with browser checks, build/budget, private-runtime, no-remote, Pages, playthrough, and D3 scans before widening behavior.
* \[P30/P32/P34-P35] **Do not widen AI Rogue capabilities without review**: Audio finishing must not add collectors, WebGPU-only requirements, workers, remote loading, hosted writes, analytics, or expanded content without fresh review.

***

## Success Criteria

Phase complete when:

* [x] All 8 sessions completed
* [x] Current 45-cue baseline has documented balance review results.
* [x] Enemy-family and boss audio identities are typed, routed, tested, optimized, and documented.
* [x] Sector themes have a tested audio routing contract and selected runtime assets within media policy.
* [x] Adaptive stingers are either implemented through a tested contract or explicitly deferred with evidence from playtesting.
* [x] Provenance and media-policy docs cover every committed audio file.
* [x] The full audio validation matrix passes or records concrete blockers.
* [x] No new hosted runtime, public-demo, privacy, remote-loading, or deterministic-simulation boundary violation is introduced.

***

## Dependencies

### Depends On

* Phase 35: AI Rogue Audit Hardening And Refactor
* The folded source baseline in this PRD and the Phase 36 session stubs.

### Enables

* Future AI Rogue gameplay tuning, content polish, and media finishing phases can build on stable audio routing, provenance, and validation contracts.


---

# 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/phases/phase_36/prd_phase_36.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.
