nib

A coding agent you can afford to leave running.

Open-source, bring-your-own-key, built for cheap models. Explicit permissions, no telemetry.

npm install -g @amenski/nib
brew install amenski/tap/nib
⏺ Bash(node --test 2>&1 | tail -20)
  ⎿  ✖ replaces every space (0.638917ms)
       AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
       + actual - expected
     … +17 lines

⏺ Patch(slug.js)
…
⏺ Bash(node --test 2>&1 | tail -15)
  ⎿  ✔ replaces every space (0.257833ms)
     ℹ tests 1
     ℹ suites 0
     … +6 lines

⏺ Fixed: slug.js:2 used String.prototype.replace(' ', '-') with a string pattern, which replaces only the
  first occurrence. Changed to replaceAll(' ', '-').

  node --test → 1 pass, 0 fail.

✳ Worked for 15s
…
● Code · ● auto · thinking low · deepseek/DeepSeek V4.1 Flash · ctx ━━━━━━━━━━━━ 2% · main ~1
Fig. 01Auto posture, real run on DeepSeek V4.1 Flash: nib fixes the bug and runs the tests with no permission prompt.

One full day on DeepSeek for under $7.

Nib keeps the prompt prefix stable so provider caches hit. Measured on a real day of work, 2026-10-20, from the DeepSeek usage page for the Nib API key.

$6.89

total bill for the day

1.2B

tokens in the day

5,005

requests in the day

The /usage panel in Nib listing tokens by model, with cached counts
Fig. 02Nib /usage on 2026-10-18: 504,190,080 of 506,372,034 input tokens came from cache (99.57%).

Three commands to a first session.

Needs Node.js 20 or newer and Git. Keys are stored locally with mode 0600.

# install
npm install -g @amenski/nib

# add a key for DeepSeek, OpenAI, Ollama or ~190 other providers
nib auth

# interactive session in Code mode; /mode general for read-only chat
nib

On macOS with Homebrew: brew install amenski/tap/nib

Nib running in a terminal in Code mode on DeepSeek V4 Flash
Fig. 03Nib running in a terminal in Code mode on DeepSeek V4 Flash

One agent, several ways to run it.

nib

The interactive terminal UI, starting in Code mode: edit files, run commands, delegate work.

nib -p "..."

Prints the response and exits, for pipes and scripts; with nobody to ask, anything that would prompt is denied.

nib -c

Continues the most recent session for this directory.

Shift+Tab

Cycles the permission posture: normal, auto, plan. /mode general switches to read-only chat.

Ten features, and how to use each.

Each comes with the keys, commands or settings you need.

01 / Permissions and sandbox

Every tool call passes a rule.

Allow, ask or deny by tool and pattern. /permissions shows this session's decisions.

On macOS, Bash, background jobs, MCP servers and hooks run under a Seatbelt profile. Writes stay in the workspace, the session temp dir and toolchain caches. Because of that boundary, ordinary sandboxed Bash runs without a prompt. Background jobs and guarded commands still ask.

Permission spec →
{
  "permissions": {
    "rules": [
      {
        "tool": "run_bash",
        "pattern": "git *",
        "action": "allow"
      },
      {
        "tool": "run_bash",
        "pattern": "rm *",
        "action": "deny"
      },
      {
        "tool": "run_bash",
        "pattern": "*",
        "action": "ask"
      }
    ]
  }
}

02 / Auto mode

A model judge answers the prompts.

Press Shift+Tab to cycle normal, auto and plan. In auto, read-only calls and ordinary edits inside the workspace run silently. A model judge allows or blocks everything else instead of asking you.

The judge reads your messages and the agent's tool calls, never tool output. You are still asked about credential files such as .env, git config changes, anything that would run outside the sandbox, and calls matched by an ask rule you wrote. After 3 blocked calls in a row (20 in total), nib asks you again. Auto mode is not available with nib -p. Fig. 01 at the top is a real run.

Shift+Tab

Auto mode guide →

03 / Language servers

Errors show up in the edit result.

After each edit, nib asks the language server about the changed files and appends errors and warnings to that edit's result. The model fixes them in the next step.

A read-only lsp tool answers definitions, references, hover, symbols, implementations and call hierarchies from the server instead of text search.

Dart and TypeScript servers are built in. They start when pubspec.yaml or tsconfig.json exists, the server binary is on PATH and the folder is trusted. Add others under lspServers.

Config spec →
"lspServers": {
  "gopls": {
    "command": "gopls",
    "extensionToLanguage": {
      ".go": "go"
    }
  }
}

04 / Steering

Talk to it while it works.

Type while a turn is running and press Enter. The message waits in a queue shown above the input, with the time you sent it. Nib hands it to the model before its next provider call, as a real user message, never mid-stream.

Esc interrupts the current call and returns to the prompt. Queued input is never dropped. Slash commands typed meanwhile run when the turn ends, except /skill <name>, which applies to the running turn.

EnterEsc

CLI spec →

05 / Undo and safe edits

Rewind the code, the chat, or both.

Edits in an interactive session are checkpointed in a shadow Git repo. /undo rewinds code, conversation or both.

Nib tracks when it last read a file. If the file changed outside the agent since then, the edit is refused with FILE_MODIFIED and nib has to read it again first.

Session spec →
› /undo

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Undo — select a checkpoint                                                                                 │
│                                                                                                            │
│ > 3m ago       fix the failing test, then run the tests                                                    │
│                                                                                                            │
│ ↑↓ navigate · Enter select · Esc close · Type to search                                                    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
…
Restored checkpoint 47483d2 — files and conversation
…
❯ fix the failing test, then run the tests
Fig. 04/undo restores the file and puts the original prompt back in the input.

06 / Sessions and long context

Pick up where you stopped.

Sessions are append-only JSONL files on your machine. nib -c continues the most recent one for this directory and nib -r <id> resumes one by ID. The todo list comes back with it.

Long sessions stay lean. Nib caps oversized tool output, clears older tool results from large requests and compacts earlier conversation. The full transcript stays in the local log. /compact does it by hand.

Sessions and context docs →
nib -c
nib -r <id>

07 / Background jobs and sub-agents

Long work runs on the side.

Builds and dev servers can run as background jobs, up to 10 at once. One check_job call waits for the job to finish, so the model does not poll in a loop.

The model can hand bounded work to a sub-agent with new_task. It runs in the background, up to 3 at a time, and its summary arrives as a follow-up message. Define your own agents in .nib/agents.

/jobs shows both, and x stops the selected one. Jobs and tasks end when you quit.

Tool spec →

08 / Images and web

Show it a screenshot. Let it look things up.

Paste an image with Ctrl+V, or write @path/to/shot.png in the prompt. The model can also call view_image on an https URL or a local file. PNG, JPEG, GIF and WebP up to 5 MB, and the active model must accept images.

web_search works without a key through Bing RSS. web_fetch gets HTTPS pages and checks arbitrary targets against SSRF. Both are permission-gated and marked as untrusted input. For richer results, point nib at a local SearXNG.

Ctrl+V

Web search spec →
"webSearch": {
  "searxngUrl": "http://localhost:8888"
}

09 / Extend it

Wire in what you already use.

Add any stdio MCP server with nib mcp add, then check it with /mcp. Servers run inside the sandbox; browser servers need --no-sandbox. List Agent Skills with /skills.

Hooks run your shell commands on events such as PreToolUse and UserPromptSubmit, and can block a tool call or a prompt. Set notify to a script to get pinged when a turn finishes or fails, or when a background job ends.

Custom modes are YAML files in ~/.nib/modes/ with their own role, tool groups and file limits.

Hooks spec →
nib mcp add github \
  --env GITHUB_TOKEN=... \
  -- npx -y \
  @modelcontextprotocol/server-github

10 / Headless and visibility

Script it. See what it used.

nib -p "..." prints the response and exits, with no TUI and no TTY. Errors go to stderr, so stdout stays pipeable. With nobody to ask, anything that would prompt is denied. --max-turns caps the number of agent turns.

/usage shows tokens per model and, where the provider supports it, your account balance. nib doctor prints config and credential sources. Thinking is on by default, and /effort sets the reasoning effort.

CLI spec →
$ nib -p "fix the failing test" --max-turns 12
permission denied (headless): run_bash cat package.json 2>/dev/null; ls -la
permission denied (headless): run_bash node --test slug.test.js
Fixed `slug.js:2` — `replace(' ', '-')` only replaced the first space; now `replaceAll(' ', '-')`, which satisfies `slugify('Hello Big World') === 'hello-big-world'`.

I could not verify: both `node --test slug.test.js` attempts were denied, so the test still needs a run.

Caveat: `replaceAll` needs Node 15+. If you target older Node, use `.replace(/ /g, '-')` instead.

Next action: run `node --test slug.test.js` in the repo.
Fig. 05The same task with nib -p: no one to ask, so the test runs are denied and nib says so.

What nib does differently.

Four choices that shape how it runs, each with the doc behind it.

Built for the cache.

The prompt prefix stays byte-stable and live state goes last, so provider caches hit: 99.57% of input tokens on a real day.

See the numbers →

A judge, not a popup.

In the auto posture (Shift+Tab), read-only calls just run and risky ones go to a fast model judge. You come back to finished work, not a stalled prompt.

How auto mode works →

No account, no telemetry, no server.

One local process. The only request that leaves your machine goes to the provider you chose.

Privacy policy →

Every subsystem has a spec.

Permissions, compaction, sandboxing: each is written up in docs/, so you can read the design behind any behaviour you rely on.

Read the docs →

Your key, any model.

Five providers built in, plus ~190 more OpenAI-compatible ones from the Models.dev catalog. Connect any with nib auth, switch mid-session with /model. Nothing leaves your machine except the request to the provider you chose.

DeepSeekOpenAIOpenRouterGroqOllama (local)and ~190 more

Get involved.