self-improving-agents CLAUDE.md

self-improving-agents CLAUDE.md is an instructions file for coding agents from BetterForAll/self-improving-agents. It costs 1,702 tokens per session, scanned A, original, MIT.

Project instructions for an AI coding agent working on a demonstration of agents that improve code through repeated review and testing. The project compares four increasingly advanced approaches.

In plain words
What is it for?
Use them when asking Claude Code to understand, modify, or extend this self-improving-agent demonstration.
Why use it?
They give the agent the project background, file layout, and intended improvement process, so it can work with the repository's design instead of guessing.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/betterforall/self-improving-agents/claude-md
Clone the repo
git clone --depth 1 https://github.com/BetterForAll/self-improving-agents

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for self-improving-agents CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/betterforall/self-improving-agents/claude-md.svg)](https://agentmods.dev/instructions/betterforall/self-improving-agents/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/betterforall/self-improving-agents/claude-md"><img src="https://agentmods.dev/badge/instructions/betterforall/self-improving-agents/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,702 This file is loaded in full into every session.
When invoked 1,702 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01702 $0.01702
Opus 5 $0.00851 $0.00851
Sonnet 5 $0.00340 $0.00340
Haiku 4.5 $0.00170 $0.00170

Measured 5d ago against content hash 48fb21b4512b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

self-improving-agents CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 160 lines

How it starts

The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Self-Improving Agents -- Project Context for Claude Code

Project Overview

This repo demonstrates 4 levels of self-improving code agents, from the simplest possible loop to a competitive adversarial arena. Each level adds one key idea. All demos use real LLM calls (Gemini 2.5 Flash) with multiple task types.

A side-by-side comparison of approaches to autonomous code improvement.


Background & History

I built a self-improving review loop for his Graph RAG project (BetterForAll/graph-rag-ui, private) starting February 1, 2026 -- 5 weeks before Karpathy's AutoResearch (March 6-7, 2026) and 6 weeks before Meta's HyperAgents paper (March 17, 2026, arxiv 2603.19461).

My original approach (in graph-rag-ui) introduced several techniques that later appeared independently in those papers:

  • Asymmetric context windows -- small focused worker, 1M-token evaluator
  • Structured issue taxonomy -- categorized feedback with severity + fix suggestions
  • Step-by-step pipeline logging -- queryable JSON logs instead of raw context
  • Fully autonomous from a single Cursor instruction -- no human in the loop

Repo Structure

tasks/                      Shared task definitions (real files, not strings)
  snake/                      Snake game AI (deterministic: score) + visual player
  support/                    Customer support Q&A (LLM-as-judge: quality)
  email_validation/           Email validation (adversarial: accuracy)
  task_runner.py              Central module: load_task, write_solution, run_solution
  checkpoint.py               Shared checkpoint/resume (atomic writes, all levels)

autoresearch/               Level 1: AutoResearch Loop
  run.py                      The main loop (--task snake|support|email_validation)
  llm.py                      Gemini 2.5 Flash wrapper
  experiment.py               Run experiments with real-time JSON logging

feedback-loop/              Level 2: Feedback Loop
  run.py                      Orchestrates worker + reviewer
  worker.py                   Proposes improvements (small context, focused)
  reviewer.py                 Structured JSON feedback (full context, sees everything)
  llm.py                      Gemini wrapper

hyperagent/                 Level 3: HyperAgent Loop (true code-rewriting)
  run.py                      Generation loop with 3-stage validation
  llm.py                      Gemini wrapper
  seed/                       Original agent code (immutable reference)
    task_agent.py               Seed task agent
    meta_agent.py               Seed meta-agent
  agent_code/                 Live working copies (rewritten by meta-agent)
  generations/                Versioned snapshots (gen_000/, gen_001/, ...)

arena-loop/                 Level 4: Arena Loop (adversarial + self-modifying)
  run.py                      Arena loop with tournament selection
  code_agent.py               Mini-HyperAgent code agents (can mutate propose())
  test_agent.py               Test hardening agents (adversarial inputs)
  arena.py                    Tournament selection + strategy evolution
  llm.py                      Gemini wrapper
  CONCEPT.md                  Full architectural writeup (GAN analogy, roadmap)

Read the full file on GitHub · 160 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 160 lines · 1,702 tokens per session scan A 48fb21b4512b

Subscribe to this mod's changes

self-improving-agents CLAUDE.md is an instructions file published in the GitHub repository BetterForAll/self-improving-agents (183 stars, last pushed 4mo ago), licensed MIT. It adds 1,702 tokens to every session, about $0.0085 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.