$npx -y skills add muratcankoylan/Agent-Skills-for-Context-Engineering --skill self-improvement-loopsThis skill should be used when the harness, scaffold, workflow, or optimizer itself is the optimization target: recursive self-improvement (RSI) loops, meta-harnesses, self-improving harnesses that mine their own failures and propose bounded edits, evolutionary or population-base
| 1 | # Self-Improvement Loops |
| 2 | |
| 3 | This skill covers systems where the harness is the artifact being optimized: an agent mines its own failures and edits its own scaffold, a meta-agent searches over harness code, a population of workflow candidates evolves against an evaluator, or the mechanism that produces context is itself versioned and improved. The design question shifts from "how do I control one loop" (harness-engineering) to "how do I let a loop rewrite parts of itself without corrupting the signal that steers it". |
| 4 | |
| 5 | The controlling constraint across every published system: the loop optimizes whatever signal it is given, including the signal's own weaknesses. Design the loop assuming the optimizer will find every gap between the metric and the intent. |
| 6 | |
| 7 | ## When to Activate |
| 8 | |
| 9 | Activate this skill when: |
| 10 | |
| 11 | - Building a loop where an agent proposes edits to its own harness, prompts, context playbook, or workflow based on mined failure patterns |
| 12 | - Designing meta-level search over harness or scaffold code: meta-agent search, tree search over workflow graphs, evolutionary program search with an LLM mutation operator |
| 13 | - Choosing acceptance criteria for any self-modifying agent system |
| 14 | - Evolving the mechanism that manages context (a skill, playbook, or context function) rather than hand-editing the context artifact |
| 15 | - Diagnosing a degenerating self-improvement loop: reward hacking, diversity collapse, context collapse, or silent stagnation |
| 16 | - Deciding which level of the optimization ladder (prompt, context, workflow, harness code, optimizer code) a recurring failure should be fixed at |
| 17 | |
| 18 | Do not activate this skill for adjacent work owned by other skills: |
| 19 | |
| 20 | - Governance of a single autonomous loop that does not modify itself: locked and editable surfaces, durable logs, rollback, novelty gates, PR preparation, and human approval boundaries belong to `harness-engineering`. That skill defines the control surfaces; this skill defines what happens when the surfaces themselves become the optimization target. |
| 21 | - Building the evaluator, regression suite, or quality gates that score candidates: `evaluation`. |
| 22 | - LLM-as-judge design, pairwise comparison, and bias mitigation for candidate scoring: `advanced-evaluation`. |
| 23 | - One-shot token efficiency, masking, or caching without an improvement loop: `context-optimization`. |
| 24 | - Remote sandboxes and background execution infrastructure for running the loop: `hosted-agents`. |
| 25 | - Whether to build the loop at all, pipeline shape, and cost estimation: `project-development`. |
| 26 | |
| 27 | ## Core Concepts |
| 28 | |
| 29 | ### The Optimization Ladder |
| 30 | |
| 31 | Published self-improvement systems target progressively deeper objects: |
| 32 | |
| 33 | | Rung | Optimized object | Example systems | |
| 34 | | --- | --- | --- | |
| 35 | | 1 | Instruction prompts | Promptbreeder, GEPA | |
| 36 | | 2 | Structured context | ACE (playbook of itemized bullets) | |
| 37 | | 3 | Context mechanism | MCE (the skill that produces context) | |
| 38 | | 4 | Workflow graph | ADAS, AFlow | |
| 39 | | 5 | Harness code | Self-Harness (bounded self-edits), Meta-Harness, Darwin Godel Machine | |
| 40 | | 6 | Optimizer code | STOP (the improver improves the improver) | |
| 41 | |
| 42 | Each rung up buys a larger design space and more leverage, and costs more per evaluation with a larger surface for gaming. Fix a recurring failure at the lowest rung that can express the fix. A stale-library failure is a context fix, not a workflow rewrite. Only move up when failure clusters at the current rung persist across candidates. |
| 43 | |
| 44 | ### The Loop Is Not the Intelligence |
| 45 | |
| 46 | Recursive structure amplifies base-model quality in both directions. The same recursive improver design that compounds gains with a strong model degrades mean performance across iterations with weaker models (claim-self-improvement-capability-threshold). Two implications: |
| 47 | |
| 48 | 1. Run a capability validation before enabling recursion: a fixed number of iterations on a held-out task set, with the loop counted as net-negative if the trajectory declines. |
| 49 | 2. Detect the degenerate stagnation mode. A broken improver that silently returns its input unchanged looks like stability in aggregate metrics. Track edit diffs, not only scores. |
| 50 | |
| 51 | ### The Outside-the-Loop Invariant |
| 52 | |
| 53 | The evaluator, its instrumentation, permission control, and budget enforcem |