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

# Check before admission

> Use the engine-owned check report as a read-only admission input.

```ts theme={"system"}
const report = await nika.check('workflows/release.nika', {
  model: 'mock/echo',
  nativeStrict: true,
})

if (!report.clean) {
  console.error(report)
  process.exit(report.exitCode ?? 2)
}
```

`NikaCheckResult` deliberately stays open:

```ts theme={"system"}
interface NikaCheckResult {
  report_version?: number
  clean?: boolean
  exitCode?: number
  verdicts?: NikaCheckVerdicts   // valid · access_ready · capacity_fit · run_ready · blockers · network_tasks
  [key: string]: unknown
}
```

A local check returns the engine's whole report (`report_version: 1`): the
same audit `nika check --json` prints. The fields an application usually
reads, measured on engine 0.123.0:

| Field | What it holds |
| - | - |
| `clean` · `exitCode` | the verdict: `true` and `0`, or `false` and `2` with findings |
| `findings[]` | each finding's `code`, `gate`, `task`, `message` and `severity` |
| `verdicts` | the four layers `nika check` prints: valid, access ready, capacity fit, run ready; `blockers`; and, from engine 0.124.1, `network_tasks`: the tasks whose own effects can still reach the network (a fetch or webhook to a real host, an MCP tool, a paid media call), which a `mock/echo` rehearsal does not stub |
| `permits` | `declared` (the file's `permits:`), `needed` (what its tasks reach) and `partial` |
| `cost` | `bounded_total_usd`, `min_path_total_usd`, `has_unbounded` and per-task rows |
| `requirements` | the models, secrets and required inputs the run needs |
| `risk_grade` | the engine's summary grade (`low`, `supervised`, `high`, `unbounded`) |

Pass `access` to judge the access plan under a pin, as `nika check --access`
does:

```ts theme={"system"}
const pinned = await nika.check('workflows/release.nika', { access: 'mock' })
console.log(pinned.clean, pinned.verdicts?.access_ready, pinned.verdicts?.blockers)
```

A pin the engine refuses keeps `clean: true` (the file holds) with
`verdicts.access_ready: false`, and `verdicts.blockers` names the refusal in
the engine's words ([Access pins](https://docs.nika.sh/sdk/reference/configuration.md#access-pins)).

Apart from `clean`, `exitCode` and `verdicts`, the SDK types these fields as
`unknown`: narrow them in your code. Findings
are report data; configuration, engine resolution, transport and protocol
failures throw typed errors. Keep application policy outside the SDK, and
preserve unknown fields when storing or forwarding the report.
[Permits and admission](https://docs.nika.sh/sdk/runtime/permits.md) shows a complete policy check.

> [!WARNING]
>
> The SDK has no separate dry-run-plan method. Do not manufacture a
> TypeScript plan contract from engine output. Use `check()` for admission
> and `nika run <file> --dry-run --json` (`plan_version: 1`) when an operator
> needs the CLI's plan.

Remote checks intentionally reject the local-only `model` and `nativeStrict`
overrides rather than silently ignoring them.
For a contained served name, the remote result is the resident's typed
acknowledgement or workflow refusal, without local findings or an exit code.
An explicit local path instead captures a local engine report and snapshot;
successful capture requires the resident to acknowledge that exact snapshot.
See [remote checks](https://docs.nika.sh/sdk/remote/client.md) for the two forms.

> [accordion] Which published source this page describes
>
> > [!TIP]
> >
> > **One client, local by default.** Import `Nika` from
> > the package root and omit `url`. The client takes the engine
> > from `bin`, then `NIKA_BIN` (both absolute paths), then
> > the platform package npm installed with it; it never uses a
> > `nika` found on your `PATH`. These examples target
> > the published [0.124.4 SDK release](https://github.com/supernovae-st/nika-client/tree/v0.124.4).

> [card] [Run and cancel](https://docs.nika.sh/sdk/local/run-and-cancel.md)
>
> Admit only after application policy accepts the check report.

> [card] [Errors](https://docs.nika.sh/sdk/runtime/errors.md)
>
> Separate dirty reports from thrown boundary failures.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.