> ## Documentation Index
> Fetch the complete documentation index at: https://auto-sop.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Recovery & Maintenance

> Revert directives, repair drift, and purge captured data

# Recovery & Maintenance

## revert

Restore `CLAUDE.md` from the most recent learner backup. Use this if the learner produced a bad directive or if you accidentally modified the managed section.

```bash theme={null}
auto-sop revert [options]
```

### Options

| Option             | Description                                        |
| ------------------ | -------------------------------------------------- |
| `--project <path>` | Project root (default: current directory)          |
| `--dry-run`        | Describe what would happen without modifying files |

### Examples

<CodeGroup>
  ```bash Preview Revert theme={null}
  auto-sop revert --dry-run
  ```

  ```bash Execute Revert theme={null}
  auto-sop revert
  ```
</CodeGroup>

### How Revert Works

The learner creates a backup of `CLAUDE.md` before every write. `revert` restores the most recent backup, effectively undoing the last learner run.

<Note>
  Revert only affects the managed section of `CLAUDE.md`. Any content you've written outside the managed section (above or below the markers) is preserved.
</Note>

***

## repair

Fix managed-section drift deadlock and clean stale state. Use this when `status` or `doctor` reports a hash mismatch or deadlock condition.

```bash theme={null}
auto-sop repair [options]
```

### Options

| Option             | Description                               |
| ------------------ | ----------------------------------------- |
| `--project <path>` | Project root (default: current directory) |

### Example

```bash theme={null}
auto-sop repair
```

### When to Use Repair

* `doctor` reports "managed section hash mismatch"
* The learner refuses to write due to drift detection
* You manually edited content inside the managed section markers
* After resolving a git merge conflict in `CLAUDE.md`

<Tip>
  `repair` recalculates the integrity hash of the managed section, allowing the learner to write again. It does not modify your directives — only fixes the metadata.
</Tip>

***

## purge

Wipe all captured interaction data (project + global) without removing hooks or the scheduler. The next learner run starts from scratch with no history.

```bash theme={null}
auto-sop purge [options]
```

### Options

| Option             | Description                               |
| ------------------ | ----------------------------------------- |
| `--project <path>` | Project root (default: current directory) |
| `--yes`            | Skip confirmation prompt                  |

### Examples

<CodeGroup>
  ```bash Interactive Purge theme={null}
  auto-sop purge
  ```

  ```bash Non-Interactive (Scripts) theme={null}
  auto-sop purge --yes
  ```
</CodeGroup>

<Warning>
  Purge permanently deletes all captured interaction data. Existing directives in `CLAUDE.md` are **not** removed — only the raw captures that feed the learner. This cannot be undone.
</Warning>

### Purge vs. Uninstall

| Action              | Hooks   | Scheduler | Directives | Captures    |
| ------------------- | ------- | --------- | ---------- | ----------- |
| `purge`             | Kept    | Kept      | Kept       | **Deleted** |
| `uninstall`         | Removed | Removed   | Removed    | Kept        |
| `uninstall --purge` | Removed | Removed   | Removed    | **Deleted** |
