Skip to content

NPC-Worldwide/npcsh

Repository files navigation

npcsh logo

npcsh

The agentic shell for building and running AI teams from the command line.

License Crates.io Docs


npcsh makes the most of LLMs and agents through an interactive shell. Build teams of agents, schedule them on jobs, engineer context, and design custom Jinja Execution templates (Jinxes) for your agents to invoke for tool-use, prompts, and skills.

Install npcsh:

curl -fsSL https://enpisi.com/install-npcsh.sh | sh
npcsh

Ask a question:

npcsh> what process is listening on port 5337?

Delegate to a coding agent:

npcsh> @corca refactor the auth module and add tests

Open the Git TUI after changes:

npcsh> /gitt

Benchmark Results

The benchmark suite measures how well a model can drive npcsh as an agentic shell. It covers 100 tasks across 10 categories, from basic shell commands and file operations to multi-step workflows, debugging, git, and scripting. Each task is scored pass/fail by an automated verifier.

The table below shows scores (100 tasks).

Scores (100 tasks)

FamilyModelVersionScore
Qwen3.535bv2.1.597/100 (97%)
9bv2.1.595/100 (95%)
397bv2.1.796/100 (96%)
Ornith35bv2.1.797/100 (97%)
9bv2.1.557/100 (57%)
Kimi K2.7-Code1t (32b active)v2.1.797/100 (97%)
Minimaxm3 428b (23b active)v2.1.796/100 (96%)
DeepSeekv4-flash 284b (13b active)v2.1.795/100 (95%)
Mistraldevstral-2 123bv2.1.794/100 (94%)
devstral-small-2 24bv2.1.794/100 (94%)
large-3 675bv2.1.789/100 (89%)
North Mini Code 1.030b (3b active)v2.1.593/100 (93%)
Gemma 431bv2.1.792/100 (92%)
Qwen3.635bv2.1.591/100 (91%)
Nemotron3-super 120b (12b active)v2.1.788/100 (88%)
Laguna XS 2.133b (3b active)v2.1.524/100 (24%)

For a more comprehensive view of npcsh's capabilities and the advantages of the NPC Context-Agent-Tool data layer, see ALARA for Agents: Least-Privilege Context Engineering Through Portable Composable Multi-Agent Teams.


Installation

Install script (recommended)

curl -fsSL https://enpisi.com/install-npcsh.sh | sh

This downloads the latest npcsh and npc Rust binaries for your platform into ~/.npcsh/bin, adds that directory to your PATH in your shell rc file, and walks you through installing the npcpy Python backend — offering any existing virtualenvs it finds, or a fresh one via uv, pyenv, or python3 -m venv. Then run npcsh.

See Python backend (npcpy) below for details on that requirement.

Cargo

cargo install npcsh

Python backend (npcpy)

Note: this is a temporary requirement. The npcpy server will be replaced by a Rust-native runner for the AI parsing once npcrs reaches greater stability.

npcsh drives its agent loop through a local npcpy server, which it spawns automatically on startup — there is nothing to run manually, but the Python interpreter npcsh uses must have npcpy importable:

pip install npcpy

Requires Python 3.10 or newer.

By default npcsh runs python3 -m npcpy.serve on 127.0.0.1:5237. If npcpy lives in a non-default Python (a venv, conda env, or pyenv version), point npcsh at that interpreter:

export BACKEND_PYTHON_PATH=/path/to/python   # PYTHON_PATH also works

The server bind address can be changed with NPCSH_SERVER_HOST and NPCSH_SERVER_PORT.

If startup fails with failed to spawn npcpy.serve or npcpy server did not become reachable after spawn, the selected Python does not have npcpy installed, or the port is already taken by a stale server process.

macOS system dependencies

brew install ollama
brew services start ollama
ollama pull qwen3.5:2b

Linux system dependencies

# Ollama
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen3.5:2b

Windows

Install Ollama, then use the install script from PowerShell via WSL, or install with cargo.

Rust build (development)

cd rust
cargo build --release
cp target/release/npcsh ~/.npcsh/bin/npcsh
cp target/release/npc ~/.npcsh/bin/npc

For normal use, install the pre-built release via the install script or cargo. The source build is for development only.

Configuration

On first run, npcsh creates ~/.npcshrc:

export NPCSH_CHAT_MODEL=qwen3.5:2b
export NPCSH_CHAT_PROVIDER=ollama
export NPCSH_DEFAULT_MODE=agent
export NPCSH_EMBEDDING_MODEL=nomic-embed-text
export NPCSH_EMBEDDING_PROVIDER=ollama

API keys can go in ~/.npcshrc, ~/.bashrc, or a project .env:

export OPENAI_API_KEY="your_key"
export ANTHROPIC_API_KEY="your_key"
export GEMINI_API_KEY="your_key"
export DEEPSEEK_API_KEY="your_key"

Agent Formats

The agent layer can be written in three formats. They can be mixed; .npc files take precedence if names collide.

.npc files — full-featured YAML agent definitions:

#!/usr/bin/env npc
name: analyst
primary_directive: You analyze data and provide insights.
model: qwen3:8b
provider: ollama
jinxes:
  - skills/data-analysis

agents.md — multiple agents in one markdown file:

## summarizer
You summarize long documents into concise bullet points.

## fact_checker
You verify claims against reliable sources and flag inaccuracies.

agents/ directory — one .md file per agent:

---
model: gemini-2.5-flash
provider: gemini
---
You translate content between languages while preserving tone and idiom.

All formats inherit the team's default model/provider from team.ctx when not specified.


Read the Docs

Full guides and API reference at npc-shell.readthedocs.io.

Community & Support

Discord | Monthly donation | Merch | Consulting: info@npcworldwi.de

Contributing

Contributions welcome! Submit issues and pull requests on the GitHub repository.

License

MIT License.

Star History

Star History Chart

About

the composable multi-agent shell

Resources

License

Stars

453 stars

Watchers

7 watching

Forks

Sponsor this project

  •  

Contributors