> For the complete documentation index, see [llms.txt](https://kerno.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kerno.gitbook.io/docs/references/kerno-cli.md).

# Kerno CLI

### Install

The CLI is published as [`@kerno/cli`](https://www.npmjs.com/package/@kerno/cli) on npm.

```bash
npm install -g @kerno/cli
```

Or run without installing.

```bash
npx @kerno/cli <command>
```

Requires Node.js 18 or higher. For the full setup walkthrough, see Set up Kerno MCP.

### Commands

| Command             | Description                                                                                                    |
| ------------------- | -------------------------------------------------------------------------------------------------------------- |
| `kerno mcp`         | Show MCP server configuration for Claude Code and Cursor. Starts the agent if it is not already running.       |
| `kerno start`       | Start the Kerno agent.                                                                                         |
| `kerno stop`        | Stop the Kerno agent.                                                                                          |
| `kerno status`      | Show the current system status.                                                                                |
| `kerno doctor`      | Diagnose orphan agents and inconsistent state files. Use `--clean` to apply fixes.                             |
| `kerno logs`        | Stream workspace logs from the running agent. Use `-n <count>` to set the number of log lines (default 40).    |
| `kerno export-logs` | Export Kerno agent logs (workspace + terminal output) to a zip file. Requires `-o <path>` for the destination. |
| `kerno login`       | Log in to Kerno via your browser.                                                                              |
| `kerno logout`      | Log out from Kerno.                                                                                            |
| `kerno uninstall`   | Stop the agent and remove installed binaries.                                                                  |

Run `kerno` with no arguments to launch the interactive shell.

### Global options

| Option                   | Description                                                   |
| ------------------------ | ------------------------------------------------------------- |
| `-w, --workspace <path>` | Workspace path. Defaults to the current directory.            |
| `-v, --verbose`          | Show Kerno diagnostic logs.                                   |
| `--force-update`         | Force re-download of the agent. Applies to `start` and `mcp`. |
| `-V, --version`          | Show CLI version.                                             |
| `-h, --help`             | Show help.                                                    |

### Examples

Start the agent in your project root.

```bash
cd /path/to/your/project
kerno start
```

Print MCP config and let the CLI start the agent if needed.

```bash
kerno mcp
```

Fix orphan agent processes.

```bash
kerno doctor --clean
```

Stream the most recent 100 log lines.

```bash
kerno logs -n 100
```

Export logs for support.

```bash
kerno export-logs -o ./kerno-logs.zip
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kerno.gitbook.io/docs/references/kerno-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
