Build an auto-improve loop for the megaplan+hermes SWE-bench pipeline. The goal: iteratively run experiments, analyze failures, implement generalized improvements, and track everything via git worktrees on GitHub.
Architecture — 3 simple processes that compose:
run_experiment.py — Launches N workers on a fixed set of 20 SWE-bench tasks with the current code. Writes predictions to a results dir. Simple wrapper around existing parallel.py.
score_experiment.py — Watches for predictions and scores them (the watch_scoring.py we just built, or a simpler version). Produces a scores.json with pass/fail per task.
analyze_and_improve.md — A process doc (checklist) that a Claude Code session runs through after each iteration:
Read scores.json, identify failures
For each failure, analyze the megaplan audit trail (what went wrong at which stage)
Commit to a new git worktree branch (auto-improve/iteration-NNN)
Push to GitHub
Key design constraints:
Same model (GLM-5.1) and same 20 tasks across iterations (to measure improvement)
Each iteration = a git worktree branch with all code + results, so you can jump back to the best one
Changes must be general (prompt improvements, workflow changes) — constraint: no task-specific patches
A FINDINGS.md accumulates learnings across iterations (like autoresearch's program.md)
Keep it dead simple — the loop should be runnable by a single Claude Code session doing: run experiment → wait → score → analyze → improve → commit → next iteration
The 20 tasks should be a representative sample (mix of django, sympy, astropy, requests)
This should live in auto_improve/ directory in hermes-agent.
code
Plan:
# Implementation Plan: Auto-Improve Loop for Megaplan+Hermes
Overview
Build a self-improving experiment loop in that iteratively runs the same 20 SWE-bench tasks, scores them, analyzes failures against megaplan audit trails, proposes generalized improvements, and commits each iteration to a git worktree branch. The loop composes 3 simple processes: run → score → analyze+improve.
Assistant
User
Assistant
auto_improve/
Current state: The repo already has evals/parallel.py (manifest-based N-worker orchestration), evals/watch_scoring.py (incremental scoring), evals/audit.py (per-phase audit trails), and a prior 20-task GLM-5.1 run at results/glm51-20tasks/ with the exact task list we'll reuse. The MEGALOOP.md doc describes the philosophy but there's no automated loop implementation yet.
Key constraint: Same model (GLM-5.1), same 20 tasks, every iteration. Changes must be general (prompt/workflow), never task-specific hacks.
Phase 1: Foundation — Config, Task Set, Directory Structure
Step 1: Create the task set and base config (auto_improve/tasks.json, auto_improve/base_config.json)
Scope: Small
Createauto_improve/tasks.json — the fixed 20-task list extracted from the existing results/glm51-20tasks/_run_config.json:14-34. This is the canonical task set; never modified.
Createauto_improve/base_config.json — template eval config pointing to GLM-5.1 for all phases, swebench_dataset: "princeton-nlp/SWE-bench_Verified", robustness: "standard", workers: 3, eval_timeout_seconds: 1200. The run_name and results_dir fields are placeholders — run_experiment.py fills them per iteration.
Createauto_improve/FINDINGS.md — empty accumulator doc with a header template. Gets appended after each iteration's analysis.
Step 2: Create directory layout and iteration tracking (auto_improve/iterations/)
Scope: Small
Createauto_improve/iterations/.gitkeep — iteration results live here, one dir per iteration (iterations/001/, iterations/002/, ...).
Establish convention: each iteration dir contains:
config.json — the exact config used (copied from base, with iteration-specific run_name)
scores.json — pass/fail per task (output of scoring)
analysis.md — failure analysis and proposed changes
Constraint: NO task-specific patches. Every change must help across multiple tasks.
F. Implement changes — Make the code/prompt changes.
G. Update FINDINGS.md — Append iteration summary to auto_improve/FINDINGS.md.
H. Commit — Create git worktree branch auto-improve/iteration-{N:03d}, commit all changes, push to GitHub.
Step 6: Create the orchestrator script (auto_improve/loop.py)
Scope: Medium
Write a simple orchestrator that a Claude Code session can invoke to run one full iteration:
code
python -m auto_improve.loop --iteration N [--skip-run] [--skip-score] [--skip-analyze]
Steps:
Determine current iteration number (scan iterations/ for highest existing + 1, or use --iteration)
Run experiment (run_experiment.py)
Score experiment (score_experiment.py or read watch scores)
Print scores summary and pause for human/Claude analysis
The analysis step is manual — the loop.py prints the scores and tells the Claude Code session to follow analyze_and_improve.md. This keeps analysis in the Claude Code context where it has access to file reading, code editing, and git operations.
Git worktree management:
Before running: ensure we're on the right branch or create auto-improve/iteration-{N:03d} worktree
After analysis+changes: commit to the worktree branch, push
commit_iteration(iteration: int, message: str) — stages changes in the worktree, commits, pushes
list_iterations() — returns list of iteration branches with their pass rates from FINDINGS.md
Design decision: Worktrees are created under auto_improve/worktrees/iteration-{N:03d}/ (gitignored). Each worktree is a full copy of the repo at that iteration's state.
Alternative (simpler): Just use regular branches without worktrees — commit iteration changes to auto-improve/iteration-{N:03d} branch from main. Worktrees add complexity; branches alone provide the "jump back to best" capability via git checkout.
worktrees/
iterations/*/results/ # symlinks to large result dirs
Ensureiterations/*/scores.json, iterations/*/analysis.md, iterations/*/config.json, and FINDINGS.md ARE tracked in git.
Phase 4: Validation
Step 9: Dry-run validation
Scope: Small
Testrun_experiment.py --iteration 0 --dry-run — verify config generation, directory creation, no actual worker launch.
Testscore_experiment.py --results-dir results/glm51-20tasks — verify it can read the existing 20-task run's results and produce a valid scores.json.
Verifyloop.py --iteration 0 --skip-run with pre-existing scores works end-to-end up to the analysis prompt.
Step 10: First real iteration
Scope: Large (wall-clock time, not code)
Runpython -m auto_improve.loop --iteration 1 — this is the baseline run with unmodified code.
Score and save baseline results. This establishes the control measurement.
Followanalyze_and_improve.md to analyze baseline failures and make first round of improvements.
Commit to auto-improve/iteration-001 branch.
Execution Order
Steps 1-2 first (foundation, no dependencies)
Steps 3-4 in parallel (independent scripts)
Step 5 after 3-4 (references their output formats)
Step 6 after 3-5 (orchestrates them)
Step 7-8 in parallel (git infra, independent of scripts)
Step 9 after all code is written
Step 10 is the first real run
Validation Order
Dry-run config generation (Step 9.1)
Score existing results (Step 9.2) — cheapest real validation
Full loop dry run (Step 9.3)
First baseline iteration (Step 10)
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-03-29T22:28:14Z",
"hash": "sha256:32589ec1205c0092953d1b1a9e91080ea50a98f4ba997d796ee234e8ed0243e2",
"questions": [
"Should the analysis step be fully automated (Claude Code runs through analyze_and_improve.md autonomously) or semi-automated (loop pauses, human reviews scores, then kicks off analysis)? The brief says 'runnable by a single Claude Code session' which suggests fully automated, but the analysis quality might benefit from human-in-the-loop.",
"For git worktrees: do you want actual git worktree add (parallel checkouts on disk) or just branches (simpler, still lets you git checkout auto-improve/iteration-003)? Worktrees let you diff iterations side-by-side but add filesystem complexity.",
"Should run_experiment.py reuse existing Docker environment images from prior iterations (faster, ~5min saved per task) or start clean each time (more reproducible)? The SWE-bench sweb.env.* images are preserved by watch_scoring's cleanup already.",
"Do you want the loop to run continuously (iteration N finishes \u2192 automatically start N+1) or require explicit invocation for each iteration? Continuous is riskier (bad changes compound) but faster."
],
"success_criteria": [
"run_experiment.py successfully launches parallel workers on the fixed 20-task set and produces predictions",
"score_experiment.py produces a normalized scores.json with per-task pass/fail from watch_scoring or batch scoring output",
"analyze_and_improve.md is a clear, followable checklist that produces consistent analysis.md files",
"loop.py orchestrates a full iteration end-to-end: run \u2192 score \u2192 analysis prompt \u2192 commit",
"Each iteration is committed to its own git branch (auto-improve/iteration-NNN) with code changes + results metadata",
"FINDINGS.md accumulates learnings across iterations and shows pass_rate progression",
"Baseline iteration (iteration 1) completes successfully with unmodified code, establishing the control measurement",
"Second iteration shows the loop can make changes and measure their impact (pass rate change is tracked)",
"No task-specific hacks in any iteration \u2014 all changes are general prompt/workflow improvements"
],
"assumptions": [
"Using the existing 20-task set from results/glm51-20tasks/_run_config.json (13 django, 2 sympy, 1 astropy, 1 requests, 3 more django) \u2014 this is the representative sample",
"GLM-5.1 (zhipu:glm-5.1) for all phases, matching the existing config",
"3 workers by default (matching existing runs), watch scoring mode for real-time feedback",
"The analysis step will be executed by Claude Code following the process doc (not a Python script doing AI calls) \u2014 this keeps it simple and leverages Claude Code's existing file reading and code editing capabilities",
"Results directories (with full predictions and audit trails) are NOT committed to git \u2014 only scores.json, analysis.md, config.json, and FINDINGS.md are tracked. Full results stay local.",
"Using simple git branches (not worktrees) unless you specifically want parallel checkouts \u2014 branches achieve the 'jump back to best iteration' goal with less complexity",
"The auto_improve/ directory is a new top-level package in hermes-agent, not inside evals/",
"Iteration numbering starts at 001 (3-digit zero-padded)"
],
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[]
Known accepted debt grouped by subsystem:
{
"config-reproducibility": [
{
"id": "DEBT-008",
"concern": "openrouter_params (temperature, top_p) are recorded in config but cannot be applied because neither hermes aiagent nor the megaplan cli expose inference parameter controls.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"docker-sandbox-init": [
{
"id": "DEBT-015",
"concern": "file_tools.py does not forward docker_mount_cwd_to_workspace when creating the docker sandbox, so if read_file/write_file is the first tool call, the host workspace bind mount may not be set up.",
"occurrence_count": 1,
"plan_ids": [
"generalize-the-eval-harness-20260327-2049"
]
}
],
"execute-loop-control-flow": [
{
"id": "DEBT-022",
"concern": "the 'all tasks done but state stuck on finalized' break path at line 562 would skip verify if verify is inserted after the execute block.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
}
],
"handler-routing": [
{
"id": "DEBT-009",
"concern": "handler layer hardcodes planned\u2192critique transitions that the plan doesn't explicitly enumerate for update.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-026",
"concern": "manual megaplan research cli invocation can strand plans in state_researched with no workflow exit transition.",
"occurrence_count": 1,
"plan_ids": [
"three-changes-to-the-megaplan-20260329-1755"
]
}
],
"hermes-config": [
{
"id": "DEBT-004",
"concern": "availability check references ~/.hermes/config.yaml for api keys, but hermes stores them in /.hermes/.env.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"join-workflow": [
{
"id": "DEBT-019",
"concern": "the --join cli has no enforced source of truth for original run settings, so a mismatched config could attach wrong models/workspace layout to an existing manifest.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"module-layout": [
{
"id": "DEBT-003",
"concern": "hermes_worker.py importing workerresult from workers.py while workers.py imports run_hermes_step from hermes_worker.py creates a circular import.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-024",
"concern": "the evals/ top-level package is outside the distributable module set and won't be included in wheel builds.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"orchestrator-lifecycle": [
{
"id": "DEBT-018",
"concern": "the manifest.all_done() polling loop can hang indefinitely if a worker crashes and leaves tasks in 'claimed' state with no timeout or reclaim mechanism.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"research-prompt": [
{
"id": "DEBT-013",
"concern": "plan omits the brief's explicit 'compare against at least 2 search results' requirement.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"schema-validation": [
{
"id": "DEBT-011",
"concern": "proposed framework_versions object schema will be rejected by the strict additionalproperties:false rewriter.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-014",
"concern": "prompt wording alone cannot prevent empty or content-free consideration entries since the schema only requires severity.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"scoring-backend": [
{
"id": "DEBT-027",
"concern": "watch scoring is docker-only; modal scoring is not supported.",
"occurrence_count": 1,
"plan_ids": [
"add-a-polling-watch-mode-to-20260329-2355"
]
}
],
"scoring-diffing": [
{
"id": "DEBT-007",
"concern": "git diff head1 fails when the workspace has only one initial commit before execution begins.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"session-lifecycle": [
{
"id": "DEBT-016",
"concern": "_cleanup_hermes_sessions() hard-codes path.home() / '.hermes' / 'sessions', ignoring hermes_home. parallel workers may delete session files from the default location.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
],
"swebench-harness-invocation": [
{
"id": "DEBT-020",
"concern": "verify runs full instance evaluation via run_evaluation rather than targeting individual test ids.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
},
{
"id": "DEBT-023",
"concern": "read_prompt() has no caller in this repository yet, so fail_to_pass test ids won't reach megaplan prompts until a follow-up wires it in.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"test-coverage": [
{
"id": "DEBT-012",
"concern": "plan references wrong test files for workflow assertions.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"trace-collection": [
{
"id": "DEBT-006",
"concern": "session log path is ~/.hermes/sessions/ not ~/.hermes/logs/, and sessions are reused across megaplan phases, so naive reads return cumulative history rather than phase-isolated snapshots.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"trace-instrumentation": [
{
"id": "DEBT-005",
"concern": "the plan captures normalized session logs and aggregate cost/token counters from run_conversation(), not raw http request/response payloads or openrouter response headers.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"verify-artifact-isolation": [
{
"id": "DEBT-021",
"concern": "multiple verify attempts may leave stale result artifacts that _check_resolved() picks up, causing false positives.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
},
{
"id": "DEBT-028",
"concern": "startup cleanup and restart idempotency are in tension \u2014 cleaning the run_id's artifacts on startup would delete reports that the restart logic wants to re-verify.",
"occurrence_count": 1,
"plan_ids": [
"add-a-polling-watch-mode-to-20260329-2355"
]
}
],
"worker-contract": [
{
"id": "DEBT-001",
"concern": "plan's sample workerresult constructor uses non-existent fields (output, input_tokens, output_tokens) instead of actual fields (payload, raw_output).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"worker-dispatch": [
{
"id": "DEBT-002",
"concern": "plan's sample function signature (phase, prompt, schema_dir, model) doesn't match the actual worker signature (step, state, plan_dir, *, root, ...).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-010",
"concern": "research on non-hermes agents silently falls back to stale training data instead of fresh web searches.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"workflow-enforcement": [
{
"id": "DEBT-025",
"concern": "handle_plan accepts both state_initialized and state_prepped, so a manual cli invocation could skip prep on heavy robustness.",
"occurrence_count": 2,
"plan_ids": [
"add-a-prep-phase-to-the-20260329-1410"
]
}
],
"workspace-lifecycle": [
{
"id": "DEBT-017",
"concern": "stale per-worker prediction dirs from crashed prior runs could be globbed into a subsequent run's combined_predictions.jsonl.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
]
}
code
Escalated debt subsystems:
[]
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Requirements:
- First, assess whether the plan targets the correct root cause. If the proposed fix already exists in the codebase, or if the plan contradicts evidence you find, flag this as CRITICAL — the plan needs a fundamentally different approach, not just adjustments.
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered step sections (`### Step N:` under `## Phase` headers, or flat `## Step N:`) with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`.
- Missing required sections or step coverage (for example: no H1, no `## Overview`, or no step sections at all) should be flagged as category `completeness` with severity_hint `likely-significant`.
- Structural formatting within steps (for example: prose instead of numbered substeps, or a missing file reference inside an otherwise actionable step) should usually be category `completeness` with severity_hint `likely-minor` because the executor can still follow the instructions.
- Ask whether the plan is the simplest approach that solves the stated problem, whether it could use fewer steps or less machinery, and whether it introduces unnecessary complexity.
- Over-engineering concerns should use category `maintainability`, should usually prefix the concern with "Over-engineering:", and should scale severity_hint to the practical impact.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
{"flags":[{"id":"task-sample-skew","concern":"Task selection: The fixed 20-task set in the plan is not actually representative of the repository's own SWE-bench sample strategy, so it will bias the loop toward Django-specific improvements.","category":"correctness","severity_hint":"likely-significant","evidence":"The plan anchors on /Users/user_c042661f/Documents/hermes-agent/results/glm51-20tasks/_run_config.json:14-34, which is 16/20 Django tasks. The repo already defines a cross-repo representative sample in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:17-50 covering django, sympy, matplotlib, scikit-learn, pytest, sphinx, astropy, requests, pylint, xarray, and flask."},{"id":"batch-scoring-source","concern":"Scoring backend: Step 3/4 assumes there is a batch-mode per-task score artifact to copy or normalize, but the current parallel runner does not emit one.","category":"correctness","severity_hint":"likely-significant","evidence":"In /Users/user_c042661f/Documents/hermes-agent/evals/parallel.py:178-187 and :470-499, batch scoring only returns a dict with return code and stdout/stderr tails. It does not write per-task pass/fail into the run directory. The only built-in per-task score writer is watch mode via /Users/user_c042661f/Documents/hermes-agent/evals/watch_scoring.py:26-47 and :245-268 (_watch_scores.json), and the repo already has /Users/user_c042661f/Documents/hermes-agent/evals/consolidate.py:27-188 to mine reports into scores.json after the fact."},{"id":"incomplete-baseline-fixture","concern":"Validation fixture: Step 9.2 treats results/glm51-20tasks as a completed scored reference run, but the checked-in artifact is still incomplete.","category":"correctness","severity_hint":"likely-significant","evidence":"The manifest at /Users/user_c042661f/Documents/hermes-agent/results/glm51-20tasks/_task_manifest.json:11-12 shows django__django-11099 in error, and :120-126 shows django__django-15563 and django__django-15973 still claimed. The run root currently contains only _run_config.json and _task_manifest.json, with no _watch_scores.json or summary_parallel.json."},{"id":"analysis-misses-preaudit-failures","concern":"Failure analysis coverage: The analysis doc only points at per-task audit directories, but current infrastructure failures can happen before those artifacts exist.","category":"completeness","severity_hint":"likely-significant","evidence":"The plan says to read results/.../worker-*/{instance_id}/*/summary.json, but /Users/user_c042661f/Documents/hermes-agent/results/glm51-20tasks/worker-2/summary_20260329T201513Z.json:62-96 shows django__django-11099 and django__django-11179 failing during shared repo-cache clone before a normal task audit directory existed. Those failures are only visible in the worker summary/manifest, not under a task timestamp directory."},{"id":"iteration-branch-missing-artifacts","concern":"Iteration reproducibility: The plan says each iteration branch should preserve code plus results, but its own assumptions and ignore rules drop the artifacts needed to revisit an iteration.","category":"correctness","severity_hint":"likely-significant","evidence":"The plan's assumptions say full results stay local, and Step 8 ignores iteration result links. But the actual artifacts needed for re-analysis are written under results directories by /Users/user_c042661f/Documents/hermes-agent/evals/audit.py:131-183, including summary.json, scoring/.json, megaplan/.json, traces/*.json, and raw outputs. A branch checkout without those artifacts will not let you 'jump back to the best one' in any meaningful way."},{"id":"iteration-workspace-cross-contamination","concern":"Workspace isolation: Reusing the existing shared SWE-bench workspace root across iterations will make iteration-to-iteration comparisons non-independent and can preserve infrastructure failures.","category":"correctness","severity_hint":"likely-significant","evidence":"The baseline config the plan wants to mirror uses workspace_dir evals/workspaces-glm51 in /Users/user_c042661f/Documents/hermes-agent/results/glm51-20tasks/_run_config.json:41. The SWE-bench backend derives its shared bare-repo cache from Path(config.workspace_dir).parent / \"_repo_cache\" in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:136-170. The current run already shows clone races against that shared cache in /Users/user_c042661f/Documents/hermes-agent/results/glm51-20tasks/worker-2/summary_20260329T201513Z.json:71-95."}],"verified_flag_ids":[],"disputed_flag_ids":[]}
You are an independent reviewer. Critique the plan against the actual repository.
Build an auto-improve loop for the megaplan+hermes SWE-bench pipeline. The goal: iteratively run experiments, analyze failures, implement generalized improvements, and track everything via git worktrees on GitHub.
Architecture — 3 simple processes that compose:
run_experiment.py — Launches N workers on a fixed set of 20 SWE-bench tasks with the current code. Writes predictions to a results dir. Simple wrapper around existing parallel.py.
score_experiment.py — Watches for predictions and scores them (the watch_scoring.py we just built, or a simpler version). Produces a scores.json with pass/fail per task.
analyze_and_improve.md — A process doc (checklist) that a Claude Code session runs through after each iteration:
Read scores.json, identify failures
For each failure, analyze the megaplan audit trail (what went wrong at which stage)
Commit to a new git worktree branch (auto-improve/iteration-NNN)
Push to GitHub
Key design constraints:
Same model (GLM-5.1) and same 20 tasks across iterations (to measure improvement)
Each iteration = a git worktree branch with all code + results, so you can jump back to the best one
Changes must be general (prompt improvements, workflow changes) — constraint: no task-specific patches
A FINDINGS.md accumulates learnings across iterations (like autoresearch's program.md)
Keep it dead simple — the loop should be runnable by a single Claude Code session doing: run experiment → wait → score → analyze → improve → commit → next iteration
The 20 tasks should be a representative sample (mix of django, sympy, astropy, requests)
This should live in auto_improve/ directory in hermes-agent.
code
Plan:
# Implementation Plan: Auto-Improve Loop for Megaplan+Hermes
Overview
Build a self-improving experiment loop in auto_improve/ that iteratively runs the same 20 SWE-bench tasks, scores them, analyzes failures against megaplan audit trails, proposes generalized improvements, and commits each iteration to a git branch. The loop composes 3 simple processes: run → score → analyze+improve.
Current state: The repo already has evals/parallel.py (manifest-based N-worker orchestration), evals/watch_scoring.py (incremental scoring), evals/consolidate.py (post-hoc result mining into per-task scores/costs/patches), evals/audit.py (per-phase audit trails), and evals/benchmarks/swe_bench.py:18-50 which defines a canonical REPRESENTATIVE_SAMPLE of 20 tasks across 10 repos. The MEGALOOP.md doc describes the philosophy but there's no automated loop implementation yet.
Key constraints:
Same model (GLM-5.1), same 20 tasks, every iteration. Changes must be general (prompt/workflow), never task-specific hacks.
Task set: Use REPRESENTATIVE_SAMPLE from evals/benchmarks/swe_bench.py:18-50 (5 django, 3 sympy, 2 matplotlib, 2 scikit-learn, 2 pytest, 1 each sphinx/astropy/requests/pylint/xarray/flask) — NOT the prior glm51-20tasks config which was 16/20 Django.
Scoring: Watch mode is the primary scoring path (emits per-task _watch_scores.json). evals/consolidate.py is the fallback for post-hoc scoring when watch mode wasn't used.
Workspace isolation: Each iteration gets its own workspace dir to prevent cross-contamination from stale repo caches.
Iteration branches commit code changes + a compact consolidated/ snapshot (per-task scores, costs, patches, audit summaries) — not raw traces, but enough to revisit and compare iterations.
Settled decisions (from gate):
Simple git branches, not worktrees (DECISION-001)
Analysis executed by Claude Code following a process doc (DECISION-002)
auto_improve/ is a new top-level directory (DECISION-004)
Phase 1: Foundation — Config, Task Set, Directory Structure
Step 1: Create the task set and base config (auto_improve/tasks.json, auto_improve/base_config.json)
Scope: Small
Createauto_improve/tasks.json — import the 20 tasks from evals/benchmarks/swe_bench.py:18-50 (REPRESENTATIVE_SAMPLE). This is the canonical task set; never modified.
Createauto_improve/base_config.json — template eval config pointing to GLM-5.1 for all phases, swebench_dataset: "princeton-nlp/SWE-bench_Verified", robustness: "standard", workers: 3, eval_timeout_seconds: 1200. The run_name, results_dir, workspace_dir, and evals_to_run fields are placeholders — run_experiment.py fills them per iteration.
Createauto_improve/FINDINGS.md — empty accumulator doc with a header template (iteration number, pass rate, key learnings, changes made). Gets appended after each iteration's analysis.
Createauto_improve/iterations/.gitkeep — iteration results live here, one dir per iteration (iterations/001/, iterations/002/, ...).
Createauto_improve/.gitignore:
code
# Raw results are large — only consolidated/ snapshot is committed
iterations/*/results
Establish convention: each iteration dir contains:
config.json — the exact config used (committed)
scores.json — normalized pass/fail per task (committed)
analysis.md — failure analysis and proposed changes (committed)
changes.md — summary of code changes made (committed)
consolidated/ — compact result snapshot from evals/consolidate.py (committed): per-task score.json, audit.json, patch.diff, plus top-level summary.json and scores.json
results — symlink to full results dir under results/ (gitignored)
On completion: run evals.consolidate.consolidate(results_root) to produce the compact consolidated/ snapshot, then copy it to iterations/{N:03d}/consolidated/
Normalize watch scores into iterations/{N:03d}/scores.json with this format:
Write a standalone re-scoring/normalization utility for when watch mode wasn't used or scores need to be regenerated:
Takes --iteration N or --results-dir PATH
Primary path: read _watch_scores.json from the results dir, normalize into scores.json
Fallback path: if no watch scores exist, run evals.consolidate.consolidate() which mines SWE-bench report.json files from logs/run_evaluation/ and produces per-task scores
Writes to iterations/{N:03d}/scores.json
Note: This script is mainly for re-scoring or normalizing existing results. When run_experiment.py completes normally with watch mode, scores.json is already produced.
Step 5: Create the analysis process doc (auto_improve/analyze_and_improve.md)
Scope: Medium
Write a structured checklist that a Claude Code session follows post-scoring. This is NOT code — it's a process document / prompt. Sections:
A. Read scores and compare — Load iterations/{N}/scores.json. If prior iteration exists, load iterations/{N-1}/scores.json and diff: call out regressions (tasks that went from pass→fail), improvements (fail→pass), and stable results.
B. Triage failures into two buckets:
Infrastructure failures — Check iterations/{N}/scores.json for tasks with "errors" status. Also check the manifest at results/auto-improve/iteration-{N:03d}/_task_manifest.json for tasks with status: "error" (these failed before any audit trail was created — e.g., workspace clone races, Docker issues). Check worker summary files results/.../worker-*/summary_*.json for error entries. These are NOT megaplan failures — they need infra fixes.
Megaplan failures — Tasks that ran to completion but produced wrong patches. These are the improvement targets.
C. Analyze megaplan failures — For each failed task:
Read the consolidated audit at iterations/{N}/consolidated/tasks/{instance_id}/audit.json (phase costs, durations, models)
Read the patch at iterations/{N}/consolidated/tasks/{instance_id}/patch.diff
If deeper analysis needed, read the full audit trail at results/auto-improve/iteration-{N:03d}/worker-*/{instance_id}/*/summary.json
Identify which megaplan phase failed or produced weak output (plan too vague? execution missed files? review didn't catch the bug?)
D. Categorize into patterns — Group failures:
narrow_fix — correct diagnosis, patch too narrow (missed related code)
wrong_type — misidentified the bug type
missing_scope — didn't explore enough files
execution_error — correct plan, flawed execution
test_mismatch — fix works but tests still fail (environment issue)
E. Write analysis — Save iterations/{N}/analysis.md with: per-task breakdown, pattern summary, comparison to prior iteration.
Step 6: Create the orchestrator script (auto_improve/loop.py)
Scope: Medium
Write a simple orchestrator that a Claude Code session can invoke to run one full iteration:
code
python -m auto_improve.loop --iteration N [--skip-run] [--skip-score]
Steps:
Determine current iteration number (scan iterations/ for highest existing + 1, or use --iteration)
Run experiment via run_experiment.py (unless --skip-run)
Normalize scores via score_experiment.py (unless --skip-score)
Print scores summary table to stdout
Print instructions: "Follow auto_improve/analyze_and_improve.md to complete this iteration"
The analysis step is manual — loop.py prints the scores and tells the Claude Code session to follow analyze_and_improve.md. This keeps analysis in the Claude Code context where it has access to file reading, code editing, and git operations.
No git worktree management in the script — branching and committing happen in the analyze step (step I of the process doc), driven by the Claude Code session.
Phase 3: Utilities
Step 7: Add __init__.py and helper module (auto_improve/__init__.py, auto_improve/utils.py)
Scope: Small
Createauto_improve/__init__.py — empty, makes it a package for python -m auto_improve.loop.
Testpython -m auto_improve.run_experiment --iteration 0 --dry-run — verify config generation, directory creation, workspace dir is per-iteration (evals/workspaces-auto-improve/iteration-000), task list matches REPRESENTATIVE_SAMPLE, no actual worker launch.
Testpython -m auto_improve.score_experiment --iteration 0 against a manually created mock _watch_scores.json — verify normalization produces valid scores.json.
Verifypython -m auto_improve.loop --iteration 0 --skip-run with pre-existing scores prints the summary table and analysis instructions.
Step 9: First real iteration (baseline)
Scope: Large (wall-clock time, not code)
Runpython -m auto_improve.loop --iteration 1 — this is the baseline run with unmodified code on the representative 20-task sample.
Score and save baseline results. This establishes the control measurement.
Followanalyze_and_improve.md to analyze baseline failures and make first round of improvements.
Commit to auto-improve/iteration-001 branch.
Execution Order
Steps 1-2 (foundation, no dependencies)
Steps 3-4 + Step 7 in parallel (independent scripts and utils)
Step 5 after 3-4 (references their output formats)
"version": 2,
"timestamp": "2026-03-29T22:35:30Z",
"hash": "sha256:9686620cc890c8a5d8b74f1ed9c4803553038d81fa4746e79719c3d1ace6acef",
"changes_summary": "Revised plan addresses all 6 gate flags:\n\n1. task-sample-skew: Replaced the 16/20-Django task set from glm51-20tasks with the repo's canonical REPRESENTATIVE_SAMPLE from evals/benchmarks/swe_bench.py:18-50 \u2014 20 tasks across 10 repos (django, sympy, matplotlib, scikit-learn, pytest, sphinx, astropy, requests, pylint, xarray, flask).\n\n2. batch-scoring-source: Hardcoded watch mode as the primary scoring path in run_experiment.py. Added evals/consolidate.py as the explicit fallback in score_experiment.py for post-hoc scoring. Removed the ambiguity about batch mode emitting per-task scores.\n\n3. incomplete-baseline-fixture: Dropped the glm51-20tasks run as a validation fixture entirely. Dry-run validation (Step 8) now uses config generation checks and mock data. The first real iteration (Step 9) IS the baseline \u2014 no dependency on prior incomplete runs.\n\n4. analysis-misses-preaudit-failures: Added an explicit "infrastructure failures" triage bucket in the analysis process doc (Step 5, section B). The checklist now directs Claude Code to check the manifest for status: \"error\" tasks and worker summary files for errors that occur before audit directories exist, separate from megaplan failures.\n\n5. iteration-branch-missing-artifacts: Each iteration now runs evals/consolidate.py and commits the consolidated/ snapshot to the branch. This provides per-task score.json, audit.json (phase costs/durations/models), and patch.diff \u2014 enough to revisit and compare iterations without committing raw traces.\n\n6. iteration-workspace-cross-contamination: Each iteration now gets its own workspace dir (evals/workspaces-auto-improve/iteration-{N:03d}), preventing shared repo cache clone races and stale workspace contamination between iterations.\n\nAlso removed Step 7 (worktree.py) from original plan \u2014 git branching is handled inline by the analysis process doc, not a separate utility module. Eliminated score_experiment.py as a separate scoring step in the happy path \u2014 run_experiment.py produces scores directly via watch mode + consolidation.",
"flags_addressed": [
"task-sample-skew",
"batch-scoring-source",
"incomplete-baseline-fixture",
"analysis-misses-preaudit-failures",
"iteration-branch-missing-artifacts",
"iteration-workspace-cross-contamination"
],
"questions": [
"Per-iteration workspace dirs mean re-cloning repos from scratch each iteration (~5min overhead per repo, ~10 repos). Acceptable for independence, or should we use a shared read-only repo cache with per-iteration worktrees (faster but reintroduces the shared cache)?"
],
"success_criteria": [
"run_experiment.py successfully launches parallel workers on the 20-task REPRESENTATIVE_SAMPLE and produces predictions + watch scores",
"Watch scores are normalized into scores.json with per-task pass/fail and summary stats",
"evals/consolidate.py produces a compact consolidated/ snapshot committed to each iteration branch",
"analyze_and_improve.md correctly triages infrastructure failures (manifest/worker errors) separately from megaplan failures",
"loop.py orchestrates run \u2192 score \u2192 analysis prompt for a full iteration",
"Each iteration is committed to its own git branch (auto-improve/iteration-NNN) with code changes + consolidated results",
"FINDINGS.md accumulates learnings across iterations with pass_rate progression",
"Baseline iteration (iteration 1) completes on the representative 20-task sample, establishing the control measurement",
"Each iteration uses an isolated workspace dir (no cross-contamination from prior iterations)",
"No task-specific hacks in any iteration \u2014 all changes are general prompt/workflow improvements"
],
"assumptions": [
"Using REPRESENTATIVE_SAMPLE from evals/benchmarks/swe_bench.py:18-50 (20 tasks, 10 repos) as the canonical task set",
"GLM-5.1 (zhipu:glm-5.1) for all phases, matching the existing config pattern",
"3 workers by default, watch scoring mode as the primary scoring path",
"The analysis step is executed by Claude Code following the process doc (DECISION-002)",
"Each iteration gets its own workspace dir under evals/workspaces-auto-improve/iteration-NNN/ to prevent cross-contamination",
"consolidated/ directory from evals/consolidate.py is committed to iteration branches \u2014 provides per-task scores, costs, patches, audit summaries (~small) without raw traces (~large)",
"Raw results directories (predictions, full audit trails, traces) stay local and are gitignored",
"auto_improve/ is a new top-level package (DECISION-004)",
"Iteration numbering starts at 001 (3-digit zero-padded)",
"swebench_dataset is princeton-nlp/SWE-bench_Verified (matching existing config)",
"Per-iteration workspace dirs mean each iteration re-clones repos from scratch \u2014 slower (~5min overhead) but fully independent"
],
"structure_warnings": [],
"delta_from_previous_percent": 57.82
}
code
Plan structure warnings from validator:
[]
Existing flags:
[
{
"id": "task-sample-skew",
"concern": "Task selection: The fixed 20-task set in the plan is not actually representative of the repository's own SWE-bench sample strategy, so it will bias the loop toward Django-specific improvements.",
"status": "addressed",
"severity": "significant"
},
{
"id": "batch-scoring-source",
"concern": "Scoring backend: Step 3/4 assumes there is a batch-mode per-task score artifact to copy or normalize, but the current parallel runner does not emit one.",
"status": "addressed",
"severity": "significant"
},
{
"id": "incomplete-baseline-fixture",
"concern": "Validation fixture: Step 9.2 treats results/glm51-20tasks as a completed scored reference run, but the checked-in artifact is still incomplete.",
"status": "addressed",
"severity": "significant"
},
{
"id": "analysis-misses-preaudit-failures",
"concern": "Failure analysis coverage: The analysis doc only points at per-task audit directories, but current infrastructure failures can happen before those artifacts exist.",
"status": "addressed",
"severity": "significant"
},
{
"id": "iteration-branch-missing-artifacts",
"concern": "Iteration reproducibility: The plan says each iteration branch should preserve code plus results, but its own assumptions and ignore rules drop the artifacts needed to revisit an iteration.",
"status": "addressed",
"severity": "significant"
},
{
"id": "iteration-workspace-cross-contamination",
"concern": "Workspace isolation: Reusing the existing shared SWE-bench workspace root across iterations will make iteration-to-iteration comparisons non-independent and can preserve infrastructure failures.",
"status": "addressed",
"severity": "significant"
}
]
code
Known accepted debt grouped by subsystem:
{
"config-reproducibility": [
{
"id": "DEBT-008",
"concern": "openrouter_params (temperature, top_p) are recorded in config but cannot be applied because neither hermes aiagent nor the megaplan cli expose inference parameter controls.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"docker-sandbox-init": [
{
"id": "DEBT-015",
"concern": "file_tools.py does not forward docker_mount_cwd_to_workspace when creating the docker sandbox, so if read_file/write_file is the first tool call, the host workspace bind mount may not be set up.",
"occurrence_count": 1,
"plan_ids": [
"generalize-the-eval-harness-20260327-2049"
]
}
],
"execute-loop-control-flow": [
{
"id": "DEBT-022",
"concern": "the 'all tasks done but state stuck on finalized' break path at line 562 would skip verify if verify is inserted after the execute block.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
}
],
"handler-routing": [
{
"id": "DEBT-009",
"concern": "handler layer hardcodes planned\u2192critique transitions that the plan doesn't explicitly enumerate for update.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-026",
"concern": "manual megaplan research cli invocation can strand plans in state_researched with no workflow exit transition.",
"occurrence_count": 1,
"plan_ids": [
"three-changes-to-the-megaplan-20260329-1755"
]
}
],
"hermes-config": [
{
"id": "DEBT-004",
"concern": "availability check references ~/.hermes/config.yaml for api keys, but hermes stores them in /.hermes/.env.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"join-workflow": [
{
"id": "DEBT-019",
"concern": "the --join cli has no enforced source of truth for original run settings, so a mismatched config could attach wrong models/workspace layout to an existing manifest.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"module-layout": [
{
"id": "DEBT-003",
"concern": "hermes_worker.py importing workerresult from workers.py while workers.py imports run_hermes_step from hermes_worker.py creates a circular import.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-024",
"concern": "the evals/ top-level package is outside the distributable module set and won't be included in wheel builds.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"orchestrator-lifecycle": [
{
"id": "DEBT-018",
"concern": "the manifest.all_done() polling loop can hang indefinitely if a worker crashes and leaves tasks in 'claimed' state with no timeout or reclaim mechanism.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"research-prompt": [
{
"id": "DEBT-013",
"concern": "plan omits the brief's explicit 'compare against at least 2 search results' requirement.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"schema-validation": [
{
"id": "DEBT-011",
"concern": "proposed framework_versions object schema will be rejected by the strict additionalproperties:false rewriter.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-014",
"concern": "prompt wording alone cannot prevent empty or content-free consideration entries since the schema only requires severity.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"scoring-backend": [
{
"id": "DEBT-027",
"concern": "watch scoring is docker-only; modal scoring is not supported.",
"occurrence_count": 1,
"plan_ids": [
"add-a-polling-watch-mode-to-20260329-2355"
]
}
],
"scoring-diffing": [
{
"id": "DEBT-007",
"concern": "git diff head1 fails when the workspace has only one initial commit before execution begins.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"session-lifecycle": [
{
"id": "DEBT-016",
"concern": "_cleanup_hermes_sessions() hard-codes path.home() / '.hermes' / 'sessions', ignoring hermes_home. parallel workers may delete session files from the default location.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
],
"swebench-harness-invocation": [
{
"id": "DEBT-020",
"concern": "verify runs full instance evaluation via run_evaluation rather than targeting individual test ids.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
},
{
"id": "DEBT-023",
"concern": "read_prompt() has no caller in this repository yet, so fail_to_pass test ids won't reach megaplan prompts until a follow-up wires it in.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"test-coverage": [
{
"id": "DEBT-012",
"concern": "plan references wrong test files for workflow assertions.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"trace-collection": [
{
"id": "DEBT-006",
"concern": "session log path is ~/.hermes/sessions/ not ~/.hermes/logs/, and sessions are reused across megaplan phases, so naive reads return cumulative history rather than phase-isolated snapshots.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"trace-instrumentation": [
{
"id": "DEBT-005",
"concern": "the plan captures normalized session logs and aggregate cost/token counters from run_conversation(), not raw http request/response payloads or openrouter response headers.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"verify-artifact-isolation": [
{
"id": "DEBT-021",
"concern": "multiple verify attempts may leave stale result artifacts that _check_resolved() picks up, causing false positives.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
},
{
"id": "DEBT-028",
"concern": "startup cleanup and restart idempotency are in tension \u2014 cleaning the run_id's artifacts on startup would delete reports that the restart logic wants to re-verify.",
"occurrence_count": 1,
"plan_ids": [
"add-a-polling-watch-mode-to-20260329-2355"
]
}
],
"worker-contract": [
{
"id": "DEBT-001",
"concern": "plan's sample workerresult constructor uses non-existent fields (output, input_tokens, output_tokens) instead of actual fields (payload, raw_output).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"worker-dispatch": [
{
"id": "DEBT-002",
"concern": "plan's sample function signature (phase, prompt, schema_dir, model) doesn't match the actual worker signature (step, state, plan_dir, *, root, ...).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-010",
"concern": "research on non-hermes agents silently falls back to stale training data instead of fresh web searches.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"workflow-enforcement": [
{
"id": "DEBT-025",
"concern": "handle_plan accepts both state_initialized and state_prepped, so a manual cli invocation could skip prep on heavy robustness.",
"occurrence_count": 2,
"plan_ids": [
"add-a-prep-phase-to-the-20260329-1410"
]
}
],
"workspace-lifecycle": [
{
"id": "DEBT-017",
"concern": "stale per-worker prediction dirs from crashed prior runs could be globbed into a subsequent run's combined_predictions.jsonl.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
]
}
code
Escalated debt subsystems:
[]
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Requirements:
- First, assess whether the plan targets the correct root cause. If the proposed fix already exists in the codebase, or if the plan contradicts evidence you find, flag this as CRITICAL — the plan needs a fundamentally different approach, not just adjustments.
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered step sections (`### Step N:` under `## Phase` headers, or flat `## Step N:`) with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`.
- Missing required sections or step coverage (for example: no H1, no `## Overview`, or no step sections at all) should be flagged as category `completeness` with severity_hint `likely-significant`.
- Structural formatting within steps (for example: prose instead of numbered substeps, or a missing file reference inside an otherwise actionable step) should usually be category `completeness` with severity_hint `likely-minor` because the executor can still follow the instructions.
- Ask whether the plan is the simplest approach that solves the stated problem, whether it could use fewer steps or less machinery, and whether it introduces unnecessary complexity.
- Over-engineering concerns should use category `maintainability`, should usually prefix the concern with "Over-engineering:", and should scale severity_hint to the practical impact.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
{"flags":[{"id":"iteration-workspace-cross-contamination","concern":"Workspace isolation: Recurring debt: the revised per-iteration workspace_dir still shares a parent-level _repo_cache, so iterations are not actually isolated and can still inherit clone/cache state from earlier runs.","category":"correctness","severity_hint":"likely-significant","evidence":"SWEBenchBackend.prepare_workspace() derives the cache path from Path(config.workspace_dir).parent / \"_repo_cache\" in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:136-170. With the planned workspace_dir of evals/workspaces-auto-improve/iteration-{N:03d}, every iteration still shares the same parent evals/workspaces-auto-improve, so they also share evals/workspaces-auto-improve/_repo_cache. The current repo already shows shared-cache clone races in /Users/user_c042661f/Documents/hermes-agent/results/glm51-20tasks/worker-2/summary_20260329T201513Z.json:71-95."},{"id":"consolidation-run-scope","concern":"CRITICAL: Consolidation: the plan treats evals/consolidate.py as the committed per-iteration source of truth, but that script is not scoped to one run and will mix in stale reports when you rerun the same 20 instance IDs every iteration.","category":"correctness","severity_hint":"likely-significant","evidence":"evals.consolidate.consolidate() scans the global logs/run_evaluation/ tree with Path(\"logs/run_evaluation/\").rglob(\"report.json\") and records the first report seen per instance id in /Users/user_c042661f/Documents/hermes-agent/evals/consolidate.py:56-64. Because the auto-improve loop intentionally reruns the same fixed 20 SWE-bench ids each iteration, iteration N can pick up iteration N-1's report.json. The plan uses this script both as fallback scoring and to build the committed consolidated/ snapshot in Step 3, so the branch artifacts can silently report the wrong iteration's scores."},{"id":"verified-vs-lite-sample","concern":"Dataset compatibility: the plan now mixes the repo's REPRESENTATIVE_SAMPLE with SWE-bench_Verified, but the sample was authored in the SWE-bench Lite path and the plan does not include an explicit validation that all 20 ids exist in the Verified split before iteration 1.","category":"correctness","severity_hint":"likely-significant","evidence":"The sample lives in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:17-50 and is defined alongside Lite-oriented comments and defaults (_load_dataset(...=\"princeton-nlp/SWE-bench_Lite\") at :60-68). list_tasks() will raise FileNotFoundError for any configured ids missing from the chosen dataset in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:105-109. The revised plan hardcodes swebench_dataset: \"princeton-nlp/SWE-bench_Verified\" but adds no validation step proving that the Lite-oriented representative sample is valid against Verified."}],"verified_flag_ids":["task-sample-skew","batch-scoring-source","incomplete-baseline-fixture","analysis-misses-preaudit-failures","iteration-branch-missing-artifacts"],"disputed_flag_ids":[]}
Not yet included in a published release.
F. Propose improvements — Based on patterns, propose GENERAL changes to:
Infrastructure robustness (if infra errors dominate)
Constraint: NO task-specific patches. Every change must help across multiple tasks.
G. Implement changes — Make the code/prompt changes. Write iterations/{N}/changes.md summarizing what changed and why.
H. Update FINDINGS.md — Append iteration summary to auto_improve/FINDINGS.md: iteration number, pass rate, delta from prior, top patterns, changes made, key learnings.
I. Commit and push — Create branch auto-improve/iteration-{N:03d} from current HEAD, commit all changes (code + iteration metadata + consolidated results), push to GitHub.