self-improve

self-improve is a skill for Claude Code, Codex from randomittin/heimdall. It costs 154 tokens per session (2,483 once invoked), scanned A, original, MIT.

A measured improvement loop for Heimdall, an agent that routes and plans coding work. It uses recorded results to test changes to that routing and planning.

In plain words
What is it for?
Reviewing metrics and completed or failed work, forming testable hypotheses, running bounded routing experiments, and keeping or rolling back changes based on the measurements.
Why use it?
It prevents changes from being kept just because they seem better. Each improvement must beat a baseline using observed results.

Skill for Claude CodeCodex

Part of the hmd plugin — 4 skills, 18 commands, 16 agents, 5 hooks, 1 MCP server shipped together

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 skills/randomittin/heimdall/self-improve
Any agent
npx skills add randomittin/heimdall --skill self-improve
Clone the repo
git clone --depth 1 https://github.com/randomittin/heimdall

Made for: Claude Code, Codex.

Or install hmd, the plugin that ships this one along with the rest of its 4 skills, 18 commands, 16 agents, 5 hooks, 1 MCP server.

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-improve

README.md
[![agentmods](https://agentmods.dev/badge/skills/randomittin/heimdall/self-improve.svg)](https://agentmods.dev/skills/randomittin/heimdall/self-improve)
Your own site
<a href="https://agentmods.dev/skills/randomittin/heimdall/self-improve"><img src="https://agentmods.dev/badge/skills/randomittin/heimdall/self-improve.svg" alt="Measured on agentmods" height="20"></a>
Per session 154 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,483 The whole file, excluding the scripts and references it only reads on demand.
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.00154 $0.02483
Opus 5 $0.00077 $0.01241
Sonnet 5 $0.00031 $0.00497
Haiku 4.5 $0.00015 $0.00248

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

Security

Grade A, and why

self-improve 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 3d 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.

skills/self-improve/SKILL.md · 178 lines

How it starts

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

self-improve — improve the improver

The maintainer loop (/hmd:maintain-check) fixes issues. This skill makes the maintainer get better at fixing issues over time. It is karpathy/autoresearch applied to Heimdall's own routing and planning — see docs/analysis/autoresearch-distilled.md for the distilled mechanics this is built on.

autoresearch's one non-negotiable rule, imported wholesale: an improvement persists only with a measured delta over a baseline — never because it seemed better. The mechanical parts (aggregation, hypothesis generation, override apply/rollback, experiment logging) live in bin/heimdall-self-improve; your job is the judgement of which hypothesis is worth an experiment.

Where this DEPARTS from autoresearch, on purpose. autoresearch runs one 5-minute training run per experiment and compares val_bpb — a low-variance continuous scalar, where n=1 is a usable measurement. It has no sample-size rule at all. Heimdall's scalar is a proportion (first-try acceptance pass-rate), which is far noisier: at 3 samples, a routing variant that is genuinely no better still clears a 0.10 delta about 73% of the time. So the sample-size floor is Heimdall's own addition, not something inherited — and it is load-bearing. Do not describe it as autoresearch's discipline; autoresearch simply never needed one.

When this runs

  • On demand: the user runs /hmd:self-improve or asks Heimdall to improve/tune itself. One experiment per invocation.
  • Between maintainer fix batches. /hmd:maintain-check documents this as a step you run yourself. There is no automatic every-Nth-cycle trigger — self_improve is not a key heimdall-state init creates, nothing in bin/ hooks/ sentinels/ modules/ reads it, and nothing counts cycles toward it. See Not implemented: the automatic every-Nth-cycle trigger in commands/maintain-check.md.
  • Overnight (/dream): the /dream command wraps this loop for an off-hours run and leaves a morning report (.planning/dream/YYYY-MM-DD.md) — see commands/dream.md. It reuses this exact keep-gate (surface-first; only measured, reversible wins persist).

Read the full file on GitHub · 178 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. 3d ago First seen · 178 lines · 0 tokens per session scan A 24f3cc78c093

Subscribe to this mod's changes

self-improve is a skill published in the GitHub repository randomittin/heimdall (5 stars, last pushed 13d ago), licensed MIT. It adds 154 tokens to every session and 2,483 once invoked, about $0.0008 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-31.