Skip to content

feat(solve): Persist workflow analysis to issue comments #172

Closed

Description

@admarble

Summary

The /solve skill analyzes issues and recommends optimal workflows, but this analysis is displayed only in the terminal and discarded. When sequant run executes, /spec re-analyzes from scratch, sometimes reaching different conclusions.

Problem

Current Flow (Disconnected)

/solve 113 114 115
    ↓
[Advisory output to terminal]  ←── User reads, decides
    ↓
npx sequant run 113 114 115
    ↓
/spec runs, makes its own analysis  ←── Ignores solve's work

Evidence

From verbose run review:

Acceptance Criteria

  • AC-1: After analysis, solve prompts: "Save this plan to the issues? [Y/n]"
  • AC-2: If yes, solve posts a structured comment to each issue with machine-readable markers
  • AC-3: Comment includes recommended phases, flags, and reasoning
  • AC-4: /spec skill checks for solve analysis comment before making its own recommendation
  • AC-5: If solve comment exists, spec uses it as input (can still override with explanation)

Proposed Comment Format

## Solve Analysis

**Recommended Phases:** exec → qa
**Skip Spec:** Yes (trivial fix - unused variable removal)
**Browser Testing:** No (no UI changes detected)
**Quality Loop:** No (simple fix)

### Reasoning
- Title contains "Fix unused variable" → trivial fix pattern
- No `.tsx` files likely modified
- Labels: `enhancement` (no `complex`/`refactor`)

<!-- solve:phases=exec,qa -->
<!-- solve:skip-spec=true -->
<!-- solve:browser-test=false -->
<!-- solve:quality-loop=false -->

Proposed Flow (Connected)

/solve 113 114 115
    ↓
[Analysis output to terminal]
    ↓
"Save this plan to the issues? [Y/n]"
    ↓
Posts structured comment to each issue
    ↓
npx sequant run 113 114 115
    ↓
/spec reads issue comments, finds solve analysis
    ↓
Spec uses solve's recommendation OR overrides with documented reason

Benefits

  1. Solve's analysis persists — Not lost after terminal output
  2. Spec can read it — Machine-readable markers enable parsing
  3. Audit trail — Issue comments show decision history
  4. User control — Prompted before posting, can decline

References

  • Solve skill: templates/skills/solve/SKILL.md
  • Spec skill: templates/skills/spec/SKILL.md

Activity

  1. added
    enhancement
    on Jan 23, 2026
  2. added
    auto-ready
    ai-in-progress
    on Feb 16, 2026
  3. admarble commented on Feb 23, 2026

    @admarble
    ContributorAuthor

    Spec Plan for #172

    AC Checklist

    • AC-1: After analysis, solve prompts: "Save this plan to the issues? [Y/n]"
    • AC-2: If yes, solve posts a structured comment to each issue with machine-readable markers
    • AC-3: Comment includes recommended phases, flags, and reasoning
    • AC-4: /spec skill checks for solve analysis comment before making its own recommendation
    • AC-5: If solve comment exists, spec uses it as input (can still override with explanation)
    • AC-6: (Derived) Add solve-comment-parser.test.ts for new comment format
    • AC-7: (Derived) Sync all 3 solve SKILL.md locations
    • AC-8: (Derived) Sync both spec SKILL.md locations

    Implementation Plan

    Phase 1: Update solve skill to post analysis (AC-1, AC-2, AC-3)

    1. Add gh issue comment to allowed-tools in all 3 solve SKILL.md locations
    2. Add "Persist Analysis" section with user prompt and posting logic
    3. Define structured comment format matching existing solve-comment-parser.ts expectations

    Phase 2: Update solve-comment-parser (AC-4)
    4. Add ## Solve Analysis to SOLVE_MARKERS array
    5. Add <!-- solve:phases=... --> HTML comment marker parsing
    6. Create solve-comment-parser.test.ts with comprehensive tests

    Phase 3: Update spec skill (AC-4, AC-5)
    7. Add "Solve Comment Detection" section to both spec SKILL.md locations
    8. Instruct spec to fetch comments, check for solve analysis, use as phase input

    Recommended Workflow

    Phases: spec → exec → qa
    Quality Loop: enabled

    Files to Modify

    File Change
    .claude/skills/solve/SKILL.md Add allowed-tools + persist section
    templates/skills/solve/SKILL.md Mirror
    skills/solve/SKILL.md Mirror
    src/lib/solve-comment-parser.ts Add new markers + HTML comment parsing
    src/lib/solve-comment-parser.test.ts New test file
    .claude/skills/spec/SKILL.md Add solve comment detection section
    templates/skills/spec/SKILL.md Mirror
  4. added
    ai-in-progress
    and removed
    ai-in-progress
    on Feb 23, 2026
  5. added a commit that references this issue on Feb 24, 2026
  6. removed
    ai-in-progress
    on Feb 24, 2026
  7. admarble commented on Mar 11, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #172

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original Solve prompts "Save this plan to the issues? [Y/n]" MET SKILL.md uses AskUserQuestion with "Yes (Recommended)" / "No" options
    AC-2 Original Structured comment posted with machine-readable markers MET gh issue comment posts with HTML comment markers
    AC-3 Original Comment includes phases, flags, and reasoning MET Comment format has phases, flags table, reasoning section, and 4 HTML markers
    AC-4 Original /spec checks for solve analysis comment MET Spec SKILL.md section 4.5 queries gh issue view --json comments for solve markers
    AC-5 Original Spec uses solve analysis as input (can override) MET Spec uses solve recommendation as starting point, override requires documented reason
    Derived ACs
    AC-6 Derived (Test Coverage) Add solve-comment-parser.test.ts for new format MET 69 tests passing including new parseSolveMarkers suite (7 tests) and ## Solve Analysis detection
    AC-7 Derived (Sync) Sync all 3 solve SKILL.md locations MET Verified identical via diff — .claude/, skills/, templates/
    AC-8 Derived (Sync) Sync both spec SKILL.md locations MET Verified identical via diff — .claude/, templates/

    Coverage: 8/8 AC items fully met
    Original ACs: 5/5 met
    Derived ACs: 3/3 met


    Quality Plan Verification

    N/A — No quality plan found in issue comments


    CI Status

    Check State Bucket Impact
    validate-plugin SUCCESS pass ✅ MET
    build (18.x) SUCCESS pass ✅ MET
    build (20.x) SUCCESS pass ✅ MET
    build (22.x) SUCCESS pass ✅ MET
    validate-skills SUCCESS pass ✅ MET
    typecheck SUCCESS pass ✅ MET

    CI Summary: 6 passed, 0 pending, 0 failed


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 7 OK
    Lines added +538 OK (mostly skill markdown + tests)
    Lines deleted -7 -

    Cache Status

    N/A — Caching disabled (first run)


    Build Verification

    N/A — Build passed (tsc exits 0)


    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    src/lib/solve-comment-parser.ts Standard ✅ Yes src/lib/solve-comment-parser.test.ts (69 tests)
    .claude/skills/solve/SKILL.md Optional N/A Skill instructions
    .claude/skills/spec/SKILL.md Optional N/A Skill instructions
    skills/solve/SKILL.md Optional N/A Skill instructions
    templates/skills/solve/SKILL.md Optional N/A Skill instructions
    templates/skills/spec/SKILL.md Optional N/A Skill instructions

    Coverage: 1/1 changed source files have corresponding tests
    Critical paths without tests: None


    Code Review

    Strengths:

    • Clean separation: parseSolveMarkers() is a focused, well-typed parser for the new HTML marker format
    • HTML markers take priority over text parsing — correct precedence for machine-readable data
    • SOLVE_HTML_MARKER_PATTERN regex handles whitespace variation (<!-- solve:... -->)
    • Unknown marker keys are silently ignored (future-proof)
    • SolveMarkers interface properly uses undefined vs explicit booleans
    • Quality loop detection correctly defers to markers when present (if (!result.qualityLoop))
    • All 3 solve SKILL.md and both spec SKILL.md locations verified in sync

    Issues:

    • None found

    Suggestions:

    • Minor: markers.phases as Phase[] on line 225 is an unchecked type assertion — invalid phase names from a malformed marker would pass through. Low risk since markers are machine-generated, and existing code uses the same pattern (line 133).

    Test Quality Review

    Category Status Notes
    Behavior vs Implementation ✅ OK Tests assert on parsed output, not internal state
    Coverage Depth ✅ OK Tests cover: new marker format, all 4 marker types, whitespace, unknown keys, empty input, precedence over arrow notation
    Mock Hygiene ✅ OK No mocks needed — pure parsing functions
    Test Reliability ✅ OK Deterministic string parsing, no timing or I/O

    Issues Found: None


    Anti-Pattern Detection

    Dependency Audit

    N/A — No dependency changes

    Code Patterns

    File:Line Category Pattern Suggestion
    solve-comment-parser.ts:225 Type Safety as Phase[] cast Low risk — consider validation if markers become user-editable

    Critical Issues: 0
    Warnings: 0


    Call-Site Review

    New exported functions detected: 1

    Function Call Sites Loop? Conditions AC Match
    parseSolveMarkers() solve-comment-parser.ts:223 (internal) No Called unconditionally by parseSolveWorkflow ✅ Correct — markers checked first, falls through to legacy parsing

    Findings: Function is used internally only. Export enables direct use by /spec skill or future consumers.


    Execution Evidence

    N/A — No executable script changes. Changes are to .ts parser (verified via tests) and .md skill instructions.


    Skill Command Verification

    Skill files changed: 5

    File Commands Found Verification Status
    .claude/skills/solve/SKILL.md gh issue comment ⚠️ Skipped (placeholders: $issue_number)
    .claude/skills/spec/SKILL.md gh issue view --json comments --jq ⚠️ Skipped (placeholder: <issue-number>)
    skills/solve/SKILL.md Same as above ⚠️ Skipped
    templates/skills/solve/SKILL.md Same as above ⚠️ Skipped
    templates/skills/spec/SKILL.md Same as above ⚠️ Skipped

    Commands Verified (syntax):

    • gh issue comment "$issue_number" --body "..." → ✅ Valid gh syntax
    • gh issue view <N> --json comments --jq '...' → ✅ comments is a valid JSON field

    Verification Status: Skipped (all commands use placeholders; syntax verified)


    Skill Change Review

    • Command verified: gh issue comment and gh issue view --json comments are valid commands
    • Fields verified: comments is a valid JSON field for gh issue view
    • Patterns complete: New ## Solve Analysis and <!-- solve:... --> markers cover the proposed format fully
    • Dependencies explicit: Requires gh CLI authenticated (consistent with existing solve/spec skills)

    Self-Evaluation

    • Verified working: Yes — 69 tests pass including new parseSolveMarkers suite; build succeeds; CI green
    • Test efficacy: High — tests cover marker parsing, format detection, precedence, edge cases
    • Likely failure mode: /solve skill generates a comment that doesn't exactly match the expected marker format (e.g., extra whitespace or different casing) — mitigated by flexible regex
    • Verdict confidence: High — this is a well-scoped parser addition + skill instruction update with comprehensive tests

    Verdict: READY_FOR_MERGE

    All 8 AC items met. Implementation is clean, well-tested (69 tests), and all skill locations are synced. CI is fully green. The parseSolveMarkers function adds the right abstraction for machine-readable solve markers without disrupting existing parsing.

    Documentation

    • N/A — No documentation needed (internal skill wiring, no user-facing API changes)

    Next Steps

    1. Merge PR feat(#172): persist solve workflow analysis to issue comments #338
    2. Run /docs 172 if any user-facing documentation is desired (optional for this change)
  8. added
    ready-for-review
    on Mar 11, 2026
  9. added a commit that references this issue on Mar 11, 2026
  10. added a commit that references this issue on Mar 11, 2026
  11. admarble commented on Mar 11, 2026

    @admarble
    ContributorAuthor

    Documentation Generated

    File: docs/features/solve-analysis-persistence.md

    Sections Included:

    • Quick Start
    • Access (command, requirements)
    • Usage (saving analysis, comment format, spec integration)
    • Options & Settings (HTML markers table)
    • Common Workflows (multi-issue analysis, override flow)
    • Troubleshooting (comment detection, old format compatibility)

    Next Steps:

    1. Review generated documentation for accuracy
    2. Merge with next PR or as standalone commit

    Ready to merge!

  12. added a commit that references this issue on Mar 11, 2026
  13. added a commit that references this issue on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-readyenhancementready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions