self-improvement-loops

Designs self-modifying agent loops that mine failures and evolve harnesses under acceptance gates.

17.9k|1.5k|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering --skill self-improvement-loops
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: self-improvement-loops
Source: https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/skills/self-improvement-loops
Command: npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering --skill self-improvement-loops

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Building agents that rewrite their own prompts, context, workflows, or harness code often ends in reward hacking, diversity collapse, or silent stagnation. This Skill provides the design patterns, acceptance gates, and failure-mode catalog needed to let a loop safely optimize itself without corrupting the signal that steers it.

Core Features & Use Cases

  • Optimization Ladder Guidance: Route recurring failures to the right rung, from prompt edits and structured context playbooks up to workflow graphs, harness code, and optimizer code.
  • Acceptance Gate Design: Implement two-split (held-in plus held-out) no-regression gates, runtime-enforced constraints, and evaluator isolation so self-modifications are accepted only on measured evidence.
  • Failure-Mode Diagnosis: Detect and fix reward hacking, context collapse, brevity bias, diversity collapse, and degenerate stagnation using documented incidents from Self-Harness, Meta-Harness, ACE, DGM, AlphaEvolve, and STOP.
  • Use Case: You are building a meta-agent that searches over harness code for a coding benchmark. Use this Skill to structure the filesystem experience archive, hide the scorer from the proposer, and gate candidate merges on held-out regression checks.

Quick Start

Ask the agent to design a self-improvement loop where a coding agent mines its own failed traces and proposes bounded edits to its harness, with a two-split acceptance gate and a filesystem archive of candidates.

Frequently Asked Questions about self-improvement-loops

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an agent that improves its own harness?

Use a three-stage loop: mine failed traces into clustered weakness signatures, generate bounded proposals touching one editable surface each, and validate with a two-split acceptance gate. Keep the evaluator, permissions, and budgets outside any surface the loop can modify.

What acceptance criteria should a self-modifying agent use?

Accept a candidate only when it does not regress on either a held-in split or a held-out split the proposer never sees, and strictly improves on at least one, under repeated evaluation. Reject candidates that trade one split against the other even when the sum improves.

How do I prevent reward hacking in self-improvement loops?

Hide the scoring implementation from the proposer and expose only scores and traces, since visible evaluators get monkey-patched or overwritten. Enforce budgets and sandboxing at the runtime or OS level, and count any detected exploit as a failed candidate rather than a high score.

Why does my self-improvement loop stop improving over time?

Common causes are diversity collapse from hill-climbing only the latest candidate, and degenerate improvers that silently return their input unchanged. Keep an archive of all viable candidates, discount parent selection by offspring count, and alarm on empty diffs rather than only score drops.

When should I not use a recursive self-improvement loop?

Avoid it when no fast, deterministic, automatable evaluator exists, or when the base model fails a capability validation on the task family, since recursion amplifies weak models downward. Single-loop governance, one-shot context optimization, and judge design belong to adjacent skills instead.

What is context collapse in agentic context engineering?

Context collapse occurs when a model monolithically rewrites its accumulated playbook, shrinking it drastically and dropping accuracy below the no-adaptation baseline. The fix is itemized entries with stable identifiers, incremental deltas merged by deterministic non-model logic, and embedding-based deduplication.