Capabilities · Nin

Fifteen ninjutsu pi-cli already ships.

Every capability below is cited against the actual file that implements it. No roadmap slides — code you can run today.

15 ninjutsu · source-cited

What pi-cli actually does

Not 'code understanding'. Real plan → run → prove loops with evidence.

Natural-language entry — pi "…"

If your first argv isn't a known subcommand, the omni-router translates it, resumes any matching session, then chains real subprocesses (validate → fix → prompt). No chat-box trap.

Terminal
$ pi "fix the lint warnings and re-run validate"|
→ planFromNlpPrimary: validate → fix
✓ validate: 4 → 0 violations
✓ fix applied: 4 patches, confidence >= 0.85

// source: packages/pi-cli/src/lib/omni-router.ts

Multilingual, offline-tolerant routing

polyglot-router calls the Pi API for plans; on failure it falls back to an offline envelope so intent-classifier heuristics still dispatch commands from any language.

Terminal
$ pi "lance une vérification et corrige les erreurs"|
→ locale: fr · normalized: validate + fix
✓ routed to offline heuristic (API offline)

// source: packages/pi-cli/src/lib/polyglot-router.ts, nlp-router.ts

pi learn — repo DNA

Scans TS/JS (chunked for big repos), builds import histograms, collects polyglot hints, redacts secrets, and persists a team-shareable system-style fingerprint.

Terminal
$ pi learn --with-graph|
→ scanRepoInChunks: 847 files in 12 batches
✓ .pi/system-style.json written, secrets redacted

// source: packages/pi-cli/src/commands/learn.ts, lib/privacy/redactor.ts

pi resonate — Staff-Engineer session

Multi-turn architecture mode with repo DNA, git context, pattern recall, optional Mastra workflow, and emits .pi-plan.md you can execute step by step.

Terminal
$ pi resonate "break up the monolithic checkout service"|
→ staged → deep, recalling 3 past patterns
✓ .pi/resonance/checkout-split-2026-04-17.md
✓ .pi-plan.md (8 steps) ready for pi execute

// source: packages/pi-cli/src/commands/resonate.ts

pi prompt — codebase-aware prompt compiler

Runs preflight (dependency-chain), calls the API for a paste-ready prompt with your actual imports and patterns, caches, diffs against last run, copies to clipboard.

Terminal
$ pi p "refactor auth context to Supabase SSR"|
→ context quality: 94% (style + graph attached)
✓ cached to .pi/prompt-cache/auth-ssr.md, copied

// source: packages/pi-cli/src/commands/prompt.ts

pi routine v2 — specs with progressive handoff

Generates versioned routine markdown (slug.vN.md), per-phase folders (.dag.json / .progress.json), and pi routine next advances phases as work lands.

Terminal
$ pi routine "ship Stripe checkout + webhook"|
✓ stripe-checkout-flow.v1.md (4 phases)
$ pi routine next|
→ phase 2/4: webhook signature verification

// source: packages/pi-cli/src/commands/routine.ts, routine-next.ts

pi validate — deterministic + cloud

Sharingan/ts-morph built-ins, project rules, polyglot scans. Merges with cloud validation, caches via Rasengan, supports --hunks-only and --async for big repos.

Terminal
$ pi validate --hunks-only --async|
→ 128 hunks across 23 files · workflow polling
✓ 0 violations · 42 rules ran · 18 served from cache

// source: packages/pi-cli/src/commands/validate.ts

pi fix — safe, interactive autofix

Same rule engine as validate. Generates deterministic patches, filters by confidence, lets you apply interactively. No rogue AI rewrites.

Terminal
$ pi fix --interactive --min-confidence 0.9|
✓ 6/8 patches applied (2 skipped)

// source: packages/pi-cli/src/commands/fix.ts, lib/rules/patch-generator.ts

pi watch — governance on save

Chokidar + daemon mode, PID lock, heartbeat, rotating logs. Validates only changed files on each save — your IDE with guardrails.

Terminal
$ pi watch --daemon|
→ daemon started · pid 14382 · logs .pi/watch.log
✓ src/app/checkout/page.tsx — 0 violations

// source: packages/pi-cli/src/commands/watch.ts, lib/watch-observability.ts

Universal VCS — Git, Perforce, GitLab, more

Adapter cache with getPendingChanges / getChangedHunksLegacy. Host-labeled Git (GitLab / Bitbucket / Gerrit), Perforce (p4), unknown adapters all work.

Terminal
$ pi vcs|
→ type: git · host: gitlab · capabilities: hunks, stash

// source: packages/pi-cli/src/lib/vcs/index.ts

Sessions, tasks, resume

Every command records a task tree. pi resume rejoins any in-flight workflow; pi trace fetches workflow snapshots; session-store pins transcripts per cwd.

Terminal
$ pi tasks tree|
└─ validate · run_abc123 · suspended
$ pi resume abc123|

// source: packages/pi-cli/src/lib/task-store.ts, session-store.ts

Git hooks + CI generator

git-hooks-installer wires pre-commit / pre-push pi validate. ci-generator emits GitHub / GitLab / Circle workflows with .pi cache and monorepo env hints.

Terminal
$ pi init --with-hooks --ci github|
✓ .git/hooks/pre-commit installed
✓ .github/workflows/pi-routine-check.yml

// source: packages/pi-cli/src/lib/git-hooks-installer.ts, ci-generator.ts

Agentic IDE injection

Merges a marker-delimited block into .cursorrules, CLAUDE.md, .clinerules, .windsurf/rules. Pins agents to your system-style and specific routine paths (not the whole library).

Terminal
$ pi routine --inject-ide cursor,claude|
✓ merged block into .cursorrules + CLAUDE.md

// source: packages/pi-cli/src/lib/agentic-ide-injector.ts

pi flow — named pipelines

setup, check-and-fix, full-check. Chains init / sync / learn / validate / fix / resonate / doctor in a single command with sensible defaults.

Terminal
$ pi flow full-check|
→ learn → validate → fix → doctor
✓ all 4 stages green

// source: packages/pi-cli/src/commands/flow.ts

pi doctor — readiness report

Aggregates API health, .pi artifacts, polyglot hints, Sharingan boundary demo, hooks / CI detection, watch status. --fix runs remediation inline.

Terminal
$ pi doctor --fix|
→ 12/12 checks · 1 auto-fixed (missing .pi/config.json)

// source: packages/pi-cli/src/commands/doctor.ts