> ## 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.

# Local client

> Use the Nika client with its default local transport: the bundled engine as a child process.

## Construct the client

```ts theme={"system"}
import { Nika } from '@supernovae-st/nika'

const nika = new Nika({
  bin: '/opt/nika/bin/nika',
  cwd: '/srv/workflows',
})
```

Both options are optional. Engine resolution is strict: `bin`, then
`NIKA_BIN`, then the platform package npm installed with the SDK
(`@supernovae-st/nika-<os>-<arch>`). `bin` and `NIKA_BIN` must be absolute
paths: a bare name or a relative path throws `NikaConfigurationError`, and a
missing file fails the engine's identity probe with `NikaCompatibilityError`.
A `nika` on your `PATH` is never used. `cwd` anchors relative workflow paths,
project-file discovery and the `.nika/` state directory.

On a platform without a bundled engine (Windows, Alpine or another musl
Linux), `new Nika()` with neither `bin` nor `NIKA_BIN` throws
`NikaEngineUnavailable`. Point `bin` at a compatible engine, or use a
[`nika serve`](https://docs.nika.sh/sdk/remote/serve-quickstart) by URL.

## Probe compatibility with a check

The client has no separate version method: before any operation it probes the
engine's identity (`nika --sdk-identity`) and refuses an engine of another
machine protocol with `NikaCompatibilityError`. Make a real, read-only check
at startup when the application cannot operate without Nika:

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

if (!report.clean) console.error(report)
```

The engine owns the open report shape. Known fields aid TypeScript completion;
future engine fields pass through unchanged.

## Native method boundary

Local mode supports `check`, `compile`, `run`, `run.events()`,
`run.result()`, `run.cancel()` and `traceVerify`. `attachRun`, `run.status()`,
workflow discovery and schedules need a server that owns durable state; on the
local transport they throw `NikaCompatibilityError`.

> [!NOTE]
>
> The client spawns the engine with an argv array (`nika run <file> --json`),
> never through a shell, so a workflow path cannot inject a command. Literal
> `inputs` travel on the engine's standard input, never in argv. The engine
> still enforces permits, secrets, spend and its runtime floor.

> [accordion] Which published source this page describes
>
> > [!NOTE]
> >
> > These pages describe the published `@supernovae-st/nika@0.124.4`
> > [SDK release](https://github.com/supernovae-st/nika-client/tree/v0.124.4) and its matching
> > [bundled engine](https://github.com/supernovae-st/nika/releases/tag/v0.124.4). A newer engine
> > release or SDK main commit does not change an installed package. Use Node.js
> > 22 or newer, on macOS (arm64, x64) or Linux with glibc (x64, arm64); no
> > global Nika installation is required for local mode. Versioned transcripts,
> > recordings and measurements keep the release they were captured on;
> > selecting this package release does not re-run those examples.
>
> > [!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] [Check](https://docs.nika.sh/sdk/local/check-and-plan.md)
>
> Read the engine-owned admission report.

> [card] [Run lifecycle](https://docs.nika.sh/sdk/local/run-and-cancel.md)
>
> Observe, settle and cancel without conflating them.


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