@pithosai/pithosai 1.0.7 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +784 -0
- package/LICENSE +1 -1
- package/README.md +544 -130
- package/dist/529.mjs +2 -0
- package/dist/813.mjs +3 -0
- package/dist/cosai +3 -0
- package/dist/heartbeat.mjs +378 -125
- package/dist/init.mjs +1 -1
- package/dist/mktai +3 -0
- package/dist/nl-fallback-classify.mjs +7 -0
- package/dist/pithosai-git-ai-adapter.mjs +2 -0
- package/dist/pithosai-nl-fallback.sh +456 -0
- package/dist/pithosai.mjs +378 -125
- package/dist/pmsai +3 -0
- package/dist/qasai +3 -0
- package/dist/rdsai +3 -0
- package/dist/render-markdown.mjs +7 -7
- package/dist/wrsai +3 -0
- package/docs/KROUTER.md +140 -0
- package/docs/hooks-usage.md +335 -0
- package/package.json +40 -14
- package/src/agent-orch/READEM.md +62 -0
- package/src/models/README.md +469 -0
- package/src/models/krouter.README.md +63 -0
- package/dist/935.mjs +0 -3
- package/dist/cosai.mjs +0 -596
- package/dist/mktai.mjs +0 -596
- package/dist/pmsai.mjs +0 -596
- package/dist/qasai.mjs +0 -596
- package/dist/rdsai.mjs +0 -596
- package/dist/wrsai.mjs +0 -596
package/README.md
CHANGED
|
@@ -1,198 +1,485 @@
|
|
|
1
1
|
# Pithosai (`@pithosai/pithosai`)
|
|
2
2
|
|
|
3
|
-
**Multi-role AI CLI** for coding and product work: natural-language requests, pluggable models (
|
|
3
|
+
**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.
|
|
4
4
|
|
|
5
|
-
---
|
|
5
|
+
**Current release: 1.0.32** — see [What's new](#whats-new-v107--v1032) and [`CHANGELOG.md`](CHANGELOG.md#1032---2026-09-22).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| | |
|
|
8
|
+
|---|---|
|
|
9
|
+
| **Best for** | Agent-style coding, multi-role workflows (RD / PM / QA / …), local or cloud models, repeatable prompts from a local database |
|
|
10
|
+
| **Requirements** | **Node.js ≥ 22.19** and **at least one** [model provider](#model-providers) |
|
|
11
|
+
| **License** | Proprietary — see [License](#license) |
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
---
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
- **Interactive `/model`** lists and switches available model keys.
|
|
13
|
-
- **Aliases:** `deepSeekPro` → `deepSeekCoder`, `deepSeekFlash` → `deepSeekChat` (older keys still work).
|
|
14
|
-
- **Native DeepSeek chat/coder:** requests send **`thinking: { type: "disabled" }`** so the provider’s default [thinking mode](https://api-docs.deepseek.com/guides/thinking_mode) does not force **`reasoning_content`** replay on tool-heavy turns (avoids **400** API errors). **`deepSeekReasoner`** is unchanged (thinking stays on).
|
|
15
|
+
## Installation
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g @pithosai/pithosai
|
|
19
|
+
```
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
- **`render-markdown`:** the built **`dist/render-markdown.mjs`** entry is fixed so direct execution prints output correctly.
|
|
21
|
+
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**), so `pithosai init` is not required.
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
Encrypted storage uses `@journeyapps/sqlcipher@5.3.1` (prebuilds for Windows, macOS including Apple Silicon, and Linux). If the native module fails to load, storage falls back to plaintext `better-sqlite3`.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
**Highlights**
|
|
24
26
|
|
|
25
|
-
**
|
|
27
|
+
- **DeepSeek V4** — Cost-first `deepseek-v4-flash` by default; `--pro` and `--reasoner` for harder work ([details](#deepseek-api-v4)).
|
|
28
|
+
- **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.
|
|
29
|
+
- **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](#model-providers), [`src/models/README.md`](src/models/README.md)).
|
|
30
|
+
- **Role shortcuts** — `rdsai`, `pmsai`, `qasai`, `cosai`, `mktai`, `wrsai` preset role and model defaults.
|
|
31
|
+
- **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 shows `You:` once; cwd lives on the footer line, not as a second `cwd …` / `request: …` echo (**1.0.18**).
|
|
32
|
+
- **Virtual projects** — Switch workspaces from the REPL via `pithosai_virtual_project` in `pithosai.db` ([details](#virtual-projects)).
|
|
33
|
+
- **Plan alignment** — `/grill-me` stress-tests a design one question at a time ([details](#plan-alignment-grill-me)).
|
|
34
|
+
- **Run modes** — `agent` (full tools), `dialog` (read-only), `plan` (writes `<slug>-plan.md`).
|
|
35
|
+
- **Local persistence** — Tasks and prompts in SQLCipher-backed SQLite; optional `pithosai migrate-db` from legacy plaintext DBs.
|
|
36
|
+
- **Skills & email** — ClawHub-style skills in-session; `heartbeat` / `email-monitor` for IMAP-driven tasks.
|
|
26
37
|
|
|
27
38
|
---
|
|
28
39
|
|
|
29
|
-
##
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export DEEPSEEK_API_KEY=sk-... # or another provider below
|
|
44
|
+
cd your-project
|
|
45
|
+
pithosai "Describe what you want done"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Invocation | Behavior |
|
|
49
|
+
|------------|----------|
|
|
50
|
+
| `pithosai -i` | Interactive session with no initial prompt |
|
|
51
|
+
| `pithosai --no-interactive "…"` | Single run, then exit |
|
|
52
|
+
| `pithosai --report-json ./last-run.json "…"` | Interactive or one-shot; report file written on `/exit` (interactive) or after run (`--no-interactive`) |
|
|
53
|
+
| `pithosai --no-interactive --json "…"` | Single run + JSON report on stdout (script mode) |
|
|
54
|
+
| `pithosai -C ./other-dir "…"` | Use a different project directory |
|
|
55
|
+
| `/exit` or `/quit` | Leave the REPL (plain `exit` is sent to the agent) |
|
|
56
|
+
|
|
57
|
+
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, so you do not run `pithosai init` first. Per-project `.pithosai/<role>/` holds optional `memory.md` and sessions — not runtime role prompts. `pithosai init [dir]` remains an optional project scaffold.
|
|
58
|
+
|
|
59
|
+
### Shell scripts (one-shot runs)
|
|
60
|
+
|
|
61
|
+
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:
|
|
30
62
|
|
|
31
|
-
|
|
63
|
+
| Exit code | Meaning |
|
|
64
|
+
|-----------|---------|
|
|
65
|
+
| `0` | Success |
|
|
66
|
+
| `1` | Agent run failed (API error, timeout, etc.) |
|
|
67
|
+
| `2` | Run stopped by user (Ctrl+S) |
|
|
68
|
+
|
|
69
|
+
Optional machine-readable report:
|
|
32
70
|
|
|
33
71
|
```bash
|
|
34
|
-
|
|
72
|
+
# Write report to a file (success/failure, error, changed files)
|
|
73
|
+
node pithosai.js -r PM -l zh --no-interactive \
|
|
74
|
+
--report-json ./last-run.json \
|
|
75
|
+
"Create the product spec"
|
|
76
|
+
|
|
77
|
+
# Or print JSON to stdout (banner is skipped when --json is set; agent output is suppressed)
|
|
78
|
+
report=$(node pithosai.js -r PM -l zh --no-interactive --json "Create spec")
|
|
79
|
+
echo "$report" | jq -e '.[0].success' >/dev/null
|
|
35
80
|
```
|
|
36
81
|
|
|
37
|
-
|
|
82
|
+
Reports 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`.
|
|
38
83
|
|
|
39
|
-
|
|
84
|
+
Each run object includes `files.created`, `files.modified`, and `files.deleted` (hybrid git snapshot + write/edit tool tracking).
|
|
40
85
|
|
|
41
|
-
|
|
86
|
+
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).
|
|
42
87
|
|
|
43
|
-
|
|
44
|
-
|--------|---------|
|
|
45
|
-
| `pithosai` | Main CLI: `init`, `migrate-db`, interactive agent, `task`, `heartbeat`, `skills`, `memorize`, and more. |
|
|
46
|
-
| `rdsai`, `pmsai`, `qasai`, `cosai`, `mktai`, `wrsai` | Same CLI with a **default role** (e.g. RD, PM, QA). See [Role entrypoints and models](#role-entrypoints-and-models) below. |
|
|
47
|
-
| `email-monitor` | Heartbeat / email-driven task loop (`heartbeat` bundle). |
|
|
48
|
-
| `render-markdown` | Render Markdown files in the terminal. |
|
|
49
|
-
| `init` | Manually initialize `~/.pithosai/pithosai.db` if needed (usually automatic after global install). |
|
|
88
|
+
Example retry loop (one-shot script mode):
|
|
50
89
|
|
|
51
|
-
|
|
90
|
+
```bash
|
|
91
|
+
REPORT=$(mktemp)
|
|
92
|
+
trap 'rm -f "$REPORT"' EXIT
|
|
93
|
+
for attempt in 1 2 3; do
|
|
94
|
+
if node pithosai.js -r PM -l zh --no-interactive --report-json "$REPORT" "Create spec"; then
|
|
95
|
+
jq -r '.[0].files.created[]' "$REPORT"
|
|
96
|
+
break
|
|
97
|
+
fi
|
|
98
|
+
echo "retry $attempt: $(jq -r '.[0].error // .[0].status' "$REPORT")"
|
|
99
|
+
done
|
|
100
|
+
```
|
|
52
101
|
|
|
53
|
-
|
|
102
|
+
### Git AI checkpoints
|
|
103
|
+
|
|
104
|
+
If [`git-ai`](https://usegitai.com/docs/agents/add-your-agent) 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.
|
|
105
|
+
|
|
106
|
+
Full hook types, JSON schema, CLI, and env vars: [`docs/hooks-usage.md`](docs/hooks-usage.md).
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"version": "v1",
|
|
111
|
+
"hooks": [
|
|
112
|
+
{
|
|
113
|
+
"name": "git-ai-before-tool",
|
|
114
|
+
"enabled": true,
|
|
115
|
+
"matcher": "^(write|edit|read)$",
|
|
116
|
+
"timeout": 30,
|
|
117
|
+
"hookType": "beforeToolExecute",
|
|
118
|
+
"command": "{pithosaiCli:pithosai-git-ai-adapter} checkpoint pre"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "git-ai-after-tool",
|
|
122
|
+
"enabled": true,
|
|
123
|
+
"matcher": "^(write|edit|read)$",
|
|
124
|
+
"timeout": 30,
|
|
125
|
+
"hookType": "afterToolExecute",
|
|
126
|
+
"command": "{pithosaiCli:pithosai-git-ai-adapter} checkpoint post"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
```
|
|
54
131
|
|
|
55
|
-
|
|
132
|
+
### Language
|
|
56
133
|
|
|
57
|
-
|
|
134
|
+
Default locale is **English**. Set per run with `--lang`, or rely on the shell `LANG`.
|
|
58
135
|
|
|
59
|
-
|
|
136
|
+
```bash
|
|
137
|
+
pithosai --lang zh "请解释这个错误"
|
|
138
|
+
```
|
|
60
139
|
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
export OPENAI_LOCAL_API_BASE=http://localhost:11434/v1
|
|
64
|
-
```
|
|
65
|
-
Example local setup:
|
|
66
|
-
```bash
|
|
67
|
-
ollama run qwen2.5-coder:14b
|
|
68
|
-
export OPENAI_LOCAL_API_BASE=http://localhost:11434/v1
|
|
69
|
-
```
|
|
140
|
+
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.
|
|
70
141
|
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
curl https://cursor.com/install -fsS | bash
|
|
74
|
-
cursor-agent login
|
|
75
|
-
export CURSOR_MODEL=auto
|
|
76
|
-
```
|
|
77
|
-
Use **`pithosai "your request" --cursor`** or set `CURSOR_MODEL`.
|
|
142
|
+
### Natural-language command fallback (bash / zsh)
|
|
78
143
|
|
|
79
|
-
|
|
144
|
+
Source [`scripts/pithosai-nl-fallback.sh`](scripts/pithosai-nl-fallback.sh) 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`):
|
|
80
145
|
|
|
81
|
-
|
|
146
|
+
```bash
|
|
147
|
+
# zsh (~/.zshrc) or bash 4+ (~/.bashrc) — from this repo:
|
|
148
|
+
source /path/to/pithosai/scripts/pithosai-nl-fallback.sh
|
|
82
149
|
|
|
83
|
-
|
|
150
|
+
# After `npm run install:global` or `npm install -g` (script is copied into dist/):
|
|
151
|
+
source "$(npm root -g)/@pithosai/pithosai/dist/pithosai-nl-fallback.sh"
|
|
152
|
+
```
|
|
84
153
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
154
|
+
Then in the same terminal:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
add tests for this file
|
|
158
|
+
给这个文件添加测试
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Those become:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pithosai --no-interactive --model krouter-rd "$input"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**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).
|
|
168
|
+
|
|
169
|
+
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.
|
|
91
170
|
|
|
92
|
-
|
|
171
|
+
**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.
|
|
93
172
|
|
|
94
|
-
|
|
173
|
+
macOS system bash 3.2 has neither `command_not_found_handle` nor `bind -x`; use zsh or Homebrew bash.
|
|
95
174
|
|
|
96
|
-
|
|
175
|
+
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.
|
|
97
176
|
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
177
|
+
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`).
|
|
178
|
+
|
|
179
|
+
| Variable | Role |
|
|
180
|
+
|----------|------|
|
|
181
|
+
| `PITHOSAI_NL_FALLBACK` | Disable all NL interception: `0` / `false` / `no` / `off` |
|
|
182
|
+
| `PITHOSAI_NL_ZLE` | Disable the zsh Enter / bash `Ctrl-J` intercept only: `0` / `false` / `no` / `off` |
|
|
183
|
+
| `PITHOSAI_NL_MODEL` | Agent model for matches (default `krouter-rd`) |
|
|
184
|
+
| `PITHOSAI_NL_CLASSIFY_LLM` | Skip the classify LLM when shell-score is below 50: `0` / `false` / `no` / `off` |
|
|
185
|
+
| `PITHOSAI_NL_CLASSIFY_TIMEOUT_MS` | Classify LLM timeout in ms (default `4000`) |
|
|
186
|
+
| `PITHOSAI_NL_CLASSIFY_MODEL` | Classify LLM id (default `RD`; if unset, uses `PITHOSAI_NL_MODEL`, and `krouter-rd` maps to `RD`) |
|
|
187
|
+
| `PITHOSAI_NL_CLASSIFY_API_BASE` | Classify LLM base URL (default Krouter; also `KROUTER_API_BASE` / `KIRO_API_BASE`) |
|
|
188
|
+
| `PITHOSAI_NL_CLASSIFY_API_KEY` | Classify LLM API key (optional; also `KROUTER_API_KEY` / `KIRO_API_KEY`) |
|
|
189
|
+
| `PITHOSAI_NL_DEBUG_LOG` | Print classify/LLM/hook debug on stderr: `1` / `true` / `yes` / `on` |
|
|
190
|
+
| `PITHOSAI_BIN` | pithosai binary (default `pithosai`) |
|
|
191
|
+
| `PITHOSAI_LANG` | Override locale for hook messages and `--lang` |
|
|
192
|
+
| `PITHOSAI_NODE` | Node binary for the classifier (default `node`) |
|
|
193
|
+
|
|
194
|
+
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 (`*`, `?`).
|
|
195
|
+
|
|
196
|
+
### Upgrading from v1.0.4 (plaintext database)
|
|
197
|
+
|
|
198
|
+
From **1.0.5** onward, plaintext databases migrate automatically when encryption is available, or you can run `pithosai migrate-db`. See [`CHANGELOG.md`](CHANGELOG.md) section **[1.0.5]**.
|
|
101
199
|
|
|
102
200
|
---
|
|
103
201
|
|
|
104
|
-
##
|
|
202
|
+
## Model providers
|
|
203
|
+
|
|
204
|
+
Configure **at least one** of the following.
|
|
205
|
+
|
|
206
|
+
| Provider | Setup |
|
|
207
|
+
|----------|--------|
|
|
208
|
+
| **DeepSeek** | `export DEEPSEEK_API_KEY=sk-...` |
|
|
209
|
+
| **Kimi Code** | `export KIMI_API_KEY=sk-...` (pi-ai `kimi-coding`; e.g. `kimi-for-coding`) |
|
|
210
|
+
| **Moonshot / Kimi platform** | `export MOONSHOT_API_KEY=sk-...` (pi-ai `moonshotai` / `moonshotai-cn`) |
|
|
211
|
+
| **MiniMax** | `export MINIMAX_API_KEY=sk-...` and/or `export MINIMAX_CN_API_KEY=sk-...` |
|
|
212
|
+
| **Z.ai (GLM)** | `export ZAI_API_KEY=sk-...` |
|
|
213
|
+
| **Xiaomi MiMo** | `export XIAOMI_API_KEY=sk-...` |
|
|
214
|
+
| **OpenRouter** | `export OPENROUTER_API_KEY=sk-or-...` (qwen, baidu, stepfun, tencent, … when no direct key) |
|
|
215
|
+
| **Ollama (local)** | Install Ollama, run a model, then `export OPENAI_LOCAL_API_BASE=http://localhost:11434/v1` and `export OPENAI_LOCAL_API_KEY=ollama` |
|
|
216
|
+
| **Krouter (Kiro provider)** | On by default (`http://localhost:20128/v1`). Start the gateway: `npm install -g @sifxprime/krouter@0.5.118 && krouter -t --skip-update`. Override the URL with `KROUTER_API_BASE`. Opt out with `KROUTER_DISABLED=1`. Install steps: [`docs/KROUTER.md`](docs/KROUTER.md). Legacy `KIRO_*` still works. API key optional. |
|
|
217
|
+
| **Cursor CLI** | Install the Cursor agent, sign in, set e.g. `export CURSOR_MODEL=auto`, and pass `--cursor` when needed |
|
|
218
|
+
|
|
219
|
+
**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.`).
|
|
220
|
+
|
|
221
|
+
**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:
|
|
105
222
|
|
|
106
223
|
```bash
|
|
107
|
-
|
|
108
|
-
pithosai init
|
|
109
|
-
pithosai "Describe what you want done"
|
|
224
|
+
node -e "import { getPublicModelKeys } from './src/models/key-to-model.js'; getPublicModelKeys().forEach(console.log)"
|
|
110
225
|
```
|
|
111
226
|
|
|
112
|
-
|
|
113
|
-
- In that interactive loop, type **`/exit`** or **`/quit`** to leave the CLI (plain `exit` is treated as a normal message to the agent).
|
|
114
|
-
- **`pithosai --no-interactive "…"`** — one shot, then exit.
|
|
115
|
-
- **`pithosai -C ./other-dir "…"`** — use another project directory.
|
|
116
|
-
- Every CLI invocation prints a cyan ASCII `pithosai` slogan banner first.
|
|
117
|
-
- On startup, `pithosai` may check npm for the latest `@pithosai/pithosai` version (at most **once per 24 hours**, tracked in `~/.pithosai/auto-upgrade-check.json`) and auto-runs `npm install -g @pithosai/pithosai@latest` when a newer release is found. Upgrade notices use the **same resolved CLI language** as help and prompts (project settings, `--lang`, or terminal locale). After an upgrade, **this process still runs the old build** until you run `pithosai` again. In a **TTY** session (same conditions as the full-screen agent TUI), it asks you to **press Enter** so those lines are not lost when the TUI starts. Set **`PITHOSAI_AUTO_UPGRADE=0`** (or `false` / `no` / `off`) to skip checks entirely.
|
|
227
|
+
Full provider tables, env vars, and OpenRouter key patterns: [`src/models/README.md`](src/models/README.md).
|
|
118
228
|
|
|
119
|
-
|
|
229
|
+
### China direct APIs (1.0.12)
|
|
120
230
|
|
|
121
|
-
|
|
231
|
+
When a direct env key is set, pi-ai catalogs are exposed under predictable CLI prefixes:
|
|
122
232
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
233
|
+
| Env | Example `--model` key |
|
|
234
|
+
|-----|------------------------|
|
|
235
|
+
| `KIMI_API_KEY` | `kimi-for-coding` |
|
|
236
|
+
| `MOONSHOT_API_KEY` | `moonshotai-kimi-k2-6`, `moonshotai-cn-kimi-k2-6` |
|
|
237
|
+
| `MINIMAX_API_KEY` / `MINIMAX_CN_API_KEY` | `minimax-*`, `minimax-cn-*` |
|
|
238
|
+
| `ZAI_API_KEY` | `z-ai-glm-4-7` |
|
|
239
|
+
| `XIAOMI_API_KEY` | `xiaomi-mimo-v2-5` |
|
|
126
240
|
|
|
127
|
-
|
|
241
|
+
```bash
|
|
242
|
+
export KIMI_API_KEY=sk-...
|
|
243
|
+
pithosai --no-interactive --model kimi-for-coding "Refactor this module"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### OpenRouter (China + Global slugs)
|
|
247
|
+
|
|
248
|
+
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.
|
|
128
249
|
|
|
129
250
|
```bash
|
|
130
|
-
|
|
251
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
252
|
+
pithosai --no-interactive --model qwen-qwen-plus "Explain this function"
|
|
253
|
+
pithosai --no-interactive --model anthropic-claude-sonnet-4 "Review this code"
|
|
254
|
+
pithosai --no-interactive --model openai-o4-mini "Find the edge cases"
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**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.
|
|
258
|
+
|
|
259
|
+
### Ollama (local)
|
|
260
|
+
|
|
261
|
+
| CLI key | Ollama tag | Agent tools (1.0.12) |
|
|
262
|
+
|---------|------------|----------------------|
|
|
263
|
+
| `ollama-qwen25` | `qwen2.5:14b` | Yes |
|
|
264
|
+
| `ollama-qwen25-coder` | `qwen2.5-coder:14b` | Yes |
|
|
265
|
+
| `ollama-deepseek-r1` | `deepseek-r1:14b` | No (chat-only) |
|
|
266
|
+
| `ollama-qwythos-9b-q8` | `qwythos-9b-q8` | Yes |
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
export OPENAI_LOCAL_API_BASE=http://localhost:11434/v1
|
|
270
|
+
export OPENAI_LOCAL_API_KEY=ollama
|
|
271
|
+
pithosai --no-interactive --model ollama-qwen25-coder "Add tests for this file"
|
|
131
272
|
```
|
|
132
273
|
|
|
274
|
+
### Krouter (Kiro provider gateway)
|
|
275
|
+
|
|
276
|
+
Install and run the local gateway first ([full install manual](docs/KROUTER.md)):
|
|
277
|
+
|
|
133
278
|
```bash
|
|
134
|
-
|
|
135
|
-
|
|
279
|
+
npm install -g @sifxprime/krouter
|
|
280
|
+
krouter -t # tray; or `krouter` for foreground logs
|
|
136
281
|
```
|
|
137
282
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
- `
|
|
143
|
-
- `
|
|
144
|
-
- `
|
|
145
|
-
- `
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
283
|
+
Open [http://localhost:20128/dashboard](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`).
|
|
284
|
+
|
|
285
|
+
| CLI key | Krouter model id |
|
|
286
|
+
|---------|------------------|
|
|
287
|
+
| `krouter-rd` | `RD` (dashboard combo) |
|
|
288
|
+
| `krouter-arch` | `ARCH` (dashboard combo) |
|
|
289
|
+
| `krouter-pm` | `PM` (dashboard combo) |
|
|
290
|
+
| `krouter-qa` | `QA` (dashboard combo) |
|
|
291
|
+
| `krouter/<id>` | any id from `GET /v1/models` |
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
# optional: override the default http://localhost:20128/v1
|
|
295
|
+
export KROUTER_API_BASE=http://localhost:20128/v1
|
|
296
|
+
# opt out: export KROUTER_DISABLED=1
|
|
297
|
+
pithosai --no-interactive --model krouter-rd "Add tests for this file"
|
|
298
|
+
pithosai --no-interactive --model krouter/cu/default "Summarize this module"
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### DeepSeek API (V4)
|
|
302
|
+
|
|
303
|
+
With a native **`DEEPSEEK_API_KEY`**, flags map to:
|
|
304
|
+
|
|
305
|
+
| Your choice | API model id | Typical use |
|
|
306
|
+
|-------------|----------------|-------------|
|
|
307
|
+
| Default (no `--pro` / `--reasoner`) | `deepseek-v4-flash` | Cost-efficient daily work |
|
|
308
|
+
| `--pro` | `deepseek-v4-pro` | Harder tasks |
|
|
309
|
+
| `--chat` | `deepseek-v4-flash` | Explicit chat path |
|
|
310
|
+
| `--reasoner` | `deepseek-v4-pro` + reasoning | Longer chain-of-thought |
|
|
311
|
+
|
|
312
|
+
Legacy ids `deepseek-chat` and `deepseek-reasoner` are retired upstream; see [DeepSeek API docs](https://api-docs.deepseek.com/). Flash paths disable API “thinking” by default so tool-heavy turns stay stable; `--reasoner` keeps extended reasoning enabled.
|
|
313
|
+
|
|
314
|
+
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**.
|
|
151
315
|
|
|
152
|
-
###
|
|
316
|
+
### Role entrypoints
|
|
153
317
|
|
|
154
|
-
|
|
155
|
-
|
|
318
|
+
| Command | Role | Default model |
|
|
319
|
+
|---------|------|----------------|
|
|
320
|
+
| `rdsai` | RD | `deepseek-v4-flash` (unless `--pro` / `--reasoner`) |
|
|
321
|
+
| `pmsai`, `qasai`, `cosai`, `mktai` | PM / QA / CO / MKT | flash (`--chat`) |
|
|
322
|
+
| `wrsai` | WR (`task` mode) | flash; default language **zh** |
|
|
323
|
+
|
|
324
|
+
These ship as POSIX shell wrappers next to `pithosai.mjs` that invoke the same binary with preset flags (**1.0.9** / **1.0.10**).
|
|
325
|
+
|
|
326
|
+
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).
|
|
327
|
+
|
|
328
|
+
### Agent orchestration (`src/agent-orch/`)
|
|
329
|
+
|
|
330
|
+
The `agent-orch/` layer chains multiple roles sequentially for complex, multi-step tasks.
|
|
331
|
+
Each role receives the previous role's report JSON as context.
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
./src/agent-orch/run.sh --roles MKT,ARCH,PM,RD \
|
|
335
|
+
--request "Analyze the market for an AI platform" \
|
|
336
|
+
--lang zh
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Available roles:** `MKT`, `ARCH`, `RD`, `PM`, `QA`, `CO`, `WR`, `SRE`.
|
|
340
|
+
|
|
341
|
+
The final report JSON path is printed to stdout.
|
|
342
|
+
|
|
343
|
+
For embedding in other shell scripts, source `base.sh` and call `dispatch_roles`:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
source "src/agent-orch/base.sh"
|
|
347
|
+
task_id="$(uuidgen)"
|
|
348
|
+
dispatch_roles "$task_id" "My Title" "My request" "zh" MKT ARCH PM RD
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
See [`src/agent-orch/READEM.md`](src/agent-orch/READEM.md) for details.
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Commands
|
|
356
|
+
|
|
357
|
+
| Command | Purpose |
|
|
358
|
+
|---------|---------|
|
|
359
|
+
| `pithosai` | Main CLI: `init`, `migrate-db`, interactive agent, `task`, `heartbeat`, `skills`, `memorize`, … |
|
|
360
|
+
| `rdsai`, `pmsai`, `qasai`, `cosai`, `mktai`, `wrsai` | Same CLI with a default role |
|
|
361
|
+
| `email-monitor` | Heartbeat / email-driven task loop |
|
|
362
|
+
| `render-markdown` | Render Markdown in the terminal |
|
|
363
|
+
| `init` | Optional manual create of `~/.pithosai/pithosai.db` (the global install and first CLI start already do this) |
|
|
364
|
+
|
|
365
|
+
### Project maintenance
|
|
366
|
+
|
|
367
|
+
| Command | What it does |
|
|
368
|
+
|---------|----------------|
|
|
369
|
+
| `pithosai init [dir]` | Optional project scaffold (`.pithosai/sessions/`, settings). Not required to start the CLI |
|
|
370
|
+
| `pithosai migrate-db` | Legacy plaintext DB → SQLCipher |
|
|
371
|
+
| `pithosai add-role <role>` | Append role to `supportedRoles` in `.settings.json` |
|
|
372
|
+
| `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 |
|
|
373
|
+
| `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) |
|
|
374
|
+
| `pithosai role-template list` | List role prompt templates stored in `pithosai.db` |
|
|
375
|
+
| `pithosai role-template show <role>` | Show decrypted role template content (`--lang`, `--name`) |
|
|
376
|
+
| `pithosai role-template create <role>` | Create role template in DB from bundled `templates/<role>/` or `--from-dir` |
|
|
377
|
+
| `pithosai role-template update <role>` | Update role template prompts (`--content`, `--file`, `--from-dir`, or `--from-remote`) |
|
|
378
|
+
| `pithosai task --file <md>` | Watch a task file and run tasks |
|
|
379
|
+
| `pithosai task summarize --task-id <id>` | Refresh LLM rolling summary for one persisted task |
|
|
380
|
+
| `pithosai task summarize --all-stale` | Summarize tasks with new messages since last cursor |
|
|
381
|
+
| `pithosai task summarize-daemon [--once]` | Background loop for stale task summaries (cron-friendly) |
|
|
382
|
+
| `pithosai cron-daemon [--once]` | Load `pithosai_cron_task` schedules and run recurring agent jobs (requires daemon for schedules to fire) |
|
|
383
|
+
| `pithosai memorize --start … --end … -r <role>` | Build `.pithosai/<role>/memory.md` |
|
|
384
|
+
| `pithosai heartbeat` / `heartbeat --once` | Email pipeline (IMAP/SMTP in settings) |
|
|
385
|
+
| `pithosai skills …` | Install / list / remove skills |
|
|
386
|
+
| `pithosai shell "cmd"` | Run a shell command via the CLI |
|
|
387
|
+
|
|
388
|
+
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`.
|
|
156
389
|
|
|
157
390
|
---
|
|
158
391
|
|
|
159
|
-
## Run modes
|
|
392
|
+
## Run modes
|
|
160
393
|
|
|
161
394
|
| Mode | Use case |
|
|
162
395
|
|------|----------|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
396
|
+
| `agent` (default) | Full tools: edit files, run commands, … |
|
|
397
|
+
| `dialog` | Answers and read-only tools (no shell tool) |
|
|
398
|
+
| `plan` | Writes `<slug>-plan.md`; read-only tools |
|
|
166
399
|
|
|
167
400
|
```bash
|
|
168
401
|
pithosai --mode dialog "Explain this error"
|
|
169
402
|
pithosai --mode plan "Outline the next sprint"
|
|
170
403
|
```
|
|
171
404
|
|
|
172
|
-
|
|
405
|
+
Markdown previews: `PITHOSAI_SKIP_RESULT_BROWSER`, `PITHOSAI_RESULT_BROWSER`, `PITHOSAI_PLAYWRIGHT_CHANNEL`.
|
|
173
406
|
|
|
174
407
|
---
|
|
175
408
|
|
|
176
|
-
##
|
|
409
|
+
## Interactive session
|
|
177
410
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
|
183
|
-
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
|
|
|
411
|
+
The default UI is a **full-screen TUI**: transcript above, input below. 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: …` or `cwd …` in the transcript (cwd/git is the footer line). In the input box, **Enter** submits; **Shift+Enter** inserts a newline (on macOS this works even when the terminal sends the same CR as Enter, e.g. Cursor / VS Code). **Ctrl+J** also inserts a newline; **`\` then Enter** is the same 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 you can still type in the input box: **submit** queues a **follow-up** message for the current run (shown on a fixed row below the running indicator); **`/note <text>`** steers the run after the current assistant turn. **Ctrl+S** stops the agent; **Ctrl+P** pauses; **Ctrl+Z** (or **`/bg`**) suspends 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). The bottom chrome shows **task/model/role** above the framed input, and a dim **`\<cwd\> - git \<branch\>`** line under the input (path ≤50% width, branch ≤40%, both truncate with a leading `...`; no repo → path only). That cwd/git row refreshes on session start, project/`/shell cd` cwd changes, after `/shell` commands, 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).
|
|
412
|
+
|
|
413
|
+
### Core slash commands
|
|
414
|
+
|
|
415
|
+
| Command | Description |
|
|
416
|
+
|---------|-------------|
|
|
417
|
+
| `/model` | List and switch models |
|
|
418
|
+
| `/mode` | Show or switch run mode (`agent`, `dialog`, `plan`) |
|
|
419
|
+
| `/bg` | Suspend the TUI (same as Ctrl+Z); return with `fg` from the parent shell |
|
|
420
|
+
| `/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` |
|
|
421
|
+
| `/shell cd <dir>` | Change working directory (`~` supported); syncs session `projectPath` (**1.0.8**) |
|
|
422
|
+
| `/list` | Show persisted tasks for the current session project (includes `projectPath` column) |
|
|
423
|
+
| `/list <text>` | Filter tasks by title, description, or path |
|
|
424
|
+
| `/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). |
|
|
425
|
+
| `/new` | Start a new task id (no prior messages loaded) |
|
|
426
|
+
| `/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). |
|
|
427
|
+
| `/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**) |
|
|
428
|
+
| `/skill-done [name]` | Clear all active skills, or one name; does not run the agent. (**1.0.30**) |
|
|
429
|
+
| `/grill-me [topic]` | Stress-test a plan with one question at a time (**1.0.8**) |
|
|
430
|
+
| `/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**) |
|
|
431
|
+
| `/exit`, `/quit` | Leave the REPL (**1.0.7**). Restores the parent shell screen without wiping scrollback (**1.0.28**). |
|
|
432
|
+
|
|
433
|
+
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**).
|
|
434
|
+
|
|
435
|
+
### `@` file and directory completion (**1.0.14**)
|
|
436
|
+
|
|
437
|
+
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 `/`.
|
|
438
|
+
|
|
439
|
+
Shared logic lives in `src/completion/` (`at-mention-utils.js` for token parsing; `at-path-suggestions.js` for filesystem listing).
|
|
440
|
+
|
|
441
|
+
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).
|
|
442
|
+
|
|
443
|
+
### Virtual projects
|
|
444
|
+
|
|
445
|
+
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).
|
|
446
|
+
|
|
447
|
+
| Column | Notes |
|
|
448
|
+
|--------|--------|
|
|
449
|
+
| `id` | Primary key (UUID) — use as `projectId` in API calls |
|
|
450
|
+
| `account_id` | Virtual account id (default **`admin`**, indexed) |
|
|
451
|
+
| `path` | Unique absolute project directory |
|
|
452
|
+
| `name`, `lang`, `description` | Project metadata shown by `/list-project` and `/show-project` |
|
|
453
|
+
|
|
454
|
+
| Command | Description |
|
|
455
|
+
|---------|-------------|
|
|
456
|
+
| `/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). |
|
|
457
|
+
| `/list-project [filter]` | List registered projects (index, name, path). Optional filter matches name, path, language, or description. |
|
|
458
|
+
| `/show-project` | Show cwd and registry metadata when cwd matches a saved path |
|
|
459
|
+
| `/switch-project <index>` | `chdir` to a listed project, initialize git when needed, and start a new task id |
|
|
460
|
+
|
|
461
|
+
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.
|
|
462
|
+
|
|
463
|
+
`/list` is scoped to the active session project path and does not collide with `/list-project` or `/list-skill` by prefix.
|
|
464
|
+
|
|
465
|
+
### Plan alignment (`/grill-me`)
|
|
188
466
|
|
|
189
|
-
|
|
467
|
+
`/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`.
|
|
468
|
+
|
|
469
|
+
### Reliability
|
|
470
|
+
|
|
471
|
+
- **Connection-loss retry (1.0.8):** Transient API drops (`network connection lost`) are retried like timeouts.
|
|
472
|
+
- **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; `task` and `code_review` also print the full summary (`result` / `findings`) so it is not hidden behind the JSON wrapper (**1.0.24**).
|
|
190
473
|
|
|
191
474
|
---
|
|
192
475
|
|
|
193
|
-
##
|
|
476
|
+
## Startup version check
|
|
477
|
+
|
|
478
|
+
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**).
|
|
194
479
|
|
|
195
|
-
|
|
480
|
+
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.
|
|
481
|
+
|
|
482
|
+
Disable with `PITHOSAI_AUTO_UPGRADE=0` (or `false` / `no` / `off`).
|
|
196
483
|
|
|
197
484
|
---
|
|
198
485
|
|
|
@@ -200,28 +487,155 @@ In a normal terminal, the default UI uses a **full-screen TUI** (bottom input, s
|
|
|
200
487
|
|
|
201
488
|
| Variable | Role |
|
|
202
489
|
|----------|------|
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
490
|
+
| `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 |
|
|
491
|
+
| `OPENAI_LOCAL_API_BASE`, `OPENAI_LOCAL_API_KEY` | Local Ollama (`/v1` base URL + key; both required for `ollama-*` keys in `/model`) |
|
|
492
|
+
| `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 [`docs/KROUTER.md`](docs/KROUTER.md) |
|
|
493
|
+
| `KIRO_API_BASE`, `KIRO_DISABLED`, `KIRO_API_KEY` | Legacy aliases for the Krouter env vars above |
|
|
494
|
+
| `CURSOR_MODEL`, `CURSOR_AGENT_BIN` | Cursor CLI |
|
|
495
|
+
| `TIPS_MODEL` | Model key for `pithosai shell-tips` (default `ollama/qwen2.5-coder:14b`) |
|
|
496
|
+
| `PITHOSAI_DB_PATH` | SQLite DB (default `~/.pithosai/pithosai.db`) |
|
|
497
|
+
| `PITHOSAI_AUTO_UPGRADE` | Disable startup check: `0` / `false` / `no` / `off` |
|
|
208
498
|
| `PITHOSAI_SKIP_RESULT_BROWSER` | Skip markdown preview (e.g. CI) |
|
|
209
|
-
| `PITHOSAI_RESULT_BROWSER` | `chrome` for Playwright
|
|
210
|
-
| `PITHOSAI_TIMEOUT_MS` / `--timeout` | Run
|
|
211
|
-
| `
|
|
499
|
+
| `PITHOSAI_RESULT_BROWSER` | e.g. `chrome` for Playwright |
|
|
500
|
+
| `PITHOSAI_TIMEOUT_MS` / `--timeout` | Run limits |
|
|
501
|
+
| `PITHOSAI_TTY_COMMANDS` | Extra `/shell` TUI basenames (comma/space-separated) that inherit the terminal, e.g. `hx,k9s,mytui` |
|
|
502
|
+
| `PITHOSAI_NL_FALLBACK` | Disable NL shell fallback: `0` / `false` / `no` / `off` |
|
|
503
|
+
| `PITHOSAI_NL_ZLE` | Disable NL Enter intercept only: `0` / `false` / `no` / `off` |
|
|
504
|
+
| `PITHOSAI_NL_MODEL` | NL fallback agent model (default `krouter-rd`) |
|
|
505
|
+
| `PITHOSAI_NL_CLASSIFY_LLM` | Skip NL classify LLM: `0` / `false` / `no` / `off` |
|
|
506
|
+
| `PITHOSAI_NL_CLASSIFY_TIMEOUT_MS` | NL classify LLM timeout (default `4000` ms) |
|
|
507
|
+
| `PITHOSAI_NL_CLASSIFY_MODEL` | NL classify LLM id (default `RD`) |
|
|
508
|
+
| `PITHOSAI_NL_CLASSIFY_API_BASE` | NL classify LLM base URL (Krouter by default) |
|
|
509
|
+
| `PITHOSAI_NL_CLASSIFY_API_KEY` | NL classify LLM API key (optional) |
|
|
510
|
+
| `PITHOSAI_NL_DEBUG_LOG` | NL fallback debug on stderr: `1` / `true` / `yes` / `on` |
|
|
511
|
+
| `PITHOSAI_BIN` | pithosai binary for NL fallback (default `pithosai`) |
|
|
512
|
+
| `PITHOSAI_LANG` | Override locale for NL fallback messages and `--lang` |
|
|
513
|
+
| `PITHOSAI_NODE` | Node binary for NL classify (default `node`) |
|
|
514
|
+
| `PHI_MESSAGES_DISABLED` | Set to `true` to disable phi turn trimming when restoring task messages |
|
|
515
|
+
| `PITHOSAI_GIT_AI` | Git AI adapter (on by default). Disable: `0` / `false` / `no` / `off`. JSON hooks still load. |
|
|
516
|
+
| `PITHOSAI_DEBUG_HOOKS` | Debug hook handlers when no `.settings.json` `hooks.active` preset: `1` / `true` |
|
|
517
|
+
| `PITHOSAI_DEBUG_HOOKS_DATA` | Log full hook payloads with debug hooks: `1` |
|
|
518
|
+
| `PITHOSAI_SECURITY_HOOKS` | Security hook handlers when no `hooks.active` preset: `1` / `true` |
|
|
519
|
+
| `PITHOSAI_BLOCKED_TOOLS` | Comma-separated tool names blocked by security hooks |
|
|
520
|
+
| `PITHOSAI_MAX_PROMPT_LENGTH` | Security-hook system-prompt length warning (default `10000`) |
|
|
521
|
+
| `SCRAPERAPI_API_KEY` | Some skills / tools |
|
|
522
|
+
|
|
523
|
+
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).
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
## What's new (v1.0.7 – v1.0.32)
|
|
528
|
+
|
|
529
|
+
Highlights for the published CLI. Full per-version notes: [`CHANGELOG.md`](CHANGELOG.md).
|
|
530
|
+
|
|
531
|
+
### v1.0.32 — Krouter combos, `pithosai models`
|
|
532
|
+
|
|
533
|
+
- **Krouter catalog** — Curated family keys (`kr/glm-5*`, `kr/minimax-*`, `kr/deepseek-*`) are gone. Shortcuts are dashboard combos `krouter-rd`, `krouter-arch`, `krouter-pm`, and `krouter-qa`. Other gateway ids use `krouter/<id>` (alias `kiro/<id>`). See [Krouter](#krouter-kiro-provider-gateway).
|
|
534
|
+
- **`pithosai models`** — Lists public `KEY_TO_MODEL` keys plus discovered krouter composites. JSON on stdout by default; `--table` prints aligned columns.
|
|
535
|
+
- **NL defaults** — Shell fallback `PITHOSAI_NL_MODEL` is `krouter-rd`. The classify LLM defaults to the `RD` combo.
|
|
536
|
+
|
|
537
|
+
### v1.0.31 — Role Market seed, bash NL fallback
|
|
538
|
+
|
|
539
|
+
- **Role templates** — `pithosai role-template init` seeds RD, PM, QA, WR, CO, MKT, and SRE (`en` and `zh`) into an empty `pithosai_role_prompts` table. The CLI does the same seed on startup, so `pithosai init` is not required. `role-template update <role> --from-remote` refreshes one installed role from the Role Market.
|
|
540
|
+
- **Krouter default** — Env-walk default is the `RD` combo (`krouter-rd`). `--reasoner` / `--pro` no longer switch that default.
|
|
541
|
+
- **bash NL fallback** — The intercept is **Ctrl-J** (bash reserves Enter for `accept-line`). It rewrites `READLINE_LINE` and leaves TAB completion working.
|
|
542
|
+
|
|
543
|
+
### v1.0.30 — `/skill-<name>` session activation
|
|
544
|
+
|
|
545
|
+
- **`/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`, …).
|
|
546
|
+
- **`/skill-done [name]`** — Clears all active skills, or one name, without running the agent.
|
|
547
|
+
- **Completer** — Tab offers `/skill-<name>` from the current skill catalog.
|
|
548
|
+
|
|
549
|
+
### v1.0.29 — Git AI checkpoints, TUI input wrap
|
|
550
|
+
|
|
551
|
+
- **JSON command hooks** — Load `~/.pithosai/hooks/*.json` and `<cwd>/.pithosai/hooks/*.json` (project wins by filename). `hookType` is a pithos HookType (`beforeToolExecute`, `afterToolExecute`, …). In-process adapters stay on `CORE_COMMAND_HOOK_ADAPTERS`; Git AI is a bundled JSON config plus shipped CLI. See [Git AI checkpoints](#git-ai-checkpoints) and [Add a pithosai core agent hook](docs/hooks-usage.md#add-a-pithosai-core-agent-hook).
|
|
552
|
+
- **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` / `status` load the same plugins and print to stdout (they do not use deprecated `.settings.json` `hooks.active`).
|
|
553
|
+
- **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.
|
|
554
|
+
- **TUI trackpad scroll** — Two-finger wheel bursts on macOS no longer freeze a long transcript; ticks coalesce and wrap results are cached.
|
|
555
|
+
|
|
556
|
+
### v1.0.28 — pi 0.85.1, `/show-task` tools, TUI exit restore
|
|
557
|
+
|
|
558
|
+
- **pi libs 0.85.1** — `@earendil-works/pi-ai`, `pi-agent-core`, `pi-coding-agent`, and `pi-tui` upgraded from 0.78; Node **≥ 22.19** required. Agent TUI uses `TuiAltScreen`.
|
|
559
|
+
- **`/show-task` tool runs** — Preview includes tool requests and tool results (truncated) in the answer body, with localized labels.
|
|
560
|
+
- **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.
|
|
561
|
+
- **Test hygiene** — Vitest terminal teardown avoids leftover escape codes; skills tests mock `fetch`.
|
|
562
|
+
- **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.
|
|
563
|
+
|
|
564
|
+
### v1.0.26 — System prompt rebuild hook, TUI job control
|
|
565
|
+
|
|
566
|
+
- **TUI job control** — **Ctrl+Z** or **`/bg`** suspends the full-screen TUI to the parent shell; **`fg`** brings it back. The agent freezes while suspended (same as `vim`/`less`). Unsupported on Windows.
|
|
567
|
+
- **System prompt rebuild hook** — New hook type `BEFORE_CACHED_AGENT_REUSE` triggers before reusing a cached agent, rebuilding the system prompt and initial messages from DB to ensure fresh task context, skills, and role prompts.
|
|
568
|
+
|
|
569
|
+
### v1.0.19 — NL fallback classifier, Enter intercept
|
|
570
|
+
|
|
571
|
+
- **Natural-language command fallback** — Node classifies unknown commands (`lookpath` + `tinyld`, 0–100 shell score). Uncertain lines ask an LLM for `shell` or `natural`; clear NL (starters, reserved-keyword prose, CJK, overlong) skips that call. Interactive zsh and bash 4+ intercept Enter so `for 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](#natural-language-command-fallback-bash--zsh).
|
|
572
|
+
|
|
573
|
+
### v1.0.18 — Quieter TUI transcript
|
|
574
|
+
|
|
575
|
+
- **TUI transcript** — Submitting a turn no longer reprints `request: …` or `cwd …` in the scrollback (`You:` and the footer cwd/git line already show that). Queuing a follow-up no longer leaves a second `Running…` spinner.
|
|
576
|
+
- **`--no-interactive`** — One-shot runs no longer draw the stderr loading spinner over streamed output.
|
|
577
|
+
- **Natural-language command fallback (initial)** — Source `scripts/pithosai-nl-fallback.sh` from zsh or bash 4+ so unknown English/Chinese commands run pithosai.
|
|
578
|
+
|
|
579
|
+
### v1.0.15 — Global OpenRouter models, Anthropic reasoning compat
|
|
580
|
+
|
|
581
|
+
- **Global OpenRouter models** — `anthropic-*`, `openai-*`, `google-*`, `meta-*`, `mistral-*`, `cohere-*`, … all available via `OPENROUTER_API_KEY`. See [`src/models/README.md`](src/models/README.md) for the full slug list.
|
|
582
|
+
- **Anthropic reasoning** — Claude Sonnet 4, Claude Opus 4, and other Anthropic reasoning models get automatic thinking-level compat (OpenRouter requires `reasoning` format even when effort is optional).
|
|
583
|
+
- **Developer-role compat** — Both China OpenRouter slugs and Anthropic reasoning models now disable the `developer` role to avoid API 400 errors. Refactored `enhanceOpenRouterModel()` handles all OpenRouter models uniformly; old `enhanceOpenRouterChinaModel()` alias preserved.
|
|
584
|
+
|
|
585
|
+
### v1.0.12 — China-mainland models, OpenRouter compat, Ollama tools
|
|
586
|
+
|
|
587
|
+
- **China-mainland providers** — `KEY_TO_MODEL` merges pi-ai direct catalogs (Kimi, Moonshot, MiniMax, Z.ai, Xiaomi) with OpenRouter China slugs (Qwen, Baidu, StepFun, Tencent, …). Shared env detection via `provider-env.js`; see [`src/models/README.md`](src/models/README.md).
|
|
588
|
+
- **OpenRouter fixes** — Mandatory-thinking models (`*-thinking`) no longer send disabled reasoning; China slugs use `system` instead of `developer` for the system prompt (Qwen-compatible).
|
|
589
|
+
- **Agent session cache** — Model switches and env-only provider changes invalidate the cached CLI agent (`resolved:provider:id` cache keys).
|
|
590
|
+
- **Ollama Qwen** — `ollama-qwen25` and `ollama-qwen25-coder` enable full agent tool calling locally.
|
|
591
|
+
- **`PHI_MESSAGES_DISABLED`** — When `true`, restores full task message history instead of phi turn trimming on resume.
|
|
592
|
+
|
|
593
|
+
### v1.0.11 — Runtime steer, follow-up, skills tools
|
|
594
|
+
|
|
595
|
+
- **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.
|
|
596
|
+
- **TUI text wrapping** — Startup hints now wrap to terminal width instead of overflowing.
|
|
597
|
+
- **Skills: read skill tools** — Installed skills can expose available tool definitions for their system prompts.
|
|
598
|
+
- **Sub Agent** — add subagent module to support subagent functions
|
|
599
|
+
|
|
600
|
+
### v1.0.10 — Packaging and distribution
|
|
601
|
+
|
|
602
|
+
- Simplified npm publish layout (`.npmignore`, narrowed `files` field).
|
|
603
|
+
- Role binaries (`rdsai`, `pmsai`, …) ship as POSIX wrappers under `scripts/bin-shims/` with corrected paths to `pithosai.mjs`.
|
|
604
|
+
- Dependencies use published `@mariozechner/*` packages on npm instead of vendored `lib/pi-mono` copies.
|
|
605
|
+
|
|
606
|
+
### v1.0.9 — Install reliability
|
|
607
|
+
|
|
608
|
+
- Improved `npm install -g` resolution for bundled agent dependencies.
|
|
609
|
+
- Role commands consolidated as thin shell wrappers invoking `pithosai.mjs`.
|
|
610
|
+
|
|
611
|
+
### v1.0.8 — Session productivity
|
|
612
|
+
|
|
613
|
+
- **Virtual projects** — `/create-project`, `/list-project`, `/show-project`, `/switch-project` with `~/.pithosai/projects.json`.
|
|
614
|
+
- **`/grill-me`** — Interactive plan alignment (localized prompts).
|
|
615
|
+
- **`/shell cd`** — In-process directory changes with `~` expansion and directory history.
|
|
616
|
+
- **Task list** — `/list` shows `projectPath`, supports `/list <text>` filter, scopes to the session project.
|
|
617
|
+
- **Resilience** — Automatic retry on connection loss; OpenRouter regression fix; `taskRef.projectPath` kept in sync after `cd` and project switches.
|
|
618
|
+
|
|
619
|
+
### v1.0.7 — Models and startup
|
|
620
|
+
|
|
621
|
+
- **DeepSeek V4** — Default `deepseek-v4-flash`; `--pro` / `--reasoner` select `deepseek-v4-pro` with optional reasoning.
|
|
622
|
+
- **Startup auto-upgrade** — Optional global update check (24 h throttle, TTY-aware prompt).
|
|
623
|
+
- **REPL exit** — `/exit` and `/quit` (plain `exit` goes to the agent).
|
|
624
|
+
- **Locales** — `zh-hant` resolution fix; `render-markdown` dist entry fix.
|
|
212
625
|
|
|
213
626
|
---
|
|
214
627
|
|
|
215
|
-
## Help
|
|
628
|
+
## Help
|
|
216
629
|
|
|
217
|
-
|
|
630
|
+
- `pithosai --help`
|
|
631
|
+
- `pithosai <command> --help`
|
|
218
632
|
|
|
219
633
|
---
|
|
220
634
|
|
|
221
635
|
## License
|
|
222
636
|
|
|
223
|
-
Pithosai is **proprietary** software
|
|
637
|
+
Pithosai is **proprietary** software; it is **not** published under an open-source license.
|
|
224
638
|
|
|
225
|
-
Copyright © 2026 [
|
|
639
|
+
Copyright © 2026 [sihuic](https://www.sihuic.com) ([service@sihuic.com](mailto:service@sihuic.com)). All rights reserved.
|
|
226
640
|
|
|
227
|
-
See [`LICENSE`](LICENSE)
|
|
641
|
+
See [`LICENSE`](LICENSE), [`CHANGELOG.md`](CHANGELOG.md), and the other markdown files this README links to (`docs/hooks-usage.md`, `docs/KROUTER.md`, `src/models/README.md`, `src/models/krouter.README.md`, `src/agent-orch/READEM.md`) in the npm package. The `license` field in `package.json` is **`UNLICENSED`** (npm convention when no public license is granted).
|