self-improving-agents: Instructions file for Claude Code

CLAUDE.md

self-improving-agents CLAUDE.md is an instructions file for Claude Code 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 for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions Claude Code.

This is BetterForAll/self-improving-agents's own configuration. It tells Claude Code how to work on self-improving-agents itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything self-improving-agents configures →

Reuse

Borrowing it

Nothing to install: this file belongs to BetterForAll/self-improving-agents. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/BetterForAll/self-improving-agents/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/BetterForAll/self-improving-agents

Made for: Claude Code.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for self-improving-agents CLAUDE.md

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01702 $0.01702
Opus 5.5 $0.00681 $0.00681
Sonnet 5.5 $0.00340 $0.00340
Haiku 4.5 $0.00170 $0.00170

Measured 2mo ago against content hash 48fb21b4512b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 (149 stars, last pushed 7mo ago), licensed MIT. It adds 1,702 tokens to every session, about $0.0068 per session on Opus 5.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.

Related

self-improving-agents CLAUDE.md compared with instructions from other repositories

self-improving-agents CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
self-improving-agents CLAUDE.mdBetterForAll/self-improving-agentsInstructions file1497mo agoMITA1,702Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode