License: these specifications are published under the Creative Commons Attribution 4.0 International license (CC BY 4.0). You may copy, adapt and build on them, including commercially, if you credit ProDesigner and link to this page.

The license covers the specifications only. ProDesigner's software and source code are not covered by it and remain proprietary.

The Markdown source · The ProDesigner document format

Contents
  1. 1. Physical form
  2. 2. Top-level structure
  3. 3. Identity
  4. 4. The payload
  5. 5. Assets
  6. 6. Server contract
  7. 7. Versioning and migration path
  8. 8. Validation
  9. 9. What this spec deliberately does not define

ProDesigner Recipe Envelope — Specification v1 (draft 1)

License: This specification is published under the Creative Commons Attribution 4.0 International license (CC BY 4.0). You may copy, adapt and build on it, including commercially, if you credit "ProDesigner" and link to https://www.prodesigner.app/spec/. The license covers this document only; ProDesigner's software and source code are not covered by it and remain proprietary.

Status: Draft 1 — founder-approved 2026-08-05 · Last updated: 2026-11-18 Format version: 0.1.0-draft.1 · Format id: prodesigner/recipe-envelope

References to other ProDesigner documents (other specifications, the decision log, source files) are to the project's own records, which are not published; this document stands on its own for reading and writing the format.

This document specifies the recipe envelope: the stable, format-agnostic wrapper in which the tools' project documents are stored — locally and in the cloud — before the full recipe format (recipe-v1.md, not yet written) exists. It was the thin slice of the project's first phase that unblocked the account and cloud-storage work.

The envelope exists to guarantee one property: everything outside the payload is stable forever; everything inside the payload is allowed to change. Servers, blob stores, quota logic, file listings, and sync code read only the envelope. Tool schemas evolve freely inside it. This is what lets the backend serve, unmodified, the tools as they are, the recipe format when it lands, and the ProDesigner editor (Studio). Corrected 2026-11-18: the one exception is the document envelope (§4.3), whose payload the sync service reads and repairs (§6).

Grounded on format-v1.md (founder-reviewed 2026-08-04) and first verified against packages/core/src/ and the seven tool sources that saved projects on 2026-08-05; checked against the code again on 2026-11-18. Every borrowed convention is cited by section; the envelope adds no conventions of its own.


1. Physical form#

A recipe envelope is a directory package with extension .pdrecipe, mirroring format-v1 §1:

sunset-dither.pdrecipe/
  recipe.json          # the envelope (this spec)
  assets/              # binary assets, content-addressed (format-v1 §8)
    sha256-3f8a…c2.jpg
  proxies/             # optional low-res stand-ins (same naming)

recipe.json is UTF-8 JSON, serialized deterministically per format-v1 §1: spec-ordered keys (unknown keys last, alphabetically), two-space indentation, no trailing whitespace. The directory form is canonical; a zipped transport form (.pdrecipez) MAY be supported later, mirroring .prodocz.

Corrected 2026-11-18 — the forms in use. No implementation writes or reads the directory package yet. What is written today:

  • A single envelope file, <name>.pdrecipe.json: the envelope's JSON exactly as stored, without its assets' bytes. This is what a tool's "download project" and the file list's download give.
  • The account export, one ZIP of stored (uncompressed) entries: docs/<id>.pdrecipe.json for each envelope, byte for byte, and assets/<hash> once for each asset any of them names. An asset entry's file in the manifest is assets/ plus its hash, optionally followed by an extension.

Cloud form. In cloud storage the package is not stored as a directory: the envelope is one object, stored under its document id, and each asset is a separate content-addressed object (keyed by its hash) in the blob store; the envelope's assets manifest is the join. The directory package is the local/export serialization of the same structure. One blob store shape serves both (format-v1 §8's rationale, unchanged).

2. Top-level structure#

{
  "format": "prodesigner/recipe-envelope",
  "formatVersion": "0.1.0-draft.1",
  "id": "rcp_01j1z3…",
  "tool": "dither",
  "meta": { … },
  "payload": { … },
  "payloadFormat": "halftide-preset",
  "payloadVersion": "10",
  "assets": { … },
  "ext": { }
}
FieldReqRead by serverDescription
format✓✓Always "prodesigner/recipe-envelope". Cheap sniffing (format-v1 §2).
formatVersion✓✓Semver of this spec, per format-v1 §9.
id✓✓Stable document ID, rcp_ prefix (§3). Minted once, never reused.
tool✓✓One of the registry in §4.1. Drives the /files page badge and open-with routing.
meta✓✓Title, timestamps, generator (§2.1).
payload✓neverThe tool's native project document, verbatim and opaque (§4).
payloadFormat✓✓Registry string identifying the payload's native schema (§4.1).
payloadVersion✓✓The payload's own version, in the payload's native versioning scheme, as a string.
assets✓manifest onlyContent-addressed asset manifest, byte-identical to format-v1 §8 (§5).
extneverNamespaced extension data per format-v1 §10. Core code never reads it.

2.1 meta#

{
  "title": "Sunset dither, v2",
  "created": "2026-08-05T14:00:00Z",
  "modified": "2026-08-05T16:12:09Z",
  "generator": "dither/10"
}

Same shape and rules as format-v1 §2.1, minus lang (recipes have no document language) and minus source (no importers yet; the field is reserved and MUST round-trip if present).

3. Identity#

Per format-v1 §3: <prefix>_<26-char Crockford ULID>, lowercase, minted once, never reused or renamed. This spec adds one prefix to the registry:

  • rcp — recipe envelope (and, later, recipe documents proper)

The reference implementation holds the prefix registry in ID_PATTERN (packages/core/src/id.ts) and the IdPrefix type (types.ts); rcp was added to both after this spec, the code change following the spec change.

Asset IDs inside envelopes use the existing ast prefix unchanged.

4. The payload#

The payload is the tool's native project document, stored verbatim. The envelope takes no position on its shape.

Normative rules:

  1. Envelope readers never interpret the payload. Servers, sync code, quota logic, and the /files page read only envelope fields. The only code that parses a payload is the named tool (and, later, the recipe-v1 migrator).
  2. Payloads round-trip untouched. A reader that rewrites an envelope MUST preserve the payload byte-for-byte semantically (deterministic re-serialization of identical JSON is permitted). Format-v1 §9's unknown-field rule applies to the entire payload subtree by construction.
  3. Asset references move out of the payload's control. Where a native format embedded data URLs (SpectralProject) or bare filenames (.giflab), the envelope's assets manifest is now authoritative: the payload references assets by ast_ ID, and the wrapping tool rewrites its native reference to the ID at save time. This is the one mandatory change per tool, and it is the change that makes cloud saves round-trip — the whole point of the exercise, since before the envelope nothing could round-trip a source asset. Corrected 2026-11-18: what holds for every tool is that the assets manifest lists every file the envelope stores, and the server counts references from the manifest alone. Not every payload refers to its assets by ast_ id: several still carry small pictures inline as data URLs (the fabric mockup's tile, the flag mockup's picture, the 3D mockup's applied artwork, the palette sheet's uploaded fonts as base64), and some name files inside one archive asset by path (business-card-studio, video-channel-mockup-studio). The SpectralProject example above was wrong: that format never embedded media.

4.1 Tool and payload-format registry (v1)#

Closed registries, extended by spec revision only (mirroring the entity-kind decision in docs/decisions.md, 2026-08-04).

toolpayloadFormatNative versioning → payloadVersion
gifgif-projectGifProject.version (string — currently "1.0.0"; the type was named GifLabProject when this row was written)
gifedittimeline-projectDoc.version (number, as string — currently "1")
avfxspectral-projectSpectralProject.formatVersion (number, as string — currently "2")
tartantartan-patternthe project's version (number, as string — currently "4"; this row said "1" until Tartan versions its type, and it has)
ditherhalftide-presetschema_version (number, as string — currently "10")
asciiascii-workspace"1" until versioned
vectorvector-settings"1" until versioned
svgcrsvgcr-settings"1" until versioned
background-removercutout-settingsthe tool's own version (as string — currently "2")
image-vector-viewerviewer-collection"1" until versioned
holographic-texture-generatorholo-foil-recipefirst field of the recipe string — currently "9"
logo-pattern-generatorbrand-pattern-kitpayload.v (number, as string — currently "4"; the site reader still opens "1"–"3")
cross-stitch-pattern-makercross-stitch-patternpayload.v (number, as string — currently "1")
documentprodocformat-v1.md's formatVersion (currently "1.0.0-draft.1"). What Studio writes today (corrected 2026-11-18): every Studio document is saved as tool document, format prodoc, version "1.0.0-draft.1", and the sync service (§4.3) accepts only this tool. The plan of 2026-09-17 — this row legacy, read indefinitely and rewritten to studio / studio-project on the next save (studio-v1.md §2) — has not been carried out
studiostudio-projectformat-v1.md's formatVersion (a format-v1 document under Studio's own row — the risograph / relief-print precedent of 2026-09-16, so payloadFormat still names one reader). Added 2026-09-17 — ProDesigner Studio, the editor. Reserved, not written yet (corrected 2026-11-18): Studio still saves under document / prodoc
holographic-sticker-mockupsticker-mockup-scenepayload.v (number, as string — currently "3")
vector-stampstamp-recipepayload.v (number, as string — currently "1")
palette-studiopalette-sheetpayload.v (number, as string — currently "2")
embroidery-digitizerembroidery-projectpayload.v (number, as string — currently "1")
fabric-mockupfabric-mockup-projectpayload.v (number, as string — currently "3", since 2026-09-14: v2 added controls.breeze and a wind section, v3 controls.form; earlier versions read with those at their defaults)
flag-mockupflag-mockup-projectpayload.v (number, as string — currently "1")
neon-sign-generatorneon-sign-projectpayload.v (number, as string — "1"). Retired (corrected 2026-11-18): the tool has been removed; the row stays because saved files may carry it, and its values are never reissued
risographriso-projectschema_version (number, as string — currently "10"; the halftide-preset document under the risograph tool's own row)
relief-printrelief-projectschema_version (number, as string — currently "10"; the halftide-preset document under the relief print tool's own row)
seamless-pattern-studiopattern-tilepayload.v (number, as string — currently "16")
3d-mockup-studio3d-mockup-scenepayload.v (number, as string — currently "2")
business-card-studiobusiness-card-scenepayload.v (number, as string — currently "1")
invoice-studioinvoice-documentpayload.v (number, as string — currently "1"). Added 2026-10-01 — Estimate & Invoice Studio; the PDF is the one source asset
redact-pdfpdf-redactionpayload.v (number, as string — currently "1"). Added 2026-10-07 — Redact PDF; the ORIGINAL PDF is the one source asset
video-channel-mockup-studiochannel-mockuppayload.v (number, as string — currently "1"). Added 2026-10-13 — Video Channel Mockup Studio; every picture is in the one source asset, an archive
effects-labeffects-lab-recipepayload.v (number, as string — currently "2"). Added 2026-11-08 — Effects Lab, one tool of instruments (Gradient Sculptor first); a recolor's or an outline's picture is the one source asset
my-fontsfont-collectionpayload.v (number, as string — currently "1"). Added 2026-10-01 — not a tool's project: one per account, the fonts a person uploaded behind their rights statement (the invoice studio's internal brief), each an assets entry of kind: "font" so the sweep keeps it. Private (sharing-v1.md §4a): never in a space, never published, never served to anyone but its owner, and not in GET /api/docs unless asked for with ?tool=my-fonts

Two private stores outside the table (added 2026-11-18). Studio also saves two envelopes that are not a tool's project and are not rows of the table above (the table is the registry the reference library checks, and these two are not in it yet):

  • tool brand-kit, payload format brand-kit: payload.v (number, as string — currently "1"). Added 2026-11-18, retroactively — saved by Studio since 2026-10-31: not a tool's project but one per account, the person's brand colors, text styles, logos, pictures and components; each file it holds is an assets entry so the sweep keeps it. Private, as my-fonts is: never in a space, never published, never served to anyone but its owner, and not in GET /api/docs unless asked for with ?tool=brand-kit. A document takes its own copy of anything it uses from the kit
  • tool uploads, payload format uploads: payload.v (number, as string — currently "1"). Added 2026-11-18, retroactively — saved by Studio since 2026-11-08: not a tool's project but one per account, the pictures a person adds to their uploads library, each an assets entry. Private, as my-fonts is, and not in GET /api/docs unless asked for with ?tool=uploads. A picture placed in a document becomes that document's own and follows its sharing

The reference validator warns on a tool it does not know, and does not refuse the envelope.

The background-remover and image-vector-viewer rows were added 2026-08-18, retroactively: both tools shipped on 2026-08-17 saving under tool values this table did not list, and validateEnvelope() admitted them as warnings per §9 forward compatibility — so nothing broke, and nothing reported it either. Their tool values are the full site slugs rather than the short codes the earlier rows use. That is deliberate: the values are already in saved files, and renaming a registry entry to be tidy would orphan every envelope written under the old name. The registry follows what shipped; it does not get to rewrite history.

2026-08-29 — the first row added BEFORE its tool exists. The holographic-sticker-mockup row was written while packages/tool-sticker-mockup was still four files and no application, and that is the point: this table has been extended retroactively twice, and both times the argument for doing it properly was made after the archaeology. There is nothing to reconstruct here.

Two notes on the values, because they cannot be changed later.

The tool value is the site slug, following background-remover and the three rows above it rather than the short codes at the top of the table. It is also the slug the variant page /tools/holographic-sticker-mockup/ already occupies — that variant is being retired and the new tool takes its URL, a founder decision on 2026-08-29, so the slug is settled before anything is saved under it.

The payloadFormat is sticker-mockup-scene and not sticker-mockup, because a scene is what the payload actually is: a camera, a light, a background and a list of items. The foil recipe is not in it — each item carries a holographic-texture-generator serial as an opaque string, and this tool never parses one. Two tools, two payload formats, and the mockup's own registry row does not make it an owner of the other's format.

2026-09-09 — the second row added before its tool exists. The embroidery-digitizer row lands with the engine package (packages/tool-embroidery-digitizer, Milestone A of embroidery-digitizer-v1.md) and before any application or site registration, following the sticker-mockup precedent above. The tool value is the site slug. The payloadFormat is embroidery-project — the payload is the whole project (design, materials, palette, objects, and the cached stitch plan) — and NOT embroidery-project-v1 as the spec's first draft proposed: no row carries a version suffix, because the version lives in payload.v / payloadVersion.

2026-09-18 — 3d-mockup-studio. The row lands with the engine (packages/tool-3d-mockup-studio), the application (apps/3d-mockup-studio) and the site registration in one day, the flag-mockup precedent. The tool value is the site slug, the founder's brief's own name ("3D Mockup Studio"), permanent from this commit. The payloadFormat is 3d-mockup-scene, no version suffix. The payload is the scene as settings — the model's file name and fingerprint (part names with face counts, which is how the mapping preset re-applies), each part's role, colour and finish, the artwork's source name, page-layer visibility, crop in page millimetres and raster size, the raster as applied at no more than 2048 px (a data URL, the working copy a saved scene reopens with), the mapping preset's id AND its resolved offset / scale / rotation numbers (so a save opens exactly as it rendered after the preset is revised), the board, the lighting and the camera. The mesh is never in the payload: a 52 MB OBJ is the designer's file, asked for again on opening.

2026-11-08 — effects-lab. The row lands with the engine (packages/tool-effects-lab), the application (apps/effects-lab) and the site registration (unlisted, in beta), on the founder's internal brief of the same day. The tool value is the site slug, confirmed by the founder the same night, permanent from this commit. The payloadFormat is effects-lab-recipe, no version suffix. One payload for the whole tool: v, the instrument that was in front, the picture's size, and one field per instrument — today gradient (its stops as a list of small maps with stable ids, never index-keyed, so the list can become a Y.Array of Y.Map; the curve, midpoint and bump of the segment ending at each stop; the used range, repeat, soften, shape, background, dither, seed and locks) — plus the person's own presets (mine) and the workspace's view (never in a URL). A later instrument is an additive field. The picture a recolor or an outline is made from is the envelope's one asset; nothing else is a picture. Corrected 2026-11-18: the payload is at version 2 and now also carries sphere and lens (two more instruments, 2026-11-09) and the person's own filters and kept effect presets (2026-11-11), each optional and absent when unused.

2026-10-13 — video-channel-mockup-studio. The row lands with the engine (packages/tool-channel-mockup), the application (apps/video-channel-mockup-studio) and the site registration (unlisted, in beta), on the founder's brief of the same day. The tool value is the site slug, from the founder's name for it, permanent from this commit. The payloadFormat is channel-mockup, no version suffix. The payload is the platform, device and look of the mockup, the channel's words, the profile picture's id, crop and initials color, the banner as a composition (a background and picture and type layers, in units of the platform's safe area), the videos on the page, and the table of pictures. Every picture is in the envelope's one asset, a stored ZIP of <id>.<ext> files; no file name and no video link is kept.

2026-10-07 — redact-pdf. The row lands with the engine (packages/tool-pdf-redact), the application (apps/redact-pdf) and the site registration (unlisted, in beta), on the founder's brief of the same day. The tool value is the site slug, permanent from this commit. The payloadFormat is pdf-redaction, no version suffix. The payload is the marks — each a rectangle in its page's PDF user space, with the text it was made from and a box's own label when it has one — and the settings (the fill, the label on every box, its size, the clean-up options); never a picture. The ORIGINAL, unredacted PDF is the envelope's one asset, which is why the tool's Save says so as it saves and why the tool offers no Share: a redacted file is sent by exporting it.

2026-10-01 — invoice-studio. The row lands with Save to account in the tool's phase 3 (packages/tool-invoice, apps/invoice-studio; the site registered the tool, unlisted, the same day). The tool value is the site slug, the founder's name for it ("Estimate & Invoice Studio"), permanent from this commit. The payloadFormat is invoice-document, no version suffix. The payload is the reading the person confirmed — every field with its places on the file's pages, the line items, the flags, the money format — and the edits on it; never the page model. The PDF is the envelope's one asset and is read again on opening: the reader is deterministic, and a reading that no longer fits its file is read afresh and the person told (openProject). A saved document holds the person's clients' details; the tool says so beside Save.

2026-09-25 — business-card-studio. The row lands with the engine (packages/tool-business-card-studio), the application (apps/business-card-studio) and the site registration, the 3D mockup studio's precedent. The tool value is the site slug, the founder's final name ("Business Card Studio"), permanent from this commit. The payloadFormat is business-card-scene, no version suffix. The payload is the RESOLVED values of the seven preset categories — so a later build that improves a built-in preset never changes how an old card looks — the preset each category came from (a label, never re-applied), the locks, the person's own presets (saved with the project, which is why saving one needs an account), the motion clock and the card's roll. The artwork is not in the payload: both faces' pixels and every mask channel, exactly as the stage draws them, and the files they were read from, are entries in ONE archive, the envelope's single asset, which the payload names by path. The envelope's 5 MB cap is why.

2026-09-18 — seamless-pattern-studio. The row lands with the engine (packages/tool-seamless-pattern-studio, the first phase of the founder's internal brief) and before any application or site registration, the embroidery-digitizer precedent. The tool value is the site slug, settled in the brief and permanent from this commit: the registry is closed and its values are never renamed. The payloadFormat is pattern-tile, the brief's own name, with no version suffix. The payload is the tile's physical size and unit, the repeat mode, the background, the current nib, and every stroke in BOTH forms — its pen samples with the nib it was made with (what makes it re-renderable when the brush changes) and its fitted cubic outline in unwrapped tile space (what tiles and exports). The clipped tile and the super-tile are never stored: both are the orbit of the strokes under the repeat's wallpaper group, re-derived on read.

2026-09-14 — flag-mockup. The row lands in the same revision as the engine (packages/tool-flag-mockup, over the physics lifted into packages/cloth-sim the same day), the application (apps/flag-mockup) and the site registration. The tool value is the site slug. The payloadFormat is flag-mockup-project: both control layers in full, the camera, the jitter seed and the processed picture — and deliberately no cloth positions, because a flag is never at rest: a saved project reopens hanging and the wind takes it within a second, which is the one honest picture of a flag there is.

2026-09-16 — risograph and relief-print. Two rows for two tools that were modes of dither until this day (an internal brief of that day). They are three builds of one application (apps/dither, PD_TOOL) over one engine package; each build writes its own row and reads the same halftide-preset-shaped document (schema_version, state) — the format names differ so /files opens a project in the tool that wrote it. What does not change: a risograph or relief document saved before this day is a dither / halftide-preset envelope and stays one; the dither build keeps the three modes as a legacy reader and neither new tool parses halftide-preset (the sticker-mockup rule: no second reader of a format the tool does not own). The tool value is the site slug, and risograph takes over the variant page's URL rather than moving it.

2026-09-14 — neon-sign-generator. The row lands in the same revision as the engine (packages/tool-neon), the application (apps/neon) and the site registration. The tool value is the site slug. The payloadFormat is neon-sign-project and carries no version suffix: the brief proposed neon and neon-sign-v1 and asked for exactly this check — both yield to this section's two rules, that the value is the slug and that the version lives in payload.v / payloadVersion. The payload is the strokes as drawn with their constraints (tube breaks, blockout, lit) as the source, plus the settings a sign is read under; the assembled tubes, circuits and cables ride along as a deterministic cache that the reader re-derives with assemble() and never trusts, so an old sign reopens as the current assembler's own answer rather than as a stale one's. Corrected 2026-11-18: the tool, its engine and its application have since been removed. The row stays: saved files may carry it, and a registry value is never removed or reissued.

2026-09-13 — fabric-mockup. The row lands in the same revision as the engine (packages/tool-fabric-mockup), the application (apps/fabric-mockup) and the site registration — the rule below, kept. The tool value is the site slug. The payloadFormat is fabric-mockup-project: the payload is both control layers in full, the camera, the drape seed and the processed tile, and deliberately NOT the settled cloth — the solver is deterministic in the seed (packages/tool-fabric-mockup/test/cloth.test.ts pins it), so a saved project reopens by solving again rather than by carrying 60 KB of positions that a later solver could disagree with.

The rule this omission argues for: a tool ships with its registry row, in the same revision. Cheap in advance, archaeology afterwards. This spec had no such rule written down when those two tools shipped, which is part of why they shipped without rows.

And the rule did not hold, which is the more useful finding. The holographic-texture-generator row was added 2026-08-20, retroactively again: the tool shipped on 2026-08-19 saving holo-foil-recipe, listed in neither this table nor packages/recipe/src/envelope.ts. Writing the rule down changed nothing, because nothing checks it — registry-matches-spec.test.ts guards the two halves of the registry against each other, and both halves were equally unaware the tool existed. A rule with no enforcement is a rule that holds until someone is busy. The enforcement now lives where the omission happens, in the site build (apps/site/check-recipe-registry.js), which is the only place that can see a shipping tool and this registry at the same time.

gifedit is the GIF Editor (site slug gif-editor), added 2026-08-06. Its native document is layers of clips positioned in absolute milliseconds, and frames are derived from clip boundaries rather than stored — so there is no per-frame delay map in its payload. Its assets are the imported GIF and any stills, referenced from the payload by ast_ ID per rule 3 above.

Where a native format already has versioning discipline (dither's __type + schema_version + validators is the model — an internal review of the tools called it "the best versioning discipline"), the envelope mirrors it. Where it has none, the envelope's payloadVersion becomes it, starting at "1".

4.2 Superseded payload formats#

A payloadFormat that has been renamed does not stop existing: envelopes written under the old string are in the store, and §4 rule 2 says payloads round-trip untouched. So a renamed value is retired, not deleted — it remains a recognised value that validateEnvelope() accepts without a warning, and it is never reissued to a different tool.

SupersededReplaced byToolRetired
giflab-projectgif-projectgif2026-08-16

Writers MUST use the current value from §4.1. Readers MUST treat a superseded value as equivalent to its replacement.

giflab-project was renamed in the GIF tool's client on 2026-08-16, when the tool's old working name came out of the product, and this table did not learn about it until 2026-08-20. In between, every GIF document was saved under a string outside a registry described as closed — passing validation only because §8 makes an unknown format a warning. The client's own comment reasoned that through and concluded correctly that nothing reads the field back; what it did not do was revise the registry, which is the half that makes the closed registry mean anything. A rename that only happens in the writer is a registry change made by side effect.

4.3 The document envelope — revision 2026-08-23#

Added by spec revision, which is the only way this registry changes, and before any code — the row above and this section landed together, per the rule §4.1 spent two retroactive additions learning.

The multiplayer surface (docs/spec/sync-v1.md) edits a format-v1 document, not a tool recipe. Before this revision there was no storage path for one: apps/api stores recipe envelopes exclusively, both registries were closed against a document type, and the only @prodesigner/core import in the whole API was isId/mintId. sync-v1.md §6.2 was written assuming the R2 head and the CRDT document were one document in two representations. They were not, and the flush it described could not have been implemented.

The resolution: a document is an envelope like any other, and its payload is the ProDoc. tool: "document", payloadFormat: "prodoc", payloadVersion mirroring format-v1's own formatVersion.

Everything downstream then works unchanged and unmodified: quota accounting, the 30-day soft delete and its collector, version history and its byte budgets, spaces and roles, /api/export, and the /files listing. That is the entire argument for this shape — the alternative was a second storage namespace with a second copy of each of those, forever.

Rule 1 still holds, and the reason is worth stating rather than assuming. §4 rule 1 says envelope readers never interpret the payload and names "servers, sync code, quota logic, and the /files page" — so a sync layer that merges this payload looks like a violation. It is not, because rule 1's own exception is "the only code that parses a payload is the named tool", and for a document envelope the multiplayer shell is the named tool. The distinction that matters is unchanged: the storage API still never parses this payload, and still cannot. sync-v1.md §6.1 draws the same line from the other side.

The asset manifests already agree, which is what makes this nearly free: §5 states the envelope's manifest is byte-identical to format-v1.md §8, and module-io-v1.md §2 repeats it. A ProDoc's assets populate the envelope's assets map directly, so refcounting, quota and garbage collection see exactly what they see for every other tool.

document is deliberately not the app's name. Naming the app was left open when this was written, and a tool value cannot be renamed once envelopes exist — §4.1's own history is two retroactive rows and one rename that orphaned nothing only by luck. A descriptive value commits nothing; when the surface is named, the name goes in meta.generator, which is free to change.

4.4 Sealed payloads — revision 2026-10-07#

Founder, 2026-10-07: "encryption on just this tool and invoice studio for now, passphrase now, one time recovery code". A tool marked seal in apps/site/tool-account.js (today redact-pdf and invoice-studio) has every save encrypted on the person's device before upload, so the server holds nothing readable of the work. The design and its reasoning are in an internal design record; the code is packages/tool-kit/src/vault.ts.

The envelope stays an envelope. Every top-level field keeps its meaning and its validation (§8); a sealed save differs in four places only:

FieldSealed value
payload{ "pd.sealed": 1, vault, alg: "A256GCM", key: { iv, wrapped }, iv, data } — data is AES-256-GCM over the JSON { payload, title, source?: { name, mime } }, under the project's content key; key is that content key, wrapped by the account's vault key; vault names the vault (vlt_…)
meta.title"Encrypted project". The person's title is inside data
assetsthe source file's bytes are PDSEAL1\0, a 12-byte IV and the AES-GCM ciphertext; the entry's mime is application/octet-stream and origin.file is "sealed" — the real name and type are inside data
ext{ "app.prodesigner.sealed": { "v": 1 } } and nothing else — no thumbnail, which would be a readable picture of the work

payloadFormat and payloadVersion keep naming the inner payload, so a tool's reader and its museum are unchanged: the account client opens the seal and hands the tool exactly what it saved.

Rule 1 holds. The storage API never parses a payload, and still cannot; /files reads only the ext marker, to draw a lock instead of a picture. Every ciphertext carries associated data naming what it is (pd-vault-v1|<tool>|payload, …|asset, pd-vault-v1|<vault>|content-key), so a payload cannot pass for a file, nor one tool's project for another's. Nothing is bound to the document id, so Files' Duplicate, which copies an envelope under a new id, makes a copy that opens.

What the server still learns: that an account has a vault and when it changed (/api/vault, the wrapped key only), the tool, the sizes, the dates, and the number of saves.

Old saves. A project a sealing tool saved before it sealed opens as it was; its next save is sealed (versions saved before then stay as they were, until the version history prunes them). A sealed project opened with a vault the account has since replaced says so and opens nothing.

5. Assets#

Byte-identical to format-v1 §8: content-addressed (sha256- + hex digest), filename is the hash, duplicates dedupe, proxy present-but-nullable and readers MUST tolerate null or absent. origin.file preserves the user's original filename for display.

Two policy notes that are not format rules and belong to the storage layer, recorded here so the spec is honest about their existence:

  • The ~25 MB tiered-sync threshold (an internal planning decision) is a sync policy. An envelope whose manifest lists an asset the local store doesn't hold is still valid; the UI answers "source video is on your other device."
  • Dedup across an account (or a space) falls out of content addressing and requires nothing from this spec.

6. Server contract#

The clause that makes the backend rewrite-proof. A storage server (Cloudflare Workers, a D1 database and R2 object storage):

  • MAY read and index: format, formatVersion, id, tool, meta.title, meta.created, meta.modified, payloadFormat, payloadVersion, and the assets manifest (IDs, hashes, sizes, mime — for quota and integrity).
  • MUST NOT parse, validate, transform, or depend on any field of payload or ext. No server-side migration ever touches a payload.
  • Stores recipe.json and each asset as separate R2 objects; the D1 row is a mirror of the readable fields above plus owner and byte totals, and is always reconstructible from the stored envelope.

Consequence: recipe-v1 landing, tool schemas churning, and the ProDesigner editor arriving are all client-side events. The backend migration count for format evolution is zero, by construction.

Corrected 2026-11-18 — the contract as the server keeps it.

  • Every envelope but document: the promise above holds. The server checks the envelope (§8; of the payload, only that it is a JSON object), stores its text as written, and never reads, changes or migrates the payload or ext. A rename (PATCH /api/docs/:id with a title) rewrites meta.title in the stored envelope and leaves the payload as it was.
  • document envelopes (§4.3) are the exception. The account service's sync service is the named tool for them: it loads the payload into a live document, repairs shapes older builds wrote (lazily, one document at a time, when the document is opened for editing, and written back only at the next save), validates it as a format-v1 document, and writes the envelope back. A rename of such a document is written into the document itself.
  • Storage. The envelope is one object stored under its document id, and each asset one object stored under its hash (§1); earlier versions are kept as further objects.
  • The database row holds more than the envelope. Besides the readable fields, the owner and the byte totals, it carries the space the document is shared in, its star, its folder and the bytes of its named versions, none of which is in the envelope; and its modified is the server's time of the last write, not meta.modified. So the row is reconstructible from the envelope only in its envelope fields.
  • Limits. An envelope's JSON is at most 5 MiB (413 envelope_too_large); every asset it names must already be stored for the owner (409 missing_asset).

6.1 Repair writes — revision 2026-09-05#

A client may re-send a stored envelope with only its top-level ext changed and ask that the write not count as an edit: PUT /api/docs/:id with ?repair=ext. The case it exists for is a thumbnail: a tool that opens a project saved before its adapter could produce one regenerates it on open and puts it back, and a person's /files list must not reorder, nor a version slot be spent, because a picture was filled in.

The server's part of the contract stays within §6. It compares the stored text and the new text with the top-level ext member removed (canonical key order, so two clients' serialisations compare equal) and refuses the request with 409 not_a_repair if anything else differs. It never reads inside ext. An accepted repair keeps the row's modified, takes no version snapshot, and still bills bytes against quota (a thumbnail is bytes). A document that does not exist cannot be repaired (404).

7. Versioning and migration path#

formatVersion follows format-v1 §9 verbatim: patch/minor additions are backward-compatible, unknown fields are preserved, major bumps require a written migration before shipping.

The path to recipe-v1 proper. When recipe-v1.md is written, it defines format: "prodesigner/recipe" with structured params, items, and order replacing the opaque payload, plus the Yjs mapping and the collection rule. Migration is client-side and per-tool: the tool that owns a payloadFormat ships a function from its native shape to recipe-v1. All envelope fields except payload/payloadFormat/payloadVersion carry over unchanged — same id, same assets, same meta. The server observes only a new format string on the next save.

The two format ids coexist during migration; format is the sniff (format-v1 §2). Envelopes are never bulk-migrated server-side — each document converts when its owner next opens it in a recipe-v1-capable tool build.

8. Validation#

packages/recipe ships validateEnvelope(), mirroring validateDocument() (format-v1 §12). An envelope is valid when: required top-level fields are present and well-typed; id matches the rcp pattern and every asset ID the ast pattern; tool and payloadFormat are from the §4.1 registries, or the payloadFormat is a §4.2 superseded value (unknown values are a warning, per §9 semantics; a superseded value is recognised and does not warn); every asset entry's hash and file agree; payload is present and is a JSON object — and nothing more. Payload contents are explicitly out of scope for the validator.

Conformance fixtures mirror packages/core/test/fixtures.ts: one minimal valid envelope per tool with its real current native payload, one envelope with unknown extra fields (must round-trip), one with an unknown payloadFormat (must warn, not fail), one carrying a §4.2 superseded payloadFormat (must validate clean, with no warning), one with a missing asset object (valid document, sync-layer concern).

Corrected 2026-11-18: a hash is sha256- and 64 lowercase hex digits. The reference validateEnvelope() accepts 6 to 64 digits, but the account service and .prodocz accept only 64, so writers MUST write 64.

"One per tool" is now enforced rather than asserted. The map is typed Record<Tool, RecipeEnvelope>, and since 2026-08-20 the package's tsconfig.json includes test, so a tool added to §4.1 without a fixture is a compile error naming the missing one. The same coverage is checked at runtime as well, for anyone who reads pnpm test alone as the definition of done.

Before that date the annotation was checking nothing — the package still carried a build script emitting a dist no consumer imports, rootDir was src, and a rootDir cannot compile a sibling directory. The map covered 7 of 12 tools and looked complete.

9. What this spec deliberately does not define#

Deferred, in full, to recipe-v1.md: per-tool params/items/order schemas; the Yjs collection rule (ID-keyed Y.Map + Y.Array order); the recipe-not-pixels rule for dither's strokes; the shared ImageAdjustments type; algorithm-version pinning for deterministic replay; source as a reference to another recipe's output; any space-level library type.

Envelopes are not collaborative documents — except the document envelope (§4.3, corrected 2026-11-18), whose payload is a format-v1 document edited live under format-v1 §11. Every other envelope is a storage unit. No Yjs mapping is specified or implied for its payload — concurrent editing arrives with recipe-v1, whose structured fields are designed for it. Building sync on opaque payloads would recreate the wholesale-overwrite problem the collection rule exists to prevent.

The decision record for this spec lives in docs/decisions.md (2026-08-05 — Recipe envelope precedes recipe-v1).