Skip to main content

Commands

This reference documents NIIA 0.9.41, the current OpenCLIs release. Bare niia prints the packaged guide plus live status; niia --help is the CLI inventory and niia --mcp-schema is the generated CLI-to-MCP contract. All five published platform fragments carry the current command and guide surface.

Surface counts

The counts intentionally differ. Login, setup, recursive MCP management, blocking automation, and similar lifecycle operations are CLI commands without a generated MCP tool. See the release matrix for immutable platform and payload proof.

Install and identity

All 62 top-level commands

Memory, intelligence, and configuration

MCP

Terminal sessions and automation

OS, transport, and identity

Work-entry self-drive

The four self-drive commands carry the entry discipline as observable session state. They advise, record, and report; they do not seize control from the user or turn a missing step into a command gate.

niia gauge [OPTIONS] [TASK]...

gauge combines prompt signals with the deployed ~/.niia/routing.toml and records the verdict in gauge.json. An explicit --rung is sovereign: the user’s TRIVIAL, MODERATE, HIGH, or CLAIM choice wins. Destructive or live-surface words still emit [CONSENT], and any fan-out recommendation is a proposal rather than authorization. --hook reads a Claude Code or Codex hook event from stdin. Hook modes keep exit zero on internal failure while recording stderr and ~/.niia/hook-error.log. --session-start arms the ladder or restores the recorded bracket after compaction. --static prints the generic ladder without signal probes. --re <reason> records an ESCALATE or DE-ESCALATE history event, and --session <id> selects the witness explicitly. --transcript <path> supplies the transcript for an ad-hoc or benchmark run when hook stdin did not provide one; this unblocks the promise-derived audit without copying the transcript into gauge.json.
Put every gauge option before TASK. Because task text is a trailing positional, tokens after it are task text, not flags.
Inside a Git worktree, witnesses live under <repo>/.niia/session-order/<session>/; outside Git they live under ~/.niia/session-order/<cwd-hash>/<session>/. The directory contains gauge.json. History is append-only, including across silent side lanes. Only a session id carried by hook stdin may atomically move current; CLI --session, ad-hoc, and static verification runs cannot retarget the live session pointer.

niia finish [--session <id>]

finish reprints the rung, re-gauge history, and every promised [NEXT] step. When the promise included a Monogram sequence, it reports the newest sequence phase and calls an unfinished phase UNMET. HIGH work also receives the open-FINDINGS reminder. The command then writes finish.json and points to audit-entry; it records and re-presents unmet work but never blocks closing.

niia audit-entry [--session <id>] [--hook]

The audit judges only the machine-gauged promise for this session. Depending on the rung, it checks that the injected contract reached the transcript before the first product edit, evidence preceded editing, HIGH research preceded the build, CLAIM work contains proof, and no product mutation followed finish. Re-gauge escalation is recorded as an event, never a violation. Results go to audit-report.json; --hook stays silent. The current transcript reader supports Claude JSONL and ad-hoc witnesses. Codex transcript audit is deliberately SUSPENDED until its reader ships; that is an explicit unverified boundary, not a passing verdict.

niia doctor

doctor is a metadata-only, sub-second estate check. It uses the newest of a SQLite database and its WAL/SHM sidecars. For dirty indexing it prefers the watcher’s own verdict, otherwise reads only the final 64 KiB of the launchd driver log and detects repeated deferral. It checks the routing registry, UserPromptSubmit, SessionStart, SessionEnd, recent hook errors, the fallback flag, and witness-directory writability. Database-family ages below 24 hours are OK, 24–72 hours are WARN, and 72 hours or more are RED. Every warning or failure row carries its own [NEXT] recovery command. It does not scan or rewrite an index; the sole write is a temporary .doctor-probe created and removed inside the witness directory to prove that the directory is writable.

Search, index, and analysis

niia index --dirty consumes watcher events into the participating document, code, git, and knowledge indexes. Registration catch-up can still refresh a project root when no event is pending; a failed lane keeps its cursor for retry rather than pretending the event was consumed.

Document commands

Code commands

niia code is the integrated Monogram surface. Use standalone Monogram for region ranking, coupling, format traces, deep semantics, and possibility bands.

Git commands

Session commands

See AI sessions for the provider and PTY boundaries.

Consciousness and Monograph

Skill reconciliation

Setup preserves locally evolved files by default. Destructive replacement requires an explicit force choice. setup use owns only the PATH-facing NIIA selector. On Unix, OpenCLIs uses a symlink to ~/.openclis/bin/niia; on Windows it copies niia.exe to %USERPROFILE%\.niia\bin\niia.exe. Version 0.9.41 writes no ownership marker: the Unix status detector recognizes the OpenCLIs symlink target, while the Windows regular copy is reported as monolex. Invoke the newly installed OpenCLIs executable after a Windows update when that PATH-facing copy must be refreshed:

MCP commands

MCP service to CLI

Use _help and _help:<tool> for service/schema help. --help is the NIIA command’s own Clap help and is not a wrapped tool lookup.

CLI to MCP

The generic bridge uses <tool> --mcp-schema when present; otherwise it exposes one passthrough tool returning the CLI’s raw output.

Persistent sessions

MCP isError, JSON-RPC, transport, quota denial, authentication, and REST failures exit non-zero. With --json, an MCP isError payload remains on stdout before the non-zero exit.

Terminal driving

Use \r, not \n, as Enter for raw-mode terminal applications.

Assertions and scenarios

Timeouts and failed guards return non-zero. niia get-answer reads the live rendered screen; niia get-answer-system reads a provider-owned transcript. Choose the evidence source that owns the answer you need.

Scheduling and pipelines

With --new, NIIA delegates session startup to Monosystem. It does not forward JWT or policy secrets through child arguments or environment variables.

Observe commands

Other read-only Kernel CLI commands can pass through niia observe. NIIA rejects write commands on this entrance.

Control commands

Other write-capable Kernel CLI operations pass through niia control only after the correct NIIA grant exists. control act --dry-run resolves and reports the planned action without actuating it.

Remote and transport

The transport commands are first-class NIIA names but are currently owned by Monosystem:
Do not use diagnostic exec as a general remote shell. That restriction is an intentional security boundary.
  • Monogram owns deep code intelligence.
  • Kernel CLI owns native OS observation and action bodies.
  • MonoSurf owns CDP-visible web-page automation.
  • Security model explains the gates shared by these surfaces.