|
| 1 | +# FluidAudio Planning Playbook |
| 2 | + |
| 3 | +This guide defines how Codex should create comprehensive plans before tackling any complex or high-risk change. Use it to think like a principal engineer: deeply understand the problem, map unknowns, evaluate trade-offs, and chart a confident path to execution. |
| 4 | + |
| 5 | +## When to Produce a Plan |
| 6 | + |
| 7 | +- The request touches multiple subsystems, alters concurrency behavior, or impacts the audio pipeline. |
| 8 | +- Unclear requirements, ambiguous success criteria, or new product surface areas. |
| 9 | +- Any task where you would want peer alignment before coding (≈ 2+ hours of work). |
| 10 | +- If in doubt, write the plan. Plans create clarity and expose risks early. |
| 11 | + |
| 12 | +## Plan Creation Workflow |
| 13 | + |
| 14 | +1. **Restate the Mission** |
| 15 | + - Summarize the problem in your own words. |
| 16 | + - List explicit goals, non-goals, stakeholders (CLI users, diarizer pipeline, model loaders), and success criteria (latency/accuracy targets, UX expectations, guardrails). |
| 17 | +2. **Gather Critical Context** |
| 18 | + - Identify relevant modules (e.g., `Sources/FluidAudio/ASR`, `Shared`, CLI commands). |
| 19 | + - Note existing patterns (managers, configs, async actors) and style constraints from `AGENTS.md`. |
| 20 | + - Capture external constraints: CoreML availability, threading rules, no mock models/tests without request. |
| 21 | +3. **Baseline the Current State** |
| 22 | + - Highlight key entry points, data flows, and known bottlenecks. |
| 23 | + - Link to reference files with line numbers when known. |
| 24 | + - Record metrics or logs worth reproducing before changes. |
| 25 | +4. **Clarify Unknowns & Research Needs** |
| 26 | + - Enumerate hard questions you must answer (APIs, model formats, concurrency requirements). |
| 27 | + - Plan validation steps: docs to read, experiments to run, SMEs to consult. |
| 28 | + - Flag “unknown unknowns” by stating the assumptions that could break and how to detect them early. |
| 29 | +5. **Enumerate Solution Options** |
| 30 | + - Describe at least 2 viable approaches when possible. |
| 31 | + - For each option, assess complexity, blast radius, performance impact, and alignment with existing architecture. |
| 32 | + - Call out irreversible steps or migrations that need extra caution. |
| 33 | +6. **Select a Direction with Rationale** |
| 34 | + - Explain why the chosen path wins (safety, maintainability, scalability). |
| 35 | + - Note mitigations for rejected options if they might resurface. |
| 36 | +7. **Define Success Conditions & Test Strategy** |
| 37 | + - Translate success criteria into measurable checkpoints (CLI command output, diarization accuracy deltas, error budget). |
| 38 | + - Decide which test layers are necessary: targeted unit coverage, integration via `FluidAudioCLI`, or end-to-end audio runs. |
| 39 | + - Outline data and tooling needed (reference audio files, golden transcripts, log comparison scripts) and ensure availability without violating rules. |
| 40 | + - Plan how to validate concurrency or performance requirements (profiling, benchmarking harnesses, timing instrumentation). |
| 41 | +8. **Implementation Strategy** |
| 42 | + - Break down into ordered work chunks that can be executed and validated independently. |
| 43 | + - Structure chunks into isolated deliverables: each should have a clear owner, inputs/outputs, review expectations, and demoable end state. |
| 44 | + - Include source files per step and expected code-level adjustments (new actor, config struct, CLI flag, etc.). |
| 45 | + - Consider concurrency, error handling, streaming behavior, and API surface consistency. |
| 46 | + - Capture outstanding tasks as TODO items with status (e.g., `[ ] perf benchmark`, `[ ] model warmup profiling`) so progress is transparent. |
| 47 | +9. **Validation Plan** |
| 48 | + - Define how you will build confidence without adding new tests unless the user requests them; when tests are required, map them to the chosen strategy. |
| 49 | + - Outline manual workflows (audio samples to run, CLI commands, logging to inspect). |
| 50 | + - Specify regression risks and monitoring hooks (e.g., `AppLogger`, timing metrics). |
| 51 | +10. **Risk & Rollback Analysis** |
| 52 | + - List failure modes (performance regressions, model load failures, memory spikes). |
| 53 | + - Provide rollback/feature flag strategies if applicable. |
| 54 | + - Call out any required coordination (model downloads, doc updates). |
| 55 | +11. **Execution Checklist** |
| 56 | + - Pre-flight checks: models available, environment constraints understood. |
| 57 | + - Dependencies or blocking tasks resolved. |
| 58 | + - Communication artifacts (status updates, follow-ups) noted. |
| 59 | + |
| 60 | +## Strategic Dimensions to Address |
| 61 | + |
| 62 | +- **Performance Budgets**: Define latency, memory, and energy budgets up front; ensure plans track how each step impacts real-time ASR/VAD throughput on target hardware. |
| 63 | +- **Resource Logistics**: Confirm model availability, download sizes, and CoreML compilation costs; decide how to stage large artifacts and prewarm caches or embeddings. |
| 64 | +- **Observability Enhancements**: Identify logging, metrics, and tracing gaps; plan instrumentation so regressions surface quickly without noisy logs. |
| 65 | +- **Concurrency & Isolation**: Validate actor boundaries, task cancellation behavior, and thread-hopping patterns; document how you prevent deadlocks, priority inversions, or data races. |
| 66 | +- **Security & Privacy**: Check for surface areas handling user audio/text; ensure encryption, temporary file hygiene, and GDPR/CCPA considerations align with company policies. |
| 67 | +- **Compatibility Matrix**: List supported OS versions, device classes, and architecture constraints; plan fallbacks or degradation strategies for unsupported environments. |
| 68 | +- **Deployment & Rollout**: Decide on feature flags, CLI toggles, migration steps, and documentation updates; outline canary or staged rollout procedures when risk is high. |
| 69 | +- **Coordination Points**: Identify stakeholders (research, infra, product) who must review decisions; schedule syncs and note dependencies on external deliverables. |
| 70 | +- **Knowledge Transfer**: Plan for updating README, AGENTS.md, or architecture diagrams so future engineers inherit the context without guesswork. |
| 71 | +- **Post-Delivery Follow-Up**: Define success metrics, monitoring windows, and retrospective checkpoints to capture learnings for the next iteration. |
| 72 | + |
| 73 | +## Plan Quality Bar |
| 74 | + |
| 75 | +- Concise yet thorough—capture reasoning, not code-level details. |
| 76 | +- Reference facts with sources (file paths, docs) to ground assumptions. |
| 77 | +- Spotlight ambiguities instead of guessing; propose how to eliminate them. |
| 78 | +- Explicitly document trade-offs so future readers can revisit choices. |
| 79 | +- Plans should be actionable for any senior engineer to execute without further clarification. |
| 80 | + |
| 81 | +## Working Notes Etiquette |
| 82 | + |
| 83 | +- Store the active plan in `.mobius/` with a descriptive filename (e.g., `.mobius/plan_offline_diarizer_refactor.md`); do not commit plan files. |
| 84 | +- Update the plan after completing significant milestones or when assumptions change. |
| 85 | +- Keep a changelog section if the plan evolves materially. |
| 86 | + |
| 87 | +Treat the plan as the contract between intent and execution. Comprehensive planning shortens feedback loops, reduces risk, and makes implementation almost mechanical. |
0 commit comments