Production-grade autonomous optimization for AI agent skills, code, docs & entire repos.
Mathematical convergence Β· Multi-model cross-validation Β· Regression guards Β· Live Unicode reporting
Most "self-improving agent" approaches boil down to "reflect on your output." That's a vibe check, not optimization. AutoForge is different.
| Typical "Reflect" | AutoForge | |
|---|---|---|
| When to stop | "Looks good to me" | 3Γ 100% pass, 5Γ retained, or 3Γ discard |
| Progress | Chat history | TSV with pass rates & diffs per iteration |
| Validation | Same model checks itself | Multi-model blind cross-validation |
| Reporting | Final summary | Live Unicode bars + dashboard after every iteration |
| Regressions | "Oops, broke something" | Regression guard with individual eval tracking |
| Modes | One generic loop | 7 specialized modes |
| Patches | Full rewrite per iteration | Incremental patches (max 30% per iter) |
| Track record | Demo | 50+ iterations across 6 production skills |
βββββββββββββββββββββββ
β Define target + β
β evals β
βββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Baseline scan β
β (Iteration 1) β
βββββββββββ¬ββββββββββββ
β
ββββββββββββββββ
β
βΌ
βββββββββββββββββ proposed βββββββββββββββββ
ββββΆβ Optimizer ββββββββββββββββββΆβ Validator β
β β (Claude Opus)β β (GPT-5) β
β βββββββββββββββββ βββββββββ¬ββββββββ
β β
β βββββββββββββββββ΄ββββββββββββββββ
β β β
β βΌ βΌ
β βββββββββββββββ βββββββββββββββ
β β β
improved β β β discarded β
β ββββββββ¬βββββββ ββββββββ¬βββββββ
β β β
β βΌ βΌ
β βββββββββββββββ ββββββββββββββββ
β β Regression β β Log finding β
β β Guard β β β for retry β
β ββββββββ¬βββββββ ββββββββββββββββ
β β
β βΌ
β βββββββββββββββββββ
β β Log to TSV β
β β + report.sh β
β β + findings.md β
β ββββββββ¬βββββββββββ
β β
β βΌ
β ββββββββββββββββ
β No β Converged? β
βββββββββββββββββββ€ β
ββββββββ¬ββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββ ββββββββββββββββ βββββββββββββ
β 3Γ 100% β
β β 5Γ retained β β 3Γ discardβ
β Deploy! β β Converged β β Stop β οΈ β
βββββββββββββββ ββββββββββββββββ βββββββββββββ
β
βΌ
ββββββββββββββββββββ
β report --final β
β + summary.sh β
β + visualize.py β
ββββββββββββββββββββ
Iter 1 (Optimizer) Iter 2 (Validator) Iter 3 (Optimizer)
βββββββββββββββββ ββββββββββββββββββ βββββββββββββββββ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Claude Opus β β GPT-5 β β Claude Opus β
β β β β β β
β Analyze β β Blind review β β Fix findings β
β Find issues β β of output β β from GPT-5 β
β Write fixes β β (no context) β β β
ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ
β β β
βΌ βΌ βΌ
pass_rate: 62% pass_rate: 78% pass_rate: 95%
status: improved status: improved status: improved
βββββββ TSV ββββββββββββββββ TSV ββββββββββββββββ TSV βββββββ
Different model validates β no "grading your own homework" blind spot
Best state: evals Aβ
Bβ
Cβ
Dβ
Eβ (80%)
New iteration: Aβ
Bβ
Cβ
Dβ Eβ
(80%)
β² β²
was passing now passing
now failing was failing
Total rate: same (80%)
But D regressed! β status: regression β revert β log finding
optimize βββΆ test βββΆ findings.md βββΆ optimize βββΆ test βββΆ ...
Round 1: 3 findings (stale flag, wrong path, missing example)
Round 2: 2 resolved, 1 new finding (edge case)
Round 3: All resolved β clean convergence
Safety: maxFindingsLoops (default: 3) prevents infinite cycles
Phase 1 Phase 2 Phase 3
SCAN & PLAN CROSS-FILE ANALYSIS ITERATIVE FIX LOOP
βββββββββββββ βββββββββββββββββββ ββββββββββββββββββ
ββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββ
β Walk repo β β README β CLI β βββββΆβ Surgical fix β
β tree β β Dockerfile β depsβ β β across files β
β ββββββββββββΆβ CI β scripts βββββΆβ ββββββββ¬ββββββββ
β Build file β β .env β code refs β β β
β priority map β β imports β reqs β β βΌ
ββββββββββββββββ β .gitignore β out β β ββββββββββββββββ
ββββββββββββββββββββ β β Validate β
β β consistency β
β ββββββββ¬ββββββββ
β β
β Not β Done?
ββββ yet ββββ
Install
# Via ClawHub
clawhub install autoforge
# Or clone
git clone https://github.com/akrimm702/autoforge.git
cp -r autoforge ~/.openclaw/workspace/skills/autoforgeConfigure reporting (optional)
export AF_CHANNEL="telegram" # telegram | discord | slack
export AF_CHAT_ID="-100XXXXXXXXXX" # chat/group ID
export AF_TOPIC_ID="1234" # thread ID (optional)No env vars? Reports print to stdout with ANSI colors.
Tell your agent
Start autoforge mode: prompt for the coding-agent skill.
Evals: PTY handling correct? Workspace protection enforced? Clear structure?
The agent reads the skill, runs the loop, tracks everything in TSV, reports live, and stops when convergence math says it's done.
Simulates 5 realistic scenarios per iteration, evaluates Yes/No against defined evals, calculates pass rate mathematically. No code execution.
Best for: SKILL.md files, prompt engineering, documentation, briefing templates.
Runs code in a sandbox, measures exit codes, stdout, stderr, runtime. Evaluates against concrete test criteria.
Best for: Shell scripts, Python tools, data pipelines, build systems.
Tests documented commands against actual CLI behavior (--help, read-only). Catches docs-vs-reality drift. Two variants: Simple (2 iterations) or Deep (iterative with multi-model).
Best for: Verifying skill documentation matches real CLI behavior.
Scans an entire repo, builds a file-map with priorities, runs cross-file consistency checks, and iteratively fixes issues across multiple files.
Best for: README β CLI drift, Dockerfile β dependency mismatches, CI β project structure gaps.
Cross-file checks include:
- README documents what the CLI actually does
- Dockerfile installs the right dependency versions
- CI workflows reference correct paths and scripts
.env.examplecovers all env vars used in code- Every import has a matching dependency declaration
.gitignoreexcludes build artifacts and secrets
Live tests against real tools and APIs β not mocked, not simulated. All evals are live category (99%+ confidence weight).
Best for: Integration testing, API validation, webhook verification, deployment checks.
Safety: NEVER destructive commands without --dry-run, ALWAYS timeouts, max 10 API calls/iteration.
Analyzes real session logs, memory files, and cron run history to find behavioral patterns β repeated mistakes, slow responses, user corrections, missing proactivity, style mismatches, tool misuse.
Best for: Improving agent behavior from real usage data.
After each iteration, report.sh sends live updates:
π AutoForge: coding-agent
π Iter 1 ββββββββββββββββββββ 45% baseline
β
Iter 2 ββββββββββββββββββββ 62% improved
β
Iter 3 ββββββββββββββββββββ 78% improved
β
Iter 4 ββββββββββββββββββββ 85% improved
β οΈ Iter 5 ββββββββββββββββββββ 82% regression β reverted
β
Iter 6 ββββββββββββββββββββ 90% improved
β
Iter 7 ββββββββββββββββββββ 92% retained
β
Iter 8 ββββββββββββββββββββ 95% improved
β
Iter 9 ββββββββββββββββββββ 100% improved
β
Iter 10 ββββββββββββββββββββ 100% improved
ββββββββββββββββββββββ
Iterations: 10 β
Keep: 8 β Discard: 0 β οΈ Regression: 1 β‘οΈ Retained: 1
π Best: 100% (Iter 9) π Ξ +55pp
π Findings: 3 found, 3 resolved
β
Loop converged β 2Γ 100% confirmed
π AutoForge Dashboard: coding-agent
βββββββββββββββββββββββββββββββββββ
π Velocity: 5.5 pp/iter (strong)
β‘ Efficiency: 80% keep rate
π― Convergence: 95% confidence
β±οΈ Runtime: 12m 34s (10 iterations)
π¬ Eval Breakdown:
Structural (S): 100% ββββββββββββββββββββ
Simulated (M): 95% ββββββββββββββββββββ
Live (L): 100% ββββββββββββββββββββ
π Validators: claude:100% / gpt:98%
Every iteration logged in machine-readable TSV:
iteration summary pass_rate change status confidence blast validators
1 Baseline 45% Original baseline S:45%/M:40% - -
2 Add subcommands 62% 16 commands added improved S:80%/M:50% +16/-0 claude:62%
...
10 Final validation 100% All checks green improved S:100%/M:100% +2/-0 claude:100%/gpt:98%
No vibes. No "looks good." Mathematical stop conditions:
| Condition | Rule | Purpose |
|---|---|---|
| β¬οΈ Minimum iters | Must reach N before any stop | Prevents premature convergence |
| π Max 30 iters | Hard safety cap | Cost protection |
| β 3Γ discard streak | Stop + analyze | Detects structural problems |
| β 3Γ regression streak | Stop + analyze | Detects fundamental issues |
| β 3Γ 100% pass | Confirmed perfect | After minimum reached |
| β‘οΈ 5Γ retained streak | Fully converged | No further improvement possible |
Multi-model convergence: When validators are configured, convergence requires ALL validators β₯ threshold. A single validator below threshold blocks convergence.
Validator noise detection: In multi-model setups, validators can produce false positives. AutoForge recognizes config/path confusion, inverted checks, normal English flagged as forbidden references, and over-counting. After all real fixes, if >3 discards stem from non-reproducible complaints β declare convergence.
Unlike simple pass-rate tracking, AutoForge tracks every individual eval across iterations:
- After baseline, store all individually passing evals as the "guard set"
- On each iteration, check ALL evals β not just total pass rate
- If total rate improves BUT a guard eval now fails β
regression - Revert to best state, log the regression as a finding for future iterations
- Findings feed back into the loop β no information is lost
This catches the classic "fix one thing, break another" failure mode that total pass rate alone misses.
For complex audits, split optimizer and validator across different models:
| Role | Example Models | Task |
|---|---|---|
| Optimizer | Claude Opus, GPT-4.1 | Finds issues, writes fixes |
| Validator | GPT-5, Gemini | Checks against ground truth independently |
The validator doesn't see the optimizer's reasoning β just the output. This prevents the "same model validates its own work" blind spot.
| Category | Confidence | Weight | When used |
|---|---|---|---|
structural (S) |
High (95%+) | 1.0Γ | Static analysis, format checks |
simulated (M) |
Medium (70-90%) | 1.5Γ | Mental simulation, hypothetical |
live (L) |
Highest (99%+) | 2.0Γ | Actually executed and measured |
Weighted pass rate: Ξ£(passing Γ weight) / Ξ£(all Γ weight) Γ 100
prompt = simulated Β· code/e2e = live Β· audit/project = mixed
Production runs, not demos.
coding-agent SKILL.md β 553 lines rewritten across 10 iterations. 16 Codex subcommands + 40 Claude CLI flags documented. 45% β 100%. Discovered --yolo was never a real flag.
ACP Router β 90% β 100% in 9 iterations. Agent coverage doubled from 6 to 12 harnesses. Thread spawn recovery policy written from scratch.
Sub-Agents Documentation β 70% β 100% in 14 iterations with multi-model validation. 6 real bugs found in upstream docs. Identified 4 categories of validator false positives.
backup.sh β Added rsync support, validation checks, restore-test. Code mode with sandboxed test runs. 3 iterations to stable, 2 more to polish.
AutoForge on itself π€― β Self-forged in project mode: 67% β 100% in 8 iterations. Fixed 2 script bugs, cleaned config/doc inconsistencies across 7 files.
| Variable | Default | Description |
|---|---|---|
AF_CHANNEL |
telegram |
Report delivery channel |
AF_CHAT_ID |
(none) | Chat/group ID. Unset = stdout |
AF_TOPIC_ID |
(none) | Thread/topic ID |
{
"mode": "e2e",
"target": "./my-skill/SKILL.md",
"validators": ["anthropic/claude-sonnet-4", "openai/gpt-4.1"],
"convergenceThreshold": 95,
"regressionThreshold": 5,
"maxFindingsLoops": 3,
"evalCategories": true,
"incrementalPatches": true
}All config fields are optional. Without them, classic single-model mode.
| Flag | Behavior |
|---|---|
--dry-run (default) |
Only TSV + proposed files. Target unchanged. |
--live |
Overwrites target. Auto-backup to results/backups/. |
--resume |
Continue from existing TSV. |
autoforge/
βββ SKILL.md β OpenClaw skill definition (the brain)
βββ README.md β You are here
βββ LICENSE β MIT
βββ .gitignore
βββ scripts/
β βββ report.sh β Live reporting (dashboard, trends, JSON)
β βββ summary.sh β Markdown summary generator
β βββ visualize.py β PNG progress charts + multi-run comparison
βββ references/
β βββ eval-examples.md β Pre-built evals by category
β βββ ml-mode.md β ML training integration guide
βββ examples/
β βββ demo-config.json β Example run configurations
βββ results/ β Your run data (gitignored)
βββ .gitkeep
- Fork β feature branch β PR
- Run
shellcheck scripts/report.shandpython3 -m py_compile scripts/visualize.py - Include real-world results from your own runs if possible
Good contributions: new eval templates, additional channel support, bug fixes with repro steps, production run case studies.
MIT β see LICENSE.
Built by Alexander Krimm.
Battle-tested across 50+ iterations on 6 production skills.
Stop reflecting. Start forging. π¨