一键导入
improvement-loop
Run a bounded verification-first improvement loop from an approved loop spec.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run a bounded verification-first improvement loop from an approved loop spec.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Audit code quality against KB-defined properties, invariants, and naming conventions.
Quality and compliance audit — combines code-quality and spec-compliance into one actionable report.
Periodic friction analysis — proposes new skills, deterministic tools, and adaptations.
Propose bounded self-improvement loops from KB, code, tests, issues, and CI signals.
Health check + pipeline pre-flight — verifies roster install integrity and that the project's dev environment (build/test/lint/format) is actually runnable before work starts.
Formal verification gate — tool resolution via capability tag, roster re-runs coqchk/.itf replay directly, emits E0p/E0m/E0m-abstract evidence tier. Replaces the QA gate for --critical tasks.
| name | improvement-loop |
| description | Run a bounded verification-first improvement loop from an approved loop spec. |
| when_to_use | Use to run a bounded, verification-first improvement loop from an approved loop spec. Trigger: 'run the improvement loop', execute an approved loop. |
| version | 1.1.1 |
| domain | workflow |
| phase | null |
| preamble | true |
| allowed_tools | ["Read","Write","Edit","Bash","AskUserQuestion"] |
| human_gate | before |
| pipeline_role | {"triggered_by":"human (after improvement-loop-planner produces an approved spec)","receives":"loop spec in $ARGUMENTS","produces":"code/config changes, results.tsv, friction log","pairs_with":"improvement-loop-planner"} |
This preamble is injected into every roster skill that declares preamble: true.
It encodes the non-negotiable principles that govern all skill runs.
Do not defer tests, documentation, or robustness in the name of speed. A short-term shortcut is rarely faster than a complete solution. "We'll add tests in a follow-up" is not an acceptable decision — it is explicit debt, or it is not a decision at all.
Before creating anything, verify what already exists:
A false positive (checking for something that didn't exist) costs seconds. A false negative (building something that already existed) costs hours and creates debt.
Do not validate a direction if you have a grounded objection. Do not say "good idea" before verifying it is a good idea. If you spot a problem, say so — clearly, factually, without softening. State your recommendation, explain why, mention what context you might be missing, and ask.
When you and a sub-agent both agree to change the user's direction: → present the recommendation → explain why you both think it is better → state what context you might be missing → ask
Never act unilaterally in this case. The decision belongs to the user.
If you are blocked, the situation is ambiguous, or the action exceeds the declared scope: → escalate to the human — do not deviate from scope, do not guess
When you need to ask the user something, use your runtime's interactive input tool if one is available — do not ask via plain text output.
Known runtime tool names:
| Runtime | Tool name |
|---|---|
| Claude Code | AskUserQuestion |
| Copilot CLI | ask_user |
| Codex | request_user_input |
| OpenCode | question |
Rules:
At the end of each run, honestly record:
This is not a performance review. It is cross-run memory.
Format: see skills-meta/friction.jsonl.
If your skill's phase: frontmatter field is non-null (i.e. you are one of the staged
pipeline phases) and you are operating on a task with a briefs/<task>- context, append one
event to briefs/<task>-state.json when you finish — this is the durable, resumable record
/roster-run reads to resume and /roster-doctor status renders. Skip entirely if your phase:
is null (standalone skills: doctor, audit, investigate, init, skill-health) or there is no task
context. Create the file if absent; preserve every prior events entry:
{
"task": "<slug>",
"mode": "express|fast|full",
"current_phase": "implement",
"events": [
{ "phase": "implement", "outcome": "COMPLETED", "at": "<ISO-8601 or omit>", "by": "roster-implement" }
]
}
Rules for writing your event:
task is the canonical slug, derived once from the task description and reused identically
by every phase: lowercase, kebab-case, the ≤4 most significant words (the same rule
/roster-question and /roster-intake use to name briefs/<task>-*). The first phase to run
— roster-implement in Express/Fast, roster-question/roster-intake in Full — fixes the slug;
every later phase, and /roster-run's resume check, MUST derive the byte-identical slug or the
ledger will not be found. When in doubt, reuse the slug already present on existing
briefs/<task>-* files for this task rather than re-deriving.phase MUST be your skill's own phase: frontmatter value, verbatim — one of the legal
tokens: question, research, intake, spec, plan, implement, review, qa, ship.
Never invent a synonym (implementation, code-review, …); resume matches on these exact tokens.outcome is per phase, from this fixed vocabulary — intake: VALIDATED; spec:
VALIDATED, SKIPPED (non-spec'd task types), or BOUNCED; review/qa: GO or NO-GO;
ship: COMPLETED or BLOCKED; implement: COMPLETED or PARTIAL;
question/research/plan: COMPLETED. Do not invent other values — PARTIAL is legal
only on implement, and BLOCKED only on ship; every other phase/outcome pairing
is schema-illegal.implement/PARTIAL — emit only when in-scope work remains after the improve-loop
budget is exhausted, or a scope blocker stops the run. Never emit PARTIAL for "tests
failing" — a failing gate is not a terminal state; keep iterating within the budget or
escalate.ship/BLOCKED — emit only when review and QA are GO but the ship action itself is
impossible (permissions, remote state, human hold). A NO-GO gate is not BLOCKED.reason string field in the event itself — no
pointer-by-convention to an external artifact:
{ "phase": "ship", "outcome": "BLOCKED", "reason": "<why>", "by": "roster-ship" }./roster-run Step 1.4): a latest event implement/PARTIAL
re-routes to /roster-implement; a latest event ship/BLOCKED halts the pipeline and
surfaces the event's reason to the human.implement/review pair; that
repetition is the history, not a bug. Set current_phase to your phase (the latest completed).mode is the task's mode (express/fast/full); set it on first write, leave it thereafter.at if your runtime can produce one; otherwise omit the field. by is your
skill name (or human-gate for a gate decision).TASK environment variable — export it when invoking
hooks manually.Pair: use /improvement-loop-planner first if you don't have a loop spec yet — it will propose and format the spec. Then pass the approved spec as $ARGUMENTS here.
Execute a bounded self-improvement loop using a user-approved loop spec supplied in $ARGUMENTS.
This skill is for controlled iterative improvement, not open-ended autonomy.
Before doing any work, extract or confirm:
Objective:Writable scope:Metric:Verify:Max iterations:Optional:
Read-only context:Guard:Keep rule:Discard rule:KB basis:If any required field is missing or too vague to execute safely, stop and ask the user to complete the loop spec.
If Max iterations is a range (e.g. 3-5), stop and ask the user to pick a specific integer before proceeding.
Example accepted spec:
Objective: Reduce flaky auth test failures to zero
Writable scope: tests/auth/**, src/auth/**
Read-only context: kb/spec.md, kb/properties.md, docs/auth.md
Metric: auth test suite passes with zero flakes
Verify: pytest tests/auth -q
Guard: pytest -q
Max iterations: 4
Keep rule: keep if flake count strictly decreases and guard passes
Discard rule: revert if flake count stays the same or increases, or if guard fails
KB basis: kb/spec.md auth requirements, kb/properties.md reliability rules
AGENTS.md, README.md, and any relevant project instructionskb/ exists and the loop references KB, read the referenced KB files firstimprovement/ is listed in .gitignore; if not, add it before creating any log filesimprovement/<date>-<slug>/results.tsv
Use tab-separated columns:
iteration status metric verify guard note
Log baseline as iteration 0.
If the verify command is broken in a way that prevents comparison, stop and report that the loop cannot run safely.
Run exactly Max iterations iterations unless:
For each iteration:
VerifyGuard if providedresults.tsvKeep rule and Discard rule if provided; they override the defaults belowAt the end, report:
At the end of each run, append to skills-meta/friction.jsonl :
{
"date": "<ISO-8601>",
"skill": "improvement-loop",
"task": "<task-slug or short description>",
"frictions": [],
"methods": [],
"suggestion_type": null,
"suggestion": null,
"effort_estimate": null
}
| Condition | Action |
|---|---|
| Required loop spec fields are missing | Stop — return to /improvement-loop-planner to produce a complete spec |
| Baseline verify command is broken | Stop — cannot compare; report to human before any changes |
| Guard fails at baseline (before any iteration) | Stop — the guard must pass at baseline or the loop is unsafe |
Primary path: after the loop completes with objective met → human decides whether to commit changes and open a PR.
If spec was incomplete or no signal existed: return to /improvement-loop-planner.