evolve

A command that reviews whether an AI agent's memory rules are working effectively. It examines stored patterns and activity measurements without changing the memory's actual content.

In plain words
What is it for?
Run it periodically to assess memory rules, review system metrics, and propose improvements after enough observations and patterns have accumulated.
Why use it?
It helps identify memory processes that are ineffective before they cause long-term problems.

Command for Claude Code

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 commands/marciopuga/cog/evolve
Clone the repo
git clone --depth 1 https://github.com/marciopuga/cog

Made for: Claude Code.

Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,368 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.00033 $0.01368
Opus 5 $0.00016 $0.00684
Sonnet 5 $0.00007 $0.00274
Haiku 4.5 $0.00003 $0.00137

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

Security

Grade A, and why

evolve 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 2d 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/commands/evolve.md · 136 lines

How it starts

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

Cog Evolve

Systems-level self-improvement. The architect.

This is NOT the reflect skill. Reflect = "what did I learn?" Evolve = "are the rules working?" Evolve never touches memory content — it changes the rules that govern how content moves.

Memory Path

All files under the resolved memory path: $COG_HOME/memory/ if COG_HOME is set, otherwise ~/cog/memory/.

Minimum Data Check

Before auditing, verify the system has enough history:

  • If reflect has never run (no self-observations, no patterns): stop. Say "Nothing to audit yet. Run the reflect skill a few times first to build patterns, then evolve can assess whether they're working."
  • If patterns.md has < 3 entries: say "Too few patterns to evaluate effectiveness. Let the system run for a few more cycles."

Evolve audits rules — there need to be rules to audit.

Files to Read

Continuity (read first):

  • memory/cog-meta/self-observations.md (what's been noticed)
  • memory/cog-meta/patterns.md (current rules)
  • memory/cog-meta/run-log.md (when housekeeping/reflect actually last ran)

Measure (don't edit content):

  • memory/hot-memory.md
  • Any domain satellite pattern files

Process

1. Architecture Review

Evaluate structural design:

  • Tier design — are hot/warm/glacier boundaries well-defined?
  • Consolidation pipeline — is the flow working? Where does it stall?
  • File organization — any files in wrong domains? Orphaned files?
  • Skill boundaries — are housekeeping/reflect/evolve lanes clean?

2. Process Effectiveness Audit

Review output of recent housekeeping and reflect runs:

Housekeeping check:

  • Did pruning priority order work?
  • Are glacier thresholds (50 obs, 10 items) right?
  • Is the 50-line hot-memory cap appropriate?

Reflect check:

  • Did consolidation produce useful patterns or noise?
  • Did thread detection work?
  • Is reflect staying in its lane?

Scorecard metrics:

  • Core patterns.md: line count / 70 (target: ≤1.0)
  • Satellite pattern files: list each with line count (cap: 30)
  • Entity compression ratio: total entity lines / total entries (target: ≤3.0)
  • Hot-memory line counts vs 50-line cap
  • Domain INDEX.md freshness: last-updated date vs today (target: ≤14 days). If INDEX.md files don't exist yet, that's not staleness — route one item: "Run the housekeeping skill to generate domain indexes."
  • Temporal markers: count of expired-but-not-swept markers (target: 0)

Read the full file on GitHub · 136 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. 2d ago First seen · 136 lines · 33 tokens per session scan A bb11da370cc5

Subscribe to this mod's changes

evolve is a command published in the GitHub repository marciopuga/cog (376 stars, last pushed 1mo ago), licensed MIT. It adds 33 tokens to every session and 1,368 once invoked, about $0.0002 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.