AGPL-3.0-or-later · forever.

project roots · live

CWD is an operational decision.

Align the process room, discovered project file, workflow paths and runtime state before a monorepo creates two invisible roots.

Project policy discovery walks upward. Direct-run trace storage does not. Set LocalNika cwd to the intended project root when one control plane and one evidence well are the goal.

Discovery and storage answer different questions.

The engine can discover an ancestor nika.yaml while a direct run still writes its trace under the process working directory. The arm and serve paths deliberately enter the discovered project root before firing, so their ledger and triggered-run traces live together there.

/repo/apps/api/                 LocalNika cwd
├── .nika/traces/              direct-run receipts
└── ↑ discover
    /repo/nika.yaml             governing project
    /repo/.nika/arm/            firing ledger
    /repo/.nika/traces/         arm / serve run receipts

Use the project root as the process room.

A root-aligned cwd gives relative workflow paths, project discovery, direct traces and armed state one explainable home. Resolve the absolute directory once at application startup.

import { fileURLToPath } from 'node:url'
import { LocalNika } from '@supernovae-st/nika-client/local'

const projectRoot = fileURLToPath(new URL('../../', import.meta.url))

export const nika = new LocalNika({ cwd: projectRoot })

await nika.runToEnd('workflows/release.nika.yaml')

A nested nika.yaml is a real boundary.

The first file found wins. Put a second nika.yaml under apps/api only when that service must have its own ceiling or project profile. Do not add one merely to shorten a path because it also changes which policy the engine applies.

/repo/nika.yaml                  platform project
└── apps/
    ├── api/nika.yaml           API project boundary
    │   └── workflows/
    └── worker/                 inherits /repo/nika.yaml

Probe from the same room as production.

Run the report and trace listing with the exact working directory the service will use. A clean command from the repository root does not prove a nested deployment uses the same project or evidence store.

cd /srv/nika/project
nika arm
nika trace ls
nika serve --dry