nan-harnessDOCS

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:

shell
$ curl --proto '=https' --tlsv1.2 -m 30 -fsSL https://github.com/DavidLMS/nan-harness/releases/latest/download/install.sh | sh

On Windows, in PowerShell:

shell
$ irm https://github.com/DavidLMS/nan-harness/releases/latest/download/install.ps1 | iex

If prompted, open a new terminal. Then verify the installation:

shell
$ nanh --version

The 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:

shell
$ nanh claude

If 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:

shell
$ nanh codex --model qwen3.6
$ nanh opencode --model deepseek-v4-flash

Pass arguments to the agent after --; nan-harness forwards them unchanged:

shell
$ nanh codex --model qwen3.6 -- --full-auto
$ nanh claude -- --resume

Your key

If you already have 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.

CommandWhat it is for
nanh auth loginEnter a key, or replace the one you have.
nanh auth statusSee which key is in use and where it is stored.
nanh auth logoutDelete the saved key.

The environment variable is useful on servers and in CI. nanh auth status shows which credential is active:

shell
$ export NAN_API_KEY="<your-NaN-api-key>"
Keep your key private. The environment variable is never copied into a harness configuration.

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 commandHarnessNative setup
nanh aiderAideroptional
nanh clineClineoptional
nanh gooseGooseoptional
nanh claudeClaude Codenot available
nanh codexCodexnot available
nanh opencodeOpenCodeoptional
nanh qwenQwen Codeoptional
nanh piPioptional
nanh kimiKimi Codeoptional
nanh openclawOpenClawoptional
nanh hermesHermes Agentoptional
nanh ompOh My Pioptional
nanh mimoMiMo Codeoptional
nanh zcodeZCodeoptional
nanh prime-agentPrime Agentoptional
nanh dshDeepSeek Harnessoptional
nanh fxfxnot 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.

shell
$ nanh opencode

Advanced: 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:

shell
$ nanh config opencode
$ opencode

Claude 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.

CapabilityNaN providerWhat it does
Speech to textNaN WhisperTranscribes audio. Large PCM WAV files are split into bounded overlapping chunks and merged.
Text to speechNaN KokoroConverts text to spoken audio.
Image generation and editingNaN image modelsGenerates images with Flux 2 Klein or Qwen Image 2.1; Flux can also edit reference images.

Use it during a launch

FlagWhat it does
(default)Adds each NaN media provider only when the harness has no existing provider for that capability.
--force-mediaEnables all three NaN media providers even when another provider is configured.
--force-sttUses NaN Whisper for speech to text.
--force-ttsUses NaN Kokoro for text to speech.
--force-image / --imageEnables 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.

ModelGenerateEdit / reference images
flux-2-kleinYesYes, up to four references
qwen-image-2.1YesNo, generation only
shell
$ nanh hermes --image-model qwen-image-2.1
$ nanh openclaw --image

You 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.

shell
$ nanh config hermes --image-model qwen-image-2.1
Media requests use your NaN credential. Existing provider credentials remain with the harness, and nan-harness does not replace them unless you explicitly force that capability.

PLATFORM 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.

IntegrationAvailability
Prime AgentLinux and macOS. Upstream does not currently provide a native Windows distribution.
fxLinux and macOS. Upstream does not currently provide a native Windows distribution.
Local SearXNGmacOS, 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.

CommandAppAvailable on
nanh zedZedmacOS, Windows, Linux
nanh chatgpt-desktopChatGPTmacOS, Windows, Linux (preview)
nanh claude-desktopClaudemacOS, Windows, Linux (beta)
nanh hermes-desktopHermesmacOS, Windows, Linux
nanh penPenmacOS, 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:

shell
$ nanh config hermes-desktop
$ hermes desktop
$ nanh config pen
$ open Pen normally
If you are interested, try them and tell us. Your experience as a user — what works, what breaks, what you miss — is the best way to help make these integrations solid.

TOKEN BUDGET AND CONTEXT

Two options to keep a session under control:

shell
$ nanh codex --session-max-tokens 10000000 --context 150000

Session 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.

Requests already running can finish, so the total may end slightly above the limit.

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.

--contextHarnesses and apps
SupportedClaude Code, Codex, OpenCode, Hermes Agent, Pi, Prime Agent, Oh My Pi, Qwen Code, Kimi Code, Aider, Goose, Hermes Desktop, Zed
Not supportedDeepSeek Harness, OpenClaw, Cline, fx, ChatGPT, Claude, Pen

OPTIONS

Recommended launch options

OptionWhat 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-searchTurns nan-harness search off or forces it.
--allow-untestedAllows a command-line harness version that cannot be read. Newer Desktop versions already warn and continue; the flag remains accepted for compatibility.
--allow-unsupportedRuns a version below the supported minimum.

Advanced native setup commands

CommandWhat it does
nanh config <harness>Writes a reversible native NaN configuration without launching the harness.
nanh config <harness> --statusChecks whether its managed configuration is current.
nanh config <harness> --refreshUpdates the copied key, model catalog and managed defaults.
nanh config <harness> --removeRemoves the managed configuration and restores safe previous values.

Other commands

CommandWhat it does
nanh doctorChecks everything and tells you how it looks.
nanh doctor <harness>Checks one harness in detail.
nanh auth loginSaves your NaN key.
nanh auth statusTells you which key is in use.
nanh auth logoutDeletes the saved key and lets you remove configurations that contain a copy.
nanh config --statusShows every native configuration managed by nan-harness.
nanh config --refresh-allRefreshes every managed native configuration.
nanh config --remove-allRemoves every managed native configuration.
nanh search setupSets up web search.
nanh search statusShows the search setup.
nanh updateUpdates nan-harness to the latest version.
nanh telemetry on|offTurns anonymous telemetry on or off.
nanh uninstallRemoves nan-harness and everything it left behind.
nanh --helpThe full list, in your terminal.

CLI UTILITIES

CommandWhat it does
nanh languageShows the current terminal language and the available languages.
nanh language enUses English terminal messages and saves the preference.
nanh language esUses Spanish terminal messages and saves the preference.

HELP AND PRIVACY

Troubleshooting

Run nanh doctor to check connectivity, model availability, installed harnesses, and stale versions.

shell
$ nanh doctor

That 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.

shell
$ nanh doctor claude

Version 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.

shell
$ nanh telemetry on
$ nanh telemetry off

It 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.

shell
$ nanh uninstall