@pentoshi/clai 4.12.0 → 4.13.0

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.
Files changed (609) hide show
  1. package/CODE_OF_CONDUCT.md +132 -0
  2. package/CONTRIBUTING.md +101 -0
  3. package/PROVIDERS.md +149 -0
  4. package/README.md +217 -426
  5. package/SECURITY.md +33 -0
  6. package/dist/agent/compaction/summary-execution.js +19 -4
  7. package/dist/agent/compaction/summary-execution.js.map +1 -1
  8. package/dist/agent/compaction-summary.d.ts +5 -2
  9. package/dist/agent/compaction-summary.js +10 -4
  10. package/dist/agent/compaction-summary.js.map +1 -1
  11. package/dist/agent/confirm-port.d.ts +3 -5
  12. package/dist/agent/confirm-port.js +12 -6
  13. package/dist/agent/confirm-port.js.map +1 -1
  14. package/dist/agent/context/compact-with-summary.d.ts +1 -0
  15. package/dist/agent/context/compact-with-summary.js +36 -7
  16. package/dist/agent/context/compact-with-summary.js.map +1 -1
  17. package/dist/agent/context/compaction-recent-history.d.ts +12 -0
  18. package/dist/agent/context/compaction-recent-history.js +114 -0
  19. package/dist/agent/context/compaction-recent-history.js.map +1 -0
  20. package/dist/agent/context/latest-user-message.d.ts +2 -0
  21. package/dist/agent/context/latest-user-message.js +10 -0
  22. package/dist/agent/context/latest-user-message.js.map +1 -0
  23. package/dist/agent/context/user-credentials.d.ts +1 -0
  24. package/dist/agent/context/user-credentials.js +3 -0
  25. package/dist/agent/context/user-credentials.js.map +1 -1
  26. package/dist/agent/context-manager.js +6 -2
  27. package/dist/agent/context-manager.js.map +1 -1
  28. package/dist/agent/evidence/task-classification.js +2 -5
  29. package/dist/agent/evidence/task-classification.js.map +1 -1
  30. package/dist/agent/evidence/tool-budgets.js +4 -14
  31. package/dist/agent/evidence/tool-budgets.js.map +1 -1
  32. package/dist/agent/loop-guard.js +1 -5
  33. package/dist/agent/loop-guard.js.map +1 -1
  34. package/dist/agent/outcomes.js +9 -1
  35. package/dist/agent/outcomes.js.map +1 -1
  36. package/dist/agent/parser/arg-formatting.js +3 -16
  37. package/dist/agent/parser/arg-formatting.js.map +1 -1
  38. package/dist/agent/parser/bare-recognition.js +12 -6
  39. package/dist/agent/parser/bare-recognition.js.map +1 -1
  40. package/dist/agent/parser/xml-protocol.js +0 -2
  41. package/dist/agent/parser/xml-protocol.js.map +1 -1
  42. package/dist/agent/plan-implement-compact.js +2 -1
  43. package/dist/agent/plan-implement-compact.js.map +1 -1
  44. package/dist/agent/request-budget.d.ts +1 -0
  45. package/dist/agent/request-budget.js +6 -1
  46. package/dist/agent/request-budget.js.map +1 -1
  47. package/dist/agent/runner.js +2 -2
  48. package/dist/agent/runner.js.map +1 -1
  49. package/dist/agent/session-policy.d.ts +1 -0
  50. package/dist/agent/session-policy.js +1 -4
  51. package/dist/agent/session-policy.js.map +1 -1
  52. package/dist/agent/subagents/manager.d.ts +5 -1
  53. package/dist/agent/subagents/manager.js +96 -15
  54. package/dist/agent/subagents/manager.js.map +1 -1
  55. package/dist/agent/subagents/read-only-tools.js +44 -20
  56. package/dist/agent/subagents/read-only-tools.js.map +1 -1
  57. package/dist/agent/subagents/tools.d.ts +8 -1
  58. package/dist/agent/subagents/tools.js +21 -13
  59. package/dist/agent/subagents/tools.js.map +1 -1
  60. package/dist/agent/subagents/types.d.ts +8 -0
  61. package/dist/agent/subagents/worker.js +48 -7
  62. package/dist/agent/subagents/worker.js.map +1 -1
  63. package/dist/agent/task-evidence.js +2 -11
  64. package/dist/agent/task-evidence.js.map +1 -1
  65. package/dist/agent/tool-output-formatting.js +8 -2
  66. package/dist/agent/tool-output-formatting.js.map +1 -1
  67. package/dist/agent/turn/automatic-compaction-execution.js +1 -0
  68. package/dist/agent/turn/automatic-compaction-execution.js.map +1 -1
  69. package/dist/agent/turn/compaction-coordinator.js +4 -4
  70. package/dist/agent/turn/compaction-coordinator.js.map +1 -1
  71. package/dist/agent/turn/compaction-replay-selection.js +1 -0
  72. package/dist/agent/turn/compaction-replay-selection.js.map +1 -1
  73. package/dist/agent/turn/loop/run-rounds.js +11 -3
  74. package/dist/agent/turn/loop/run-rounds.js.map +1 -1
  75. package/dist/agent/turn/prompt-sections.js +4 -9
  76. package/dist/agent/turn/prompt-sections.js.map +1 -1
  77. package/dist/agent/turn/setup/turn-messages.js +2 -1
  78. package/dist/agent/turn/setup/turn-messages.js.map +1 -1
  79. package/dist/agent/turn/subagent-inbox.d.ts +5 -5
  80. package/dist/agent/turn/subagent-inbox.js +90 -11
  81. package/dist/agent/turn/subagent-inbox.js.map +1 -1
  82. package/dist/agent/turn/system-sections.d.ts +1 -0
  83. package/dist/agent/turn/system-sections.js +1 -1
  84. package/dist/agent/turn/system-sections.js.map +1 -1
  85. package/dist/agent/turn/task-autostart.js +2 -0
  86. package/dist/agent/turn/task-autostart.js.map +1 -1
  87. package/dist/agent/turn/tool-execution/authorization.js +3 -39
  88. package/dist/agent/turn/tool-execution/authorization.js.map +1 -1
  89. package/dist/agent/turn/tool-execution/single-tool.js +2 -4
  90. package/dist/agent/turn/tool-execution/single-tool.js.map +1 -1
  91. package/dist/agent/turn/tool-result-recorder.js +5 -0
  92. package/dist/agent/turn/tool-result-recorder.js.map +1 -1
  93. package/dist/agent/turn/tool-routing.d.ts +1 -1
  94. package/dist/agent/turn/tool-routing.js +11 -11
  95. package/dist/agent/turn/tool-routing.js.map +1 -1
  96. package/dist/agent/workspace-orient.js +2 -2
  97. package/dist/agent/workspace-orient.js.map +1 -1
  98. package/dist/app/adapters/agent-event-adapter.js +5 -0
  99. package/dist/app/adapters/agent-event-adapter.js.map +1 -1
  100. package/dist/app/adapters/current-store-adapter.js +2 -2
  101. package/dist/app/adapters/current-store-adapter.js.map +1 -1
  102. package/dist/app/commands/catalog.js +9 -4
  103. package/dist/app/commands/catalog.js.map +1 -1
  104. package/dist/app/commands/registry.js +1 -1
  105. package/dist/app/commands/registry.js.map +1 -1
  106. package/dist/app/controllers/session-compact-helper.js +2 -1
  107. package/dist/app/controllers/session-compact-helper.js.map +1 -1
  108. package/dist/app/controllers/session-controller.d.ts +8 -0
  109. package/dist/app/controllers/session-controller.js +66 -12
  110. package/dist/app/controllers/session-controller.js.map +1 -1
  111. package/dist/app/controllers/session-naming.d.ts +4 -5
  112. package/dist/app/controllers/session-naming.js +38 -80
  113. package/dist/app/controllers/session-naming.js.map +1 -1
  114. package/dist/app/controllers/session-prompt-history.d.ts +4 -0
  115. package/dist/app/controllers/session-prompt-history.js +33 -0
  116. package/dist/app/controllers/session-prompt-history.js.map +1 -0
  117. package/dist/app/controllers/session-prompt-queue.d.ts +1 -0
  118. package/dist/app/controllers/session-prompt-queue.js +1 -1
  119. package/dist/app/controllers/session-prompt-queue.js.map +1 -1
  120. package/dist/app/events/artifact-output.d.ts +1 -0
  121. package/dist/app/events/artifact-output.js +32 -0
  122. package/dist/app/events/artifact-output.js.map +1 -0
  123. package/dist/app/events/event-buffer.d.ts +13 -1
  124. package/dist/app/events/event-buffer.js +92 -4
  125. package/dist/app/events/event-buffer.js.map +1 -1
  126. package/dist/app/operation-review.d.ts +7 -0
  127. package/dist/app/operation-review.js +61 -0
  128. package/dist/app/operation-review.js.map +1 -0
  129. package/dist/app/ports/confirm-port.d.ts +1 -1
  130. package/dist/app/ports/persistence-port.d.ts +2 -1
  131. package/dist/app/ports/secret-port.d.ts +2 -0
  132. package/dist/classic/app/ClassicApp.js +34 -3
  133. package/dist/classic/app/ClassicApp.js.map +1 -1
  134. package/dist/classic/app/action-handlers.js +0 -2
  135. package/dist/classic/app/action-handlers.js.map +1 -1
  136. package/dist/classic/app/app-wiring.d.ts +1 -2
  137. package/dist/classic/app/app-wiring.js +1 -8
  138. package/dist/classic/app/app-wiring.js.map +1 -1
  139. package/dist/classic/app/use-feed.js +2 -1
  140. package/dist/classic/app/use-feed.js.map +1 -1
  141. package/dist/classic/app/wiring-interactions.d.ts +0 -2
  142. package/dist/classic/app/wiring-interactions.js +5 -13
  143. package/dist/classic/app/wiring-interactions.js.map +1 -1
  144. package/dist/classic/app/wiring-types.d.ts +2 -2
  145. package/dist/classic/blocks/batch-lines.js +10 -8
  146. package/dist/classic/blocks/batch-lines.js.map +1 -1
  147. package/dist/classic/blocks/block-context.d.ts +1 -0
  148. package/dist/classic/blocks/block-context.js.map +1 -1
  149. package/dist/classic/blocks/tool-lines.js +20 -39
  150. package/dist/classic/blocks/tool-lines.js.map +1 -1
  151. package/dist/classic/bootstrap/renderer-handle.d.ts +5 -1
  152. package/dist/classic/bootstrap/renderer-handle.js.map +1 -1
  153. package/dist/classic/bootstrap/start-classic.js +12 -12
  154. package/dist/classic/bootstrap/start-classic.js.map +1 -1
  155. package/dist/classic/chrome/context-limit-editor.d.ts +7 -0
  156. package/dist/classic/chrome/context-limit-editor.js +5 -0
  157. package/dist/classic/chrome/context-limit-editor.js.map +1 -1
  158. package/dist/classic/chrome/status-rows.d.ts +4 -0
  159. package/dist/classic/chrome/status-rows.js +11 -0
  160. package/dist/classic/chrome/status-rows.js.map +1 -1
  161. package/dist/classic/feed/feed-blocks.d.ts +1 -1
  162. package/dist/classic/feed/feed-blocks.js +13 -6
  163. package/dist/classic/feed/feed-blocks.js.map +1 -1
  164. package/dist/classic/panels/confirm-panel.js +9 -3
  165. package/dist/classic/panels/confirm-panel.js.map +1 -1
  166. package/dist/classic/panels/keys-panel.js +12 -3
  167. package/dist/classic/panels/keys-panel.js.map +1 -1
  168. package/dist/classic/panels/pager-panel.js +0 -6
  169. package/dist/classic/panels/pager-panel.js.map +1 -1
  170. package/dist/classic/panels/pager-source-controller.d.ts +34 -0
  171. package/dist/classic/panels/pager-source-controller.js +209 -0
  172. package/dist/classic/panels/pager-source-controller.js.map +1 -0
  173. package/dist/classic/panels/panel-controller.d.ts +1 -5
  174. package/dist/classic/panels/panel-controller.js +44 -92
  175. package/dist/classic/panels/panel-controller.js.map +1 -1
  176. package/dist/classic/panels/panel-effect.d.ts +2 -4
  177. package/dist/classic/panels/panel-effect.js.map +1 -1
  178. package/dist/classic/panels/panel-effects.js +3 -6
  179. package/dist/classic/panels/panel-effects.js.map +1 -1
  180. package/dist/classic/panels/panel-types.d.ts +0 -2
  181. package/dist/classic/panels/picker-panel.js +1 -1
  182. package/dist/classic/panels/picker-panel.js.map +1 -1
  183. package/dist/classic/panels/secret-panel.d.ts +1 -0
  184. package/dist/classic/panels/secret-panel.js +8 -1
  185. package/dist/classic/panels/secret-panel.js.map +1 -1
  186. package/dist/commands/providers.d.ts +1 -0
  187. package/dist/commands/providers.js +1 -0
  188. package/dist/commands/providers.js.map +1 -1
  189. package/dist/commands/qoder.d.ts +8 -0
  190. package/dist/commands/qoder.js +85 -0
  191. package/dist/commands/qoder.js.map +1 -0
  192. package/dist/commands/update/installers.js +1 -0
  193. package/dist/commands/update/installers.js.map +1 -1
  194. package/dist/index.js +31 -15
  195. package/dist/index.js.map +1 -1
  196. package/dist/llm/capability/state.d.ts +1 -1
  197. package/dist/llm/capability/tool-dialect.js +1 -0
  198. package/dist/llm/capability/tool-dialect.js.map +1 -1
  199. package/dist/llm/capability/vision-patterns.js +1 -0
  200. package/dist/llm/capability/vision-patterns.js.map +1 -1
  201. package/dist/llm/catalog-facts.js +15 -8
  202. package/dist/llm/catalog-facts.js.map +1 -1
  203. package/dist/llm/codex-auth.d.ts +2 -0
  204. package/dist/llm/codex-auth.js +30 -0
  205. package/dist/llm/codex-auth.js.map +1 -1
  206. package/dist/llm/codex-config.js +18 -14
  207. package/dist/llm/codex-config.js.map +1 -1
  208. package/dist/llm/codex-models.d.ts +0 -1
  209. package/dist/llm/codex-models.js +0 -1
  210. package/dist/llm/codex-models.js.map +1 -1
  211. package/dist/llm/context-windows.js +2 -3
  212. package/dist/llm/context-windows.js.map +1 -1
  213. package/dist/llm/freebuff-run.d.ts +3 -0
  214. package/dist/llm/freebuff-run.js +9 -1
  215. package/dist/llm/freebuff-run.js.map +1 -1
  216. package/dist/llm/freebuff-session-api.d.ts +3 -1
  217. package/dist/llm/freebuff-session-api.js +14 -1
  218. package/dist/llm/freebuff-session-api.js.map +1 -1
  219. package/dist/llm/freebuff-session.d.ts +2 -0
  220. package/dist/llm/freebuff-session.js +61 -28
  221. package/dist/llm/freebuff-session.js.map +1 -1
  222. package/dist/llm/freebuff-wire.d.ts +3 -0
  223. package/dist/llm/freebuff-wire.js +82 -0
  224. package/dist/llm/freebuff-wire.js.map +1 -0
  225. package/dist/llm/freebuff.js +61 -117
  226. package/dist/llm/freebuff.js.map +1 -1
  227. package/dist/llm/provider-identity.js +5 -0
  228. package/dist/llm/provider-identity.js.map +1 -1
  229. package/dist/llm/provider-info-text.js +25 -0
  230. package/dist/llm/provider-info-text.js.map +1 -1
  231. package/dist/llm/provider-profile-layers.js +1 -1
  232. package/dist/llm/provider-profile-layers.js.map +1 -1
  233. package/dist/llm/qoder/qoder-accounts.d.ts +9 -0
  234. package/dist/llm/qoder/qoder-accounts.js +53 -0
  235. package/dist/llm/qoder/qoder-accounts.js.map +1 -0
  236. package/dist/llm/qoder/qoder-auth.d.ts +59 -0
  237. package/dist/llm/qoder/qoder-auth.js +203 -0
  238. package/dist/llm/qoder/qoder-auth.js.map +1 -0
  239. package/dist/llm/qoder/qoder-credential.d.ts +31 -0
  240. package/dist/llm/qoder/qoder-credential.js +82 -0
  241. package/dist/llm/qoder/qoder-credential.js.map +1 -0
  242. package/dist/llm/qoder/qoder-login.d.ts +28 -0
  243. package/dist/llm/qoder/qoder-login.js +153 -0
  244. package/dist/llm/qoder/qoder-login.js.map +1 -0
  245. package/dist/llm/qoder/qoder-refresh.d.ts +4 -0
  246. package/dist/llm/qoder/qoder-refresh.js +165 -0
  247. package/dist/llm/qoder/qoder-refresh.js.map +1 -0
  248. package/dist/llm/qoder/qoder-signer.d.ts +66 -0
  249. package/dist/llm/qoder/qoder-signer.js +119 -0
  250. package/dist/llm/qoder/qoder-signer.js.map +1 -0
  251. package/dist/llm/qoder/qoder.d.ts +20 -0
  252. package/dist/llm/qoder/qoder.js +441 -0
  253. package/dist/llm/qoder/qoder.js.map +1 -0
  254. package/dist/llm/qoder/signer-glue.generated.d.ts +1 -0
  255. package/dist/llm/qoder/signer-glue.generated.js +4 -0
  256. package/dist/llm/qoder/signer-glue.generated.js.map +1 -0
  257. package/dist/llm/qoder/signer-wasm.generated.d.ts +3 -0
  258. package/dist/llm/qoder/signer-wasm.generated.js +6 -0
  259. package/dist/llm/qoder/signer-wasm.generated.js.map +1 -0
  260. package/dist/llm/reasoning-capability.js +1 -0
  261. package/dist/llm/reasoning-capability.js.map +1 -1
  262. package/dist/llm/reasoning-controls.js +1 -3
  263. package/dist/llm/reasoning-controls.js.map +1 -1
  264. package/dist/llm/reasoning-errors.js +3 -1
  265. package/dist/llm/reasoning-errors.js.map +1 -1
  266. package/dist/llm/request-plan.js +18 -12
  267. package/dist/llm/request-plan.js.map +1 -1
  268. package/dist/llm/routing/attempt-complete.js +11 -4
  269. package/dist/llm/routing/attempt-complete.js.map +1 -1
  270. package/dist/llm/routing/attempt-request.d.ts +2 -1
  271. package/dist/llm/routing/attempt-request.js +37 -0
  272. package/dist/llm/routing/attempt-request.js.map +1 -1
  273. package/dist/llm/routing/attempt-stream.js +12 -4
  274. package/dist/llm/routing/attempt-stream.js.map +1 -1
  275. package/dist/llm/routing/provider-selection.js +3 -0
  276. package/dist/llm/routing/provider-selection.js.map +1 -1
  277. package/dist/llm/tool-protocol.js +6 -0
  278. package/dist/llm/tool-protocol.js.map +1 -1
  279. package/dist/llm/wire/chat-body.js +17 -0
  280. package/dist/llm/wire/chat-body.js.map +1 -1
  281. package/dist/llm/wire/reasoning-payload.d.ts +1 -1
  282. package/dist/llm/wire/reasoning-payload.js +6 -0
  283. package/dist/llm/wire/reasoning-payload.js.map +1 -1
  284. package/dist/modes/ask.js +26 -10
  285. package/dist/modes/ask.js.map +1 -1
  286. package/dist/noninteractive/readline-prompts.d.ts +2 -1
  287. package/dist/noninteractive/readline-prompts.js +34 -1
  288. package/dist/noninteractive/readline-prompts.js.map +1 -1
  289. package/dist/noninteractive/stdio-confirm-port.js +18 -6
  290. package/dist/noninteractive/stdio-confirm-port.js.map +1 -1
  291. package/dist/noninteractive/stream-blocks.d.ts +2 -4
  292. package/dist/noninteractive/stream-blocks.js +5 -5
  293. package/dist/noninteractive/stream-blocks.js.map +1 -1
  294. package/dist/noninteractive/stream-renderer.js +1 -1
  295. package/dist/noninteractive/stream-renderer.js.map +1 -1
  296. package/dist/prompts/embedded.js +2 -2
  297. package/dist/prompts/embedded.js.map +1 -1
  298. package/dist/prompts/index.d.ts +3 -1
  299. package/dist/prompts/index.js +27 -10
  300. package/dist/prompts/index.js.map +1 -1
  301. package/dist/prompts/system.agent.md +16 -16
  302. package/dist/prompts/system.ask.md +5 -3
  303. package/dist/safety/filesystem-permissions.d.ts +4 -0
  304. package/dist/safety/filesystem-permissions.js +113 -0
  305. package/dist/safety/filesystem-permissions.js.map +1 -0
  306. package/dist/safety/permission-mode.d.ts +5 -0
  307. package/dist/safety/permission-mode.js +22 -0
  308. package/dist/safety/permission-mode.js.map +1 -0
  309. package/dist/safety/shell-command-words.d.ts +11 -0
  310. package/dist/safety/shell-command-words.js +193 -0
  311. package/dist/safety/shell-command-words.js.map +1 -0
  312. package/dist/safety/shell-filesystem-effects.d.ts +14 -0
  313. package/dist/safety/shell-filesystem-effects.js +178 -0
  314. package/dist/safety/shell-filesystem-effects.js.map +1 -0
  315. package/dist/safety/shell-permission-words.d.ts +16 -0
  316. package/dist/safety/shell-permission-words.js +102 -0
  317. package/dist/safety/shell-permission-words.js.map +1 -0
  318. package/dist/safety/tool-classification.js +1 -15
  319. package/dist/safety/tool-classification.js.map +1 -1
  320. package/dist/session-runtime/binding.js +4 -1
  321. package/dist/session-runtime/binding.js.map +1 -1
  322. package/dist/session-runtime/client.js +111 -7
  323. package/dist/session-runtime/client.js.map +1 -1
  324. package/dist/session-runtime/discovery.d.ts +1 -1
  325. package/dist/session-runtime/discovery.js +2 -2
  326. package/dist/session-runtime/discovery.js.map +1 -1
  327. package/dist/session-runtime/host.d.ts +10 -2
  328. package/dist/session-runtime/host.js +206 -83
  329. package/dist/session-runtime/host.js.map +1 -1
  330. package/dist/session-runtime/input-commands.d.ts +2 -0
  331. package/dist/session-runtime/input-commands.js +11 -0
  332. package/dist/session-runtime/input-commands.js.map +1 -0
  333. package/dist/session-runtime/input-stream.d.ts +15 -0
  334. package/dist/session-runtime/input-stream.js +128 -0
  335. package/dist/session-runtime/input-stream.js.map +1 -0
  336. package/dist/session-runtime/types.d.ts +9 -0
  337. package/dist/store/config/endpoints.d.ts +2 -1
  338. package/dist/store/config/endpoints.js +4 -1
  339. package/dist/store/config/endpoints.js.map +1 -1
  340. package/dist/store/config.js +1 -0
  341. package/dist/store/config.js.map +1 -1
  342. package/dist/store/history/freshness.d.ts +9 -0
  343. package/dist/store/history/freshness.js +29 -0
  344. package/dist/store/history/freshness.js.map +1 -0
  345. package/dist/store/history/jsonl-backend.js +2 -16
  346. package/dist/store/history/jsonl-backend.js.map +1 -1
  347. package/dist/store/history/lifecycle.js +6 -2
  348. package/dist/store/history/lifecycle.js.map +1 -1
  349. package/dist/store/history/recovery.d.ts +1 -3
  350. package/dist/store/history/recovery.js +72 -111
  351. package/dist/store/history/recovery.js.map +1 -1
  352. package/dist/store/history/session-queries.js +5 -5
  353. package/dist/store/history/session-queries.js.map +1 -1
  354. package/dist/store/history-index.d.ts +5 -0
  355. package/dist/store/history-index.js +41 -9
  356. package/dist/store/history-index.js.map +1 -1
  357. package/dist/store/history.d.ts +7 -2
  358. package/dist/store/history.js +13 -7
  359. package/dist/store/history.js.map +1 -1
  360. package/dist/store/rtk-usage.d.ts +2 -0
  361. package/dist/store/rtk-usage.js +44 -0
  362. package/dist/store/rtk-usage.js.map +1 -0
  363. package/dist/store/session-model.js +0 -1
  364. package/dist/store/session-model.js.map +1 -1
  365. package/dist/store/session-prompts-format.d.ts +2 -0
  366. package/dist/store/session-prompts-format.js +29 -0
  367. package/dist/store/session-prompts-format.js.map +1 -0
  368. package/dist/store/session-prompts.d.ts +40 -0
  369. package/dist/store/session-prompts.js +213 -0
  370. package/dist/store/session-prompts.js.map +1 -0
  371. package/dist/store/subagents.d.ts +5 -1
  372. package/dist/store/subagents.js +67 -6
  373. package/dist/store/subagents.js.map +1 -1
  374. package/dist/tools/call-normalization.js +0 -3
  375. package/dist/tools/call-normalization.js.map +1 -1
  376. package/dist/tools/command-intent.d.ts +0 -1
  377. package/dist/tools/command-intent.js +3 -10
  378. package/dist/tools/command-intent.js.map +1 -1
  379. package/dist/tools/definitions/aggregate.js +0 -4
  380. package/dist/tools/definitions/aggregate.js.map +1 -1
  381. package/dist/tools/definitions/define.js +0 -3
  382. package/dist/tools/definitions/define.js.map +1 -1
  383. package/dist/tools/definitions/files.js +3 -111
  384. package/dist/tools/definitions/files.js.map +1 -1
  385. package/dist/tools/definitions/fs-read.d.ts +3 -0
  386. package/dist/tools/definitions/fs-read.js +43 -0
  387. package/dist/tools/definitions/fs-read.js.map +1 -0
  388. package/dist/tools/definitions/selection.js +0 -45
  389. package/dist/tools/definitions/selection.js.map +1 -1
  390. package/dist/tools/definitions/shell.js +6 -3
  391. package/dist/tools/definitions/shell.js.map +1 -1
  392. package/dist/tools/elevated-shell.d.ts +1 -0
  393. package/dist/tools/elevated-shell.js +2 -0
  394. package/dist/tools/elevated-shell.js.map +1 -1
  395. package/dist/tools/fs/read-budget.d.ts +8 -0
  396. package/dist/tools/fs/read-budget.js +30 -0
  397. package/dist/tools/fs/read-budget.js.map +1 -0
  398. package/dist/tools/fs/read-input.d.ts +16 -0
  399. package/dist/tools/fs/read-input.js +73 -0
  400. package/dist/tools/fs/read-input.js.map +1 -0
  401. package/dist/tools/fs/read-many.d.ts +6 -0
  402. package/dist/tools/fs/read-many.js +50 -0
  403. package/dist/tools/fs/read-many.js.map +1 -0
  404. package/dist/tools/fs/read-sections.d.ts +11 -0
  405. package/dist/tools/fs/read-sections.js +71 -0
  406. package/dist/tools/fs/read-sections.js.map +1 -0
  407. package/dist/tools/fs/read-window.d.ts +1 -1
  408. package/dist/tools/fs/read-window.js +57 -25
  409. package/dist/tools/fs/read-window.js.map +1 -1
  410. package/dist/tools/fs/read.d.ts +0 -4
  411. package/dist/tools/fs/read.js +34 -17
  412. package/dist/tools/fs/read.js.map +1 -1
  413. package/dist/tools/fs.d.ts +3 -2
  414. package/dist/tools/fs.js +23 -5
  415. package/dist/tools/fs.js.map +1 -1
  416. package/dist/tools/handlers/files-1.js +11 -35
  417. package/dist/tools/handlers/files-1.js.map +1 -1
  418. package/dist/tools/handlers/files-2.js.map +1 -1
  419. package/dist/tools/handlers/shell-1.js +26 -35
  420. package/dist/tools/handlers/shell-1.js.map +1 -1
  421. package/dist/tools/interactive-session-tools.js +1 -0
  422. package/dist/tools/interactive-session-tools.js.map +1 -1
  423. package/dist/tools/jobs/types.d.ts +4 -1
  424. package/dist/tools/jobs.js +9 -1
  425. package/dist/tools/jobs.js.map +1 -1
  426. package/dist/tools/read-only-shell.d.ts +2 -0
  427. package/dist/tools/read-only-shell.js +65 -0
  428. package/dist/tools/read-only-shell.js.map +1 -0
  429. package/dist/tools/registry.js +0 -9
  430. package/dist/tools/registry.js.map +1 -1
  431. package/dist/tools/retired-tools.js +1 -1
  432. package/dist/tools/retired-tools.js.map +1 -1
  433. package/dist/tools/rtk/rewrite.d.ts +3 -2
  434. package/dist/tools/rtk/rewrite.js +4 -5
  435. package/dist/tools/rtk/rewrite.js.map +1 -1
  436. package/dist/tools/shell/exec-attempt.js +1 -0
  437. package/dist/tools/shell/exec-attempt.js.map +1 -1
  438. package/dist/tools/shell/internals.d.ts +1 -1
  439. package/dist/tools/shell/internals.js +2 -1
  440. package/dist/tools/shell/internals.js.map +1 -1
  441. package/dist/tools/shell/spawn-argv.js +1 -1
  442. package/dist/tools/shell/spawn-argv.js.map +1 -1
  443. package/dist/tools/shell/timeout.d.ts +1 -0
  444. package/dist/tools/shell/timeout.js +2 -0
  445. package/dist/tools/shell/timeout.js.map +1 -0
  446. package/dist/tools/shell.d.ts +1 -0
  447. package/dist/tools/shell.js.map +1 -1
  448. package/dist/tools/sudo-session.d.ts +4 -5
  449. package/dist/tools/sudo-session.js +1 -0
  450. package/dist/tools/sudo-session.js.map +1 -1
  451. package/dist/tools/tool-types.d.ts +2 -4
  452. package/dist/tui-v2/app/App.js +5 -1
  453. package/dist/tui-v2/app/App.js.map +1 -1
  454. package/dist/tui-v2/bootstrap/start-tui-v2.js +0 -2
  455. package/dist/tui-v2/bootstrap/start-tui-v2.js.map +1 -1
  456. package/dist/tui-v2/components/jobs/subagents-panel.js +14 -2
  457. package/dist/tui-v2/components/jobs/subagents-panel.js.map +1 -1
  458. package/dist/tui-v2/components/modal/confirm-modal.js +6 -2
  459. package/dist/tui-v2/components/modal/confirm-modal.js.map +1 -1
  460. package/dist/tui-v2/components/modal/keys-modal.js +42 -6
  461. package/dist/tui-v2/components/modal/keys-modal.js.map +1 -1
  462. package/dist/tui-v2/components/modal/secret-modal.d.ts +8 -0
  463. package/dist/tui-v2/components/modal/secret-modal.js +27 -18
  464. package/dist/tui-v2/components/modal/secret-modal.js.map +1 -1
  465. package/dist/tui-v2/components/overlay/overlay-host.js +14 -3
  466. package/dist/tui-v2/components/overlay/overlay-host.js.map +1 -1
  467. package/dist/tui-v2/components/pager/pager.js +43 -61
  468. package/dist/tui-v2/components/pager/pager.js.map +1 -1
  469. package/dist/tui-v2/components/picker/picker.js +17 -3
  470. package/dist/tui-v2/components/picker/picker.js.map +1 -1
  471. package/dist/tui-v2/components/transcript/intro-card.js +2 -1
  472. package/dist/tui-v2/components/transcript/intro-card.js.map +1 -1
  473. package/dist/tui-v2/components/transcript/tool-card.js +21 -19
  474. package/dist/tui-v2/components/transcript/tool-card.js.map +1 -1
  475. package/dist/tui-v2/components/transcript/transcript-view.js +24 -21
  476. package/dist/tui-v2/components/transcript/transcript-view.js.map +1 -1
  477. package/dist/tui-v2/components/transcript/use-transcript-selection.d.ts +1 -0
  478. package/dist/tui-v2/components/transcript/use-transcript-selection.js +12 -1
  479. package/dist/tui-v2/components/transcript/use-transcript-selection.js.map +1 -1
  480. package/dist/tui-v2/composer/composer-editor.js +1 -1
  481. package/dist/tui-v2/composer/composer-editor.js.map +1 -1
  482. package/dist/types.d.ts +17 -2
  483. package/dist/types.js +1 -0
  484. package/dist/types.js.map +1 -1
  485. package/dist/ui/mentions/expand.js +1 -1
  486. package/dist/ui-core/actions/action-id.d.ts +1 -1
  487. package/dist/ui-core/actions/action-id.js +0 -2
  488. package/dist/ui-core/actions/action-id.js.map +1 -1
  489. package/dist/ui-core/actions/format-shortcuts.js +0 -2
  490. package/dist/ui-core/actions/format-shortcuts.js.map +1 -1
  491. package/dist/ui-core/actions/keymap.js +0 -6
  492. package/dist/ui-core/actions/keymap.js.map +1 -1
  493. package/dist/ui-core/bootstrap/composition-root.d.ts +0 -3
  494. package/dist/ui-core/bootstrap/composition-root.js +0 -8
  495. package/dist/ui-core/bootstrap/composition-root.js.map +1 -1
  496. package/dist/ui-core/bootstrap/overlay-ports.js +14 -5
  497. package/dist/ui-core/bootstrap/overlay-ports.js.map +1 -1
  498. package/dist/ui-core/bootstrap/session-resume.d.ts +5 -0
  499. package/dist/ui-core/bootstrap/session-resume.js +13 -35
  500. package/dist/ui-core/bootstrap/session-resume.js.map +1 -1
  501. package/dist/ui-core/commands/command-handlers.js +5 -2
  502. package/dist/ui-core/commands/command-handlers.js.map +1 -1
  503. package/dist/ui-core/commands/config-commands.js +5 -1
  504. package/dist/ui-core/commands/config-commands.js.map +1 -1
  505. package/dist/ui-core/commands/key-commands.js +50 -30
  506. package/dist/ui-core/commands/key-commands.js.map +1 -1
  507. package/dist/ui-core/commands/keys/auth-picker.d.ts +3 -0
  508. package/dist/ui-core/commands/keys/auth-picker.js +29 -0
  509. package/dist/ui-core/commands/keys/auth-picker.js.map +1 -0
  510. package/dist/ui-core/commands/keys/qoder.d.ts +4 -0
  511. package/dist/ui-core/commands/keys/qoder.js +194 -0
  512. package/dist/ui-core/commands/keys/qoder.js.map +1 -0
  513. package/dist/ui-core/commands/picker-commands.js +19 -1
  514. package/dist/ui-core/commands/picker-commands.js.map +1 -1
  515. package/dist/ui-core/commands/pickers/output-pager.js +19 -8
  516. package/dist/ui-core/commands/pickers/output-pager.js.map +1 -1
  517. package/dist/ui-core/commands/pickers/search-reasoning.js +3 -4
  518. package/dist/ui-core/commands/pickers/search-reasoning.js.map +1 -1
  519. package/dist/ui-core/commands/prompt-commands.d.ts +2 -0
  520. package/dist/ui-core/commands/prompt-commands.js +10 -0
  521. package/dist/ui-core/commands/prompt-commands.js.map +1 -0
  522. package/dist/ui-core/commands/rtk-commands.js +35 -16
  523. package/dist/ui-core/commands/rtk-commands.js.map +1 -1
  524. package/dist/ui-core/commands/session-commands.js +22 -7
  525. package/dist/ui-core/commands/session-commands.js.map +1 -1
  526. package/dist/ui-core/commands/subagent-commands.js +5 -4
  527. package/dist/ui-core/commands/subagent-commands.js.map +1 -1
  528. package/dist/ui-core/composer/composer-meta.js +2 -5
  529. package/dist/ui-core/composer/composer-meta.js.map +1 -1
  530. package/dist/ui-core/controllers/overlay-controller.d.ts +13 -0
  531. package/dist/ui-core/controllers/overlay-controller.js +33 -6
  532. package/dist/ui-core/controllers/overlay-controller.js.map +1 -1
  533. package/dist/ui-core/rendering/batch-sections.d.ts +1 -1
  534. package/dist/ui-core/rendering/batch-sections.js +18 -4
  535. package/dist/ui-core/rendering/batch-sections.js.map +1 -1
  536. package/dist/ui-core/rendering/duration.d.ts +2 -0
  537. package/dist/ui-core/rendering/duration.js +9 -1
  538. package/dist/ui-core/rendering/duration.js.map +1 -1
  539. package/dist/ui-core/rendering/intro-header.js +5 -6
  540. package/dist/ui-core/rendering/intro-header.js.map +1 -1
  541. package/dist/ui-core/rendering/open-tool-output.js +4 -1
  542. package/dist/ui-core/rendering/open-tool-output.js.map +1 -1
  543. package/dist/ui-core/rendering/pager-source.js +3 -0
  544. package/dist/ui-core/rendering/pager-source.js.map +1 -1
  545. package/dist/ui-core/rendering/pager-text.js +3 -0
  546. package/dist/ui-core/rendering/pager-text.js.map +1 -1
  547. package/dist/ui-core/rendering/pager-view-policy.js +4 -2
  548. package/dist/ui-core/rendering/pager-view-policy.js.map +1 -1
  549. package/dist/ui-core/rendering/session-prompts-pager-source.d.ts +3 -0
  550. package/dist/ui-core/rendering/session-prompts-pager-source.js +40 -0
  551. package/dist/ui-core/rendering/session-prompts-pager-source.js.map +1 -0
  552. package/dist/ui-core/rendering/subagent-source.d.ts +4 -3
  553. package/dist/ui-core/rendering/subagent-source.js +79 -7
  554. package/dist/ui-core/rendering/subagent-source.js.map +1 -1
  555. package/dist/ui-core/rendering/text-width.d.ts +1 -0
  556. package/dist/ui-core/rendering/text-width.js +31 -0
  557. package/dist/ui-core/rendering/text-width.js.map +1 -1
  558. package/dist/ui-core/rendering/tool-presenter.d.ts +9 -4
  559. package/dist/ui-core/rendering/tool-presenter.js +43 -91
  560. package/dist/ui-core/rendering/tool-presenter.js.map +1 -1
  561. package/dist/ui-core/rendering/usage-pager-source.js +6 -2
  562. package/dist/ui-core/rendering/usage-pager-source.js.map +1 -1
  563. package/dist/ui-core/state/transcript-store.js +7 -2
  564. package/dist/ui-core/state/transcript-store.js.map +1 -1
  565. package/dist/ui-core/state/transcript-types.d.ts +1 -1
  566. package/dist/ui-core/state/transcript-types.js +4 -2
  567. package/dist/ui-core/state/transcript-types.js.map +1 -1
  568. package/dist/version.generated.d.ts +2 -2
  569. package/dist/version.generated.js +2 -2
  570. package/package.json +6 -2
  571. package/dist/agent/turn/pentest-tools.d.ts +0 -3
  572. package/dist/agent/turn/pentest-tools.js +0 -17
  573. package/dist/agent/turn/pentest-tools.js.map +0 -1
  574. package/dist/classic/bootstrap/suspend-port.d.ts +0 -14
  575. package/dist/classic/bootstrap/suspend-port.js +0 -29
  576. package/dist/classic/bootstrap/suspend-port.js.map +0 -1
  577. package/dist/tools/capabilities.d.ts +0 -12
  578. package/dist/tools/capabilities.js +0 -225
  579. package/dist/tools/capabilities.js.map +0 -1
  580. package/dist/tools/definitions/network.d.ts +0 -2
  581. package/dist/tools/definitions/network.js +0 -17
  582. package/dist/tools/definitions/network.js.map +0 -1
  583. package/dist/tools/definitions/orchestration.d.ts +0 -2
  584. package/dist/tools/definitions/orchestration.js +0 -27
  585. package/dist/tools/definitions/orchestration.js.map +0 -1
  586. package/dist/tools/fs/search.d.ts +0 -32
  587. package/dist/tools/fs/search.js +0 -427
  588. package/dist/tools/fs/search.js.map +0 -1
  589. package/dist/tools/handlers/network-3.d.ts +0 -2
  590. package/dist/tools/handlers/network-3.js +0 -13
  591. package/dist/tools/handlers/network-3.js.map +0 -1
  592. package/dist/tools/handlers/orchestration-2.d.ts +0 -2
  593. package/dist/tools/handlers/orchestration-2.js +0 -16
  594. package/dist/tools/handlers/orchestration-2.js.map +0 -1
  595. package/dist/tools/net-ping-sweep.d.ts +0 -18
  596. package/dist/tools/net-ping-sweep.js +0 -274
  597. package/dist/tools/net-ping-sweep.js.map +0 -1
  598. package/dist/tools/wordlists.d.ts +0 -6
  599. package/dist/tools/wordlists.js +0 -390
  600. package/dist/tools/wordlists.js.map +0 -1
  601. package/dist/tui-v2/bootstrap/pager-export.d.ts +0 -7
  602. package/dist/tui-v2/bootstrap/pager-export.js +0 -19
  603. package/dist/tui-v2/bootstrap/pager-export.js.map +0 -1
  604. package/dist/ui-core/ports/pager-export-port.d.ts +0 -16
  605. package/dist/ui-core/ports/pager-export-port.js +0 -68
  606. package/dist/ui-core/ports/pager-export-port.js.map +0 -1
  607. package/dist/ui-core/rendering/fs-search-summary.d.ts +0 -11
  608. package/dist/ui-core/rendering/fs-search-summary.js +0 -65
  609. package/dist/ui-core/rendering/fs-search-summary.js.map +0 -1
package/README.md CHANGED
@@ -1,423 +1,308 @@
1
1
  # clai
2
2
 
3
- > A fast, terminal-native AI agent that runs real tools — built to run on **free API tiers and subscriptions you already pay for**, stay alive across rate limits with **multi-key + multi-provider switching**, and do serious work: **building, debugging, and scope-based pentesting / bug bounty**.
3
+ clai is a terminal AI assistant for software development, debugging, shell tasks, and authorized security testing. It can inspect a repository, edit files, run checks, manage background processes, and delegate independent research to subagents.
4
4
 
5
- `clai` is an agentic CLI. It doesn't just describe what to do — it edits files, runs shell commands, scans hosts, fetches HTTP evidence, keeps a durable task plan, and verifies its own work before claiming success. It runs in your terminal with three full surfaces — an OpenTUI full-screen console (default on macOS/Linux), a classic Ink UI (default on Windows), and a noninteractive stream renderer for prompts and pipes. Every interactive surface is a full-screen app sharing the same features, commands, and session state.
5
+ Use a hosted API, an account sign-in, or a local Ollama model. Interactive sessions support live reattachment from multiple terminals on the same machine, so you can reconnect over SSH and continue working with the same agent.
6
6
 
7
- Why people pick it over other agent CLIs:
7
+ - **Persistent sessions:** streaming output and agent work continue after a terminal disconnect or `/minimise`; type from any attached terminal.
8
+ - **Three working modes:** ask questions, execute tasks, or review a plan before implementation.
9
+ - **Provider flexibility:** multiple credentials, automatic key rotation, and optional fallback between configured providers.
10
+ - **Tools and integrations:** file editing, shell commands, background jobs, interactive terminals, web search, MCP servers, and Agent Skills.
11
+ - **Long sessions:** saved transcripts, durable subagent findings, context compaction, and pagers for large outputs.
8
12
 
9
- - **Zero cost of entry.** A fresh install runs **keyless out of the box** on the built-in Free provider — no signup, no API key, no card. It stays useful at $0: Freebuff, Gemini, OpenRouter, NVIDIA NIM, Cline, Hetzner and Bynara are all first-class free options, and `/freeonly on` restricts cross-provider fallback to configured free-tier providers.
10
- - **Account sign-in in the terminal.** Freebuff, ChatGPT, GitHub Copilot, Cline, and Kiro support account-based sign-in. Freebuff uses its browser/device approval flow and a hosted session; the subscription-backed providers use their respective subscription credentials.
11
- - **One agent, ~25 providers.** DeepSeek, Kimi, GLM, MiniMax, MiMo, Qwen, OpenAI, Anthropic, Gemini, local Ollama, and a dozen OpenAI-compatible gateways — switch with one command, mid-session if you like.
12
- - **It doesn't die on rate limits.** Up to 10 keys per provider with sticky rotation, optional cross-provider fallback, and retry/backoff tuned per provider. Long jobs survive flaky free tiers.
13
- - **It's honest.** Findings need real tool output. Builds get typechecked/run before "done." Compaction and history keep long sessions coherent instead of hallucinating progress.
13
+ [Installation](#installation) · [Quick start](#quick-start) · [Persistent sessions](#persistent-sessions) · [Providers](#supported-providers) · [Terminals](#terminal-compatibility-and-recommendations) · [Commands](#commands) · [Contributing](CONTRIBUTING.md)
14
14
 
15
- ---
15
+ ## Installation
16
16
 
17
- ## Highlights
17
+ This guide follows the `main` branch. Packaged releases can lag recent changes; use [source setup](CONTRIBUTING.md#source-setup) to run the current development version.
18
18
 
19
- - **Free-tier first.** Built-in **keyless Free** gateway (`free-2/kilo-auto/free`) so a fresh install runs at no cost with zero setup — no API key required.
20
- - **Account sign-in.** `clai auth <freebuff|cline|chatgpt|copilot|kiro>` — provider-specific browser/device approval, with supported `--import` paths and multi-credential rotation.
21
- - **Multi-key smart switching.** Up to 10 keys per provider with a *sticky* active key and circular rotation on rate-limit, quota, transient, or 5xx errors. Disable any key to skip it without deleting it. Optional cross-provider fallback and a free-only filter.
22
- - **Broad provider support.** 25+ built-in providers: Freebuff, DeepSeek, Kimi (Moonshot), GLM (Zhipu AI), MiniMax, Xiaomi MiMo, OpenAI, Anthropic, Google Gemini, Ollama, NVIDIA NIM, OpenRouter, Qwen Cloud, Cline, Codex (ChatGPT), GitHub Copilot, Kiro, AgentRouter, AWS Mantle, TokenRouter, Token Harbor, Lightning AI, Modal, Meta, Fireworks, Hetzner, OrcaRouter, Merge Gateway, ExpLabs, Vercel AI Gateway — plus custom OpenAI-compatible endpoints.
23
- - **Parallel subagents.** Independent investigations (recon, research, large refactors) run as read-only subagents concurrently; `/orchestrator` and `/subagents` control and inspect them, with per-role model chains.
24
- - **Agent Skills.** Loads `SKILL.md`-based skills on demand — `/skills` manages them, and relevant skills surface automatically per prompt.
25
- - **Scope-based pentesting.** Opt-in engagement scope with authorized/excluded targets, allowed phases, rate and concurrency ceilings, redirect and DNS-rebinding escape detection, and out-of-scope flagging — designed for authorized pentests and bug-bounty programs.
26
- - **Real building & debugging.** Scaffolds apps, edits code surgically, installs packages, runs builds/tests, starts dev servers as background jobs, and probes them before reporting success.
27
- - **Durable plans.** `plan.create` / `task.update` drive a live checklist that survives context compaction and reloads with `/history` — the agent works task-by-task and won't fake completion.
28
- - **State-preserving compaction.** Automatic and manual `/compact` keep a deterministic work envelope next to the summary: subagents (id, title, status, and a digest of results already read), live and finished background jobs, Responder-delegated tasks with their read state, touched files, and any credentials you supplied for the task, carried verbatim instead of being summarized away. When the history fits the model's window, the summary request replays the cached conversation prefix, so compaction is mostly a cache read.
29
- - **Durable agent sessions.** Interactive sessions run behind a local broker, so an agent keeps working after `/minimise`, an SSH disconnect, or switching to another history session; `clai --resume <id>` reattaches to the same live UI and output stream.
30
- - **Persistent interactive terminals.** Conversation-owned PTY or pipe sessions keep REPLs such as Python, Metasploit, Meterpreter, database consoles, and debuggers open across model turns.
31
- - **Native + text tool calling.** Uses provider-native function calling where available, with a text-fence fallback (`toolCalling: auto|native|text`).
32
- - **MCP, explicitly controlled.** Discovers local stdio and remote HTTP/SSE servers from project configs. MCP tools are off by default; `/mcp` inspects and adds servers, and picking one drops an editable `@mcp:<server>` token into your prompt.
33
- - **Safety gate you control.** Every action is classified safe / confirm / block; deletes always confirm with a preview; destructive patterns are blocked.
19
+ Native releases are available for macOS, Linux, and Windows on x64 and ARM64. They include the runtime; Node.js is required for the npm package and development from source.
34
20
 
35
- ---
21
+ ### macOS and Linux
36
22
 
37
- ## Install
38
-
39
- ### macOS
40
23
  ```sh
41
- brew tap pentoshi007/clai && brew install clai
42
- # or
43
24
  curl -fsSL https://downloads.clai.aniketpandey.website/install/install.sh | sh
44
25
  ```
45
26
 
46
- ### Linux
27
+ The installer verifies the binary's published SHA256 checksum. It installs to `/usr/local/bin` by default; `CLAI_BIN_DIR` selects another directory.
28
+
29
+ Homebrew is also available:
30
+
47
31
  ```sh
48
- curl -fsSL https://downloads.clai.aniketpandey.website/install/install.sh | sh
32
+ brew tap pentoshi007/clai
33
+ brew install clai
49
34
  ```
50
35
 
51
36
  ### Windows
37
+
38
+ Run in PowerShell:
39
+
52
40
  ```powershell
53
41
  irm https://downloads.clai.aniketpandey.website/install/install.ps1 | iex
54
- # or
55
- scoop bucket add clai https://github.com/pentoshi007/clai && scoop install clai
56
42
  ```
57
43
 
58
- ### npm / from source
44
+ ### npm
45
+
46
+ Requires Node.js 22 or later:
47
+
59
48
  ```sh
60
- npm i -g @pentoshi/clai
61
- # or
62
- git clone https://github.com/pentoshi007/clai.git
63
- cd clai && npm install && npm run build && npm start
49
+ npm install -g @pentoshi/clai
64
50
  ```
65
51
 
66
- Node.js ≥ 22. Type `clai` in any terminal to start.
52
+ On macOS and Linux, the npm installer sets up Bun for the OpenTUI interface when needed. Set `CLAI_NO_BUN_AUTO_INSTALL=1` to skip that setup and use `clai --classic`.
67
53
 
68
- > **Tip for Linux users:** For the best mouse and hover support in the full-screen TUI, modern GPU-rendered terminals like **Kitty**, **Alacritty**, or **WezTerm** are recommended. On macOS, **iTerm2** and the default Terminal work out of the box.
69
-
70
- ---
54
+ For manual downloads, use [GitHub Releases](https://github.com/pentoshi007/clai/releases). For a source checkout, follow [CONTRIBUTING.md](CONTRIBUTING.md).
71
55
 
72
56
  ## Quick start
73
57
 
74
- Out of the box, `clai` runs **keyless** on the built-in Free provider — no signup, no API key:
75
-
76
58
  ```sh
77
- clai # launch the full-screen agent console (already on the free provider)
59
+ clai
78
60
  ```
79
61
 
80
- Have a ChatGPT, Copilot, Cline, or Kiro subscription? Sign in instead of buying API credit:
62
+ A fresh configuration uses the keyless Free provider and **ask** mode. Hosted availability and limits depend on the provider. Use `/agent` to enable task execution or `/plan` to prepare a plan for review.
63
+
64
+ To sign in with an existing account, for example ChatGPT:
81
65
 
82
66
  ```sh
83
- clai auth chatgpt # browser or device-code sign-in
67
+ clai auth chatgpt
84
68
  clai use chatgpt
85
69
  clai
86
70
  ```
87
71
 
88
- Prefer a plain API key? Set it and start:
72
+ To use an API key, `clai set` prompts with hidden input when the key is omitted:
89
73
 
90
74
  ```sh
91
- # Add an API key (DeepSeek shown; Gemini, OpenAI, Anthropic, Kimi, etc. work the same)
92
- clai set deepseek sk-your_key_here
75
+ clai set deepseek
93
76
  clai use deepseek
94
-
95
- # Launch the full-screen agent console
96
77
  clai
97
-
98
- # Or one-shot directly from the shell
99
- clai "explain what this repo does and find the entrypoint"
100
- clai --mode agent "add a /health endpoint to the Express app and run the tests"
101
78
  ```
102
79
 
103
- Prefer fully local and offline? Point at Ollama:
80
+ For a local model, start Ollama and download the model you intend to use, then configure its endpoint:
104
81
 
105
82
  ```sh
106
83
  clai set ollama --url http://localhost:11434
107
84
  clai use ollama
85
+ clai model <downloaded-model>
86
+ clai
108
87
  ```
109
88
 
110
- ---
111
-
112
- ## Providers & Key Management
113
-
114
- ### Account sign-in providers (no conventional API key needed)
115
-
116
- Sign in with an account you already have. Browser/device-code flows work on headless servers through a copyable link; `--import` reuses supported local sign-ins or imports provider tokens.
117
-
118
- | Provider | Sign-in | Notes |
119
- |----------|---------|-------|
120
- | **Freebuff** | `clai auth freebuff` | Free, session-gated catalog; browser sign-in or headless link |
121
- | **ChatGPT (Codex)** | `clai auth chatgpt` | Any ChatGPT tier incl. Free; mimics the official Codex CLI |
122
- | **GitHub Copilot** | `clai auth copilot` | Incl. Copilot Free; mimics VS Code Copilot Chat |
123
- | **Cline** | `clai auth cline` | Free `cline-free/*` models plus frontier catalog |
124
- | **Kiro (AWS)** | `clai auth kiro` | AWS Builder ID, Google/GitHub social login, or IAM Identity Center SSO |
125
-
126
- Up to 10 credentials can be stored per provider, with automatic key rotation on applicable authentication/quota errors. `clai auth <p> --import` imports supported local sign-ins; Freebuff also imports `FREEBUFF_API_KEY`, `CODEBUFF_API_KEY`, or the upstream `~/.config/manicode/credentials.json` token.
127
-
128
- ### API-key providers
129
-
130
- | Provider | Default Model | Tier | Environment Variable |
131
- |----------|---------------|------|----------------------|
132
- | **Free (keyless)** | `free-2/kilo-auto/free` | Free · Keyless | — (no key needed) |
133
- | **DeepSeek** | `deepseek-chat` | Paid / Usage | `DEEPSEEK_API_KEY` |
134
- | **Kimi (Moonshot)** | `kimi-k3` | Paid / Usage | `KIMI_API_KEY` / `MOONSHOT_API_KEY` |
135
- | **GLM (Zhipu AI)** | `glm-4-plus` | Free tier / Paid | `GLM_API_KEY` / `ZHIPU_API_KEY` |
136
- | **MiniMax** | `MiniMax-Text-01` | Paid / Usage | `MINIMAX_API_KEY` |
137
- | **Xiaomi MiMo** | `mimo-v2.6-pro` | Paid / Usage | `MIMO_API_KEY` |
138
- | **Google Gemini** | `gemini-3.5-flash` | Free tier / Paid | `GEMINI_API_KEY` |
139
- | **NVIDIA NIM** | `openai/gpt-oss-20b` | Free tier | `NVIDIA_API_KEY` |
140
- | **OpenRouter** | `meta-llama/llama-3.3-70b-instruct:free` | Free / Paid | `OPENROUTER_API_KEY` |
141
- | **Ollama** | `llama3.1:8b` | Local / Free | `OLLAMA_HOST` |
142
- | **OpenAI** | `gpt-5.4-mini` | Paid | `OPENAI_API_KEY` |
143
- | **Anthropic** | `claude-3-5-haiku-latest` | Paid | `ANTHROPIC_API_KEY` |
144
- | **Qwen Cloud** | `qwen3.7-plus` | Paid (DashScope) | `DASHSCOPE_API_KEY` |
145
- | **Bynara** | `mimo-v2.5-free` | Free | `BYNARA_API_KEY` |
146
- | **Hetzner** | `Qwen/Qwen3.6-35B-A3B-FP8` | Free (experiment) | `HETZNER_API_KEY` |
147
- | **AgentRouter** | `claude-opus-4-6` | Paid gateway | `AGENTROUTER_API_KEY` |
148
- | **AWS Mantle** | `anthropic.claude-haiku-4-5` | Paid (AWS) | `ANTHROPIC_API_KEY` |
149
- | **TokenRouter** | `moonshotai/kimi-k3` | Paid gateway | `TOKENROUTER_API_KEY` |
150
- | **Token Harbor** | `claude-sonnet-5.5` | Paid gateway (free tier) | `TOKENHARBOR_API_KEY` |
151
- | **Lightning AI** | `openai/gpt-5` | Free grant / Paid | `LIGHTNING_API_KEY` |
152
- | **Modal** | `moonshotai/Kimi-K3` | Your own endpoint ($30/mo credit) | `MODAL_PROXY_TOKEN_ID` |
153
- | **Meta (Muse)** | `muse-spark-1.2` | Paid | `MODEL_API_KEY` |
154
- | **Fireworks** | `accounts/fireworks/models/kimi-k2p6` | Paid | `FIREWORKS_API_KEY` |
155
- | **OrcaRouter** | `openai/gpt-4o-mini` | Paid gateway (zero markup) | `ORCAROUTER_API_KEY` |
156
- | **Merge Gateway** | `openai/gpt-5.2` | Paid gateway | `MERGE_GATEWAY_API_KEY` |
157
- | **ExpLabs** | `claude-fable-5.1` | Paid / BYOK gateway | `EXPLABS_API_KEY` |
158
- | **Vercel AI Gateway** | `openai/gpt-5.4-mini` | Paid gateway | `AI_GATEWAY_API_KEY` |
159
-
160
- Model catalogs use each provider's supported discovery source; most expose a dedicated models endpoint. Freebuff does not: clai reads account-visible model IDs from its read-only session endpoint and merges them with a source-versioned fallback. You can switch models anytime using `/model` or `clai model <name>`, browse the whole fleet with `/models`, and read setup details for any provider with `/info <provider>`.
161
-
162
- ### Freebuff setup and behavior
163
-
164
- Freebuff is a hosted, free-tier provider that requires an account sign-in. Free-mode inference is only served to the genuine freebuff CLI: the server refuses direct API calls (free_mode_cli_required), so clai manages sign-in and the live model catalog but refuses generation requests fast with an actionable message. The default model is `z-ai/glm-5.3-flash`.
89
+ You can also run a prompt directly or pipe input:
165
90
 
166
91
  ```sh
167
- clai auth freebuff # sign in, then approve in your browser
168
- clai use freebuff
169
- clai # start the interactive agent
170
- clai model z-ai/glm-5.3-flash # set a model from the catalog
171
- # in the interactive console: /model · /info freebuff
92
+ clai "explain this repository and identify its entrypoint"
93
+ clai --mode agent "add a health endpoint and run the relevant tests"
94
+ git diff | clai --quiet "review this diff for bugs"
172
95
  ```
173
96
 
174
- On a desktop, `clai auth freebuff` opens the approval page when possible. On SSH/headless Linux it prints a URL to open on any device; no localhost callback or port-forwarding is required. To import an existing token, use `clai auth freebuff --import`. Import checks `FREEBUFF_API_KEY`, `CODEBUFF_API_KEY`, then the upstream `~/.config/manicode/credentials.json` file (or `FREEBUFF_CONFIG_DIR`). A token can also be entered with `clai set freebuff <token>`. clai stores credentials through its existing secure key storage; up to 10 credentials can be configured and rotated on authentication or quota errors.
97
+ ## Persistent sessions
175
98
 
176
- The login token is an opaque bearer credential. It has no refresh token or documented expiry; if the server returns 401, sign in again or replace the token. Keep it secret and do not paste it into chat or commit it to a repository.
99
+ ### Detach and resume
177
100
 
178
- #### Sessions, models, and spending
101
+ Run `/minimise` inside the interactive console to return to your shell while the agent continues. `/minimize` and `/minmize` are aliases. The detach message includes the session ID and a resume command.
179
102
 
180
- clai admits no Freebuff session for inference and spends no wallet Freebucks: every direct inference attempt is refused server-side, so the request stops before any session state mutates. To use these models, run the genuine client (`npm i -g freebuff`, then `freebuff`). Because inference is unavailable, Freebuff is intentionally excluded from automatic cross-provider fallback; select it explicitly only for sign-in and catalog browsing.
103
+ | Command | Behavior |
104
+ | --- | --- |
105
+ | `clai --resume` | Resume the most recently updated live or saved session across directories. |
106
+ | `clai --resume <id>` | Resume a specific session; a unique ID prefix also works. |
107
+ | `clai -c` or `clai --continue` | Prefer the latest session for the current directory, with a saved-session fallback when none matches. |
108
+ | `clai history` or `/history` | Find saved sessions and see whether an agent is running, attached, or detached. |
181
109
 
182
- `/model` lists only the models the server currently reports as applicable to the signed-in account (live rate-limit pools plus zero-price models, minus plan-gated ids), cached per credential for up to 30 minutes. The bundled model-ID table is only an offline fallback when the session probe is unreachable; nothing is hardcoded into the live list. Freebuff does not provide the separately probed `/api/v1/models` endpoint, nor does the session catalog publish per-model context-window limits. Context sizes therefore use clai's generic estimates rather than claimed live Freebuff limits. Modality and reasoning support are recognized from known model patterns; not every catalog item is guaranteed to support images or a configurable effort.
110
+ Reattaching to a live session opens its existing UI. Resuming a saved session restores its conversation and transcript. Bare `--resume` also uses the original working directory if it still exists. Resume flags apply to interactive sessions; prompts supplied on the command line run separately.
183
111
 
184
- #### Tools, images, thinking, and caching
112
+ ### SSH and multiple terminals
185
113
 
186
- clai does not run Freebuff inference, so no Chat Completions or SSE streaming path is exercised against this provider. `/model` lists only the models the server currently reports as applicable to the signed-in account (live rate-limit pools plus zero-price models, minus plan-gated ids), cached per credential for up to 30 minutes. The bundled model-ID table is only an offline fallback when the session probe is unreachable; nothing is hardcoded into the live list.
114
+ After an SSH disconnect, reconnect to the same machine as the same OS user and run `clai --resume`. To share a particular live session, run `clai --resume <id>` in another terminal or SSH connection.
187
115
 
188
- On clean TUI shutdown and after a noninteractive run, clai awaits best-effort deletion of its own CLI session claims. Forced termination, process crashes, or an unreachable server can prevent that request; the server-side session expiry still applies. clai never sends a delete for a claim it does not own.
116
+ Every attachment sees the same live screen and can type immediately, including prompts and shortcuts. Attachments share one composer and one running agent. The screen fits the smallest attached terminal. Closing or minimising one attachment keeps the agent and the other attachments running.
189
117
 
190
- #### Troubleshooting
118
+ Durable sessions require an interactive terminal, a compatible PTY transport, and history enabled. Private mode and `--no-history` use foreground sessions. Saved history remains available after the live process ends; an active process still depends on its host machine remaining running.
191
119
 
192
- - **401 / invalid token:** run `clai auth freebuff` again or replace the saved token. There is no refresh-token flow.
193
- - **409 session_superseded / 403 free_mode_cli_required on generation:** expected. The server only serves free-mode turns to the genuine freebuff CLI; clai refuses before spending anything. Use `freebuff` for these models or `/provider` for another provider.
194
- - **Quota, model-unavailable, country, or account refusal:** follow the server's message; wait for the indicated reset/window or choose a currently available model with `/model`.
195
- - **Wallet consent required:** clai has not spent anything. It always requests zero wallet spend; use a free-eligible model or review the purchase in a Freebuff-supported surface.
196
- - **Catalog does not refresh:** `/model` uses the account-visible session response and a 30-minute per-account cache. If the session probe is unreachable, clai displays its bundled catalog fallback; the hosted `/api/v1/models` endpoint is not available.
197
- - **Session remains after a forced stop:** clean exits attempt deletion; otherwise Freebuff's server-side expiry clears it.
120
+ ### History and context
198
121
 
199
- ### Manage Keys
122
+ `/new` starts a fresh session and saves the previous one. If work is still running, it remains in its previous session. `/save <name>` names a session, and `/prompts` browses sent prompts with their timestamps and provider, model, and effort metadata.
200
123
 
201
- ```sh
202
- clai set deepseek sk-first_key # store a key
203
- clai set deepseek sk-second_key # add another key for multi-key rotation
204
- clai set gemini --from-env GEMINI_API_KEY
205
- echo "sk-..." | clai set deepseek --stdin
206
- clai set ollama --url http://localhost:11434
207
- clai keys # list providers with masked keys (★ active)
208
- clai use deepseek # set active provider
209
- clai provider # interactive provider/model selector
210
- clai unset deepseek # remove keys for a provider
211
- ```
124
+ Context compaction reduces what the model receives while retaining recent requests, plans, task state, and available research findings. It does not erase the saved chat transcript. Use `/compact` to compact manually, `/context` to inspect context size, and `/output` to read retained tool output.
212
125
 
213
- In the interactive console:
214
- - **`/set`** opens the multi-row key editor. Add keys (`+`), set the active key (★), or disable a key (`○`) without deleting it.
215
- - **`/keys`** displays configured keys (masked) and active status.
216
- - **`/provider`** and **`/model`** open interactive pickers for switching providers and models on the fly.
217
- - **`/info <provider>`** shows per-provider setup, pricing, and endpoint details.
126
+ `/clear` deletes the current session and starts fresh. `/reset` clears all saved history. These are deletion commands; use `/new` when you want to keep the previous conversation.
218
127
 
219
- ### Smart Switching & Resilience
128
+ ## Providers and usage
220
129
 
221
- - **Multi-key rotation** — Store up to **10 keys per provider**. The last key that worked is *sticky*. On encountering a rate limit (HTTP 429), quota limit, auth error, or 5xx server error, `clai` automatically rotates to the next available key.
222
- - **Disable without deleting** — Toggle any key disabled in the `/set` editor; rotation skips it until you re-enable it.
223
- - **Cross-provider fallback** *(opt-in)* — `/fallback on` lets `clai` fall back to other configured providers when the active provider is exhausted.
224
- - **Token-saving shell output** *(opt-in)* — `/rtk on` routes foreground `shell.exec` commands through [rtk](https://github.com/rtk-ai/rtk) via `rtk rewrite`, so the model reads compact output. Only the executed command changes: the model's tool call, approvals, and history keep the original, and the system prompt and tool schemas never change, so the prompt cache prefix is never invalidated. Background jobs, interactive/PTY sessions, sudo, and commands clai already reduces (nmap, ffuf, …) are never rewritten; if rtk is missing, busy updating, or fails, commands run unmodified. No rtk yet? `/rtk install` (or **Install rtk** on the `/rtk` screen) uses Homebrew, else rtk's checksum-verified installer, else cargo (winget, else cargo, on Windows) in the background; `/rtk update` upgrades through whichever tool installed it. rtk is found even when its directory is not on `PATH`, and a same-named impostor binary is skipped. All rewrite rules live in rtk itself, so updating rtk never requires a clai release.
225
- - **Free-only mode** *(opt-in)* — `/freeonly on` restricts fallback strictly to free tiers (Free, Gemini, OpenRouter, NIM, Bynara, Hetzner, and the free-lane subscription providers) so you never accidentally spend.
226
- - **Usage visibility** — `/usage` shows token consumption per provider and model, including cache reads and writes, so you can see what a session actually cost. It counts every billed request: subagents, title generation, compaction, and retried attempts whose stream died after the provider had already billed the prompt.
130
+ clai supports API credentials, account sign-ins, and local endpoints. Account integrations include ChatGPT, GitHub Copilot, Cline, Kiro, OmniRush, and Qoder. Freebuff has separate admission requirements described in the [provider guide](PROVIDERS.md#freebuff).
227
131
 
228
- ---
132
+ ### Supported providers
229
133
 
230
- ## What clai is good at
134
+ Account sign-in integrations:
231
135
 
232
- ### Building & debugging
136
+ | Provider | Sign-in command | Notes |
137
+ | --- | --- | --- |
138
+ | ChatGPT (Codex) | `clai auth chatgpt` | Stored as `codex`; browser/headless sign-in or existing Codex CLI import. |
139
+ | GitHub Copilot | `clai auth copilot` | Browser/device sign-in or supported credential import. |
140
+ | Cline | `clai auth cline` | Account sign-in or supported credential import. |
141
+ | Kiro | `clai auth kiro` | Social login, AWS Builder ID, or IAM Identity Center. |
142
+ | OmniRush | `clai auth omnirush` | Device-code sign-in or existing OmniRush CLI import. |
143
+ | Qoder | `clai auth qoder` | Browser/headless sign-in, CLI import, or PAT via `--pat`. |
144
+ | Freebuff | `clai auth freebuff` | Sign-in and catalog support; inference requires server admission. |
233
145
 
234
- The same agent that runs recon also ships code. It explores before it writes, matches your existing stack from lockfiles, edits surgically, and proves the result:
146
+ API, keyless, and local integrations:
235
147
 
236
- - Scaffolds and extends apps; replaces starter boilerplate with real features.
237
- - Surgical file tools: `fs.edit`, `fs.replaceLines`, `fs.append`, plus multi-file writes.
238
- - Runs the checks that apply — typecheck, build, unit/integration tests — and fixes failures before claiming success.
239
- - Starts dev servers as background jobs, tails until ready, probes `localhost`, and reports the URL / port / job id with the server left running.
240
- - Debugging loop: reproduce → read the actual error → fix root cause → re-verify.
148
+ | Provider | Provider ID | Credential or endpoint variable |
149
+ | --- | --- | --- |
150
+ | Free | `free` | Keyless models; optional `FREE_API_KEY` for authenticated access. |
151
+ | Ollama | `ollama` | Local endpoint through `OLLAMA_HOST` or `clai set ollama --url <url>`. |
152
+ | Anthropic | `anthropic` | `ANTHROPIC_API_KEY` |
153
+ | DeepSeek | `deepseek` | `DEEPSEEK_API_KEY` |
154
+ | Google Gemini | `gemini` | `GEMINI_API_KEY` |
155
+ | GLM / Zhipu | `glm` | `GLM_API_KEY`, `ZHIPU_API_KEY`, or `ZAI_API_KEY` |
156
+ | Kimi / Moonshot | `kimi` | `KIMI_API_KEY` or `MOONSHOT_API_KEY` |
157
+ | MiniMax | `minimax` | `MINIMAX_API_KEY` |
158
+ | Xiaomi MiMo | `mimo` | `MIMO_API_KEY` |
159
+ | NVIDIA NIM | `nvidia` | `NVIDIA_API_KEY` |
160
+ | OpenAI | `openai` | `OPENAI_API_KEY` |
161
+ | OpenRouter | `openrouter` | `OPENROUTER_API_KEY` |
162
+ | Qwen Cloud / DashScope | `qwen-cloud` | `DASHSCOPE_API_KEY` |
163
+ | AgentRouter | `agentrouter` | `AGENTROUTER_API_KEY` |
164
+ | AWS Mantle | `aws-mantle` | `ANTHROPIC_API_KEY` for the configured Mantle endpoint. |
165
+ | Bynara | `bynara` | `BYNARA_API_KEY` |
166
+ | ExpLabs | `explabs` | `EXPLABS_API_KEY` |
167
+ | Fireworks | `fireworks` | `FIREWORKS_API_KEY` |
168
+ | Hetzner | `hetzner` | `HETZNER_API_KEY` |
169
+ | Lightning AI | `lightning` | `LIGHTNING_API_KEY` |
170
+ | Merge Gateway | `merge-gateway` | `MERGE_GATEWAY_API_KEY` |
171
+ | Meta Model API | `meta` | `MODEL_API_KEY` |
172
+ | Modal | `modal` | Both `MODAL_PROXY_TOKEN_ID` and `MODAL_PROXY_TOKEN_SECRET`; deployed endpoint required. |
173
+ | OrcaRouter | `orcarouter` | `ORCAROUTER_API_KEY` |
174
+ | Token Harbor | `tokenharbor` | `TOKENHARBOR_API_KEY` |
175
+ | TokenRouter | `tokenrouter` | `TOKENROUTER_API_KEY` |
176
+ | Vercel AI Gateway | `vercel` | `AI_GATEWAY_API_KEY` |
241
177
 
242
- ```sh
243
- clai --mode agent "convert this Vite React app to Next.js App Router, keep all features, run the build"
244
- clai --mode agent "this test is flaky — find the race and fix it"
245
- ```
178
+ Use `clai set <provider>` for a hidden-input credential prompt, or `--from-env <variable>` to import a credential. The [provider guide](PROVIDERS.md) includes account flows, endpoint setup, and provider-specific behavior. `/model` shows model choices; access, limits, and prices depend on the provider and account.
246
179
 
247
- ### Parallel subagents & Agent Skills
180
+ ### Models, rotation, and usage
248
181
 
249
- For work with several independent threads — recon on multiple targets, researching unrelated bugs, surveying a large codebase — `clai` delegates read-only investigations to **subagents** that run concurrently and report back with evidence:
182
+ - `/provider` selects a provider; `/model` selects its model; `/models` browses models across providers.
183
+ - `/set` manages up to 10 credentials per provider, including disabled keys and the active key. Applicable authentication, quota, rate-limit, and server failures can trigger rotation.
184
+ - `/fallback on` enables cross-provider fallback; it is off by default. `/freeonly on` filters fallback using clai's provider categories. Check the selected model and account's billing terms when controlling spending.
185
+ - `/effort` configures reasoning where supported. Qoder uses the selected effort, including `xhigh`, and displays thinking when returned by the model.
186
+ - `/usage` shows reported token and cache usage across main turns, subagents, and auxiliary requests. Supported account providers also expose quota or subscription information. Token totals are not a billing invoice.
250
187
 
251
- - `/orchestrator on|off|status|models` — control delegation and assign cheaper models to subagent roles.
252
- - `/subagents` — inspect live assignments; stop or restart one by id.
188
+ The [provider guide](PROVIDERS.md) covers authentication, environment variables, endpoint configuration, and provider-specific behavior. Model catalogs and account access can change; use `/model` and the provider's own dashboard for availability.
253
189
 
254
- **Agent Skills** extend the agent with reusable `SKILL.md` playbooks (bundled or your own). Skills are discovered from standard locations, ranked per prompt, and loaded on demand; `/skills list|refresh` manages them.
190
+ ## Working with clai
255
191
 
256
- ### Scope-based pentesting & bug bounty
192
+ ### Modes and permissions
257
193
 
258
- `clai` is built to run real, authorized security work — not to narrate it. It follows a recon-first methodology and keeps you inside the boundaries you set.
194
+ | Mode | Purpose |
195
+ | --- | --- |
196
+ | `ask` | Questions, explanations, and read-only investigation. This is the initial default. |
197
+ | `agent` | Execute tasks with file, shell, and other tools under the configured permission policy. |
198
+ | `plan` | Gather evidence and prepare a plan. Review it with `/view-plan`, then use `/implement` to approve execution or `/discard` to remove it. |
259
199
 
260
- ```
261
- recon / discovery → fingerprint stack → plan.create (kind=pentest)
262
- ↑ │
263
- │ /implement (approve)
264
- │ ↓
265
- └──── enumerate → exploit → post-ex → report
266
- (revise the plan as surface grows; keep completed tasks)
267
- ```
200
+ Switch modes with `/ask`, `/agent`, `/plan`, or `Shift+Tab`. `clai mode <mode>` sets the default for new sessions.
268
201
 
269
- 1. **Authorize once**, then optionally **define scope** — authorized targets, exclusions, allowed phases, rate/concurrency ceilings, and an expiry.
270
- 2. **Recon first** (read-only discovery needs no plan): whois, DNS, `net.pingSweep`, `http.fetch`, and shell tools like `nmap`, `ffuf`, `nuclei`, `sqlmap` — orchestrated with durable checkpoints.
271
- 3. **Analyze real evidence**, then `plan.create` with `kind=pentest` from actual ports/services/endpoints — then stop for your approval.
272
- 4. `/implement` and execute task-by-task; expand the plan as new attack surface appears without wiping completed work.
273
- 5. **Report** with structure — title, severity, evidence, reproduction, impact, remediation — and honest residual/untested notes.
202
+ Fresh configurations use **auto-allow** permissions. `/permissions default` enables the more conservative confirmation policy; `/permissions auto-allow` allows eligible actions automatically while retaining confirmation for out-of-folder or unresolved deletions. `/permissions full-access` further relaxes confirmations. Ask/plan restrictions, OS permissions, engagement scope, and hard safety blocks still apply.
274
203
 
275
- **Scope enforcement is real, not cosmetic.** When scope is active, `clai` checks each target against your authorized/excluded lists, enforces token-bucket rate limits and a concurrency ceiling, detects **redirects that leave scope** and **DNS-rebinding escapes**, and flags out-of-scope hosts instead of touching them.
204
+ When an approval prompt appears, `Ctrl+O` opens the complete pending operation, including its arguments and working directory. Reading the operation does not approve it. These policies govern clai's tool execution; they are not an OS sandbox.
276
205
 
277
- ```sh
278
- clai authorize-pentest AGREE
279
- clai scope new --targets lab.example.com,10.10.0.0/24 --exclude prod.example.com \
280
- --phases recon,enumeration --max-rate 5 --max-concurrency 2
281
- # in the console: /scope show · /scope add <targets> · /scope clear
282
- ```
206
+ ### Subagents and background work
283
207
 
284
- ### General security & sysadmin workflows
208
+ `/orchestrator` controls delegation and subagent model choices. `/subagents` shows assignments and lets you stop or restart an investigation. Retained findings and delivery state help the parent reuse completed research after compaction or resuming a session.
285
209
 
286
- Log triage, config hardening, packaging, network analysis, OCR of a screenshot or PDF report, quick OSINT — all handled by the same agent under the same safety gate.
210
+ The agent can keep development servers and long commands running as background jobs. Use `/jobs` to inspect them and `/output` to browse output. Conversation-owned interactive terminals support REPLs, debuggers, and database consoles across model turns.
287
211
 
288
- ---
212
+ `/rtk on` optionally compresses eligible foreground shell output through [rtk](https://github.com/rtk-ai/rtk). It is off by default; `/rtk install`, `/rtk update`, and `/rtk status` manage the integration.
289
213
 
290
- ## Modes & reasoning
214
+ ### Authorized security testing
291
215
 
292
- Three modes, switchable anytime with a slash command, `Shift+Tab`, or `clai --mode`:
216
+ clai can assist with reconnaissance, enumeration, scoped testing, and reporting using installed tools. Test systems you own or have permission to assess.
293
217
 
294
- | Mode | Use |
295
- |------|-----|
296
- | **ask** | Answers, methodology, and read-only tools — no mutations, no attacks. |
297
- | **agent** | Executes: edits, installs, scans, verifies, works the plan. |
298
- | **plan** | Research and design a durable plan; approve with `/implement` before execution. |
218
+ `clai authorize-pentest AGREE` stores the authorization acknowledgement. Use `clai scope` to configure the default engagement scope inherited by new sessions, or `/scope` to configure the current session. Scope can define authorized targets, exclusions, phases, and limits. Plan mode supports evidence gathering before you approve implementation.
299
219
 
300
- **Reasoning / thinking** is controlled with `/effort` (alias `/reasoning`), accepting `on`, `off`, `none`, `minimal`, `low`, `medium`, `high`, or `xhigh`. `clai` sends reasoning options only to models that support them.
220
+ ## Terminal interface
301
221
 
302
- ---
222
+ OpenTUI is selected by default on macOS and Linux when the terminal is at least 60 columns by 14 rows and the runtime is available. Windows and smaller terminals use Classic, which runs on React and Ink. `clai --classic` selects Classic explicitly; `clai --tui` requests OpenTUI with a Classic fallback when unavailable.
303
223
 
304
- ## Safety gate
224
+ Both interfaces provide streaming chat, tool output, plans, session history, and provider controls.
305
225
 
306
- You own authorization; `clai` gates risk on every action:
226
+ ### Terminal compatibility and recommendations
307
227
 
308
- | Level | Behavior |
309
- |-------|----------|
310
- | **safe** | Auto-runs read-only work: `fs.read/list/search`, `tool.check`, `http.fetch` GET, `web.search`/`web.fetch`, recon commands. |
311
- | **confirm** | Asks first for mutations: file writes/edits, installs, moves, mutating shell commands. |
312
- | **block** | Refuses destructive patterns (`rm -rf /`, fork bombs, exfiltration signatures) and SSRF-prone fetches. |
228
+ Choose a terminal for the OS on your local device. These recommendations link to each terminal's official setup information:
313
229
 
314
- `fs.delete` always confirms (with an optional diff preview) even under allow-all. Use `/permissions` to choose the confirmation level and `/allow` / `/disallow` for a per-session tool allow-list.
230
+ | Local OS | Recommended terminal | Alternatives |
231
+ | --- | --- | --- |
232
+ | Linux | [Kitty](https://sw.kovidgoyal.net/kitty/binary/) | [WezTerm](https://wezterm.org/installation.html) or [Alacritty](https://alacritty.org/). |
233
+ | macOS | [iTerm2](https://iterm2.com/) | [Kitty](https://sw.kovidgoyal.net/kitty/binary/), [WezTerm](https://wezterm.org/installation.html), or [Alacritty](https://alacritty.org/); the built-in Terminal app is also an option. |
234
+ | Windows | [Windows Terminal](https://learn.microsoft.com/en-us/windows/terminal/) | [WezTerm](https://wezterm.org/installation.html) or [Alacritty](https://alacritty.org/). |
315
235
 
316
- ---
236
+ clai selects its interface using the OS where it runs. Native Windows uses Classic; WSL and SSH sessions on a Linux host use the Linux interface selection, even when the local window is Windows Terminal or iTerm2. Over SSH, key, mouse, and clipboard capabilities come from your local terminal and any intervening multiplexer.
317
237
 
318
- ## Terminal UI
238
+ Standard terminals can handle ordinary text input and output. Modified keys, mouse motion/hover, and clipboard integration vary by terminal and configuration. If `Shift+Enter` is not distinguishable from `Enter`, use `Ctrl+N` or `Alt+Enter` for a newline. Use `clai --classic` if OpenTUI cannot start, and `F5` or `/redraw` to repaint a scrambled screen.
319
239
 
320
- The interactive console provides streaming chat, nested tool cards, file diffs, a live plan pane, pickers, session history, and masked key prompts.
240
+ ### Keyboard shortcuts
321
241
 
322
- | Action | Key |
323
- |--------|-----|
324
- | Send / newline | `Enter` / `Shift+Enter` |
325
- | Abort turn (keeps results) | `Esc` |
326
- | Interrupt / quit | `Ctrl+C` (twice to quit) |
327
- | Cycle mode (ask→agent→plan) | `Shift+Tab` |
328
- | Plan pane / plan detail | `Ctrl+H` / `Ctrl+P` |
242
+ | Action | Shortcut |
243
+ | --- | --- |
244
+ | Send prompt | `Enter` |
245
+ | Insert newline | `Shift+Enter`, `Alt+Enter`, or `Ctrl+N` |
246
+ | Cancel current turn | `Esc` |
247
+ | Interrupt; press again to quit | `Ctrl+C` |
248
+ | Cycle mode | `Shift+Tab` |
249
+ | Toggle plan pane / details | `Ctrl+H` / `Ctrl+P` |
329
250
  | Background jobs | `Ctrl+J` |
330
251
  | Expand thinking / tool output | `Ctrl+T` / `Ctrl+O` |
331
- | Copy focused thinking block | `c` |
332
- | Search transcript | `Ctrl+R` |
333
- | Copy selection | `Ctrl+Shift+C` |
334
- | Commands / file mentions | `/` · `@` |
335
- | MCP servers / project config | `/mcp` |
336
- | Command help / shortcut reference | `Ctrl+G` / `/shortcuts` |
337
-
338
- - **Thinking blocks:** Clickable `✦ Thought for 3.2s` rows open internal reasoning in a scrollable card (`Ctrl+T`). Pressing `c` copies the reasoning text.
339
- - **Tool cards:** Show running commands with live elapsed timers, status indicators, and expandable output pagers (`Ctrl+O`) with search and copy capabilities. Large tool outputs spill to artifacts automatically, keeping the transcript and context window lean.
340
- - **File diffs:** Edits and writes render clean inline diff previews before changes take effect.
341
-
342
- ### Background sessions, minimise, and SSH reattach
343
-
344
- Interactive sessions run behind a local broker so an agent continues working across terminal disconnects:
345
-
346
- - **`/minimise`** (or `/minimize`) detaches immediately and returns you to your shell without interrupting the turn. It displays the session ID and resume command.
347
- - **SSH disconnects:** If an SSH session drops, reconnect and run `clai --resume <id>` (or `clai -c` to continue the latest session in the current directory).
348
- - **`/history`** lists all active, attached, and detached sessions.
349
-
350
- ---
351
-
352
- ## Slash commands
353
-
354
- | Command | Does |
355
- |---------|------|
356
- | `/ask` · `/agent` · `/plan [view]` | Switch mode (plan = design a plan you approve before anything runs; `view` pages the current plan) |
357
- | `/implement` · `/discard` | Approve and execute or drop the current plan |
358
- | `/model [name]` · `/models [filter]` | Select model · browse all models across providers |
359
- | `/provider [name]` | Switch provider or open picker |
360
- | `/set [provider]` · `/unset [provider]` · `/keys` | Manage API keys and view provider configuration |
361
- | `/info [provider]` | Setup, pricing, and endpoint details for a provider |
362
- | `/effort [level]` · `/reasoning [level]` | Configure thinking / reasoning effort |
363
- | `/freeonly [on\|off]` · `/fallback [on\|off]` | Free-only filter · cross-provider fallback |
364
- | `/orchestrator [...]` · `/subagents` | Control subagent delegation · inspect live subagents |
365
- | `/rtk [on\|off\|status\|install\|update]` | Compress shell output through [rtk](https://github.com/rtk-ai/rtk) (off by default) · install or update rtk |
366
- | `/skills [name\|list\|refresh]` | Manage Agent Skills |
367
- | `/search [provider]` · `/search-provider` | Choose web-search backend |
368
- | `/mcp [...]` | Browse, configure, start, or stop MCP servers |
369
- | `/scope [show\|add\|new\|clear]` | Manage engagement scope |
370
- | `/output [last\|id\|list]` | Open full tool output pager (also `Ctrl+O`) |
371
- | `/jobs` | View background jobs (also `Ctrl+J`) |
372
- | `/compact` · `/context` · `/usage` | Compact history · context size · token usage per provider/model |
373
- | `/history` · `/save <name>` · `/new` · `/clear` · `/reset` | Session lifecycle management |
374
- | `/allow <tool>` · `/disallow <tool>` · `/permissions` | Tool permission management |
375
- | `/cwd <path>` | Change working directory |
376
- | `/think` · `/thinking` | Show thinking from the last response |
377
- | `/privacy [...]` | Private mode · clear history, logs, or artifacts |
378
- | `/minimise` · `/minimize` | Detach terminal while the session runs in background |
379
- | `/update` · `/help` · `/shortcuts` · `/exit` | Utilities and exit |
380
-
381
- ---
382
-
383
- ## CLI commands
384
-
385
- ```sh
386
- clai [prompt...] # interactive UI, or one-shot with a prompt
387
- --mode <ask|agent|plan> --provider <p> --model <m>
388
- -y/--yes --no-history
389
- --show-thinking --verbose --quiet # one-shot stream controls
390
- --tui --classic
391
- --resume <sessionId> -c/--continue # reattach live or reopen saved session
392
-
393
- clai auth <provider> # OAuth sign-in: cline, chatgpt, copilot, kiro
394
- # --import · --browser · --headless
395
- clai set <provider> [key] # --from-env <VAR> | --stdin | --url <url> | --skip-ping
396
- clai unset <provider> [--url] # remove all keys (or endpoint URLs) for a provider
397
- clai keys # list providers with masked keys
398
- clai use <provider> # set active provider
399
- clai provider [provider] # switch provider or open picker
400
- clai model <model> # set model for the active provider
401
- clai mode <ask|agent|plan> # set default mode
402
- clai search-provider <brave|tavily|exa|duckduckgo>
403
- clai config [key] [value] # view or update configuration
404
- clai doctor # check installed tools + provider config
405
- clai history [--show <id>] # list saved sessions
406
- clai update # check for updates and upgrade
407
- clai authorize-pentest AGREE # enable scan/attack tools (one-time ack)
408
- clai scope <show|new|add|clear> # engagement scope management
409
- clai privacy <status|on|off|clear-all> # privacy and history clearing
410
- ```
411
-
412
- ---
413
-
414
- ## Model Context Protocol (MCP)
415
-
416
- `clai` can discover and call tools from local or remote MCP servers. MCP tools are **off by default**; they are activated when a prompt mentions `@mcp:<server>` or via `/mcp all`.
417
-
418
- ### Project configuration
419
-
420
- Define MCP servers in `.clai/mcp.json` (or standard `.vscode/mcp.json` / `.cursor/mcp.json` locations):
252
+ | Search transcript when focused | `Ctrl+R` |
253
+ | Repaint screen | `F5` or `/redraw` |
254
+ | Help / full shortcut reference | `Ctrl+G` / `/shortcuts` |
255
+
256
+ Type `/` for command suggestions and `@` for file mentions. Terminal support affects which modified key combinations are available; `/shortcuts` lists bindings by context.
257
+
258
+ ## Commands
259
+
260
+ Run `clai --help` for CLI flags and `clai <command> --help` for a subcommand. In the interactive console, `/help` lists slash commands.
261
+
262
+ | Slash command | Purpose |
263
+ | --- | --- |
264
+ | `/ask`, `/agent`, `/plan` | Switch working mode. |
265
+ | `/view-plan`, `/implement`, `/discard` | Review, execute, or discard a plan. |
266
+ | `/provider [name]`, `/model [name]`, `/models [filter]` | Select providers and models. |
267
+ | `/set [provider]`, `/unset [provider]`, `/keys`, `/info [provider]` | Configure credentials and inspect provider setup. |
268
+ | `/effort [level]`, `/reasoning [level]` | Set reasoning effort or open its picker. |
269
+ | `/fallback [on\|off]`, `/freeonly [on\|off]` | Configure fallback. |
270
+ | `/orchestrator`, `/subagents` | Manage delegation and inspect subagents. |
271
+ | `/rtk [on\|off\|status\|install\|update]` | Manage shell output compression. |
272
+ | `/skills [name\|list\|refresh]`, `/mcp` | Manage skills and MCP servers. |
273
+ | `/search [provider]`, `/search-provider` | Select the web-search backend. |
274
+ | `/scope [show\|new\|add\|clear]` | Configure this session's engagement scope. |
275
+ | `/jobs`, `/output [last\|id\|list]` | Inspect jobs and tool output. |
276
+ | `/compact`, `/context`, `/usage` | Manage context and inspect usage. |
277
+ | `/history`, `/save <name>`, `/new`, `/prompts` | Browse, name, create, and inspect sessions. |
278
+ | `/clear`, `/reset` | Delete the current session or all saved history. |
279
+ | `/allow <tool>`, `/disallow <tool>`, `/permissions` | Configure tool permissions. |
280
+ | `/cwd <path>` | Change the working directory. |
281
+ | `/think`, `/thinking` | Show the last response's thinking. |
282
+ | `/privacy` | Manage private mode and clear retained data. |
283
+ | `/minimise`, `/minimize`, `/minmize` | Detach this terminal. |
284
+ | `/redraw`, `/refresh` | Repaint the screen. |
285
+ | `/update`, `/help`, `/shortcuts`, `/exit`, `/quit` | Updates, help, and exit. |
286
+
287
+ Useful CLI flags:
288
+
289
+ | Flag | Purpose |
290
+ | --- | --- |
291
+ | `--mode <ask\|agent\|plan>` | Set the mode for this invocation. |
292
+ | `--provider <id>`, `--model <name>` | Override the configured provider or model. |
293
+ | `--resume [id]`, `-c`, `--continue` | Resume an interactive session. |
294
+ | `--classic`, `--tui`, `--ui <classic\|tui>` | Select the interactive interface. |
295
+ | `--no-history` | Disable history persistence for this invocation. |
296
+ | `-y`, `--yes` | Auto-confirm eligible tool actions in a one-shot agent run. |
297
+ | `--quiet`, `--verbose`, `--show-thinking` | Control one-shot answer, tool output, and reasoning display. |
298
+
299
+ ## Project context, skills, and MCP
300
+
301
+ Place project notes in `.clai/context.md` in the working directory to supply architecture, conventions, or testing context. Project skills live under `.clai/skills/` as `SKILL.md` playbooks; `/skills list` shows discovered skills and `/skills refresh` rescans them.
302
+
303
+ MCP servers can expose local or remote tools. Tools are disabled by default; activate a server with an `@mcp:<server>` prompt mention or enable all configured servers with `/mcp all`. `/mcp` also supports configuration, connection status, authentication, and logs.
304
+
305
+ Example `.clai/mcp.json`:
421
306
 
422
307
  ```json
423
308
  {
@@ -425,129 +310,35 @@ Define MCP servers in `.clai/mcp.json` (or standard `.vscode/mcp.json` / `.curso
425
310
  "local": {
426
311
  "command": "my-mcp-server",
427
312
  "args": ["--root", "${workspaceFolder}"],
428
- "env": {
429
- "MCP_TOKEN": "${env:MCP_TOKEN}"
430
- }
313
+ "env": { "MCP_TOKEN": "${env:MCP_TOKEN}" }
431
314
  },
432
315
  "remote": {
433
316
  "url": "https://mcp.example.com/mcp",
434
- "headers": {
435
- "Authorization": "Bearer ${env:MCP_TOKEN}"
436
- }
317
+ "headers": { "Authorization": "Bearer ${env:MCP_TOKEN}" }
437
318
  }
438
319
  }
439
320
  }
440
321
  ```
441
322
 
442
- Use `/mcp` inside the interactive console to browse servers, inspect available tools, view logs, restart connections, or add new servers interactively.
443
-
444
- ---
445
-
446
- ## Built-in tools
447
-
448
- | Group | Tools |
449
- |-------|-------|
450
- | **Files** | `fs.read` · `fs.list` · `fs.search` · `fs.write` · `fs.writeMany` · `fs.edit` · `fs.replaceLines` · `fs.append` · `fs.delete` |
451
- | **Shell & jobs** | `shell.exec` (servers: `background:"always"` + `name`) · `shell.jobs` · `shell.tail` · `shell.wait` · `shell.stop` |
452
- | **Terminals** | `terminal.start` · `terminal.send` · `terminal.read` · `terminal.status` · `terminal.close` |
453
- | **Network** | `tool.check` (with the install command for this OS) · `net.pingSweep` · `wordlist.find` (pentest sessions; plus `nmap`, `ffuf`, etc. via shell) |
454
- | **HTTP / web** | `http.fetch` (raw evidence) · `web.search` · `web.fetch` (readable) |
455
- | **Orchestration** | `subagent.start` · `subagent.list` · `subagent.wait` · `subagent.read` · `subagent.stop` — independent read-only tool calls in one response run in parallel |
456
- | **Plan** | `plan.create` · `plan.clear` · `task.add` · `task.update` · `task.move` · `agent.handoff` |
457
- | **MCP** | `mcp.list` · `mcp.tools` · `mcp.call` · `mcp.enable` · `mcp.connect` · `mcp.login` · `mcp.add` |
458
- | **Context** | `image.ocr` · `image.view` · `pdf.read` · `skill.load` — OS, shell, and cwd arrive with every request |
459
-
460
- ---
461
-
462
- ## Web search / OSINT
463
-
464
- | Provider | Key | Environment Variable |
465
- |----------|-----|----------------------|
466
- | **DuckDuckGo** | None (default) | — |
467
- | **Brave** | Required | `BRAVE_SEARCH_API_KEY` |
468
- | **Tavily** | Required | `TAVILY_API_KEY` |
469
- | **Exa** | Required | `EXA_API_KEY` |
470
-
471
- ```sh
472
- clai set brave bsx-...
473
- clai set tavily tvly-...
474
- clai search-provider tavily
475
- ```
476
-
477
- ---
478
-
479
- ## Per-project context
480
-
481
- Drop a `.clai/context.md` in any project root, and its content is injected automatically on every turn — repo architecture, stack conventions, testing instructions, or scope rules. Project-level Agent Skills live alongside it under `.clai/skills/`.
482
-
483
- ---
484
-
485
- ## Interactive REPLs and terminals
486
-
487
- When a task requires multi-step interactive terminal interactions, `clai` maintains a persistent terminal session attached to the conversation:
488
-
489
- ```text
490
- Start a Python REPL, test the regular expression against our test cases, and show me the output.
491
- ```
492
-
493
- The agent runs interactive commands in persistent PTY sessions, reads incremental output, sends follow-up commands, and safely terminates processes upon completion.
494
-
495
- ---
323
+ ## Configuration and privacy
496
324
 
497
- ## Configuration & privacy
325
+ `clai config` prints the configuration and its location. Use `clai mode`, `clai model`, and `clai use` to change defaults. History, prompt journals, logs, and runtime data normally live under `~/.clai/`; saved chat records include `history.jsonl`. Large outputs may also use per-session temporary directories.
498
326
 
499
327
  ```sh
500
- clai config # view current config
501
- clai mode agent # set default mode
502
- clai model <name> # set default model
503
- /privacy on # private mode: don't persist this session
504
- /privacy clear-all # wipe history, logs, and artifacts
328
+ clai privacy status
329
+ clai privacy on
330
+ clai privacy off
331
+ clai privacy retention 0
505
332
  ```
506
333
 
507
- Config is stored locally in your OS user directory (e.g. `~/.config/clai/`). Keys are stored locally and never exposed in plain text.
508
-
509
- ---
510
-
511
- ## Development
334
+ Private mode disables chat and prompt persistence and durable background attachment; `--no-history` applies to a single invocation. Retention defaults to `0` (unlimited saved sessions). These settings do not erase previously saved data. `clai privacy clear-history`, `clear-logs`, `clear-artifacts`, and `clear-all` explicitly delete retained data; the corresponding `/privacy` actions are available in the UI.
512
335
 
513
- ```sh
514
- npm install
515
- npm run dev # run from source
516
- npm run typecheck
517
- npm run build
518
- npm test # full test suite
519
- npm run compile # compile native binaries with Bun
520
- ```
521
-
522
- ---
523
-
524
- ## Architecture
525
-
526
- ```
527
- clai/
528
- ├─ src/
529
- │ ├─ index.ts # CLI entry + subcommands
530
- │ ├─ agent/ # loop, plans, compaction, resume orientation, tool parsing
531
- │ ├─ llm/ # providers, OAuth auth flows, streaming, key rotation + fallback
532
- │ ├─ mcp/ # discovery, validation, transports, lifecycle, and tool dispatch
533
- │ ├─ tools/ # fs, shell, terminal, net, http, web, batch, plan, subagents
534
- │ ├─ skills/ # Agent Skills discovery, catalog, and on-demand loading
535
- │ ├─ safety/ # risk classifier + engagement (scope) policy
536
- │ ├─ store/ # config, history, keys, plans, scope
537
- │ ├─ ui-core/ # renderer-neutral state, actions, layout, rendering, and ports
538
- │ ├─ classic/ # React + Ink classic UI and POSIX terminal bootstrap
539
- │ ├─ tui-v2/ # OpenTUI full-screen renderer
540
- │ ├─ noninteractive/ # stdout/stderr-split one-shot stream renderer
541
- │ ├─ app/ # session controllers, commands, events, and ports
542
- │ └─ prompts/ # agent methodology (embedded for the compiled binary)
543
- ├─ install/ · manifests/
544
- └─ package.json
545
- ```
336
+ Credentials saved with `clai set` or account sign-in are retained in `~/.clai/keys.json`, a **plaintext** file with restricted permissions (`0600` on POSIX). clai also attempts to store them in the OS keyring when available; the local file is retained for recovery. Recognized secrets are masked or redacted in supported displays and storage paths, but review logs and transcripts before sharing them.
546
337
 
547
- ---
338
+ Cloud requests send the model's context and relevant tool results to the selected provider. Provider-specific metadata uploads, including OmniRush's optional lifecycle upload, are described in the [provider guide](PROVIDERS.md#omnirush-lifecycle-uploads).
548
339
 
549
- ## License
340
+ ## Development and support
550
341
 
551
- MIT.
342
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for source setup, architecture boundaries, and the CI checks. Report reproducible bugs through [GitHub Issues](https://github.com/pentoshi007/clai/issues), and use [Discussions](https://github.com/pentoshi007/clai/discussions) for questions. Follow [SECURITY.md](SECURITY.md) for vulnerability reporting and the [Code of Conduct](CODE_OF_CONDUCT.md) when participating.
552
343
 
553
- **Use only on systems you are authorized to test.** clai is an operator's tool: authorization, scope, and impact are yours. The agent executes with the gates and confirmations you configure — nothing more.
344
+ Licensed under the [MIT License](LICENSE).