From 74f1b9674faea497dae8c847d54fec727ba55095 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 29 May 2026 23:23:17 +0100 Subject: [PATCH] Tighten IPA trial agent prompts --- docs/ipa-vocal-tract-roadmap.md | 12 +++-- state/evidence.jsonl | 1 + state/scratch.md | 19 +++++-- state/spine.yaml | 2 +- tools/run-ipa-trial-loop.ps1 | 91 ++++++++++++++++++++++++++++++--- 5 files changed, 108 insertions(+), 17 deletions(-) diff --git a/docs/ipa-vocal-tract-roadmap.md b/docs/ipa-vocal-tract-roadmap.md index fd2b937..2e64819 100644 --- a/docs/ipa-vocal-tract-roadmap.md +++ b/docs/ipa-vocal-tract-roadmap.md @@ -692,11 +692,13 @@ The trial shape is five target sets with five phoneme lanes each: - mixed generalization: `mix-a`, `mix-m`, `mix-s`, `mix-p`, `mix-u`. Agent-authored candidates must be named -`__.aqua`. The point is not one-patch golf. A useful -round tests whether a contour, source, tract, radiation, or DSL-lowering idea -generalizes across the target sets. Full-patch FM/AM/noise dressing is allowed -as parity pressure, but the evaluator must label it as dressing when primitive -or gesture evidence does not improve. +`____.aqua`, where `family` is lowercase +kebab-case and is the canonical hypothesis-family id for evaluator grouping. +Each round writes exactly 25 candidates: one per target lane. The point is not +one-patch golf. A useful round tests whether a contour, source, tract, +radiation, or DSL-lowering idea generalizes across the target sets. Full-patch +FM/AM/noise dressing is allowed as parity pressure, but the evaluator must +label it as dressing when primitive or gesture evidence does not improve. ## CultMesh Render/Scoring Work diff --git a/state/evidence.jsonl b/state/evidence.jsonl index b4f3894..3dc242b 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -238,3 +238,4 @@ {"date":"2026-05-29","area":"ipa-gesture-experiment-harness","summary":"Added `IpaGestureExperiment.WriteRound`, the first frozen batch surface for IPA hypothesis work. A round writes deterministic candidate `.aqua` scripts, primitive `ProbeTimelineReport` CSVs, `manifest.yaml`, gesture-layer `metrics.csv`, and per-candidate `evidence.jsonl`. `IpaGestureExperiment.AnalyzeRound` adds metric summaries, score-band candidate clusters, and a science brief for sub-agent analysis. The harness scores descriptor/spline/primitive evidence only and explicitly leaves clean vocal identity, full spectrogram parity, optimizer checkpoints, and worker orchestration downstream. PatchScriptTests pass 93/93.","evidence":"src/AquaSynth.Core/IpaGestureExperiment.cs; tests/AquaSynth.Dsl.Tests/PatchScriptTests.cs; docs/ipa-vocal-tract-roadmap.md; docs/utterance-parity-research.md; state/map.yaml; state/spine.yaml; state/scratch.md"} {"date":"2026-05-29","area":"ipa-trial-render-orchestration","summary":"Added the first local IPA trial worker/evaluator loop. `IpaTrialOrchestrator.RunAsync` generates candidates through `IpaGestureExperiment`, renders them through Faust, compares spectrogram/articulation evidence against local Pink Trombone fixture references, writes WAV/report artifacts, and stores typed `IpaTrialResult` records in `ipa-trial-results.cc`. The first five-seed run proved the pipeline but exposed silent vowel/nasal candidates; the accepted refinement moved voiced excitation into primitive `SourcePort` lowering. The second run at `artifacts/parity/ipa-trials/20260529T214127955/five-seed-trials` improved open `a` to log-mel cosine `0.5693`, `m` to `0.5199`, and `s` to `0.5498`, while `p` stayed weak at `-0.1024`, pointing to closure/release ownership next. Focused verification passes 94/94 plus opt-in IPA trial run.","evidence":"src/AquaSynth.Core/IpaTrialResults.cs; src/AquaSynth.Faust/IpaTrialOrchestrator.cs; src/AquaSynth.Core/FaustExport.cs; src/AquaSynth.Core/IpaGestureExperiment.cs; tests/AquaSynth.Dsl.Tests/IpaTrialOrchestratorTests.cs; docs/ipa-vocal-tract-roadmap.md; state/spine.yaml; state/scratch.md"} {"date":"2026-05-29","area":"ipa-trial-loop","lesson":"External IPA exploration needs a semantic retrieval tool over the CultCache .cc trial store, not crude full-memory dumps. Hypothesis agents should use search/show to retrieve ranked metric and artifact context, then write batches across the five five-phoneme target sets; the worker owns rendering, scoring, and .cc upserts."} +{"date":"2026-05-29","area":"ipa-trial-loop-prompts","lesson":"Prompt smoke found that agent prompts need hard acceptance contracts, not just instructions: exact candidate count, canonical filename schema, normalized family ids, retrieval receipts, claim-to-metric audit rows, and fail-closed evaluator compliance prevent report-shaped fog from passing as loss-landscape science."} diff --git a/state/scratch.md b/state/scratch.md index c22c444..b712c24 100644 --- a/state/scratch.md +++ b/state/scratch.md @@ -17,10 +17,11 @@ Current slice: - Active IPA exploration shape: vowels `a/i/u/e/o`, nasals/approximants `m/n/ng/l/r`, fricatives `s/z/f/v/th`, stops `p/b/t/d/k`, and mixed generalization `mix-a/mix-m/mix-s/mix-p/mix-u`. - Agent patch files must be named `__.aqua` so the - scorer can bind them to target/reference lanes. Full-patch dressing remains - allowed, but evaluator reports must say when it is compensating for failed - primitive or gesture evidence. + Agent patch files must be named + `____.aqua` so the scorer can bind them + to target/reference lanes and the evaluator can group hypothesis families. + Full-patch dressing remains allowed, but evaluator reports must say when it + is compensating for failed primitive or gesture evidence. - Verification so far: `dotnet build tools\IpaTrialWorker\IpaTrialWorker.csproj --disable-build-servers -p:UseSharedCompilation=false -p:BuildInParallel=false -v minimal` passes; `IpaTrialWorker search` returns @@ -29,6 +30,16 @@ Current slice: `tools\run-ipa-trial-loop.ps1 -Rounds 0 -SkipLocalTrialRun` creates a loop skeleton. Need final focused tests and optionally a one-round external Codex smoke if time/tooling allows. +- Prompt QA pass: ran three dry single-turn external Codex smoke probes for + both hypothesizer and evaluator prompts under + `artifacts/parity/ipa-prompt-smoke/pass-{1,2,3}`. The refinements removed + contradictory count/name instructions, hardened candidate naming to + `____.aqua`, made family ids lowercase + kebab-case, required exact 25-lane output, added pre-evidence digest and + claim-audit sections, forced semantic-search/show receipts, and made the + evaluator fail closed when receipts, target coverage, filename validation, or + family extraction are incomplete. Final script syntax smoke passes with + `tools\run-ipa-trial-loop.ps1 -Rounds 0 -SkipLocalTrialRun`. - Implemented the first IPA trial render/scoring orchestration. Core now has typed `IpaTrialResult` CultCache records plus `IpaTrialResultCultCacheStore`; diff --git a/state/spine.yaml b/state/spine.yaml index be21492..17b822c 100644 --- a/state/spine.yaml +++ b/state/spine.yaml @@ -145,7 +145,7 @@ live_invariants: - IPA training scoring contract is documented. Reports must keep `gesture_score`, `clean_vocal_score`, and `full_parity_score` separate. Gesture score measures descriptor-to-surface coverage, motion direction, spline contour/timing, primitive timeline consequences, and optional external articulation landmarks. Full parity patches may use FM/AM/modulators/envelopes/filters, auxiliary animated voices, and recording-condition helpers, but those helpers cannot count as articulation evidence unless gesture and clean-vocal scores move coherently. - `IpaGestureExperiment.WriteRound` is the first frozen batch harness for IPA hypothesis work. It writes `manifest.yaml`, candidate `.aqua` scripts, primitive `ProbeTimelineReport` CSVs, gesture-layer `metrics.csv`, and per-candidate `evidence.jsonl` under a caller-provided artifact root. `IpaGestureExperiment.AnalyzeRound` writes `analysis/metric-summary.csv`, `analysis/candidate-clusters.csv`, and `analysis/science-brief.md` for the science-worker handoff. This harness owns frozen descriptor/spline/primitive evidence only; clean vocal identity, full spectrogram parity, optimizer checkpoints, and worker orchestration stay downstream. Focused verification: `PatchScriptTests` pass 93/93. - `IpaTrialOrchestrator.RunAsync` is the first local render/scoring worker for IPA trials. It generates candidate patches through `IpaGestureExperiment`, renders them through Faust, compares against local PT fixture references with `AudioAnalyzer`, writes WAV/report artifacts, and stores typed `IpaTrialResult` records in `ipa-trial-results.cc`. The five-seed trial run at `tests/AquaSynth.Dsl.Tests/bin/Debug/net10.0/artifacts/parity/ipa-trials/20260529T214127955/five-seed-trials` showed voiced vowels/nasals became audible only after primitive `SourcePort` lowering gained a true oscillatory voiced carrier; sibilants are pressure, plosives remain weak. Verification: opt-in IPA trial test passed, and focused `PatchScriptTests|IpaTrialResultsRoundTripThroughCultCache` pass 94/94. - - External IPA exploration now has a worker/tool boundary. `tools/IpaTrialWorker` owns `seed`, `score`, `search`, `show`, and audit-only `dump` commands over the typed `.cc` trial-result store; `score` renders external Codex-authored `.aqua` candidates through `IpaTrialOrchestrator.RunCandidateScriptsAsync`, while `search` is the semantic retrieval organ for hypothesis agents. `tools/run-ipa-trial-loop.ps1` orchestrates external `codex exec` hypothesis/evaluator workers around that store. The active trial shape is five target sets of five phoneme lanes each: vowels, nasals/approximants, fricatives, stops, and mixed generalization. Verification: `IpaTrialWorker` builds, `search` smoke reads the seed store, and the loop skeleton runs with `-Rounds 0 -SkipLocalTrialRun`. + - External IPA exploration now has a worker/tool boundary. `tools/IpaTrialWorker` owns `seed`, `score`, `search`, `show`, and audit-only `dump` commands over the typed `.cc` trial-result store; `score` renders external Codex-authored `.aqua` candidates through `IpaTrialOrchestrator.RunCandidateScriptsAsync`, while `search` is the semantic retrieval organ for hypothesis agents. `tools/run-ipa-trial-loop.ps1` orchestrates external `codex exec` hypothesis/evaluator workers around that store. The active trial shape is five target sets of five phoneme lanes each: vowels, nasals/approximants, fricatives, stops, and mixed generalization. Candidate names are exactly `____.aqua`, with lowercase kebab-case family ids. Three dry external Codex smoke passes refined hypothesizer/evaluator prompts into exact 25-lane output, retrieval receipts, claim audits, and fail-closed evaluator compliance. Verification: `IpaTrialWorker` builds, `search` smoke reads the seed store, and the loop skeleton runs with `-Rounds 0 -SkipLocalTrialRun`. - TurbulenceJet now includes a release-timed burst-noise component in addition to the deterministic pressure pulse, but a stronger trial barely moved papa; the source is not the main remaining articulation bottleneck. Graph radiation now mixes 30% raw boundary flow with 70% high-passed flow after local admittance weighting, down from the over-bright 15/85 blend. Latest radiation/source artifact under `artifacts/parity/pink-trombone-utterance-logmel/20260527T174236049`: mama/papa/thrombosis cosine 0.6578/0.7692/0.5585, rmsRatio 3.0006/2.6153/2.3488, articulation 0.1437/0.1173/0.1191. Static `closure-release` under `artifacts/parity/pink-trombone-logmel/20260527T174139661` has rmsRatio 0.9900 and speechBandRatio 0.0842. This is still not speaking; next pressure is true tract resonance/passive scattering and pressure storage, not more burst gain. - Same-path two-port area discontinuities now emit `graph_area_energy_in_*` and `graph_area_energy_out_*` probes alongside the three-port branch `graph_connection_energy_*` probes. Use these to inspect passivity and formant-body failures at the scatter sites rather than judging only final output loudness. - `FaustExportOptions.DebugProbeUi` wraps graph probe signals in Faust `vbargraph` UI controls under `/debug/...` without changing audio output arity. Native streaming Faust patches now separate writable controls from read-only probe zones and can read/snapshot probe values after `ProcessBlock`; use this for acoustic graph passivity/radiation inspection, leave it off for normal parity renders. diff --git a/tools/run-ipa-trial-loop.ps1 b/tools/run-ipa-trial-loop.ps1 index 6c46218..30c3a0e 100644 --- a/tools/run-ipa-trial-loop.ps1 +++ b/tools/run-ipa-trial-loop.ps1 @@ -117,8 +117,8 @@ function Assert-CandidateBatch { @("mix-a", "mix-m", "mix-s", "mix-p", "mix-u") ) $files = @(Get-ChildItem -LiteralPath $PatchDirectory -Filter "*.aqua" -File -Recurse) - if ($files.Count -lt 25) { - throw "Hypothesis worker wrote $($files.Count) .aqua candidates; expected at least 25." + if ($files.Count -ne 25) { + throw "Hypothesis worker wrote $($files.Count) .aqua candidates; expected exactly 25." } $stems = $files | ForEach-Object { [IO.Path]::GetFileNameWithoutExtension($_.Name) } @@ -133,10 +133,21 @@ function Assert-CandidateBatch { } if (-not $covered) { - throw "Hypothesis worker did not write a candidate for target '$target'. Candidate files must be named __.aqua." + throw "Hypothesis worker did not write a candidate for target '$target'. Candidate files must be named ____.aqua." } } } + + foreach ($stem in $stems) { + $parts = $stem.Split([string[]]@("__"), [StringSplitOptions]::None) + if ($parts.Count -lt 3 -or [string]::IsNullOrWhiteSpace($parts[1]) -or [string]::IsNullOrWhiteSpace($parts[2])) { + throw "Candidate '$stem' does not follow ____.aqua." + } + + if ($parts[1] -cnotmatch '^[a-z0-9]+(-[a-z0-9]+)*$') { + throw "Candidate '$stem' uses invalid family '$($parts[1])'. Family ids must be lowercase kebab-case." + } + } } $repoRoot = Resolve-RepoRoot @@ -159,7 +170,7 @@ Set-Content -LiteralPath $indexPath -Value @" - allow_source_edits: $AllowCodexSourceEdits - trial_results_store: $storePath - worker: $workerProject -- trial_shape: five rounds, each asking for five five-phoneme target-set candidates +- trial_shape: five rounds, exactly 25 candidates per round, one per phoneme lane "@ @@ -237,22 +248,56 @@ Useful repo surfaces: - src/AquaSynth.Faust/IpaTrialOrchestrator.cs - artifacts under $loopRoot +Before writing candidates: +0. Open $preEvidence and include a `PreEvidence Digest` section in $roundDir/hypotheses.md with five metric-bearing facts from it. +1. Run at least three targeted semantic searches and save the outputs under ${roundDir}: + - one for weakest stop/plosive closure evidence; + - one for best vowel/nasal/fricative transferable successes; + - one for dressing/FM/AM/noise versus articulation-owner failures. +2. Open at least three detailed trial records with `show`: one weak stop/plosive, one transferable success, and one dressing-vs-articulation case when available. +3. In $roundDir/hypotheses.md, include a `Retrieval Receipts` section listing the exact search/show files you used. +4. If fewer than three search receipts and three show receipts exist on disk, stop and create the missing retrieval artifacts before writing `.aqua` files. + Task: 1. Read the current loss landscape across gesture, log-mel, RMS, articulation, and primitive timeline evidence. -2. Invent the next candidate patches across five five-phoneme target sets. Cover at least one target from each set, and prefer all 25 when the evidence points to reusable changes: +2. Invent the next candidate patches across five five-phoneme target sets: vowels: a, i, u, e, o nasals/approximants: m, n, ng, l, r fricatives: s, z, f, v, th stops: p, b, t, d, k mixed generalization: mix-a, mix-m, mix-s, mix-p, mix-u -3. Write at least twenty-five new .aqua candidates under: +3. Write exactly twenty-five new .aqua candidates under: $patchDir - Name each file __.aqua so the scorer can infer the reference target. + Name each file ____.aqua so the scorer can infer the reference target and hypothesis family. 4. Make the candidates test transferable hypotheses, not one-off phoneme golf. Reuse the same contour idea across multiple places/manners when that is the claim being tested. 5. If source edits are allowed, refine the DSL or lowering code only when the evidence says the graph owner is wrong rather than the patch values. 6. Write a concise hypothesis report to: $roundDir/hypotheses.md +Candidate design contract: +- Produce exactly 25 files: exactly one candidate for each target lane. No extras. +- Use 3-5 named hypothesis families across the 25 files, for example source-carrier, constriction-place, stop-release, nasal-branch, and dressing-control. +- Filename schema is mandatory: ____.aqua. +- Family ids must be lowercase kebab-case and reused verbatim in filenames and `Hypothesis Families`. +- The family segment in filenames is the canonical hypothesis-family id used by the evaluator. +- The same family name should appear in filenames across multiple target sets when you are testing generalization. +- A family is transferable only if it appears in at least three target sets; otherwise label it exploratory in the report. +- Keep `.aqua` scripts parseable and self-contained. Prefer modifying values and gesture contours already visible in seed candidates before inventing new syntax. +- Do not use source edits as a way to rescue malformed candidate patches. +- Only edit source if two or more retrieved trials indicate the same owner-layer failure pattern; otherwise `Source Edit Decision: none`. +- If Source edits allowed is False, do not edit any file outside $patchDir and $roundDir/hypotheses.md. +- Before finishing, list $patchDir and verify exact count, target coverage, and filename schema in `Acceptance Checklist`. + +Required `$roundDir/hypotheses.md` shape: +- `PreEvidence Digest`: five facts with exact metric keys and values from $preEvidence. +- `Retrieval Receipts`: search/show files used. +- `Loss Landscape Read`: strongest and weakest evidence by family. +- `Hypothesis Families`: 3-5 families, each with owner layer, transfer status, evidence_refs, cited trial_ids, at least one concrete metric key/value from `show`, and predicted metric movement using `gesture:+/-/flat`, `logmel:+/-/flat`, `articulation:+/-/flat`, `rms:+/-/flat`, `timeline:+/-/flat/risk`. +- `Claim Audit`: one row per family: claim -> evidence file(s) -> metric key/value(s) -> predicted movement. +- `Candidate Matrix`: exactly 25 rows with target id, filename, family, expected metric movement, and risk. +- `Source Edit Decision`: `none` unless source edits are allowed and justified by evidence. +- `Acceptance Checklist`: 25 files, one per target id, filename schema, required report sections, >=3 search receipts, >=3 show receipts. + Authority boundary: - Source edits allowed: $AllowCodexSourceEdits - Do not rewrite existing trial artifacts or the CultCache store directly. @@ -331,6 +376,29 @@ $hypothesisOutput Round artifacts are under: $roundDir +Before judging: +1. Run at least three targeted semantic searches into ${roundDir}: + - current round candidates by hypothesizer id or round id; + - weak regressions / failed articulation; + - promising transfer / generalization. +2. Use `show` on at least one promising and one weak candidate from the current round. +3. If the hypothesis worker skipped the required 25-lane matrix or retrieval receipts, mark orchestration/prompt compliance as failed even if some audio metrics improved. + +Use the worker as your search organ: +dotnet run --project tools/IpaTrialWorker/IpaTrialWorker.csproj -- search --store "$storePath" --query "$roundId external-codex-$roundId current round candidates" --limit 30 --output "$roundDir/eval-search-current-round.md" +dotnet run --project tools/IpaTrialWorker/IpaTrialWorker.csproj -- search --store "$storePath" --query "weak regression failed articulation stop plosive source tract radiation" --limit 30 --output "$roundDir/eval-search-weak.md" +dotnet run --project tools/IpaTrialWorker/IpaTrialWorker.csproj -- search --store "$storePath" --query "promising transfer generalization vowel nasal fricative articulation" --limit 30 --output "$roundDir/eval-search-promising.md" +dotnet run --project tools/IpaTrialWorker/IpaTrialWorker.csproj -- show --store "$storePath" --trial-id "" --output "$roundDir/eval-detail-.md" + +Verify compliance from disk as well as the hypothesis report: +- count .aqua files under $patchDir; +- validate exactly 25 files; +- validate one target each for a, i, u, e, o, m, n, ng, l, r, s, z, f, v, th, p, b, t, d, k, mix-a, mix-m, mix-s, mix-p, mix-u; +- validate filename schema ____.aqua. +- validate family ids are lowercase kebab-case. +- derive canonical family ids only from the filename family segment; ignore prose family names when they disagree. +- If any required section, receipt class, per-target validation, filename validation, or family extraction is incomplete, set `Round Compliance: failed`. + Task: 1. Evaluate whether the worker's proposed hypotheses follow from the measured evidence. 2. Call out any hypothesis that is likely full-patch dressing impersonating articulation. @@ -338,6 +406,15 @@ Task: 4. Write your evaluator report to: $roundDir/evaluation.md +Required `$roundDir/evaluation.md` shape: +- `Retrieval Receipts`: exactly five receipts: three search outputs plus one weak show output and one promising show output. Cite no other evidence files in this section. Only cite claims backed by these file paths; write `unknown` when evidence is absent. +- `Commands Run`: exact search/show commands and output paths used to support claims. +- `Round Compliance`: passed/failed, candidate count, target coverage, naming validity, family extraction, and whether the report had the required matrix. +- `Family Verdicts`: one row per canonical filename family with improved/flat/regressed/unknown metrics. Treat |delta| < 0.01 as flat; if deltas are not present in cited show artifacts, write `unknown` and reason=`no delta in receipts`. +- `Generalization Read`: whether effects transferred across target sets or overfit one phoneme. +- `Dressing Audit`: articulation evidence requires movement in gesture/articulation/primitive timeline metrics; FM/AM/noise/envelope evidence without those is dressing. +- `Next Target`: exactly one markdown bullet, final line of the file, and no continuation text: ` | | `. + Authority boundary: - Do not edit source files. - Do not rewrite trial artifacts.