Repository navigation
Closed
Labels
Description
Summary
Add an optional --reflect flag to sequant run that analyzes the completed run and suggests improvements for future runs.
Problem
From verbose run review:
- Run completed with pass/fail summary only
- No analysis of what could be improved
- No suggestions for workflow optimization
- Patterns (e.g., spec taking same time for trivial vs complex issues) not surfaced
Current Output
Results: 3 passed, 0 failed
✓ #113: spec → exec → qa (9m 10s)
✓ #114: spec → exec → qa (10m 18s)
✓ #115: spec → exec → qa (15m 51s)
📝 Log: .sequant/logs/run-xxx.json
Proposed Output (with --reflect)
Results: 3 passed, 0 failed
✓ #113: spec → exec → qa (9m 10s)
✓ #114: spec → exec → qa (10m 18s)
✓ #115: spec → exec → qa (15m 51s)
📝 Log: .sequant/logs/run-xxx.json
┌─ Run Analysis ──────────────────────────────────────────────────┐
│ │
│ Observations: │
│ • #113 spec phase (2m 55s) similar to #115 (3m 37s) despite │
│ 10x complexity difference — consider fast-track for trivial │
│ • All 3 issues ran same phases despite different requirements │
│ • No browser testing ran despite #115 touching .tsx files │
│ │
│ Suggestions for next run: │
│ • Add `ui` label to component extraction issues │
│ • Consider `--phases exec,qa` for simple fixes │
│ • Run `/solve` first to get phase recommendations │
│ │
└─────────────────────────────────────────────────────────────────┘
Acceptance Criteria
- AC-1: Add
--reflectflag tosequant runcommand - AC-2: Analyze phase timing patterns across issues
- AC-3: Detect potential phase mismatches (e.g., .tsx without /test)
- AC-4: Suggest workflow improvements based on patterns
- AC-5: Output is concise (max 10 lines of suggestions)
Analysis Points
| Pattern | Detection | Suggestion |
|---|---|---|
| Similar spec times for different complexity | Compare title length/AC count to duration | Consider solve analysis |
| .tsx files without /test | Check diff for .tsx, check phases | Add ui label |
| All issues same phases | Compare recommended vs executed | Use /solve or per-issue flags |
| Long QA times | Duration > 5 minutes | Check sub-agent spawning |
| Quality loop triggered | Loop phase in results | Consider complex label upfront |
Priority
Low — Nice-to-have for workflow optimization. Not blocking correctness.
References
- Run command:
src/commands/run.ts - Metrics writer:
src/lib/workflow/metrics-writer.ts - Existing
/reflectskill:templates/skills/reflect/SKILL.md
Activity
admarble commentedon Feb 22, 2026
Spec Plan — #179: Add optional self-reflection summary after run completion
AC Quality Check
✅ All 5 acceptance criteria are clear and testable.
Scope Assessment
Verdict: ✅ SCOPE_OK — Single focused feature with clear boundaries.
Non-Goals
Acceptance Criteria
AC-1: Add
--reflectflag tosequant runcommandVerification Method: Integration Test
Test Scenario:
--reflectflag is passedAC-2: Analyze phase timing patterns across issues
Verification Method: Unit Test
Test Scenario:
analyzeRun()is calledAC-3: Detect potential phase mismatches (e.g., .tsx without /test)
Verification Method: Unit Test
Test Scenario:
analyzeRun()is calledAC-4: Suggest workflow improvements based on patterns
Verification Method: Unit Test
Test Scenario:
analyzeRun()is calledAC-5: Output is concise (max 10 lines of suggestions)
Verification Method: Unit Test
Test Scenario:
formatReflection()is calledImplementation Plan
Phase 1: Create reflection analysis module
src/lib/workflow/run-reflect.tswith:ReflectionInput/ReflectionOutputinterfacesanalyzeRun(input)— orchestrates analysisanalyzeTimingPatterns()— compares phase durations across issuesdetectPhaseMismatches()— checks fileDiffStats for .tsx without /testsuggestImprovements()— pattern-based workflow suggestionsformatReflection(output)— renders box-formatted output (max 10 lines)Phase 2: Wire into CLI and run command
reflect?: booleantoRunOptionsinterface insrc/commands/run.ts.option("--reflect", "Analyze run and suggest improvements")inbin/cli.tsmergedOptions.reflectis true:analyzeRun()withresults,issueInfoMap,logWriter?.getRunLog(),configformatReflection()outputPhase 3: Tests
src/lib/workflow/run-reflect.test.tscovering:Data sources at integration point:
results: IssueResult[]— per-issue phase success/failure/durationlogWriter.getRunLog()— full RunLog with fileDiffStats, labelsissueInfoMap— issue titles and labelsconfig— run configuration (phases, qualityLoop)Feature Quality Planning
Completeness: All 5 ACs map to implementation steps. Integration with existing run summary.
Error Handling: Graceful fallback if logWriter is null (--no-log) — just skip fileDiff-based analysis. Never crash the run for reflection failures.
Code Quality: Typed interfaces, follows existing workflow module patterns.
Test Coverage: Unit tests for each analyzer + format output.
Recommended Workflow
Phases: spec → exec → qa
Quality Loop: disabled
Reasoning: CLI/backend feature, no UI components. Pure logic with unit tests.
Label Review
Current: enhancement, auto-ready, ai-in-progress
Recommended: enhancement, auto-ready, ai-in-progress, cli
Reason: This is a CLI flag addition.
→
gh issue edit 179 --add-label clifeat(#179): add --reflect flag for post-run analysis
feat(#179): add --reflect flag for post-run analysis
feat(#179): add --reflect flag for post-run analysis (#333)
admarble commentedon Feb 22, 2026
/fullsolve Complete
Issue: #179
Status: READY_FOR_MERGE ✅
Summary
AC Coverage
--reflectflag tosequant runKey Changes
src/lib/workflow/run-reflect.ts— analysis module withanalyzeRun()andformatReflection()src/lib/workflow/run-reflect.test.ts— 15 unit testssrc/commands/run.ts— wiring: import,reflect?: booleanin RunOptions, integration after summarybin/cli.ts—.option("--reflect", ...)Iterations
PR: #333 (merged)
chore: release v1.17.0