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/extract.md

View on GitHub
# Sub-Skill: Extract

**Parent:** self-improving-agent
**Trigger:** "extract patterns", "find reusable patterns", "what did we learn"

## Purpose

Extract reusable patterns from completed work sessions. Analyzes session history to identify approaches that succeeded consistently and packages them as candidate rules or skill components.

## Workflow

### Step 1: Gather Session Data

Collect recent session outcomes:
- Tasks completed and their outcomes (success, partial, failure)
- Corrections made by the user
- Tool usage patterns
- Error resolutions applied

### Step 2: Identify Patterns

Run `pattern_extractor.py` on session logs:
```bash
python scripts/pattern_extractor.py --input session-log.jsonl --min-occurrences 2
```

Pattern categories:
- **Solution patterns:** Same approach solved similar problems multiple times
- **Error patterns:** Same error occurred and was resolved the same way
- **Workflow patterns:** A sequence of steps was effective repeatedly
- **Anti-patterns:** Approaches that consistently failed

### Step 3: Score Patterns

Each pattern gets scored on:
- **Frequency:** How often it appeared (2-3 = low, 4-6 = medium, 7+ = high)
- **Consistency:** Same solution every time vs varied approaches
- **Impact:** Prevented errors (high) vs minor convenience (low)
- **Generalizability:** Works across contexts vs project-specific

### Step 4: Package Candidates

For each high-scoring pattern, create a candidate entry:
```
Pattern: [description]
Evidence: [N occurrences across M sessions]
Score: [frequency * consistency * impact]
Recommendation: KEEP | PROMOTE | EXTRACT_TO_SKILL
```

### Step 5: Present for Review

Output the ranked pattern list for human review. Patterns are candidates, not automatically promoted -- the **promote** sub-skill handles graduation.

## Inputs

| Input | Required | Description |
|-------|----------|-------------|
| Session logs | Yes | JSONL file of session outcomes |
| Min occurrences | No | Minimum pattern frequency (default: 2) |
| Time range | No | Only analyze sessions within N days |

## Outputs

- Ranked list of extracted patterns with scores
- Candidate entries ready for promotion review
- Anti-pattern warnings
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated 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: 322kUpdated Claude CodeCodexVerifiedInstall