Repository Public
1<!--2ORIX Sonata3File: Documentation/spec/project-format.md4Author: Simon-Pierre Boucher5Contact: contact@spboucher.ai6-->7# The `.sonataproject` format (format 2)89A project is a directory (a macOS package) holding **user data only**. Implementation:10`Packages/SonataProject`; tests: round trip, migration from format 1, path safety, missing files.1112```13Name.sonataproject/14 project.json manifest: format, id (UUID), name, languageVersion, main, created, modified, assets[], writtenBy15 studio.json studio state: overrides (strips, notes), loop range, metronome, track colours and heights16 src/*.sonata sources; `main` designates the entry (default src/main.sonata)17 instruments/*.sonatainstrument instrument definitions saved from Instrument Lab (Sonata source)18 assets/ imported audio, content-addressed names (first 16 hex digits of the SHA-256 + extension)19```2021Outside the bundle, per project id:2223| What | Where | Regenerable |24|---|---|---|25| Waveform overviews, frozen bounces, compile cache | `~/Library/Caches/ai.spboucher.orix.sonata/projects/<id>/` | yes — safe to delete |26| Backups of the sources before each save (20 kept) | `~/Library/Application Support/ORIX Sonata/Backups/<id>/` | no |27| Unsaved edits (crash recovery) | the system's document autosave (`~/Library/Autosave Information/` for untitled documents, in place for saved ones) | managed by macOS |2829## Rules3031- **The code is canonical.** `studio.json` holds explicit overrides in the exact schema of32 `sonata_ir::Overrides`; the compiler applies them after compilation. Each note override carries33 the start and pitch of the note it edited: if the code changed that note, the override is34 reported as a conflict and skipped — never applied to a different note, never written back35 into the source silently. Deleting `studio.json` returns the project to exactly what the code says.36- Paths in the manifest are relative, inside `src/`, `instruments/` or `assets/`; no `..`, no37 absolute path, no backslash or control character; a file that resolves outside the bundle38 through a symlink is skipped with a warning.39- Writes are atomic per file (temporary file + rename); the manifest is written last; a new40 bundle is assembled in a temporary directory and moved into place in one step. `assets/` and41 files the format does not know are never modified or removed.42- Missing assets and an unreadable `studio.json` do not prevent opening: they are listed to the user.43- A manifest with a newer `format` than the application is refused with a clear message; older44 formats are migrated in memory and rewritten on the next save.45- No secret is ever stored in a project. API keys of the optional assistant live in the Keychain.46- Limits: 4 MiB per source file, 2 GiB per asset.4748## Format history4950| Format | Change |51|---|---|52| 1 | development format: `entry` instead of `main`, no `assets`, dates as seconds since 1970 |53| 2 | current |54