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

# Function: rawPlan()

```ts
function rawPlan(
  store: PlanStore,
  planId: string,
  opts?: {
    revision?: number;
  },
): Promise<RawPlanView>;
```

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

Fold the plan's op log up to a revision into a `RawPlanView`.

## Parameters

| Parameter        | Type                                         | Description                                                                   |
| ---------------- | -------------------------------------------- | ----------------------------------------------------------------------------- |
| `store`          | [`PlanStore`](../../interfaces/PlanStore.md) | The plan store to read from.                                                  |
| `planId`         | `string`                                     | The plan to read.                                                             |
| `opts?`          | { `revision?`: `number`; }                 | Optional revision selector.                                                   |
| `opts.revision?` | `number`                                     | Fold only the op prefix through this revision. Omitted folds the present log. |

## Returns

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

The folded content view at the requested revision.

## Remarks

The plan IS the fold of its op log, so this is the canonical way to read plan CONTENT. With no
`revision`, it folds the plan's present log. With `{revision: N}`, it serves a HISTORICAL view:
it reads the op prefix `throughRevision: N` and folds exactly that prefix, so the result is
what the content looked like at revision N. A revision the log never reached is REJECTED by
the store (which throws rather than silently returning everything) — this function never
guesses or truncates.

`provenance` (clone/template lineage) is read from `store.readProvenance(planId)` and carried
into the view, where it is covered by the digest.

The returned view carries NO lifecycle `state` — see the module doc. `state` is a property of
the plan NOW and lives on `store.readState()`, not here.
