docs: S16 Swang — pattern-first roadmap, ADR-0029, and the proposed semantic core - #111
Conversation
📝 WalkthroughWalkthroughThe PR extends the documented roadmap through S16 and adds ADR, stage, glossary, process, and normative specification documentation for Swang deterministic authoring and verified lifting. ChangesSwang S16 roadmap and specification
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The constitution said stage numbering follows glossary §0 only, and the glossary stopped at S14 — the earlier cut of this branch resolved that tension the wrong way round, by making the stage documents canonical. Restore the glossary's authority and repair the lag instead: S15 and S16 get their §0 entries, SPEC points back at §0 as the canonical list, and the AGENTS routing range catches up to S16. The Swang ADR takes the next free number, 0029 — 0028 is the ui-core theme, already merged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
ADR-0028 belongs to the ui-core theme, already merged — this branch's Swang ADR collided with it and moves to the next free number. While re-indexing, add the 0028 row the theme PR forgot. The rewrite folds in what the design interview settled: two crates with griff-pattern std-only; budgets layered where each limit is meaningful and pruning as a named path-addressed hash (swang-prune-hash-v1) with an independent seed; a monotonic additive-only language level whose check is a frozen first-line pre-parser, never an input to a content hash; the rhythm override as an explicit third source in ranked_candidates (strategies and RhythmTemplate semantics unchanged); recursive descent as an initial implementation strategy rather than an immutable contract; and fractal lifting demoted to a research candidate with an admission bar. A prior-art section records the four surveys with scoped claims — including UPIC as the contrasting fixed-axis design. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
Reorder the phases so the first implementation work proves the risky hypothesis — a hierarchical pattern passing through the unchanged S6 generator into an audible riff — instead of the safe one, that a parser can be written. The canonical score text moves behind the vertical slice; the transport syntax for Phase 2 is namespaced CLI flags with an explicit rhythm unit, tail policy, independent rhythm seed, and a versioned expansion artifact whose fingerprints come from the public rhythm_diagnostics. Fractal *lifting* leaves the promised phases for the deferred-research list with an explicit admission bar; morton and depth_first are not reserved names. Decision refs move to ADR-0029 and the normative semantics to docs/swang/spec.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
…ays so docs/swang/spec.md splits by stability on purpose: the semantic core (language levels, the determinism law and its bans, units, layered budgets, kernel/traversal/time-slot semantics, swang-prune-hash-v1 with its encoding and edge laws, the rhythm-override precedence, independent seeds, the expansion artifact) is frozen — any change is a new language level — while the Phase-2 CLI is labelled the transport experiment it is, with its sixteen acceptance tests, and the research list promises no names. The grammar is deliberately absent: it earns its section when the operators have survived contact with a real riff. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da5c6a7c17
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 8
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/adr/0029-swang-authoring-and-verified-lifting.md`:
- Around line 33-36: Update the prior-art survey count in the ADR introduction
to avoid claiming exactly four surveys when the section covers additional
distinct areas such as UPIC and Euclidean rhythms. Replace “four surveys” with
“several surveys” or revise it to enumerate the exact count and grouping
consistent with the section contents.
- Around line 18-22: Update the source-structure discussion in the ADR to
distinguish flattened MIDI from Guitar Pro: describe repeat markers and
alternate endings as preserved Guitar Pro notation that can be lifted directly,
while reserving the program-synthesis classification for constructs genuinely
absent from the input. Adjust the verification statement accordingly without
changing the broader verified-lifting model.
In `@docs/glossary.md`:
- Around line 121-127: Update the S16 glossary entry to clarify that S1/S3/S6
are only the core dependencies, or align its dependency summary with the full
set documented in the S16 stage page, including S2, S4, and conditional S15.
In `@docs/process-backlog.md`:
- Around line 17-19: Revise the “a pruned parent yields no active descendants”
backlog wording to avoid claiming that proptest proves or pins the semantics.
State that proptest currently exercises or guards the invariants, and retain
that Kani is planned for stronger bounded verification.
In `@docs/swang/spec.md`:
- Around line 278-303: Complete the Phase-2 budget contract by defining whether
fractal depth, cell limits, and lowering limits are required CLI flags or
supplied by a versioned frontend profile. Update docs/swang/spec.md at lines
278-303 to document every required flag or default, and align
docs/stages/S16-swang-language-and-verified-lifting.md at lines 300-315 so its
transport example and acceptance criteria use the same contract.
- Around line 24-31: Expand the first-line language-level section in the Swang
specification with a normative header example and precise lexical rules: define
the exact tokens, permitted whitespace, encoding, and line termination. Specify
pre-parser behavior for missing or duplicate headers, including deterministic
rejection, while preserving the frozen, first-line-only parsing contract.
- Around line 147-149: The canonical conversion rule must be defined in
docs/swang/spec.md lines 147-149: specify whether transport uses integer basis
points or an exact decimal-to-basis-points conversion, including serialization
and rounding behavior. Apply that same rule to the temporary CLI example in
docs/swang/spec.md lines 287-295, replacing ambiguous 0.8 usage, and update the
stage example and acceptance contract in
docs/stages/S16-swang-language-and-verified-lifting.md lines 307-315 to use and
verify the identical deterministic representation.
- Around line 205-216: Define the normative bar geometry for map_rhythm in
docs/swang/spec.md, binding bar length and meter to the canonical master
timeline or requiring explicit geometry input and recording it in the expansion
artifact. Align the Phase-2 vertical slice in
docs/stages/S16-swang-language-and-verified-lifting.md with that same source;
both sites must use one consistent geometry definition.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8175131f-5cf5-4910-9567-3a397f4ddf93
📒 Files selected for processing (10)
AGENTS.mdREADME.mddocs/SPEC.mddocs/adr/0029-swang-authoring-and-verified-lifting.mddocs/adr/README.mddocs/decisions.log.mddocs/glossary.mddocs/process-backlog.mddocs/stages/S16-swang-language-and-verified-lifting.mddocs/swang/spec.md
Architecture review: changes requested before mergeThe pattern-first structure, crate split, rhythm-override seam, honest residual model, and demotion of fractal lifting are all materially better than the first cut. The Decomposer reference also supports the stated reconstruction-vs-readability failure mode. The PR is not merge-ready yet. Codex and CodeRabbit currently have ten unresolved review threads; I verified the major ones as valid. Please address those, plus the two additional contract issues below. Blocking semantic issues
Cross-document corrections
Once these are resolved, the architecture is suitable to merge and open Phase 0/1. CI is currently green on |
… bar geometry Address the ten review threads plus the two architecture blockers from the summary review (comment 4971565841): - the header line gets its byte-exact forever grammar (UTF-8 no BOM, "swang" SP level, LF/CRLF rule, 64-byte pre-parser, typed errors), and the semantic core is honestly restyled Proposed-until-Phase-0 — documents stop time-travelling ahead of their own ADR; - swang-prune-hash-v1 separates the injective path *serialization* from the 64-bit *hash* that may collide (sole consequence: a shared keep/prune decision), fixes structural child order independent of traversal, and states the full normative algorithm — mix64 constants, DOMAIN/GAMMA, the constant per-node threshold floor(bps·2^64/10000) in u128, emergent cumulative decay, and edge laws at 0 and 10000; golden vectors are demoted to illustrations of the algorithm; - map_rhythm gains bar geometry: PPQN and meter bind to the canonical master timeline, v0.1 requires a constant meter (SWG0304), the unit must divide the bar exactly (SWG0301), and the geometry is recorded in the expansion artifact; - density transport goes integer end to end: --rhythm-density-bps 0..=10000, no decimal grammar, no float anywhere; - the Phase-2 budget contract closes: depth is exact and doubles as max_depth, max-cells has a documented *frontend* default, and the time-domain limits are satisfied by construction until an operator can violate them; - the diagnostic registry opens for real (SWG0001–SWG0304 assigned); - v0.1 operators split into specified (fractalize, linearize, map_rhythm, thin) versus a candidate roster with no promised semantics; bars = 4 leaves the map_rhythm example; - Guitar Pro is no longer flattened to MIDI's level: notated repeats and alternate endings lift as recorded facts (ADR-0022), synthesis begins above them; - glossary/stage S16 dependencies align; the survey count reads as grouped-by-theme; the backlog stops calling proptest a proof. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
|
Review fixes landed in f4d510e — thread-by-thread map: Architecture blockers (comment 4971565841):
Automated threads:
🤖 Generated with Claude Code |
Keys at different levels are deterministic transformations of one seed, not provably independent random variables — for a fixed seed the probability is not even defined. State the exact normative law (active iff the cell and every tested ancestor pass) and demote (bps/10000)^d to the design intuition it is, under an explicitly named independent-uniform assumption. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
Summary
Formalize S16: Swang language and verified lifting as Griff's deterministic musical authoring and decompilation roadmap — reworked after the full design interview on #108 and rebased over the merged theme work (#110, #112).
What changed since the first cut
docs/swang/spec.md— the normative semantics, split by stability: a proposed semantic core — frozen at Phase 0 acceptance — (language levels, determinism law, units, layered budgets, kernel/traversal/time-slot semantics,swang-prune-hash-v1, rhythm-override precedence, independent seeds, the expansion artifact) versus an explicitly temporary Phase-2 CLI transport syntax with sixteen acceptance tests. The grammar is deliberately absent until the operators survive contact with a real riff.docs/stages/; that was a constitutional amendment hiding in a docs PR. Reverted: S15/S16 are added to §0 instead, SPEC points back at §0, AGENTS routing catches up to S0…S16.griff-pattern(std-only structural algebra) +griff-swang(AST, parser, lowering);griff-corenever depends on either.Developer impact
Validation
mainafter Cockpit band legibility, plus the CI gate that should have caught it #110/ADR-0028: one palette, two renderers, contrast asserted #112 merged; ADR index now carries both 0028 (theme) and 0029 (Swang);ADR-0028-as-Swang orS0…S14references outside append-only history.Refs #108
🤖 Generated with Claude Code
https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
Summary by CodeRabbit
New Features
Documentation