Comprehensive session retrospective that turns one session's outcomes into persistent improvements. Adaptive depth: deep by default, with light mode via --light (and tiny-session auto-light). Triggers: "cwf:retro", "retro", "retrospective", "회고"
Adaptive end-of-session review that converts outcomes into durable process/context/tool improvements. Deep by default; light mode is used with --light or for tiny routine sessions. Produces retro.md alongside plan.md and lessons.md in the session artifact directory.
/retro [path] # adaptive (deep by default)
/retro --deep [path] # full analysis with expert lens
/retro --from-run [path] # internal flag when invoked by cwf:run
path: optional override for output directory--deep: force full 7-section analysis (expert lens, learning resources, web search)--from-run: internal invocation context flag; enables compact report for run-chain orchestrationRun:
bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh set . phase="retro"
Resolution order:
[path] argument provided, use it.cwf/projects/ path already used in this session (plan.md/lessons.md writes)YYMMDD) differs from today's local date, AskUserQuestion:
{CWF_PLUGIN_DIR}/scripts/next-prompt-dir.sh --bootstrap <title>, then copy plan.md and lessons.md from the previous session directory when present so retro context is preserved.{CWF_PLUGIN_DIR}/scripts/next-prompt-dir.sh --bootstrap <title>If AskUserQuestion is unavailable/blocked, do not wait. Resolve path in this order: explicit [path] -> live.dir -> latest .cwf/projects/ -> bootstrap via {CWF_PLUGIN_DIR}/scripts/next-prompt-dir.sh --bootstrap retro-light. Record a short note (Fast path or Post-Retro Findings) so the fallback choice is auditable.
If invocation includes --light, run deterministic fast path immediately after output-dir resolution (before evidence collection and large artifact reads):
bash {CWF_PLUGIN_DIR}/scripts/retro-light-fastpath.sh \
--session-dir "{output-dir}" \
--invocation "{invocation_mode}" \
--lang "{user-language}"
Then validate retro stage gate immediately:
bash {CWF_PLUGIN_DIR}/scripts/check-run-gate-artifacts.sh \
--session-dir "{output-dir}" \
--stage retro \
--strict
Rules:
invocation_mode with the same criteria as Section 3.1 before running this command.Skip this section when Section 1.2 completed and execution already ended in non-interactive light mode.
Before reading artifacts, run the evidence collector (it includes best-effort Codex session-log sync with timeout protection):
bash {CWF_PLUGIN_DIR}/scripts/retro-collect-evidence.sh --session-dir "{output-dir}"
Then read retro-evidence.md (if generated), plan.md, lessons.md, and cwf-state.yaml. Read AGENTS/adapter docs and project-context docs only when those files exist.
When running deep mode (or when user explicitly specifies a diff baseline/scope), generate coverage-contract artifacts before drafting narrative sections:
bash {CWF_PLUGIN_DIR}/scripts/retro-coverage-contract.sh \
--session-dir "{output-dir}" \
--base-ref "{retro_base_ref:-HEAD~1}"
Then cite at least:
Parse the --deep flag from the invocation arguments.
If --deep is present: mode = deep (full 7 sections).
If --deep is absent: assess session weight to decide mode:
--light is explicitly specified, OR session < 3 turns with routine/simple tasks (config changes, small fixes, doc edits)--light to explicitly request lightweight mode when cost savings is desired.--light)Reuse the command and gate in Section 1.2. Do not rerun unless retro.md is missing/invalid. In non-interactive runs, stop after fast path + gate. Do not call AskUserQuestion when fallback policy is sufficient.
Determine invocation context from arguments and live task:
--from-run present, or live task explicitly indicates cwf:run.Persist this as:
invocation_mode: run_chain | direct
Draft everything internally before writing to file.
After fast path bootstrap, enrich sections 1-4 and 7 inline only if time/context budget allows. No sub-agents.
Draft sections 1-3 inline (these require full conversation access), then launch parallel sub-agents in two batches.
Resolve session directory: Resolve the effective live-state file, then read live.dir.
live_state_file=$(bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh resolve)
session_dir: "{live.dir value from resolved live-state file}"
Apply the context recovery protocol to these files before launching each batch:
| Batch | Agent | Output file |
|---|---|---|
| 1 | CDM Analysis | {session_dir}/retro-cdm-analysis.md |
| 1 | Learning Resources | {session_dir}/retro-learning-resources.md |
| 2 | Expert α | {session_dir}/retro-expert-alpha.md |
| 2 | Expert β | {session_dir}/retro-expert-beta.md |
Stage-tier policy for deep mode outputs:
{session_dir}/retro-cdm-analysis.md{session_dir}/retro-learning-resources.md,
{session_dir}/retro-expert-alpha.md, {session_dir}/retro-expert-beta.mdFor all outputs: bounded retry = 1 for missing/invalid files.
Run slot preflight before each batch launch:
bash {CWF_PLUGIN_DIR}/scripts/agent-slot-preflight.sh --required 2 --json
launch_mode=blocked, wait/close active agents and retry once.launch_mode=multi_batch, run the batch sequentially agent-by-agent.Batch 1 — launch with the preflight-selected mode (only for agents whose result files are missing or invalid):
subagent_type: general-purpose, max_turns: 16. Read {SKILL_DIR}/references/cdm-guide.md, analyze Sections 1-3 summary + relevant cwf-state.yaml, write Section 4 content to {session_dir}/retro-cdm-analysis.md, append <!-- AGENT_COMPLETE -->.subagent_type: general-purpose, max_turns: 20. Find 2-3 external resources using the Web Research Protocol in {CWF_PLUGIN_DIR}/references/agent-patterns.md, write Section 6 content to {session_dir}/retro-learning-resources.md, append <!-- AGENT_COMPLETE -->.Wait for Batch 1 to complete. Read output files from session directory:
{session_dir}/retro-cdm-analysis.md — CDM analysis (needed by Batch 2 experts){session_dir}/retro-learning-resources.md — Learning resourcesGate behavior after Batch 1:
retro-cdm-analysis.md remains invalid after retry: hard fail deep retro.retro-learning-resources.md remains invalid after retry: continue with
warning and render Section 6 with explicit omission note.PERSISTENCE_GATE=HARD_FAIL or
PERSISTENCE_GATE=SOFT_CONTINUE, or equivalent wording).Batch 2 — launch with the preflight-selected mode (after Batch 1, only for agents whose result files are missing or invalid):
subagent_type: general-purpose, max_turns: 20. Read {CWF_PLUGIN_DIR}/references/expert-advisor-guide.md + {SKILL_DIR}/references/expert-lens-guide.md, analyze Sections 1-4 summary (including CDM output), write to {session_dir}/retro-expert-alpha.md, append <!-- AGENT_COMPLETE -->.subagent_type: general-purpose, max_turns: 20. Same contract as Expert alpha; write to {session_dir}/retro-expert-beta.md, append <!-- AGENT_COMPLETE -->.After Batch 2: read output files from session directory ({session_dir}/retro-expert-alpha.md, {session_dir}/retro-expert-beta.md). Draft Section 5 with the required agreement/disagreement synthesis subsection, then draft Section 7 inline (capability/tool scan), then integrate all results into retro.md.
Gate behavior after Batch 2:
PERSISTENCE_GATE=SOFT_CONTINUE or equivalent).Rationale for 2-batch design: Expert Lens depends on CDM results. Batch 1 produces CDM + Learning in parallel, Batch 2 runs experts after CDM is available.
Use section-writing guidance from section-authoring.md.
Use section-writing guidance from section-authoring.md.
Use section-writing guidance from section-authoring.md, including mandatory 5 Whys depth for major waste signals.
Use section-writing guidance from section-authoring.md.
Use section-writing guidance from section-authoring.md. Agreement/disagreement synthesis subsection remains mandatory in deep mode.
Use section-writing guidance from section-authoring.md.
Use section-writing guidance from section-authoring.md, including capability inventory, gap classification, and action path.
Write to {output-dir}/retro.md using the format below.
Immediately enforce deterministic retro artifact gate:
bash {CWF_PLUGIN_DIR}/scripts/check-run-gate-artifacts.sh \
--session-dir "{output-dir}" \
--stage retro \
--strict \
--record-lessons
If this gate fails, do not mark retro complete. Fix artifacts/mode labeling first, then re-run the gate.
Discover runtime logs under:
.cwf/sessions/{YYMMDD}-*.claude.md, {YYMMDD}-*.codex.md{YYMMDD}-*.mdThen:
{output-dir}/session-logs/ exists.ln -s "{relative-log-path}/{filename}" "{output-dir}/session-logs/{filename}"
retro.md is session-specific. Persist findings to project-level improvements with a required ownership check before applying the eval > state > doc hierarchy.
For each finding, classify ownership first:
owner=repo — the fix belongs to this repository's local artifacts/policies.owner=plugin — the fix belongs to CWF plugin/runtime/shared tooling behavior.Then set apply layer deterministically:
owner=repo -> apply_layer=localowner=plugin -> apply_layer=upstreamRequired metadata for every persist proposal:
ownerapply_layerpromotion_targetdue_releaseevidence (command output, artifact path, or session-log line)Routing rules:
owner=repo: continue with tiering and local target updates.owner=plugin: do not propose local AGENTS/doc edits as the primary fix. Output an upstream backlog item (issue/patch target under plugins/cwf/ or related shared runtime files). Local edits are allowed only as clearly marked stopgaps.owner=plugin, state uncertainty explicitly, and avoid adding repo-local policy noise.next-session.md delta-focused; do not move global contracts there.After ownership routing, evaluate enforcement mechanisms strongest-first:
Tier 1: Eval/Hook (deterministic) — Can a script/hook catch this?
check-session.sh / session_defaults for missing artifactsTier 2: State (structural) — Does this change workflow state?
cwf-state.yaml schema (new artifacts, stage transitions)session_defaults (new always/milestone artifacts)Tier 3: Doc (behavioral, last resort) — Only for judgment calls
project-context.md for architectural patternsPer-section persist actions:
project-context.md (Tier 3 — context is inherently behavioral). Offer to append new context.owner=repo.project-context.md for architectural patterns, protocol/skill docs for process changes.project-context.md).owner=repo, AskUserQuestion "Implement now?". For owner=plugin, AskUserQuestion "Queue upstream issue/patch now?".Expert Roster Maintenance (deep mode only, when Section 5 was produced):
{CWF_PLUGIN_DIR}/references/expert-advisor-guide.md (including the retro-specific gap analysis step)After writing retro.md, always report outcomes to the user.
If invocation_mode=direct (user-triggered /retro or cwf:retro):
Retro Brief with 4-6 bullets:
Persist Proposals with 2-5 concrete items:
repo, plugin)local, upstream)Eval-Hook, State, Doc)If invocation_mode=run_chain:
Persist Proposals mini-list with 1-2 concrete items that each state owner/apply-layer/target (file or backlog). If no actionable item exists, state that explicitly.The user may continue the conversation after the retro. During post-retro discussion:
retro.md — append under ### Post-Retro Findingslessons.md with new learningsowner/apply_layer, then evaluate through eval > state > doc.owner=plugin, append an upstream backlog note instead of adding repo-local policy prose.- **Owner**: \repo|plugin``- **Apply Layer**: \local|upstream``- **Promotion Target**: \...``- **Due Release**: \...``Do not prompt the user to start this discussion.
Use canonical templates from section-authoring.md for both light/deep modes.
{SKILL_DIR}/references/expert-lens-guide.md and include the mandatory agreement/disagreement synthesis subsection.retro.md and deep-mode companion outputs are written in the user's language.{SKILL_DIR}/references/cdm-guide.md — CDM probe methodology and output format{SKILL_DIR}/references/expert-lens-guide.md — Retro-specific expert lens constraints and output format