@pithosai/pithosai
v1.0.38
Published
Pithos AI CLI — multi-role coding and product agents (bundled distribution).
Readme
Pithosai (@pithosai/pithosai)
Multi-role AI CLI for coding and product work: natural-language requests, pluggable models (DeepSeek, China direct APIs, OpenRouter, Ollama, Krouter/Kiro, Cursor), and role-based prompts stored in SQLite.
Current release: 1.0.38 — see What's new and Code/CHANGELOG.md section [1.0.38].
Reading bundled files: files referenced below (e.g.
docs/KROUTER.md) are shipped inside the npm package but have no public URL on npmjs.com. Open them in the npm Code tab atCode/<relative path>(e.g.Code/docs/KROUTER.md).
| | | |---|---| | Best for | Agent-style coding, multi-role workflows (RD / PM / QA / …), local or cloud models, repeatable prompts from a local database | | Requirements | Node.js ≥ 22.19 and at least one model provider | | Platforms | macOS, Linux, and Windows (Git Bash required on Windows — PowerShell is refused; 1.0.33 fixes bundled path resolution so the CLI starts on Windows) | | License | Proprietary — see License |
Installation
npm install -g @pithosai/pithosaiOn Windows, run pithosai from Git Bash (or another MSYS/bash shell). PowerShell is not supported: the installed *.ps1 bin shims exit with pithosai cannot run in powershell, please use git bash. If PowerShell reports that scripts are disabled (ExecutionPolicy), use Git Bash instead of changing policy just to run the CLI.
On a global install, if ~/.pithosai/pithosai.db does not exist, it is created from the bundled schema. Override the path with PITHOSAI_DB_PATH. The first CLI start seeds built-in role templates when pithosai_role_prompts is empty (1.0.31).
Encrypted storage uses @journeyapps/[email protected] (prebuilds for Windows, macOS including Apple Silicon, and Linux). If the native module fails to load, plaintext or missing databases still open with better-sqlite3. An encrypted pithosai.db is never overwritten silently (1.0.34): an interactive session prompts once (default No) and, on confirm, renames the encrypted file to a timestamped sibling before creating a fresh plaintext DB; non-interactive sessions and unrecognized file headers abort and leave the file untouched.
Highlights
- DeepSeek V4 — Cost-first
deepseek-v4-flashby default;--proand--reasonerfor harder work (details). - China-mainland models (1.0.12) — Kimi Code, Moonshot, MiniMax, Z.ai, Xiaomi via direct API keys; Qwen, Baidu, StepFun, and more via OpenRouter when no direct key is set.
- Global OpenRouter models (1.0.15) — Anthropic, OpenAI, Google, Meta, Mistral, and more from the OpenRouter catalog, all via
OPENROUTER_API_KEY. Reasoning models (Claude Sonnet 4, Claude Opus 4, o3, o4-mini, …) get proper thinking format and developer-role compat automatically (details; provider slug list inCode/src/models/README.md). - Role shortcuts —
rdsai,pmsai,qasai,cosai,mktai,wrsaipreset role and model defaults. - Orchestration shortcut —
orchairuns the multi-role chain (src/agent-orch/) from an installed package without resolving the package root. - Full-screen TUI — Transcript, tool output, slash commands (
/model,/shell,/list, skills,/image, …), and@file/path completion. Enter submits; Shift+Enter (or Ctrl+J) inserts a newline in the input box. Long first-line input wraps inside the frame instead of disappearing under the right border (1.0.29). After submit, the transcript showsYou:once; cwd lives on the footer line, not as a secondcwd …/request: …echo (1.0.18). - Virtual projects — Switch workspaces from the REPL via
pithosai_virtual_projectinpithosai.db(details). - Plan alignment —
/grill-mestress-tests a design one question at a time (details). - Run modes —
agent(full tools),dialog(read-only),plan(writes<slug>-plan.md). - Local persistence — Tasks and prompts in SQLCipher-backed SQLite; optional
pithosai migrate-dbfrom legacy plaintext DBs. - Skills & email — ClawHub-style skills in-session;
heartbeat/email-monitorfor IMAP-driven tasks.
Quick start
export DEEPSEEK_API_KEY=sk-... # or another provider below
cd your-project
pithosai "Describe what you want done"| Invocation | Behavior |
|------------|----------|
| pithosai -i | Interactive session with no initial prompt |
| pithosai --no-interactive "…" | Single run, then exit |
| pithosai --report-json ./last-run.json "…" | Interactive or one-shot; report file written on /exit (interactive) or after run (--no-interactive) |
| pithosai --no-interactive --json "…" | Single run + JSON report on stdout (script mode) |
| pithosai -C ./other-dir "…" | Use a different project directory |
| /exit or /quit | Leave the REPL (plain exit is sent to the agent) |
Each run prints a short ASCII banner with the CLI version under it. Role prompts (IDENTITY, ABILITIES, AGENTS) load from the local database (pithosai_role_prompts in ~/.pithosai/pithosai.db). An empty table is filled from the Role Market on startup. Per-project .pithosai/<role>/ holds optional memory.md and sessions — not runtime role prompts.
Shell scripts (one-shot runs)
Use --no-interactive for automation. One-shot runs stream assistant text without a stderr Running… spinner. The process exit code tells you whether the run succeeded:
| Exit code | Meaning |
|-----------|---------|
| 0 | Success |
| 1 | Agent run failed (API error, timeout, etc.) |
| 2 | Run stopped by user (Ctrl+S) |
Optional machine-readable report:
# Write report to a file (success/failure, error, changed files)
node pithosai.js -r PM -l zh --no-interactive \
--report-json ./last-run.json \
"Create the product spec"
# Or print JSON to stdout (banner is skipped when --json is set; agent output is suppressed)
report=$(node pithosai.js -r PM -l zh --no-interactive --json "Create spec")
echo "$report" | jq -e '.[0].success' >/dev/nullReports are always a JSON array — one element per agent run. One-shot mode writes [{ ... }]. Interactive mode with --report-json appends one object per turn (including after role switches) and writes the full array on /exit or /quit.
Each run object includes files.created, files.modified, and files.deleted (hybrid git snapshot + write/edit tool tracking).
In interactive sessions, --report-json is also supported: the report file is written once when you exit with /exit or /quit, and again when you switch roles with /role <name> (current runs are saved first, then the role changes).
Example retry loop (one-shot script mode):
REPORT=$(mktemp)
trap 'rm -f "$REPORT"' EXIT
for attempt in 1 2 3; do
if node pithosai.js -r PM -l zh --no-interactive --report-json "$REPORT" "Create spec"; then
jq -r '.[0].files.created[]' "$REPORT"
break
fi
echo "retry $attempt: $(jq -r '.[0].error // .[0].status' "$REPORT")"
doneGit AI checkpoints
If git-ai is installed and on PATH, pithosai checkpoints write / edit / read through JSON command hooks — not hardcoded in the agent wrapper. Git AI is an external CLI (scripts/pithosai-git-ai-adapter.js, published as the pithosai-git-ai-adapter bin), not an in-process core adapter. The bundled default is src/agent/hooks/configs/git-ai.json; override it with ~/.pithosai/hooks/git-ai.json or <project>/.pithosai/hooks/git-ai.json. {pithosaiCli:pithosai-git-ai-adapter} expands to the shipped CLI (source scripts/ or release dist/). hookType uses pithos names (beforeToolExecute, afterToolExecute; postToolExecute is an alias of afterToolExecute). Enabled by default; set PITHOSAI_GIT_AI=0 (or false / no / off) to skip the adapter. Checkpoint failures are logged and never block the tool. beforeToolExecute commands that exit 2 do block the tool.
Full hook types, JSON schema, CLI, and env vars: see Code/docs/hooks-usage.md.
{
"version": "v1",
"hooks": [
{
"name": "git-ai-before-tool",
"enabled": true,
"matcher": "^(write|edit|read)$",
"timeout": 30,
"hookType": "beforeToolExecute",
"command": "{pithosaiCli:pithosai-git-ai-adapter} checkpoint pre"
},
{
"name": "git-ai-after-tool",
"enabled": true,
"matcher": "^(write|edit|read)$",
"timeout": 30,
"hookType": "afterToolExecute",
"command": "{pithosaiCli:pithosai-git-ai-adapter} checkpoint post"
}
]
}Language
Default locale is English. Set per run with --lang, or rely on the shell LANG.
pithosai --lang zh "请解释这个错误"Supported codes include en, ar, de, es, fr, it, ja, ko, nl, pt, zh, and zh-hant (Traditional Chinese, fixed in 1.0.7). Run pithosai --help for the full list.
Natural-language command fallback (bash / zsh)
Source dist/pithosai-nl-fallback.sh (npm Code tab; the scripts/ source is not published) so unknown shell commands that look like natural language (English, Chinese, …) run pithosai instead of dying as "command not found". The hook registers command_not_found (plus a pre-parse intercept in interactive zsh, and a Ctrl-J intercept in bash 4+); classification runs in Node (lookpath + tinyld, a 0–100 shell-command score, and when the score is below 50 an LLM that may answer only shell or natural):
# zsh (~/.zshrc) or bash 4+ (~/.bashrc) — from this repo:
source /path/to/pithosai/scripts/pithosai-nl-fallback.sh
# After `npm run install:global` or `npm install -g` (script is copied into dist/):
source "$(npm root -g)/@pithosai/pithosai/dist/pithosai-nl-fallback.sh"Then in the same terminal:
add tests for this file
给这个文件添加测试Those become:
pithosai --no-interactive --model krouter-rd "$input"Skipped (normal command not found): first token is a real command on PATH, a path (foo/bar), a flag-like line (foo --help), a valid for/if one-liner, or a single-token typo (gti). Hyphens inside words or paths (api-cettire-orders) still go to pithosai. On this command not found path the typed line is never rewritten to pithosai --no-interactive … (only the interactive zsh Enter intercept and the bash Ctrl-J intercept rewrite it, and only in place).
In interactive zsh, Enter is intercepted before parse so lines like for these files: … / for thest files: … go to pithosai instead of a keyword parse error. Real PATH commands (git status) still execute normally.
bash 4+: plain Enter cannot be intercepted — bash consumes \C-m as the built-in accept-line before any bind -x macro runs, so the NL path is reached by pressing Ctrl-J at the end of an NL line instead of Enter. Lines that bash fails to parse (for these files: show size) also never reach command_not_found, so they cannot be recovered on plain Enter — use Ctrl-J for those. Lines that parse but name an unknown command (list the files here) still reach the NL fallback through command_not_found on plain Enter. Skipping a line through the Ctrl-J intercept also leaves real PATH commands and valid for/if one-liners to execute unchanged.
macOS system bash 3.2 has neither command_not_found_handle nor bind -x; use zsh or Homebrew bash.
The intercept rewrites the pending readline line into the pithosai invocation and submits it on the same Ctrl‑J keypress via a two‑key readline macro: the shell handler (bound to \C-x\C-p) rewrites READLINE_LINE, then \C-m (accept-line) executes it; the handler never evaluates a command or spawns a terminal‑reading child, so TAB completion keeps working after an NL line.
Classification needs Node.js on PATH (or PITHOSAI_NODE) and nl-fallback-classify next to the sourced script (dist/nl-fallback-classify.mjs after a build/global install, or src/cli/shared/nl-fallback/nl-fallback-classify.js when sourcing from this repo). When the heuristic shell-command score is below 50 but still uncertain (foo bar baz), the classifier asks the LLM (RD via Krouter by default, 1.0.32) for exactly shell or natural. Clear natural-language lines (starters, reserved-keyword prose, questions, CJK, tinyld, or longer than 300 characters / 200 words) go to pithosai with no LLM call so Enter does not wait on the network. Overlong lines that still look like shell (path, flags, or a PATH command) keep normal shell handling. Requires bash 4+ (command_not_found_handle) or zsh (command_not_found_handler).
| Variable | Role |
|----------|------|
| PITHOSAI_NL_FALLBACK | Disable all NL interception: 0 / false / no / off |
| PITHOSAI_NL_ZLE | Disable the zsh Enter / bash Ctrl-J intercept only: 0 / false / no / off |
| PITHOSAI_NL_MODEL | Agent model for matches (default krouter-rd) |
| PITHOSAI_NL_CLASSIFY_LLM | Skip the classify LLM when shell-score is below 50: 0 / false / no / off |
| PITHOSAI_NL_CLASSIFY_TIMEOUT_MS | Classify LLM timeout in ms (default 4000) |
| PITHOSAI_NL_CLASSIFY_MODEL | Classify LLM id (default RD; if unset, uses PITHOSAI_NL_MODEL, and krouter-rd maps to RD) |
| PITHOSAI_NL_CLASSIFY_API_BASE | Classify LLM base URL (default Krouter; also KROUTER_API_BASE / KIRO_API_BASE) |
| PITHOSAI_NL_CLASSIFY_API_KEY | Classify LLM API key (optional; also KROUTER_API_KEY / KIRO_API_KEY) |
| PITHOSAI_NL_DEBUG_LOG | Print classify/LLM/hook debug on stderr: 1 / true / yes / on |
| PITHOSAI_BIN | pithosai binary (default pithosai) |
| PITHOSAI_LANG | Override locale for hook messages and --lang |
| PITHOSAI_NODE | Node binary for the classifier (default node) |
Sourcing the hook in zsh sets NO_NOMATCH so punctuation like ? in hello, who are you? is not treated as a glob (otherwise zsh prints no matches found and never calls the handler). Quote the line if a glob would match real files (*, ?).
Upgrading from v1.0.4 (plaintext database)
From 1.0.5 onward, plaintext databases migrate automatically when encryption is available, or you can run pithosai migrate-db. See Code/CHANGELOG.md section [1.0.5].
Model providers
Configure at least one of the following.
| Provider | Setup |
|----------|--------|
| DeepSeek | export DEEPSEEK_API_KEY=sk-... |
| Kimi Code | export KIMI_API_KEY=sk-... (pi-ai kimi-coding; e.g. kimi-for-coding) |
| Moonshot / Kimi platform | export MOONSHOT_API_KEY=sk-... (pi-ai moonshotai / moonshotai-cn) |
| MiniMax | export MINIMAX_API_KEY=sk-... and/or export MINIMAX_CN_API_KEY=sk-... |
| Z.ai (GLM) | export ZAI_API_KEY=sk-... |
| Xiaomi MiMo | export XIAOMI_API_KEY=sk-... |
| OpenRouter | export OPENROUTER_API_KEY=sk-or-... (qwen, baidu, stepfun, tencent, … when no direct key) |
| Ollama (local) | Install Ollama, run a model, then export OPENAI_LOCAL_API_BASE=http://localhost:11434/v1 and export OPENAI_LOCAL_API_KEY=ollama |
| Krouter (Kiro provider) | On by default (http://localhost:20128/v1). Start the gateway: npm install -g @sifxprime/[email protected] && krouter -t --skip-update. Override the URL with KROUTER_API_BASE. Opt out with KROUTER_DISABLED=1. Install steps: Code/docs/KROUTER.md. Legacy KIRO_* still works. API key optional. |
| Cursor CLI | Install the Cursor agent, sign in, set e.g. export CURSOR_MODEL=auto, and pass --cursor when needed |
Precedence: DeepSeek → China pi-ai direct keys (KIMI_API_KEY, MOONSHOT_API_KEY, MINIMAX_*, ZAI_API_KEY, XIAOMI_API_KEY) → Ollama → Krouter → OpenRouter → CURSOR_MODEL / --cursor. Direct keys use pi-ai model catalogs; OpenRouter skips overlapping providers (e.g. moonshotai when MOONSHOT_API_KEY is set). When --model is omitted, the CLI applies this walk and selects the first available model (provider/id). An explicit --model requires that provider's env API key or exits with code 2 ({{envVar}} is not set.).
Explicit model keys — Use --model <key> or /model <key> where <key> comes from KEY_TO_MODEL (kebab-case, e.g. kimi-for-coding, qwen-qwen-plus, ollama-qwen25-coder). Hand-crafted lists are loaded from ~/.pithosai/models.json5 (seeded from src/models/catalog.json on first run). An unknown --model key prints an error on stderr and exits with code 2. List keys in your current environment:
node -e "import { getPublicModelKeys } from './src/models/key-to-model.js'; getPublicModelKeys().forEach(console.log)"Full provider tables, env vars, and OpenRouter key patterns: see Code/src/models/README.md.
China direct APIs (1.0.12)
When a direct env key is set, pi-ai catalogs are exposed under predictable CLI prefixes:
| Env | Example --model key |
|-----|------------------------|
| KIMI_API_KEY | kimi-for-coding |
| MOONSHOT_API_KEY | moonshotai-kimi-k2-6, moonshotai-cn-kimi-k2-6 |
| MINIMAX_API_KEY / MINIMAX_CN_API_KEY | minimax-*, minimax-cn-* |
| ZAI_API_KEY | z-ai-glm-4-7 |
| XIAOMI_API_KEY | xiaomi-mimo-v2-5 |
export KIMI_API_KEY=sk-...
pithosai --no-interactive --model kimi-for-coding "Refactor this module"OpenRouter (China + Global slugs)
Use OpenRouter for any model from the OpenRouter catalog (China: Qwen, Baidu, StepFun, …; Global: Anthropic, OpenAI, Google, Meta, Mistral, …). Unset higher-priority keys if you want traffic to stay on OpenRouter.
export OPENROUTER_API_KEY=sk-or-v1-...
pithosai --no-interactive --model qwen-qwen-plus "Explain this function"
pithosai --no-interactive --model anthropic-claude-sonnet-4 "Review this code"
pithosai --no-interactive --model openai-o4-mini "Find the edge cases"Thinking models — Any OpenRouter model with reasoning: true (Claude Sonnet 4/Opus 4, o3/o4-mini, Qwen thinking variants, …) automatically gets proper thinking format and developer-role compat. After /model to a thinking key, use /new or restart so the agent bootstraps fresh.
Ollama (local)
| CLI key | Ollama tag | Agent tools (1.0.12) |
|---------|------------|----------------------|
| ollama-qwen25 | qwen2.5:14b | Yes |
| ollama-qwen25-coder | qwen2.5-coder:14b | Yes |
| ollama-deepseek-r1 | deepseek-r1:14b | No (chat-only) |
| ollama-qwythos-9b-q8 | qwythos-9b-q8 | Yes |
export OPENAI_LOCAL_API_BASE=http://localhost:11434/v1
export OPENAI_LOCAL_API_KEY=ollama
pithosai --no-interactive --model ollama-qwen25-coder "Add tests for this file"Krouter (Kiro provider gateway)
Install and run the local gateway first (full install manual: Code/docs/KROUTER.md):
npm install -g @sifxprime/krouter
krouter -t # tray; or `krouter` for foreground logsOpen http://localhost:20128/dashboard, configure providers and combos, then point pithosai at http://localhost:20128/v1. Listed CLI shortcuts are dashboard combos (RD / ARCH / PM / QA). Other gateway ids use --model krouter/<id>. No API key is required unless kRouter enables auth (KROUTER_API_KEY).
| CLI key | Krouter model id |
|---------|------------------|
| krouter-rd | RD (dashboard combo) |
| krouter-arch | ARCH (dashboard combo) |
| krouter-pm | PM (dashboard combo) |
| krouter-qa | QA (dashboard combo) |
| krouter/<id> | any id from GET /v1/models |
# optional: override the default http://localhost:20128/v1
export KROUTER_API_BASE=http://localhost:20128/v1
# opt out: export KROUTER_DISABLED=1
pithosai --no-interactive --model krouter-rd "Add tests for this file"
pithosai --no-interactive --model krouter/cu/default "Summarize this module"DeepSeek API (V4)
With a native DEEPSEEK_API_KEY, flags map to:
| Your choice | API model id | Typical use |
|-------------|----------------|-------------|
| Default (no --pro / --reasoner) | deepseek-v4-flash | Cost-efficient daily work |
| --pro | deepseek-v4-pro | Harder tasks |
| --chat | deepseek-v4-flash | Explicit chat path |
| --reasoner | deepseek-v4-pro + reasoning | Longer chain-of-thought |
Legacy ids deepseek-chat and deepseek-reasoner are retired upstream; see DeepSeek API docs. Flash paths disable API “thinking” by default so tool-heavy turns stay stable; --reasoner keeps extended reasoning enabled.
With OpenRouter only, use slugs deepseek/deepseek-v4-flash (default) and deepseek/deepseek-v4-pro (--pro / --reasoner). An OpenRouter regression was fixed in 1.0.8.
Role entrypoints
| Command | Role | Default model |
|---------|------|----------------|
| rdsai | RD | deepseek-v4-flash (unless --pro / --reasoner) |
| pmsai, qasai, cosai, mktai | PM / QA / CO / MKT | flash (--chat) |
| wrsai | WR (task mode) | flash; default language zh |
| orchai | Multi-role chain (src/agent-orch/) | per-role defaults |
The role wrappers ship as POSIX shell shims next to pithosai.mjs that invoke the same binary with preset flags (1.0.9 / 1.0.10); orchai instead execs the orchestration entrypoint dist/agent-orch/run.sh.
Use /model in the REPL to list and switch models interactively. Autocomplete includes tool-capable keys only (Ollama Qwen yes; ollama-deepseek-r1 excluded). The interactive session reuses one agent instance until /new or until the resolved model changes (1.0.12 session cache).
Agent orchestration (src/agent-orch/)
The agent-orch/ layer chains multiple roles sequentially for complex, multi-step tasks.
Each role receives the previous role's report JSON as context. Run it from the project
directory you want the agents to work in (orchai / run.sh keep the shell cwd; they do
not switch into the package install root).
./src/agent-orch/run.sh --roles MKT,ARCH,PM,RD \
--request "Analyze the market for an AI platform" \
--lang zhAvailable roles: MKT, ARCH, RD, PM, QA, CO, WR, SRE.
The final report JSON path is printed to stdout.
For embedding in other shell scripts, source base.sh and call dispatch_roles:
source "src/agent-orch/base.sh"
task_id="$(uuidgen)"
dispatch_roles "$task_id" "My Title" "My request" "zh" MKT ARCH PM RDSee Code/src/agent-orch/READEM.md for details.
Running from an npm install
npm installs ship the orchestration scripts to dist/agent-orch/ and expose an orchai
bin that execs that entrypoint. When the package is installed globally (or its .bin is on
PATH), invoke it directly — no package-root resolution needed:
orchai --roles MKT,ARCH,PM,RD \
--request "Analyze the market for an AI platform" \
--lang zhThe orchai shim resolves its own node_modules/.bin symlink, so it works for local and global
installs alike. You can still call run.sh by path if you prefer (local install shown):
./node_modules/@pithosai/pithosai/dist/agent-orch/run.sh --roles MKT,ARCH,PM,RD \
--request "Analyze the market for an AI platform" \
--lang zhBoth copies are equivalent; base.sh locates the CLI entry (pithosai.js in a checkout, dist/pithosai.mjs in an install) automatically.
Commands
| Command | Purpose |
|---------|---------|
| pithosai | Main CLI: migrate-db, interactive agent, task, heartbeat, skills, memorize, … |
| rdsai, pmsai, qasai, cosai, mktai, wrsai | Same CLI with a default role |
| orchai | Run the multi-role orchestration chain (src/agent-orch/run.sh) |
| email-monitor | Heartbeat / email-driven task loop |
| render-markdown | Render Markdown in the terminal |
| init | Optional manual create of ~/.pithosai/pithosai.db (the global install and first CLI start already do this) |
Project maintenance
| Command | What it does |
|---------|----------------|
| pithosai migrate-db | Legacy plaintext DB → SQLCipher |
| pithosai add-role <role> | Append role to supportedRoles in .settings.json |
| pithosai role-template init | Seed built-in Role Market templates (RD, PM, QA, WR, CO, MKT, SRE × en/zh) into an empty pithosai.db; prints download progress while fetching. The CLI also auto-runs this seed on startup when pithosai_role_prompts is empty |
| pithosai models | List models as JSON (default) or --table; public KEY_TO_MODEL + discovered krouter composites; optional JS regex filters match key/provider/modelId (AND) |
| pithosai role-template list | List role prompt templates stored in pithosai.db |
| pithosai role-template show <role> | Show decrypted role template content (--lang, --name) |
| pithosai role-template create <role> | Create role template in DB from bundled templates/<role>/ or --from-dir |
| pithosai role-template update <role> | Update role template prompts (--content, --file, --from-dir, or --from-remote) |
| pithosai task --file <md> | Watch a task file and run tasks |
| pithosai task summarize --task-id <id> | Refresh LLM rolling summary for one persisted task |
| pithosai task summarize --all-stale | Summarize tasks with new messages since last cursor |
| pithosai task summarize-daemon [--once] | Background loop for stale task summaries (cron-friendly) |
| pithosai cron-daemon [--once] | Load pithosai_cron_task schedules and run recurring agent jobs (requires daemon for schedules to fire) |
| pithosai memorize --start … --end … -r <role> | Build .pithosai/<role>/memory.md |
| pithosai heartbeat / heartbeat --once | Email pipeline (IMAP/SMTP in settings) |
| pithosai skills … | Install / list / remove skills |
| pithosai shell "cmd" | Run a shell command via the CLI |
Use pithosai --help and pithosai <command> --help for flags such as --timeout, --lang, --role, and --log-path. By default, logs are written to a per-project file under the OS temp directory ($TMPDIR/pithosai/<project-hash>/pithosai.log); override with --log-path or PITHOSAI_LOG_FILEPATH.
Run modes
| Mode | Use case |
|------|----------|
| agent (default) | Full tools: edit files, run commands, … |
| dialog | Answers and read-only tools (no shell tool) |
| plan | Writes <slug>-plan.md; read-only tools |
pithosai --mode dialog "Explain this error"
pithosai --mode plan "Outline the next sprint"Markdown previews: PITHOSAI_SKIP_RESULT_BROWSER, PITHOSAI_RESULT_BROWSER, PITHOSAI_PLAYWRIGHT_CHANNEL.
Interactive session
The default UI is a full-screen TUI: transcript above, input below.
Transcript
- Your turn is shown once as
You:plus the text you typed, with a blank line before it so it is separated from the previous output. - The run does not reprint
request: …orcwd …in the transcript (cwd/git is the footer line).
Editing keys
| Key | Action |
|-----|--------|
| Enter | Submit |
| Shift+Enter | Insert a newline (on macOS this works even when the terminal sends the same CR as Enter, e.g. Cursor / VS Code) |
| Ctrl+J | Insert a newline |
| \ then Enter | Same newline fallback |
A line that fills the box wraps onto the next row (aligned under the typed text) instead of hiding characters under the right border (1.0.29).
While the agent runs
| Key / command | Action |
|---------------|--------|
| Type + submit | Queue a follow-up message for the current run (shown on a fixed row below the running indicator) |
| /note <text> | Steer the run after the current assistant turn |
| Ctrl+S | Stop the agent |
| Ctrl+P | Pause |
| Ctrl+Z (or /bg) | Suspend the TUI so your parent shell can run commands — type fg to bring the TUI back (the agent freezes while suspended) |
After pause, edit the request if needed, then type /continue to resume or /exit to stop (plain continue, c, exit, or e are treated as request text).
Bottom chrome
- task/model/role above the framed input.
- A dim
<cwd> - git <branch>line under the input (path ≤50% width, branch ≤40%, both truncate with a leading...; no repo → path only). - The cwd/git row refreshes on session start, project/
/shell cdcwd changes, after/shellcommands, before/after each agent turn, and periodically during a run so same-directory branch switches show up without restarting.
Set PITHOSAI_NO_TUI=1 for a classic line prompt (scripts, minimal terminals).
Core slash commands
The Interactive session controls above are keybindings; the table below lists the slash commands available in the same prompt.
| Command | Description |
|---------|-------------|
| /model | List and switch models |
| /mode | Show or switch run mode (agent, dialog, plan) |
| /bg | Suspend the TUI (same as Ctrl+Z); return with fg from the parent shell |
| /shell <cmd> | Run a shell command. Full-screen tools (tig, vim, hx, less, …) attach to the terminal until they exit; /shell -i <cmd> forces that. Extra names: PITHOSAI_TTY_COMMANDS |
| /shell cd <dir> | Change working directory (~ supported); syncs session projectPath (1.0.8) |
| /list | Show persisted tasks for the current session project (includes projectPath column) |
| /list <text> | Filter tasks by title, description, or path |
| /select, /show, /show-task, /show-prompt | Work with persisted tasks. /show-task includes tool requests and tool results in the answer preview (1.0.28). /show-prompt fences the skills XML for readable preview (tools stay as a markdown list). |
| /new | Start a new task id (no prior messages loaded) |
| /list-skill, /install-skill, /remove-skill | Same as pithosai skills (ClawHub). Install/remove refresh the live agent session skills in place (no restart//new needed). |
| /skill-<name> […] | Activate an installed catalog skill for the current agent session (agent mode). Embeddable like /image; multiple tokens add to the session set. Follow-ups keep a <forced_skills> block until /skill-done, a [PITHOS_SKILL_COMPLETE:<name>] marker, or the session ends (/new, /select, …). (1.0.30) |
| /skill-done [name] | Clear all active skills, or one name; does not run the agent. (1.0.30) |
| /grill-me [topic] | Stress-test a plan with one question at a time (1.0.8) |
| /image <path> | Embed a local image in a request. Multiple /image directives can appear anywhere in the request body (start, middle, end). Each is attached to the AI and removed from the prompt text. Failed paths are reported; a mix of successes and failures is supported. (1.1.4) |
| /exit, /quit | Leave the REPL (1.0.7). Restores the parent shell screen without wiping scrollback (1.0.28). |
Tab completion covers slash commands (including /list-project, /grill-me, and /skill-<name> from the current skill catalog). For embeddable /skill-<name>, Enter in the autocomplete list applies the token like Tab (keeps editing); /skill-done and other whole-line slash commands still submit on Enter. Directory navigation via /shell cd and ls is tracked for recall (1.0.8).
@ file and directory completion (1.0.14)
Type @ in the TUI or readline prompt to autocomplete files and folders under the current project directory (runOpts.cwd / virtual project root). Suggestions include all project files (.git, node_modules, dist, and .pithosai are skipped). Tab or continue typing to filter; select a directory to keep completing with a trailing /.
Shared logic lives in src/completion/ (at-mention-utils.js for token parsing; at-path-suggestions.js for filesystem listing).
If you need full persisted task history on resume (instead of phi LUM trimming), set PHI_MESSAGES_DISABLED=true. By default, phi restores the first user turn plus the latest 2 user turns (each with assistant and tool messages).
Virtual projects
Manage multiple workspaces from the REPL without leaving the session. Registry table: pithosai_virtual_project in ~/.pithosai/pithosai.db (legacy ~/.pithosai/projects.json is imported once on first load when the table is empty).
| Column | Notes |
|--------|--------|
| id | Primary key (UUID) — use as projectId in API calls |
| account_id | Virtual account id (default admin, indexed) |
| path | Unique absolute project directory |
| name, lang, description | Project metadata shown by /list-project and /show-project |
| Command | Description |
|---------|-------------|
| /create-project [name path lang description] | Register a project, create its directory if needed, initialize git when the path is not yet versionized (via isomorphic-git), chdir, and start a new task id. With no arguments, registers the current directory (or shows it if already registered). |
| /list-project [filter] | List registered projects (index, name, path). Optional filter matches name, path, language, or description. |
| /show-project | Show cwd and registry metadata when cwd matches a saved path |
| /switch-project <index> | chdir to a listed project, initialize git when needed, and start a new task id |
Agents also have git function-call tools (git_status, git_init, git_add, git_commit, git_log, git_rollback) under src/agent/tools/git/. Status, branch, add, commit, log, and rollback prefer the system git CLI so repositories using reftable ref storage work; they fall back to isomorphic-git when git is not installed. New project init still uses isomorphic-git. git_rollback undoes local commits (soft default keeps changes staged; mixed / hard optional) and refuses to remove the root commit. After generating docs or code, agents should call code_review (deepseek-v4-pro, read-only review of uncommitted changes; optional path / filepaths); apply all findings, then git_commit with a concise AI-generated message.
/list is scoped to the active session project path and does not collide with /list-project or /list-skill by prefix.
Plan alignment (/grill-me)
/grill-me runs a Matt Pocock–style alignment prompt (one question per turn) to sharpen plans before implementation. Optional text after the command sets the focus topic. Prompt language follows --lang / settings (en, zh, zh-hant, …). A matching Cursor skill lives at .cursor/skills/grill-me/SKILL.md.
Reliability
- Connection-loss retry (1.0.8): Transient API drops (
network connection lost) are retried like timeouts. - Tool result display: Orphaned error tool results are filtered so the transcript stays consistent; ANSI styling in tool output was corrected in 1.0.8. Tool results still preview the first three non-empty lines;
taskandcode_reviewalso print the full summary (result/findings) so it is not hidden behind the JSON wrapper (1.0.24).
Startup version check
On launch, the CLI may check npm for a newer @pithosai/pithosai (at most once per 24 hours; state in ~/.pithosai/auto-upgrade-check.json) and run npm install -g @pithosai/pithosai@latest (1.0.7).
Notices use the same resolved CLI language as help. The running process remains the old build until you start pithosai again. When stdin and stdout are TTYs and the full-screen TUI would start, the CLI waits for Enter so upgrade messages are visible.
Disable with PITHOSAI_AUTO_UPGRADE=0 (or false / no / off).
Environment variables
| Variable | Role |
|----------|------|
| DEEPSEEK_API_KEY, KIMI_API_KEY, MOONSHOT_API_KEY, MINIMAX_API_KEY, MINIMAX_CN_API_KEY, ZAI_API_KEY, XIAOMI_API_KEY, OPENROUTER_API_KEY | API providers |
| OPENAI_LOCAL_API_BASE, OPENAI_LOCAL_API_KEY | Local Ollama (/v1 base URL + key; both required for ollama-* keys in /model) |
| KROUTER_API_BASE, KROUTER_DISABLED, KROUTER_API_KEY | Local kRouter (@sifxprime/krouter, on by default at http://localhost:20128/v1; set KROUTER_DISABLED=1 to opt out; key optional). See Code/docs/KROUTER.md |
| KIRO_API_BASE, KIRO_DISABLED, KIRO_API_KEY | Legacy aliases for the Krouter env vars above |
| CURSOR_MODEL, CURSOR_AGENT_BIN | Cursor CLI |
| TIPS_MODEL | Model key for pithosai shell-tips (any OpenAI-compatible catalog key; default ollama/qwen2.5-coder:14b) (1.0.33) |
| PITHOSAI_DB_PATH | SQLite DB (default ~/.pithosai/pithosai.db) |
| PITHOSAI_AUTO_UPGRADE | Disable startup check: 0 / false / no / off |
| PITHOSAI_SKIP_RESULT_BROWSER | Skip markdown preview (e.g. CI) |
| PITHOSAI_RESULT_BROWSER | e.g. chrome for Playwright |
| PITHOSAI_TIMEOUT_MS / --timeout | Run limits |
| PITHOSAI_TTY_COMMANDS | Extra /shell TUI basenames (comma/space-separated) that inherit the terminal, e.g. hx,k9s,mytui |
| PITHOSAI_NL_FALLBACK | Disable NL shell fallback: 0 / false / no / off |
| PITHOSAI_NL_ZLE | Disable NL Enter intercept only: 0 / false / no / off |
| PITHOSAI_NL_MODEL | NL fallback agent model (default krouter-rd) |
| PITHOSAI_NL_CLASSIFY_LLM | Skip NL classify LLM: 0 / false / no / off |
| PITHOSAI_NL_CLASSIFY_TIMEOUT_MS | NL classify LLM timeout (default 4000 ms) |
| PITHOSAI_NL_CLASSIFY_MODEL | NL classify LLM id (default RD) |
| PITHOSAI_NL_CLASSIFY_API_BASE | NL classify LLM base URL (Krouter by default) |
| PITHOSAI_NL_CLASSIFY_API_KEY | NL classify LLM API key (optional) |
| PITHOSAI_NL_DEBUG_LOG | NL fallback debug on stderr: 1 / true / yes / on |
| PITHOSAI_BIN | pithosai binary for NL fallback (default pithosai) |
| PITHOSAI_LANG | Override locale for NL fallback messages and --lang |
| PITHOSAI_NODE | Node binary for NL classify (default node) |
| PHI_MESSAGES_DISABLED | Set to true to disable phi turn trimming when restoring task messages |
| PITHOSAI_GIT_AI | Git AI adapter (on by default). Disable: 0 / false / no / off. JSON hooks still load. |
| PITHOSAI_DEBUG_HOOKS | Debug hook handlers when no .settings.json hooks.active preset: 1 / true |
| PITHOSAI_DEBUG_HOOKS_DATA | Log full hook payloads with debug hooks: 1 |
| PITHOSAI_SECURITY_HOOKS | Security hook handlers when no hooks.active preset: 1 / true |
| PITHOSAI_BLOCKED_TOOLS | Comma-separated tool names blocked by security hooks |
| PITHOSAI_MAX_PROMPT_LENGTH | Security-hook system-prompt length warning (default 10000) |
| SCRAPERAPI_API_KEY | Some skills / tools |
When PHI_MESSAGES_DISABLED=true, persisted task messages are restored in full chronological order instead of LUM selection (first user turn + latest 2 user turns).
What's new (v1.0.7 – v1.0.38)
Highlights for the published CLI. Full per-version notes: Code/CHANGELOG.md.
v1.0.38 — Sentry and PostHog
- The CLI reports crashes to Sentry and usage to PostHog (session start/exit, Commander commands, TUI slash command names). Events include version, OS, Node, cwd, and sanitized argv — not prompts or file contents.
- DSN, PostHog project key, and host live as constants in
src/telemetry/config.js.
v1.0.37 — Role → Krouter combo default
- When
--modelis omitted, preferkrouter-<role>(combo id matches the active role, e.g.-r QA→QA). Configure upstream models for that combo in the Krouter dashboard. - If the role combo is unknown (or Krouter is disabled), keep the previous env-walk defaults. Explicit
--model//modelstill override./roleupdates the default model unless you already chose a model explicitly.
v1.0.36 — Remove deprecated pithosai init, orchai cwd, PowerShell refuse
- Removed
pithosai init— The project-scaffold subcommand is gone. Start the CLI in any directory; DB and role templates are created/seeded on install and first start. Usepithosai role-template initonly when you need to re-seed an emptypithosai_role_promptstable. The separateinitbin (create~/.pithosai/pithosai.db) is unchanged. orchaicwd —run.shno longercds into the package root; orchestration uses the shell's current directory.- Windows PowerShell — Postinstall installs refuse
*.ps1shims; PowerShell exits withpithosai cannot run in powershell, please use git bash.Use Git Bash on Windows.
v1.0.35 — orchai bin, packaged agent-orch
orchai— Multi-role orchestration is onPATHafter install; no need to resolvedist/agent-orch/run.shby hand. See Running from an npm install.- Packaged scripts —
finalize-distcopiesbase.sh/run.shintodist/agent-orch/.base.shfinds the CLI in a checkout (pithosai.js) or an install (dist/pithosai.mjs), including Windows Git Bash viacygpath -m. - Bundled-doc paths — README references use
Code/<relative path>so files open from the npm Code tab (they have no public URL on npmjs.com).
v1.0.34 — Encrypted DB guard when SQLCipher is missing
- Non-destructive fallback — If
@journeyapps/sqlciphercannot load and~/.pithosai/pithosai.dbis encrypted, the CLI no longer opens a new empty plaintext DB at the same path. Interactive TTY: confirm → archive to{path}.{yyyyMMddHHmmss}(plus-wal/-shm/-journalsidecars), then create plaintext. Decline, cancel, or non-interactive: abort, file unchanged. Unrecognized headers also abort (fail closed). - Orchestration docs paths —
role_path()inbase.shwrites under./docs/pre-product/,./docs/pro-product/, and./docs/pos-product/.
v1.0.33 — Windows CLI, shell-tips model
- Windows — Global / bundled CLI starts on Windows again. Rspack no longer leaves the build-machine
import.meta.urlas the only path anchor; runtime entry (process.argv[1]) is used when the baked URL is foreign or missing. pithosai shell-tips— OptionalTIPS_MODELselects any OpenAI-compatible catalog key; default staysollama/qwen2.5-coder:14b.
v1.0.32 — Krouter combos, pithosai models
- Krouter catalog — Curated family keys (
kr/glm-5*,kr/minimax-*,kr/deepseek-*) are gone. Shortcuts are dashboard comboskrouter-rd,krouter-arch,krouter-pm, andkrouter-qa. Other gateway ids usekrouter/<id>(aliaskiro/<id>). See Krouter. pithosai models— Lists publicKEY_TO_MODELkeys plus discovered krouter composites. JSON on stdout by default;--tableprints aligned columns.- NL defaults — Shell fallback
PITHOSAI_NL_MODELiskrouter-rd. The classify LLM defaults to theRDcombo.
v1.0.31 — Role Market seed, bash NL fallback
- Role templates —
pithosai role-template initseeds RD, PM, QA, WR, CO, MKT, and SRE (enandzh) into an emptypithosai_role_promptstable. The CLI does the same seed on startup.role-template update <role> --from-remoterefreshes one installed role from the Role Market. - Krouter default — Env-walk default is the
RDcombo (krouter-rd).--reasoner/--prono longer switch that default. - bash NL fallback — The intercept is Ctrl-J (bash reserves Enter for
accept-line). It rewritesREADLINE_LINEand leaves TAB completion working.
v1.0.30 — /skill-<name> session activation
/skill-<name>— Embeddable tokens activate installed catalog skills on the current agent session (agent mode). Several tokens add to the set. Follow-ups keep a<forced_skills>block until/skill-done, a[PITHOS_SKILL_COMPLETE:<name>]marker, or the session ends (/new,/select, …)./skill-done [name]— Clears all active skills, or one name, without running the agent.- Completer — Tab offers
/skill-<name>from the current skill catalog.
v1.0.29 — Git AI checkpoints, TUI input wrap
- JSON command hooks — Load
~/.pithosai/hooks/*.jsonand<cwd>/.pithosai/hooks/*.json(project wins by filename).hookTypeis a pithos HookType (beforeToolExecute,afterToolExecute, …). In-process adapters stay onCORE_COMMAND_HOOK_ADAPTERS; Git AI is a bundled JSON config plus shipped CLI. See Git AI checkpoints and the "Add a pithosai core agent hook" section inCode/docs/hooks-usage.md. - Built-in hook plugins — Bundled hooks (system prompt rebuild, JSON command hooks) register through
registerBuiltinHookPlugins(), with a per-run agent context so plugins can read task id, model, and messages.pithosai hooks list/statusload the same plugins and print to stdout (they do not use deprecated.settings.jsonhooks.active). - TUI input wrap — A nearly-full first line in the framed editor wraps onto the next row instead of clipping under the right border. Wrapped rows stay aligned under the typed text.
- TUI trackpad scroll — Two-finger wheel bursts on macOS no longer freeze a long transcript; ticks coalesce and wrap results are cached.
v1.0.28 — pi 0.85.1, /show-task tools, TUI exit restore
- pi libs 0.85.1 —
@earendil-works/pi-ai,pi-agent-core,pi-coding-agent, andpi-tuiupgraded from 0.78; Node ≥ 22.19 required. Agent TUI usesTuiAltScreen. /show-tasktool runs — Preview includes tool requests and tool results (truncated) in the answer body, with localized labels.- TUI exit restore — Leaving the full-screen TUI no longer clears the restored main buffer (no nested alt-screen enter / no post-stop clear). Shell prompt and scrollback stay intact.
- Test hygiene — Vitest terminal teardown avoids leftover escape codes; skills tests mock
fetch. - Mouse-wheel transcript scroll — Wheel again scrolls the agent TUI transcript after the pi-tui 0.85.1 upgrade. All-motion mouse tracking is disabled so a macOS trackpad cannot flood stdin and freeze the CLI.
v1.0.26 — System prompt rebuild hook, TUI job control
- TUI job control — Ctrl+Z or
/bgsuspends the full-screen TUI to the parent shell;fgbrings it back. The agent freezes while suspended (same asvim/less). Unsupported on Windows. - System prompt rebuild hook — New hook type
BEFORE_CACHED_AGENT_REUSEtriggers before reusing a cached agent, rebuilding the system prompt and initial messages from DB to ensure fresh task context, skills, and role prompts.
v1.0.19 — NL fallback classifier, Enter intercept
- Natural-language command fallback — Node classifies unknown commands (
lookpath+tinyld, 0–100 shell score). Uncertain lines ask an LLM forshellornatural; clear NL (starters, reserved-keyword prose, CJK, overlong) skips that call. Interactive zsh and bash 4+ intercept Enter sofor these files: …reaches pithosai instead of a keyword parse error. Env:PITHOSAI_NL_FALLBACK,PITHOSAI_NL_ZLE,PITHOSAI_NL_MODEL,PITHOSAI_NL_CLASSIFY_LLM,PITHOSAI_NL_DEBUG_LOG,PITHOSAI_BIN,PITHOSAI_LANG,PITHOSAI_NODE. See Natural-language command fallback.
v1.0.18 — Quieter TUI transcript
- TUI transcript — Submitting a turn no longer reprints
request: …orcwd …in the scrollback (You:and the footer cwd/git line already show that). Queuing a follow-up no longer leaves a secondRunning…spinner. --no-interactive— One-shot runs no longer draw the stderr loading spinner over streamed output.- Natural-language command fallback (initial) — Source
scripts/pithosai-nl-fallback.shfrom zsh or bash 4+ so unknown English/Chinese commands run pithosai.
v1.0.15 — Global OpenRouter models, Anthropic reasoning compat
- Global OpenRouter models —
anthropic-*,openai-*,google-*,meta-*,mistral-*,cohere-*, … all available viaOPENROUTER_API_KEY. SeeCode/src/models/README.mdfor the full slug list. - Anthropic reasoning — Claude Sonnet 4, Claude Opus 4, and other Anthropic reasoning models get automatic thinking-level compat (OpenRouter requires
reasoningformat even when effort is optional). - Developer-role compat — Both China OpenRouter slugs and Anthropic reasoning models now disable the
developerrole to avoid API 400 errors. RefactoredenhanceOpenRouterModel()handles all OpenRouter models uniformly; oldenhanceOpenRouterChinaModel()alias preserved.
v1.0.12 — China-mainland models, OpenRouter compat, Ollama tools
- China-mainland providers —
KEY_TO_MODELmerges pi-ai direct catalogs (Kimi, Moonshot, MiniMax, Z.ai, Xiaomi) with OpenRouter China slugs (Qwen, Baidu, StepFun, Tencent, …). Shared env detection viaprovider-env.js; seeCode/src/models/README.md. - OpenRouter fixes — Mandatory-thinking models (
*-thinking) no longer send disabled reasoning; China slugs usesysteminstead ofdeveloperfor the system prompt (Qwen-compatible). - Agent session cache — Model switches and env-only provider changes invalidate the cached CLI agent (
resolved:provider:idcache keys). - Ollama Qwen —
ollama-qwen25andollama-qwen25-coderenable full agent tool calling locally. PHI_MESSAGES_DISABLED— Whentrue, restores full task message history instead of phi turn trimming on resume.
v1.0.11 — Runtime steer, follow-up, skills tools
- Runtime input while agent runs — Submit plain text to queue a follow-up in the current run;
/note <text>to steer after the current turn. Queued messages show on a dimmed TUI footer row. Ctrl+S stops, Ctrl+P pauses. - TUI text wrapping — Startup hints now wrap to terminal width instead of overflowing.
- Skills: read skill tools — Installed skills can expose available tool definitions for their system prompts.
- Sub Agent — add subagent module to support subagent functions
v1.0.10 — Packaging and distribution
- Simplified npm publish layout (
.npmignore, narrowedfilesfield). - Role binaries (
rdsai,pmsai, …) ship as POSIX wrappers underscripts/bin-shims/with corrected paths topithosai.mjs. - Dependencies use published
@mariozechner/*packages on npm instead of vendoredlib/pi-monocopies.
v1.0.9 — Install reliability
- Improved
npm install -gresolution for bundled agent dependencies. - Role commands consolidated as thin shell wrappers invoking
pithosai.mjs.
v1.0.8 — Session productivity
- Virtual projects —
/create-project,/list-project,/show-project,/switch-projectwith~/.pithosai/projects.json. /grill-me— Interactive plan alignment (localized prompts)./shell cd— In-process directory changes with~expansion and directory history.- Task list —
/listshowsprojectPath, supports/list <text>filter, scopes to the session project. - Resilience — Automatic retry on connection loss; OpenRouter regression fix;
taskRef.projectPathkept in sync aftercdand project switches.
v1.0.7 — Models and startup
- DeepSeek V4 — Default
deepseek-v4-flash;--pro/--reasonerselectdeepseek-v4-prowith optional reasoning. - Startup auto-upgrade — Optional global update check (24 h throttle, TTY-aware prompt).
- REPL exit —
/exitand/quit(plainexitgoes to the agent). - Locales —
zh-hantresolution fix;render-markdowndist entry fix.
Help
pithosai --helppithosai <command> --help
License
Pithosai is proprietary software; it is not published under an open-source license.
Copyright © 2026 sihuic ([email protected]). All rights reserved.
See Code/LICENSE, Code/CHANGELOG.md, and the other markdown files referenced above (relative paths docs/hooks-usage.md, docs/KROUTER.md, src/models/README.md, src/models/krouter.README.md, src/agent-orch/READEM.md — open each at Code/<path>). The license field in package.json is UNLICENSED (npm convention when no public license is granted).
