Evolve
Turn undigested entries in docs/agents/learnings.md into one reviewed PR. Read docs/agents/self-evolution.md first — it defines the allowlist, gates, and learnings format. The human gate is PR review; do not ask for chat confirmation of individual edits.
Flow
- Load — parse
docs/agents/learnings.md; collect entries withstatus:undigested. If none, say so and stop. - Group — cluster entries by
target. For each target, decide the minimal edit that addresses the rationale(s). Skip entries whose rationale is wrong or already addressed — flip them todigestedwith a note in the PR body instead of editing. - Allowlist check — every file you plan to touch must satisfy
isAllowlisted(packages/evolution/src/allowlist.ts). Non-allowlisted suggestions go into the PR body as "Out of scope" notes, never into the diff. - Branch —
git checkout -b evolve/<YYYY-MM-DD>-<slug>(never edit on main; a PreToolUse hook blocks main commits anyway). - Edit — apply the grouped edits. Keep docs ≤15KB (docs-size gate). New/edited skills need
name= dirname frontmatter and the two runtime symlinks (see "New skills" below). - Flip — set consumed entries to
status:digestedindocs/agents/learnings.md(same commit). If the buffer exceeds 32KB, move digested entries todocs/agents/learnings-archive.md. - Self-check — run from the repo root:
vp checkcd packages/evolution && vp test run(structural gates)cd packages/evolution && EVOLUTION_DIFF_BASE=origin/main vp test run src/evolution-guard.test.ts(after committing)- Optional semantic eval:
cd packages/evolution && SEMANTIC_EVAL=1 vp test run src/semantic-eval.test.ts— record scores in the PR body.
- PR — push and
gh pr createusingreference/pr-template.mdas the body. Add theself-evolvinglabel:gh pr create --label self-evolving .... - Engine self-modification — if the diff touches
.claude/settings.json,.codex/hooks.json,.agents/hooks/**,packages/evolution/**, or.github/workflows/ci.yml, you MUST add an ADR underdocs/adr/in the same diff (next number, usedocs/adr/0000-template.md) and tick the self-modifying checkbox in the PR body. CI fails otherwise.
New skills (MUSE Creation)
When ≥3 undigested learnings cluster on the same procedural theme (a repeatable how-to rather than a doc fix), propose a new skill instead of bloating docs:
- Follow the
write-a-skillskill to draft.agents/skills/<name>/SKILL.md(kebab-case name = dirname, ≤15KB). - Create both symlinks (relative, exactly like existing ones):
```bash
ln -s ../../.agents/skills/<name> .claude/skills/<name>
ln -s ../../.agents/skills/<name> .hermes/skills/<name>
```
- Do NOT touch
skills-lock.json— local skills are defined by absence from it. - The skill ships in the same evolution PR, flagged in the PR body under "New skills".
Rules
- One
/evolverun = one branch = one PR. Never push to main. - Never modify lock-managed skills (anything listed in
skills-lock.json) or files outside the allowlist. - Don't invent learnings: every change must trace to a learnings entry hash quoted in the PR body.
- If a learning conflicts with an existing instruction, prefer the learning only when its evidence is stronger; otherwise flip to
digestedwith a "rejected" note.