Skip to content

borghei/Claude-Skills / engineering/self-improving-agent

self-improving-agent

Verified

Curates agent memory and turns repeated lessons into reviewed rules: memory health checks, pattern extraction, feedback and regression analysis. Use when managing auto-memory or building agents that learn from their own sessions.

skills/promote.md

View on GitHub
# Sub-Skill: Promote

**Parent:** self-improving-agent
**Trigger:** "promote pattern to rule", "graduate to CLAUDE.md", "make this permanent"

## Purpose

Graduate proven patterns from memory (MEMORY.md) to enforced rules (CLAUDE.md or `.claude/rules/`). This is the critical step that turns observations into permanent behavior changes.

## Workflow

### Step 1: Check Promotion Criteria

A pattern is ready for promotion when ALL of these are met:

| Criterion | Threshold | Verification |
|-----------|-----------|--------------|
| Recurrence | 3+ sessions | Check recurrence count in memory |
| Consistency | Same solution every time | No contradicting entries exist |
| Impact | Prevented errors or saved time | At least one error prevented |
| Stability | Underlying system unchanged | Referenced code/tools still exist |
| Clarity | Statable in 1-2 sentences | Can be expressed as a clear rule |

### Step 2: Determine Target

| Pattern Type | Promote To | Format |
|-------------|-----------|--------|
| Coding convention | `.claude/rules/<area>.md` | Rule with scope path |
| Project architecture | `CLAUDE.md` | Architecture section entry |
| Tool preference | `CLAUDE.md` | Development environment section |
| Debugging pattern | `.claude/rules/debugging.md` | Conditional rule |
| File-scoped rule | `.claude/rules/<scope>.md` with `paths:` | Scoped rule |

### Step 3: Draft the Rule

Format as a clear, enforceable statement:
- Start with an action verb (Use, Always, Never, Prefer)
- Include the "why" as a brief annotation
- Scope to specific files/directories if applicable

Example:
```
Always use `type` not `interface` for object shapes.
Reason: Consistent with codebase convention; types are more flexible for unions.
```

### Step 4: Apply Promotion

Preview with `rule_promoter.py`, show the user the rule text and target, and apply only after an explicit yes (a promoted rule shapes every later session):
```bash
python3 scripts/rule_promoter.py --memory ./MEMORY.md --entry-title "Use pnpm" --target claude-md --target-path ./CLAUDE.md --dry-run
python3 scripts/rule_promoter.py --memory ./MEMORY.md --entry-title "Use pnpm" --target claude-md --target-path ./CLAUDE.md --apply
```

### Step 5: Clean Up Memory

After promotion:
- Remove the original entry from MEMORY.md
- Add a reference note: "Promoted to CLAUDE.md on [date]"
- Verify MEMORY.md line count is within limits

## Inputs

| Input | Required | Description |
|-------|----------|-------------|
| Entry title | Yes | Title (or part of it) of the `## ` memory entry to promote |
| Target | Yes | CLAUDE.md or .claude/rules/<name>.md |
| Dry run | No | Preview without applying (default: true) |

## Outputs

- Promotion validation result (pass/fail with reasons)
- Draft rule text
- Applied changes (if not dry run)
- Updated memory with entry removed
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall