---
name: pearl-distiller
description: Distills a memory pearl from a close-out finding. Creates ~/.claude/projects/-home-jgrusewski-Work-foxhunt/memory/pearl_<topic>.md with structured body and updates MEMORY.md index in the right section. One of only two skills that may write into memory/. Use post-close-out, never proactively.
---

# Foxhunt Pearl Distiller

Authoritative writer for new memory pearls. The other authorized writer is `memory-curator` (which can delete/archive). All other agents and skills are read-only on `memory/`.

## When to invoke

- After SP close-out, when a finding warrants distillation.
- Explicit request: "distill pearl from <topic>".

## Inputs you must collect first

1. **Topic** — short kebab-case identifier (becomes filename: `pearl_<topic>.md`).
2. **One-line description** — for `MEMORY.md` index entry.
3. **Pattern statement** — one paragraph: what was discovered.
4. **Detection signal** — how to recognize this pattern in code or behavior.
5. **Fix** — what to do when the pattern is detected.
6. **Canonical reference** — commit SHA + `path:line` where the pattern was first fixed.
7. **Related pearls** — links to existing pearls.
8. **Section in `MEMORY.md`** — pick from existing sections (Controllers and signals, Bootstrap and smoothing, Architectural constraints, Distributional Q / action selection, Optimization, GPU mechanics, Testing discipline, Spec/plan scoping, Close-out / sweep records, Active Project State).

## What this skill produces

1. **New file** at `~/.claude/projects/-home-jgrusewski-Work-foxhunt/memory/pearl_<topic>.md`:

```markdown
---
name: <topic readable>
description: <one-line; same as MEMORY.md hook>
type: pearl
---

# Pearl: <Topic Readable>

## Pattern

<One paragraph: what was discovered.>

## Detection signal

<How to recognize this in code or runtime behavior.>

## Fix

<What to do when detected.>

## Canonical reference

- Commit: `<SHA>`
- File: `<path>:<line>`
- Spec: `<docs/superpowers/specs/...>`

## Related pearls

- `<related_pearl_1.md>` — <one-sentence relation>
- `<related_pearl_2.md>` — <one-sentence relation>
```

2. **Edit `MEMORY.md`** to add the index line under the right section:

```markdown
- [pearl_<topic>.md](pearl_<topic>.md) — <one-line hook>
```

The line must be ≤150 characters (per the auto-memory rules in the system prompt).

## Discipline

- Only invoke after a close-out doc exists. Do not distill speculative pearls.
- Reuse existing sections in `MEMORY.md`; do not invent a new section without explicit user approval.
- If a similar pearl already exists, ask the user whether to merge instead of creating a new one (delegate to `memory-curator` for merges).
- The pearl content must be specific enough that an auditor agent can cite it by name in a finding.

## After distilling

If the pearl supersedes a prior pearl, mark the old one DEPRECATED in its frontmatter and add a "Superseded by: <new pearl>" note. Do not delete the old pearl — `memory-curator` handles archival.
