Repository navigation
Description
Motivation
The gap channel between /qa, /loop, and sequant ready is prose scraped by a single regex, and it is measurably lossy:
parseQaSummary(src/lib/workflow/phase-executor.ts:581-625) extracts gaps viaparseListSection(output, /\*\*(?:Issues|Gaps)/). That matches exactly one place in the QA output templates — the**Issues:**bullet list under### Code Review. It does not capture AC-tableNOT_METrows, §6d Adversarial Re-Read findings, §5 Risk Assessment, or §2d Test Quality Review's differently-named**Issues Found:**list. A QA pass that fails on a §6dSevere Gapcan hand/loopan empty findings list./loop's own extraction (loop/SKILL.md:114-122) greps for a### Required Fixessection that no QA output template emits — the only occurrences of that heading in the qa skill are a prohibition and loop's own worked example. The surviving channel is a rawNOT_MET|PARTIALLY_METline grep.ReadyGapItem(src/lib/workflow/ready-gate.ts:85-93) is{description: string, nonGoal: boolean}— no category, severity, evidence, or recommended action.- Under
acpolicy,sequant ready's "document remaining gaps without fixing" output goes to terminal scrollback only: no GitHub comment (orchestrated QA skips posting perqa/SKILL.md§9), no state payload beyond a single status enum. The documented gaps are unrecoverable after the terminal closes.
Meanwhile the repo has four unrelated finding shapes (ReadyGapItem, QaSummary.gaps: string[], merge-check's severity-typed CheckFinding in src/lib/merge-check/types.ts:44-57, precheck's CheckStatus), none wired to the QA verdict path.
Transcript evidence for why structure matters: a 28-episode audit of end-of-session gap prompts (2026-07-14 → 08-10) measured 57% real would-ship defects, 29% cosmetic tail, and one shipped regression (#930) — caused by acting on a gaps-list with no severity/action classification ("fix all gaps" applied to findings the QA itself had framed as non-blocking). #608 measured the inverse failure: open-ended "what might we be missing" sections invent plausible concerns with a 0% action rate. A finite taxonomy with required evidence is the middle path.
Proposal
One shared gap-finding schema, emitted as a structured marker and consumed by every existing gap consumer.
Schema (new, in run-log-schema.ts or sibling; consolidates — does not add a fifth shape alongside the four):
interface GapFinding {
category: "requirement_gap" | "dependency_gap" | "test_gap"
| "repository_gap" | "risk_gap" | "execution_gap";
evidence: string; // REQUIRED — concrete observation, not speculation
description: string;
recommendedAction: "fix_now" | "document" | "pause_for_human";
affectedAcs?: string[]; // e.g. ["AC-3"]
nonGoal?: boolean; // existing ready-gate semantics
}Emission: /qa output templates end with <!-- SEQUANT_QA_GAPS: {json} --> — the same durable-marker idiom as SEQUANT_SPEC (#921/#925) and SEQUANT_PHASE. The prose sections stay for humans; the marker is the machine contract.
Consumers (all wired in this issue — an emitted marker nothing reads is dead weight, per #608):
parseQaSummaryparses the marker first, falls back to the current regex scrape for older output./loopconsumesrecommendedAction: "fix_now"findings instead of the dead### Required Fixesgrep;documentfindings are excluded from fix iterations (this is the structural fix for the fix(lint): exclude gitignored scripts/dev from the widened lint/typecheck scope #930 class).ReadyGapItemgains the schema fields;formatReadyReportrenders category/action.sequant readypersists the final gap report to the issue as a comment carrying the marker (closing the terminal-scrollback hole). Feeds feat(ready): sequant ready never records run metrics — no visibility into escalation, iteration counts, or gate outcomes #929's metric record shape (remainingcounts by category).
Fallback rule: a gap the model cannot fit into the six categories is emitted as prose exactly as today — the taxonomy narrows the structured channel; it must never silently drop an unclassifiable finding.
Non-Goals
- No new always-on QA sections or prompts — this restructures the output of existing sections. investigate(metrics): gap-check signal-to-noise — does flagged → action rate justify cumulative QA prompt cost? #608's 0% action-rate finding stands.
- No auto-merge or verdict-algorithm changes — verdict computation is untouched; this changes what flows after the verdict.
- No fresh-context refuter over findings (evaluated and dropped 2026-08-08; see loops/graphs assessment).
- Not migrating merge-check's
CheckFinding— noted as a future unification candidate only.
Tailored caveats
- Skill template edits must sync all three skill dirs (
skills/,templates/skills/,.claude/skills/) byte-identically; CI gate exists (chore(#738): reconcile skill-mirror divergences (8 diverged, 10 missing) + CI gate #742). - Marker regex must tolerate multi-line JSON or the emitting template must guarantee single-line JSON (
SPEC_MARKER_REGEXprecedent uses\{[^}]+\}— nested objects will break it; decide flat-JSON contract or better regex up front). - Loop's shell-side parsing mirrors TS parsing — the drift guard compares literal strings only (PM_CONFIG.yarn.ciInstall uses Yarn 2+
--immutable, which Yarn 1 rejects — no berry detection exists #871); keep the shell side to marker presence checks, do real parsing in TS. - No box-drawing in output templates (LLM-hostile formatting).
Acceptance Criteria
- AC-1: A
GapFindingschema with the six categories, requiredevidence, andrecommendedActionexists insrc/lib/workflow/and is exported. Evidence: unit test constructs and validates all six categories plus rejects a missing-evidence finding. - AC-2: QA output templates (standard and simple-fix, all three skill dirs) emit
<!-- SEQUANT_QA_GAPS: {json} -->andparseQaSummaryprefers the marker over the regex scrape. Evidence: unit test feeds a QA output containing a §6d finding absent from**Issues:**and asserts it survives intoQaSummary.gapsvia the marker; mutation-verified by deleting the marker from the fixture and confirming the fallback path returns the old (lossy) result. - AC-3:
/loopconsumesfix_nowfindings from the marker and excludesdocumentfindings from fix iterations; the dead### Required Fixesgrep is removed. Evidence: integration test drives loop with a marker containing onefix_nowand onedocumentfinding and asserts only the former reaches the fix prompt. - AC-4:
sequant readyposts its final gap report (with marker) as an issue comment when terminal, andReadyGapItemcarries the schema fields. Evidence: unit test asserts the comment body contains the marker withremainingfindings; manual verification on one live dogfood issue. - AC-5: An unclassifiable gap falls back to today's prose behavior with no finding dropped. Evidence: unit test with a marker-less QA output asserts
parseQaSummaryoutput is unchanged from current behavior. - AC-6: Existing consumers are regression-covered —
run --ready-gate, standalone ready, and loop paths pass the current suite unchanged. Evidence: full targeted suite forphase-executor,ready-gate, and loop-related tests green.
Human decisions required
- Should the
readygap-report comment post underacpolicy only, or fora-plusterminal states too?
Context
Designed from the 2026-08-13 strategy review: 28-episode transcript audit of gap-prompt outcomes, flow-map of the qa/ready gap channel, and the taxonomy proposal (finite categories + required evidence). Related: #929 (ready metrics — this issue's persisted report feeds its record shape), #921/#925 (marker idiom), #608 (advisory-section action-rate data), #930 (the shipped regression this schema's document class prevents).
Activity
admarble commentedon Aug 21, 2026
Spec: Structured gap findings (#937)
Complexity: Standard (6 ACs, 4 consumers across
src/lib/workflow/,src/commands/,skills/{qa,loop}×3 mirrors)AC Quality Check
Linter: 0 issues. All six ACs carry explicit evidence clauses. One semantic tension to resolve up front: AC-2 says
parseQaSummary"prefers the marker over the regex scrape", AC-5 says an unclassifiable gap "falls back to today's prose behavior with no finding dropped". If a marker is present and a prose-only gap exists, strict "prefer marker" drops the prose gap. Plan resolves this as union with dedupe (see Decisions).Scope Assessment
Non-Goals: present (4 items). Feature count 2⚠️ · AC items 6 ⚠️ · Directory spread 1 ✅ → ⚠️ SCOPE_WARNING (quality loop auto-enabled). In-flight worktrees (#916, #919) touch none of the affected files.
Acceptance Criteria
GapFindingzod schema insrc/lib/workflow/run-log-schema.ts(GapFindingSchema,GapCategorySchema,GapActionSchema), exported. Unit test: Given each of the 6 categories →safeParsesucceeds; givenevidencemissing/empty → fails.skills/qa/SKILL.md§Output Template, simple-fix + standard, after### Next Steps) end with<!-- SEQUANT_QA_GAPS: {"findings":[...]} -->;parseQaSummaryparses the marker first. Unit test: fixture with a §6d Adversarial Re-Read finding absent from**Issues:**→ present inQaSummary.gapsandQaSummary.findings. Mutation-verified: delete the marker from the fixture → test fails, fallback returns the lossy list (record asSEQUANT_MUTATIONmarker in the PR body per CLAUDE.md).ready-gate.tsfixableGaps,batch-executor.ts:1610failedAcs) filter torecommendedAction === "fix_now"when findings exist;loop/SKILL.mdreads the marker and drops the dead### Required Fixessed. Integration test:ready-gate.test.tsfake runner returns QA output with onefix_now+ onedocumentfinding → loop-phase configfailedAcs/promptContextcontain only the former. Plus a gate test scoped toloop/SKILL.mdasserting### Required Fixesis gone andSEQUANT_QA_GAPSis referenced (mutation-verified).ReadyGapItemgains optionalcategory,evidence,recommendedAction,affectedAcs;formatReadyReportrenders[category · action]per item and appends the marker;sequant readyposts the report viaGitHubProvider.postCommentwhenfinalVerdict !== null. Unit test: injectedpostCommentspy receives a body containing the marker whosefindingsequalremaining. Manual: one live dogfood issue.parseQaSummaryresult deep-equals current behavior. Unit test: reuse existing fixtures inphase-executor.test.ts, snapshot before/after.phase-executor*,ready-gate*,ready*,batch-executortest files green, full suite before push (signature change onQaSummary/ReadyGapItem).Implementation Plan
Phase 1 — Schema + parser (AC-1, AC-2, AC-5)
run-log-schema.ts: addGapFindingSchema; extendQaSummarySchemawithfindings: GapFindingSchema.array().optional(). Keepgaps: string[]—batch-executor.ts:200/1610,run-display.ts:128,ready-gate.ts:565all read it.src/lib/workflow/qa-gaps-marker.tsmirroringmutation-marker.ts(stripMarkdownCode, zod validate, invalid →[]+ warning). Regex must NOT be the{[^}]+}family — the payload is nested (array of objects,affectedAcsarray). Use/<!-- SEQUANT_QA_GAPS: (\{[\s\S]*?\}) -->/(lazy to the closing-->); template contract: single line, no-->inside strings.parseQaSummary:gaps = dedupe([...markerFindings.map(f => f.description), ...parseListSection(...)]);findingsset only when the marker parsed.Phase 2 — QA template emission (AC-2)
4.
skills/qa/SKILL.md: add the marker line to both templates + an "Output Verification" bullet requiring it; classification guidance: NOT_MET rows →requirement_gap/fix_now; §2d/§6d findings →test_gap/risk_gap; non-blocking polish →document; "cannot classify → prose only, omit from marker". Synctemplates/skills/and.claude/skills/byte-identically (cmpgate, #742).Phase 3 — Loop + ready consumers (AC-3, AC-4)
5.
ready-gate.ts:classifyGapsconsumessummary.findingswhen present (nonGoal = finding.nonGoal || gapTouchesNonGoals),fixableGapsfilters!nonGoal && action === "fix_now";batch-executor.ts:1610same filter. New optpostReport?: (body) => Promise<void>on the gate options;src/commands/ready.tsand therun --ready-gatepath (batch-executor.ts:771) wirenew GitHubProvider().postComment. Best-effort (never fails the gate).6.
formatReadyReport: per-itemcategory · actiontag, marker appended;ready.ts --jsonremainingalready serializes the extended item.7.
skills/loop/SKILL.md: replace the### Required Fixessed with: preferSEQUANT_FAILED_ACSenv when set (orchestrated, already filtered); else shell presence-grep for the marker, then filterrecommendedAction=="fix_now"with a tiny inlinenode -eJSON filter (no regex schema duplication — #871 drift guard). Add adocumentrow to "Excluded Finding Classes".Phase 4 — Regression + docs (AC-6) — targeted suites, full suite, CHANGELOG,
docs/reference for the marker.Decisions
{"findings":[...]}, not a bare array — extensible (e.g.unclassifiedcount for feat(ready): sequant ready never records run metrics — no visibility into escalation, iteration counts, or gate outcomes #929) and the opening{keeps the existing marker-grep idiom shape.parseQaSummary— reconciles AC-2 with AC-5's no-drop rule. Dedupe on trimmed/case-folded description.NO_IMPLEMENTATION/UNCOMMITTED_ONLY/NO_VERDICT—MAX_ITERATIONS/TOKEN_BUDGETare exactly the states whose gap list must survive the terminal. (Resolves the issue's human-decision question; override if you wantac-only.)node -eon an extracted single-line JSON is a 3-line filter; a subcommand would be a fifth parser to keep in sync.Open Questions
--jsonmode still posts. Impact if wrong: noisy dogfood issues — trivial follow-up flag.batch-executor.ts:200("QA Gaps:" error text) render category/action? Recommendation: yes, cheap, same formatter as the ready report.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled (SCOPE_WARNING)
Reasoning: 5 of 6 ACs are unit/integration-verified (testgen stubs); two-skill × three-dir template sync and a parser contract change warrant the loop.
Labels: current none → add
enhancement,planned.admarble commentedon Aug 21, 2026
/fullsolve Complete
Issue: #937
Status: NEEDS_VERIFICATION
Summary
Progress Table
ui/frontend/adminlabel)AC Coverage
GapFindingSchema— six categories, requiredevidence, exported. Matches the issue's own verbatimGapFindingTS-interface fixture field-for-field.SEQUANT_QA_GAPS;parseQaSummaryunions marker + prose.selectFixableGapswired intoready-gate.ts/batch-executor.ts;/loop's dead### Required Fixesgrep replaced with marker parsing — verified against 5 realistic samples.Risk Assessment
/loop's shell-side marker extraction (grep/sed) has no fenced-code-block awareness, unlike the TypeScript-sidestripMarkdownCodethe other markers use. Low real-world risk (QA never wraps its own emitted marker in a fence), but worth a follow-up hardening pass if it proves to matter in practice.Quality checks: type safety ✅ (0 issues), scope/size ✅ (moderate, cohesive, test-proportionate), security ✅ (0 critical/warning).
PR: #954
Merge is a human decision. The one open item (AC-4's manual dogfood check) is exactly the kind of post-merge verification this project's
ready/QA framework treats as report-only, not auto-mergeable —/fullsolveis stopping here rather than merging on your behalf. Suggested next step: merge #954, then exercisesequant ready(or a/qa→/loopcycle) on a live issue to close out AC-4, or run/qa 937again once you're satisfied.fix(loop): strip fenced/inline code before matching SEQUANT_QA_GAPS m…
fix(#964): orchestrated sequant run posts the fresh qa verdict, not j…
docs: cover the v2.11.0→next batch's behavior changes and QA gates