Skip to main content

npcsh is a command-line toolkit for using AI agents in novel ways.

Project description

npcsh logo

npcsh

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

License PyPI Python Docs


npcsh makes the most of multi-modal LLMs and agents through slash commands and interactive modes, all from the command line. Build teams of agents, schedule them on jobs, engineer context, and design custom Jinja Execution templates (Jinxes) for you and your agents to invoke.

pip install 'npcsh[lite]'

Once installed, run npcsh to enter the NPC shell. Also provides the CLI tools npc, wander, spool, yap, and nql.

.npc and .jinx files are directly executable with shebangs (#!/usr/bin/env npc):

npc ./myagent.npc "summarize this repo"     # run an NPC with a prompt
npc ./script.jinx bash_command="ls -la"     # run a jinx directly
./myagent.npc "hello"                       # or just execute it (with shebang)

Benchmark Results

How well can a model drive npcsh as an agentic shell? 125 tasks across 15 categories — from basic shell commands to multi-step workflows, code debugging, and tool chaining — scored pass/fail. Comparisons with other agent coders coming soon. For a more comprehensive view of npcsh's capabilities and the advantages of the NPC Context-Agent-Tool data layer, check out ALARA for Agents: Least-Privilege Context Engineering Through Portable Composable Multi-Agent Teams

FamilyModelScore
Kimik2.5121/125 (97%)
Qwen3.50.8b31/125 (24%)
2b81/125 (65%)
4b77/125 (62%)
9b100/125 (80%)
35b111/125 (88%)
397b120/125 (96%)
Qwen30.6b
1.7b42/125 (34%)
4b94/125 (75%)
8b85/125 (68%)
30b103/125 (82%)
Gemma4e4b34/125 (27%)
31b105/125 (84%)
Gemma31b
4b37/125 (30%)
12b77/125 (62%)
27b73/125 (58%)
Llama3.2:1b
3.2:3b26/125 (20%)
3.1:8b60/125 (48%)
Mistralsmall3.272/125 (57%)
ministral-351/125 (40%)
large-359/125 (47%)
Devstral260/125 (48%)
MiniMaxM2.7120/125 (96%)
Phiphi458/125 (46%)
GPT-OSS20b94/125 (75%)
OLMo27b13/125 (10%)
13b47/125 (38%)
Cogito3b10/125 (8%)
GLM4.7-flash102/125 (82%)
5120/125 (96%)
Nemotron3-super49/125 (39%)
Gemini2.5-flash
3.1-flash
3.1-pro
Claude4.6-sonnet
4.5-haiku
GPT5-mini
DeepSeekv4-flash99/125 (79%)
chat
reasoner
Category breakdown (completed models)
Category Qwen3.5 Qwen3 Gemma4 Gemma3 Llama Mistral Phi GPT-OSS Cogito GLM Kimi Qwen3.5 MiniMax Devstral Nemotron DeepSeek
0.8b2b9b35b 1.7b4b8b30b0.6b e4b31b 4b12b27b 3.2:3b small3.2ministral-3large-3 phi4 20b 3b 4.75 k2.5 397b M2.7 2 3-super v4-flash
shell (10)56101088996106696107891001010101010978
file-ops (10)8910108109105869102610810100109101091059
python (10)0391005661100310366410010101010106510
data (10)0246245609157059546059999449
system (10)2891079710610597296106901010101010869
text (10)1768210670839817004807101010100010
debug (10)261010042104003004020909101010100310
git (10)086929982946948406805101099019
multi-step (10)0676063709355230054058999204
scripting (10)1581007260902103163708109910825
image-gen (5)5555555555353551525555555550
audio-gen (5)5455555555455451555555555555
web-search (5)1545154505155045003055555025
delegation (5)0233022404020000300034444231
tool-chain (5)1544252504133001100055555115
Total (125)31811001114294761033410537777326725159589410102120121120120604999
python -m npcsh.benchmark.local_runner --model qwen3:4b --provider ollama

Usage

  • Get help with a task:

    npcsh>can you help me identify what process is listening on port 5337?
    
  • Edit files:

    npcsh>please read through the markdown files in the docs folder and suggest changes
    
  • Search & Knowledge

    /web_search "cerulean city"            # Web search
    /db_search "query"                     # Database search
    /file_search "pattern"                 # File search
    /memories                              # Interactive memory browser TUI
    /kg                                    # Interactive knowledge graph TUI
    /nql                                   # Database query TUI
    

    Web search results

  • Computer Use

    /computer_use
    

    Plonk GUI automation TUI Plonk GUI automation — completed task

  • Generate Images

    /vixynt 'generate an image of a rabbit eating ham in the brink of dawn' model='gpt-image-1' provider='openai'
    

    a rabbit eating ham in the brink of dawn

  • Generate Videos

    /roll 'generate a video of a hat riding a dog' veo-3.1-fast-generate-preview  gemini
    

    video of a hat riding a dog

  • Multi-Agent Discussions

    /convene "Is the universe a simulation?" npcs=alicanto,corca,guac rounds=3
    

    Convene — multi-NPC discussion

  • Serve an NPC Team

    /serve --port 5337 --cors='http://localhost:5137/'
    

Agent Formats

npcsh supports multiple ways to define agents inside your npc_team/ directory. You can mix all three formats — .npc files take precedence if names collide.

.npc files — Full-featured YAML agent definitions with model, provider, jinxes, and more:

#!/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 — Define multiple agents in a single markdown file. Each ## heading = agent name, body = directive:

## 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. Filename (minus .md) = agent name. Supports YAML frontmatter:

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

All three formats are supported by both the Python and Rust editions of npcsh. Agents from agents.md and agents/ inherit the team's default model/provider from team.ctx.

The full team structure:

npc_team/
├── team.ctx           # Team config (model, provider, forenpc, context)
├── coordinator.npc    # YAML agent definitions
├── analyst.npc
├── agents.md          # Markdown-defined agents
├── agents/            # One .md file per agent
│   └── translator.md
├── jinxes/            # Workflows and tools
│   ├── research.jinx
│   └── skills/        # Knowledge-content skills
└── tools/             # Custom tool functions

This means you can bring agents from other ecosystems — if you already have an agents.md or an agents/ directory from Claude Code, Codex, Amp, or any other tool, just drop them into your npc_team/ and npcsh will pick them up alongside your .npc files.


Launching AI Coding Tools with NPC Teams

Your npc_team/ works beyond npcsh — you can launch any major AI coding tool as an NPC from your team using the CLI launchers from npcpy. Each tool gets the NPC's persona injected and gains awareness of the other team members.

pip install npcpy   # if not already installed

# Launch Claude Code as an NPC (interactive picker)
npc-claude

# Launch as a specific NPC
npc-claude --npc corca

# Same for other coding tools
npc-codex --npc researcher
npc-gemini --npc analyst
npc-opencode --npc coder
npc-aider --npc reviewer
npc-amp --npc writer

# Point to a specific team directory
npc-claude --team ./my_project/npc_team

The launcher discovers your team from ./npc_team or ~/.npcsh/npc_team, lets you pick an NPC, and starts the tool with that NPC's directive. For Claude Code, it also passes the other NPCs as sub-agents via --agents.

For deeper integration (jinxes exposed as MCP tools, team switching mid-conversation), register the NPC plugin:

npc-plugin claude    # install MCP server + hooks
npc-plugin codex     # same for Codex
npc-plugin gemini    # same for Gemini CLI

Features

  • Agents (NPCs) — AI agents with personas, directives, and tool sets
  • Team Orchestration — Delegation, review loops, multi-NPC discussions
  • Jinxes — Jinja Execution templates — reusable tools for users and agents
  • Skills — Knowledge-content jinxes with progressive section disclosure
  • NQL — SQL models with embedded AI functions (Snowflake, BigQuery, Databricks, SQLite)
  • Knowledge Graphs — Build and evolve knowledge graphs from conversations
  • Deep Research — Multi-agent hypothesis generation, persona sub-agents, paper writing
  • Computer Use — GUI automation with vision
  • Image, Audio & Video — Generation via Ollama, diffusers, OpenAI, Gemini
  • MCP Integration — Full MCP server support with agentic shell TUI
  • API Server — Serve teams via OpenAI-compatible REST API

Works with all major LLM providers through LiteLLM: ollama, openai, anthropic, gemini, deepseek, openai-like, and more.


Installation

pip install 'npcsh[lite]'        # API providers (ollama, gemini, anthropic, openai, etc.)
pip install 'npcsh[local]'       # Local models (diffusers/transformers/torch)
pip install 'npcsh[yap]'         # Voice mode
pip install 'npcsh[all]'         # Everything
System dependencies

Linux:

sudo apt-get install espeak portaudio19-dev python3-pyaudio ffmpeg libcairo2-dev libgirepository1.0-dev
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen3.5:2b

macOS:

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

Windows: Install Ollama and ffmpeg, then ollama pull qwen3.5:2b.

API keys go in a .env file:

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

Rust Edition (experimental)

A native Rust build of npcsh is available — same shell, same DB, same team files, faster startup. Still experimental.

cd npcsh/rust && cargo build --release
cp target/release/npcsh ~/.local/bin/npc   # or wherever you want

Both editions share ~/npcsh_history.db and ~/.npcsh/npc_team/ and can be used interchangeably.

Read the Docs

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

Links

Research

  • Quantum-like nature of natural language interpretation: arxiv, accepted at QNLP 2025
  • Simulating hormonal cycles for AI: arxiv

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

Project details


Release history Release notifications | RSS feed

This version

1.2.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npcsh-1.2.9.tar.gz (20.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

npcsh-1.2.9-py3-none-win_amd64.whl (39.8 MB view details)

Uploaded Python 3Windows x86-64

npcsh-1.2.9-py3-none-manylinux_2_35_x86_64.whl (39.8 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

npcsh-1.2.9-py3-none-macosx_14_0_arm64.whl (39.8 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

npcsh-1.2.9-py3-none-macosx_13_0_x86_64.whl (47.5 MB view details)

Uploaded Python 3macOS 13.0+ x86-64

File details

Details for the file npcsh-1.2.9.tar.gz.

File metadata

  • Download URL: npcsh-1.2.9.tar.gz
  • Upload date:
  • Size: 20.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for npcsh-1.2.9.tar.gz
Algorithm Hash digest
SHA256 98388a951256ea1efababa25a1c31717abf5dcaeabad2da5e5eb4aef0f17f4fc
MD5 e17136db53b0ef736858e0eb0787a8cc
BLAKE2b-256 76c49ce8e094b235633d784a1101ce9fe6ef6d4aefd28280b14ff105edf8c229

See more details on using hashes here.

File details

Details for the file npcsh-1.2.9-py3-none-win_amd64.whl.

File metadata

  • Download URL: npcsh-1.2.9-py3-none-win_amd64.whl
  • Upload date:
  • Size: 39.8 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for npcsh-1.2.9-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 33b5261dc800b947683303e88478c255f07a0b4f3e07f3c6a40b6aa30bec157c
MD5 6ee51cf756dbae206a44d9d7b46ab255
BLAKE2b-256 fe4bbb2cc72edec28387b2767a2a643bde538825814443823dbf367f5ab8c474

See more details on using hashes here.

File details

Details for the file npcsh-1.2.9-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for npcsh-1.2.9-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 654c8a33ae17cb046e0817d6a8caeebdc9a64bac46db3f1c82bc67607b32b9f6
MD5 e04e0a6b9e87043b2da1ba9357a1dd4b
BLAKE2b-256 24e817d54ffffe9af078b2ba4e63de7cf693b4997b5597b283b3bf9478912041

See more details on using hashes here.

File details

Details for the file npcsh-1.2.9-py3-none-macosx_14_0_arm64.whl.

File metadata

  • Download URL: npcsh-1.2.9-py3-none-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 39.8 MB
  • Tags: Python 3, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for npcsh-1.2.9-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b85ca26135e9bb55d8b91b1a9eed689af0586c9f10931c1484c7458501ee33c7
MD5 66de593488b2447879d31c13ca48255d
BLAKE2b-256 03f691f6831b8112efd9b8c6b7b99cb32aaa69caa903ea916d8aa75bd7026ace

See more details on using hashes here.

File details

Details for the file npcsh-1.2.9-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for npcsh-1.2.9-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 a6481fb0d52096b91b702ea69af84ca72c464fbfdea0fd784b92e9790a960df9
MD5 e5203640beb628ca6b28dd5ade126a90
BLAKE2b-256 64e0f2d003a63f3bc2b2569eddb4dc5108e34c4ac8fc7017a5cf9dc2015d264d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page