Get started

harnext CLI

A terminal-native coding agent that reads, writes, and edits files, runs shell, and drives MCP servers — on open-source, local, or any provider. Run it interactively, hand it a task, or let it ship unattended.

harnext is the whole harness in one CLI: the interactive agent you use day to day, a one-shot mode for scripts and automation, and the setup command that wires your repo into a staged pipeline. Install it once and you have everything — no glue scripts, no agent server.

Shell
npm i -g harnext
Requirements
Node ≥ 20. Sessions, config, and replays all live under ~/.harnext.

The interactive REPL

Run harnext inside a repo and describe what you want. The agent reads, greps, plans, edits, and runs your tests — every tool call is shown as it happens, and nothing is written without the permission mode you chose.

~/projects/api — harnext
❯ refactor packages/api/auth — split the session helper

read  packages/api/auth/session.ts · 218 lines
grep  "createSession" · 9 matches · 4 files
│ plan · 3 steps — extract tokens.ts, thin the helper, update imports
edit  packages/api/auth/tokens.ts   +47 −0
edit  packages/api/auth/session.ts  +8 −52
bash  npm test -- auth  ✓ 23 passing · 1.2s

↑ 3.1k ↓ 0.9k tokens · change ready for review

One-shot mode

Pass -p to run a single task and exit — ideal for scripts, CI, and automation. The run is recorded as a session like any other.

Shell
harnext -p "Add a /health route that returns 200 OK" --provider anthropic

Pick your provider — or bring your own

Anthropic, OpenAI, Google, Ollama, NVIDIA and 20+ more, switchable per run with --provider and --model. Point --base-url at a local or self-hosted endpoint to keep development entirely in-house.

Shell
# cloud provider
harnext --provider anthropic --model claude-opus-4-8

# local model — code never leaves the machine
harnext --provider ollama --model llama3.2

# any OpenAI-compatible endpoint
harnext --base-url http://localhost:8000/v1 --model my-finetune

Wire up your repo

harnext setup connects your sources to the Context Engine and wires the harness into your repo, so the agent runs as a staged pipeline you can hand off and walk away from.

Shell
cd my-repo
harnext setup
# ✓ context engine connected · harness ready

Where to go next