Repository navigation
fix(uf-workflow): unify clarification-marker grammar (superset extraction) - #753
Conversation
…orce#743) The clarify probe (bare substring match) and extractor (colon-only pattern) diverged: a hand-written bare marker [NEEDS CLARIFICATION] wedged the pipeline permanently -- detect_resume reported clarify incomplete on every resume while scan_clarifications returned zero questions, with no resolution path. - Single-source the marker grammar; scan, resolve, count, and the detect_resume probe all derive from one shared constant - Extract the superset: colon, bare-with-text, and completely bare forms all become questions (bare forms unscoped, question text falls back to the raw marker text) - Plural and unterminated marker-like text no longer blocks clarify - Extend /uf.unleash Step 1 prose for bare-marker Dewey queries - Invert the pinned non-extraction test; cover all three forms, empty/whitespace questions, and the resume probe - Mirror changed .opencode/ assets under internal/scaffold/assets - Update @opencode-ai/plugin 1.4.10 -> 1.19.0 (maintainer-directed) - Store retrospective Dewey learnings; update AGENTS.md, CHANGELOG Assisted-by: glm-5 Generated with AI assistance (glm-5)
jflowers
left a comment
There was a problem hiding this comment.
Council Review: APPROVE WITH ADVISORIES
6 Divisor reviewers (adversary, architect, curator, guard, sre, testing) assessed 2979075…c2c459f (+2,174/−224, 50 files). All runs approve; the consolidation classifies all 14 findings as non-blocking advisories (5 MEDIUM, 9 LOW). Local verification passes in full: build, race tests (13 packages), coverage ratchet 88.3%, scope coverage gate, golangci-lint clean; plugin tests green in CI.
What this PR does: single-sources CLARIFICATION_MARKER_PATTERN so the extractor handles the probe's full superset — colon, bare-with-text, and bare forms — with bare forms extracting as unscoped questions and a raw-marker-text fallback. Closes #743 (finding 5). Declares the maintainer-directed @opencode-ai/plugin 1.4.10 → 1.19.0 pin move (design D7) with all pin-enforcement gates moved.
Advisories by root cause:
- Dependency-pin governance (3 MEDIUM, 2 LOW) — the pin move lacks the gatekeeping exception's security/CI-reliability trigger; the structural conditions all verify (immutable pin, moved gates, rollback documented, mirror pairs byte-identical, npm audit clean). The completing conditions are green
ci_security/ci_dependencieson the refreshed lock plus this approval — record the closure at merge. Follow-up: a top-levelenginesfield for the Node floor (LOW). - Stale measurable-delta records (1 MEDIUM, 2 LOW) — task 1.3's Record cites +5 lines/one sentence; the shipped hunk is +9 lines/two sentences, and the stale count propagates to task 6.1 and design D5. The docs-gate consolidation into #739/#309 is asserted in the task record but not performed on the issue bodies. Refresh the records and add one-line scope edits pre-merge.
- Fallback non-convergence (1 MEDIUM, 1 LOW) — the raw-marker-text fallback re-enters the grammar on each resolve; documented trade-off with manual file editing as the terminating path.
- Test hygiene (3 LOW) — the source-scan guard comment overstates detection; the hand-written log-mention fixture lacks producer linkage; the rollback baseline SHA rests on manual transcription.
Not anchored to the diff (unchanged code): MARKER_NOT_FOUND's message template (index.ts:2360) re-wraps the extracted question in colon-form syntax, which conflates forms under the superset grammar (LOW — the message remains actionable).
Inline comments carry the full findings.
This review was generated by /uf.review-pr (AI-assisted).
| "type": "module", | ||
| "dependencies": { | ||
| "@opencode-ai/plugin": "1.4.10", | ||
| "@opencode-ai/plugin": "1.19.0", |
There was a problem hiding this comment.
MEDIUM — dependency-governance (divisor-adversary). The pin move (1.4.10 → 1.19.0) does not satisfy the AGENTS.md gatekeeping exception's required condition — a documented security or CI-reliability fix — and design D7 explicitly declares that no such justification exists. The update adds two transitive packages (@ai-sdk/provider 3.0.8, json-schema 0.4.0) and refreshes nine others. The structural safeguards hold (exact immutable pin, all pin-enforcement gates moved with it, honest declaration), which keeps this advisory rather than blocking: PR review and CI approval are the completing conditions the exception names.
| scaffold assets. Verification: `make plugin-test`, `make test` | ||
| (drift tests enforce the mirrors), `make lint`. | ||
|
|
||
| ### D7. Declared dependency update (maintainer-directed) |
There was a problem hiding this comment.
MEDIUM — dependency-governance (divisor-architect). The declared dependency update rests its acceptance evidence on this design record, and the structural conditions verify: all five changed scaffold-mirror pairs are byte-identical (matching blob hashes ead592bb/d41a90e2 in the diff index), rollback to 1.4.10 is documented, and npm audit reports 0 vulnerabilities. What the record lacks is the exception's substantive trigger. Recording the authorization at merge — green security CI plus this review's approval — closes the governance gap.
| "type": "module", | ||
| "dependencies": { | ||
| "@opencode-ai/plugin": "1.4.10", | ||
| "@opencode-ai/plugin": "1.19.0", |
There was a problem hiding this comment.
MEDIUM — gatekeeping-integrity (divisor-guard). The maintainer-directed pin move exercises the AGENTS.md gatekeeping exception without its security/CI-reliability trigger. All four structural override conditions are present in the diff (documented intent in design D7, verified pin, documented rollback, moved enforcement gates). The remaining condition is process completion: green ci_security and ci_dependencies over the refreshed lock plus review approval. Record that closure at merge; any CI security failure against the refreshed lock re-opens this at HIGH.
| if (scoped !== "") return scoped | ||
| const unscoped = (match[2] ?? "").trim() | ||
| if (unscoped !== "") return unscoped | ||
| return match[0].trim() |
There was a problem hiding this comment.
MEDIUM — operability (divisor-sre). The raw-marker-text fallback creates a non-converging loop: each resolve of a fallback question appends a fresh entry that itself carries a mention and re-matches the grammar, so the clarification file grows without bound when an auto-resolving agent skips the operator note. The change declares this trade-off (design D4, spec scenario, CHANGELOG) and manual file editing terminates the cycle. A follow-up guard is worth considering if auto-resolution becomes default.
| - [x] 1.1 Implement the shared superset grammar in `.opencode/plugins/uf-workflow/index.ts`: replace `CLARIFICATION_MARKER_PATTERN` with the single-sourced pattern built from `\[NEEDS CLARIFICATION(?::\s*([^\]]*?)\s*|\s+([^\]]*?)\s*|\s*)\]` (colon form captures group 1, bare-with-text captures group 2, completely bare captures nothing), delete `CLARIFICATION_MARKER_PREFIX` entirely, update the grammar doc comment to enumerate the three branches and the no-`]` constraint, and add the question-extraction helper (trimmed group 1, else trimmed group 2, else empty; an empty result falls back to the trimmed raw marker text `match[0]`) consumed by every extractor path | ||
| - [x] 1.2 Rewire the consumers in `.opencode/plugins/uf-workflow/index.ts` to the shared grammar: `scan_clarifications` reports `question: helper(match)` with context and line unchanged; `replaceClarificationMarker` locates the first marker whose `helper(match)` equals the `question` argument exactly as scanned (answer splicing and the MARKER_NOT_FOUND failure unchanged); `countClarificationMarkers` keeps its per-line matchAll logic and now counts the superset; `uf_unleash_detect_resume` derives `hasMarkers` from `countClarificationMarkers(specText) > 0`, deleting the `specText.includes(CLARIFICATION_MARKER_PREFIX)` substring probe; update the `scan_clarifications` and `resolve_clarification` tool description strings (currently colon-only) to describe the three superset forms | ||
| - [x] 1.3 [P] Extend `uf.unleash.md` Step 1 (Clarify) with one sentence: for bare-marker questions (whose question text is the raw marker), formulate the Dewey query from the surrounding context rather than the marker text — extending the existing do-not-use-the-raw-marker-text note (measurable one-sentence delta, design D5) and record the before/after line and token delta of the uf.unleash.md edit in this tasks artifact | ||
| - Record (task 1.3): uf.unleash.md Step 1 — one sentence added extending the do-not-use-raw-marker-text note; file before: 1106 lines / 4942 words; after: 1111 lines / 4982 words (delta +5 lines, +40 words); sentence: "For bare-marker questions -- whose question text is the raw marker itself because the marker carried no question text -- the query MUST be formulated from the surrounding context (the marker line's neighboring spec lines) rather than the marker text." |
There was a problem hiding this comment.
MEDIUM — metadata-accuracy (divisor-guard). The Record for task 1.3 cites stale measurements: it claims a +5-line, one-sentence edit to uf.unleash.md Step 1, but the shipped hunk is net +9 lines (1106 + 9 = 1115) with two sentences — the designed bare-marker query plus the post-council log-mention operator note. The stale count propagates to the task 6.1 record and design D5. Refreshing the three citing artifacts before merge restores the record's audit purpose; the shipped code itself is correct.
|
|
||
| - [x] 5.1 [P] Add a CHANGELOG.md entry describing the single-sourced superset clarification-marker grammar (bare forms extracted as unscoped questions, raw-marker-text fallback, grammar-derived detect_resume probe) and the declared dependency update (design D7: `@opencode-ai/plugin` 1.4.10 → 1.19.0, maintainer-directed, pin-enforcement gates and the SC-FR-003 spec record moved to the new pin) — the manifests are scaffold assets deployed via `uf init`, so the bump is changelog-relevant for scaffold consumers | ||
| - [x] 5.2 [P] Assess the documentation gate and record the result: the behavior change is user-visible (bare hand-written markers now resolve instead of wedging clarify; marker-like text outside the grammar no longer blocks), so the gate MUST be assessed rather than presumed exempt — search open issues first and reference or consolidate #739 (already scopes the unleash docs pages; its usage.md/architecture.md scope may absorb this change — reference rather than duplicate) and, per the Cross-Repo Documentation rule, search open `unbound-force/website` issues first and reference or consolidate the Increment 2 docs issue #309 (the website counterpart of #739; check #310 as the plugin-tool-behavior sibling) rather than filing a duplicate; record the referenced/filed issue numbers or the per-target exemption rationale; assess `docs/usage.md` and `docs/architecture.md` for marker-grammar mentions and document that malformed (pluralized or unterminated) marker text is ignored by design and that well-formed marker text written as documentation (quoted syntax, fenced examples, or prose) extracts as a question — user docs should advise avoiding literal marker syntax in prose (design D4); also assess spec-author-facing surfaces — AGENTS.md's Spec writing conventions, the `.specify/` spec templates, and the speckit command files `.opencode/commands/speckit.specify.md` and `.opencode/commands/speckit.plan.md` (the repository's densest marker-syntax teaching surfaces; the docs pages carry no marker mentions today) — for marker-syntax guidance, adding the malformed-marker-by-design and mention-extraction notes where those surfaces teach marker syntax | ||
| - Record (task 5.2): documentation gate assessed — behavior change is user-visible, gate not presumed exempt; issues referenced, none filed (search-first found open coverage for both targets; filing would duplicate): this repo #739 (open, label docs; its scope table already commits docs/usage.md and docs/architecture.md /uf.unleash-section updates and absorbs this change's bare-marker-resolves workflow delta) and, per the Cross-Repo Documentation rule, website #309 (open, label docs; the /uf.unleash workflow-docs counterpart of #739) plus #310 (open; the plugin-tool-behavior sibling — scan_clarifications/resolve_clarification tool descriptions now describe the three superset forms); open-issue searches in both repos surfaced no other clarification-marker docs coverage. docs/usage.md and docs/architecture.md: exempt from in-change edits — verified zero marker-grammar mentions today, their /uf.unleash coverage is high-level workflow prose with no clarify mechanics to amend, and #739's scoped rewrite of exactly those sections is the consolidation point (referenced, not duplicated). Spec-author surfaces edited: .opencode/commands/speckit.specify.md — two bullets added to execution-flow step 6.3 after the prioritize-clarifications bullet (marker grammar: all three bracketed forms extract as clarification questions, pluralized/unterminated marker-like text ignored by design; mention extraction: well-formed marker syntax extracts as a question wherever it appears — quoted, fenced, or prose — and holds clarify open until resolved, avoid literal marker syntax in documentation); .specify/templates/spec-template.md — one italic grammar note added after the FR-006/FR-007 marker example, deliberately phrased without literal bracketed syntax so scaffolded specs cannot self-trigger clarify; AGENTS.md Coding Conventions — one "Clarification markers" bullet added after the Spec writing bullet codifying the shared grammar, malformed-marker-ignored-by-design, and avoid-literal-marker-syntax-in-prose. Exempt: .opencode/commands/speckit.plan.md and .specify/templates/plan-template.md (they teach unbracketed "NEEDS CLARIFICATION" as plan.md Technical Context placeholder values — a different convention from the spec.md bracketed grammar; plan.md is not scanned by the clarify tools and neither surface teaches the bracketed syntax); .specify/templates/{agent-file,checklist,constitution,tasks}-template.md (zero marker mentions). |
There was a problem hiding this comment.
LOW — documentation-gate (divisor-guard). The AGENTS.md doc gate ("MUST file a documentation issue") is satisfied by cross-reference to #739/#309 rather than a new filing. The zero-waste reading is defensible — search-first anti-duplication — and the PR's CHANGELOG/AGENTS.md updates carry the user-facing delta. Linking #739 and #309 in the PR body makes the consolidation discoverable at merge.
| "type": "module", | ||
| "dependencies": { | ||
| "@opencode-ai/plugin": "1.4.10", | ||
| "@opencode-ai/plugin": "1.19.0", |
There was a problem hiding this comment.
LOW — dependency-health (divisor-sre). The pin move raises the effective Node floor to ^22.22.2 via transitive [email protected]. AGENTS.md documents the floor and CI verifies it, but the manifest declares no top-level engines field — contributors below the floor see an EBADENGINE warning that names [email protected] rather than the repository's own requirement. An engines field in package.json (mirrored to scaffold assets) makes the floor actionable at install time.
|
|
||
| // Exactly one marker-grammar pattern exists: one regex literal carrying | ||
| // the escaped opening bracket. A reintroduced second grammar — under | ||
| // any constant name — would carry a second escaped literal and fail |
There was a problem hiding this comment.
LOW — regression-protection (divisor-testing). The source-scan single-sourcing guard's comment claims a re-introduced grammar would fail the occurrence count, but the count is representation-dependent: an unescaped string constant, \x5B escapes, \s-interposed regexes, or RegExp concatenation all evade it. The behavioral tests (SPEC_WITH_MARKER_LIKE_TEXT) cover the historical probe-path regression. Scoping the comment to what the scan actually detects — regex-literal grammars in house style — keeps the guard honest.
| "", | ||
| "## Clarifications", | ||
| "", | ||
| "- Q: [NEEDS CLARIFICATION] -> A: some answer (Dewey-resolved from test)", |
There was a problem hiding this comment.
LOW — coverage-strategy (divisor-testing). SPEC_WITH_CLARIFICATIONS_LOG_MENTION hand-writes resolve_clarification's log-line format, so a producer format change leaves the fixture passing while representing unreachable state. Deriving the fixture from the producer's executed output (fakeSpecDeps already persists writes) or cross-referencing the clarify suite's write-format assertions forces co-update.
| readJSONFile(t, filepath.Join(root, "internal", "scaffold", "testdata", "plugin-package-rollback.json"), &rollback) | ||
|
|
||
| const baselineLockSHA256 = "b628c764236019785a620deadc06373949236ce84fb38bc68a39f619411874e3" | ||
| const baselineLockSHA256 = "5ebee4af68d7a6125f5d0f52ecca7c419bbfbd9beff13503f3d5d6f36a09f965" |
There was a problem hiding this comment.
LOW — regression-protection (divisor-testing). TestPluginPackageInputs_RollbackPrerequisites compares the testdata baseline lock against the constant rollback SHA with no computed-hash link — update-time provenance rests on manual transcription. Computing the expected hash at test time removes the transcription step.
Summary
Closes #743
Single-sourced the /uf.unleash clarification-marker grammar: one shared
CLARIFICATION_MARKER_PATTERNnow feedsscan_clarifications,resolve_clarification, and theuf_unleash_detect_resumeprobe. Thegrammar accepts three forms — colon (scoped), bare-with-text, and
completely bare — with bare/empty forms extracting as unscoped questions
whose text falls back to the raw marker text, so a hand-written bare
marker resolves instead of wedging clarify (the probe firing while the
extractor returned nothing). Pluralized and unterminated marker-like
text no longer holds clarify open.
Includes the maintainer-declared dependency update (design D7):
@opencode-ai/plugin1.4.10 → 1.19.0 with every pin-enforcement gatemoved to the new pin — scaffold manifest mirrors, exact-version test
constants, rollback baseline lock SHA, the SC-FR-003 spec record, and
the AGENTS.md Technology Stack pin plus Node runtime floor.
How to Test
Run the two touched suites:
101 tests covering the three-form grammar, resolution round-trips for
every form, the plugin-source single-sourcing scan, the fallback-form
log-mention probe, over-long >4096-char schema rejection, and
fenced/backtick mention extraction.
Full gates:
make plugin-test(888 tests),make test(scaffold driftand pin-enforcement gates green at 1.19.0),
make lint,openspec validate clarification-marker-superset --type change --strict.Behavior check: write a bare hand-written clarification marker in a
spec.md and run /uf.unleash — it surfaces as a resolvable question
instead of wedging clarify.
How to Demo
Write a bare
[NEEDS CLARIFICATION]marker in a spec.md and run/uf.unleash— it surfaces as a resolvable question instead of wedgingthe clarify step.
Key Files Changed
.opencode/plugins/uf-workflow/index.ts(+89) — single-sourcedgrammar, superset extraction, raw-text fallback
.opencode/test/unleash-clarify.test.ts(+481),.opencode/test/unleash-resume.test.ts(+125) — three-form grammar,round-trip, and resume-probe coverage
.opencode/commands/uf.unleash.md,.opencode/commands/speckit.specify.md,.opencode/lib/unleash-templates.ts,.specify/templates/spec-template.md— clarify prose and templates
.opencode/package.json,.opencode/package-lock.json—@opencode-ai/plugin1.4.10 → 1.19.0 (design D7)internal/scaffold/assets/opencode/**,scaffold_test.go,testdata/plugin-package-rollback.json— byte-identical mirrors andpin-enforcement gates
openspec/changes/clarification-marker-superset/**— proposal,design, spec deltas, tasks
.uf/dewey/learnings/**— retrospective learningsAGENTS.md,CHANGELOG.mdKnown Issues
The final
/uf.review-council(code mode) verdict was REQUEST CHANGES;maintainer chose to proceed. Unresolved findings:
@opencode-ai/pluginpin move1.4.10 → 1.19.0 does not satisfy the AGENTS.md gatekeeping
exception's conditions (no documented security/CI-reliability
justification; declared maintainer-directed in design D7 instead).
append a
## Clarificationsentry whose logged question text itselfmatches the grammar, so
remainingreports 1 — a log-mention steadystate that keeps the resume probe reporting clarify incomplete
(index.ts:2369).
unleash-resume.test.tspins thatlog-mention steady state (
remaining: 1after resolving afallback-form marker) as expected behavior.
at
.opencode/commands/speckit.specify.md:207contradicts the newthree-form grammar bullet in the same file.
edited surfaces (speckit.specify.md, spec-template.md, AGENTS.md
Coding Conventions bullet).
error-handling, logged-question structural integrity, Step 1 prose
scoping, workflow edge cases, dependency-health pass-through, test
traceability, fenced/backtick mention coverage.
This PR was generated by /uf.finale (AI-assisted).