Skip to content

Commit d24a931

Browse files
committed
Add PLANS.md - codex tip from OpenAI
1 parent 93bd9cf commit d24a931

3 files changed

Lines changed: 103 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,6 @@ Documentation/parakeet-tdt/
104104
docs/parakeet-tdt/
105105

106106
fluidaudio_cli/*
107+
.vscode/
108+
109+
.mobius/

AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# FluidAudio - Agent Development Guide
22

33
## Build & Test Commands
4+
45
```bash
56
swift build # Build project
67
swift build -c release # Release build
@@ -11,23 +12,35 @@ swift format --in-place --recursive --configuration .swift-format Sources/ Tests
1112
```
1213

1314
## Architecture
15+
1416
- **FluidAudio/**: Main library (ASR/, Diarizer/, VAD/, Shared/ modules)
1517
- **FluidAudioCLI/**: CLI tool with benchmarking and processing commands
1618
- **Tests/FluidAudioTests/**: Comprehensive test suite
1719
- **Models**: Auto-downloaded from HuggingFace with CoreML compilation
1820
- **Processing Pipeline**: Audio → VAD → Diarization → ASR → Timestamped transcripts
1921

2022
## Critical Rules
23+
2124
- **NEVER** use `@unchecked Sendable` - implement proper thread safety with actors/MainActor
2225
- **NEVER** create dummy/mock models or synthetic audio data - use real models only
2326
- **NEVER** create simplified versions - implement full solutions or consult first
2427
- **NEVER** run `git push` unless explicitly requested by user
2528
- **ONLY** add or run tests when explicitly requested by the user
2629

2730
## Code Style (swift-format config)
31+
2832
- Line length: 120 chars, 4-space indentation
2933
- Import order: `import CoreML`, `import Foundation`, `import OSLog` (OrderedImports rule)
3034
- Naming: lowerCamelCase for variables/functions, UpperCamelCase for types
3135
- Error handling: Use proper Swift error handling, no force unwrapping in production
3236
- Documentation: Triple-slash comments (`///`) for public APIs
3337
- Thread safety: Use actors, `@MainActor`, or proper locking - never `@unchecked Sendable`
38+
39+
## Clean code
40+
41+
- When adding new interfaces, make sure that the API is consistent with the other model managers
42+
- Files should be isolated and the code should contain a single responsibility for each
43+
44+
## Mobius Plan
45+
46+
When users ask you to perform tasks that might be more compilcated, make sure you look at PLANS.md and follow the instructions there to plan the change out first and follow the instructions there. The plans should be in a .mobius/ folder and never committed directly to Github

PLANS.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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

Comments
 (0)