Autonomous iterative optimization loop — run N iterations against a mechanical metric, learn from git history, auto-keep/discard changes. Use for improving measurable metrics (coverage, performance, bundle size, etc.) through repeated experimentation.
Instrucciones de origen · Vista previa de solo lectura
name
ak:loop
description
Autonomous iterative optimization loop — run N iterations against a mechanical metric, learn from git history, auto-keep/discard changes. Use for improving measurable metrics (coverage, performance, bundle size, etc.) through repeated experimentation.
user-invocable
true
disable-model-invocation
true
when_to_use
Invoke only when an objective metric can drive repeated trials.
category
utilities
keywords
["optimization","iteration","metrics","loop"]
argument-hint
[Goal/Metric description] or inline config block
metadata
{"author":"agentkit","attribution":"Core patterns adapted from autoresearch by Udit Goenka (MIT)","license":"MIT","version":"1.1.0"}
ak:loop — Autonomous Optimization Loop
Constraint + Mechanical Metric + Fast Verification = Autonomous Improvement
Tolerance for metric variance: low / medium / high
Min-Delta
0
Minimum improvement to count as progress
Direction
higher
Whether higher or lower metric value is better
Interactive Setup
When required fields are missing, ask all at once:
ask_user capability({
questions: [
{ question: "What metric do you want to improve? (e.g. 'test coverage in src/utils')", field: "Goal" },
{ question: "Which files may be edited? (glob, e.g. 'src/utils/**/*.ts')", field: "Scope" },
{ question: "Verify command — must print a single number to stdout", field: "Verify" },
{ question: "Guard command for regression check? (optional, press Enter to skip)", field: "Guard" }
]
})
reference the var name only: $DATABASE_URL, never the value
Private keys, certs
first 8 chars + <...REDACTED...> + last 8 chars
When a reproduction command needs real credentials, write it as a template the user fills in — never copy-paste-ready with a live secret. Reject any output containing a JWT (eyJ...), 32+ char hex, AWS key prefixes (AKIA, ASIA), or other known token formats. Re-mask and re-emit.
Limitations (Honest)
Cannot optimize subjective or aesthetic goals
Cannot modify files outside the declared Scope
Cannot modify files referenced by the Guard command
Cannot guarantee improvement — some metrics have hard ceilings
Requires a git repository with a clean working tree before starting
Verify command must complete in < 30 seconds (otherwise loop is impractical)
Does not parallelize iterations — sequential by design (each iteration learns from the last)