Skip to main content

Claude Code-style CLI harness for the Subnet 66 ninja agent

Project description

xninja

xninja is a small PyPI-ready CLI package that runs the public unarbos/ninja agent like a local coding assistant.

It bundles the latest ninja agent.py snapshot at package build time and calls its validator-compatible contract:

solve(repo_path, issue, model, api_base, api_key)

Install

Prerequisites

  • Python 3.11 or newer
  • pip (bundled with Python)
  • An OpenRouter API key

From PyPI (recommended)

pip install xninja

Verify the installation:

xninja --version

From source

Clone the repository and install in editable mode:

git clone https://github.com/unarbos/xninja.git
cd xninja
python -m pip install -e .

Verify the installation:

xninja --version

Configure

xninja config

This stores your OpenRouter API key and default model in the OS user config directory, such as ~/.config/xninja/config.json on Linux. The file is written with user-only permissions.

Environment variables override stored config:

OPENROUTER_API_KEY=...
XNINJA_MODEL=anthropic/claude-sonnet-4.6

Use

Open an interactive session in the current git repo:

xninja

Run a one-shot task:

xninja "fix the failing parser test"

Run explicitly:

xninja run --repo . --model anthropic/claude-sonnet-4.6 "add validation for empty input"

By default, xninja previews the returned patch and asks before applying it. Use --apply to request application after the run.

Agent Sources

Show bundled metadata:

xninja agent info

Cache and use a specific unarbos/ninja ref:

xninja agent update --ref cec561e45192042687c053237c1db503cd7d3ae0
xninja run --agent-ref cec561e45192042687c053237c1db503cd7d3ae0 "fix the issue"

Use your own compatible local agent.py:

xninja run --agent-path ./agent.py "fix the issue"
xninja --agent-path ~/agents/my_agent.py "fix the issue"

Custom agents must expose the same callable contract as the bundled agent:

def solve(repo_path, issue, model, api_base, api_key):
    return {"patch": "", "logs": "", "steps": 0, "cost": None, "success": True}

Models

xninja models

Recommended defaults are intentionally simple. You can pass any OpenRouter model id with --model.

Development

python -m pip install -e '.[dev]'
pytest
python -m build

Project details


Download files

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

Source Distribution

xninja-0.1.0.tar.gz (81.4 kB view details)

Uploaded Source

Built Distribution

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

xninja-0.1.0-py3-none-any.whl (78.4 kB view details)

Uploaded Python 3

File details

Details for the file xninja-0.1.0.tar.gz.

File metadata

  • Download URL: xninja-0.1.0.tar.gz
  • Upload date:
  • Size: 81.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for xninja-0.1.0.tar.gz
Algorithm Hash digest
SHA256 be011351d8bddac3af9c3ee7afdf72490cb44fbcae2a97ae78aaef8fd121b9ef
MD5 1f345ca50c49284af2756f034078dfb4
BLAKE2b-256 3bba333cd5cb6085225a3cb6eee10ebf1e32fb7cce6e801790ebb6b9380a3dd5

See more details on using hashes here.

File details

Details for the file xninja-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xninja-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 78.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for xninja-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 466b2f93e72a53c388d5811b65d344b763b028946991a2aa00f76597390c3233
MD5 58eb912436c01f21dbae9053ae8c5ca9
BLAKE2b-256 006637e48038ddf6b06c69673a3b1e1bd7c63e7816267c160581e3c1a39bc4cd

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