Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
02edf04
WIP: Grounding Manager
briansrls Apr 25, 2026
385f39a
Merge remote-tracking branch 'origin/main' into session/crisp-seal-366
briansrls Apr 25, 2026
a3bc3c3
docs(t-ground-engine-brief): add fallback pointer for unresolved pilo…
briansrls Apr 25, 2026
288d3cd
docs(t-ground-engine-brief): unify audit-doc location with existing w…
briansrls Apr 25, 2026
cc67b81
Merge remote-tracking branch 'origin/main' into session/crisp-seal-366
briansrls Apr 25, 2026
6fd81ea
docs(grounding): post-pilot manager bundle — receipt + Director escal…
briansrls Apr 25, 2026
b900270
docs(grounding): record Director Route 1 routing + manager-side input…
briansrls Apr 25, 2026
b1cb302
Merge remote-tracking branch 'origin/main' into session/crisp-seal-366
briansrls Apr 25, 2026
b2c72dc
docs(t-ground-engine-brief): drop stale fallback now that receipt lan…
briansrls Apr 25, 2026
25c84c1
docs(grounding): purge residual pre-routing language across all four …
briansrls Apr 25, 2026
40a7469
Merge remote-tracking branch 'origin/main' into session/crisp-seal-366
briansrls Apr 25, 2026
fa769e3
Merge remote-tracking branch 'origin/main' into session/crisp-seal-366
briansrls Apr 25, 2026
0c66c32
Merge remote-tracking branch 'origin/main' into session/crisp-seal-366
briansrls Apr 25, 2026
a8396e1
docs(t-ground-engine-brief): add status banner to prevent Phase 0 re-…
briansrls Apr 25, 2026
17fa80c
docs(grounding): final live-state pass + dual-status tracked-debt entry
briansrls Apr 25, 2026
9bb074a
docs(grounding): fix top-of-file live-state stragglers (REQUEST_CHANG…
briansrls Apr 25, 2026
08969f7
Merge remote-tracking branch 'origin/main' into session/crisp-seal-366
briansrls Apr 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions docs/briefs/grounding-manager.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# R2 Grounding Manager Brief

**Status:** `PROPOSAL` — pending R2 proposal
([`docs/r2-structure.md`](../r2-structure.md), PR #754) merge +
R1 all-gates-green closure. Until then, this brief is the R2
Grounding Manager's scope-in-preparation; it does not dispatch
work. On R2 promotion, the `PROPOSAL` banner lifts and this brief
becomes the live dispatch authority for the lane.
**Status:** `PROPOSAL` (formal) → `ACTIVE` (Director-discretionary).
Formal R2 promotion still pending R1 all-gates-green closure +
[`docs/r2-structure.md`](../r2-structure.md) promotion to ROADMAP.
Director-discretionary dispatch has been used since 2026-04-25 for
T-Ground-Pilot (PR #765, merged) and T-Ground-Engine-Phase-1 audit
(PR #768, merged). Engine implementation parked pending the loader-close
PR (Director routed Route 1 on 2026-04-25; substrate ask is in flight as
ad-hoc Director dispatch) — see [`t-ground-engine-substrate-escalation.md`](t-ground-engine-substrate-escalation.md).
Working state at the bottom of this brief reflects current dispatch state.

## Orient before reading

Expand Down Expand Up @@ -248,11 +251,11 @@ to director before dispatching full-reference work.

Lane-owner dispatch status (update as sub-deliverables close):

**T-Ground-Pilot:**
- [ ] Rust primitive `.dag` declarations (i8–i64, u8–u64, bool, Unit)
- [ ] Toy inhabitance-search engine
- [ ] Routing-stability tests against pilot set (parity with current table)
- [ ] Pilot receipt document
**T-Ground-Pilot:** ✅ COMPLETE (PR #765 merged 2026-04-25 commit `2909f9e05`; receipt in [`grounding-pilot-receipt.md`](grounding-pilot-receipt.md))
- [x] Rust primitive `.dag` declarations (i8–i64, u8–u64, bool, Unit)
- [x] Toy inhabitance-search engine
- [x] Routing-stability tests against pilot set (parity with current table)
- [x] Pilot receipt document

**T-Ground-Rust:**
- [ ] Numeric types (integer, float, character)
Expand All @@ -278,11 +281,12 @@ Lane-owner dispatch status (update as sub-deliverables close):
- [ ] Array, slice, map, struct, pointer
- [ ] Function, interface, channel

**T-Ground-Engine:**
- [ ] Inhabitance-search walker
- [ ] Minimum-satisfier selection
- [ ] Fail-closed tie-breaking with structured diagnostic
- [ ] Cross-type coercion paths (e.g., UTF-8 `Char ↔ u8`)
**T-Ground-Engine:** ⏸️ PARKED — Phase 0 substrate audit complete (PR #768 merged 2026-04-25 commit `4afc0d794`); Director routed Route 1 (small loader-close, ad-hoc Director dispatch). Engine re-dispatches in sharpened-(b) form once the loader-close PR merges. See [`t-ground-engine-substrate-escalation.md`](t-ground-engine-substrate-escalation.md).
- [x] Phase 0 substrate audit (concluded escalation-class)
- [ ] Inhabitance-search walker (Phase 1, blocked on loader-close PR)
- [ ] Minimum-satisfier selection (Phase 1)
- [ ] Fail-closed tie-breaking with structured diagnostic (Phase 1; pilot established the contract baseline)
- [ ] Cross-type coercion paths (e.g., UTF-8 `Char ↔ u8`) (Phase 2; blocks on full-reference)

**T-Ground-Tests:**
- [ ] Routing-stability TestClaim variant declared
Expand All @@ -299,16 +303,30 @@ Lane-owner dispatch status (update as sub-deliverables close):
- [ ] Remove `TypeRealization.carrier: String` field from `src/v3/std/emit_model.dag`
- [ ] Remove emit-pipeline call sites reading the old surface
- [ ] All test claims assert against the new structural authority (no residual reads of deleted scaffolding)
- [ ] Delete `src/v3/grounding_pilot/` workspace member (scope-expansion confirmed in PR #765)
- [ ] Delete Engine sibling crate if Route 1/3 dispatched as (b.i) (scope-expansion contingent on Director routing)
- [ ] Track 13 closure PR lands — single step

Decisions log (append as they happen):

- _(none yet)_
- **2026-04-25** — Pilot dispatched and merged under Director-discretionary dispatch (R2 promotion gates not yet formally fired). PR #765.
- **2026-04-25** — Pilot lessons synthesized into [`grounding-pilot-receipt.md`](grounding-pilot-receipt.md). Five carry-forwards: Stratum-B finding, mirroring-as-substrate-ask, fail-closed contract baseline, SG-0 location reasoning, state-space discipline as full-reference precedent.
- **2026-04-25** — Pilot's `RustPrimitive` partition (`IntegerPrimitive | NonIntegerPrimitive`) locked as full-reference precedent shape via codex P2 adjudication. Future widening to flat record is out of scope.
- **2026-04-25** — Engine-Phase-1 brief landed (PR #767, `t-ground-engine-phase-1.md`). Audit-first discipline; no Rust-constant mirroring; variant-aware walker; SG-0 untouched.
- **2026-04-25** — Engine-Phase-1 Phase 0 audit landed (PR #768, `t-ground-engine-substrate-audit.md`). Conclusion: both options (a) and (b) block on the same substrate gaps; escalation-class. Engine implementation parked.
- **2026-04-25** — Engine substrate ask escalated to Director via [`t-ground-engine-substrate-escalation.md`](t-ground-engine-substrate-escalation.md). Manager recommended Route 3: route Gap 1 close through Pure Bootstrap to Zero program (PB-1 / PB-Bootstrap-Process scope overlap). *(Past tense — overruled in next entry.)*
- **2026-04-25** — Director chose **Route 1** (small loader-close, ad-hoc Director dispatch). Manager recommendation overruled with substantive reasoning: PB-1 migrates *existing* fixture sets; deciding the bootstrap shape includes a new fifth set is upstream of PB-1's pattern. Faster unblock: sharpened (b) Engine within days vs quarters for full Pure Bootstrap to Zero scope. Manager internalized the upstream-vs-pattern distinction for future cross-manager flagging.

Open questions for director:

- _(none yet — program is pre-dispatch)_
- ~~**Engine substrate routing**~~ — RESOLVED 2026-04-25. Route 1 chosen by Director.
- **R2 promotion timing** — formally still PROPOSAL pending R1 all-gates-green closure. R1 Census Close landed (PR #763) but Director-discretionary dispatch has been used for Pilot + Engine-Phase-1-audit. Consider formalizing the promotion or making the discretionary mode explicit in `r2-structure.md`. **See Tracked debt below.**

Tracked debt (manager surfaces, Director resolves):

- **Dual-status convention (`PROPOSAL` formal / `ACTIVE` discretionary).** Currently load-bearing for two dispatched lanes (Pilot, Engine-Phase-1 audit) and likely a third (loader-close → Engine re-dispatch). **Owner**: Director. **Forcing function**: if this convention survives one more dispatch (i.e., loader-close lands and Engine re-dispatches under it), manager surfaces as escalation rather than queued open-question — the cost of dual-authority dispatch state grows non-linearly past three live dispatches per `feedback_state_space_vs_behavioral_invariants` (status as an enum-with-implicit-modes admits illegal combinations like "PROPOSAL but ACTIVE"). **Resolution paths** (Director picks one): (a) formalize R2 promotion explicitly via `r2-structure.md` amendment; (b) add a "Director-discretionary dispatch" mode to `r2-structure.md` as a first-class status alongside PROPOSAL/ACTIVE; (c) defer formalization with explicit "do not let this accumulate" sunset commitment.

Cross-manager notifications queued:

- _(none yet — awaits R1 close + substrate-capability closure signals from Surface and Testgen Managers)_
- ~~**Pure Bootstrap to Zero Manager** (PR #766) — substrate ask~~ — Director chose Route 1 (ad-hoc dispatch, not routed through Zero-Floor). Director handles Zero-Floor heads-up directly per cross-program coordination. No manager-side notification queued.
- **Surface / Testgen Managers** (R1, archived on R1 close per `r2-structure.md`) — pilot's fail-closed-by-construction shape (`GroundingError::{Ambiguous, NoInhabitant}`) is general-purpose, not Grounding-specific. If their wind-down work hasn't closed yet, this shape is reusable as a contract baseline.
109 changes: 109 additions & 0 deletions docs/briefs/grounding-pilot-receipt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# T-Ground-Pilot — Receipt

**Status**: COMPLETE. Pilot lane closed via [PR #765](https://github.com/gunb-ai/gunbc/pull/765) (merged commit `2909f9e05`, 2026-04-25).

**Purpose**: capture the lessons the pilot established empirically, so they carry forward into Engine + full-reference + Dissolve scopes without requiring future workers to re-derive them from the PR thread. Manager-authored synthesis per the [grounding-manager brief](grounding-manager.md) ("Pilot deliverable #4 — manager scope, not worker scope").

**Audience**: T-Ground-Engine workers (any phase), T-Ground-Rust / -Python / -Go workers (when substrate unblocks), T-Ground-Tests workers, R2 Grounding Manager (working-state inputs), Director (program-scope review).

---

## Framing question the pilot answered

*Does inhabitance-search routing — consuming structural target-primitive declarations and selecting by algebra-homomorphism — produce the same target-primitive selection as today's name-keyed table lookup, on a small Rust pilot set?*

**Answer**: Yes, with a finding. Routing parity stratifies into two strata:

- **Stratum A** (3 of 10 pilot types — `Int(=Int64)→i64`, `Bool→bool`, `Unit→()`): exact match against today's `rust_type_checkpoints`.
- **Stratum B** (7 of 10 — `Int8/16/32`, `UInt8`–`UInt64`): engine produces canonical width-correct primitive that the name-keyed table cannot reach. The fallback `OrderedRing→i64` algebra-inhabitant is width-blind (would mis-route `Int8` to `i64`); `Semiring` has no inhabitant declared at all (unsigned types fail-closed today).

The proposal's central architectural claim — *structural `(algebra, carrier)` matching strictly subsumes name-keyed lookup* — was empirically demonstrated. The proposal did not need amendment.

---

## The five lessons

These are the carry-forwards. Each cites its empirical source (the PR commit or comment that produced it) and names where the lesson routes forward.

### Lesson 1 — Stratum-B finding: full-reference scope is larger than implicit baseline

**What we learned.** Today's table-driven coercion surface (`dsl/extdeps/languages/rust/types.dag`'s `rust_type_checkpoints` + `rust_algebra_inhabitants`) covers far less than the implicit baseline assumed. Of the 10 pilot types, only 3 have name-keyed routing entries; 7 either mis-route via width-blind fallbacks or fail-closed entirely.

**Source.** [PR #765 body — "Parity finding (pilot-success signal, not an escalation)"](https://github.com/gunb-ai/gunbc/pull/765); [LGTM comment 4317308089](https://github.com/gunb-ai/gunbc/pull/765#issuecomment-4317308089).

**Forward routing.** T-Ground-Rust / -Python / -Go workers and brief authors must internalize: *the full-reference lanes' true scope is "model the language reference's primitives" + "extend routing onto previously fail-closed surface."* The latter is invisible from the existing tables — it only becomes visible by enumerating the language reference and discovering what's missing. Brief authors for the full-reference lanes should not size scope by counting existing table rows.

**Forward routing (T-Ground-Dissolve).** Dissolution doesn't just swap table-routing for engine-routing on covered surface — it also extends routing onto previously fail-closed surface. The dissolution PR is a strict-superset behavior change, not a like-for-like swap.

### Lesson 2 — Mirroring is forbidden; eliminating it is a substrate ask

**What we learned at pilot time.** The pilot's Rust-constant mirror of `dsl/extdeps/languages/rust/primitives.dag` (and of `dsl/std/integer.dag`'s type-mappings) is a load-bearing concession with hand-sync risk. The lesson, as originally written: *Engine's load-bearing scope is to consume `.dag` declarations directly, eliminating the mirror.*

**What the audit revealed (post-pilot).** The mirror existed precisely because the v3 substrate doesn't load `dsl/extdeps/languages/*` into the bootstrap Dag at all (`bootstrap.rs:16-19` — *"Production bootstrap does not inject target-language realizations"*). The pilot's choice to mirror was forced by the substrate, not by pilot-scope convenience. Eliminating the mirror is a **substrate-capability question**, not an Engine-internal question.

**Source.** Pilot mirroring discipline first articulated in [PR #765 LGTM comment 4317308089](https://github.com/gunb-ai/gunbc/pull/765#issuecomment-4317308089); substrate dependency confirmed in [the Phase 0 audit](t-ground-engine-substrate-audit.md) (PR #768 merged 2026-04-25).

**Forward routing.** Engine cannot honor "no mirroring" without the extdeps loader closing. See `docs/briefs/t-ground-engine-substrate-escalation.md` for the routing decision.

**Forward routing (full-reference lanes).** Same constraint: T-Ground-Python / -Go cannot consume their respective `dsl/extdeps/languages/*/primitives.dag` files without the extdeps loader. Their dispatch shape depends on the same substrate close.

### Lesson 3 — Fail-closed by construction is the contract baseline

**What we learned.** The pilot proactively shipped `GroundingError::{Ambiguous, NoInhabitant}` plus structural tests (`pilot_primitives_have_unique_algebra_carrier_keys`, `missing_inhabitant_fails_closed`). The original pilot brief allowed deferring fail-closed discipline to Engine; the worker chose to lock it at pilot scope per `feedback_fail_closed_discipline.md`.

**Source.** Pilot crate `src/v3/grounding_pilot/src/lib.rs`, fail-closed shape per [PR #765](https://github.com/gunb-ai/gunbc/pull/765).

**Forward routing.** Engine doesn't need to *introduce* fail-closed selection — only generalize it (minimum-satisfier selection, structured diagnostics naming candidates). Pilot's bare-vector `Ambiguous { candidates }` is the floor; Engine produces a real diagnostic per the proposal's L4 surface. **This is a contract, not a suggestion** — Engine that drops fail-closed shape regresses against pilot.

**Forward routing (T-Ground-Tests).** L4 witness-based certification can rely on the contract being load-bearing in the engine, not just decorative. Tests can assert against `Ambiguous` / `NoInhabitant` outcomes as first-class behaviors.

### Lesson 4 — SG-0 ratchet drives Engine location decision

**What we learned.** The pilot's manager-brief candidate location (`src/v3/compiler/src/pilot/grounding_pilot.rs`) would have ratchet-bumped the SG-0 hand-Rust ratchet on `src/v3/compiler/`. Worker restructured to a sibling crate (`src/v3/grounding_pilot/`) — strictly better than the manager-brief default because workspace-member removal is a cleaner "deletable as a unit" than module deletion.

**Source.** [PR #765 PR body — "File-location decisions"](https://github.com/gunb-ai/gunbc/pull/765); manager endorsement in [LGTM comment 4317308089](https://github.com/gunb-ai/gunbc/pull/765#issuecomment-4317308089).

**Forward routing.** If Engine remains hand-Rust temporarily (sharpened (b.i) per the substrate-escalation), it must inherit the same SG-0 constraint — sibling-crate or `.dag`-defined, never under `src/v3/compiler/`. The Engine-Phase-1 brief codified this in its Phase 0 audit options ((c) `src/v3/compiler/` is REJECTED on SG-0 grounds).

**Forward routing (T-Ground-Dissolve).** Dissolve scope already expanded to delete `src/v3/grounding_pilot/`. If Engine ships in a sibling crate, Dissolve scope expands further to delete that crate too. Both deletions are workspace-member removals (clean).

### Lesson 5 — State-space discipline: precedent shape for full-reference

**What we learned.** The original `RustPrimitive` declaration carried `overflow: IntegerOverflow?` with a doc-comment convention ("none for non-integer primitives"). Codex P2 review caught the gap: the type admitted illegal state combinations (`bool: Some(TwoComplementWrap)`, `i64: None`). Manager called for a structural fix per `feedback_state_space_vs_behavioral_invariants` and `feedback_no_validation_passes`. Worker partitioned `RustPrimitive` into `IntegerPrimitive | NonIntegerPrimitive` — overflow lives only on the integer variant; structurally absent from non-integer.

**Source.** Codex P2 finding + manager adjudication in [comment 4317414841](https://github.com/gunb-ai/gunbc/pull/765#issuecomment-4317414841); structural-fix commit on the pilot branch.

**Forward routing.** `RustPrimitive`'s sum-type partition is the **precedent shape** that `PythonPrimitive` / `GoPrimitive` inherit. T-Ground-Python / -Go briefs must require state-space discipline at the type-shape level (not via doc-comment convention or `Option`-with-validation). Specifically:

- Identify per-target the analog axes where overflow / Copy-trait / mutability / GIL-affinity / etc. only apply to a subset of primitives.
- Partition the per-target `Primitive` type structurally so subset-only fields live only on the variants where they're meaningful.

**Forward routing (Engine).** Variant-aware walker handling is a contract: `find_inhabitant` and equivalents must dispatch on `IntegerPrimitive | NonIntegerPrimitive` to extract the variant-typed `algebra` field. The Engine-Phase-1 brief codified this via the state-space-discipline test requirement.

**Forward routing (T-Ground-Dissolve).** Widening `RustPrimitive` back to a flat record is locked out of scope per the codex P2 adjudication. Dissolve cannot simplify the partition away.

---

## What this receipt does NOT contain

- **Worker-level implementation details.** The pilot's engine code, test names, and per-line decisions live in [PR #765](https://github.com/gunb-ai/gunbc/pull/765) and `src/v3/grounding_pilot/src/lib.rs`. This receipt is lessons, not history.
- **Brief amendments.** Lessons that should reshape future briefs are flagged; the actual amendments happen in the relevant brief PRs.
- **Director-routed substrate decisions.** The mirroring lesson's substrate ask is documented in [`t-ground-engine-substrate-escalation.md`](t-ground-engine-substrate-escalation.md), not here.

---

## Cross-program implications

- **Pure Bootstrap to Zero program.** The extdeps-loader gap (Lesson 2 forward routing) overlaps directly with PB-1 / PB-Bootstrap-Process scope (`bootstrap.rs` data-driven loader). See substrate-escalation doc for concrete coordination ask.
- **R1 Substrate Manager (archived on R1 close).** The pilot's lessons about state-space discipline, fail-closed contract, and structural over conventional are general-purpose and should inform DB-11 + cardinality-substrate design decisions if those sub-lanes haven't yet finalized their type shapes. The lessons are framework-level, not Grounding-specific.
- **R2 Grounding Manager working state.** Lane checklist updated in `grounding-manager.md`. Pilot lane ✅. Engine-Phase-1 audit complete + parked pending loader-close PR (Director routed Route 1; substrate ask is in flight as ad-hoc Director dispatch).

---

## Lineage

- Parent program: ROADMAP.md §"Post-R1 Program — Grounding Completeness" (current); §"Release R2 Program" → T-Ground (post-promotion).
- Parent thesis claim: THESIS.md Tier 1 → "Grounding completeness."
- Parent architectural design: [`docs/single-emitter-design.md`](../single-emitter-design.md).
- Parent worked-examples doc: [`docs/thesis/target-grounding-proposal.md`](../thesis/target-grounding-proposal.md).
- Sibling artifacts: [`grounding-manager.md`](grounding-manager.md), [`t-ground-engine-phase-1.md`](t-ground-engine-phase-1.md), [`t-ground-engine-substrate-audit.md`](t-ground-engine-substrate-audit.md), [`t-ground-engine-substrate-escalation.md`](t-ground-engine-substrate-escalation.md).
Loading
Loading