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

# Project runtime state

> Persist run traces, firing ledgers, receipts and cadence watermarks deliberately.

> [!NOTE]
>
> **Live project control plane.** The released engine
> discovers `nika.yaml` from the working directory toward its
> ancestors. The file is optional when built-in defaults are enough. Its
> project-shape grammar is closed: `nika` ·
> `ceiling` · `arm` · `traces` ·
> `registry`. Direct runs and the cadence path
> (`nika arm` · `nika serve`) read the same file.

Source describes intent. `.nika/` records what the machine did. A production
deployment should choose storage and retention for that distinction before it
runs its first armed beat.

## State map

The unified tree below assumes the recommended setup: direct processes use the
project root as `cwd`.

PROJECT STATE · TWO JOURNALS, TWO QUESTIONS

<pre tabIndex="0">
  \<project>/.nika/
  &#x20;   ├── traces/
  &#x20;   │   └── \<run>.ndjson             what happened inside a workflow run?
  &#x20;   └── arm/
  &#x20;     └── \<label>/                 what happened at the project clock?
  &#x20;         ├── history.ndjson       claims · skips · receipts
  &#x20;         ├── last.json            latest slot-bearing decision
  &#x20;         ├── watermark            latest recorded slot
  &#x20;         └── ledger.lock          transient append lock
</pre>

## Verify a run trace through the SDK

```ts theme={"system"}
const run = await nika.run('workflows/release.nika')
const result = await run.result()

if (!result.receipt) throw new Error('run did not issue a receipt')

const verdict = await nika.traceVerify(result.receipt)

if (!verdict.verified) {
  throw new Error(verdict.output ?? verdict.reason ?? 'verification failed')
}

console.log(verdict.verdict, verdict.trace_id, verdict.exitCode)
```

The SDK returns the engine-issued receipt to the engine for verification. It
does not accept a trace path or inspect the journal in TypeScript. `nika arm`
reads the arming sidecar. They are related evidence, but they are not
interchangeable.

## Persist the clock on servers

A resident server or OS unit needs a durable project state path. If a
container discards `.nika/` on restart, it also discards recent traces and the
watermark used to reason about missed slots.

> [!WARNING]
>
> The firing contract is at-least-once. A crash after a durable claim and
> before its receipt leaves an unmatched claim in `history.ndjson`. Keep
> external effects idempotent when a repeated fire must be harmless.

## Source-control boundary

```text .gitignore theme={"system"}
.nika/
.env
```

`.nika/` also holds `nika serve` job state (`.nika/serve/`) and, when you
serve over HTTP, the bearer token (`.nika/serve.token`): never commit it.

Ignoring live state does not mean deleting it on deployment. Mount, back up or
export it according to the workload's evidence and retention policy.

## Evidence lifecycle

```text theme={"system"}
project source ── review ── deploy
                               │
                               ├── arm claim
                               ├── run trace
                               ├── arm receipt
                               └── selected evidence export
```

Export evidence deliberately. Do not turn the entire state directory into a
public application artifact.

## Continue

> [card] [Receipts and replay](https://docs.nika.sh/sdk/runtime/receipts.md)
>
> Verify and replay the workflow journal.

> [card] [Resident server](https://docs.nika.sh/sdk/operations/resident-server.md)
>
> Operate the process that writes arming state.

> [card] [Arm registry](https://docs.nika.sh/sdk/project/arm-registry.md)
>
> Understand what the ledger is proving.

> [card] [CWD and monorepos](https://docs.nika.sh/sdk/project/cwd-and-monorepos.md)
>
> See exactly which root owns each state lane.

> [card] [Trace concepts](https://docs.nika.sh/concepts/traces.md)
>
> The durable run journal and its integrity chain.


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