---
name: auto-recall
description: Detect repeated workflow patterns and auto-generate reusable skills from them. Analyzes tool operation logs to identify automation opportunities.
---

# Auto-Recall Skill

Analyzes past tool operations to discover repeated patterns and auto-generate skills.

## How It Works

### 1. Operation Logging
Every tool call (Read, Write, Edit, Bash, Grep, Glob) is logged with:
- Timestamp, session ID
- Tool name, input params (truncated)
- Working directory
- Response summary (success/error)

Log location: `~/.claude/tool_logs/operations.jsonl`

### 2. Pattern Analysis
Run periodically or on-demand. Analyzes logs looking for:

**Repeated Sequences**: Same 3+ tool calls in the same order across multiple sessions
- Example: Grep for routes → Read handler → Edit handler → Read bridge → Edit bridge = "add endpoint" pattern

**Frequent File Clusters**: Files always edited together
- Example: brain/index.ts + tools.ts + executor.ts = "add SAGE tool" pattern

**Common Bash Sequences**: Shell commands run in consistent order
- Example: npm run build → fix error → rebuild = "build-fix" pattern

### 3. Skill Generation
For each detected pattern:
1. Compare against existing skills/commands — skip if already covered
2. Extract the common steps as a reusable workflow
3. Identify what varies (parameters) vs what's constant (structure)
4. Generate a SKILL.md or command.md file

### 4. Pattern Output Format
```
### Pattern: <name>
- **Overlap**: [None / Partial with `<skill>` / Fully covered]
- **Recommendation**: [Create new / Update existing / Skip]
- **Frequency**: N sessions
- **Typical steps**: specific operations
- **Parameterizable**: what varies → use $ARGUMENTS
- **Suggested filename**: <name>.md
```

## Manual Trigger
When you notice yourself repeating the same workflow:
1. Document the steps in `.claude/memory/patterns.md`
2. Convert to a skill or command if used 3+ times
3. Skills go in `.claude/skills/{name}/SKILL.md`
4. Commands go in `.claude/commands/{name}.md`

## Ethereal Patterns Already Captured
- **Add SAGE tool**: tools.ts → executor.ts → brain/index.ts
- **Add bridge route**: backend route → ROUTE_MAP → bridge function
- **Mesa dispatch**: create session → add context → dispatch → poll → synthesize
- **Migration**: write SQL → apply to Neon → update schema docs
- **New channel adapter**: adapter file → registry → webhook route → env vars

## Skill vs Command Decision
- **Skill**: Reusable methodology, multiple steps, needs SKILL.md format
- **Command**: Single-trigger action, specific outcome, slash-command format
