nan-harness
Run the coding agents you already use with NaN through nan-harness. Use nanh <harness> for everyday launches and nanh config <harness> only for advanced native setup. nanh is the shorter alias for nan-harness.
INSTALL
Run this on macOS or Linux:
$ curl --proto '=https' --tlsv1.2 -m 30 -fsSL https://github.com/DavidLMS/nan-harness/releases/latest/download/install.sh | shOn Windows, in PowerShell:
$ irm https://github.com/DavidLMS/nan-harness/releases/latest/download/install.ps1 | iexIf prompted, open a new terminal. Then verify the installation:
$ nanh --versionThe installer provides both nan-harness and nanh. Release builds are available for macOS, Linux, and Windows. To build from source, see the repository.
FIRST RUN
Go to your project and launch the agent you already use:
$ nanh claudeIf NAN_API_KEY is not set, nan-harness asks for your NaN API key the first time it needs one. It verifies and saves the key.
After that, use the agent as usual. To choose a model at launch, use --model. If supported, you can also use the agent's native model picker:
$ nanh codex --model qwen3.6
$ nanh opencode --model deepseek-v4-flashPass arguments to the agent after --; nan-harness forwards them unchanged:
$ nanh codex --model qwen3.6 -- --full-auto
$ nanh claude -- --resumeYour key
NAN_API_KEY in your environment, this section does not apply to you. That key wins over any other: nan-harness will not ask you for one, saves nothing to disk, and there is no need to log in.If you do not, nan-harness keeps it where your system keeps passwords: Keychain on macOS, Credential Manager on Windows, Secret Service on Linux. If none of them is available it uses a private file and warns you.
| Command | What it is for |
|---|---|
| nanh auth login | Enter a key, or replace the one you have. |
| nanh auth status | See which key is in use and where it is stored. |
| nanh auth logout | Delete the saved key. |
The environment variable is useful on servers and in CI. nanh auth status shows which credential is active:
$ export NAN_API_KEY="<your-NaN-api-key>"HARNESSES
nanh <harness> is the recommended workflow for every supported harness. nan-harness checks the installed version, reads the current NaN catalog, prepares any required bridge and supervises the process without changing persistent provider settings. nanh config <harness> is an advanced option for harnesses that support direct native configuration.
| Recommended command | Harness | Native setup |
|---|---|---|
| nanh aider | Aider | optional |
| nanh cline | Cline | optional |
| nanh goose | Goose | optional |
| nanh claude | Claude Code | not available |
| nanh codex | Codex | not available |
| nanh opencode | OpenCode | optional |
| nanh qwen | Qwen Code | optional |
| nanh pi | Pi | optional |
| nanh kimi | Kimi Code | optional |
| nanh openclaw | OpenClaw | optional |
| nanh hermes | Hermes Agent | optional |
| nanh omp | Oh My Pi | optional |
| nanh mimo | MiMo Code | optional |
| nanh zcode | ZCode | optional |
| nanh prime-agent | Prime Agent | optional |
| nanh dsh | DeepSeek Harness | optional |
| nanh fx | fx | not available |
Recommended: run with nan-harness
For everyday use, run nanh <harness>. It checks the installed version, discovers your current NaN models, uses your current credential source, prepares any required bridge, and supervises the process. If the harness is missing, nan-harness can offer to install it.
$ nanh opencodeAdvanced: native setup
Use nanh config <harness> only when another tool or integration needs to start a supported harness with its usual executable. Native setup writes persistent provider settings. The later launch runs directly through the harness, so nan-harness no longer manages that process. This command only configures the harness; start it afterwards with its usual executable:
$ nanh config opencode
$ opencodeClaude Code, Codex and fx need nan-harness running because their NaN connection depends on a local bridge or gateway. They cannot be prepared for standalone use with nanh config.
Native setup uses the API key saved by nanh auth login; an environment-only key is never copied into another application. Use --status to inspect it and --refresh after changing your saved key or model catalog. --remove removes what nan-harness added and restores previous settings when it is safe to do so.
NATIVE MEDIA
Hermes Agent and OpenClaw can route native media features through NaN. nan-harness preserves an existing media provider and adds a NaN provider only when that capability is not already configured.
| Capability | NaN provider | What it does |
|---|---|---|
| Speech to text | NaN Whisper | Transcribes audio. Large PCM WAV files are split into bounded overlapping chunks and merged. |
| Text to speech | NaN Kokoro | Converts text to spoken audio. |
| Image generation and editing | NaN image models | Generates images with Flux 2 Klein or Qwen Image 2.1; Flux can also edit reference images. |
Use it during a launch
| Flag | What it does |
|---|---|
| (default) | Adds each NaN media provider only when the harness has no existing provider for that capability. |
| --force-media | Enables all three NaN media providers even when another provider is configured. |
| --force-stt | Uses NaN Whisper for speech to text. |
| --force-tts | Uses NaN Kokoro for text to speech. |
| --force-image / --image | Enables images with Flux 2 Klein. |
| --image-model <id> | Enables images and sets the default to Flux 2 Klein or Qwen Image 2.1. |
Choose an image model
Use --image-model with Hermes Agent or OpenClaw to choose the default image model. Qwen Image 2.1 is for generation and Flux 2 Klein also supports editing and up to four reference images. The --image and --force-image options use Flux by default.
| Model | Generate | Edit / reference images |
|---|---|---|
flux-2-klein | Yes | Yes, up to four references |
qwen-image-2.1 | Yes | No, generation only |
$ nanh hermes --image-model qwen-image-2.1
$ nanh openclaw --imageYou can choose a model for one image request in the native image tool without changing the configured default. Ask for Qwen Image 2.1 for generation or Flux 2 Klein for editing. A Qwen request with references returns an error.
Use it in native setup
Pass the same flags to nanh config hermes or nanh config openclaw to write the media providers into the harness configuration. The managed media selection, including the image model, is retained when you refresh that configuration.
$ nanh config hermes --image-model qwen-image-2.1PLATFORM NOTES
Some integrations depend on distributions supplied by the upstream harness. nan-harness reports these limits before it searches for an executable or offers installation.
| Integration | Availability |
|---|---|
| Prime Agent | Linux and macOS. Upstream does not currently provide a native Windows distribution. |
| fx | Linux and macOS. Upstream does not currently provide a native Windows distribution. |
| Local SearXNG | macOS, Linux and Windows x64. Requires Python 3.11 or newer and tar on PATH. |
On Windows, you can pass --executable <path> to try a future compatible Prime Agent or fx build. The usual version and launch checks still apply.
DESKTOP APPS (EXPERIMENTAL)
These integrations are experimental. All five apps have been tested on macOS. Other platform combinations are covered by automated compatibility tests.
| Command | App | Available on |
|---|---|---|
| nanh zed | Zed | macOS, Windows, Linux |
| nanh chatgpt-desktop | ChatGPT | macOS, Windows, Linux (preview) |
| nanh claude-desktop | Claude | macOS, Windows, Linux (beta) |
| nanh hermes-desktop | Hermes | macOS, Windows, Linux |
| nanh pen | Pen | macOS, Windows, Linux |
What happens when you launch one
nan-harness prepares a temporary NaN connection, launches the app, and cleans up when it closes. It does not replace the app or log you out; your login, history, and settings stay intact.
ChatGPT and Hermes use a separate profile. Claude, Pen, and Zed restore their previous configuration when they close. Pen and Zed receive all text models available to your NaN account through a private local gateway, which also provides the final token-usage summary.
If a launch is interrupted
Close the app and run the same command again with --restore. nan-harness restores the state recorded for the interrupted launch.
Run Hermes or Pen directly
Hermes Desktop and Pen can also be configured for direct use. After that, open the app normally; nan-harness is no longer involved. Usage summaries work only when you launch through nanh. Pen must be fully restarted to reload a changed model catalog:
$ nanh config hermes-desktop
$ hermes desktop
$ nanh config pen
$ open Pen normallySEARCH WITH NAN-HARNESS
nan-harness can give your agent a web search tool backed by SearXNG. It is optional: nothing is installed or contacted until you set up a backend.
Set it up
| Command | What it does |
|---|---|
| nanh search setup --local | Installs a private SearXNG on your machine. Needs Python 3.11+ and tar (macOS, Linux, Windows x64). |
| nanh search setup --docker | Runs SearXNG in a Docker container. |
| nanh search setup --url https://… | Uses a SearXNG server you trust. |
$ nanh search setup --localnan-harness checks that the backend works before saving it. No SearXNG credentials are stored.
Manage it
| Command | What it does |
|---|---|
| nanh search status | Shows the current backend. Add --json for scripts. |
| nanh search disable | Turns search off. The backend stays installed. |
| nanh search update | Updates a local or Docker backend. |
| nanh search remove | Removes the backend nan-harness created and its settings. |
How your agent uses it
If your agent already has a search provider, nan-harness leaves it alone. If not, it adds its own search tool. Just ask: "search the web for the latest Rust release notes".
Without a backend, the tool replies with setup instructions.
| Flag | What it does |
|---|---|
| (default) | Adds search only if the agent has none. |
| --no-search | Never adds it. |
| --force-search | Adds it even if the agent has another provider. Not available for Aider. |
$ nanh claude --no-search
$ nanh cline --force-searchFor Pi and Prime Agent, any installed extension with a web_search tool counts as a provider.
In native setup
nanh config <harness> follows the same rules and keeps your --no-search or --force-search choice on --refresh. nanh config --status shows it.
TOKEN BUDGET AND CONTEXT
Two options to keep a session under control:
$ nanh codex --session-max-tokens 10000000 --context 150000Session budget
--session-max-tokens limits the input and output tokens of a launch. It counts every request, including compaction and auxiliary models.
When the limit is reached, the agent gets a notice and stops making requests. Your conversation is kept: start a new launch with a higher limit and resume it.
It needs the local gateway, so it does not work with --no-chat-gateway.
Context
--context sets roughly how many tokens the agent uses before compacting the conversation. The agent may compact a little earlier.
| --context | Harnesses and apps |
|---|---|
| Supported | Claude Code, Codex, OpenCode, Hermes Agent, Pi, Prime Agent, Oh My Pi, Qwen Code, Kimi Code, Aider, Goose, Hermes Desktop, Zed |
| Not supported | DeepSeek Harness, OpenClaw, Cline, fx, ChatGPT, Claude, Pen |
OPTIONS
Recommended launch options
| Option | What it does |
|---|---|
| --model <id> | Which model to use this time. |
| --session-max-tokens <tokens> | Limits the tokens this launch can use. |
| --context <tokens> | Sets when the agent compacts the conversation. |
| --no-search / --force-search | Turns nan-harness search off or forces it. |
| --allow-untested | Allows a command-line harness version that cannot be read. Newer Desktop versions already warn and continue; the flag remains accepted for compatibility. |
| --allow-unsupported | Runs a version below the supported minimum. |
Advanced native setup commands
| Command | What it does |
|---|---|
| nanh config <harness> | Writes a reversible native NaN configuration without launching the harness. |
| nanh config <harness> --status | Checks whether its managed configuration is current. |
| nanh config <harness> --refresh | Updates the copied key, model catalog and managed defaults. |
| nanh config <harness> --remove | Removes the managed configuration and restores safe previous values. |
Other commands
| Command | What it does |
|---|---|
| nanh doctor | Checks everything and tells you how it looks. |
| nanh doctor <harness> | Checks one harness in detail. |
| nanh auth login | Saves your NaN key. |
| nanh auth status | Tells you which key is in use. |
| nanh auth logout | Deletes the saved key and lets you remove configurations that contain a copy. |
| nanh config --status | Shows every native configuration managed by nan-harness. |
| nanh config --refresh-all | Refreshes every managed native configuration. |
| nanh config --remove-all | Removes every managed native configuration. |
| nanh search setup | Sets up web search. |
| nanh search status | Shows the search setup. |
| nanh update | Updates nan-harness to the latest version. |
| nanh telemetry on|off | Turns anonymous telemetry on or off. |
| nanh uninstall | Removes nan-harness and everything it left behind. |
| nanh --help | The full list, in your terminal. |
CLI UTILITIES
| Command | What it does |
|---|---|
| nanh language | Shows the current terminal language and the available languages. |
| nanh language en | Uses English terminal messages and saves the preference. |
| nanh language es | Uses Spanish terminal messages and saves the preference. |
HELP AND PRIVACY
Troubleshooting
Run nanh doctor to check connectivity, model availability, installed harnesses, and stale versions.
$ nanh doctorThat report is safe to share: it excludes keys, paths, prompts, and model output. The single-harness report includes the executable path, so review it before sharing.
$ nanh doctor claudeVersion warnings
Each release of nan-harness is tested against specific versions of each harness. If yours is newer than the last tested version, nan-harness warns you and continues. Older versions below the minimum require --allow-unsupported; versions whose number cannot be read require --allow-untested.
Telemetry
Off unless you turn it on. If enabled, nan-harness can send sanitized CLI and bridge error reports plus a minimal invocation event with a random installation identifier, its version, the harness, operation, transport, OS family, architecture, and target environment. It never sends prompts, model output, arguments, paths, credentials, usernames, or hostnames. A model-specific diagnostic may include the NaN model ID. As with any HTTPS request, the receiving infrastructure can observe ordinary network metadata.
$ nanh telemetry on
$ nanh telemetry offIt helps us see which harnesses need attention. Turning it off stops usage events and automatic error delivery. An interactive error may still offer a one-time anonymous report.
Uninstalling
It asks for confirmation, undoes every configuration it left in your agents, deletes your saved key and removes itself. If you changed one of those configurations by hand, it stops instead of overwriting your work.
$ nanh uninstall