---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/orchestration/raw/functions/rawDiff.md
---

# Function: rawDiff()

```ts
function rawDiff(
  store: PlanStore,
  planId: string,
  a: number | "current",
  b: number | "current",
): Promise<PlanDiff>;
```

Defined in: [src/batteries/orchestration/raw.ts:119](https://github.com/NHTIO/ADK/blob/v1.20260906.0/src/src/batteries/orchestration/raw.ts#L119)

A STRUCTURAL delta between two folded states of a plan.

## Parameters

| Parameter | Type                                         | Description                                        |
| --------- | -------------------------------------------- | -------------------------------------------------- |
| `store`   | [`PlanStore`](../../interfaces/PlanStore.md) | The plan store to read from.                       |
| `planId`  | `string`                                     | The plan to diff.                                  |
| `a`       | `number` | `"current"`                      | The "from" side: a revision number or `'current'`. |
| `b`       | `number` | `"current"`                      | The "to" side: a revision number or `'current'`.   |

## Returns

`Promise`<[`PlanDiff`](../../types/interfaces/PlanDiff.md)>

The structural delta between the two folded states.

## Remarks

`rawDiff(a, b)` compares two folded states, NOT an event log. It resolves each side to a
revision (`'current'` means the plan's present revision), folds both prefixes, and compares the
resulting content structurally:

* `nodesAdded` / `nodesRemoved` are keyed by node id.
* `nodesChanged` names the CHANGED FIELD PATHS with before/after values, typed `ArgValue` — a
  changed field may hold a `NodeRef`, so a narrower type would make a legitimate change
  unrepresentable.
* `edgesAdded` / `edgesRemoved` are keyed by edge id; an edge whose endpoints or handle changed
  counts as removed-then-added, since its identity is its id.
* Both digests are carried so a UI can label either side.

Because this is a FINAL-STATE diff, a node edited and then reverted across the compared span
produces NO row — the two states are identical at that node, and there is nothing to report.
