raga-cli 0.0.0-stage → 0.8.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 (478) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/LICENSE +21 -0
  3. package/README.md +139 -2
  4. package/bundled-skills/AGENTS.md +5 -0
  5. package/bundled-skills/README.md +25 -0
  6. package/bundled-skills/agents/comment-sicko.json +9 -0
  7. package/bundled-skills/agents/comment-sicko.md +28 -0
  8. package/bundled-skills/agents/model-roles.json +41 -0
  9. package/bundled-skills/agents/poteto-agent.json +9 -0
  10. package/bundled-skills/agents/poteto-agent.md +4 -0
  11. package/bundled-skills/agents/worker.json +8 -0
  12. package/bundled-skills/agents/worker.md +1 -0
  13. package/bundled-skills/bundle.json +1448 -0
  14. package/bundled-skills/dependencies.json +40 -0
  15. package/bundled-skills/docs/guide/01-setup.md +3 -0
  16. package/bundled-skills/docs/guide/02-peak.md +135 -0
  17. package/bundled-skills/docs/guide/03-understand.md +79 -0
  18. package/bundled-skills/docs/guide/04-design.md +133 -0
  19. package/bundled-skills/docs/guide/05-build-and-clean.md +83 -0
  20. package/bundled-skills/docs/guide/06-verify-and-ship.md +166 -0
  21. package/bundled-skills/docs/guide/07-overnight.md +118 -0
  22. package/bundled-skills/docs/guide/08-principles.md +72 -0
  23. package/bundled-skills/docs/guide/09-make-it-yours.md +96 -0
  24. package/bundled-skills/docs/guide/10-recipes-and-pitfalls.md +180 -0
  25. package/bundled-skills/docs/guide/README.md +38 -0
  26. package/bundled-skills/docs/guide/images/design.jpg +0 -0
  27. package/bundled-skills/docs/guide/images/overnight.jpg +0 -0
  28. package/bundled-skills/docs/guide/images/recipes.jpg +0 -0
  29. package/bundled-skills/docs/guide/images/router.jpg +0 -0
  30. package/bundled-skills/docs/guide/images/understanding.jpg +0 -0
  31. package/bundled-skills/docs/guide/images/verification.jpg +0 -0
  32. package/bundled-skills/licenses/commander +22 -0
  33. package/bundled-skills/licenses/cursor-team-kit +21 -0
  34. package/bundled-skills/licenses/no-mistakes +21 -0
  35. package/bundled-skills/licenses/pstack +21 -0
  36. package/bundled-skills/skills/peak/SKILL.md +184 -0
  37. package/bundled-skills/skills/peak/playbooks/authoring-a-skill.md +12 -0
  38. package/bundled-skills/skills/peak/playbooks/autonomous-run.md +13 -0
  39. package/bundled-skills/skills/peak/playbooks/autopilot-full.md +25 -0
  40. package/bundled-skills/skills/peak/playbooks/autopilot-stack.md +12 -0
  41. package/bundled-skills/skills/peak/playbooks/babysit.md +18 -0
  42. package/bundled-skills/skills/peak/playbooks/bug-fix.md +15 -0
  43. package/bundled-skills/skills/peak/playbooks/eval.md +25 -0
  44. package/bundled-skills/skills/peak/playbooks/feature.md +21 -0
  45. package/bundled-skills/skills/peak/playbooks/hillclimb.md +21 -0
  46. package/bundled-skills/skills/peak/playbooks/investigation.md +14 -0
  47. package/bundled-skills/skills/peak/playbooks/multi-phase-plan.md +155 -0
  48. package/bundled-skills/skills/peak/playbooks/opening-a-pr.md +34 -0
  49. package/bundled-skills/skills/peak/playbooks/orchestrate.md +112 -0
  50. package/bundled-skills/skills/peak/playbooks/pause-safely.md +10 -0
  51. package/bundled-skills/skills/peak/playbooks/perf-issue.md +25 -0
  52. package/bundled-skills/skills/peak/playbooks/prototype.md +14 -0
  53. package/bundled-skills/skills/peak/playbooks/refactoring.md +16 -0
  54. package/bundled-skills/skills/peak/playbooks/runtime-forensics.md +11 -0
  55. package/bundled-skills/skills/peak/playbooks/session-pickup.md +11 -0
  56. package/bundled-skills/skills/peak/playbooks/shipping.md +12 -0
  57. package/bundled-skills/skills/peak/playbooks/trace-forensics.md +14 -0
  58. package/bundled-skills/skills/peak/playbooks/visual-parity.md +11 -0
  59. package/bundled-skills/skills/peak/playbooks/worktree-cleanup.md +6 -0
  60. package/bundled-skills/skills/peak/references/architect/SKILL.md +81 -0
  61. package/bundled-skills/skills/peak/references/architect/references/design-red-flags.md +57 -0
  62. package/bundled-skills/skills/peak/references/architect/references/rationale-template.md +35 -0
  63. package/bundled-skills/skills/peak/references/architect/references/runner-prompt.md +20 -0
  64. package/bundled-skills/skills/peak/references/arena/SKILL.md +50 -0
  65. package/bundled-skills/skills/peak/references/automate-me/SKILL.md +106 -0
  66. package/bundled-skills/skills/peak/references/benchmark-checklist/SKILL.md +41 -0
  67. package/bundled-skills/skills/peak/references/blast-radius/SKILL.md +52 -0
  68. package/bundled-skills/skills/peak/references/bro/SKILL.md +9 -0
  69. package/bundled-skills/skills/peak/references/control-cli/SKILL.md +111 -0
  70. package/bundled-skills/skills/peak/references/control-ui/SKILL.md +111 -0
  71. package/bundled-skills/skills/peak/references/correct/SKILL.md +34 -0
  72. package/bundled-skills/skills/peak/references/create-formal-verification-skill/SKILL.md +43 -0
  73. package/bundled-skills/skills/peak/references/create-skill/SKILL.md +14 -0
  74. package/bundled-skills/skills/peak/references/create-verification-skill/SKILL.md +46 -0
  75. package/bundled-skills/skills/peak/references/create-verification-skill/references/feature-map-example/README.md +47 -0
  76. package/bundled-skills/skills/peak/references/create-verification-skill/references/feature-map-example/create-note.md +39 -0
  77. package/bundled-skills/skills/peak/references/create-verification-skill/references/feature-map-example/search.md +45 -0
  78. package/bundled-skills/skills/peak/references/deslop/SKILL.md +24 -0
  79. package/bundled-skills/skills/peak/references/figure-it-out/SKILL.md +54 -0
  80. package/bundled-skills/skills/peak/references/how/SKILL.md +38 -0
  81. package/bundled-skills/skills/peak/references/how/references/explainer-prompt.md +55 -0
  82. package/bundled-skills/skills/peak/references/how/references/explorer-prompt.md +35 -0
  83. package/bundled-skills/skills/peak/references/in-your-own-words/SKILL.md +9 -0
  84. package/bundled-skills/skills/peak/references/interrogate/SKILL.md +76 -0
  85. package/bundled-skills/skills/peak/references/interrogate/references/code-quality-review.md +47 -0
  86. package/bundled-skills/skills/peak/references/interrogate/references/lead-judgment.md +39 -0
  87. package/bundled-skills/skills/peak/references/interrogate/references/reviewer-prompt.md +62 -0
  88. package/bundled-skills/skills/peak/references/interrogate/references/rubric.md +77 -0
  89. package/bundled-skills/skills/peak/references/ketchup/SKILL.md +45 -0
  90. package/bundled-skills/skills/peak/references/maintain-formal-verification-skill/SKILL.md +60 -0
  91. package/bundled-skills/skills/peak/references/maintain-verification-skill/SKILL.md +41 -0
  92. package/bundled-skills/skills/peak/references/no-comments/SKILL.md +26 -0
  93. package/bundled-skills/skills/peak/references/no-mistakes/SKILL.md +20 -0
  94. package/bundled-skills/skills/peak/references/no-mistakes/upstream/SKILL.md +394 -0
  95. package/bundled-skills/skills/peak/references/peak-setup/SKILL.md +18 -0
  96. package/bundled-skills/skills/peak/references/poteto-help/SKILL.md +16 -0
  97. package/bundled-skills/skills/peak/references/poteto-help/references/prompting.md +51 -0
  98. package/bundled-skills/skills/peak/references/poteto-help/references/recipes.md +51 -0
  99. package/bundled-skills/skills/peak/references/principle-attack-the-premise/SKILL.md +23 -0
  100. package/bundled-skills/skills/peak/references/principle-boundary-discipline/SKILL.md +36 -0
  101. package/bundled-skills/skills/peak/references/principle-build-the-lever/SKILL.md +25 -0
  102. package/bundled-skills/skills/peak/references/principle-encode-lessons-in-structure/SKILL.md +13 -0
  103. package/bundled-skills/skills/peak/references/principle-exhaust-the-design-space/SKILL.md +11 -0
  104. package/bundled-skills/skills/peak/references/principle-experience-first/SKILL.md +21 -0
  105. package/bundled-skills/skills/peak/references/principle-explain-the-number/SKILL.md +19 -0
  106. package/bundled-skills/skills/peak/references/principle-fix-root-causes/SKILL.md +23 -0
  107. package/bundled-skills/skills/peak/references/principle-foundational-thinking/SKILL.md +23 -0
  108. package/bundled-skills/skills/peak/references/principle-guard-the-context-window/SKILL.md +14 -0
  109. package/bundled-skills/skills/peak/references/principle-laziness-protocol/SKILL.md +12 -0
  110. package/bundled-skills/skills/peak/references/principle-make-operations-idempotent/SKILL.md +24 -0
  111. package/bundled-skills/skills/peak/references/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +16 -0
  112. package/bundled-skills/skills/peak/references/principle-minimize-reader-load/SKILL.md +20 -0
  113. package/bundled-skills/skills/peak/references/principle-model-the-domain/SKILL.md +26 -0
  114. package/bundled-skills/skills/peak/references/principle-never-block-on-the-human/SKILL.md +17 -0
  115. package/bundled-skills/skills/peak/references/principle-outcome-oriented-execution/SKILL.md +23 -0
  116. package/bundled-skills/skills/peak/references/principle-prove-it-works/SKILL.md +24 -0
  117. package/bundled-skills/skills/peak/references/principle-redesign-from-first-principles/SKILL.md +18 -0
  118. package/bundled-skills/skills/peak/references/principle-separate-before-serializing-shared-state/SKILL.md +18 -0
  119. package/bundled-skills/skills/peak/references/principle-sequence-verifiable-units/SKILL.md +19 -0
  120. package/bundled-skills/skills/peak/references/principle-subtract-before-you-add/SKILL.md +20 -0
  121. package/bundled-skills/skills/peak/references/principle-test-behavior-not-implementation/SKILL.md +22 -0
  122. package/bundled-skills/skills/peak/references/principle-type-system-discipline/SKILL.md +15 -0
  123. package/bundled-skills/skills/peak/references/raga-runtime/SKILL.md +37 -0
  124. package/bundled-skills/skills/peak/references/raga-runtime/managed-tools.mjs +34 -0
  125. package/bundled-skills/skills/peak/references/raga-runtime/raga_runtime.py +44 -0
  126. package/bundled-skills/skills/peak/references/recall/SKILL.md +37 -0
  127. package/bundled-skills/skills/peak/references/reflect/SKILL.md +63 -0
  128. package/bundled-skills/skills/peak/references/reflect/references/divergent-reviewer.md +38 -0
  129. package/bundled-skills/skills/peak/references/reflect/references/judgment-reviewer.md +37 -0
  130. package/bundled-skills/skills/peak/references/reflect/references/synthesizer.md +56 -0
  131. package/bundled-skills/skills/peak/references/reflect/references/tooling-reviewer.md +48 -0
  132. package/bundled-skills/skills/peak/references/reviewer-triage.md +142 -0
  133. package/bundled-skills/skills/peak/references/sharpen/SKILL.md +18 -0
  134. package/bundled-skills/skills/peak/references/show-me-your-work/SKILL.md +84 -0
  135. package/bundled-skills/skills/peak/references/show-me-your-work/references/decision-log-template.tsv +1 -0
  136. package/bundled-skills/skills/peak/references/show-me-your-work/scripts/log.sh +42 -0
  137. package/bundled-skills/skills/peak/references/statechart/SKILL.md +38 -0
  138. package/bundled-skills/skills/peak/references/statechart/scripts/chart-to-tla.mjs +236 -0
  139. package/bundled-skills/skills/peak/references/statechart/scripts/compare-charts.mjs +104 -0
  140. package/bundled-skills/skills/peak/references/statechart/scripts/lib.mjs +725 -0
  141. package/bundled-skills/skills/peak/references/statechart/scripts/model/OutputFolder.cfg +6 -0
  142. package/bundled-skills/skills/peak/references/statechart/scripts/model/OutputFolder.map.mjs +106 -0
  143. package/bundled-skills/skills/peak/references/statechart/scripts/model/OutputFolder.tla +176 -0
  144. package/bundled-skills/skills/peak/references/statechart/scripts/statechart.mjs +749 -0
  145. package/bundled-skills/skills/peak/references/statechart/scripts/test/statechart.test.mjs +2790 -0
  146. package/bundled-skills/skills/peak/references/statechart/scripts/test/sync.mmd +19 -0
  147. package/bundled-skills/skills/peak/references/statechart/scripts/test/upload.mmd +16 -0
  148. package/bundled-skills/skills/peak/references/statechart/scripts/tlc-to-chart.mjs +1347 -0
  149. package/bundled-skills/skills/peak/references/swarm/SKILL.md +43 -0
  150. package/bundled-skills/skills/peak/references/tdd/SKILL.md +44 -0
  151. package/bundled-skills/skills/peak/references/teach/SKILL.md +23 -0
  152. package/bundled-skills/skills/peak/references/technical-writing/SKILL.md +108 -0
  153. package/bundled-skills/skills/peak/references/typescript-best-practices/SKILL.md +33 -0
  154. package/bundled-skills/skills/peak/references/typescript-best-practices/references/patterns.md +328 -0
  155. package/bundled-skills/skills/peak/references/unslop/SKILL.md +64 -0
  156. package/bundled-skills/skills/peak/references/verify-this/SKILL.md +76 -0
  157. package/bundled-skills/skills/peak/references/why/SKILL.md +100 -0
  158. package/bundled-skills/skills/peak/references/why/references/epistemics.md +71 -0
  159. package/bundled-skills/skills/peak/references/why/references/investigator-prompt.md +84 -0
  160. package/bundled-skills/skills/peak/references/why/references/source-playbook.md +17 -0
  161. package/bundled-skills/skills/peak/references/why/references/sources/code-archaeology.md +51 -0
  162. package/bundled-skills/skills/peak/references/why/references/sources/databricks.md +70 -0
  163. package/bundled-skills/skills/peak/references/why/references/sources/datadog.md +97 -0
  164. package/bundled-skills/skills/peak/references/why/references/sources/incident-postmortem.md +5 -0
  165. package/bundled-skills/skills/peak/references/why/references/sources/linear.md +48 -0
  166. package/bundled-skills/skills/peak/references/why/references/sources/notion.md +55 -0
  167. package/bundled-skills/skills/peak/references/why/references/sources/sentry.md +66 -0
  168. package/bundled-skills/skills/peak/references/why/references/sources/slack.md +17 -0
  169. package/bundled-skills/skills/peak/references/why/references/synthesizer-prompt.md +129 -0
  170. package/bundled-skills/skills/peak/scripts/check-plan.mjs +205 -0
  171. package/bundled-skills/skills/peak/scripts/check-plan.test.ts +96 -0
  172. package/bundled-skills/skills/peak/scripts/orch/orch.test.ts +761 -0
  173. package/bundled-skills/skills/peak/scripts/orch/orch.ts +588 -0
  174. package/bundled-skills/skills/peak/scripts/orch/store.ts +1676 -0
  175. package/bundled-skills/skills/peak/scripts/vendor/commander/LICENSE +22 -0
  176. package/bundled-skills/skills/peak/scripts/vendor/commander/esm.mjs +16 -0
  177. package/bundled-skills/skills/peak/scripts/vendor/commander/index.js +24 -0
  178. package/bundled-skills/skills/peak/scripts/vendor/commander/lib/argument.js +149 -0
  179. package/bundled-skills/skills/peak/scripts/vendor/commander/lib/command.js +2778 -0
  180. package/bundled-skills/skills/peak/scripts/vendor/commander/lib/error.js +39 -0
  181. package/bundled-skills/skills/peak/scripts/vendor/commander/lib/help.js +747 -0
  182. package/bundled-skills/skills/peak/scripts/vendor/commander/lib/option.js +379 -0
  183. package/bundled-skills/skills/peak/scripts/vendor/commander/lib/suggestSimilar.js +101 -0
  184. package/bundled-skills/skills/peak/scripts/vendor/commander/package.json +1 -0
  185. package/bundled-skills/skills/peak/scripts/vendor/commander/typings/esm.d.mts +3 -0
  186. package/bundled-skills/skills/peak/scripts/vendor/commander/typings/index.d.ts +1113 -0
  187. package/bundled-skills/skills/peak/scripts/watch-pr/cli.test.ts +224 -0
  188. package/bundled-skills/skills/peak/scripts/watch-pr/cli.ts +223 -0
  189. package/bundled-skills/skills/peak/scripts/watch-pr/fakes.test-helper.ts +129 -0
  190. package/bundled-skills/skills/peak/scripts/watch-pr/github.test.ts +436 -0
  191. package/bundled-skills/skills/peak/scripts/watch-pr/github.ts +718 -0
  192. package/bundled-skills/skills/peak/scripts/watch-pr/policy.test.ts +420 -0
  193. package/bundled-skills/skills/peak/scripts/watch-pr/policy.ts +836 -0
  194. package/bundled-skills/skills/peak/scripts/watch-pr/render.ts +169 -0
  195. package/bundled-skills/skills/peak/scripts/watch-pr/tsconfig.json +13 -0
  196. package/bundled-skills/skills/peak/scripts/watch-pr/types.compile.ts +93 -0
  197. package/bundled-skills/skills/peak/scripts/watch-pr/types.ts +413 -0
  198. package/bundled-skills/skills/peak/scripts/watch-pr/watch-pr +4 -0
  199. package/bundled-skills/skills/peak/scripts/worktree-audit.sh +4 -0
  200. package/dist/bundle/chunks/anthropic-messages-BMDYDGHW.js +6 -0
  201. package/dist/bundle/chunks/anthropic.js +75 -0
  202. package/dist/bundle/chunks/azure-openai-responses-Q7EZTEHK.js +2 -0
  203. package/dist/bundle/chunks/bedrock-converse-stream.js +86 -0
  204. package/dist/bundle/chunks/chunk-3EGDWOKT.js +2 -0
  205. package/dist/bundle/chunks/chunk-3V45WARH.js +7 -0
  206. package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
  207. package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  208. package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
  209. package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
  210. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  211. package/dist/bundle/chunks/chunk-AI2NMHE7.js +1567 -0
  212. package/dist/bundle/chunks/chunk-C4IJNE7U.js +2 -0
  213. package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
  214. package/dist/bundle/chunks/chunk-G54UBZTF.js +44 -0
  215. package/dist/bundle/chunks/chunk-H76KZMOI.js +2 -0
  216. package/dist/bundle/chunks/chunk-IOPE2TJ4.js +131 -0
  217. package/dist/bundle/chunks/chunk-IXDQLPKS.js +11 -0
  218. package/dist/bundle/chunks/chunk-J22MF7YW.js +64 -0
  219. package/dist/bundle/chunks/chunk-JLV25LHE.js +2 -0
  220. package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
  221. package/dist/bundle/chunks/chunk-KNY3PXQI.js +2 -0
  222. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  223. package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  224. package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
  225. package/dist/bundle/chunks/chunk-LX24DVQ5.js +2 -0
  226. package/dist/bundle/chunks/chunk-P2QCWBFM.js +9 -0
  227. package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
  228. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  229. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  230. package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
  231. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  232. package/dist/bundle/chunks/chunk-Q4U25BSY.js +2 -0
  233. package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  234. package/dist/bundle/chunks/chunk-RFPFZTK2.js +7 -0
  235. package/dist/bundle/chunks/chunk-RP2WKNT7.js +4 -0
  236. package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
  237. package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
  238. package/dist/bundle/chunks/chunk-UDT647VB.js +82 -0
  239. package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
  240. package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  241. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  242. package/dist/bundle/chunks/chunk-WJGLPWUE.js +16 -0
  243. package/dist/bundle/chunks/chunk-YMZUNB25.js +2 -0
  244. package/dist/bundle/chunks/cli-4P6FVVLT.js +51 -0
  245. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-S6CT2FXS.js +2 -0
  246. package/dist/bundle/chunks/codemode-worker.js +478 -0
  247. package/dist/bundle/chunks/easter-egg-3d-65VIC4G2.js +2 -0
  248. package/dist/bundle/chunks/execute-3H5WKMA3.js +505 -0
  249. package/dist/bundle/chunks/github-copilot.js +2 -0
  250. package/dist/bundle/chunks/google-generative-ai-35NZKG6S.js +2 -0
  251. package/dist/bundle/chunks/google-vertex-P33AHYYX.js +2 -0
  252. package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
  253. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  254. package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
  255. package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
  256. package/dist/bundle/chunks/kimi-coding.js +2 -0
  257. package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
  258. package/dist/bundle/chunks/llama-cpp-classify-U4EH6TAM.js +22 -0
  259. package/dist/bundle/chunks/meta.js +2 -0
  260. package/dist/bundle/chunks/mistral-conversations-J62DPS2P.js +5 -0
  261. package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
  262. package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
  263. package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
  264. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  265. package/dist/bundle/chunks/openai-codex-responses-4HXATL2M.js +10 -0
  266. package/dist/bundle/chunks/openai-codex.js +75 -0
  267. package/dist/bundle/chunks/openai-completions-75YYY35N.js +7 -0
  268. package/dist/bundle/chunks/openai-decisions-HEBEVGA2.js +5 -0
  269. package/dist/bundle/chunks/openai-responses-UWNAKTBV.js +4 -0
  270. package/dist/bundle/chunks/openrouter-images-HVOPXKHS.js +2 -0
  271. package/dist/bundle/chunks/openrouter.js +75 -0
  272. package/dist/bundle/chunks/pi-messages-DG7CALOV.js +8 -0
  273. package/dist/bundle/chunks/radius.js +75 -0
  274. package/dist/bundle/chunks/runtime-435R6IKY.js +2 -0
  275. package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
  276. package/dist/bundle/chunks/typesafe-system-one-24HEGHNN.js +2 -0
  277. package/dist/bundle/chunks/virtual-modules-U3JBUDP7.js +2 -0
  278. package/dist/bundle/chunks/xai.js +2 -0
  279. package/dist/bundle/cli-runtime.js +3 -0
  280. package/dist/bundle/cli.js +5 -0
  281. package/dist/bundle/index.js +2 -0
  282. package/dist/bundle/raga-runtime.js +3 -0
  283. package/dist/bundle/raga.js +5 -0
  284. package/dist/bundle/rpc-entry.js +3 -0
  285. package/dist/core/export-html/template.css +1085 -0
  286. package/dist/core/export-html/template.html +56 -0
  287. package/dist/core/export-html/template.js +2044 -0
  288. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  289. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  290. package/dist/core/export-html/vendor/marked.min.js +79 -0
  291. package/dist/modes/interactive/assets/clankolas.png +0 -0
  292. package/dist/modes/interactive/theme/dark.json +78 -0
  293. package/dist/modes/interactive/theme/light.json +78 -0
  294. package/docs/cli-integration.md +106 -0
  295. package/docs/cli.md +337 -0
  296. package/docs/codemode.md +230 -0
  297. package/docs/compaction.md +463 -0
  298. package/docs/configuration.md +62 -0
  299. package/docs/containerization.md +183 -0
  300. package/docs/custom-provider.md +227 -0
  301. package/docs/docs.json +220 -0
  302. package/docs/environment-variables.md +101 -0
  303. package/docs/extensions.md +400 -0
  304. package/docs/how-pi-works.md +49 -0
  305. package/docs/images/doom-extension.png +0 -0
  306. package/docs/images/exy.png +0 -0
  307. package/docs/images/interactive-mode.png +0 -0
  308. package/docs/images/tree-view.png +0 -0
  309. package/docs/index.md +39 -0
  310. package/docs/json.md +226 -0
  311. package/docs/keybindings.md +195 -0
  312. package/docs/llama-cpp.md +121 -0
  313. package/docs/mcp.md +272 -0
  314. package/docs/message-types.md +279 -0
  315. package/docs/models-configuration.md +196 -0
  316. package/docs/models.md +225 -0
  317. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  318. package/docs/packages.md +129 -0
  319. package/docs/prompt-templates.md +59 -0
  320. package/docs/providers.md +247 -0
  321. package/docs/quickstart.md +136 -0
  322. package/docs/rpc-commands.md +860 -0
  323. package/docs/rpc-extension-ui.md +200 -0
  324. package/docs/rpc.md +193 -0
  325. package/docs/sdk.md +148 -0
  326. package/docs/security.md +99 -0
  327. package/docs/session-format.md +293 -0
  328. package/docs/sessions.md +66 -0
  329. package/docs/settings.md +184 -0
  330. package/docs/shell-aliases.md +93 -0
  331. package/docs/skills.md +93 -0
  332. package/docs/slash-commands.md +61 -0
  333. package/docs/terminal-setup.md +233 -0
  334. package/docs/termux.md +117 -0
  335. package/docs/themes.md +138 -0
  336. package/docs/tmux.md +55 -0
  337. package/docs/tui.md +195 -0
  338. package/docs/usage.md +94 -0
  339. package/docs/virtual-models.md +114 -0
  340. package/docs/windows.md +81 -0
  341. package/examples/README.md +36 -0
  342. package/examples/extensions/README.md +214 -0
  343. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  344. package/examples/extensions/bash-spawn-hook.ts +30 -0
  345. package/examples/extensions/bookmark.ts +50 -0
  346. package/examples/extensions/border-status-editor.ts +150 -0
  347. package/examples/extensions/built-in-tool-renderer.ts +225 -0
  348. package/examples/extensions/claude-rules.ts +86 -0
  349. package/examples/extensions/commands.ts +72 -0
  350. package/examples/extensions/confirm-destructive.ts +59 -0
  351. package/examples/extensions/custom-compaction.ts +117 -0
  352. package/examples/extensions/custom-footer.ts +64 -0
  353. package/examples/extensions/custom-header.ts +73 -0
  354. package/examples/extensions/custom-provider-anthropic/index.ts +617 -0
  355. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  356. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  357. package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  358. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  359. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  360. package/examples/extensions/debug-provider.ts +90 -0
  361. package/examples/extensions/dirty-repo-guard.ts +56 -0
  362. package/examples/extensions/doom-overlay/README.md +46 -0
  363. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  364. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  365. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  366. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  367. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  368. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  369. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  370. package/examples/extensions/doom-overlay/index.ts +74 -0
  371. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  372. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  373. package/examples/extensions/dynamic-resources/dynamic.json +81 -0
  374. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  375. package/examples/extensions/dynamic-resources/index.ts +15 -0
  376. package/examples/extensions/dynamic-tools.ts +74 -0
  377. package/examples/extensions/entry-renderer.ts +41 -0
  378. package/examples/extensions/event-bus.ts +43 -0
  379. package/examples/extensions/file-trigger.ts +41 -0
  380. package/examples/extensions/git-checkpoint.ts +53 -0
  381. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  382. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  383. package/examples/extensions/gondolin/index.ts +531 -0
  384. package/examples/extensions/gondolin/package-lock.json +175 -0
  385. package/examples/extensions/gondolin/package.json +19 -0
  386. package/examples/extensions/handoff.ts +190 -0
  387. package/examples/extensions/hello.ts +26 -0
  388. package/examples/extensions/hidden-thinking-label.ts +53 -0
  389. package/examples/extensions/inline-bash.ts +94 -0
  390. package/examples/extensions/input-transform-streaming.ts +39 -0
  391. package/examples/extensions/input-transform.ts +43 -0
  392. package/examples/extensions/interactive-shell.ts +196 -0
  393. package/examples/extensions/jev-router.ts +113 -0
  394. package/examples/extensions/mac-system-theme.ts +47 -0
  395. package/examples/extensions/message-renderer.ts +59 -0
  396. package/examples/extensions/minimal-mode.ts +353 -0
  397. package/examples/extensions/modal-editor.ts +85 -0
  398. package/examples/extensions/model-status.ts +31 -0
  399. package/examples/extensions/notify.ts +57 -0
  400. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  401. package/examples/extensions/overlay-test.ts +153 -0
  402. package/examples/extensions/permission-gate.ts +34 -0
  403. package/examples/extensions/pirate.ts +47 -0
  404. package/examples/extensions/plan-mode/README.md +66 -0
  405. package/examples/extensions/plan-mode/index.ts +394 -0
  406. package/examples/extensions/plan-mode/utils.ts +168 -0
  407. package/examples/extensions/preset.ts +436 -0
  408. package/examples/extensions/project-trust.ts +64 -0
  409. package/examples/extensions/prompt-customizer.ts +49 -0
  410. package/examples/extensions/protected-paths.ts +30 -0
  411. package/examples/extensions/provider-payload.ts +18 -0
  412. package/examples/extensions/qna.ts +118 -0
  413. package/examples/extensions/question.ts +286 -0
  414. package/examples/extensions/questionnaire.ts +448 -0
  415. package/examples/extensions/rainbow-editor.ts +88 -0
  416. package/examples/extensions/reload-runtime.ts +37 -0
  417. package/examples/extensions/rpc-demo.ts +118 -0
  418. package/examples/extensions/sandbox/index.ts +326 -0
  419. package/examples/extensions/sandbox/package-lock.json +92 -0
  420. package/examples/extensions/sandbox/package.json +19 -0
  421. package/examples/extensions/send-user-message.ts +97 -0
  422. package/examples/extensions/session-name.ts +27 -0
  423. package/examples/extensions/shutdown-command.ts +63 -0
  424. package/examples/extensions/snake.ts +343 -0
  425. package/examples/extensions/space-invaders.ts +560 -0
  426. package/examples/extensions/ssh.ts +220 -0
  427. package/examples/extensions/status-line.ts +32 -0
  428. package/examples/extensions/structured-output.ts +65 -0
  429. package/examples/extensions/subagent/README.md +177 -0
  430. package/examples/extensions/subagent/agents/planner.md +37 -0
  431. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  432. package/examples/extensions/subagent/agents/scout.md +50 -0
  433. package/examples/extensions/subagent/agents/worker.md +24 -0
  434. package/examples/extensions/subagent/agents.ts +157 -0
  435. package/examples/extensions/subagent/index.ts +1038 -0
  436. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  437. package/examples/extensions/subagent/prompts/implement.md +10 -0
  438. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  439. package/examples/extensions/summarize.ts +199 -0
  440. package/examples/extensions/system-prompt-header.ts +17 -0
  441. package/examples/extensions/tic-tac-toe.ts +1008 -0
  442. package/examples/extensions/timed-confirm.ts +70 -0
  443. package/examples/extensions/titlebar-spinner.ts +58 -0
  444. package/examples/extensions/todo.ts +297 -0
  445. package/examples/extensions/tool-override.ts +144 -0
  446. package/examples/extensions/tools.ts +146 -0
  447. package/examples/extensions/trigger-compact.ts +50 -0
  448. package/examples/extensions/truncated-tool.ts +195 -0
  449. package/examples/extensions/widget-placement.ts +9 -0
  450. package/examples/extensions/with-deps/index.ts +32 -0
  451. package/examples/extensions/with-deps/package-lock.json +31 -0
  452. package/examples/extensions/with-deps/package.json +22 -0
  453. package/examples/extensions/working-indicator.ts +123 -0
  454. package/examples/extensions/working-message-test.ts +25 -0
  455. package/examples/rpc-client.ts +35 -0
  456. package/examples/rpc-extension-ui.ts +661 -0
  457. package/examples/sdk/01-minimal.ts +26 -0
  458. package/examples/sdk/02-custom-model.ts +49 -0
  459. package/examples/sdk/03-custom-prompt.ts +75 -0
  460. package/examples/sdk/04-skills.ts +55 -0
  461. package/examples/sdk/05-tools.ts +48 -0
  462. package/examples/sdk/06-extensions.ts +99 -0
  463. package/examples/sdk/07-context-files.ts +47 -0
  464. package/examples/sdk/08-prompt-templates.ts +51 -0
  465. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  466. package/examples/sdk/10-settings.ts +53 -0
  467. package/examples/sdk/11-sessions.ts +52 -0
  468. package/examples/sdk/12-full-control.ts +74 -0
  469. package/examples/sdk/13-session-runtime.ts +67 -0
  470. package/examples/sdk/14-codemode-mcp.ts +61 -0
  471. package/examples/sdk/README.md +141 -0
  472. package/package.json +21 -5
  473. package/python/raga_rlm/__init__.py +336 -0
  474. package/python/raga_rlm/repl.py +920 -0
  475. package/schemas/keybindings.schema.json +393 -0
  476. package/schemas/models.schema.json +1211 -0
  477. package/schemas/settings.schema.json +815 -0
  478. package/schemas/theme.schema.json +365 -0
package/docs/cli.md ADDED
@@ -0,0 +1,337 @@
1
+ <a id="cli-and-modes-reference"></a>
2
+
3
+ # Command Line
4
+
5
+ This page documents Pi's built-in command-line commands and options. Run `pi --help` or append `--help` to a command for the exact interface in your installed version. The top-level help also includes options registered by loaded extensions.
6
+
7
+ ```sh
8
+ pi [options] [--] [@files...] [messages...]
9
+ pi install <source> [options]
10
+ pi remove <source> [options]
11
+ pi uninstall <source> [options]
12
+ pi update [target] [options]
13
+ pi list
14
+ pi config [options]
15
+ pi auth <check|print-api-key|print-bearer-token> [options]
16
+ pi mcp <list|login|logout> [options]
17
+ ```
18
+
19
+ <a id="modes"></a>
20
+
21
+ ## Invocation and output
22
+
23
+ ```sh
24
+ pi
25
+ pi --print "Summarize this repository"
26
+ git diff | pi --print "Review this change"
27
+ pi --mode json "Inspect this repository" > events.jsonl
28
+ ```
29
+
30
+ With terminal stdin and stdout, Pi opens the terminal UI unless `--print`, `--mode json`, or `--mode rpc` selects another interface. When either stream is redirected and neither JSON nor RPC mode is selected, Pi uses print mode. See [CLI Integration](cli-integration.md) for choosing between interactive, print, JSON, RPC, and SDK integration.
31
+
32
+ | Input | Behavior |
33
+ |---|---|
34
+ | `message` | Provide an initial prompt |
35
+ | `@path` | Include a text file or image in the first prompt |
36
+ | Piped stdin | Prepend its contents to the first prompt |
37
+ | `--` | Stop option parsing so a prompt can begin with `-` |
38
+
39
+ Pi resolves `@path` from the current working directory. The working directory also controls project configuration, resource discovery, and session grouping.
40
+
41
+ `--print` controls whether Pi runs once and exits. `--mode` selects the output interface. `--mode text` does not force one-shot execution when stdin and stdout are terminals; use `--print` for that behavior.
42
+
43
+ | Option | Behavior |
44
+ |---|---|
45
+ | `-p`, `--print` | Run the supplied prompts, write the final assistant text to stdout, then exit |
46
+ | `--mode text` | Select text output; still open the terminal UI when stdin and stdout are terminals |
47
+ | `--mode json` | Run the supplied prompts, write JSONL events to stdout, then exit |
48
+ | `--mode rpc` | Read JSONL commands from stdin and write responses and events to stdout until shutdown |
49
+ | `--export <input> [output]` | Export a session file to HTML and exit; derive the destination when `output` is omitted |
50
+
51
+ RPC mode rejects `@file` arguments. JSON and RPC modes reserve stdout for protocol records. See [JSON Event Stream](json.md) and [RPC Protocol](rpc.md).
52
+
53
+ <a id="model-options"></a>
54
+
55
+ ## Models
56
+
57
+ ```sh
58
+ pi --model sonnet:high
59
+ ```
60
+
61
+ See [Choose a Model](models.md) for model selection and [Providers](providers.md) for credentials.
62
+
63
+ - `--provider <name>`<br>
64
+ Restricts `--model` lookup to one provider. It requires `--model`.
65
+ - `--model <pattern>`<br>
66
+ Selects by exact ID or fuzzy ID/name match. It accepts `provider/id` and an optional `:<thinking>` suffix. If several providers match, Pi prefers the one with credentials, otherwise it asks for `--provider`.
67
+ - `--api-key <key>`<br>
68
+ Uses a non-persistent API-key override. It requires a model selected through `--model` or `--models`. It does not choose between providers that offer the same model.
69
+ - `--thinking <level>`<br>
70
+ Sets `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. It overrides a `--model` suffix and is clamped to the model's capabilities.
71
+ - `--models <patterns>`<br>
72
+ Sets a comma-separated scope for startup and cycling. It accepts exact IDs, fuzzy matches, case-insensitive globs, and optional `:<thinking>` suffixes. A model offered by several providers is added for each, with a warning.
73
+ - `--list-models [search]`<br>
74
+ Lists available models, optionally filtered by a fuzzy search, then exits.
75
+
76
+ <a id="session-options"></a>
77
+
78
+ ## Sessions
79
+
80
+ ```sh
81
+ pi --continue
82
+ ```
83
+
84
+ See [Sessions and Context](sessions.md) for resuming, forking, naming, and storing sessions.
85
+
86
+ - `-c`, `--continue`<br>
87
+ Continues the most recent session for the current project.
88
+ - `-r`, `--resume`<br>
89
+ Opens the session selector.
90
+ - `--session <path|id>`<br>
91
+ Opens by file path, exact ID, or partial ID. Pi searches the current project first and offers to fork a cross-project match.
92
+ - `--session-id <id>`<br>
93
+ Opens the exact project session ID or creates it if absent. IDs accept letters, numbers, `.`, `_`, and `-`.
94
+ - `--fork <path|id>`<br>
95
+ Forks an existing session into a new session for the current project.
96
+ - `--session-dir <dir>`<br>
97
+ Overrides storage and lookup. It takes precedence over `PI_CODING_AGENT_SESSION_DIR` and the `sessionDir` setting.
98
+ - `--no-session`<br>
99
+ Uses an in-memory session that is not persisted.
100
+ - `-n`, `--name <name>`<br>
101
+ Sets the session display name.
102
+
103
+ Constraints:
104
+
105
+ - Session IDs must start and end with a letter or number.
106
+ - `--fork` cannot be combined with `--session`, `--continue`, `--resume`, or `--no-session`.
107
+ - `--session-id` cannot be combined with `--session`, `--continue`, or `--resume`. Combine it with `--fork` to choose the new ID.
108
+
109
+ <a id="tool-options"></a>
110
+
111
+ ## Tools
112
+
113
+ ```sh
114
+ pi --tools read,grep,find,ls --print "Review this project"
115
+ ```
116
+
117
+ See [Settings](settings.md#tools) for configuring the default tool selection.
118
+
119
+ - `-t`, `--tools <list>`<br>
120
+ Replaces the default selection with a comma-separated allowlist of built-in, extension, or custom tools. Entries are tool names or patterns where `*` matches any characters. MCP tools are kept unless an entry starts with `mcp__` (see [MCP tools](#mcp-tools)). A list of only `+name` and `-name` entries is not an allowlist; it changes the default selection instead.
121
+ - `-xt`, `--exclude-tools <list>`<br>
122
+ Disables comma-separated tool names or patterns after all other selection options, MCP tools included.
123
+ - `-nbt`, `--no-builtin-tools`<br>
124
+ Disables default built-in tools while retaining extension and custom tools.
125
+ - `-nt`, `--no-tools`<br>
126
+ Starts with all built-in, extension, custom, and MCP tools disabled.
127
+ - `--rlm`<br>
128
+ RLM mode: the model gets one tool, `python`, which runs code in a persistent Python kernel that calls `read`, `bash`, `edit`, `write`, and sub-LLMs. Ignores `--tools`, `--no-tools`, `--no-builtin-tools`, and `defaultTools`. Same as the [`rlm.enabled`](settings.md#rlm-mode) setting for one run.
129
+ - `--rlm-input <[name=]path>`<br>
130
+ Exposes a file as `context.inputs[name]` in the kernel, read on first access. Without a name, the file name is the key. Repeatable.
131
+
132
+ Default enabled tools are `read`, `bash`, `edit`, and `write`, unless `defaultTools` changes them. `--tools` with plain names replaces the whole selection, so name every tool you want. Like `defaultTools`, it also accepts a list of only `+name` and `-name` entries, which adds tools to or removes them from the default selection: `pi --tools +codemode,-write` keeps the other default tools, enables `codemode`, and disables `write`. These entries take exact tool names, not `*` patterns; use `--exclude-tools` to disable tools by pattern. Plain names and `+name`/`-name` entries cannot be mixed. `/reload` enables tools newly added to `defaultTools`, but a tool removed with `-name` stays removed.
133
+
134
+ <a id="mcp-tools"></a>
135
+
136
+ `--tools` selects the tools declared to the model. It does not remove MCP tools, whose reach is set by their [exposure](mcp.md#control-tool-exposure): `pi --tools read,codemode` keeps every MCP tool callable from codemode scripts. An MCP tool that no entry names or matches is never declared directly, whatever its exposure; only `tool_search`, if listed, can load it. Once an entry starts with `mcp__`, `--tools` filters MCP tools too, so this keeps only the tools of the `radius` server:
137
+
138
+ ```sh
139
+ pi --tools read,bash,codemode,'mcp__radius__*'
140
+ ```
141
+
142
+ The MCP resource tools (`list_mcp_resources`, `list_mcp_resource_templates`, `read_mcp_resource`) count as MCP tools. To remove MCP tools, use `--exclude-tools 'mcp__*'` or [`--no-mcp`](#resource-options).
143
+
144
+ | Built-in | Purpose |
145
+ |---|---|
146
+ | `read` | Read text files and supported images |
147
+ | `bash` | Run shell commands |
148
+ | `powershell` | Run PowerShell commands on Windows |
149
+ | `edit` | Apply exact text replacements to an existing file |
150
+ | `write` | Create or overwrite a file |
151
+ | `grep` | Search file contents |
152
+ | `find` | Find paths using glob patterns |
153
+ | `ls` | List directory contents |
154
+
155
+ Built-in extensions add two more tools. They are off by default; the MCP extension turns them on when an MCP server needs them (see [MCP](mcp.md#exposure)). To enable them yourself, name them in `--tools` or `defaultTools`.
156
+
157
+ | Built-in extension | Purpose |
158
+ |---|---|
159
+ | `codemode` | Run JavaScript that calls the other tools, for example in parallel with `Promise.allSettled`; only the script's output reaches the model |
160
+ | `tool_search` | Search tools that are not declared to the model (`codemode` and `deferred` exposure, such as MCP tools) and declare the matches for the next call |
161
+
162
+ ### Enable codemode
163
+
164
+ To turn on `codemode` for every session, add it to the default tools in `~/.pi/agent/settings.json` or a project's `.raga/settings.json`:
165
+
166
+ ```json
167
+ {
168
+ "defaultTools": ["+codemode"]
169
+ }
170
+ ```
171
+
172
+ This keeps `read`, `bash`, `edit`, and `write` and adds `codemode`. For one invocation, add it with `--tools`:
173
+
174
+ ```sh
175
+ pi --tools +codemode
176
+ ```
177
+
178
+ Codemode is useful without MCP: scripts can run several tool calls in parallel, filter large output before it reaches the model, call classifier models such as TypeSafe's Jev through `models.classify()` (see [Classifier models](models.md#use-classifier-models)), and generate images through `models.generateImages()` (see [Image models](models.md#use-image-models)).
179
+
180
+ ### How codemode works
181
+
182
+ Scripts run in a QuickJS sandbox and reach the other tools through `tools.<name>(args)`. [Codemode](codemode.md) describes the script API, how tools are listed and found, the `store()` and `models` globals, and the limits.
183
+
184
+ ### Tool search
185
+
186
+ `tool_search` is off by default; enable it with `"defaultTools": ["+tool_search"]` or `--tools`. It uses the same ranking as `searchTools()` over tools that are not declared yet and declares the matches for the next model call. Loaded tools are recorded in the session like other tool changes, so they stay declared on that branch.
187
+
188
+ <a id="resource-options"></a>
189
+
190
+ ## Resources
191
+
192
+ ```sh
193
+ pi --extension ./review.ts
194
+ ```
195
+
196
+ See [Configuration](configuration.md) for conventional directories and project trust, [Settings](settings.md#resources) for configured paths, and [Pi Packages](packages.md) for package sources.
197
+
198
+ - `-e`, `--extension <path>`<br>
199
+ Loads an extension file or directory, or a built-in extension such as `builtin:mcp`, and is repeatable.
200
+ - `-ne`, `--no-extensions`<br>
201
+ Disables discovered, configured, and built-in extensions. Explicit `-e` paths still load, so `pi -ne -e builtin:mcp` keeps only the built-in MCP support.
202
+ - `--no-mcp`<br>
203
+ Disables the built-in MCP support for this run: no servers connect, and there are no MCP tools or `/mcp`. It does not affect an extension that replaces the built-in MCP support.
204
+ - `--skill <path>`<br>
205
+ Loads a skill file or directory and is repeatable.
206
+ - `-ns`, `--no-skills`<br>
207
+ Disables discovered and configured skills. Explicit `--skill` paths still load.
208
+ - `--prompt-template <path>`<br>
209
+ Loads a prompt-template file or directory and is repeatable.
210
+ - `-np`, `--no-prompt-templates`<br>
211
+ Disables discovered and configured templates. Explicit `--prompt-template` paths still load.
212
+ - `--theme <path>`<br>
213
+ Loads a theme file or directory and is repeatable.
214
+ - `--use-theme <name[/name]>`<br>
215
+ Selects the initial interactive theme for this run.
216
+ - `--no-themes`<br>
217
+ Disables discovered and configured themes. Explicit `--theme` paths still load.
218
+ - `-nc`, `--no-context-files`<br>
219
+ Disables `AGENTS.md` and `CLAUDE.md` discovery.
220
+
221
+ Resource paths apply only to the current process. Relative paths resolve from the current working directory.
222
+
223
+ <a id="prompt-and-display-options"></a>
224
+
225
+ ## Prompts and process
226
+
227
+ ```sh
228
+ pi --append-system-prompt ./instructions.md
229
+ ```
230
+
231
+ See [Configuration](configuration.md) for saved configuration, [Security](security.md#understand-project-trust) for project trust, and [Environment Variables](environment-variables.md) for process controls.
232
+
233
+ - `--system-prompt <text|path>`<br>
234
+ Replaces the default system prompt with text or the contents of an existing file.
235
+ - `--append-system-prompt <text|path>`<br>
236
+ Appends text or an existing file to the system prompt and is repeatable.
237
+ - `--tui-mode <mode>`<br>
238
+ Uses `fullscreen` (default) or `regular` terminal mode.
239
+ - `--verbose`<br>
240
+ Shows verbose interactive startup information, overriding `quietStartup`.
241
+ - `-a`, `--approve`<br>
242
+ Trusts project-local configuration and resources for this process.
243
+ - `-na`, `--no-approve`<br>
244
+ Ignores trust-gated project-local configuration and resources for this process.
245
+ - `--offline`<br>
246
+ Disables automatic network activity, including model catalog refreshes. Equivalent to `PI_OFFLINE=1`.
247
+ - `-h`, `--help`<br>
248
+ Shows help, including flags registered by loaded extensions, then exits.
249
+ - `-v`, `--version`<br>
250
+ Shows the Pi version, then exits.
251
+
252
+ Extensions may register additional long-form options. Unknown short options are rejected.
253
+
254
+ ## Package commands
255
+
256
+ ```sh
257
+ pi install npm:@scope/package
258
+ ```
259
+
260
+ See [Pi Packages](packages.md) for source formats, filtering, installation, and project scope.
261
+
262
+ ### Common tasks
263
+
264
+ | Task | Command |
265
+ |---|---|
266
+ | Install a package | `pi install <source>` |
267
+ | List configured packages | `pi list` |
268
+ | Remove a package and its settings entry | `pi remove <source>` |
269
+ | Configure which package resources load | `pi config` |
270
+
271
+ Add `--local` or `-l` to `install`, `remove`, `uninstall`, or `config` to use project settings instead of global settings.
272
+
273
+ ### Update Pi or packages
274
+
275
+ Running `pi update` without a target updates Pi itself.
276
+
277
+ | Task | Command |
278
+ |---|---|
279
+ | Update Pi | `pi update` |
280
+ | Update all installed packages | `pi update --extensions` |
281
+ | Update one installed package | `pi update <source>` |
282
+ | Refresh model catalogs | `pi update --models` |
283
+ | Update Pi and all installed packages | `pi update --all` |
284
+
285
+ Add `--force` to reinstall Pi when the selected update includes Pi.
286
+
287
+ `pi update` cannot update Pi when another package manager provides it, such as Nix. Update Pi with that package manager, for example `nix profile upgrade pi`. Package and model catalog updates still work.
288
+
289
+ ### Aliases and command options
290
+
291
+ - `pi uninstall <source>` is an alias for `pi remove <source>`.
292
+ - `pi update --self`, `pi update self`, and `pi update pi` are aliases for `pi update`.
293
+ - `pi update --extension <source>` is an alias for `pi update <source>`.
294
+ - `-a`, `--approve` trusts project-local files for one command. `-na`, `--no-approve` ignores trust-gated project-local files.
295
+ - Append `-h` or `--help` to a command for its exact usage and option constraints.
296
+
297
+ ## Credential commands
298
+
299
+ ```sh
300
+ pi auth check --provider openai --json
301
+ ```
302
+
303
+ Authentication commands require `--provider <provider>` or `--model <model>`. See [Providers](providers.md) for supported methods.
304
+
305
+ | Command | Description |
306
+ |---|---|
307
+ | `pi auth check` | Print `ready`, `not_ready`, or `invalid`; exit with status `0`, `1`, or `2`, respectively |
308
+ | `pi auth print-api-key` | Print the resolved API key |
309
+ | `pi auth print-bearer-token` | Print a resolved OAuth bearer token |
310
+
311
+ | Option | Applies to | Description |
312
+ |---|---|---|
313
+ | `--provider <provider>` | All | Resolve credentials for a provider |
314
+ | `--model <model>` | All | Resolve credentials from a model; may be combined with `--provider` |
315
+ | `--json` | `auth check` | Write the structured result as JSON |
316
+ | `--credentials` | `auth check` | Emit the resolved credential when ready |
317
+ | `--no-refresh` | `auth check` | Do not refresh expired OAuth credentials; refresh is the default |
318
+ | `--min-expiry <duration>` | `print-bearer-token` | Require remaining token lifetime using `ms`, `s`, `m`, or `h`, such as `30m` |
319
+
320
+ Credential-printing commands write secrets to stdout.
321
+
322
+ ## MCP commands
323
+
324
+ These commands work outside a session, so agents can run them through `bash`. See [MCP Servers](mcp.md).
325
+
326
+ | Command | Description |
327
+ |---|---|
328
+ | `pi mcp add <server> [options] -- <command> [args...]` | Add or replace a stdio server in `mcp.json`; `--env KEY=VALUE` (repeatable) and `--cwd <dir>` set its environment and working directory. Arguments after the command are passed to it |
329
+ | `pi mcp add <server> [options] --url <url>` | Add or replace a streamable HTTP server; `--header KEY=VALUE` (repeatable), `--bearer-token-env-var <NAME>` (sends `Authorization: Bearer ${NAME}`), `--oauth-client-id`, `--oauth-client-secret`, `--oauth-callback-port`, and `--oauth-client-name` configure authentication |
330
+ | `pi mcp remove <server>` | Remove a server from `mcp.json`; stored OAuth credentials are kept |
331
+ | `pi mcp list [--json]` | Connect to every enabled server and print its state, tools, and errors; exit with `1` when a config entry is invalid or an enabled server is not connected |
332
+ | `pi mcp login <server> [--timeout <seconds>]` | Sign in to an OAuth server: open the authorization page and wait for the browser; a terminal also accepts the pasted redirect URL. `--timeout` limits the whole sign-in, including requests to the authorization server (default 300 seconds) |
333
+ | `pi mcp logout <server>` | Delete the stored OAuth credentials of a server |
334
+
335
+ `add` and `remove` change `~/.pi/agent/mcp.json`, or `.raga/mcp.json` in the current directory with `--local` (`-l`). `add` also takes `--exposure <mode>` (see [Exposure](mcp.md#exposure)) and `--description <text>` and does not connect; run `pi mcp list` to check the server.
336
+
337
+ Project `.raga/mcp.json` files are only read for projects that are already trusted.
@@ -0,0 +1,230 @@
1
+ # Codemode
2
+
3
+ The `codemode` tool lets the model write a JavaScript script that calls pi's other tools and runs non-LLM models, such as classifiers and image models. Only the script's output reaches the model, so a script can run calls in parallel and filter large results before the model sees them. To turn it on, see [Enable codemode](cli.md#enable-codemode).
4
+
5
+ ## Scripts
6
+
7
+ The tool input is raw JavaScript source, not JSON and not a markdown code fence. It runs as the body of an async function in a QuickJS sandbox, so top-level `await` and `return` work. The sandbox has no Node APIs, file system, network, or timers; scripts reach the outside world only through tools and `models`.
8
+
9
+ A script may start with an options line. It must be the first line; an options line anywhere else fails the call before the script runs:
10
+
11
+ ```js
12
+ // @options: {"max_output_tokens": 2000, "timeout_ms": 60000}
13
+ ```
14
+
15
+ - `max_output_tokens` (default 10000) limits the output. Longer output keeps its start and end, and the full text is written to a temp file whose path is included in the result. A script fails when its output passes 16777216 characters of text and base64 image data or 100000 `text()`, `image()`, and `console` calls; write large data to a file with a tool instead.
16
+ - `timeout_ms` is a hard deadline for the whole script, including any wait for a free worker. It is unset by default. Image generation can take minutes, so do not set a short deadline for scripts that generate images.
17
+
18
+ The result starts with `Script completed` or `Script failed`, the wall time, and the output. Text and image items appear in order, each on its own line. When the output has more than one text item (from `text()` or `return`), each starts with a `==> text N/M <==` line. `console` calls follow in one `<console_output>` block with one line per call. A failed script keeps its partial output, followed by `Script error:` and the error. Tool calls are real: calls made before a failure are not undone. Calls still running when the script ends are cancelled, and unawaited promises are discarded.
19
+
20
+ ## Globals
21
+
22
+ | Global | Purpose |
23
+ |---|---|
24
+ | `tools.<name>(args)` | Call a tool. See [Call tools](#call-tools). |
25
+ | `text(value)` | Add a text item to the output. Strings are added as is, other values as JSON. |
26
+ | `image(value)` | Add an image to the output: a base64 `data:` URL, an `{ image_url }` object, or an image block `{ type: "image", data, mimeType }` such as those returned by MCP tools and `models.generateImages()`. Remote URLs are not supported. PNG, JPEG, GIF, and WebP are accepted. Each image is also saved to a temp file, and the result names the path before the image. |
27
+ | `console.log(...)` | Add a line to the `<console_output>` block after the other output. Arguments are joined with spaces; `info`, `warn`, `error`, and `debug` do the same. |
28
+ | `return value` | A top-level `return` adds the value like `text()`. |
29
+ | `exit()` | End the script successfully. |
30
+ | `store(key, value)` / `load(key)` | Keep small JSON values across `codemode` calls. See [Store values](#store-values). |
31
+ | `ALL_TOOLS` | Every callable tool as `{ name, description }`, including tools the description does not list. |
32
+ | `searchTools(query, { limit?, namespace? })` | Rank callable tools by relevance (BM25, default limit 8). Resolves to `{ name, description }[]`. |
33
+ | `describeTool(name)` | Resolves to a tool's description and TypeScript declaration, or `undefined`. |
34
+ | `describeNamespace(name)` | Resolves to `{ name, description?, instructions?, tools }` for a namespace such as an MCP server, or `undefined`. |
35
+ | `models` | List and run non-LLM models. See [Models](#models). |
36
+
37
+ ## Call tools
38
+
39
+ Every tool the session can call is a method of `tools`, named by its identifier: characters that are not valid in a JavaScript identifier become `_`, so the MCP tool `mcp__dev-radius__search` is `tools.mcp__dev_radius__search`. Each method takes one object with the tool's arguments.
40
+
41
+ What a call resolves to depends on the tool:
42
+
43
+ - Tools with an output schema resolve to a structured value. `bash` resolves to `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }`, also for non-zero exit codes. Its `output` is not limited to the 2000 lines or 50KB the model sees: it holds up to 1 MiB, and longer output keeps its first and last 512 KiB around an omission marker, with `truncated` set and the full output in `full_output_path`.
44
+ - MCP tools resolve to their `CallToolResult`, including `isError` and `structuredContent`.
45
+ - `read` resolves to the file's text, or for an image to an image block `{ type: "image", data, mimeType, note }` that `image()` shows. `data` is the base64 image the model would see and `note` the text that goes with it, such as resize hints.
46
+ - Other tools, such as `edit` and `write`, resolve to their text output.
47
+
48
+ A call that fails, is blocked, or gets invalid arguments rejects with an `Error` that carries the tool's error text. Use `Promise.allSettled()` to keep the results of the calls that succeed.
49
+
50
+ The `codemode` description lists tools with their TypeScript declarations, grouped by namespace (for example one MCP server). Tools with `deferred` exposure, which includes MCP tools with the default `codemode` exposure, are not listed, so the description stays the same while MCP servers connect. Listed declarations share a budget of 3000 estimated tokens (`codemode.inlineBudget` in [settings](settings.md#tools)). Scripts find the other tools with `searchTools()`, `describeTool()`, `describeNamespace()`, or by filtering `ALL_TOOLS`.
51
+
52
+ While `codemode` is active, `codemode.mode` in [settings](settings.md#tools) decides how the other tools are presented. With `on` (default) declared tools stay declared, and their descriptions say how to call them from scripts. With `only` they are hidden from the model and listed in the `codemode` description instead, so the model calls them through scripts. Tool declarations in the `codemode` description, `describeTool()`, and `ALL_TOOLS` carry the tools' prompt guidelines, since the system prompt rules only cover declared tools.
53
+
54
+ ## Store values
55
+
56
+ `store(key, value)` keeps a JSON value under a string key for later `codemode` calls; storing `undefined` deletes the key. `load(key)` returns the value, or `undefined`. Writes are kept only when the script succeeds: each successful script that stores values appends a `codemode-store` custom entry to the session, so resumed sessions keep the values and each branch sees only the values written on its path.
57
+
58
+ The store is for small state such as IDs, cursors, or summaries. One value may have at most 262144 characters of JSON and all values together at most 1048576. Do not store image data; show images with `image()`, which also saves them to a temp file.
59
+
60
+ ## Models
61
+
62
+ `models` reaches the model catalog and runs non-LLM models with the session's credentials: classifiers, which answer typed questions about JSON state and, for some models, images, and image models, which generate images. Chat models are listed but cannot be run from scripts. Which classifier and image models exist is described in [Use classifier models](models.md#use-classifier-models) and [Use image models](models.md#use-image-models).
63
+
64
+ ```ts
65
+ type ModelType = "chat" | "image" | "classifier";
66
+
67
+ /** A catalog entry. `provider` and `id` identify it; other fields depend on the type. */
68
+ interface ModelInfo {
69
+ type?: ModelType;
70
+ provider: string;
71
+ id: string;
72
+ name: string;
73
+ api: string;
74
+ input: ("text" | "image")[];
75
+ contextWindow?: number;
76
+ [key: string]: unknown;
77
+ }
78
+
79
+ declare const models: {
80
+ /** Every known model of a type, optionally for one provider. */
81
+ getModelsOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
82
+ /** Models of a type whose provider has working credentials. */
83
+ getAvailableOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
84
+ /** One catalog entry, or undefined. */
85
+ getModelOfType(type: ModelType, provider: string, id: string): Promise<ModelInfo | undefined>;
86
+ /** Answer `context.questions` about `context.state`; answers are in `result.answers` by question ID. */
87
+ classify(model: ModelInfo, context: ClassifierContext): Promise<ClassifierResult>;
88
+ /** Generate images from `context.input` text and image blocks; show `result.output` blocks with image(). Can take minutes. */
89
+ generateImages(model: ModelInfo, context: ImagesContext): Promise<ImagesResult>;
90
+ };
91
+ ```
92
+
93
+ `classify()` and `generateImages()` use only the `provider` and `id` of `model`, so `{ provider, id }` works as well. They do not throw on provider errors: check `stopReason` and `errorMessage`. At most four such calls run at once per script; more calls wait for a free slot, so `Promise.all()` over many items is fine. Their usage is added to the `codemode` tool result and counts toward the session cost.
94
+
95
+ Model IDs differ between providers, for example `typesafe/jev-latest` and `openrouter/typesafe/jev-1.13`. Use `models.getAvailableOfType(type)` to find the IDs that work with the current credentials.
96
+
97
+ ### Classify
98
+
99
+ ```ts
100
+ interface ClassifierContext {
101
+ /** The data to classify. */
102
+ state: Record<string, unknown>;
103
+ /** Images judged together with `state`. Only models whose `input` includes "image" accept them. */
104
+ images?: { type: "image"; data: string; mimeType: string }[];
105
+ /** Questions by ID. One call answers all of them. */
106
+ questions: Record<string, ClassifierQuestion>;
107
+ }
108
+
109
+ type ClassifierQuestion =
110
+ /** Pick one label. `criteria` maps each label to what it means. */
111
+ | { type: "choice"; instructions: string; criteria: Record<string, string> }
112
+ /** Score on an ordered scale. `criteria` describes each level, lowest first. */
113
+ | { type: "score"; instructions: string; criteria: string[] }
114
+ /** Yes or no. */
115
+ | { type: "bool"; instructions: string; criteria: { true: string; false: string } };
116
+
117
+ interface ClassifierResult {
118
+ provider: string;
119
+ model: string;
120
+ /** Answers by question ID. */
121
+ answers: Record<string, ClassifierAnswer>;
122
+ usage?: ModelUsage;
123
+ stopReason: "stop" | "error" | "aborted";
124
+ errorMessage?: string;
125
+ }
126
+
127
+ type ClassifierAnswer =
128
+ | { type: "choice"; choice: string; probabilities: Record<string, number>; confidence: number }
129
+ /** `score` is the expected level index, from 0 to `criteria.length - 1`. */
130
+ | { type: "score"; score: number; confidence: number }
131
+ /** Probability of `true`. */
132
+ | { type: "bool"; probability: number };
133
+
134
+ /** Token counts and cost in USD, when the service reports them. */
135
+ type ModelUsage = { input: number; output: number; totalTokens: number; cost: { total: number } };
136
+ ```
137
+
138
+ Classify several items by calling `classify()` once per item. This script sorts feedback messages, for example ones a tool returned earlier in the script:
139
+
140
+ ```js
141
+ const jev = await models.getModelOfType("classifier", "typesafe", "jev-latest");
142
+ const results = await Promise.all(
143
+ messages.map((message) =>
144
+ models.classify(jev, {
145
+ state: { message },
146
+ questions: {
147
+ sentiment: {
148
+ type: "choice",
149
+ instructions: "How does the user feel about the product?",
150
+ criteria: { positive: "Satisfied or happy", negative: "Unhappy or frustrated", neutral: "Neither" },
151
+ },
152
+ urgency: {
153
+ type: "score",
154
+ instructions: "How urgently does this need a reply?",
155
+ criteria: ["no reply needed", "reply this week", "reply today"],
156
+ },
157
+ },
158
+ }),
159
+ ),
160
+ );
161
+ return results.map((result, i) =>
162
+ result.stopReason === "stop"
163
+ ? { message: messages[i], sentiment: result.answers.sentiment.choice, urgency: result.answers.urgency.score }
164
+ : { message: messages[i], error: result.errorMessage },
165
+ );
166
+ ```
167
+
168
+ Classifiers whose `input` includes `"image"` also judge images. `tools.read()` returns an image file as an image block that `images` accepts. Other classifiers return an error result when `images` is not empty.
169
+
170
+ ```js
171
+ const luna = await models.getModelOfType("classifier", "openai", "gpt-6-luna");
172
+ const photo = await tools.read({ path: "screenshot.png" });
173
+ const result = await models.classify(luna, {
174
+ state: { task: "Settings page redesign" },
175
+ images: [photo],
176
+ questions: {
177
+ broken: {
178
+ type: "bool",
179
+ instructions: "Does the screenshot show a broken layout?",
180
+ criteria: { true: "Overlapping, cut-off, or misaligned elements", false: "Clean layout" },
181
+ },
182
+ },
183
+ });
184
+ ```
185
+
186
+ ### Generate images
187
+
188
+ ```ts
189
+ interface ImagesContext {
190
+ /** The prompt as text blocks, plus image blocks to edit or use as references. */
191
+ input: (TextBlock | ImageBlock)[];
192
+ }
193
+
194
+ interface ImagesResult {
195
+ provider: string;
196
+ model: string;
197
+ /** Generated images, and text blocks for models that also return text. */
198
+ output: (TextBlock | ImageBlock)[];
199
+ usage?: ModelUsage;
200
+ stopReason: "stop" | "error" | "aborted";
201
+ errorMessage?: string;
202
+ }
203
+
204
+ type TextBlock = { type: "text"; text: string };
205
+ /** `data` is base64. */
206
+ type ImageBlock = { type: "image"; data: string; mimeType: string };
207
+ ```
208
+
209
+ Show generated images with `image(block)`. Do not print `data` with `text()`, `console`, or `return`: it is large and the model cannot read it as text. `image()` also saves each image to a temp file and puts its path in the result, so a later turn can copy or move the file.
210
+
211
+ ```js
212
+ // @options: {"timeout_ms": 300000}
213
+ const painter = await models.getModelOfType("image", "openrouter", "google/gemini-2.5-flash-image");
214
+ const result = await models.generateImages(painter, {
215
+ input: [{ type: "text", text: "A red fox in the snow, watercolor" }],
216
+ });
217
+ if (result.stopReason !== "stop") return result.errorMessage;
218
+ for (const block of result.output) {
219
+ if (block.type === "image") image(block);
220
+ else text(block.text);
221
+ }
222
+ ```
223
+
224
+ ## Limits
225
+
226
+ - A script's VM has 256 MB of memory. Running out throws `InternalError: out of memory`; filter or aggregate large data instead of accumulating it.
227
+ - On Bun, stopping a script or reaching its deadline ends the call promptly, but a built-in that does not poll QuickJS's interrupt handler can keep computing in its worker until it returns.
228
+ - At most two codemode workers may be alive across all sessions in one pi process; `PI_CODEMODE_MAX_WORKERS` changes the limit. A cancelled worker occupies its slot until it exits. At capacity, new scripts wait for a free worker in arrival order. A script that gets no worker within 60 seconds, or before its `timeout_ms`, fails without running.
229
+ - A script that waits on a promise that can never settle (no tool call pending) fails immediately, since there are no timers.
230
+ - Scripts cannot start other `codemode` scripts.