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

# NIIA CLI Overview

> NIIA 0.9.50 — self-drive modes and one evidence surface across AI CLIs, code, documents, terminals, MCP, and machines.

# NIIA CLI

NIIA is the continuity and integration layer of Monolex. It remembers work across AI CLIs, joins code/document/git intelligence, and provides guarded entrances to terminal sessions, MCP services, remote machines, and the operating system.

*Documents NIIA 0.9.50.*

## NIIA is beside the models

NIIA does not replace Claude Code, Codex, Grok, OpenCode, Gemini, or agy. Each tool keeps its own provider, subscription, interface, and session format. NIIA reads the durable artifacts those tools leave behind and can drive their real terminal sessions through the Monolex PTY surface.

```text theme={null}
Claude  Codex  Grok  OpenCode  Gemini  agy
   \      |      |       |       |      /
    \──── local sessions and transcripts ────/
                         │
                         ▼
                       NIIA
                         │
        recall · search · compare · continue
```

Closing NIIA does not make the provider CLIs stop working. Closing one provider CLI does not erase the session evidence NIIA has already indexed.

## Four planes

| Plane         | User question                                               | Primary commands                                                   |
| ------------- | ----------------------------------------------------------- | ------------------------------------------------------------------ |
| Memory        | “What was I doing, and what did another model decide?”      | `niia recall`, `niia session`, `niia search`                       |
| Intelligence  | “Where is this in code, docs, or git, and what is missing?” | `niia docs`, `niia code`, `niia git`, `niia insights`, `niia gaps` |
| Orchestration | “Can I drive and assert a real terminal workflow?”          | `niia health`, `niia ask`, `niia step`, `niia scenario`            |
| Embodiment    | “Can I reach the OS, MCP, or another machine safely?”       | `niia observe`, `niia control`, `niia mcp`, `niia remote`          |

## The Mono stack

```text theme={null}
NIIA             identity · recall · orchestration · authorization
  ↕
Work Wiki        knowledge state and convergence
  ↕
Monoflow         temporal and cross-database analysis
  ↕
Monogram         Monogit          Monomento
code             git              documents
```

NIIA calls each layer through its public contract. For example, `niia code context` uses [Monogram](/ai-clis/monogram/overview), cross-database insight and drill commands compose [Monoflow](/ai-clis/monoflow), and `niia convergence` reaches the knowledge coverage owned by [Work Wiki](/ai-clis/work-wiki). The standalone CLIs expose their complete command and storage boundaries.

## A normal work entry

```bash theme={null}
niia where
niia recall
niia status
niia doctor
niia search "current feature"
```

For non-trivial work, NIIA's entry discipline asks you to match process to uncertainty:

| Work shape                                    | Entry                                             |
| --------------------------------------------- | ------------------------------------------------- |
| Named, additive, low risk                     | Act directly                                      |
| Existing structure would be touched           | Prepare against the real code first               |
| Wide or unknown design space                  | Research before planning                          |
| A safety or correctness claim must be trusted | Prove the claim against code and runtime evidence |

The doctrine itself is queryable:

```bash theme={null}
niia consciousness "entry discipline"
```

NIIA 0.9.50 can carry that doctrine as a report-only bracket. Choose first
whether the machine or the user invokes the work-entry verbs:

```text theme={null}
                    default · strict · quiet
                              │
                              ▼
AUTO ── prompt hooks ──▶ gauge ──▶ work ──▶ finish ──▶ audit
MANUAL ────────────────────▲       same verbs, invoked by you
```

```bash theme={null}
niia mode                          # current hook and routing state
niia mode auto                     # machine-carried entry discipline
niia mode manual                   # remove only NIIA hooks
niia mode preset strict            # announce every prompt rung
niia mode preset quiet             # keep witness/audit, reduce injection
```

The mode switch preserves foreign hooks and unrelated settings. A custom
routing table is backed up before a preset replaces it.

```bash theme={null}
niia gauge "change the existing session ownership path"
niia gauge --transcript ./adhoc.jsonl "audit an ad-hoc run"
# Follow the emitted [NEXT] chain; re-gauge if the task changes shape.
niia gauge --re "the fix also changes the public protocol"
niia finish
niia audit-entry
```

`gauge` writes the selected rung, signals, promise, and append-only history to a
session witness. Only a hook-carried session id may move the atomic `current`
pointer; an explicit CLI `--session` witness cannot steal it. `finish`
re-presents that promise and writes the close witness; `audit-entry` reports
only against what the machine-gauged session promised. None of these commands
gates the user. Hook-internal errors remain visible in
`~/.niia/hook-error.log` without blocking the prompt. `doctor` separately
checks the databases, the watcher's dirty-index verdict, all three hook lanes,
and the witness path using metadata rather than a corpus scan. See the
[complete command map](/niia-cli/commands#work-entry-self-drive)
for options, storage paths, thresholds, and the current Codex-audit limitation.

## Memory across AI CLIs

```bash theme={null}
niia session list -n 5
niia session read latest --tool codex --full
niia index --sessions
niia session search "PTY ordering"
```

Reading a known session and searching the indexed session corpus are different operations. `session read` works from a provider's discovered session source; `session search` queries the explicit session index.

## Real terminal orchestration

```bash theme={null}
niia health
niia ask --session <ID> "run cargo check"
niia follow-up --session <ID> "summarize the errors" --expect-last "Finished"
```

NIIA drives the interactive CLI that is already running in a PTY. It does not substitute an API call or hide a provider-specific transcript behind a generic chat wrapper.

Two answer readers exist because two truths can differ:

* `niia get-answer` reads the rendered terminal screen.
* `niia get-answer-system` parses the provider's own transcript or output file.

## MCP in both directions

```text theme={null}
MCP service ── niia mcp-run ──▶ ordinary CLI output
ordinary CLI ─ niia mcp-serve ─▶ typed MCP tools
NIIA itself ── niia mcp ──────▶ 109 generated / 110 live tools
```

The supported NIIA MCP server is `niia mcp`. The retired standalone `rust-niia-mcp` binary is not the current registration target.

## OS and remote ownership

NIIA owns the authorization and routing boundary, not every operation body:

* `niia observe` and `niia control` gate and forward OS work to [Kernel CLI](/kernel-cli).
* `niia serve`, `daemon`, `devices`, `remote`, and `mailbox` forward to Monosystem, the current transport owner.
* [MonoSurf](/monosurf/index) owns browser-page DOM and session automation; Kernel CLI owns the native UI outside the page.

## Install

```bash theme={null}
curl -fsSL https://openclis.com/install.sh | sh
openclis install niia
niia --version
niia setup --dry-run
niia setup
```

`niia setup` is drift-aware: locally evolved files are preserved unless destructive replacement is explicitly requested.

On Unix, `niia setup use openclis` selects OpenCLIs with a symlink from
`~/.niia/bin/niia` to `~/.openclis/bin/niia`; later updates follow the link.
`setup use monolex` installs a regular copy instead. On Windows, the OpenCLIs
selector copies the executable, so invoke it from the newly updated OpenCLIs
path whenever the PATH-facing copy must be refreshed:

```powershell theme={null}
& "$HOME\.openclis\bin\niia.exe" setup use openclis
Get-Command niia
niia --version
```

That copies the released `niia.exe` to `$HOME\.niia\bin\niia.exe`. Version
0.9.50 writes no `.niia-source` marker, and its status detector classifies a
regular Windows copy as `monolex`; verify the selected payload with
`Get-Command niia` and `niia --version`.

## Next pages

<CardGroup cols={2}>
  <Card title="Complete commands" href="/niia-cli/commands">
    The 63 top-level commands and all MCP-visible nested operations.
  </Card>

  <Card title="AI sessions" href="/niia-cli/sessions">
    Provider formats, indexing, reading, searching, and PTY continuation.
  </Card>

  <Card title="Consciousness core" href="/niia-cli/consciousness">
    The 27-document embedded core and its graph navigation commands.
  </Card>

  <Card title="Security model" href="/niia-cli/security">
    Trust, unlock scopes, MCP failures, remote restrictions, and ownership.
  </Card>
</CardGroup>
