| name | Evolutionary Archive Management |
| description | Manage the HyperAgents evolutionary archive โ an append-only log of all code generations with fitness scores, lineage tracking, and diff storage. Triggers when working with .hyperagents/ directory, archive.jsonl files, or generation metadata. |
| version | 1.0.0 |
| metadata | {"filePattern":["**/.hyperagents/**","**/archive.jsonl","**/metadata.json"],"bashPattern":["archive","generation","genid"],"priority":80} |
Evolutionary Archive Management
The evolutionary archive is the persistent memory of the HyperAgents improvement process. It stores every generation's code changes, fitness scores, and lineage relationships.
Archive Structure
.hyperagents/
โโโ archive.jsonl # Append-only generation log
โโโ config.json # Evolution configuration
โโโ next_parent.json # Pre-computed next parent selection
โโโ gen_initial/ # Baseline generation
โ โโโ metadata.json # Generation metadata
โ โโโ <domain>_eval/ # Evaluation results
โ โโโ report.json # Aggregate scores
โ โโโ predictions.csv # Per-item predictions
โโโ gen_0/
โ โโโ metadata.json
โ โโโ agent_output/
โ โ โโโ model_patch.diff # The code diff
โ โ โโโ meta_agent_chat_history.md
โ โโโ <domain>_eval/
โ โโโ report.json
โ โโโ predictions.csv
โโโ gen_1/
โ โโโ ...
โโโ gen_N/
โโโ ...
archive.jsonl Format
Each line is a self-contained JSON snapshot of the archive state after adding a new generation:
{"current_genid": 3, "archive": ["initial", 0, 1, 2, 3]}
This append-only format enables:
- Recovery from crashes (last complete line is the truth)
- Historical analysis (see how the archive grew)
- Atomic updates (each line is a complete snapshot)
metadata.json Format
Each generation's metadata records its full context:
{
"gen_output_dir": ".hyperagents/gen_3",
"current_genid": 3,
"parent_genid": 1,
"prev_patch_files": [".hyperagents/gen_1/agent_output/model_patch.diff"],
"curr_patch_files": [".hyperagents/gen_3/agent_output/model_patch.diff"],
"parent_agent_success": true,
"optimize_option": "only_agent",
"can_select_next_parent": true,
"run_eval": true,
"run_full_eval": true,
"valid_parent": true
}
Key Operations
Adding a Generation
- Create
gen_<id>/ directory
- Run meta-agent, save diff and chat history to
agent_output/
- Run evaluation, save results to
<domain>_eval/
- Write
metadata.json with all context
- Append to
archive.jsonl with updated archive list
Reconstructing a Generation
To get the full codebase state at any generation:
- Start from the root commit
- Apply all diffs in the lineage chain: initial -> parent -> ... -> target
- The lineage is stored in
metadata.json as prev_patch_files + curr_patch_files
Querying the Archive
- Best generation: Sort by fitness, take max
- Lineage of N: Follow
parent_genid links from N to initial
- Valid parents: Filter where
valid_parent: true
- Improvement rate: Compare each generation to its parent
Fitness Score Retrieval
Scores live in gen_<id>/<domain>_eval/report.json. The score key varies by domain:
overall_accuracy โ classification domains
average_progress โ game environments
average_fitness โ control tasks
accuracy_score โ code editing
points_percentage โ proof grading
Ensemble Scoring
When ensemble optimization is enabled, additional scores are stored at:
gen_<id>/report_ensemble_<domain>_<split>.json
The max score type returns the better of agent and ensemble scores.
Safety Rules
- Never modify archive.jsonl in place โ only append
- Never delete gen_initial/ โ it's the baseline
- Always write metadata.json atomically โ write to temp file, then rename
- Back up before pruning โ copy archive.jsonl before removing generations
- Validate lineage integrity โ every genid's parent must exist in the archive