---
name: augment-decoction
description: Distill recurring cross-project Augment memory into generic SPEC/ARCH records and optionally remove fully subsumed originals from Pi. Use when the user asks to "decoct", "glean", generalize, or clean up repeated memories across projects.
---

# Augment Decoction for Pi

Decoction extracts durable, project-independent knowledge from recurring
memories. It is separate from sleep: sleep consolidates settled work within one
project, while decoction finds patterns across projects and writes them under
`.generic/`.

1. Call `augment_decoction_glean` with `action: "discover"`. If no cluster
   spans at least four distinct projects, report that and stop.
2. Pick a cluster and call `augment_read_memory` for every source. Synthesize
   one generic record:
   - use SPEC for a reusable contract or rule;
   - use ARCH for a reusable decision or tradeoff;
   - retain only claims supported across the projects;
   - put every source used in `derived_from`.
3. Suggest source removal only when the generic preserves the original's entire
   durable content. Do not suggest a source that also contains project-specific
   facts, history, caveats, or unresolved work.
4. Call `augment_decoction_glean` with `action: "write"`, the complete draft,
   and the reasoned `suggested_removals`. For an existing generic, read it fresh
   and pass both of its expected hashes.
5. Report the generic path and any warnings. Warnings are advisory and do not
   block the write.
6. Show each suggested cleanup path and reason verbatim. Ask for explicit user
   approval of the exact paths; never infer approval from approval of the
   generic itself.
7. Only after approval, call `augment_decoction_cleanup` with the generic path
   and the approved source paths. Report every deletion and any failure.

Cleanup hard-deletes the selected originals after retargeting inbound links to
the generic. It has no journal or rollback. The user may approve a subset or
decline cleanup entirely.
