Skip to content

feat(model-matrix): deploy model-matrix config and meta-prompt pack to hero repos via uf init - #900

Merged
jflowers merged 23 commits into
unbound-force:mainfrom
jflowers:opsx/model-matrix-scaffold-deployment
Nov 1, 2026
Merged

jflowers merged 23 commits into
unbound-force:mainfrom
jflowers:opsx/model-matrix-scaffold-deployment

Conversation

@jflowers

@jflowers jflowers commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Deployed the model-matrix configuration surface (slice 1, #887) to hero repos via uf init, closing the slice-1 gap where a freshly scaffolded repo's tracked .uf/model-matrix.yaml named the meta-prompt pack with no pack file — making every uf_delegate_command fail non-retryably with MATRIX_INVALID. What ships:

  • Meta-prompt pack deployment (SC-FR-008): canonical .opencode/uf/packs/meta-prompt.md gains a byte-identical embedded mirror; alwaysDeployedPacks and collectDeployedPacks entries deploy it regardless of detected language (full and DivisorOnly modes) and list it in scaffolded AGENTS.md; its two self-describing comments revised for deployed status, MP-001 through MP-024 rules unchanged.
  • meta-prompt-custom.md template: user-owned initial-deployment template following the *-custom.md pattern — seeded once, never overwritten, drift-exempt by the custom-pack skip rule.
  • Classifier subagent: hidden .opencode/agents/model-matrix-classifier.md mirrored so hero repos get the agent-engine half of the classifier cascade instead of silently degrading to static defaults (user-owned on re-init, deny-all permissions).
  • Re-init ownership (SC-FR-010): the deployed .uf/model-matrix.yaml is reclassified as a team-owned extension point (isToolOwned flip, the Added review agents survive uf init in review-matrix.yaml but not reviewer-capabilities.yaml #884/docs: reviewer-capabilities.yaml survives plain uf init re-runs (reviewer-capabilities-init-survival) #886 review-matrix precedent) — team edits survive plain re-init, --force replaces, fresh deploys seed the template; the .uf/schemas/model-matrix/ registry and canonical packs stay tool-owned and refresh on diff.
  • Deployment completeness guard (SC-FR-009): new TestSCFR009_DeploymentCompletenessGuard parses the embedded template and fails naming any packs: key without an embedded pack file — the regression test that would have caught the slice-1 gap.
  • Tests and docs: full test-registry updates (asset paths, ownership/divisor/deployment tables, TestRun_ModelMatrixPreservedOnRerun, fresh-deploy parity assertions), docs/configuration.md "Scaffold deployment" subsection with the re-init ownership table and healing note, CHANGELOG entry, AGENTS.md convention-pack list. Documentation issues filed per the gate: docs: model-matrix scaffold deployment via uf init (model-matrix-scaffold-deployment) #899 and docs: model-matrix-scaffold-deployment — uf init deploys the model-matrix surface to hero repos website#362.

Repos scaffolded during the slice-1 window (invalid matrix naming meta-prompt) are healed by re-running uf init: the pack deploys as a new file regardless of ownership, making the existing matrix valid.

Closes #889

How to Test

Full CI-parity gate (fresh green at final head 79f1596f):

make check   # lint + go test -race -count=1 ./... + build + coverage gate + plugin suite

Targeted scenario tests, mapped to the spec delta:

# Drift enforcement for the new mirrors (SC-FR-008)
go test -race -count=1 -run 'TestEmbeddedAssets_MatchSource|TestCanonicalSources_AreEmbedded|TestAssetPaths_MatchExpected|TestSCFR001_CanonicalAssetSurfaceMatchesMirrors' ./internal/scaffold/

# Deployment completeness guard (SC-FR-009)
go test -race -count=1 -run TestSCFR009_DeploymentCompletenessGuard ./internal/scaffold/

# Re-init ownership: team matrix + custom pack preserved, tool-owned refresh, --force replaces (SC-FR-010)
go test -race -count=1 -run 'TestRun_ModelMatrixPreservedOnRerun|TestRun_OverwriteOnDiff_ToolOwned' ./internal/scaffold/

# Ownership / deployment classification tables
go test -race -count=1 -run 'TestIsToolOwned|TestIsDivisorAsset|TestShouldDeployPack|TestCollectDeployedPacks|TestEnsureAGENTSmdPackSection' ./internal/scaffold/

End-to-end manual scenario (acceptance criteria 1-2):

  1. go run ./cmd/unbound-force init /tmp/hero-test — the created list must include .uf/model-matrix.yaml, .uf/schemas/model-matrix/v1.schema.json, .opencode/uf/packs/meta-prompt.md, .opencode/uf/packs/meta-prompt-custom.md, and .opencode/agents/model-matrix-classifier.md.
  2. Edit /tmp/hero-test/.uf/model-matrix.yaml (add a profile) and meta-prompt-custom.md (add a CR rule), then re-run plain uf init /tmp/hero-test — both files must be skipped with content unchanged, while tool-owned files with differing content update.
  3. Re-run with --force — the team-edited matrix is replaced with the embedded template.

How to Demo

  1. Run go run ./cmd/unbound-force init /tmp/hero-demo on an empty directory and show the created-file list: .uf/model-matrix.yaml, .uf/schemas/model-matrix/v1.schema.json, .opencode/uf/packs/meta-prompt.md, .opencode/uf/packs/meta-prompt-custom.md, .opencode/agents/model-matrix-classifier.md.
  2. Add a profile to /tmp/hero-demo/.uf/model-matrix.yaml and a CR rule to meta-prompt-custom.md; re-run plain uf init /tmp/hero-demo — both edited files are reported skipped with content unchanged, tool-owned files refresh on diff.
  3. Re-run with --force — the team-edited matrix is replaced by the embedded template (documented escape hatch).

Key Files Changed

 .opencode/uf/packs/meta-prompt-custom.md           |  20 +
 .opencode/uf/packs/meta-prompt.md                  |  26 +-
 .../review-dispatch-20261101T210122-jay-flowers.md |  10 +
 ...caffold-security-20261101T210116-jay-flowers.md |  10 +
 ...scaffold-testing-20261101T185714-jay-flowers.md |  10 +
 ...scaffold-testing-20261101T210118-jay-flowers.md |  10 +
 .../spec-authoring-20261101T210120-jay-flowers.md |  10 +
 .../test-quality-20261101T210124-jay-flowers.md    |  10 +
 AGENTS.md                                          |   1 +
 CHANGELOG.md                                       |  38 ++
 cmd/unbound-force/main_test.go                     |  15 +-
 docs/configuration.md                              |  74 ++++
 .../opencode/agents/model-matrix-classifier.md     |  56 +++
 .../assets/opencode/uf/packs/meta-prompt-custom.md |  20 +
 .../assets/opencode/uf/packs/meta-prompt.md        | 249 +++++++++++
 internal/scaffold/scaffold.go                      |  28 +-
 internal/scaffold/scaffold_test.go                 | 461 +++++++++++++++++++--
 .../.openspec.yaml                                 |   3 +
 .../model-matrix-scaffold-deployment/design.md     | 260 ++++++++++++
 .../model-matrix-scaffold-deployment/notes.md      |  77 ++++
 .../model-matrix-scaffold-deployment/proposal.md   | 274 ++++++++++
 .../specs/scaffold/spec.md                         | 192 +++++++++
 .../model-matrix-scaffold-deployment/tasks.md      | 215 ++++++++++
 23 files changed, 2016 insertions(+), 53 deletions(-)

Known Issues

Review councils approved with advisories (spec review: APPROVE WITH ADVISORIES, 4 advisories; code review: APPROVE WITH ADVISORIES, 5/5 Divisor reviewers, 11 advisory findings, pre-flight PASS 4/4). Unresolved advisories, compactly:

  • MEDIUM (both councils): openspec/changes/model-matrix-scaffold-deployment/proposal.md cites nonexistent task "5.4" (actual task is 6.1) — documentation cross-reference nit.
  • LOW: raw path concatenation in TestSCFR009_DeploymentCompletenessGuard (adversary; embed.FS fails closed — stylistic).
  • LOW: alwaysDeployedPacks/collectDeployedPacks dual encoding (architect; deliberate deferral recorded in design D5).
  • LOW: CHANGELOG entry missing docs: model-matrix scaffold deployment via uf init (model-matrix-scaffold-deployment) #899 / website#362 cross-references (curator).
  • LOW: proposal missing content-coverage/blog disposition bullet (curator).
  • LOW: design.md conflates the packvalidator_test.go format-skip with knownNonEmbeddedFiles deferrals (adversary/guard).
  • LOW: notes.md says 17-file change set; final is 18+ (guard).
  • LOW: meta-prompt.md MP-022 references determinism.md, not yet deployed to hero repos (guard; accepted degradation per design).
  • LOW: SC-FR-008 bullet 3 "list" wording ambiguity vs filterEmptyCustomPacks behavior (adversary).
  • LOW: spec delta references non-resolving specs/model-matrix + specs/unleash paths (adversary).
  • LOW: SC-FR-010 override-preservation clause lacks a direct test assertion (testing).
  • LOW: assertContent helper reports byte-count-only mismatch messages (testing).

This PR was generated by /uf.finale (AI-assisted).

…slice 2, unbound-force#889)

OpenSpec change model-matrix-scaffold-deployment: deploy the
model-matrix configuration surface to hero repos via uf init —
meta-prompt pack (canonical + custom template), model-matrix-
classifier subagent, AGENTS.md pack-section entries, deployed-
matrix re-init ownership semantics (SC-FR-008/009/010).

Spec review: APPROVE WITH ADVISORIES (dispatch 781e5975,
9 advisories recorded, no overrides).
…oyment (1.1)

Comment-only revision per design D2: the header and Custom Rules
notes now describe a deployed scaffold asset (issue unbound-force#889) with a
meta-prompt-custom.md companion template. MP-001..MP-024 rules
verified byte-for-byte unchanged; marker scan extracts zero
questions; lines wrap under 72 chars.
…nt (1.2)

Canonical custom-pack stub per design D2, mirroring the
default-custom.md shape: frontmatter, intro prose naming the
agents and commands that load it alongside meta-prompt.md
(Cobalt-Crush on speckit.plan/speckit.tasks spec-authoring
delegations; all Divisor personas at review), CR-NNN prefix
guidance, sentinel-terminated Custom Rules section, and no
version marker. Marker scan extracts zero questions; lines
wrap under 72 chars. Embedded mirror sync and drift/test
registration follow in tasks 2.1 and 4.1.
…1.2)

Checkbox-only bookkeeping commit, made by the pipeline orchestrator
under gate-timeout recovery with human consent: the cycle-3
delegation timed out after committing the template but before this
mark-complete commit, and the uncommitted checkbox flip caused
detect_resume to false-negative spec-review freshness, burning
cycle 4 on a redundant re-approval.
…, 3.1-3.3)

Checkbox-only bookkeeping commit under the orchestrator's
standing-consent gate-timeout recovery: cycle 5 timed out after
the fix-loop delegation landed the work commits (7a923ebc,
31a1b4f6, a0d70846, 8dc99e07) and make check went fully green
at 8fe581bc, but before the child could commit these flips.
Committing them keeps the tree clean so detect_resume does not
false-negative spec-review freshness.
…ic deployment (4.3)

Also marks tasks 4.1, 4.2, 4.7 complete in tasks.md - their work landed
in the fix-loop registration unit (commits 28230d44..8fe581bc) with the
full hard gate green, but the checkbox flips were not recorded.
…d packs (4.4)

TestSCFR009_DeploymentCompletenessGuard parses the embedded
uf/model-matrix.yaml packs: keys and fails naming each missing
internal/scaffold/assets/opencode/uf/packs/<key>.md mirror - the
regression guard for the slice-1 gap (MATRIX_INVALID on load).
… (4.6)

TestRun_ModelMatrixPreservedOnRerun covers all four SC-FR-010
scenarios: new-file seeding, plain re-init preservation of the
team-edited matrix and custom template, tool-owned refresh of the
schema registry and canonical pack, and the --force replace path.
Persist the five Dewey knowledge artifacts produced during the
model-matrix scaffold deployment review cycles (issue unbound-force#889):

- review-dispatch: verify embedded-asset byte-identity via diff
  index blob hashes (RD-FR-032)
- scaffold-security: ownership flips to project-owned config are
  safe only with fail-closed load-time validation
- scaffold-testing: guard-test pattern for embed-FS template
  reference closure
- spec-authoring: re-verify task-number cross-references after
  tasks.md phase reorganization
- test-quality: explicit negative assertions for invariant bullets
  that lack scenarios

Assisted-by: glm-5
Generated with AI assistance (glm-5)
@jflowers
jflowers requested a review from a team as a code owner November 1, 2026 21:27
@jflowers jflowers self-assigned this Nov 1, 2026

@jflowers jflowers left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review Verdict: APPROVE WITH ADVISORIES

The Divisor review council (5 reviewers — adversary, architect, curator, guard, testing, all enmaas/rits/zai-org/glm-5-3) reviewed all 23 changed files (+2016/−53) against base 3abf946. All five reviewers returned APPROVE WITH ADVISORIES; CI is fully green (18 checks, 0 failures, 0 pending). Dispatch correlation: b2c94d31-639d-4381-9419-12eb91e8e011.

Findings: 10 unique (17 raw, deduplicated by file + root cause) — 2 MEDIUM, 8 LOW, 0 blocking. The 9 file-anchored findings are posted as inline comments. One MEDIUM finding has no single line anchor and is recorded here:

  • [MEDIUM] Content-coverage disposition missing (divisor-curator, openspec/changes/model-matrix-scaffold-deployment/proposal.md, Impact section) — The proposal dispositions the documentation gate (#899, unbound-force/website#362) but carries no content-coverage (blog/tutorial) disposition. This deployment slice is what makes the model-matrix epic (#887–#889) reach consumers — uf init now deploys the matrix, the hidden classifier agent, and the meta-prompt pack to every hero repo — meeting the new-agent-on-the-deployed-surface blog significance threshold, yet no blog-labeled issue tracks model-matrix (verified: only #742 and #423 carry the blog label). Recommendation: file a blog issue for the capability epic (suggested title: "blog: the model matrix — capability-driven model selection for every hero repo"), or add an explicit assessed-and-declined disposition bullet to proposal.md naming the threshold applied.

Advisory highlights:

  • The task-5.4 → 6.1 cross-reference drift in proposal.md is the only finding flagged independently by three reviewers; the fix is a two-line edit.
  • The path-concatenation advisory on TestSCFR009 (divisor-adversary) is rebutted by two sibling reviewers' path-domain analysis: embed.FS virtual keys are forward-slash-only and filepath.Join would break lookups on Windows — the concatenation matches the production assetContent seam. Reasonable to close as won't-fix.
  • Prior councils' unresolved advisories were re-verified this round; all stand except the rebutted path-concatenation flag.

Constitution compliance: verified — no gate configuration (coverage thresholds, CI flags, review limits, pinned versions) is touched by any of the 23 files; the guard confirms the implementation matches SC-FR-008/009/010 acceptance criteria.

Verdict justification: no blocking findings; all advisories are documentation-accuracy, test-observability, or deliberately deferred (design D5) trade-offs with trivial or documentation-only fixes. The deployment implementation — byte-identical embedded mirrors, the isToolOwned ownership flip, and the new guard/lifecycle tests — is solid and fully CI-verified.

This review was generated by /uf.review-pr (AI-assisted).

<!-- originating_issue: 889 is recorded in .openspec.yaml;
/uf.finale emits `Closes #889` in the PR body. The repo
documentation issue filed per the AGENTS.md documentation
gate (task 5.4) and the cross-repo `unbound-force/website`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[MEDIUM] The proposal cites task 5.4 for the documentation-issue filing here and again in the Impact section's Documentation gate bullet, but tasks.md numbers that task 6.1 inside Phase 6; Phase 5 ends at 5.3. The dangling reference misdirects anyone tracing the documentation gate and breaks the proposal-to-tasks traceability MP-016 exists to provide. Replacing both "task 5.4" references with "task 6.1" closes the gap. (divisor-architect, divisor-curator, divisor-guard)

sort.Strings(keys)

for _, key := range keys {
packAsset := "opencode/uf/packs/" + key + ".md"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] TestSCFR009_DeploymentCompletenessGuard joins the pack asset path by string concatenation ("opencode/uf/packs/" + key + ".md"), which go.md SC-003 flags for filesystem path construction. Blast radius is negligible here: keys come from the drift-enforced embedded template and assetContent only reads from the embed.FS (a "../x" key fails the lookup fail-closed). Two sibling reviewers' lesson proposals rebut the flag on path-domain grounds — embed.FS keys are forward-slash-only and filepath.Join would break lookups on Windows; the concatenation matches the production assetContent seam. Consider closing as won't-fix, or adding a short comment noting the embed.FS path domain. (divisor-adversary)

is DivisorOnly-only), and `meta-prompt` is the one mapped
pack absent from the embedded set — so hero repos
scaffolded from current `main` receive a matrix that cannot
load. `internal/schemas/packvalidator_test.go` and

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] The Context section states packvalidator_test.go and knownNonEmbeddedFiles both carry slice-1 deferral entries for meta-prompt.md and model-matrix-classifier.md. Only knownNonEmbeddedFiles carried those markers; packvalidator_test.go's meta-prompt.md skip (lines 203-211) is a permanent format-based exemption with no #889/SC-FR-007 marker, and it carries no classifier entry at all. A future reader auditing slice-1 deferrals from this citation will not find them where cited. Splitting the sentence into the two distinct skip mechanisms restores accuracy. (divisor-architect, divisor-guard)

Comment thread CHANGELOG.md
## Unreleased

### Added
- model-matrix-scaffold-deployment: `uf init` now deploys the

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] The Unreleased entry cross-references the spec directory and Fixes: #889 but omits the documentation issues the change filed: #899 (repo docs) and unbound-force/website#362 (website docs). Those issues are the discovery path for the documentation work this user-facing change requires. Appending "Docs: #899, unbound-force/website#362" to the closing cross-reference line closes the gap. (divisor-curator)

threshold. `git diff --name-only c95ea4a5...HEAD` touches
no gate config — coverage-gate.json,
.opencode/vitest.config.ts, and .github/workflows/* are
absent from the 17-file change set — and the test-file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] notes.md records the constitution-verification gate as covering a 17-file change set; the merged PR carries 23 files (the six retrospective learnings joined after the note was written). The substantive claim — no gate configuration touched — remains true for all 23 files; only the count is stale. Updating to 23, or citing the verified paths directly, keeps the audit record accurate. (divisor-architect, divisor-curator, divisor-guard)

t.Fatalf("read %s: %v", label, err)
}
if !bytes.Equal(got, want) {
t.Errorf("%s content mismatch: got %d bytes, want %d bytes",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] The assertContent helper verifies content exactly (bytes.Equal) but its failure message reports only byte counts ("%s content mismatch: got %d bytes, want %d bytes"). A same-length divergence — a wrong asset deployed, or a marker at a different position — prints identical counts and leaves the debugging agent with no signal about what or where the difference is. Reporting the first-differing byte offset, or a bounded head/tail excerpt of both payloads, would surface the actual regression. (divisor-testing)

"ci-custom": true,
"review-voice": true,
"review-voice-custom": true,
"meta-prompt": true,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] This change extends the dual encoding of the always-deployed pack set — alwaysDeployedPacks (extension-less keys) and collectDeployedPacks (.md filenames) — with two meta-prompt entries each. Every future always-deployed pack must now be registered in both places; omitting one silently diverges deploy behavior from the AGENTS.md pack listing. Design D5 documents the deferral and TestShouldDeployPack/TestCollectDeployedPacks_* pin both lists, so this is an accepted, test-mitigated trade-off; the structural fix (single source of truth) is worth tracking for a future governance change. (divisor-architect)

// copy (scenario 2), and byte-identical copies produce no spurious
// updates (scenario 3). The user-owned meta-prompt-custom.md
// template is never overwritten once deployed.
func TestRun_ModelMatrixPreservedOnRerun(t *testing.T) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] SC-FR-010 bullet 4 requires *-custom.md packs and the gitignored .uf/model-matrix.override.yaml to remain preserved on re-init. TestRun_ModelMatrixPreservedOnRerun covers the *-custom.md half (customOut asserted Skipped with edited content unchanged), but no test asserts the override file survives a re-init — no test references model-matrix.override.yaml at all. The invariant currently holds structurally (no embedded override asset exists), but the MUST clause is unpinned: a future tool-owned override template would silently clobber team overrides with no failing test. An explicit preserved-override assertion closes the traceability gap. (divisor-testing)

to slice 2. SC-FR-008 through SC-FR-010 are allocated here;
SC-FR-011 through SC-FR-018 remain reserved for future scaffold
changes. Sibling capabilities: matrix loading and selection
semantics live in specs/model-matrix/spec.md (MM-FR-001 through

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[LOW] The allocation header records sibling capability requirements at specs/model-matrix/spec.md and specs/unleash/spec.md; neither path resolves in the tree (specs/ holds only numbered Speckit directories 001–036; openspec/specs/ holds review-council, ci, graphthulhu-distribution). The MM-FR requirements actually live in the unarchived slice-1 delta at openspec/changes/model-matrix-delegation/specs/model-matrix/spec.md. Citing the path that resolves — or noting it resolves post-archive — restores the header's cross-referencing purpose. (divisor-architect, divisor-curator, divisor-guard)

@jflowers
jflowers merged commit 1eb4b1a into unbound-force:main Nov 1, 2026
17 checks passed
@jflowers
jflowers deleted the opsx/model-matrix-scaffold-deployment branch November 15, 2026 21:37
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.

Slice 2: deploy model-matrix config and meta-prompt pack to hero repos via uf init (model-matrix)

1 participant