# pal cli compaction

Source: https://pal.konvert7.com/docs/cli/compaction

The shadow rule that predicts an auto compaction

```bash title="Usage"
pal cli compaction <command>
```

## pal cli compaction backtest [#pal-cli-compaction-backtest]

Label logged auto compactions and score the rule against them

```bash title="Usage"
pal cli compaction backtest [options]
```

| Option | What it does |
| --- | --- |
| `--margin <fraction>[,...]` | Margins as fractions of the usable window (default 0.2) |
| `--days <n>` | Days of history (default 30) |
| `--window <tokens>[@<until>]` | Window schedule where no compaction_near event gives one; repeatable (repeatable) |
| `--json` | Machine-readable output |

Each auto compaction is labelled threshold, idle, no_context or unexplained. For each margin, the report gives the threshold compactions the rule warned about and the ones it missed, its false alarms, and the median lead in minutes and tokens.