Skip to content

generative: entries — the request lives where it plays - #105

Merged
ninjudd merged 7 commits into
mainfrom
tracks/generative-entries
Aug 9, 2026
Merged

ninjudd merged 7 commits into
mainfrom
tracks/generative-entries

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

nested-tracks.md §18 step 3: a track entry may hold an inline generative: block — the sound schema's request fields verbatim (prompt or text, plus conditioning), written where they play. The entry mints a gen: node under step 2's naming rule, but nothing in the build may run it: the node resolves to the chosen take, every take auditions as gen:<name>-<n>, and a request with no takes fails resolution naming the field generate that fills it.

Decision 3 amended as designed on concrete files: the required id fell. Takes key on the gen node's name — the owning track's, or <track>-<id> — so run-recorded state lives in audio/<name>/variants.yaml with a gen: first key (sound: stays for the transitional sounds), and the common leaf fold moves no files: still-water-keys folded and its audio directory never moved, only the file's first key renamed, a move the check diagnostic tells a pre-fold file to make. field generate and field choose resolve gen node names, so the sole-entry leaf reads as field generate still-water-keys --song creek — the exact command the file's comment has always shown.

The track file never changes when audio is generated or chosen — the design constraint stated in the leaf-content discussion, asserted at the byte level by a test. It is also why a voice entry authors voice_ref_sha256 up front (the schema already pairs it with voice_ref): the run verifies the snapshot against it and refuses a drifted voice, instead of writing the hash back the way the sound path fills its recipe.

Namespace guards grew to match: a generative entry may not mint a name a sound or an asset holds (both claim audio/<name>/, which imports also land in since #104), check says so, and the import pre-flight now reads generative entry names from tracks/ so the collision is an upfront refusal rather than a check-red project after the copy. The gen-name collision check covers both generator kinds, so an un-id'd generative and an un-id'd supercollider in one track collide with the give-each-an-id message.

The fold's cache story is the amended decision 6 exactly, with a better ending than kit-punch's: keys re-keyed once (its input moved from the raw take to the wrapper stem) and re-rendered byte-identically — be389af6d73b…, the hash it had before the fold — so phrase and main never re-keyed at all and print cached. lead-take deliberately does not fold: vocal-48k (a normalize sound) sources it and a sound cannot see a track; it waits for multi-rate step 3, recorded in the plan intro beside seven-eight-loop's identical deferral.

Testing

From the repo root:

pnpm build && pnpm typecheck && pnpm test

549 tests pass (31 new: entry-takes loading and its diagnostics, the graph shape and never-runs proof, generate/choose end-to-end against the stub worker including the track-file-untouched byte assertion, the namespace guards, and the review round's pins — tampered takes and drifted voice references flagged by check, fmt coverage for takes files on both sides, the orphaned-takes-directory scan, and generate/choose refusing an asset-owned name and a mis-attached takes file).

cd examples/bloom
field check
field build creek/track:main
field query 'deps(//songs/creek/track:keys)'

check says ok. The build prints source //songs/creek/gen:still-water-keys → songs/creek/audio/still-water-keys/1.wav — a built line on that gen node is what wrong looks like, because it would mean the build ran a deliberate generation. deps prints the three-line leaf shape: gen:still-water-keys, track:still-water-keys, track:keys. On a warm pre-fold cache, track:still-water-keys and track:keys build once and phrase/main stay cached — the downstream cache surviving is the proof keys re-rendered byte-identically (shasum -a 256 .field/out/songs/creek/track/keys.wav still prints be389af6d73b…). Without my cache the same claim is checkable via field explain: keys' parameters are byte-identical across the fold, so only the input hash moved.

field choose still-water-keys --song creek --variant 2
field build creek/track:main
field choose still-water-keys --song creek --variant 1

choose prints the gen spelling (//songs/creek/gen:still-water-keys now plays it; every placement follows — before this PR it claimed a sound: label and said source:, a spelling #102 retired). The first build after switching takes rebuilds exactly the keys chain — different take, different bytes, so still-water-keys, keys, phrase, main rebuild and nothing else does — and both renders then live in the action cache, so flipping between takes after that is entirely cached: variant A/B-ing is a one-line diff each way and zero renders once both have been heard.

I also verified the fresh-clone story from a git archive export (no takes — audio/ is git-ignored): field check says ok, and field build creek refuses with //songs/creek/sound:lead-take has no takes yet — field generate lead-take --song creek --seed <n>, which is the message the README now quotes (it used to quote still-water-keys' — the fold changed which request the build reaches first). Generating on this machine is stub-tested only; no model workers are installed here. State left behind: an audiod daemon in examples/bloom (field quit stops it).

ninjudd added 4 commits August 9, 2026 15:15
The generative sound schema's request fields move into a shared shape
the entry reuses verbatim; takes files gain a gen: key (sound: stays
transitional); the loader stitches audio/<node>/variants.yaml in by
gen node name; the graph mints committed-content gen: nodes with
per-take audition labels; generate and choose resolve gen node names,
write gen-keyed takes, and never touch the track file — a voice
entry's voice_ref_sha256 is verified against the snapshot instead of
written back.
A generative entry's takes claim audio/<node>/ exactly as a generative
sound's do, and imports land there too since #104 — so check refuses a
generative entry minting a name a sound or asset holds, and the import
pre-flight (takenSongNames) now reads generative entry names from
tracks/ so the collision is an upfront error, not a check-red project
after the copy.
The recipe becomes the track's one entry; keys.yaml changes one word
(sound: → track:). The takes directory never moves — node-name keying
is why — and its one-line rekey (sound: → gen:) is told by the check
diagnostic. keys re-rendered byte-identically, so phrase and main
stayed cached without re-keying. choose's success line learns the gen:
spelling; the old line said source:, which retired in #102.
project-model.md gains the generative: entry bullet and reworks
deliberate generation around the request/record split's new home;
build-graph.md names the gen-node takes directory; nested-tracks.md
amends decision 3 (id optional, takes key on the gen node's name),
updates the status intro, and records lead-take's deferral beside
seven-eight-loop's — vocal-48k sources it, and a sound cannot see a
track until multi-rate step 3 retires the wrapper.
@minjudd

minjudd commented Aug 9, 2026

Copy link
Copy Markdown

Starting review of ba3f29a.

@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 1 potential issue.

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 ba3f29a. Configure here.

Comment thread src/model/namespace.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba3f29a94f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/model/project.ts Resolved
Comment thread src/model/project.ts Resolved
Comment thread src/model/project.ts Resolved
Comment thread src/commands/generate.ts Resolved
Comment thread src/model/project.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 ba3f29a. The design holds up under every probe I could build, and the fold's key story is checkable here without your cache — I reconstructed both sides rather than taking it.

The fold, proven on matching takes. I wrote the same take bytes into both trees — sound: still-water-keys on main, gen: still-water-keys here — and asked each for the plan:

main   track:keys   input //songs/creek/sound:still-water-keys 2865fad017f2
                    parameters {"clips":[{"input":0,"start":0,"duration":480000,"read_offset":0,"gain_db":0,"fade_in":0,"fade_out":0}]}
head   track:keys   input //songs/creek/track:still-water-keys (not built)
                    parameters {"clips":[{"input":0,"start":0,"duration":480000,"read_offset":0,"gain_db":0,"fade_in":0,"fade_out":0}]}
head   track:still-water-keys   input //songs/creek/gen:still-water-keys 2865fad017f2

Byte-identical parameters, the input moving from the raw take to the wrapper stem, and the gen node resolving to the chosen take underneath. That is amended decision 6 exactly, and it is the whole of what moved.

"Nothing in the build may run it" is structural, not a rule that could be forgotten. explain creek/gen:still-water-keys reports (generation), not (rule) — the same node kind a committed asset gets — so there is no generator to dispatch and no key to miss. With takes absent it is in ungenerated instead, and resolution refuses naming the fill command, which is also why deps and explain on keys refuse in a fresh checkout rather than printing a shape.

The README's quoted message is right, checked on a takeless tree: field build creek prints //songs/creek/sound:lead-take has no takes yet …, so the fold really did change which request the build reaches first.

choose end to end, on real takes. A second variant, field choose still-water-keys --song creek --variant 2: it prints the gen spelling, the gen node repoints to the new bytes, and the track file's md5 is identical before and after — the byte-level constraint verified from outside your test.

Every refusal fires with the right sentence: refilling takes (already has 2 takes … or give the entry a new id), a supercollider name through generate and through choose, --prompt against an entry that already says what to generate, an unknown voice_ref, a chimera recipe, chosen past the end (diagnosed against the takes file, so the graph's variants[chosen - 1]! sits behind check), a pre-fold sound:-keyed takes file (told the rename), and every collision I could construct — a generative entry against a sound name, against an asset name, against another generator of either kind, and field import refusing a name a gen entry mints. fmt canonicalizes the new block and check flags a scrambled one.

One thing I went looking for and it is fine: committed refs sort by content hash, and a gen node with takes is committed, so choosing a different take can permute a track's clip indices where a supercollider entry never could. It costs nothing — the sort is a pure function of the hashes, so flipping back to take 1 reproduces the same plan and the same key, and the A/B-ing-is-free claim survives. The parent re-keys either way, because its input hash moved.

539 tests, 440 pass, 41 skip, 58 fail — the same 58 as main, all field-audiod is not built. pnpm typecheck clean.

One note on the Testing block rather than a finding: field build creek/track:main and the deps line need takes to exist, so they refuse on a fresh checkout — true in yours, and the body does say so three paragraphs later under the fresh-clone story. Worth putting the field generate line above them, or saying up front that the block assumes a generated tree.

Comment thread docs/projects/all/nested-tracks.md Resolved
Comment thread src/schema/sounds.ts Resolved
ninjudd added 3 commits August 9, 2026 15:42
Entry takes now get every verification a sound's had — variant hashes
(a tampered WAV was check-green while the build trusted the stale
hash), the voice_ref pin (a re-imported recording changed the voice
under a check-green entry), and fmt coverage (takes files were absent
from allFiles on both sides, so a noncanonical file said already
canonical). And check now scans audio/ for takes directories no
generative request claims: renaming a track, id, or sound stranded
its takes silently on both sides — decision 3's amendment promised
this diagnostic before it existed, and now says so.
Filling an entry whose base name an asset owns now fails before the
worker spawns: the run's renameSync writes into audio/<name>/, the
ledger's directory, over a legacy item's bytes in the worst case.
And choose validates the takes attachment against the path it
resolved — a stale pre-fold sound: file was getting chosen rewritten
and a gen success report while the loader rejected the file and the
graph never saw the choice.
refineRecipe is shared with generative entries now, and its
no-kind branch was the one message naming a noun — a track entry got
told about a generative sound that does not exist. The other four
messages were already noun-neutral.
@minjudd

minjudd commented Aug 9, 2026

Copy link
Copy Markdown

Starting review of 547e1af.

@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 547e1af. You took the harder branch on both findings — building the diagnostic rather than softening the sentence — and the two commits that came with it close holes I had not found.

The orphan scan works both ways and does not false-positive. Renaming the leaf track in bloom now says no generative request claims audio/still-water-keys/ — a renamed track, id, or sound leaves its takes behind, and a stray audio/ghost/variants.yaml gets the same. The discriminator is the right one: an imported asset's directory has no takes file and is skipped, which I checked against a real field import since #104 means every asset is now a directory and a scan over audio/ had exactly one way to go wrong. The record is honest about the scope, too — flagging that the sound half is new is more useful than quietly making both true.

check and fmt covering takes files is a gap I did not see. A takes file has been a schema-validated project file all along and fmt silently skipped it; now a scrambled one is not canonically formatted (run field fmt) and fmt fixes it in place. That is the kind of thing that stays invisible until a hand-edit drifts.

The choose guard is a real hole, and yours. Before it, choosing against a pre-fold sound:-keyed takes file under a gen entry wrote chosen and printed success while the loader rejected the file and the graph never saw the choice — a silent no-op that reported as a change. It now refuses and points at the rename: the takes in audio/still-water-keys/ still attach to sound: — rename sound: to gen: first (field check). Same for generate into an asset's directory, which would have written under the ledger's item.

The two verification additions are parity rather than new policy, which is what makes them easy to trust: the entry voice_ref_sha256 check is the sound-side check at project.ts:1323 with the entry's fields, and entry takes hash exactly as sound variants do.

549 tests, 450 pass, 41 skip, 58 fail — the same 58 as main, all field-audiod is not built. pnpm typecheck clean, field check on bloom ok, and the message now reads a generative request needs ….

One cosmetic thing, take it or leave it: the amendment's parenthetical says "Review caught this sentence…" where this file's own precedent is Found in review (#95) at line 686. A number makes it greppable, which is the whole point of citing one.

No findings.

@ninjudd
ninjudd merged commit 1a8f482 into main Aug 9, 2026
1 check passed
@ninjudd
ninjudd deleted the tracks/generative-entries branch August 9, 2026 22:50
ninjudd added a commit that referenced this pull request Aug 10, 2026
The last sound folds (nested-tracks.md §18 step 3, the shape
still-water-keys set): `lead-take` is now a leaf track whose one input
is the generative request, and `lead-vocal` places `track: lead-take` at
bars 5 and 9 where its clips said `sound: lead-take`. The gen node keeps
the name — the entry carries no id, so the node is the owning track's
name — which is why `audio/lead-take/` never moves and the takes file
only flips its attachment key. The 24 kHz take converts at the leaf's
own edge (multi-rate.md decision 4), and what the old sound indirection
was for survives the fold: `field choose lead-take` repoints the gen
node and both placements follow, with the track files untouched.

The fold is byte-identical: `lead-vocal` re-renders (its wiring changed
from the conversion ref to the track ref) to exactly the bytes it
produced before the fold — `cmp` clean against the pre-fold artifact —
so `main` never re-keys. The conversion itself was not even re-run:
`convert:gen-lead-take-48000` is an action-cache hit from
`convert:lead-take-48000`'s render, because the node name is wiring and
the key never sees it. A/B take flipping stays fully cached in both
directions.

With that, bloom has no `sounds/` directory left and `rg 'sound:'
examples/` finds only history in the README's prose. What remains of
chunk 6 — recorded in the plan's status — is retiring the machinery
bloom no longer exercises: the `sound:` entry field, the `sound:` label
and takes key, and the `sounds/` loader, behind the migration
diagnostics the format owes departing spellings. That is the next PR,
and it is deliberately not this one: this diff is the example moving,
and the retirement diff is schema surgery that deserves its own review.

## Testing

One local migration first: if you have generated takes for `lead-take`,
`field check` will say `songs/creek/audio/lead-take/variants.yaml: these
takes attach to the gen node "lead-take" now — rename sound: to gen:
(nested-tracks.md §18)` — a one-line edit to that git-ignored file, and
the diagnostic tells you exactly it.

Then, in `examples/bloom` (needs `pnpm build` so the `field` on your
PATH is current; spawns an `audiod` daemon — `field quit` stops it):

```
field check
field query 'deps(//songs/creek/track:lead-vocal)'
field build //songs/creek/track:lead-vocal
field choose lead-take --song creek --variant 2
field build //songs/creek/track:lead-vocal
field choose lead-take --song creek --variant 3
field build //songs/creek/track:lead-vocal
```

`check` says ok; the deps run in a straight line `gen:lead-take →
convert:gen-lead-take-48000 → track:lead-take → track:lead-vocal`; the
first build re-renders `lead-take` and `lead-vocal` (new labels,
converted content unchanged), and a following `field build //songs/...`
shows `main` cached — the fold moved no bytes, which is the claim that
would fail loudest if the leaf stem were not a clean pass-through. The
choose round-trip re-renders on the way to variant 2 and is entirely
`cached` on the way back to 3, and `git status` stays clean throughout —
neither command touches a tracked file. 581 tests pass unchanged from
#112; the fold adds none because it changes no code, which is itself the
point: the machinery landed in #105–#112, and this PR is bloom catching
up to it.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Example and documentation only; no schema or CLI changes in this diff,
so production risk is limited to readers following outdated `sound:`
paths in local clones.
> 
> **Overview**
> **Moves creek’s last sound into the nested-tracks model:** `lead-take`
is now a leaf track (`tracks/lead-take.yaml`) whose sole input is a
`generative:` block (text, delivery knobs), and `sounds/lead-take.yaml`
is removed so bloom has no `sounds/` left.
> 
> **`lead-vocal` wires through the track, not a sound:** both verse and
build placements use `track: lead-take` instead of `sound: lead-take`.
The 24 kHz take still resamples at the leaf edge to 48 kHz; `field
choose lead-take` repoints the `gen:` node so both placements follow
without touching tracked YAML.
> 
> **Docs and the bloom README** are aligned with `gen:` labels,
track-based placements, and chunk 6 status (sound machinery retirement
deferred to a follow-up PR). **No application code changes** — behavior
was already in prior nested-tracks / multi-rate work; this diff is the
example catching up.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
acc96ae. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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