self-evolution

A pattern for making agent systems learn from failures, workarounds, and regressions by recording fixes in helper code or reference files.

In plain words
What is it for?
Use it when an agent tool, workflow, skill, sub-agent, or external system fails or behaves ambiguously and the issue needs a recorded fix or follow-up.
Why use it?
It prevents the same problem from being rediscovered and makes recurring failures visible instead of leaving them as undocumented patches.

Skill for Claude CodeCodex

Part of the agent-agentic-os plugin — 19 skills, 4 commands, 2 agents, 3 hooks 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/richfrem/agent-plugins-skills/self-evolution
Any agent
npx skills add richfrem/agent-plugins-skills --skill self-evolution
Clone the repo
git clone --depth 1 https://github.com/richfrem/agent-plugins-skills

Made for: Claude Code, Codex.

Or install agent-agentic-os, the plugin that ships this one along with the rest of its 19 skills, 4 commands, 2 agents, 3 hooks.

Per session 116 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,965 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.00116 $0.02965
Opus 5 $0.00058 $0.01483
Sonnet 5 $0.00023 $0.00593
Haiku 4.5 $0.00012 $0.00297

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

Security

Grade A, and why

self-evolution 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.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/audit_map_debt.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

plugins/agent-agentic-os/skills/self-evolution/SKILL.md · 353 lines

How it starts

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

Self-Evolution Skill

Trigger: Any tool call, subprocess, workflow, skill, sub-agent, helper, or documented repo capability fails, behaves ambiguously, or is bypassed through a workaround, guess, or manual substitute — and the fix or Map Debt entry is within allowed boundaries.

Core principle: The agent does not just retry — it learns. Every fix either patches a helper (so the failure can't recur) or updates a reference file (so future agents avoid the same dead end). Fixes that aren't recorded are not fixes; they are patches waiting to become the same bug again.


Phase 0 — Read the Repo Profile

Before doing anything else, locate and read the repo's self-evolution profile:

<repo-root>/plugins/<plugin>/references/self-evolution-profile.md

If no profile exists for the current repo/plugin, create a conservative default one now using the template in Phase 0.1 below, then continue — but only proceed if the target edit is inside the default allowed directories.

Also read <plugin>/references/map-debt.md if it exists. Surface any open entry that matches the current friction — if Repeat: YES, escalate immediately (go to Phase 6) instead of deferring again.

The profile defines:

  • Allowed edit directories — the only dirs the agent may edit autonomously
  • Error pattern → tier classification table — maps known error signatures to tiers
  • Domain playbook location — where reference files ("The Map") live
  • Evolution log path — where to append the fix record

Phase 0.1 — Bootstrap Profile (if missing)

If no profile exists, write one at <plugin>/references/self-evolution-profile.md:

# Self-Evolution Profile — <Plugin Name>

## Allowed Edit Directories

- plugins/<plugin>/skills/
- plugins/<plugin>/scripts/
- plugins/<plugin>/references/

## Explicit Confirmation Required

- plugin.json
- CLAUDE.md
- .agent/rules/
- ADRs/
- docs/
- repository root files
- any file outside this plugin
- any rename, move, or deletion

## Error Pattern Classification
| Pattern | Tier |
|---------|------|
| workaround used / bypassed capability | Friction |
| element not found / selector missing | Regression |
| function not exported / module not found | Gap |
| TypeError / syntax error | Failure |
| subprocess timeout | Regression |
| JSON parse error | Failure |

## Domain Playbook Location
plugins/<plugin>/references/

## Evolution Log
plugins/<plugin>/references/evolution-log.md

## Map Debt
plugins/<plugin>/references/map-debt.md

Read the full file on GitHub · 353 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 353 lines · 116 tokens per session scan A 69e5f6cbcd9c

Subscribe to this mod's changes

self-evolution is a skill published in the GitHub repository richfrem/agent-plugins-skills (6 stars, last pushed 5d ago), licensed MIT. It adds 116 tokens to every session and 2,965 once invoked, about $0.0006 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.

Related

Other skills, from other repositories

kapso-whatsapp

How to interact with Kapso WhatsApp from the swarm — read inbound webhook payloads (text AND media), fetch message history, send free-form messages within the 24h session window (and template messages outside it), mark-as-read, show the typing indicator, send reactions, download media, verify webhook signatures, and…

desplega-ai/agent-swarm · 156 tokens

composio

Use Composio from Agent Swarm through the agent-swarm x composio CLI route, the swarmx MCP tool, or a registered ctx.api.composio script connection. Trigger when a task needs connected third-party app tools such as Gmail, Google Calendar, Google Docs, Google Drive, GitHub, Slack, Notion, or HubSpot through Tool Router…

desplega-ai/agent-swarm · 128 tokens

attio-interaction

Generic Attio CRM REST API v2 recipes for querying records, upserting companies/people/deals, writing notes/tasks/comments, managing lists, and handling webhooks.

desplega-ai/agent-swarm · 39 tokens

scheduled-task-resilience

Guardrails for polling, scheduled jobs, and long-running external operations. Use whenever a task waits on CI, builds, deploys, browser jobs, or another asynchronous API so work survives heartbeat checks without duplicate delivery.

desplega-ai/agent-swarm · 48 tokens

swarm-scripts

Bulk, repeat, fan-out, or data-heavy work: write and run swarm scripts (inline script-run, named script-upsert, durable launch-script-run). Covers the script-vs-tool rubric, the authoring contract (args first, ctx second), the seed catalog, connections and secrets, dbquery, and exposing a script as an API.

desplega-ai/agent-swarm · 82 tokens

user-management

How to manage the user registry — creating users for new Slack/GitHub/GitLab/Linear identities, managing aliases, resolving users across platforms. Use when a new human interacts with the swarm or when user identity needs updating.

desplega-ai/agent-swarm · 49 tokens