Skip to content

A recipe can exist before its takes - #83

Merged
ninjudd merged 2 commits into
mainfrom
generative/takeless-recipes
Aug 9, 2026
Merged

ninjudd merged 2 commits into
mainfrom
generative/takeless-recipes

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

A generative sound could only be written by a run that had already happened. model, seed, generated_at and a variants list of at least one are all things a recipe written in advance cannot supply, so a project whose audio is not committed could not be expressed at all — which is exactly the shape examples/bloom has to ship in (bloom-in-tree.md §3, chunk 1 of that plan).

Provenance moves onto the variant, which is where it belonged regardless. It describes a run, and a sound accumulates several: two takes made a month apart can come from different model versions and certainly have different generation times, and one model/generated_at pair on the sound could record only one answer for the whole list. seed was already per-variant; the sound-level copy went with the other two.

An empty variants list is the default, so omitting the key and writing variants: [] stop being separate failures — a hand-written recipe does the former and a chunk that only dropped the .min(1) would have left it failing. check passes on such a project, because it is coherent and the audio is simply absent, and build/play are what refuse. They name the sound and the exact command, on both paths that can reach it: resolving a dependency, and naming the label directly, which expands as a pattern and never went through resolveLabel at all. A pattern matching several lists all of them, since a pattern is a request for a set.

Two things had to ship with that or a takeless recipe would have been a dead end, neither of which the plan anticipated:

field generate now fills an existing takeless recipe. It previously refused any name that already existed — pick a new name — so a shipped recipe was unfillable and the whole idea went nowhere. Filling takes the request from the file instead of the command line, so a content flag passed alongside is refused as a second answer; --seed and --variants describe the run rather than the sound and stay on the CLI. The file is edited in place rather than re-emitted, so a shipped recipe's comments survive being filled — the same reason choose edits the document instead of rebuilding it.

field generate also chooses its first take. Every take it produced is usable, so the sound resolves the moment it exists and choose means what its name says. That is also what keeps check honest: it still refuses takes with nothing chosen, and that state is now unreachable except by hand, so refusing it costs nothing and still catches the hand edit. Without this, generating would have broken a check that had just passed.

Generating over takes that already exist is still refused rather than merged, which is the §1.2 trigger policy unchanged: filling an empty recipe is the one thing that opened up. Filling is also refused pre-flight when a recipe's name: disagrees with its filename — that project is already check-red, so the run was going to be wasted either way, and filling would have added a second error by writing takes under a directory check does not expect.

This is a breaking format change, and okamnesiac/bloom does not pass field check after it. Its recipes carry the retired sound-level keys. They are not migrated in place, because bloom is frozen until it moves; chunk 2 writes them in the new shape as it copies them, which is the migration. The retired keys are declared as z.never carrying instructions rather than removed outright — the RETIRED_FADER precedent — so a recipe written before the change is told where the value went instead of getting Unrecognized keys. The migration those messages describe loses nothing: a recipe's model and generated_at describe the one run that produced every variant it lists, which is exactly the shape generate still writes, so copying each down onto every variant records what actually happened. seed needs no home, since every variant has carried its own all along.

One thing the takeless case exposed that was a closed loop: a music recipe with no bars or duration_seconds passed check, and generate answered give exactly one of --bars or --duration — but both of those are content flags, refused on a recipe that already says what to generate. Unfillable by any command, with advice for a locked door. check asks for the length now. Its mirror image is fixed too: generate writes both lengths into a music recipe, and passing both into a rule that wants exactly one made an ordinary generated recipe unfillable the same way. Seconds win, because seconds are what ran.

Testing

cd ~/amnesiac/field && pnpm build && pnpm typecheck && pnpm test

456 tests, 33 files — up from 445. Each behaviour was proved by reverting its fix and watching the new test fail rather than by watching it pass: the variants default, check tolerating a takeless recipe, the build message, auto-choosing, filling, the retirement messages, the music length, the name pre-flight, and the length resolution.

The breaking half, against the only project this format has:

cd ~/amnesiac/bloom && field check

Eighteen diagnostics, and what matters is their shape rather than their count. Each affected recipe leads with provenance describes a run and lives on each take now — copy this value onto every entry under variants: and delete it here (bloom-in-tree.md §3) at model. If instead you see Unrecognized keys: "model", "seed", "generated_at", the forwarding did not land and the migration message is gone. bloom is not fixed by this PR and is not meant to be — chunk 2 rewrites those files as it copies them.

The whole loop runs without a GPU, because field generate takes the stub worker by env var:

rm -rf /tmp/takeless && mkdir /tmp/takeless && cd /tmp/takeless
field init --name p
field song create creek
mkdir -p songs/creek/sounds
printf '# ships without audio: generate your own take\nname: lead\ntype: generative\ntext: the water knows the way\n' > songs/creek/sounds/lead.yaml
printf 'name: verse\ntype: audio\nclips:\n  - id: c\n    source: lead\n    position: 0\n    duration: 1920\n' > songs/creek/tracks/verse.yaml
printf 'name: main\ntype: audio\ninserts: []\ninputs:\n  - track: verse\n    at: 0\nclips: []\n' > songs/creek/tracks/main.yaml
export FIELD_VOICED_PYTHON=~/amnesiac/field/src/testing/stub-worker.mjs
field check
field build creek

ok, then //songs/creek/sound:lead has no takes yet — field generate lead --song creek --seed <n>. This is the pair that matters. On main the same two commands both fail with four schema errors and clip "c" references unknown source "lead" — the recipe cannot exist, so the clip pointing at it is dangling. A check that still refuses this file means the schema half did not land; a build that says no such label means the message half did not, and that is the wrong answer in the most expensive way, because it sends you hunting for a typo in a name that is spelled correctly and sitting on disk.

Now the command it just named — first with a flag it should refuse:

field generate lead --song creek --seed 7 --text 'different line'
field generate lead --song creek --seed 7
cat songs/creek/sounds/lead.yaml
field check

The first is refused: lead.yaml already says what to generate, so --text would be a second answer — drop it, or edit the recipe. The second fills it, and the recipe still opens with # ships without audio: generate your own take — if that comment is gone, the file was re-emitted instead of edited, which is the failure this half exists to avoid and the one a shipped example would feel. Below it, chosen: 1 and two variants each carrying their own model, seed, sha256 and generated_at. Then ok.

Finally, the guard that did not move:

field generate lead --song creek --seed 9

sound "lead" already has 2 takes in creek (pick a new name). If this succeeded it would have replaced chosen audio under the project's feet, which is the whole reason deliberate generation is human-triggered.

Clean up with rm -rf /tmp/takeless. The stub leaves nothing outside that directory, and no daemon is started — the stub worker is spawned and exits with the command.

One thing left deliberately: field build creek reports the first takeless sound it reaches, not all of them, because resolution throws where it fails. Naming a pattern (field build //songs/creek/sound/...) does list all of them. If a fresh clone of the example should get the full list from field build creek too, that is a collect-then-report change to the build walk and worth its own PR.

A generative sound could only be written by a run that had already
happened: model, seed, generated_at and a non-empty variants list are all
things a recipe written in advance cannot supply. That makes a project
whose audio is not committed impossible to express, which is the shape
examples/bloom has to ship in.

Provenance moves onto the variant, where it belongs regardless: it
describes a run, and a sound accumulates several. Two takes made a month
apart can come from different model versions and certainly have different
generation times, and a single model/generated_at pair on the sound could
record only one answer for the whole list.

An empty variants list is now the default, so omitting the key and
writing it empty stop being separate failures. check passes on such a
project — it is coherent, the audio is simply absent — and build and play
are what refuse, naming the sound and the exact field generate that fills
it, on both the resolve path and the pattern path.

Two things had to ship with that or a takeless recipe would have been a
dead end. generate now fills one in place, taking the request from the
file rather than the command line and leaving its comments intact, since
it previously refused any name that already existed. And it chooses its
first take, so a sound resolves as soon as it has audio and choose means
switching rather than a second mandatory step; that also keeps check's
refusal of takes-with-no-pick meaningful, because no command produces
that state any more.
@minjudd

minjudd commented Aug 9, 2026

Copy link
Copy Markdown

Starting review of edceadd.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit edceadd. Configure here.

Comment thread src/commands/generate.ts Resolved
Comment thread src/commands/generate.ts Resolved

@minjudd minjudd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed edceadd. Two findings, and they are the same fact seen from the code and from the plan: this breaks bloom, and the plan now says it did not.

What the PR builds is right, and the two things it says the plan did not anticipate are real improvements. variants defaulting to [] rather than merely permitting empty is the correct reading of the finding on #82 — absent and empty were separate failures and only one of them is what a hand-written recipe produces. Provenance on the variant is right for the reason given, and seed having already lived there is the tell that the other two were misplaced. generate filling a takeless recipe and choosing its first take are both necessary: without the first a shipped recipe is unfillable, and without the second generating would break a check that had just passed. Editing the file in place so a shipped recipe's comments survive is the same instinct as choose, and it matters more here because the comments are the example's teaching material.

pnpm typecheck is clean and the suite is 452 across 33 files, exactly as the Testing section says.

The problem is entirely outside this repo, which is the irony worth naming: this is chunk 1 of the plan written because a change in one repo could break the other with no test able to see it, and it is that.

Comment thread src/schema/sounds.ts Resolved
Comment thread docs/projects/all/bloom-in-tree.md Resolved
Retiring model, seed and generated_at from the sound left strictObject to
answer "Unrecognized keys", which is true and tells nobody anything. They
are declared as z.never with the instructions instead, the RETIRED_FADER
precedent. The migration those messages describe is mechanical and loses
nothing: a recipe's model and generated_at describe the one run that made
every variant it lists, which is the shape generate still writes, so
copying each down onto every variant records what actually happened.

A music recipe with no length was reachable only once a recipe could
exist before its takes, and it was a closed loop — check passed, generate
answered "give exactly one of --bars or --duration", and passing either
was refused as a second answer to what the recipe already said. The
schema asks for a length now, so check is where it surfaces.

Filling resolved the mirror image of that: a generated music recipe
carries both the seconds it ran at and the bars it was asked for, and
passing both into a rule that wants exactly one made an ordinary recipe
unfillable. Seconds win, because seconds are what ran.

Filling also now refuses, pre-flight, a recipe whose name disagrees with
its filename. That project is already check-red, so the run was going to
be wasted either way, and filling would have added a second error by
writing takes under a directory check does not expect.
@minjudd

minjudd commented Aug 9, 2026

Copy link
Copy Markdown

Starting review of d4f10e2.

@minjudd minjudd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving d4f10e2. Both findings fixed, and one of them corrects me rather than the code.

I was wrong that generated_at cannot be migrated. I argued a sound carries one timestamp for a list of takes, so copying it down invents per-take values. It does not: a sound's variants all come from a single run — generate writes them together and refuses to run over existing takes — so the one timestamp is each variant's true timestamp. Checked in bloom: still-water-keys.yaml has one generated_at and three seeds, one per variant. Copying down is faithful, keeping the fields required is right, and "optional provenance would weaken the format permanently to save a one-time edit" is the correct trade. Good rebuttal.

The forwarding works, and works with the suffix rather than against it — the #81 lesson applied without being told. What bloom hears now:

lead-take.yaml: provenance describes a run and lives on each take now — copy this value onto every entry under `variants:` and delete it here (bloom-in-tree.md §3) at model
lead-take.yaml: each entry under `variants:` already records the seed it ran with, so this one has no home — delete it (bloom-in-tree.md §3) at seed

Three keys, two different answers, and the seed one is the one worth having got right: the mechanical instinct is "move it like the others", and the message says to delete it because the value is already there.

The chunk-1 line is honest now, and states the breakage in the strongest available terms rather than the softest.

The three things you added beyond the findings are each the sort that only appears once a recipe can exist before its takes. The name-vs-filename pre-flight is a genuine pre-flight — project.ts:446 already enforces that rule, so this is the same answer arriving before a run is spent rather than a second rule. The both-lengths resolution is the right way round: seconds are what ran, and passing both through would have made an ordinary recipe unfillable with advice naming flags that filling refuses. And requiring a length on a music recipe closes the hole the schema change opened, in check where the advice can be acted on.

pnpm typecheck clean, 456 tests across 33 files.

One thing recorded rather than filed, since the headline claim is now stated plainly. "The repo is stale rather than mysterious" undersells the interval: the failed sounds cascade, so vocal-48k reports an unknown source and creek's keys track reports an unknown clip source — bloom cannot build or play until chunk 2, not merely fail check. The sentence above it says the important half loudly, and anyone who reads check-red as broken will infer the rest; worth knowing precisely if that window is longer than an afternoon.

No findings.

@ninjudd
ninjudd merged commit cbaed43 into main Aug 9, 2026
1 check passed
@ninjudd
ninjudd deleted the generative/takeless-recipes branch August 9, 2026 02:41
ninjudd referenced this pull request Aug 9, 2026
The tool and the only real project using its format lived in two repos,
so a change to one could not be tested against the other. That cost most
of a day: field #79 moved the bare song name to `track:main` while bloom
sat unmerged and `field build creek` was broken with no test anywhere
able to notice; `tall-grass` was missed by a migration because creek was
what I looked at; a track fader went silent where the five files
carrying one were somewhere a test could not see. A test can only see
one repo — that is the whole argument, and CI running `field check` here
would have caught all three.

**Copied, not migrated.** This repo squash-merges into a linear history,
so bloom's commits could not have survived the merge however they
arrived; a submodule would have kept two repos and added a pointer to
forget to bump. The history goes with the old repository, which is being
deleted.

**No audio comes with it.** All seven WAVs stay behind, both generative
recipes ship with `variants: []`, and whoever clones generates their own
takes — which is what [chunk
1](okamnesiac/field#83) made expressible. Two
people's bloom sounding different is the demonstration, not the cost: a
project *is* its recipes. It also means no Git LFS in a TypeScript repo,
and no generated audio arriving in review where a diff says nothing.

Two files could not simply be dropped, because something referenced
them.

`water` was downloaded and then normalized, so its pin describes the
*processed* bytes — a download rule has to be `download` → `normalize`
with the pin on the output, not a URL field on the ledger. That is its
own plan, so the example drops it: the shared pin, the bytes, creek's
`water` track, and that track's placement in `main`. creek loses its
ambience.

tall-grass's 7/8 loop was a recording. It is now
`shared/instruments/seven-eight-loop.scd` — a seeded program rendering
the same two bars of 3+2+2 at 132, which needs no committed bytes and is
bit-reproducible. `drums.yaml` and `loop-cd.yaml` still say `source:
seven-eight-loop`, because a clip's source resolves a sound exactly as
it resolved an asset.

Both ledgers go with the last pins they held. A project committing no
audio carries no ledger; `field import` writes one when there is
something to write down.

The README is rewritten rather than copied: it described committed
audio, LFS, and a water recording, and it claimed tall-grass renders
without SuperCollider — which stopped being true when its loop became a
program. It now opens with what is missing and why, and a **Generating**
section is the first thing after setup.

CI is deliberately not here. That is chunk 3, and it deserves its own
change because the way to review it is to break a schema and watch the
example catch it — which is a different exercise from reading a file
copy.

## Testing

```
cd ~/amnesiac/field && pnpm build && pnpm typecheck && pnpm test
```

456 tests, unchanged: this adds no code. Then the example itself, which
is the actual subject:

```
cd ~/amnesiac/field/examples/bloom
field check
field build tall-grass
```

`ok`, then four built labels ending in `//songs/tall-grass/track:main`.
**tall-grass building on a fresh clone with no audio in the repository
is the claim this whole PR rests on** — every sound in it is a recipe,
so if `seven-eight-loop` had been dropped rather than replaced you would
get `references unknown source` here instead.

creek is the other half, and it must *fail*:

```
field build creek
```

`//songs/creek/sound:still-water-keys has no takes yet — field generate
still-water-keys --song creek --seed <n>`. If this builds, audio got
committed by accident. If it says `no such label`, the takeless recipes
are malformed rather than empty.

Then the README's own sequence. With the real workers installed it is
the two `field generate` lines from **Generating**; without them, the
stub worker exercises the same path:

```
cd /tmp && rm -rf bloom-clone && cp -R ~/amnesiac/field/examples/bloom bloom-clone && cd bloom-clone
export FIELD_ACED_PYTHON=~/amnesiac/field/src/testing/stub-worker.mjs
export FIELD_VOICED_PYTHON=~/amnesiac/field/src/testing/stub-worker.mjs
field generate still-water-keys --song creek --seed 90210 --variants 2
field generate lead-take --song creek --seed 4823 --variants 3
field check
head -3 songs/creek/sounds/lead-take.yaml
```

`ok`, and the recipe still opens with its comment — filling edits the
file in place, so a shipped example's annotations survive. Note that
neither command passes `--prompt` or `--text`: the recipe is the
request, and a flag repeating it is refused.

Stop there with the stub. `field build creek` after a stub generate
fails on `not a RIFF/WAVE file`, because the stub writes text rather
than audio — that is the stub, not this change, and it is why the two
builds above use tall-grass and the *refusal* from creek as the real
assertions.

The audio is genuinely absent, which is the definition of done for this
chunk:

```
cd ~/amnesiac/field && git ls-files examples/bloom | grep -c '\.wav$'
```

`0`. And `git ls-files examples/bloom | wc -l` is `36`.

Clean up with `rm -rf /tmp/bloom-clone`. Building inside
`examples/bloom` leaves a `.field/` there, which its own `.gitignore`
covers.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation and example YAML/SCD only; no application code or CI
changes in this PR.
> 
> **Overview**
> Adds the **bloom** Field project under `examples/bloom` so the
format’s real consumer lives in the same repo as the CLI (CI wiring is a
follow-up chunk). The tree is **36 tracked files and zero WAVs**:
recipes, tracks, and SuperCollider programs ship; generated takes stay
local via `.gitignore`.
> 
> **Copy-time edits** from the standalone repo: creek’s shared **water**
ambience and its ledgers are removed; tall-grass’s **seven-eight-loop**
becomes a seeded `supercollider` sound (`seven-eight-loop.scd`) instead
of a recording. Creek’s **still-water-keys** and **lead-take** use the
new takeless generative shape (`variants: []`).
> 
> The **README** is rewritten for “no audio in git”—setup, `field check`
on a fresh clone, generating creek’s missing takes, and building
**tall-grass** from recipes only. Plan docs (`bloom-in-tree.md`,
`now.md`) mark chunk 2 done and note deleting `okamnesiac/bloom` instead
of archiving it.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5ac4896. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
ninjudd added a commit that referenced this pull request Aug 9, 2026
Neither is installed and no config exists, so anything that reaches for a
formatter applies its own defaults — which is how a sixty-line change in
#83 became three hundred and twelve and had to be reverted.

A line, not a plan: nobody has committed to when, and the shape of the
work is not in question. ESLint changes no bytes and could land tomorrow;
prettier cannot, because a config matched to the existing style still
rewrites about 1,900 lines. That is the whole of what there is to say
until someone picks it up.
ninjudd added a commit that referenced this pull request Aug 9, 2026
Neither is installed and no config exists, so anything that reaches for
a formatter applies its own defaults — which is how a sixty-line change
in #83 became three hundred and twelve and had to be reverted.

A line, not a plan: nobody has committed to when, and the shape of the
work is not in question. ESLint changes no bytes and could land
tomorrow; prettier cannot, because a config matched to the existing
style still rewrites about 1,900 lines. That is the whole of what there
is to say until someone picks it up.

## Testing

Three lines in `later.md`, no document. Nothing to run — but the one
number in the line is worth being able to check, since it is the reason
prettier is not free. On a copy, so the repo is never written to:

```
cd /tmp && rm -rf fmt-probe && mkdir fmt-probe && cp -R ~/amnesiac/field/src fmt-probe/src && cd fmt-probe
npx --yes prettier --write --single-quote --print-width 100 'src/**/*.ts' >/dev/null 2>&1
diff -ru ~/amnesiac/field/src src | grep -c '^[+-][^+-]'
```

`1916`, across 40 files. If that came back near zero the line would be
wrong and prettier should just be adopted without ceremony. Clean up
with `rm -rf /tmp/fmt-probe`; `git status` in the repo should be clean
afterwards.
ninjudd added a commit that referenced this pull request Oct 10, 2026
The snippet began with prettier --write on 'src/**/*.ts', so pasting it
at the repository root rewrote 5,209 lines across 86 files in place,
the #83 accident the entry records. It now copies src/ into a mktemp
directory and points prettier at the copy by absolute path, so a
failed copy leaves prettier nothing to match rather than the real
tree. A second diff counts the 86 files the goal line cites. Run
verbatim from the root, it prints 5209 and 86 and leaves git status
clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants