Skip to content

feat(unleash): automatic tier routing with risk floors and issue resolution - #784

Merged
jflowers merged 3 commits into
unbound-force:mainfrom
jflowers:opsx/unleash-tier-routing
Oct 20, 2026
Merged

jflowers merged 3 commits into
unbound-force:mainfrom
jflowers:opsx/unleash-tier-routing

Conversation

@jflowers

Copy link
Copy Markdown
Contributor

Summary

/uf.unleash now routes every change to the right workflow tier
automatically instead of stopping on main or unrecognized branches.
A tier-routing skill applies the rubric (quick / OpenSpec / Speckit
by scope signals) with mechanical risk floors (security-sensitive,
auth, data-loss, or public-API-breaking signals reject the quick
tier with an actionable escalation). Two new tested tools back it:
uf_unleash_route_decision (durable decision recording,
quick/<name> branch creation, floor enforcement) and
uf_unleash_resolve_issue (#NNN and issue-URL resolution behind
an injectable gh runner, fail-closed on gh failures, untrusted
bodies passed through as data only). The quick tier runs
spec-less with full quality gates and a both-claims resume
derivation (implement AND quick-pre-flight), review councils run
in code mode, and the resolved issue number threads through to
the PR body (Closes #N, route-decision state taking precedence
over .openspec.yaml). The pending sibling change
unleash-deterministic-tools was reconciled and its
archive-order constraint recorded; repo and website documentation
were de-staled to the three-tier model (website PR
unbound-force/website#315, merge pending).

How to Test

cd .opencode && npx vitest run          # 34 files / 978 tests green
go test ./internal/scaffold/ -count=1   # drift + template contracts (mirrors in sync)
openspec validate unleash-tier-routing  # valid, 0 errors
diff .opencode/plugins/uf-workflow/index.ts \
  internal/scaffold/assets/opencode/plugins/uf-workflow/index.ts  # mirror identity

How to Demo

  1. On main, run /uf.unleash fix the readme typo — instead of
    STOP, the route decision applies the tier-routing rubric and
    creates quick/fix-the-readme-typo with full quality gates.
  2. Run /uf.unleash add OAuth login — the security-sensitive
    risk floor rejects the quick tier with an actionable
    escalation to OpenSpec (ROUTE_RISK_FLOOR).
  3. Run /uf.unleash fix #NNN — the issue number resolves via
    the injected gh runner, threads through checkpoint state, and
    the eventual /uf.finale PR body emits a closing reference.

Key Files Changed

  • .opencode/commands/uf.unleash.md (+348) — tier routing, risk
    floors, issue resolution, stale Step 6/8 fixes
  • .opencode/plugins/uf-workflow/index.ts (+718) — new
    uf_unleash_route_decision and uf_unleash_resolve_issue
    tools, checkpoint re-keying, resume gates
  • .opencode/skills/tier-routing/SKILL.md (new, +143) —
    routing rubric
  • .opencode/plugins/uf-finale/index.ts (+37) —
    originating-issue precedence
  • .opencode/lib/branch-classification.ts,
    .opencode/lib/unleash-templates.ts
  • Tests: unleash-route-decision.test.ts (new, +690),
    unleash-resolve-issue.test.ts (new, +519),
    uf-finale.test.ts (+354), unleash-resume.test.ts (+292)
  • Scaffold mirrors under internal/scaffold/assets/opencode/
    (drift-protected, in sync)
  • openspec/changes/unleash-tier-routing/ (proposal, design,
    spec, tasks) + sibling unleash-deterministic-tools
    reconciliation
  • Docs: AGENTS.md, README.md, QUICKSTART.md,
    CHANGELOG.md, docs/
  • 27 retrospective learnings under .uf/dewey/learnings/

70 files changed, +5883 / −320.

Known Issues

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

@jflowers
jflowers requested a review from a team as a code owner October 20, 2026 17:49
@jflowers jflowers self-assigned this Oct 20, 2026
Route /uf.unleash between speckit, openspec, and a new quick tier
when no spec has been committed. Adds the tier-routing rubric skill,
issue-ref resolution, route decision tool, and quick-tier gates.
/uf.unleash now picks the workflow when no spec exists yet: Speckit for
large scopes, OpenSpec for smaller ones, or a lightweight quick tier for
trivial fixes and chores.

- uf_unleash_route_decision tool: validates the route (no routing around
  tier-named branches), enforces a clean tree, creates quick/<name>
  branches, and checkpoints the tier-routing decision
- branch gate accepts quick/* (no artifact prerequisites); ON_MAIN and
  UNRECOGNIZED_BRANCH now carry routing messages instead of STOPs
- detect_resume: quick tier forces clarify/plan/tasks/spec-review done
  and derives implement from the checkpoint claim; feature_dir optional
- tier-routing skill: rubric, risk floors (security/auth/data-loss/
  public-API never route below openspec), issue-ref resolution, and the
  announcement format
- uf.unleash: routing step (1a), per-tier orchestration with gate
  re-run verification, quick pipeline skipping spec-artifact steps
- uf.finale: quick/* branches; threads the route-decision issue number
  into the PR body (Closes #N) with precedence over .openspec.yaml
- review council: quick branches review in code mode
- write_unleash_summary: feature_dir optional for the quick tier

Tests: 926 passing (33 files). openspec validate passes for
unleash-tier-routing and the amended unleash-deterministic-tools.
Review iterations for the unleash-tier-routing change:

- Enforce quick-tier risk floors mechanically: ROUTE_RISK_FLOOR
  rejects a quick decision carrying any risk signal before any
  git access, so MUST-level floors live in code, not prose
- Extract uf_unleash_resolve_issue with an injected gh runner
  (#NNN and issue-URL detection, fail-closed envelopes); trim
  duplicated description-gathering prose to the skill
- Thread the originating issue number end-to-end and re-key the
  tier-routing checkpoint under the feature branch so /uf.finale
  emits Closes #N on routed branches
- Make the quick pre-flight gate durable across resumes (both
  the implement and quick-pre-flight claims required)
- Fix stale /uf.unleash Step 8 references (review council is
  Step 6) in the template and AGENTS.md
- Document the three-tier model in AGENTS.md, docs/, README,
  QUICKSTART; add CHANGELOG entry
- Reconcile sibling change unleash-deterministic-tools
  artifacts and record the archive-order constraint
- Pin behaviors with table-driven tests (route decision,
  resolve-issue, resume, finale state-reader); 978 plugin
  tests green

Assisted-by: glm-5
Generated with AI assistance (glm-5)
@jflowers
jflowers force-pushed the opsx/unleash-tier-routing branch from a6b0b76 to 94ff439 Compare October 20, 2026 19:15

@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 Council Verdict: APPROVE WITH ADVISORIES

Four Divisor personas (architect, curator, guard, testing) completed structured reviews; the adversary run failed on a transient provider error and cast no vote. All four successful runs returned APPROVE WITH ADVISORIES. All 17 CI checks pass or skip. Findings: 3 MEDIUM, 9 LOW — no CRITICAL or HIGH.

Recurring themes:

  • Prescribed terminal output rendered as prose (determinism gate, DE-003) — tracked via #782 for two blocks, untracked for one
  • Risk floors vs AGENTS.md "What requires a spec" boundary gap
  • Tier-conditional command paragraphs without explicit tier markers
  • Byte-identical scaffold mirrors multiply every command/skill edit

All 12 findings are attached as inline comments. Dispatch artifact: .uf/artifacts/dispatch/43cfc023-3081-43c2-b616-b3c663596c27.json.

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

```

For Quick mode:

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 · architect · determinism

This step prescribes new terminal output as prose: the Step 2 "For Quick mode:" status display, the "implement ✗ (gate pending)" rendering rule, and the tier-routing skill's Phase 5 announcement format. The established precedent routes prescribed output through formatter tools (format_unleash_exit / format_unleash_demo), which this change extends for the quick tier. design.md records the DE-003 tension, but the renderer extraction carries no tracked issue number — task 12.5 notes it only as a design risk, unlike the sibling deferrals tracked in #780/#782. Consider extending #782 (or filing a tracking issue) and recording the reference in the design risk note and task 12.5, or routing these blocks through a formatter now.

failure, emit the envelope's error and **STOP**. Then run
the pre-flight gate below.

Run the `pre-flight` skill in `hard-gate` mode — 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.

MEDIUM · guard · intent-fidelity

This quick pre-flight hard-gate paragraph follows the **If WORKFLOW_TIER = quick** block (line 650) as a top-level paragraph without its own tier marker, unlike the explicit markers at lines 344, 450, 477, and 500. Its scope is visible only through adjacency and the "quick-tier equivalent" phrase, so a linear execution for the speckit or openspec tiers can read the blocking "If any check fails, EXIT" as unconditional. The trailing continuation at 693–694 ("On failure ... STOP. Then proceed directly to Step 6") also has an ambiguous antecedent. An explicit **If WORKFLOW_TIER = quick**: prefix (or nesting inside the quick block) plus a scoped continuation fixes the read; the byte-identical scaffold mirror needs the same edit.

choose the heavier one: under-routing a large change loses
gates, while over-routing a small one only adds ceremony.

## Phase 4: Apply the risk floors (escalate only)

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 · guard · governance-consistency

The Phase 4 risk floors (lines 106–111: security-sensitive, auth, data-loss, public-API-breaking) do not subsume the AGENTS.md "What requires a spec" classes (new features, signature-changing refactors, multi-function test additions, agent changes, CI changes, data-model changes). A small-looking change in those classes carries no floor signal and remains autonomously routable to the spec-less quick tier, which conflicts with the "All non-trivial changes MUST be preceded by a spec workflow" mandate at the boundary between the two texts. ROUTE_RISK_FLOOR enforcement inherits the gap because its risk_signals vocabulary knows only the four floor signals. Adding the spec-required classes to Phase 4 and the tool vocabulary — or amending the AGENTS.md list to state its interaction with quick routing — closes it; the scaffold mirror carries the same text.

// No .openspec.yaml — field stays null.
}

// Tier-routing issue number (unleash-tier-routing). The route

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 · architect · dry

This reader re-derives the uf-workflow writeState contract inline — the .uf/progress/${sanitizeSlug(branch)}/uf.unleash.json path and a hand-rolled ProgressState guard — instead of sharing a helper in .opencode/lib/. The e2e connecting test pins the contract, and the extraction is tracked in #782, which contains the risk. Folding this reader into the #782 extraction removes the duplication.

Comment thread docs/usage.md
| Bug fix or small task | OpenSpec | `/opsx-propose` |
| New feature (3+ stories) | Speckit | `/speckit.specify` |
| "Handle everything" | Either | `/uf.unleash` |
| Trivial fix, chore, or docs | Quick | `/uf.unleash` |

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 · curator · documentation-completeness

The "Which Workflow?" table row for the quick tier ("Trivial fix, chore, or docs") and the matching AGENTS.md row describe the tier without its risk floors; neither "security-sensitive" nor "risk floor" appears anywhere in docs/usage.md. An engineer choosing a tier from these tables alone can route a security-sensitive fix to the spec-less quick tier. The floors are documented only in agent-facing surfaces and website#315, and #772 covers AGENTS/CHANGELOG/website but not this table. A one-line floor note here closes the gap.


3. **Announce the decision** — autonomous, no confirmation
gate: the tier, the change name, and the rationale, per
the skill's announcement format.

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 · architect · convention-compliance

Step 1a.1 declares skill Phase 1 the "single source" for description-gathering rules while restating the full procedure: the $ARGUMENTS rule, the uf_unleash_resolve_issue call shape, the ISSUE_RESOLVE_FAILED/ISSUE_RESOLVE_ERROR codes, and the one-question rule. Step 1a.4 and skill Phases 4/5 likewise duplicate the route-decision call shape and the ROUTE_RISK_FLOOR re-route. With the byte-identical scaffold mirror, each contract change now requires four synchronized edits. Trimming these to pointers, or dropping the single-source sentence, reduces the surface.

design.md and specs/unleash/spec.md are amended to reference
`uf_unleash_route_decision`; that change MUST archive after
this one lands.
- Content coverage: blog assessed — no (capability announcement

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 · curator · content-pipeline

The blog assessment records "no" as "deferred to release notes / CHANGELOG", but no open blog-labeled issue covers tier routing and no release-checklist hook triggers re-evaluation — #742 is gated on #716 and #423 covers CI. "One command from idea to demo" is a strong release-time blog candidate, and nothing currently prompts the evaluation. A tracking issue or a release-checklist line preserves the opportunity.

For Quick mode:

```
Detected: Quick mode — routed change <change_name>

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 · guard · constitution-alignment

The quick-mode resumability display (lines 312–326) and the skill Phase 5 announcement (SKILL.md 127–133) are prose templates, while DE-003 requires new instructions to be executable tooling where feasible. The deferral is documented in design.md Risks, tracked in #782, and captured in learning determinism-20261020T172445, and the templates are small and stable — recording it LOW to keep the deferral bounded to these blocks. Include both in the #782 template migration.

let routedBranch = branch
if (input.tier === "quick") {
exec(["checkout", "-b", `quick/${input.change_name}`], cwd)
// Read back to verify the switch took effect and to anchor 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 · testing · assertion-depth

The comment at lines 1145–1146 states the post-checkout read-back exists partly "to verify the switch took effect", but routedBranch at line 1147 is never compared against quick/${input.change_name} — there is no fail-closed check and no mismatch error path, and a detached HEAD returns "HEAD" unnoticed. The read-back serves its real purpose (checkpoint anchoring), but the claimed verification is unimplemented, and the test fake mirrors only the happy path. Implementing the comparison with a mismatch test, or correcting the comment and pinning the current behavior, aligns the code with its stated intent.

contracts); `openspec validate unleash-tier-routing` valid
with only the house-norm long-text warnings already accepted
at 7.x. Coverage criterion recorded per Constitution IV:
94.61% statements (round-1 verification measurement) anchors

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 · testing · coverage-strategy

Task 9.6 records the coverage criterion as "94.61% statements (round-1)", but the freshest measured value is 94.58% (task 10.7), and the final rounds (11.8, 12.6, +13 tests) record no new measurement. The acceptance evidence is stale, and the criterion exceeds the last measured value. A final make plugin-test coverage pass recorded in task 12.6, with the delta against 9.6, refreshes the evidence.

@jflowers
jflowers merged commit e708065 into unbound-force:main Oct 20, 2026
17 checks passed
@jflowers
jflowers deleted the opsx/unleash-tier-routing 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.

1 participant