Skip to content

autonomous-sdlc: learn from every run — trace capture, scoring, and /sdlc-retro (AFlow-inspired) - #21

Draft
JoshuaOliphant wants to merge 3 commits into
mainfrom
claude/aflow-sdlc-optimization-946f0n
Draft

autonomous-sdlc: learn from every run — trace capture, scoring, and /sdlc-retro (AFlow-inspired)#21
JoshuaOliphant wants to merge 3 commits into
mainfrom
claude/aflow-sdlc-optimization-946f0n

Conversation

@JoshuaOliphant

@JoshuaOliphant JoshuaOliphant commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Design note plus proof-of-concept implementation for making the autonomous-sdlc loop learn from its own runs. Started from AFlow (Zhang et al., ICLR 2025 — MCTS over agentic workflows), revised after discussion to invert the mechanism: instead of buying evaluations with benchmark runs, every real /sdlc run is the evaluation, amortized over normal usage. Plugin bumped 2.3.1 → 2.4.0.

Design (docs/aflow-sdlc-optimization.md)

The flow — capture → score → retro → measure. The retro proposes but never self-merges; patterns need ≥2 supporting runs; secondary metrics veto but are never optimized. The original genome/benchmark MCTS design is retained as future work for when passive accumulation plateaus.

Implementation

  • Capture (sdlc_state.py): every terminal transition (DONE and BLOCKED, including budget force-blocks via block()) archives the run's full trace (state.json history, decisions.jsonl, progress.md, signs.md, escalation.md) to ~/.claude/autonomous-sdlc/runs/ (override: SDLC_RUNS_DIR) and appends a scored line to runs.jsonl carrying plugin_version for attribution. Archiving is best-effort by design — it can never break a transition.
  • Score (sdlc_state.py score): composite from the current increment's transition history — 0.5·outcome + 0.2·efficiency + 0.2·(1−rework rate) + 0.1·autonomy — with rework broken out (verify bounces, review round-trips, replans, repairs).
  • Retro tooling (scripts/sdlc_retro.py): digest aggregates runs since the last retro marker — per-version score windows with pessimistic means (mean − stderr) and a min-n comparability gate, outcome/blocked-reason/rework totals, worst-run archive pointers; mark records the retro point that windows the next one.
  • /sdlc-retro command + sdlc-retro skill: grade the previous retro first (revert proposal on regression), mine the worst runs against a pattern checklist (blocked reasons, rework clusters, attempts-exceeded shapes, sign audit, decision audit), deliver ≤5 grounded proposals — one commit each, as a PR in author mode or feedback entries in consumer mode.
  • sdlc-loop skill: SHIP→DONE notes the automatic archiving and nudges /sdlc-retro at 10+ unretroed runs.

Verification

  • uv run --group dev python scripts/check_all.py — versions in sync, shared copies match, 131 tests pass (9 new: scoring, archive-on-terminal, forced-block capture, archive-failure safety, increment windowing, digest/mark CLI)
  • ruff check plugins/autonomous-sdlc/scripts/ — clean
  • End-to-end smoke test: two loops driven to DONE and BLOCKED(budget) in scratch projects → both archived with correct scores → digest aggregated them and surfaced the blocked run as worst → mark windowed the next digest to 0 runs

🤖 Generated with Claude Code

https://claude.ai/code/session_01UT9Qjmu44qeUVEbwfbSfMk

claude added 2 commits July 8, 2026 05:45
…loop

Maps AFlow (Zhang et al. 2025) onto autonomous-sdlc: what its MCTS
workflow search assumes, why a naive port fails, and a three-tier
adaptation — score every run from the existing state.json trace,
reify the loop's config surface as a hashable workflow genome, then
search genome variants with MCTS-lite using autoloop as the
benchmark-mode evaluator harness.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UT9Qjmu44qeUVEbwfbSfMk
Per discussion: instead of benchmark-driven MCTS as the primary
mechanism, every real /sdlc run archives its trace (state history,
decisions, signs, escalations) to a durable user-level ledger with a
computed score, and a periodic /sdlc-retro mines the accumulated
records to propose skill improvements as a human-reviewed PR. Each
retro first grades the previous one by comparing score windows across
plugin versions (AFlow's keep-if-improved, amortized over real usage).
Deliberate genome/benchmark search moves to future work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UT9Qjmu44qeUVEbwfbSfMk
@JoshuaOliphant JoshuaOliphant changed the title docs: AFlow-style MCTS workflow optimization for the SDLC loop (design note) docs: learn from every SDLC run — trace capture + periodic retro (AFlow-inspired design note) Jul 8, 2026
Proof of concept for docs/aflow-sdlc-optimization.md:

- sdlc_state.py: every terminal transition (DONE and BLOCKED, including
  budget force-blocks) archives the run's full trace to the user-level
  ledger at ~/.claude/autonomous-sdlc/ (override: SDLC_RUNS_DIR) and
  appends a scored runs.jsonl line carrying plugin_version. New 'score'
  subcommand computes the composite (outcome, efficiency, rework rate,
  autonomy) from the current increment's transition history. Archiving
  is best-effort and can never break a transition.
- sdlc_retro.py: 'digest' aggregates the ledger since the last retro
  marker (per-version score windows with pessimistic means and a min-n
  comparability gate, outcome/rework totals, worst-run pointers);
  'mark' records a retro point.
- New sdlc-retro skill + /sdlc-retro command: grade the previous retro,
  mine worst runs, deliver <=5 grounded proposals (>=2 supporting runs
  each) as a PR in author mode or feedback entries in consumer mode.
- sdlc-loop skill: notes automatic archiving at SHIP->DONE and nudges
  /sdlc-retro at 10+ unretroed runs.
- Tests for scoring, archive-on-terminal, archive-failure safety,
  increment windowing, and the digest/mark CLI. Plugin 2.3.1 -> 2.4.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UT9Qjmu44qeUVEbwfbSfMk
@JoshuaOliphant JoshuaOliphant changed the title docs: learn from every SDLC run — trace capture + periodic retro (AFlow-inspired design note) autonomous-sdlc: learn from every run — trace capture, scoring, and /sdlc-retro (AFlow-inspired) Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants