Autoany — EGRI Skill
Turn ambiguous user goals into safe, measurable, rollback-capable recursive improvement systems.
Core Principle
Do not grant an agent more mutation freedom than your evaluator can reliably judge.
Operating Procedure
Phase 1: Problem Compilation
Extract from the user's goal:
- Objective — metric(s) to optimize (scalar or vector)
- Hard constraints — what must never be violated (memory, latency, cost, compliance)
- Mutable artifacts — what the loop may change (the
train.py equivalent)
- Immutable artifacts — what stays fixed (the
prepare.py equivalent)
- Evaluator — how to score candidates reliably enough to compare them
- Execution backend — where candidates run (local, container, simulator, API)
- Budget — time, tokens, money, or trial count per candidate
- Promotion policy — keep-if-improves, Pareto, threshold, human-gate
- Autonomy mode — suggestion, sandbox, auto-promote, or portfolio
Produce a problem-spec.yaml. See assets/problem-spec.template.yaml for the schema and references/PROBLEM-SPEC.md for field-by-field semantics.
Phase 2: Evaluator-First Design
Before touching the mutable artifact:
- Define the evaluator — what it measures, how it scores, what thresholds matter
- Build or identify the benchmark / replay set / test suite
- Establish baseline score by running the current artifact through the evaluator
- Confirm the evaluator is trusted — if not, fix it before proceeding
Law: The evaluator must exist and produce a baseline score before any mutation begins.
Phase 3: Harness Construction
Build the immutable execution shell:
- Execution script — runs the candidate artifact deterministically
- Scoring script — invokes the evaluator, outputs structured results
- Constraint checker — rejects candidates violating hard constraints
- Rollback mechanism — restores previous state on failure or rejection
- Telemetry — logs trial metadata (duration, resource use, errors)
- Ledger — append-only record of all trials (see
assets/ledger.schema.json)
Phase 4: Mutation Surface Definition
- Identify artifact type (code, config, prompt, graph, parameters)
- Define mutation operators (edit, replace, compose, parameterize, restructure)
- Start with the smallest viable mutation surface — expand only after baseline is stable
- Mark everything else as immutable
Phase 5: Loop Execution
x_t = current best artifact state
while budget remains:
m = propose_mutation(x_t, ledger, strategy)
x' = apply(m, x_t)
result = execute(x', harness)
score = evaluate(result)
if violates_constraints(result): discard(x'), log("rejected")
elif promotion_policy(score, x_t_score): promote(x'), x_t = x'
else: discard(x'), log("no improvement")
record(ledger, trial_metadata)
Phase 6: Ledger Review and Strategy Distillation
After each batch of trials:
- Review ledger for patterns (what helped, what failed, what is exhausted)
- Induce reusable abstractions ("depth increases hurt under this budget")
- Update search strategy based on accumulated evidence
- Decide: continue, branch, simplify, or escalate to human
Autonomy Modes
| Mode |
Mutate |
Execute |
Promote |
When to use |
| Suggestion |
Propose only |
No |
No |
Evaluator untrusted or high-risk domain |
| Sandbox |
Yes |
Yes |
No |
Evaluator exists but promotion needs human review |
| Auto-promote |
Yes |
Yes |
Yes |
Strong evaluator, bounded damage, clear constraints |
| Portfolio |
Yes |
Yes |
Yes |
Multiple loops, budget allocation across subproblems |
Default to sandbox. Escalate only with explicit user approval.
Safety Rules
- Never mutate evaluator and artifact in the same trial
- Never promote without constraint checks passing
- Never exceed budget — fail closed, not open
- Always maintain rollback capability to last promoted state
- Log every trial, including failures and rejections
- If evaluator is suspected gamed, halt and escalate
Domain Adaptation
Read references/DOMAIN-MAPPINGS.md for concrete artifact/harness/evaluator choices per domain.
Formal Model
Read references/REFERENCE.md for full EGRI formal model: Π = (X, M, H, E, J, C, B, P, L).
Nested Loops and Meta-Optimization
Read references/META-LOOP.md for Level 1-3 loops (policy, portfolio, org).
Scaffold Initialization
python3 scripts/autoany_init.py <project-name> --domain <code|rag|workflow|etl|ui|generic> --path <output-dir>
1---2name: autoany-23description: Evaluator-Governed Recursive Improvement (EGRI) framework for turning ambiguous goals into safe, measurable, rollback-capable recursive improvement systems. Use when the user wants to: (1) build a self-improving system for any domain (ML, RAG, workflows, ETL, UI, compiler tuning, etc.), (2) formalize a vague optimization goal into a bounded loop with evaluator, harness, and promotion policy, (3) create an autoresearch-style system beyond ML training, (4) design a mutable-artifact + immutable-evaluator architecture, (5) scaffold a problem-spec for recursive improvement, (6) turn "make X better" into a safe, auditable optimization process. Triggers on: "self-improving", "autoresearch", "autoany", "EGRI", "recursive improvement", "optimization loop", "evaluator-governed", "harness + evaluator", "mutable artifact", "problem compiler", "benchmark loop", "mutation surface".4---56# Autoany — EGRI Skill78Turn ambiguous user goals into safe, measurable, rollback-capable recursive improvement systems.910## Core Principle1112> Do not grant an agent more mutation freedom than your evaluator can reliably judge.1314## Operating Procedure1516### Phase 1: Problem Compilation1718Extract from the user's goal:19201. **Objective** — metric(s) to optimize (scalar or vector)212. **Hard constraints** — what must never be violated (memory, latency, cost, compliance)223. **Mutable artifacts** — what the loop may change (the `train.py` equivalent)234. **Immutable artifacts** — what stays fixed (the `prepare.py` equivalent)245. **Evaluator** — how to score candidates reliably enough to compare them256. **Execution backend** — where candidates run (local, container, simulator, API)267. **Budget** — time, tokens, money, or trial count per candidate278. **Promotion policy** — keep-if-improves, Pareto, threshold, human-gate289. **Autonomy mode** — suggestion, sandbox, auto-promote, or portfolio2930Produce a `problem-spec.yaml`. See `assets/problem-spec.template.yaml` for the schema and `references/PROBLEM-SPEC.md` for field-by-field semantics.3132### Phase 2: Evaluator-First Design3334Before touching the mutable artifact:35361. Define the evaluator — what it measures, how it scores, what thresholds matter372. Build or identify the benchmark / replay set / test suite383. Establish baseline score by running the current artifact through the evaluator394. Confirm the evaluator is trusted — if not, fix it before proceeding4041**Law:** The evaluator must exist and produce a baseline score before any mutation begins.4243### Phase 3: Harness Construction4445Build the immutable execution shell:46471. **Execution script** — runs the candidate artifact deterministically482. **Scoring script** — invokes the evaluator, outputs structured results493. **Constraint checker** — rejects candidates violating hard constraints504. **Rollback mechanism** — restores previous state on failure or rejection515. **Telemetry** — logs trial metadata (duration, resource use, errors)526. **Ledger** — append-only record of all trials (see `assets/ledger.schema.json`)5354### Phase 4: Mutation Surface Definition55561. Identify artifact type (code, config, prompt, graph, parameters)572. Define mutation operators (edit, replace, compose, parameterize, restructure)583. Start with the **smallest viable mutation surface** — expand only after baseline is stable594. Mark everything else as immutable6061### Phase 5: Loop Execution6263```64x_t = current best artifact state65while budget remains:66 m = propose_mutation(x_t, ledger, strategy)67 x' = apply(m, x_t)68 result = execute(x', harness)69 score = evaluate(result)70 if violates_constraints(result): discard(x'), log("rejected")71 elif promotion_policy(score, x_t_score): promote(x'), x_t = x'72 else: discard(x'), log("no improvement")73 record(ledger, trial_metadata)74```7576### Phase 6: Ledger Review and Strategy Distillation7778After each batch of trials:79801. Review ledger for patterns (what helped, what failed, what is exhausted)812. Induce reusable abstractions ("depth increases hurt under this budget")823. Update search strategy based on accumulated evidence834. Decide: continue, branch, simplify, or escalate to human8485## Autonomy Modes8687| Mode | Mutate | Execute | Promote | When to use |88|------|--------|---------|---------|-------------|89| **Suggestion** | Propose only | No | No | Evaluator untrusted or high-risk domain |90| **Sandbox** | Yes | Yes | No | Evaluator exists but promotion needs human review |91| **Auto-promote** | Yes | Yes | Yes | Strong evaluator, bounded damage, clear constraints |92| **Portfolio** | Yes | Yes | Yes | Multiple loops, budget allocation across subproblems |9394Default to **sandbox**. Escalate only with explicit user approval.9596## Safety Rules97981. Never mutate evaluator and artifact in the same trial992. Never promote without constraint checks passing1003. Never exceed budget — fail closed, not open1014. Always maintain rollback capability to last promoted state1025. Log every trial, including failures and rejections1036. If evaluator is suspected gamed, halt and escalate104105## Domain Adaptation106107Read `references/DOMAIN-MAPPINGS.md` for concrete artifact/harness/evaluator choices per domain.108109## Formal Model110111Read `references/REFERENCE.md` for full EGRI formal model: Π = (X, M, H, E, J, C, B, P, L).112113## Nested Loops and Meta-Optimization114115Read `references/META-LOOP.md` for Level 1-3 loops (policy, portfolio, org).116117## Scaffold Initialization118119```bash120python3 scripts/autoany_init.py <project-name> --domain <code|rag|workflow|etl|ui|generic> --path <output-dir>121```