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

# @parmana/replay

> Genuinely re-evaluates a recorded policy decision against its recorded signals. Real, tested, and disconnected from packages/api and packages/runtime.

<Info>**\[PARTIAL]**. Real semantic re-evaluation, for one execution at a time, not reachable from `POST /replay` or any other route. See [Replay](/replay/overview) for the full disambiguation from the unrelated `POST /replay` route.</Info>

## Purpose

Re-runs `PolicyEngine.evaluate()` against a trust record's recorded signals and compares
the outcome to what was originally decided, this is genuine semantic verification, not a
signature or hash recheck.

## Install

```bash theme={null}
npm install @parmana/replay
```

## Key exports

| Export                                           | Stability                                                                                                                                                               |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ReplayEngine`                                   | \[PARTIAL]. `.replay(input: ReplayInput): ReplayResult`. Real `PolicyEngine` re-evaluation, scoped to `trustRecord.executions[0]`, one execution, not the whole record. |
| `ReplayBuilder`                                  | \[AVAILABLE]. `.build(): ReplayEngine`                                                                                                                                  |
| `ReplayVerifier`                                 | \[AVAILABLE]. `.verify(original, replayed): boolean`, deep-equality via `JSON.stringify` comparison                                                                     |
| `ReplayPipeline`, `ReplayExecutor`, `ReplayPlan` | \[AVAILABLE]. Build and run a multi-step replay plan from recorded execution IDs                                                                                        |
| `ReplayContext`                                  | Per-replay context                                                                                                                                                      |
| `ReplayError`                                    | Thrown on an invalid or incomplete trust record                                                                                                                         |

## `ReplayResult` shape

```typescript theme={null}
interface ReplayResult {
  recordedDecision: Decision;
  replayedDecision: Decision;
  matches: boolean;        // recordedDecision.outcome === replayedDecision.outcome
  replayedAt: string;
}
```

## Minimal example

```typescript theme={null}
import { ReplayEngine } from "@parmana/replay";

const engine = new ReplayEngine();
const result = engine.replay({ trustRecord, transaction, policy });
// result.matches === true if the recorded and re-evaluated outcomes agree
```

Full runnable version: `examples/tutorials/06-replay/run.ts`.

<Warning>
  **Not reachable from the server.** Confirmed by grep: nothing in `packages/api` or
  `packages/runtime` imports `@parmana/replay`. `POST /replay` is an unrelated route, a
  signature recheck via `ExecutionTrustApplication.replay()`, see
  [Endpoints](/api-reference/endpoints). Don't assume calling the HTTP route exercises this
  package.
</Warning>

## Next

<CardGroup cols={2}>
  <Card title="Replay" icon="rotate" href="/replay/overview">
    The full disambiguation between this package and the unrelated HTTP route.
  </Card>

  <Card title="Policies and the decision" icon="scale-balanced" href="/concepts/policies-and-the-decision">
    The `PolicyEngine` this package re-invokes.
  </Card>
</CardGroup>
