Skip to content

huqi-pr/nib

 
 

Repository files navigation

Nib

Adapt Nib to your workflow, not the other way around.

Nib is a lightweight, open-source coding agent CLI — a minimal and deeply customizable alternative to Claude Code. Built on @mariozechner/pi-coding-agent, it gives power users full control over how the agent thinks, acts, and looks.

⚠️ Beta — This project is in early development. Install from source only.

中文文档


Why Nib?

Claude Code Nib
Open source
Self-hosted
Custom extensions Limited Full TypeScript API
Default system prompt ~2000 tokens < 200 tokens
Multi-model support Limited 20+ models
Local model support
YOLO mode (no forced sandbox)
Native session branching
Cost Opaque Minimal + transparent

Prerequisites

Install

git clone https://github.com/your-username/nib.git
cd nib
pnpm install
pnpm build
pnpm link --global

Verify:

nib --version

Quick Start

1. Configure an API key

Create ~/.pi/agent/auth.json with your provider credentials (create the directory first if it doesn't exist):

mkdir -p ~/.pi/agent
{
  "deepseek": { "type": "api_key", "key": "sk-..." }
}

Other supported providers:

{
  "anthropic": { "type": "api_key", "key": "sk-ant-..." },
  "openai":    { "type": "api_key", "key": "sk-..." },
  "mistral":   { "type": "api_key", "key": "..." }
}

For local models (Ollama), no API key is needed — see Custom Models.

2. Run

nib

3. Select a model (optional)

Press ctrl+l inside the agent to open the model selector. Default model is deepseek-v4-pro.

Or start with a specific model:

nib --model deepseek-v4-flash

Features

  • Minimal by default — system prompt under 200 tokens; no bloat, no noise
  • YOLO mode — no forced sandboxing; you decide the risk level
  • Multi-model — switch between 20+ models mid-session
  • Local model first — full Ollama support out of the box
  • Session branching — fork conversations at any point, explore safely
  • Extension API — add custom tools, commands, keybindings, and UI widgets in TypeScript
  • Skills — define reusable task workflows in Markdown
  • Prompt templates — swap system prompts per project or context
  • Themes — fully customizable TUI appearance

Extending Nib

Extensions are TypeScript modules that hook into the agent lifecycle. Drop them in extensions/, register them in bin/nib.js, and rebuild.

// extensions/my-extension.ts
import type { ExtensionAPI, SessionStartEvent, ExtensionContext } from "@mariozechner/pi-coding-agent";

export default function (pi: ExtensionAPI) {
  pi.on("session_start", (event: SessionStartEvent, ctx: ExtensionContext) => {
    ctx.ui.notify("My extension loaded!");
  });
}

Available extension hooks include session_start, agent_start, before_agent_start, tool_call, input, and more. You can also register custom slash commands, tools, keyboard shortcuts, and TUI widgets.


Project Structure

nib/
├── bin/nib.js          ← CLI entry point
├── extensions/         ← TypeScript extension modules
├── skills/             ← Reusable task skills (Markdown)
├── prompts/            ← Custom prompt templates (Markdown)
├── themes/             ← TUI themes (JSON)
└── AGENTS.md           ← Agent behavior notes

Development

git clone https://github.com/your-username/nib.git
cd nib
pnpm install
pnpm build       # compile extensions/*.ts → dist/
pnpm link --global
nib

After editing any .ts file, re-run pnpm build. Edits to bin/nib.js, skills/, prompts/, and themes/ take effect immediately.


Contributing

Contributions are welcome. Please open an issue before submitting a large PR.

  • Extensions — new hooks, tools, commands
  • Skills — task workflow templates
  • Themes — TUI color schemes
  • Docs — guides, examples, translations

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 53.3%
  • JavaScript 46.7%