Retro

From fortunto2/solo-factory · View interactive version

Retro is an AI agent skill from the GitHub repository fortunto2/solo-factory. Use when "retro", "evaluate pipeline", "what went wrong", "pipeline review", "check pipeline logs", or after pipeline completes and needs quality assessment.

How to use this skill

Skill file

/retro

This skill is self-contained — follow the phases below instead of delegating to other skills (/review, /audit, /build) or spawning Task subagents. Run all analysis directly.

Post-pipeline retrospective. Parses pipeline logs, counts productive vs wasted iterations, identifies recurring failure patterns, scores the pipeline run, and suggests concrete patches to skills/scripts to prevent the same failures next time.

Live Context

When to use

After a pipeline completes (or gets cancelled). This is the process quality check — /review checks code quality, /retro checks pipeline process quality.

Can also be used standalone on any project — with or without pipeline logs.

MCP Tools (use if available)

If MCP tools are not available, fall back to Glob + Grep + Read.

Phase 1: Locate Artifacts

  1. Detect project from $ARGUMENTS or CWD:
  1. Find pipeline state file: .solo/pipelines/solo-pipeline-{project}.local.md (project-local) or ~/.solo/pipelines/solo-pipeline-{project}.local.md (global fallback)
  1. Verify artifacts exist (parallel reads):
  1. Determine analysis mode:
  1. Count iter logs (if they exist): ls {project_root}/.solo/pipelines/iter-*.log | wc -l

Fallback Analysis (No Pipeline Logs)

If no pipeline logs exist, the retro can still provide value by analyzing:

  1. Git history: git log --oneline --since="1 week ago" — commit frequency, patterns, conventional format
  2. Test results: run test suite if configured in CLAUDE.md or package.json
  3. Build status: run build if configured
  4. CLAUDE.md changes: git log --oneline -- CLAUDE.md — how docs evolved
  5. Code quality metrics: file counts, TODO/FIXME density, dead code indicators
  6. Project structure: completeness of docs/, tests/, CI config

Skip Phases 2-4 and proceed directly to Phase 5 (Plan Fidelity) and Phase 6 (Git & Code Quality). Adjust Phase 7 scoring to weight available data more heavily.

Phase 2: Parse Pipeline Log (quantitative)

Read pipeline.log in full. Parse line-by-line, extracting structured data from log tags:

Log format: [HH:MM:SS] TAG | message

Extract by tag:

| Tag | What to extract |

|-----|----------------|

| START | Pipeline run boundary — count restarts (multiple START lines = restarts) |

| STAGE | iter N/M \| stage S/T: {stage_id} — iteration count per stage |

| SIGNAL | <solo:done/> or <solo:redo/> — which stages got completion signals |

| INVOKE | Skill invoked — extract skill name, check for wrong names |

| ITER | commit: {sha} \| result: {stage complete\|continuing} — per-iteration outcome |

| CHECK | {stage} \| {path} -> FOUND\|NOT FOUND — marker file checks |

| FINISH | Duration: {N}m — total duration per run |

| MAXITER | Reached max iterations ({N}) — hit iteration ceiling |

| QUEUE | Plan cycling events (activating, archiving) |

| CIRCUIT | Circuit breaker triggered (if present) |

| CWD | Working directory changes |

| CTRL | Control signals (pause/stop/skip) |

Compute metrics:

total_runs = count of START lines
total_iterations = count of ITER lines
productive_iters = count of ITER lines with "stage complete"
wasted_iters = total_iterations - productive_iters
waste_pct = wasted_iters / total_iterations * 100
maxiter_hits = count of MAXITER lines
plan_cycles = count of QUEUE lines with "Cycling"

per_stage = {
  stage_id: {
    attempts: count of STAGE lines for this stage,
    successes: count of ITER lines with "stage complete" for this stage,
    waste_ratio: (attempts - successes) / attempts * 100,
  }
}

Phase 3: Parse Progress.md (qualitative)

Read progress.md and scan for error patterns:

  1. Unknown skill errors: grep for Unknown skill: — extract which skill name was wrong
  2. Empty iterations: iterations where "Last 5 lines" show only errors or session header (no actual work done)
  3. Repeated errors: same error appearing in consecutive iterations -> spin-loop indicator
  4. Doubled signals: <solo:done/><solo:done/> in same iteration -> minor noise (note but don't penalize)
  5. Redo loops: count how many times build->review->redo->build cycles occurred

For each error pattern found, record:

Phase 4: Analyze Iter Logs (sample-based)

Do NOT read all iter logs — could be 60+. Use smart sampling:

  1. First failed iter per pattern: For each failure pattern found in Phase 3, read the first iter log that shows it
  1. First successful iter per stage: For each stage that eventually succeeded, read the first successful iter log
  1. Final review iter: Read the last iter-*-review.log (the verdict)
  1. Extract from each sampled log:

Phase 5: Plan Fidelity Check

For each track directory in docs/plan-done/ and docs/plan/:

  1. Read spec.md (if exists):
  1. Read plan.md (if exists):
  1. Compile per-track summary:

Phase 6: Git & Code Quality (lightweight)

Quick checks only — NOT a full /review:

  1. Commit count and format:

```bash

git -C {project_root} log --oneline | wc -l

git -C {project_root} log --oneline | head -30

```

  1. Committer breakdown:

```bash

git -C {project_root} shortlog -sn --no-merges | head -10

```

  1. Test status (if test command exists in CLAUDE.md or package.json):
  1. Build status (if build command exists):

Phase 6.5: Context Degradation Analysis

Check for signs of context window problems during the pipeline run:

  1. Iteration quality curve: Compare early iterations vs late iterations.
  1. Observation masking usage: Check if scratch/ directory exists in project root.
  1. Plan recitation evidence: In sampled iter logs, check if the agent re-read plan.md at task boundaries.
  1. CLAUDE.md bloat: wc -c {project_root}/CLAUDE.md

Add findings to the report under ## Context Health:

## Context Health
- Iteration quality trend: {STABLE / DEGRADING / N/A}
- Observation masking: {USED / NOT USED / N/A}
- Plan recitation: {OBSERVED / ABSENT / N/A}
- CLAUDE.md size: {N} chars — {OK / WARN / BLOATED}

Phase 7: Score & Report

Load scoring rubric from ${CLAUDE_PLUGIN_ROOT}/skills/retro/references/eval-dimensions.md.

If plugin root not available, use the embedded weights:

Scoring weights:

Note: In fallback mode (no pipeline logs), redistribute Efficiency and Stability weights to Fidelity, Quality, and Commits.

Generate report at {project_root}/docs/retro/{date}-retro.md:

# Pipeline Retro: {project} ({date})

## Overall Score: {N}/10

## Pipeline Efficiency

| Metric | Value | Rating |
|--------|-------|--------|
| Total iterations | {N} | |
| Productive iterations | {N} ({pct}%) | {emoji} |
| Wasted iterations | {N} ({pct}%) | {emoji} |
| Pipeline restarts | {N} | {emoji} |
| Max-iter hits | {N} | {emoji} |
| Total duration | {time} | {emoji} |
| Tracks completed | {N} | |
| Duration per track | {time/tracks} | {emoji} |

## Per-Stage Breakdown

| Stage | Attempts | Successes | Waste % | Notes |
|-------|----------|-----------|---------|-------|
| scaffold | | | | |
| setup | | | | |
| plan | | | | |
| build | | | | |
| deploy | | | | |
| review | | | | |

## Failure Patterns

### Pattern 1: {name}
- **Occurrences:** {N} iterations
- **Root cause:** {analysis}
- **Wasted:** {N} iterations
- **Fix:** {concrete suggestion with file reference}

### Pattern 2: ...

## Plan Fidelity

| Track | Criteria Met | Tasks Done | SHAs | Rating |
|-------|-------------|------------|------|--------|
| {track-id} | {N}% | {N}% | {yes/no} | {emoji} |

## Code Quality (Quick)

- **Tests:** {N} pass, {N} fail (or "not configured")
- **Build:** PASS / FAIL (or "not configured")
- **Commits:** {N} total, {pct}% conventional format

## Three-Axis Growth

| Axis | Score | Evidence |
|------|-------|----------|
| **Technical** (code, tools, architecture) | {0-10} | {what changed} |
| **Cognitive** (understanding, strategy, decisions) | {0-10} | {what improved} |
| **Process** (harness, skills, pipeline, docs) | {0-10} | {what evolved} |

If only one axis is served — note what's missing.

## Recommendations

1. **[CRITICAL]** {patch suggestion with file:line reference}
2. **[HIGH]** {improvement}
3. **[MEDIUM]** {optimization}
4. **[LOW]** {nice-to-have}

## Suggested Patches

### Patch 1: {file} — {description}

**What:** {one-line description}
**Why:** {root cause reference from Failure Patterns}

\```diff
- old line
+ new line
\```

Rating guide (use these emojis):

Phase 8: Interactive Patching

After generating the report:

  1. Show summary to user: overall score, top 3 failure patterns, top 3 recommendations
  1. For each suggested patch (if any), use AskUserQuestion:
  1. If "Show diff first": display the full diff, then ask again (Apply / Skip)
  1. If "Apply": use Edit tool to apply the change directly
  1. After all patches processed:

Phase 9: CLAUDE.md Revision

After patching, revise the project's CLAUDE.md to keep it lean and useful for future agents.

Steps:

  1. Read CLAUDE.md and check size: wc -c CLAUDE.md
  2. Add learnings from this retro:
  1. If over 40,000 characters — trim ruthlessly:
  1. Verify result <= 40,000 characters — if still over, cut least actionable content
  2. Write updated CLAUDE.md, update "Last updated" date

Priority (keep -> cut):

  1. ALWAYS KEEP: Tech stack, directory structure, Do/Don't rules, common commands, architecture decisions
  2. KEEP: Workflow instructions, troubleshooting for active issues, key file references
  3. CONDENSE: Phase histories (one line each), detailed examples, tool/MCP listings
  4. CUT FIRST: Historical notes, verbose explanations, duplicated content, resolved issues

Rules:

Phase 10: Factory Critic (optional)

Run this phase only if ${CLAUDE_PLUGIN_ROOT} is available (i.e., solo-factory is installed). Skip if running as a standalone skill without the factory context.

After evaluating the project pipeline, step back and evaluate the factory itself — the skills, scripts, and pipeline logic that produced this result. Be a harsh critic.

What to evaluate:

  1. Read the skills that were invoked in this pipeline run (from INVOKE lines in pipeline.log):
  1. Read pipeline script signal handling and stage logic:
  1. Cross-reference with failure patterns from Phase 3:

Score the factory (not the project):

Factory Score: {N}/10

Skill quality:
- {skill}: {score}/10 — {why}
- {skill}: {score}/10 — {why}

Pipeline reliability: {N}/10 — {why}

Missing capabilities:
- {what the factory couldn't do that it should have}

Top factory defects:
1. {defect} → {which file to fix} → {concrete fix}
2. {defect} → {which file to fix} → {concrete fix}

Harness Evolution — think about the bigger picture

After scoring the factory, step back further and think about the harness — the entire system that guides agents (CLAUDE.md, docs/, linters, skills, templates). Ask:

  1. Context engineering: Did the agent have everything it needed in-repo? Or did it struggle because knowledge was missing / scattered / stale?
  1. Architectural constraints: Did the agent break module boundaries, produce inconsistent patterns, or ignore conventions?
  1. Decision traces: What worked well that future agents should reuse? What failed that they should avoid?
  1. Skill gaps: Which skills need better instructions? Which new skills should exist?

Write to evolution log:

Append findings to {project_root}/docs/evolution.md (create if not exists). If ~/.solo/evolution.md exists, append there as well for cross-project tracking.

## {YYYY-MM-DD} | {project} | Factory Score: {N}/10

Pipeline: {stages run} | Iters: {total} | Waste: {pct}%

### Defects
- **{severity}** | {skill/script}: {description}
  - Fix: {concrete file:change}

### Harness Gaps
- **Context:** {what knowledge was missing or stale for the agent}
- **Constraints:** {what boundary violations or inconsistencies occurred}
- **Precedents:** {patterns worth capturing for future agents — good or bad}

### Missing
- {capability the factory lacked}

### What worked well
- {skill/pattern that performed efficiently}

Rules:

Signal Output

Output signal: <solo:done/>

Important: /retro always outputs <solo:done/> — it never needs redo. Even if pipeline was terrible, the retro itself always completes.

Edge Cases

Reference Files

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.