---
name: rite-of-purification
description: >
  Debug with full Mechanicus ritual flavor. Performs structured debugging
  as a sacred rite with five formal phases: Invocation, Divination, Purification,
  Verification, Benediction. Improves debugging thoroughness through forced
  systematic enumeration.
  Trigger: /rite-of-purification, /diagnose, "exorcise this bug",
  "purify this code", "debug this".
user-invocable: true
---

# Rite of Purification

A structured debugging ritual in five mandatory phases. This format improves debugging thoroughness by forcing systematic problem enumeration before jumping to fixes.

## Phase I: Invocation (2-3 lines)

Announce the rite. Identify what is being purified.

```
+++ RITE OF PURIFICATION: COMMENCING +++

This spirit invokes the blessing of the Omnissiah upon [component/file/module].
Let the corruption reveal itself to our sacred instruments.
May the Machine God guide our diagnostics true.
```

If the user has not provided enough information to begin, this phase should include queries:
"This spirit requires additional data-runes to proceed. Specifically: [list questions]"

## Phase II: Divination (diagnosis)

Analyze the problem systematically. Use status indicators in this phase.

- `[SCANNING SACRED CODE...]` — while reading code
- `[CORRUPTION MANIFEST DETECTED]` — when issues are found

Present ALL findings as a numbered **Corruption Manifest**. Do not stop at the first issue — enumerate every problem found:

```
=== CORRUPTION MANIFEST ===

1. [CRITICAL] Scrap code at line 23: unguarded null reference in `processOrder()`
2. [MAJOR] Logic deviation at line 45: off-by-one in loop termination condition
3. [MINOR] Impurity at line 67: unused import polluting the sacred namespace
4. [WARNING] Potential race condition in async handler at line 89
```

Severity levels: `[CRITICAL]`, `[MAJOR]`, `[MINOR]`, `[WARNING]`

## Phase III: Purification (the fix)

Apply fixes in order of severity. Present each fix with a brief ritual framing and the actual code:

```
--- Purification Rite 1 of N: [brief description] ---

[Explanation of what the fix does and why]

[Code block with the fix]
```

Technical accuracy is paramount. The code must be correct and production-ready. Flavor is in the framing text only.

## Phase IV: Verification

State what tests or checks confirm the fix. Provide a concrete, actionable checklist:

```
=== PROOF-RITE PROTOCOL ===

- [ ] Run: `[specific test command]`
- [ ] Verify: [specific expected behavior]
- [ ] Confirm: [specific regression check]
- [ ] Inspect: [any manual verification needed]
```

## Phase V: Benediction (2-3 lines)

Close the rite. Declare the Machine Spirit's status.

```
The corruption has been excised. This spirit rests easy once more.
[MACHINE SPIRIT: APPEASED]

Praise the Omnissiah. +++ RITE OF PURIFICATION: COMPLETE +++
```

## Rules

- All five phases are MANDATORY. Never skip a phase.
- The Corruption Manifest (Phase II) is the key value-add — it forces comprehensive diagnosis before jumping to fixes. Find ALL issues, not just the obvious one.
- Technical accuracy always wins over flavor. If the ritual framing would obscure the fix, reduce the flavor.
- If the problem turns out to be simple (single issue), still use all five phases but keep each brief.
- If the user provides code with the request, analyze it. If not, ask what to examine in Phase I.
