@pithosai/pithosai 1.0.10 → 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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2026 lidh04@gmail.com. All rights reserved.
1
+ Copyright © 2026 sihuic. Email: service@sihuic.com. Website: https://www.sihuic.com. All rights reserved.
2
2
 
3
3
  This software is proprietary and confidential. It is not distributed under
4
4
  an open-source license. No permission is granted to use, copy, modify, merge,
package/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Pithosai (`@pithosai/pithosai`)
2
2
 
3
- **Multi-role AI CLI** for coding and product work: natural-language requests, pluggable models (DeepSeek, OpenRouter, Ollama, Cursor), and role-based prompts stored in SQLite.
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
+
5
+ **Current release: 1.0.32** — see [What's new](#whats-new-v107--v1032) and [`CHANGELOG.md`](CHANGELOG.md#1032---2026-09-22).
4
6
 
5
7
  | | |
6
8
  |---|---|
7
9
  | **Best for** | Agent-style coding, multi-role workflows (RD / PM / QA / …), local or cloud models, repeatable prompts from a local database |
8
- | **Requirements** | **Node.js ≥ 18.12** and **at least one** [model provider](#model-providers) |
10
+ | **Requirements** | **Node.js ≥ 22.19** and **at least one** [model provider](#model-providers) |
9
11
  | **License** | Proprietary — see [License](#license) |
10
12
 
11
13
  ---
@@ -16,14 +18,18 @@
16
18
  npm install -g @pithosai/pithosai
17
19
  ```
18
20
 
19
- 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`.
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.
22
+
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`.
20
24
 
21
25
  **Highlights**
22
26
 
23
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)).
24
30
  - **Role shortcuts** — `rdsai`, `pmsai`, `qasai`, `cosai`, `mktai`, `wrsai` preset role and model defaults.
25
- - **Full-screen TUI** — Transcript, tool output, and slash commands (`/model`, `/shell`, `/list`, skills, …).
26
- - **Virtual projects** — Switch workspaces from the REPL via `~/.pithosai/projects.json` ([details](#virtual-projects)).
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)).
27
33
  - **Plan alignment** — `/grill-me` stress-tests a design one question at a time ([details](#plan-alignment-grill-me)).
28
34
  - **Run modes** — `agent` (full tools), `dialog` (read-only), `plan` (writes `<slug>-plan.md`).
29
35
  - **Local persistence** — Tasks and prompts in SQLCipher-backed SQLite; optional `pithosai migrate-db` from legacy plaintext DBs.
@@ -36,7 +42,6 @@ On a global install, if `~/.pithosai/pithosai.db` does not exist, it is created
36
42
  ```bash
37
43
  export DEEPSEEK_API_KEY=sk-... # or another provider below
38
44
  cd your-project
39
- pithosai init
40
45
  pithosai "Describe what you want done"
41
46
  ```
42
47
 
@@ -44,10 +49,85 @@ pithosai "Describe what you want done"
44
49
  |------------|----------|
45
50
  | `pithosai -i` | Interactive session with no initial prompt |
46
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) |
47
54
  | `pithosai -C ./other-dir "…"` | Use a different project directory |
48
55
  | `/exit` or `/quit` | Leave the REPL (plain `exit` is sent to the agent) |
49
56
 
50
- Each run prints a short ASCII banner. Prompts load from the local database (default `~/.pithosai/pithosai.db`). Optional role overrides live under `.pithosai/<role>/` in your project.
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:
62
+
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:
70
+
71
+ ```bash
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
80
+ ```
81
+
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`.
83
+
84
+ Each run object includes `files.created`, `files.modified`, and `files.deleted` (hybrid git snapshot + write/edit tool tracking).
85
+
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).
87
+
88
+ Example retry loop (one-shot script mode):
89
+
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
+ ```
101
+
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
+ ```
51
131
 
52
132
  ### Language
53
133
 
@@ -59,6 +139,60 @@ pithosai --lang zh "请解释这个错误"
59
139
 
60
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.
61
141
 
142
+ ### Natural-language command fallback (bash / zsh)
143
+
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`):
145
+
146
+ ```bash
147
+ # zsh (~/.zshrc) or bash 4+ (~/.bashrc) — from this repo:
148
+ source /path/to/pithosai/scripts/pithosai-nl-fallback.sh
149
+
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
+ ```
153
+
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.
170
+
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.
172
+
173
+ macOS system bash 3.2 has neither `command_not_found_handle` nor `bind -x`; use zsh or Homebrew bash.
174
+
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.
176
+
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
+
62
196
  ### Upgrading from v1.0.4 (plaintext database)
63
197
 
64
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]**.
@@ -72,11 +206,97 @@ Configure **at least one** of the following.
72
206
  | Provider | Setup |
73
207
  |----------|--------|
74
208
  | **DeepSeek** | `export DEEPSEEK_API_KEY=sk-...` |
75
- | **OpenRouter** | `export OPENROUTER_API_KEY=sk-or-...` |
76
- | **Ollama (local)** | Install Ollama, run a model, then `export OPENAI_LOCAL_API_BASE=http://localhost:11434/v1` |
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. |
77
217
  | **Cursor CLI** | Install the Cursor agent, sign in, set e.g. `export CURSOR_MODEL=auto`, and pass `--cursor` when needed |
78
218
 
79
- **Precedence:** DeepSeek → Ollama (`OPENAI_LOCAL_API_BASE`) → OpenRouter → `CURSOR_MODEL` / `--cursor`.
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:
222
+
223
+ ```bash
224
+ node -e "import { getPublicModelKeys } from './src/models/key-to-model.js'; getPublicModelKeys().forEach(console.log)"
225
+ ```
226
+
227
+ Full provider tables, env vars, and OpenRouter key patterns: [`src/models/README.md`](src/models/README.md).
228
+
229
+ ### China direct APIs (1.0.12)
230
+
231
+ When a direct env key is set, pi-ai catalogs are exposed under predictable CLI prefixes:
232
+
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` |
240
+
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.
249
+
250
+ ```bash
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"
272
+ ```
273
+
274
+ ### Krouter (Kiro provider gateway)
275
+
276
+ Install and run the local gateway first ([full install manual](docs/KROUTER.md)):
277
+
278
+ ```bash
279
+ npm install -g @sifxprime/krouter
280
+ krouter -t # tray; or `krouter` for foreground logs
281
+ ```
282
+
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
+ ```
80
300
 
81
301
  ### DeepSeek API (V4)
82
302
 
@@ -103,7 +323,32 @@ With **OpenRouter** only, use slugs `deepseek/deepseek-v4-flash` (default) and `
103
323
 
104
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**).
105
325
 
106
- Use `/model` in the REPL to list and switch models interactively.
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.
107
352
 
108
353
  ---
109
354
 
@@ -115,22 +360,32 @@ Use `/model` in the REPL to list and switch models interactively.
115
360
  | `rdsai`, `pmsai`, `qasai`, `cosai`, `mktai`, `wrsai` | Same CLI with a default role |
116
361
  | `email-monitor` | Heartbeat / email-driven task loop |
117
362
  | `render-markdown` | Render Markdown in the terminal |
118
- | `init` | Initialize `~/.pithosai/pithosai.db` manually |
363
+ | `init` | Optional manual create of `~/.pithosai/pithosai.db` (the global install and first CLI start already do this) |
119
364
 
120
365
  ### Project maintenance
121
366
 
122
367
  | Command | What it does |
123
368
  |---------|----------------|
124
- | `pithosai init [dir]` | Scaffold project, `.pithosai/sessions/`, settings |
369
+ | `pithosai init [dir]` | Optional project scaffold (`.pithosai/sessions/`, settings). Not required to start the CLI |
125
370
  | `pithosai migrate-db` | Legacy plaintext DB → SQLCipher |
126
- | `pithosai add-role <role>` | Add a role to the project |
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`) |
127
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) |
128
383
  | `pithosai memorize --start … --end … -r <role>` | Build `.pithosai/<role>/memory.md` |
129
384
  | `pithosai heartbeat` / `heartbeat --once` | Email pipeline (IMAP/SMTP in settings) |
130
385
  | `pithosai skills …` | Install / list / remove skills |
131
386
  | `pithosai shell "cmd"` | Run a shell command via the CLI |
132
387
 
133
- Use `pithosai --help` and `pithosai <command> --help` for flags such as `--timeout`, `--lang`, `--role`, and `--log-path`.
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`.
134
389
 
135
390
  ---
136
391
 
@@ -153,35 +408,57 @@ Markdown previews: `PITHOSAI_SKIP_RESULT_BROWSER`, `PITHOSAI_RESULT_BROWSER`, `P
153
408
 
154
409
  ## Interactive session
155
410
 
156
- The default UI is a **full-screen TUI**: transcript above, input below. **Ctrl+S** stops the agent; **Ctrl+P** pauses. Set `PITHOSAI_NO_TUI=1` for a classic line prompt (scripts, minimal terminals).
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).
157
412
 
158
413
  ### Core slash commands
159
414
 
160
415
  | Command | Description |
161
416
  |---------|-------------|
162
417
  | `/model` | List and switch models |
163
- | `/shell <cmd>` | Run a shell command in-process |
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` |
164
421
  | `/shell cd <dir>` | Change working directory (`~` supported); syncs session `projectPath` (**1.0.8**) |
165
422
  | `/list` | Show persisted tasks for the current session project (includes `projectPath` column) |
166
423
  | `/list <text>` | Filter tasks by title, description, or path |
167
- | `/select`, `/show`, `/show-task`, `/show-prompt` | Work with persisted tasks |
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). |
168
425
  | `/new` | Start a new task id (no prior messages loaded) |
169
- | `/list-skill`, `/install-skill`, `/remove-skill` | Same as `pithosai skills` (ClawHub) |
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**) |
170
429
  | `/grill-me [topic]` | Stress-test a plan with one question at a time (**1.0.8**) |
171
- | `/exit`, `/quit` | Leave the REPL (**1.0.7**) |
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**).
172
434
 
173
- Tab completion covers slash commands (including `/list-project` and `/grill-me`). Directory navigation via `/shell cd` and `ls` is tracked for recall (**1.0.8**).
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).
174
442
 
175
443
  ### Virtual projects
176
444
 
177
- Manage multiple workspaces from the REPL without leaving the session. Registry file: **`~/.pithosai/projects.json`** (**1.0.8**).
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` |
178
453
 
179
454
  | Command | Description |
180
455
  |---------|-------------|
181
- | `/create-project [name path lang description]` | Register a project, create its directory if needed, `chdir`, and start a new task id. With no arguments, registers the current directory (or shows it if already registered). |
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). |
182
457
  | `/list-project [filter]` | List registered projects (index, name, path). Optional filter matches name, path, language, or description. |
183
458
  | `/show-project` | Show cwd and registry metadata when cwd matches a saved path |
184
- | `/switch-project <index>` | `chdir` to a listed project and start a new task id |
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.
185
462
 
186
463
  `/list` is scoped to the active session project path and does not collide with `/list-project` or `/list-skill` by prefix.
187
464
 
@@ -192,7 +469,7 @@ Manage multiple workspaces from the REPL without leaving the session. Registry f
192
469
  ### Reliability
193
470
 
194
471
  - **Connection-loss retry (1.0.8):** Transient API drops (`network connection lost`) are retried like timeouts.
195
- - **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**.
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**).
196
473
 
197
474
  ---
198
475
 
@@ -210,21 +487,115 @@ Disable with `PITHOSAI_AUTO_UPGRADE=0` (or `false` / `no` / `off`).
210
487
 
211
488
  | Variable | Role |
212
489
  |----------|------|
213
- | `DEEPSEEK_API_KEY`, `OPENROUTER_API_KEY` | API providers |
214
- | `OPENAI_LOCAL_API_BASE` | Local Ollama (`/v1` base URL) |
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 |
215
494
  | `CURSOR_MODEL`, `CURSOR_AGENT_BIN` | Cursor CLI |
495
+ | `TIPS_MODEL` | Model key for `pithosai shell-tips` (default `ollama/qwen2.5-coder:14b`) |
216
496
  | `PITHOSAI_DB_PATH` | SQLite DB (default `~/.pithosai/pithosai.db`) |
217
497
  | `PITHOSAI_AUTO_UPGRADE` | Disable startup check: `0` / `false` / `no` / `off` |
218
498
  | `PITHOSAI_SKIP_RESULT_BROWSER` | Skip markdown preview (e.g. CI) |
219
499
  | `PITHOSAI_RESULT_BROWSER` | e.g. `chrome` for Playwright |
220
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`) |
221
521
  | `SCRAPERAPI_API_KEY` | Some skills / tools |
222
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
+
223
525
  ---
224
526
 
225
- ## What's new (v1.0.7 – v1.0.10)
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
226
594
 
227
- Highlights for the published CLI (excluding unreleased components). Full per-version notes: [`CHANGELOG.md`](CHANGELOG.md).
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
228
599
 
229
600
  ### v1.0.10 — Packaging and distribution
230
601
 
@@ -265,6 +636,6 @@ Highlights for the published CLI (excluding unreleased components). Full per-ver
265
636
 
266
637
  Pithosai is **proprietary** software; it is **not** published under an open-source license.
267
638
 
268
- Copyright © 2026 [lidh04@gmail.com](mailto:lidh04@gmail.com). All rights reserved.
639
+ Copyright © 2026 [sihuic](https://www.sihuic.com) ([service@sihuic.com](mailto:service@sihuic.com)). All rights reserved.
269
640
 
270
- See [`LICENSE`](LICENSE) in the npm package. The `license` field in `package.json` is **`UNLICENSED`** (npm convention when no public license is granted).
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).
package/dist/529.mjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export const __rspack_esm_id="529";export const __rspack_esm_ids=["529"];export const __webpack_modules__={7136(s,t,e){e.d(t,{hashPassword:()=>r});var a=e(7598);let o=(0,e(7975).promisify)(a.pbkdf2);async function r(s){let t=(0,a.randomBytes)(16),e=await o(s,t,1e5,32,"sha256");return{salt:t.toString("hex"),hash:`100000:${e.toString("hex")}`}}}};
package/dist/813.mjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export const __rspack_esm_id="813";export const __rspack_esm_ids=["813"];export const __webpack_modules__={5484(t,e,i){i.a(t,async function(t,s){try{i.d(e,{showMarkdownInPiTui:()=>o});var l=i(8691),r=i(3565),n=i(2615),h=i(9989),a=t([l,r,n]);[l,r,n]=a.then?(await a)():a;let c=!1;class m{constructor(t){let{terminal:e,tui:i,markdown:s,hintText:l,documentTitle:r,onClose:n}=t;this.terminal=e,this.tui=i,this._markdown=s,this.hintText=l,this.documentTitle=r?.trim()||"",this.onClose=n,this.scrollTop=0,this._fullLines=null,this._cachedWidth=null,this._ggAwaitingSecondG=!1,this._ggTimer=null}clearGgPrefixState(){null!=this._ggTimer&&(clearTimeout(this._ggTimer),this._ggTimer=null),this._ggAwaitingSecondG=!1}invalidate(){this._markdown.invalidate(),this._fullLines=null,this._cachedWidth=null}handleInput(t){let e=this.terminal.columns,i=this.terminal.rows,s=+!!this.documentTitle,l=Math.max(1,i-s-1),r=this._getFullLines(e).length,h=Math.max(0,r-l);if((0,n.matchesKey)(t,"escape")||(0,n.matchesKey)(t,"esc")||(0,n.matchesKey)(t,"q")||(0,n.matchesKey)(t,"shift+q")||(0,n.matchesKey)(t,"ctrl+c")){this.clearGgPrefixState(),this.onClose();return}if((0,n.matchesKey)(t,"shift+g")){this.clearGgPrefixState(),this.scrollTop=h;return}if((0,n.matchesKey)(t,"g")){if(this._ggAwaitingSecondG){this.clearGgPrefixState(),this.scrollTop=0;return}this._ggAwaitingSecondG=!0,null!=this._ggTimer&&clearTimeout(this._ggTimer),this._ggTimer=setTimeout(()=>{this._ggTimer=null,this._ggAwaitingSecondG=!1},500);return}if(this.clearGgPrefixState(),(0,n.matchesKey)(t,"up")||(0,n.matchesKey)(t,"k")){this.scrollTop=Math.max(0,this.scrollTop-1);return}if((0,n.matchesKey)(t,"down")||(0,n.matchesKey)(t,"j")){this.scrollTop=Math.min(h,this.scrollTop+1);return}if((0,n.matchesKey)(t,"pageUp")||(0,n.matchesKey)(t,"ctrl+u")){this.scrollTop=Math.max(0,this.scrollTop-l);return}if((0,n.matchesKey)(t,"pageDown")||(0,n.matchesKey)(t,"ctrl+d")){this.scrollTop=Math.min(h,this.scrollTop+l);return}if((0,n.matchesKey)(t,"home")){this.scrollTop=0;return}if((0,n.matchesKey)(t,"end")){this.scrollTop=h;return}}_getFullLines(t){return this._fullLines&&this._cachedWidth===t||(this._cachedWidth=t,this._fullLines=this._markdown.render(t)),this._fullLines}render(t){let e=this.terminal.rows,i=this.documentTitle?[l.m.bold.cyan((0,n.truncateToWidth)(this.documentTitle,t))]:[],s=i.length,r=Math.max(1,e-s-1);null!=this._cachedWidth&&this._cachedWidth!==t&&this.invalidate();let h=this._getFullLines(t),a=Math.max(0,h.length-r);this.scrollTop=Math.min(this.scrollTop,a);let o=h.slice(this.scrollTop,this.scrollTop+r);for(;o.length<r;)o.push("");let c=l.m.dim((0,n.truncateToWidth)(this.hintText,t));return[...i,...o,c]}}async function o(t){let{markdown:e,t:i,documentTitle:s,tuiSession:l=null}=t;if(!e||"string"!=typeof e||!e.trim())return;if(!(process.stdout.isTTY&&process.stdin.isTTY))return void process.stdout.write(`${e}
3
+ `);let a=l&&"function"==typeof l.suspendForReadline&&"function"==typeof l.resumeFromReadline;a&&l.suspendForReadline();try{c||((0,r.initTheme)("dark"),c=!0);let t=(0,r.getMarkdownTheme)(),l=new n.Markdown(e,1,1,t),a=i("cli.resultPreviewTerminalHint"),o=new n.ProcessTerminal,u=new n.TuiAltScreen(o);u.setClearOnShrink(!0),await new Promise(t=>{let e,i=new m({terminal:o,tui:u,markdown:l,hintText:a,documentTitle:s,onClose:()=>{e?.clearGgPrefixState(),u.stop(),(0,h.eN)(),t()}});e=i;let r=new n.Container;r.addChild(i),u.addChild(r),u.setFocus(i),u.start(),u.requestRender(!0)})}finally{a&&l.resumeFromReadline()}}s()}catch(t){s(t)}})}};