Self-Improving Workflow
A universal methodology skill. No tech stack templates. No tier system. Two pillars.
⚡ First action when this skill is invoked — bootstrap
Whenever this skill is loaded (the user invoked it by name, or a trigger word matched), immediately do the following before anything else:
- Run the bootstrap:
bash ~/.agents/skills/src/mirror/self-improving-workflow/scripts/init.sh "$(pwd)"
- Check the output:
- If it created files (commands/, agents/, state/, memory/, rules/) → tell the user: "Workflow scaffold installed in
.claude/. You can now use /run <topic> to start an autonomous task, or /plan <topic> to plan only. See .claude/CLAUDE.md for the full operating contract." Then stop and wait for the user's next instruction.
- If everything was skipped (already initialized) → tell the user: "Workflow already initialized. Use
/run <topic> to start, /resume to continue an unfinished plan, or /review for a read-only diagnostic." Then stop and wait.
This is the only purpose of invoking the skill by name. The skill is not an entrypoint that itself plans or executes — it lays down the slash commands and reviewer subagents into .claude/, after which the user drives everything via /run, /plan, /resume, etc.
Init is idempotent and write-once per file: it never overwrites your CLAUDE.md, your rules, or any local edits to commands/agents.
The two pillars
Pillar 1 — Multi-Agent Collaborative Learning
Four sub-agents review the work at four levels:
| Reviewer |
Triggers on |
planner-critic |
every new plan / re-plan |
implementation-reviewer |
every task done |
requirement-auditor |
every slice done |
integration-checker |
every phase done |
All findings flow to .claude/memory/episodic/ and are auto-promoted to .claude/rules/dev-lessons.md once a pattern hits the threshold (≥3 occurrences, ≥0.7 avg confidence).
Pillar 2 — Long-Running Uninterrupted Execution
Single /run <topic> command drives a hierarchical plan (phase → slice → task) to completion. Only stops on:
guard.sh blocks an irreversible operation (data loss, remote irreversible, credentials, shared comms, process kill)
- 3 consecutive review failures on the same target
Decision log at .claude/state/decisions.jsonl records every non-trivial choice for post-hoc audit.
Commands
Slash commands are mirrored from the skill into each project's .claude/commands/ on bootstrap, so Claude Code can discover them. Re-running init.sh picks up new commands added to the skill in future versions.
| Command |
Purpose |
/run <topic> |
The main entrypoint |
/run-strict <topic> |
Strict mode — 5-reviewer loop, refuses to mark done until topic-auditor verifies end-to-end delivery |
/plan <topic> |
Plan only, no execution |
/review [scope] |
Diagnostic, read-only |
/learn |
Manual crystallization |
/resume |
Continue an unfinished plan |
Reviewer subagents
The five reviewers are mirrored from the skill into .claude/agents/ on bootstrap (same reason — Claude Code only discovers subagents under .claude/agents/ or ~/.claude/agents/). The 5th reviewer (topic-auditor) only fires under /run-strict; the other four are used by both /run and /run-strict. Customize project-specific rubric items via .claude/rules/dev-lessons.md instead of forking the prompts.
Strict mode
/run-strict is the opt-in stricter sibling of /run. Use it when partial completion is unacceptable. Three differences from /run:
- Universal Completion Chain enforcement —
planner-critic rejects plans where any acceptance item lacks a task chain reaching observable proof (test output, command stdout, file content, log line, etc. — never just "commit sha").
- Observable-proof evidence per task —
implementation-reviewer rejects task evidence that's just a commit sha. Static-only changes can use static-only: <reason> as an explicit exemption.
- 5th reviewer
topic-auditor — runs once after all phases done, before the loop is allowed to write plan.meta.status = "done". May execute read-only smoke commands (pytest, curl, cat, etc.) to verify end-to-end delivery against plan.meta.topic. If anything is missing, injects new slices into the single P_recovery phase.
Strict mode also uses a progress-aware strike rule: same-target failures only count toward the 3-strike halt when the reviewer's complaint is unchanged round-to-round. Slow-but-progressing repair never gets killed.
Tradeoff: /run-strict runs 2-5× longer than /run. Use it when you mean it.
What bootstrap seeds
scripts/init.sh seeds the project's .claude/ (see the top of this file for when it runs):
commands/ and agents/ — mirrored from the skill (write-once per file, so Claude Code can discover them)
state/ — plan.json, decisions.jsonl, plan.schema.json, archive/
memory/ — episodic/, working/, semantic-patterns.json
rules/autonomy-stops.md, rules/dev-lessons.md
CLAUDE.md — only if the project doesn't already have one
Only scripts/ stays in the skill repo and is invoked by absolute path from the commands.
See also
references/methodology.md — the why behind the two pillars
references/plan-schema.md — full plan model
references/reviewer-contracts.md — IO contract for each reviewer
references/learning-loop.md — crystallization algorithm
references/migration-from-tiered.md — upgrade from the old tiered version
1---2name: self-improving-workflow3description: Universal methodology skill for Claude Code projects. Two pillars: (1) Multi-agent collaborative learning — every plan, slice, task and phase is reviewed by 4 specialist sub-agents (planner-critic, implementation-reviewer, requirement-auditor, integration-checker) whose findings auto-crystallize into project rules. (2) Long-running uninterrupted execution — single /run entrypoint drives a hierarchical plan (phase→slice→task) to completion fully autonomously, halting only on physically irreversible operations or 3 consecutive review fails. Tech-stack agnostic, project agnostic, no tier system. TRIGGER WORDS: /run, long task, autonomous plan, multi-agent review, self improving, 长任务, 多智能体评审, 自主执行, 不间断, 工作流初始化, scaffold .claude.4---56# Self-Improving Workflow78A universal methodology skill. No tech stack templates. No tier system. Two pillars.910## ⚡ First action when this skill is invoked — bootstrap1112Whenever this skill is loaded (the user invoked it by name, or a trigger word matched), **immediately do the following before anything else**:13141. Run the bootstrap:15 ```bash16 bash ~/.agents/skills/src/mirror/self-improving-workflow/scripts/init.sh "$(pwd)"17 ```182. Check the output:19 - If it created files (commands/, agents/, state/, memory/, rules/) → tell the user: *"Workflow scaffold installed in `.claude/`. You can now use `/run <topic>` to start an autonomous task, or `/plan <topic>` to plan only. See `.claude/CLAUDE.md` for the full operating contract."* Then **stop and wait** for the user's next instruction.20 - If everything was skipped (already initialized) → tell the user: *"Workflow already initialized. Use `/run <topic>` to start, `/resume` to continue an unfinished plan, or `/review` for a read-only diagnostic."* Then **stop and wait**.2122This is the only purpose of invoking the skill by name. The skill is **not** an entrypoint that itself plans or executes — it lays down the slash commands and reviewer subagents into `.claude/`, after which the user drives everything via `/run`, `/plan`, `/resume`, etc.2324Init is idempotent and write-once per file: it never overwrites your `CLAUDE.md`, your rules, or any local edits to commands/agents.2526## The two pillars2728## Pillar 1 — Multi-Agent Collaborative Learning2930Four sub-agents review the work at four levels:3132| Reviewer | Triggers on |33|---|---|34| `planner-critic` | every new plan / re-plan |35| `implementation-reviewer` | every task done |36| `requirement-auditor` | every slice done |37| `integration-checker` | every phase done |3839All findings flow to `.claude/memory/episodic/` and are auto-promoted to `.claude/rules/dev-lessons.md` once a pattern hits the threshold (≥3 occurrences, ≥0.7 avg confidence).4041## Pillar 2 — Long-Running Uninterrupted Execution4243Single `/run <topic>` command drives a hierarchical plan (`phase → slice → task`) to completion. **Only stops on**:44451. `guard.sh` blocks an irreversible operation (data loss, remote irreversible, credentials, shared comms, process kill)462. 3 consecutive review failures on the same target4748Decision log at `.claude/state/decisions.jsonl` records every non-trivial choice for post-hoc audit.4950## Commands5152Slash commands are mirrored from the skill into each project's `.claude/commands/` on bootstrap, so Claude Code can discover them. Re-running `init.sh` picks up new commands added to the skill in future versions.5354| Command | Purpose |55|---|---|56| `/run <topic>` | The main entrypoint |57| `/run-strict <topic>` | Strict mode — 5-reviewer loop, refuses to mark done until topic-auditor verifies end-to-end delivery |58| `/plan <topic>` | Plan only, no execution |59| `/review [scope]` | Diagnostic, read-only |60| `/learn` | Manual crystallization |61| `/resume` | Continue an unfinished plan |6263## Reviewer subagents6465The five reviewers are mirrored from the skill into `.claude/agents/` on bootstrap (same reason — Claude Code only discovers subagents under `.claude/agents/` or `~/.claude/agents/`). The 5th reviewer (`topic-auditor`) only fires under `/run-strict`; the other four are used by both `/run` and `/run-strict`. Customize project-specific rubric items via `.claude/rules/dev-lessons.md` instead of forking the prompts.6667## Strict mode6869`/run-strict` is the opt-in stricter sibling of `/run`. Use it when partial completion is unacceptable. Three differences from `/run`:70711. **Universal Completion Chain enforcement** — `planner-critic` rejects plans where any acceptance item lacks a task chain reaching observable proof (test output, command stdout, file content, log line, etc. — never just "commit sha").722. **Observable-proof evidence per task** — `implementation-reviewer` rejects task evidence that's just a commit sha. Static-only changes can use `static-only: <reason>` as an explicit exemption.733. **5th reviewer `topic-auditor`** — runs once after all phases done, before the loop is allowed to write `plan.meta.status = "done"`. May execute read-only smoke commands (`pytest`, `curl`, `cat`, etc.) to verify end-to-end delivery against `plan.meta.topic`. If anything is missing, injects new slices into the single `P_recovery` phase.7475Strict mode also uses a **progress-aware strike rule**: same-target failures only count toward the 3-strike halt when the reviewer's complaint is unchanged round-to-round. Slow-but-progressing repair never gets killed.7677Tradeoff: `/run-strict` runs 2-5× longer than `/run`. Use it when you mean it.7879## What bootstrap seeds8081`scripts/init.sh` seeds the project's `.claude/` (see the top of this file for when it runs):8283- `commands/` and `agents/` — mirrored from the skill (write-once per file, so Claude Code can discover them)84- `state/` — `plan.json`, `decisions.jsonl`, `plan.schema.json`, `archive/`85- `memory/` — `episodic/`, `working/`, `semantic-patterns.json`86- `rules/autonomy-stops.md`, `rules/dev-lessons.md`87- `CLAUDE.md` — only if the project doesn't already have one8889Only `scripts/` stays in the skill repo and is invoked by absolute path from the commands.9091## See also9293- `references/methodology.md` — the why behind the two pillars94- `references/plan-schema.md` — full plan model95- `references/reviewer-contracts.md` — IO contract for each reviewer96- `references/learning-loop.md` — crystallization algorithm97- `references/migration-from-tiered.md` — upgrade from the old tiered version