hyperagent
FreeRuns bundled scriptsNot checkedRun a self-referential self-improving agent loop where a meta-agent iteratively modifies a task-agent's code to optimize for any measurable target. Based on…
by ckorhonen★ 35 GitHub starsAbout this skill
Hyperagent
Quick Start — Simple Examples
New to Hyperagent? Try these beginner-friendly tasks before the full setup.
1. Optimize a simple Python script to run faster
Say: "Use hyperagent to optimize this script for speed" and paste something like:
# slow_sort.py
def sort_numbers(nums):
result = []
while nums:
smallest = min(nums)
result.append(smallest)
nums.remove(smallest)
return result
Hyperagent will benchmark it, propose a faster implementation, and validate the improvement.
2. Improve a prompt to get better answers
Say: "Run hyperagent on this prompt and improve accuracy" with a prompt like:
Summarize this article in one sentence.
The meta-agent iterates on the prompt, measures quality, and keeps improvements that score higher.
3. Make a sorting function more efficient
Say: "Evolve this function with hyperagent" and paste any function. Hyperagent creates a benchmark, runs generations of improvements, and shows you the performance gain per generation.
4. Self-improve any script
Say: "Self-improve this agent/script" and point to any Python file. Hyperagent wraps it in an evaluation loop, proposes modifications, and tracks what works.
The simplest possible setup: create
task.shthat printsMETRIC score=0.5, then runpython3 scripts/init_session.py. From there the loop is fully automated.
Self-referential self-improvement: a meta-agent that modifies a task-agent (and itself) to optimize any measurable objective.
Inspired by Facebook Research's Hyperagents paper (arXiv:2603.19461), which demonstrated that agents combining a task-solver and a self-modifying meta-level into a single editable program can achieve open-ended, compounding improvements that transfer across domains.
How It Works
A hyperagent is a system with two components in a single editable codebase:
- Task Agent — solves the target task (benchmark, code generation, data processing, etc.)
- Meta Agent — analyzes task performance history and proposes modifications to the task agent's code (and optionally its own code)
The key insight from the paper: when the meta-level modification procedure is itself editable, the system can improve not just task performance but also the mechanism that generates future improvements — enabling compounding, transferable gains.
Core Principles
Self-referential modification
The meta-agent can modify the task-agent's code AND its own strategy. Both live in the same editable workspace. This enables metacognitive self-improvement: improving how you improve.
Population-based exploration (archive)
Don't just keep the best variant — maintain an archive of all successful variants as stepping stones. Parent selection favors high performers with unexplored potential.
Empirical evaluation gates everything
No change is accepted without measurement. Every candidate is evaluated against the task benchmark with repeated trials.
Persistent memory and performance tracking
The system maintains a structured history of all experiments, hypotheses, and outcomes. Later generations build on earlier insights — no rediscovering dead ends.
Transfer across domains
Meta-level improvements (performance tracking, evaluation strategies, hypothesis generation patterns) are domain-agnostic and can be transferred to new tasks.
Available Scripts
scripts/common.py— shared utilities (archive management, metrics, reporting)scripts/init_session.py— initialize a hyperagent session, scaffold the workspacescripts/run_task.py— evaluate a task-agent variant and record metricsscripts/log_variant.py— log evaluated record, decide disposition, update archive and reportsscripts/render_report.py— generate HTML report of the full evolutionary historyscripts/select_parent.py— select a parent from the archive for the next generation
Note: There is no
generate_variant.pyscript — the meta-agent role (hypothesis generation and code modification) is performed by the LLM agent itself, not by a script.
All scripts are non-interactive, expose --help, emit structured JSON on stdout, and keep diagnostics on stderr.
Default Workflow
Initialize the session after defining the optimization target:
python3 scripts/init_session.py \ --goal "Improve prompt accuracy on math benchmark" \ --metric-name accuracy \ --unit pct \ --direction higher \ --task-command ./task.sh \ --checks-command ./checks.sh \ --scope src/agent.py \ --max-generations 50Evaluate the baseline (generation 0):
python3 scripts/run_task.py \ --id gen-000 \ --hypothesis "Control: unmodified task agent" \ --change-summary "No modifications" \ --baseline \ --output .hyperagent/gen-000.json python3 scripts/log_variant.py --in
Install hyperagent in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the hyperagent skill do?
Run a self-referential self-improving agent loop where a meta-agent iteratively modifies a task-agent's code to optimize for any measurable target. Based on Facebook Research's Hyperagents paper (arXiv:2603.19461). Use when asked to "run hyperagent", "self-improve this", "optimize with self-modification", or "evolve this agent/script".
How do I install the hyperagent skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the hyperagent skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic