# CLI reference

> Every kernuq subcommand and flag, plus the agent-first conventions — --json, --dry-run and the progressive manual.

Every subcommand speaks `--json`; every write supports `--dry-run`. Errors are written to stderr as structured JSON: `{"error":{"code":…,"message":…}}`.

## Introspection

| Command | Purpose |
| --- | --- |
| `kernuq version` | Print the version |
| `kernuq manual [topic]` | Progressive manual; without a topic prints a < 2 KB index |
| `kernuq schema <kind>` | Print a formal JSON Schema |
| `kernuq skill-export [--dir <path>] [--json]` | Generate an Agent Skills `SKILL.md` |
| `kernuq probe [--json]` | Host and kernel probe |

Manual topics: `quickstart`, `uri-vfs`, `harness`, `formation`, `sdui-lowcode`, `widget-sandbox`, `admin-crud`, `security-boundaries`.

Schema kinds: `harness`, `formation`, `compute`, `resource-catalog`, `event`, `hypertext-input`, `sdui`, `ui-widget`.

## Config and data

```bash
kernuq validate --config <file> [--conf-dir <dir>] [--dry-run=true] [--json]
kernuq import   --config <file> [--conf-dir <dir>] [--db <path>] [--dry-run] [--json]
kernuq export   [--db ~/.kernuq/data/kernuq.db] [--dir ./exported-bundle] [--json]
```

YAML is the seed; SQLite is the runtime single source of truth. `export` writes the current state as a GitOps bundle.

## Run

```bash
kernuq serve --config <file> [--db <path>] [--bind 127.0.0.1:7680] [--ui]
```

`--ui` mounts the embedded SDUI console.

## Agent interop

```bash
kernuq mcp-serve [--db <path>] [--profile builder] [--batch-id <id>]
```

Runs a stdio MCP server. `--profile` is one of `observer`, `ui_co_designer`, `builder`, `operator`; every write in the process shares `--batch-id` for atomic rollback.

```bash
kernuq agent-host --node-id <id> --owner-unit <org-uri> --master-ws <ws-url> \
  --wrap claude --workspace ./workspace [--token $KERNUQ_ACP_HOST_TOKEN]
```

Wraps a local CLI agent as an ACP node that reverse-registers with the master; `--workspace` is the directory jail it may access.
