@phi-code-admin/phi-code 0.74.2 → 0.75.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 (656) hide show
  1. package/CHANGELOG.md +1186 -4
  2. package/README.md +478 -379
  3. package/dist/bun/cli.d.ts +3 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +9 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/register-bedrock.d.ts +2 -0
  8. package/dist/bun/register-bedrock.d.ts.map +1 -0
  9. package/dist/bun/register-bedrock.js +4 -0
  10. package/dist/bun/register-bedrock.js.map +1 -0
  11. package/dist/bun/restore-sandbox-env.d.ts +13 -0
  12. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  13. package/dist/bun/restore-sandbox-env.js +32 -0
  14. package/dist/bun/restore-sandbox-env.js.map +1 -0
  15. package/dist/cli/args.d.ts +12 -7
  16. package/dist/cli/args.d.ts.map +1 -1
  17. package/dist/cli/args.js +87 -45
  18. package/dist/cli/args.js.map +1 -1
  19. package/dist/cli/config-selector.d.ts.map +1 -1
  20. package/dist/cli/config-selector.js.map +1 -1
  21. package/dist/cli/file-processor.d.ts.map +1 -1
  22. package/dist/cli/file-processor.js +4 -0
  23. package/dist/cli/file-processor.js.map +1 -1
  24. package/dist/cli/initial-message.d.ts +18 -0
  25. package/dist/cli/initial-message.d.ts.map +1 -0
  26. package/dist/cli/initial-message.js +22 -0
  27. package/dist/cli/initial-message.js.map +1 -0
  28. package/dist/cli/list-models.d.ts.map +1 -1
  29. package/dist/cli/list-models.js +7 -1
  30. package/dist/cli/list-models.js.map +1 -1
  31. package/dist/cli/session-picker.d.ts.map +1 -1
  32. package/dist/cli/session-picker.js +2 -1
  33. package/dist/cli/session-picker.js.map +1 -1
  34. package/dist/cli.d.ts.map +1 -1
  35. package/dist/cli.js +9 -5
  36. package/dist/cli.js.map +1 -1
  37. package/dist/config.d.ts +24 -0
  38. package/dist/config.d.ts.map +1 -1
  39. package/dist/config.js +226 -30
  40. package/dist/config.js.map +1 -1
  41. package/dist/core/agent-session-runtime.d.ts +117 -0
  42. package/dist/core/agent-session-runtime.d.ts.map +1 -0
  43. package/dist/core/agent-session-runtime.js +300 -0
  44. package/dist/core/agent-session-runtime.js.map +1 -0
  45. package/dist/core/agent-session-services.d.ts +86 -0
  46. package/dist/core/agent-session-services.d.ts.map +1 -0
  47. package/dist/core/agent-session-services.js +117 -0
  48. package/dist/core/agent-session-services.js.map +1 -0
  49. package/dist/core/agent-session.d.ts +63 -82
  50. package/dist/core/agent-session.d.ts.map +1 -1
  51. package/dist/core/agent-session.js +674 -628
  52. package/dist/core/agent-session.js.map +1 -1
  53. package/dist/core/api-key-store.d.ts +87 -0
  54. package/dist/core/api-key-store.d.ts.map +1 -0
  55. package/dist/core/api-key-store.js +168 -0
  56. package/dist/core/api-key-store.js.map +1 -0
  57. package/dist/core/auth-guidance.d.ts +5 -0
  58. package/dist/core/auth-guidance.d.ts.map +1 -0
  59. package/dist/core/auth-guidance.js +21 -0
  60. package/dist/core/auth-guidance.js.map +1 -0
  61. package/dist/core/auth-storage.d.ts +12 -5
  62. package/dist/core/auth-storage.d.ts.map +1 -1
  63. package/dist/core/auth-storage.js +34 -8
  64. package/dist/core/auth-storage.js.map +1 -1
  65. package/dist/core/bash-executor.d.ts +0 -15
  66. package/dist/core/bash-executor.d.ts.map +1 -1
  67. package/dist/core/bash-executor.js +28 -129
  68. package/dist/core/bash-executor.js.map +1 -1
  69. package/dist/core/compaction/branch-summarization.d.ts +2 -0
  70. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  71. package/dist/core/compaction/branch-summarization.js +3 -2
  72. package/dist/core/compaction/branch-summarization.js.map +1 -1
  73. package/dist/core/compaction/compaction.d.ts +4 -4
  74. package/dist/core/compaction/compaction.d.ts.map +1 -1
  75. package/dist/core/compaction/compaction.js +32 -27
  76. package/dist/core/compaction/compaction.js.map +1 -1
  77. package/dist/core/compaction/index.d.ts.map +1 -1
  78. package/dist/core/compaction/utils.d.ts.map +1 -1
  79. package/dist/core/compaction/utils.js.map +1 -1
  80. package/dist/core/config-watcher.d.ts +47 -0
  81. package/dist/core/config-watcher.d.ts.map +1 -0
  82. package/dist/core/config-watcher.js +135 -0
  83. package/dist/core/config-watcher.js.map +1 -0
  84. package/dist/core/default-models.json +80 -0
  85. package/dist/core/defaults.d.ts.map +1 -1
  86. package/dist/core/diagnostics.d.ts.map +1 -1
  87. package/dist/core/event-bus.d.ts.map +1 -1
  88. package/dist/core/event-bus.js.map +1 -1
  89. package/dist/core/exec.d.ts.map +1 -1
  90. package/dist/core/exec.js +7 -3
  91. package/dist/core/exec.js.map +1 -1
  92. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  93. package/dist/core/export-html/ansi-to-html.js +1 -1
  94. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  95. package/dist/core/export-html/index.d.ts +7 -4
  96. package/dist/core/export-html/index.d.ts.map +1 -1
  97. package/dist/core/export-html/index.js +15 -13
  98. package/dist/core/export-html/index.js.map +1 -1
  99. package/dist/core/export-html/template.css +112 -17
  100. package/dist/core/export-html/template.html +1 -0
  101. package/dist/core/export-html/template.js +312 -64
  102. package/dist/core/export-html/tool-renderer.d.ts +9 -10
  103. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  104. package/dist/core/export-html/tool-renderer.js +61 -16
  105. package/dist/core/export-html/tool-renderer.js.map +1 -1
  106. package/dist/core/extensions/index.d.ts +5 -4
  107. package/dist/core/extensions/index.d.ts.map +1 -1
  108. package/dist/core/extensions/index.js +2 -2
  109. package/dist/core/extensions/index.js.map +1 -1
  110. package/dist/core/extensions/loader.d.ts +0 -1
  111. package/dist/core/extensions/loader.d.ts.map +1 -1
  112. package/dist/core/extensions/loader.js +98 -18
  113. package/dist/core/extensions/loader.js.map +1 -1
  114. package/dist/core/extensions/runner.d.ts +27 -14
  115. package/dist/core/extensions/runner.d.ts.map +1 -1
  116. package/dist/core/extensions/runner.js +299 -115
  117. package/dist/core/extensions/runner.js.map +1 -1
  118. package/dist/core/extensions/types.d.ts +200 -44
  119. package/dist/core/extensions/types.d.ts.map +1 -1
  120. package/dist/core/extensions/types.js +10 -0
  121. package/dist/core/extensions/types.js.map +1 -1
  122. package/dist/core/extensions/wrapper.d.ts +4 -11
  123. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  124. package/dist/core/extensions/wrapper.js +7 -87
  125. package/dist/core/extensions/wrapper.js.map +1 -1
  126. package/dist/core/footer-data-provider.d.ts +22 -2
  127. package/dist/core/footer-data-provider.d.ts.map +1 -1
  128. package/dist/core/footer-data-provider.js +225 -49
  129. package/dist/core/footer-data-provider.js.map +1 -1
  130. package/dist/core/index.d.ts +5 -2
  131. package/dist/core/index.d.ts.map +1 -1
  132. package/dist/core/index.js +5 -2
  133. package/dist/core/index.js.map +1 -1
  134. package/dist/core/keybindings.d.ts +348 -50
  135. package/dist/core/keybindings.d.ts.map +1 -1
  136. package/dist/core/keybindings.js +276 -132
  137. package/dist/core/keybindings.js.map +1 -1
  138. package/dist/core/messages.d.ts.map +1 -1
  139. package/dist/core/messages.js.map +1 -1
  140. package/dist/core/model-registry.d.ts +41 -5
  141. package/dist/core/model-registry.d.ts.map +1 -1
  142. package/dist/core/model-registry.js +316 -136
  143. package/dist/core/model-registry.js.map +1 -1
  144. package/dist/core/model-resolver.d.ts +6 -0
  145. package/dist/core/model-resolver.d.ts.map +1 -1
  146. package/dist/core/model-resolver.js +70 -37
  147. package/dist/core/model-resolver.js.map +1 -1
  148. package/dist/core/output-guard.d.ts +6 -0
  149. package/dist/core/output-guard.d.ts.map +1 -0
  150. package/dist/core/output-guard.js +59 -0
  151. package/dist/core/output-guard.js.map +1 -0
  152. package/dist/core/package-manager.d.ts +49 -7
  153. package/dist/core/package-manager.d.ts.map +1 -1
  154. package/dist/core/package-manager.js +655 -122
  155. package/dist/core/package-manager.js.map +1 -1
  156. package/dist/core/prompt-templates.d.ts +12 -10
  157. package/dist/core/prompt-templates.d.ts.map +1 -1
  158. package/dist/core/prompt-templates.js +37 -38
  159. package/dist/core/prompt-templates.js.map +1 -1
  160. package/dist/core/provider-display-names.d.ts +2 -0
  161. package/dist/core/provider-display-names.d.ts.map +1 -0
  162. package/dist/core/provider-display-names.js +33 -0
  163. package/dist/core/provider-display-names.js.map +1 -0
  164. package/dist/core/resolve-config-value.d.ts +6 -0
  165. package/dist/core/resolve-config-value.d.ts.map +1 -1
  166. package/dist/core/resolve-config-value.js +75 -8
  167. package/dist/core/resolve-config-value.js.map +1 -1
  168. package/dist/core/resource-loader.d.ts +18 -8
  169. package/dist/core/resource-loader.d.ts.map +1 -1
  170. package/dist/core/resource-loader.js +217 -123
  171. package/dist/core/resource-loader.js.map +1 -1
  172. package/dist/core/sdk.d.ts +25 -8
  173. package/dist/core/sdk.d.ts.map +1 -1
  174. package/dist/core/sdk.js +84 -37
  175. package/dist/core/sdk.js.map +1 -1
  176. package/dist/core/session-cwd.d.ts +19 -0
  177. package/dist/core/session-cwd.d.ts.map +1 -0
  178. package/dist/core/session-cwd.js +38 -0
  179. package/dist/core/session-cwd.js.map +1 -0
  180. package/dist/core/session-manager.d.ts +11 -1
  181. package/dist/core/session-manager.d.ts.map +1 -1
  182. package/dist/core/session-manager.js +42 -27
  183. package/dist/core/session-manager.js.map +1 -1
  184. package/dist/core/settings-manager.d.ts +34 -5
  185. package/dist/core/settings-manager.d.ts.map +1 -1
  186. package/dist/core/settings-manager.js +113 -13
  187. package/dist/core/settings-manager.js.map +1 -1
  188. package/dist/core/skills.d.ts +13 -11
  189. package/dist/core/skills.d.ts.map +1 -1
  190. package/dist/core/skills.js +59 -19
  191. package/dist/core/skills.js.map +1 -1
  192. package/dist/core/slash-commands.d.ts +2 -3
  193. package/dist/core/slash-commands.d.ts.map +1 -1
  194. package/dist/core/slash-commands.js +9 -6
  195. package/dist/core/slash-commands.js.map +1 -1
  196. package/dist/core/source-info.d.ts +18 -0
  197. package/dist/core/source-info.d.ts.map +1 -0
  198. package/dist/core/source-info.js +19 -0
  199. package/dist/core/source-info.js.map +1 -0
  200. package/dist/core/system-prompt.d.ts +3 -3
  201. package/dist/core/system-prompt.d.ts.map +1 -1
  202. package/dist/core/system-prompt.js +16 -55
  203. package/dist/core/system-prompt.js.map +1 -1
  204. package/dist/core/telemetry.d.ts +3 -0
  205. package/dist/core/telemetry.d.ts.map +1 -0
  206. package/dist/core/telemetry.js +9 -0
  207. package/dist/core/telemetry.js.map +1 -0
  208. package/dist/core/timings.d.ts +1 -0
  209. package/dist/core/timings.d.ts.map +1 -1
  210. package/dist/core/timings.js +6 -0
  211. package/dist/core/timings.js.map +1 -1
  212. package/dist/core/tools/bash.d.ts +27 -14
  213. package/dist/core/tools/bash.d.ts.map +1 -1
  214. package/dist/core/tools/bash.js +301 -208
  215. package/dist/core/tools/bash.js.map +1 -1
  216. package/dist/core/tools/edit-diff.d.ts +23 -1
  217. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  218. package/dist/core/tools/edit-diff.js +154 -59
  219. package/dist/core/tools/edit-diff.js.map +1 -1
  220. package/dist/core/tools/edit.d.ts +22 -12
  221. package/dist/core/tools/edit.d.ts.map +1 -1
  222. package/dist/core/tools/edit.js +243 -65
  223. package/dist/core/tools/edit.js.map +1 -1
  224. package/dist/core/tools/file-mutation-queue.d.ts +6 -0
  225. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  226. package/dist/core/tools/file-mutation-queue.js +37 -0
  227. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  228. package/dist/core/tools/find.d.ts +10 -14
  229. package/dist/core/tools/find.d.ts.map +1 -1
  230. package/dist/core/tools/find.js +202 -110
  231. package/dist/core/tools/find.js.map +1 -1
  232. package/dist/core/tools/grep.d.ts +14 -22
  233. package/dist/core/tools/grep.d.ts.map +1 -1
  234. package/dist/core/tools/grep.js +100 -35
  235. package/dist/core/tools/grep.js.map +1 -1
  236. package/dist/core/tools/index.d.ts +27 -60
  237. package/dist/core/tools/index.d.ts.map +1 -1
  238. package/dist/core/tools/index.js +96 -45
  239. package/dist/core/tools/index.js.map +1 -1
  240. package/dist/core/tools/ls.d.ts +8 -11
  241. package/dist/core/tools/ls.d.ts.map +1 -1
  242. package/dist/core/tools/ls.js +66 -15
  243. package/dist/core/tools/ls.js.map +1 -1
  244. package/dist/core/tools/output-accumulator.d.ts +50 -0
  245. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  246. package/dist/core/tools/output-accumulator.js +178 -0
  247. package/dist/core/tools/output-accumulator.js.map +1 -0
  248. package/dist/core/tools/path-utils.d.ts.map +1 -1
  249. package/dist/core/tools/path-utils.js +1 -1
  250. package/dist/core/tools/path-utils.js.map +1 -1
  251. package/dist/core/tools/read.d.ts +9 -13
  252. package/dist/core/tools/read.d.ts.map +1 -1
  253. package/dist/core/tools/read.js +175 -52
  254. package/dist/core/tools/read.js.map +1 -1
  255. package/dist/core/tools/render-utils.d.ts +21 -0
  256. package/dist/core/tools/render-utils.d.ts.map +1 -0
  257. package/dist/core/tools/render-utils.js +49 -0
  258. package/dist/core/tools/render-utils.js.map +1 -0
  259. package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  260. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  261. package/dist/core/tools/tool-definition-wrapper.js +34 -0
  262. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  263. package/dist/core/tools/truncate.d.ts.map +1 -1
  264. package/dist/core/tools/truncate.js.map +1 -1
  265. package/dist/core/tools/write.d.ts +8 -11
  266. package/dist/core/tools/write.d.ts.map +1 -1
  267. package/dist/core/tools/write.js +167 -32
  268. package/dist/core/tools/write.js.map +1 -1
  269. package/dist/index.d.ts +12 -9
  270. package/dist/index.d.ts.map +1 -1
  271. package/dist/index.js +12 -10
  272. package/dist/index.js.map +1 -1
  273. package/dist/main.d.ts +5 -1
  274. package/dist/main.d.ts.map +1 -1
  275. package/dist/main.js +326 -404
  276. package/dist/main.js.map +1 -1
  277. package/dist/migrations.d.ts +2 -2
  278. package/dist/migrations.d.ts.map +1 -1
  279. package/dist/migrations.js +24 -4
  280. package/dist/migrations.js.map +1 -1
  281. package/dist/modes/index.d.ts.map +1 -1
  282. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  283. package/dist/modes/interactive/components/armin.js +10 -6
  284. package/dist/modes/interactive/components/armin.js.map +1 -1
  285. package/dist/modes/interactive/components/assistant-message.d.ts +5 -1
  286. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  287. package/dist/modes/interactive/components/assistant-message.js +32 -3
  288. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  289. package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
  290. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  291. package/dist/modes/interactive/components/bash-execution.js +31 -12
  292. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  293. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  294. package/dist/modes/interactive/components/bordered-loader.js +7 -1
  295. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  296. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  297. package/dist/modes/interactive/components/branch-summary-message.js +5 -3
  298. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  299. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  300. package/dist/modes/interactive/components/compaction-summary-message.js +5 -3
  301. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  302. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  303. package/dist/modes/interactive/components/config-selector.js +49 -16
  304. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  305. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  306. package/dist/modes/interactive/components/countdown-timer.js +5 -0
  307. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  308. package/dist/modes/interactive/components/custom-editor.d.ts +3 -3
  309. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  310. package/dist/modes/interactive/components/custom-editor.js +14 -7
  311. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  312. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  313. package/dist/modes/interactive/components/custom-message.js +6 -1
  314. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  315. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  316. package/dist/modes/interactive/components/daxnuts.js +8 -6
  317. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  318. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  319. package/dist/modes/interactive/components/diff.js.map +1 -1
  320. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  321. package/dist/modes/interactive/components/dynamic-border.js +1 -0
  322. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  323. package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  324. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
  325. package/dist/modes/interactive/components/earendil-announcement.js +40 -0
  326. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
  327. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  328. package/dist/modes/interactive/components/extension-editor.js +16 -10
  329. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  330. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  331. package/dist/modes/interactive/components/extension-input.js +13 -7
  332. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  333. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  334. package/dist/modes/interactive/components/extension-selector.js +18 -11
  335. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  336. package/dist/modes/interactive/components/footer.d.ts +1 -0
  337. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  338. package/dist/modes/interactive/components/footer.js +7 -2
  339. package/dist/modes/interactive/components/footer.js.map +1 -1
  340. package/dist/modes/interactive/components/index.d.ts +1 -1
  341. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  342. package/dist/modes/interactive/components/index.js +1 -1
  343. package/dist/modes/interactive/components/index.js.map +1 -1
  344. package/dist/modes/interactive/components/keybinding-hints.d.ts +8 -36
  345. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  346. package/dist/modes/interactive/components/keybinding-hints.js +23 -48
  347. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  348. package/dist/modes/interactive/components/login-dialog.d.ts +5 -1
  349. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  350. package/dist/modes/interactive/components/login-dialog.js +35 -14
  351. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  352. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  353. package/dist/modes/interactive/components/model-selector.js +41 -22
  354. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  355. package/dist/modes/interactive/components/oauth-selector.d.ts +18 -6
  356. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  357. package/dist/modes/interactive/components/oauth-selector.js +104 -31
  358. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  359. package/dist/modes/interactive/components/scoped-models-selector.d.ts +5 -12
  360. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  361. package/dist/modes/interactive/components/scoped-models-selector.js +61 -42
  362. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  363. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  364. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  365. package/dist/modes/interactive/components/session-selector.d.ts +2 -1
  366. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/session-selector.js +109 -73
  368. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  369. package/dist/modes/interactive/components/settings-selector.d.ts +9 -0
  370. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  371. package/dist/modes/interactive/components/settings-selector.js +84 -4
  372. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  373. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  374. package/dist/modes/interactive/components/show-images-selector.js +6 -1
  375. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  376. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  377. package/dist/modes/interactive/components/skill-invocation-message.js +5 -3
  378. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  379. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  380. package/dist/modes/interactive/components/theme-selector.js +7 -1
  381. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  382. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  383. package/dist/modes/interactive/components/thinking-selector.js +6 -1
  384. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  385. package/dist/modes/interactive/components/tool-execution.d.ts +20 -34
  386. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  387. package/dist/modes/interactive/components/tool-execution.js +158 -636
  388. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  389. package/dist/modes/interactive/components/tree-selector.d.ts +21 -2
  390. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  391. package/dist/modes/interactive/components/tree-selector.js +224 -52
  392. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  393. package/dist/modes/interactive/components/user-message-selector.d.ts +2 -2
  394. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  395. package/dist/modes/interactive/components/user-message-selector.js +20 -16
  396. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  397. package/dist/modes/interactive/components/user-message.d.ts +1 -0
  398. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  399. package/dist/modes/interactive/components/user-message.js +8 -6
  400. package/dist/modes/interactive/components/user-message.js.map +1 -1
  401. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  402. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  403. package/dist/modes/interactive/interactive-mode.d.ts +67 -39
  404. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  405. package/dist/modes/interactive/interactive-mode.js +1556 -680
  406. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  407. package/dist/modes/interactive/theme/dark.json +1 -1
  408. package/dist/modes/interactive/theme/light.json +1 -1
  409. package/dist/modes/interactive/theme/theme.d.ts +3 -0
  410. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  411. package/dist/modes/interactive/theme/theme.js +101 -72
  412. package/dist/modes/interactive/theme/theme.js.map +1 -1
  413. package/dist/modes/print-mode.d.ts +2 -2
  414. package/dist/modes/print-mode.d.ts.map +1 -1
  415. package/dist/modes/print-mode.js +107 -77
  416. package/dist/modes/print-mode.js.map +1 -1
  417. package/dist/modes/rpc/jsonl.d.ts +17 -0
  418. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  419. package/dist/modes/rpc/jsonl.js +49 -0
  420. package/dist/modes/rpc/jsonl.js.map +1 -0
  421. package/dist/modes/rpc/rpc-client.d.ts +8 -1
  422. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  423. package/dist/modes/rpc/rpc-client.js +22 -16
  424. package/dist/modes/rpc/rpc-client.js.map +1 -1
  425. package/dist/modes/rpc/rpc-mode.d.ts +2 -2
  426. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  427. package/dist/modes/rpc/rpc-mode.js +184 -94
  428. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  429. package/dist/modes/rpc/rpc-types.d.ts +14 -4
  430. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  431. package/dist/modes/rpc/rpc-types.js.map +1 -1
  432. package/dist/package-manager-cli.d.ts +4 -0
  433. package/dist/package-manager-cli.d.ts.map +1 -0
  434. package/dist/package-manager-cli.js +460 -0
  435. package/dist/package-manager-cli.js.map +1 -0
  436. package/dist/utils/changelog.d.ts.map +1 -1
  437. package/dist/utils/changelog.js.map +1 -1
  438. package/dist/utils/child-process.d.ts +12 -0
  439. package/dist/utils/child-process.d.ts.map +1 -0
  440. package/dist/utils/child-process.js +86 -0
  441. package/dist/utils/child-process.js.map +1 -0
  442. package/dist/utils/clipboard-image.d.ts.map +1 -1
  443. package/dist/utils/clipboard-image.js +94 -11
  444. package/dist/utils/clipboard-image.js.map +1 -1
  445. package/dist/utils/clipboard-native.d.ts +1 -0
  446. package/dist/utils/clipboard-native.d.ts.map +1 -1
  447. package/dist/utils/clipboard-native.js.map +1 -1
  448. package/dist/utils/clipboard.d.ts +1 -1
  449. package/dist/utils/clipboard.d.ts.map +1 -1
  450. package/dist/utils/clipboard.js +96 -46
  451. package/dist/utils/clipboard.js.map +1 -1
  452. package/dist/utils/exif-orientation.d.ts +5 -0
  453. package/dist/utils/exif-orientation.d.ts.map +1 -0
  454. package/dist/utils/exif-orientation.js +158 -0
  455. package/dist/utils/exif-orientation.js.map +1 -0
  456. package/dist/utils/frontmatter.d.ts.map +1 -1
  457. package/dist/utils/frontmatter.js.map +1 -1
  458. package/dist/utils/fs-watch.d.ts +5 -0
  459. package/dist/utils/fs-watch.d.ts.map +1 -0
  460. package/dist/utils/fs-watch.js +25 -0
  461. package/dist/utils/fs-watch.js.map +1 -0
  462. package/dist/utils/git.d.ts.map +1 -1
  463. package/dist/utils/git.js.map +1 -1
  464. package/dist/utils/image-convert.d.ts.map +1 -1
  465. package/dist/utils/image-convert.js +5 -1
  466. package/dist/utils/image-convert.js.map +1 -1
  467. package/dist/utils/image-resize.d.ts +5 -5
  468. package/dist/utils/image-resize.d.ts.map +1 -1
  469. package/dist/utils/image-resize.js +51 -95
  470. package/dist/utils/image-resize.js.map +1 -1
  471. package/dist/utils/mime.d.ts.map +1 -1
  472. package/dist/utils/mime.js.map +1 -1
  473. package/dist/utils/paths.d.ts +16 -0
  474. package/dist/utils/paths.d.ts.map +1 -0
  475. package/dist/utils/paths.js +50 -0
  476. package/dist/utils/paths.js.map +1 -0
  477. package/dist/utils/photon.d.ts.map +1 -1
  478. package/dist/utils/photon.js.map +1 -1
  479. package/dist/utils/pi-user-agent.d.ts +2 -0
  480. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  481. package/dist/utils/pi-user-agent.js +5 -0
  482. package/dist/utils/pi-user-agent.js.map +1 -0
  483. package/dist/utils/shell.d.ts +10 -6
  484. package/dist/utils/shell.d.ts.map +1 -1
  485. package/dist/utils/shell.js +29 -25
  486. package/dist/utils/shell.js.map +1 -1
  487. package/dist/utils/sleep.d.ts.map +1 -1
  488. package/dist/utils/sleep.js.map +1 -1
  489. package/dist/utils/tools-manager.d.ts.map +1 -1
  490. package/dist/utils/tools-manager.js +11 -6
  491. package/dist/utils/tools-manager.js.map +1 -1
  492. package/dist/utils/version-check.d.ts +14 -0
  493. package/dist/utils/version-check.d.ts.map +1 -0
  494. package/dist/utils/version-check.js +77 -0
  495. package/dist/utils/version-check.js.map +1 -0
  496. package/docs/compaction.md +394 -0
  497. package/docs/custom-provider.md +646 -0
  498. package/docs/development.md +71 -0
  499. package/docs/docs.json +148 -0
  500. package/docs/extensions.md +2596 -0
  501. package/docs/images/doom-extension.png +0 -0
  502. package/docs/images/exy.png +0 -0
  503. package/docs/images/interactive-mode.png +0 -0
  504. package/docs/images/tree-view.png +0 -0
  505. package/docs/index.md +70 -0
  506. package/docs/json.md +82 -0
  507. package/docs/keybindings.md +197 -0
  508. package/docs/models.md +474 -0
  509. package/docs/packages.md +223 -0
  510. package/docs/prompt-templates.md +88 -0
  511. package/docs/providers.md +243 -0
  512. package/docs/quickstart.md +142 -0
  513. package/docs/rpc.md +1407 -0
  514. package/docs/sdk.md +1149 -0
  515. package/docs/session-format.md +412 -0
  516. package/docs/sessions.md +137 -0
  517. package/docs/settings.md +279 -0
  518. package/docs/shell-aliases.md +13 -0
  519. package/docs/skills.md +232 -0
  520. package/docs/terminal-setup.md +106 -0
  521. package/docs/termux.md +127 -0
  522. package/docs/themes.md +295 -0
  523. package/docs/tmux.md +61 -0
  524. package/docs/tui.md +918 -0
  525. package/docs/usage.md +277 -0
  526. package/docs/windows.md +17 -0
  527. package/examples/README.md +25 -0
  528. package/examples/extensions/README.md +208 -0
  529. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  530. package/examples/extensions/bash-spawn-hook.ts +30 -0
  531. package/examples/extensions/bookmark.ts +50 -0
  532. package/examples/extensions/border-status-editor.ts +150 -0
  533. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  534. package/examples/extensions/claude-rules.ts +86 -0
  535. package/examples/extensions/commands.ts +72 -0
  536. package/examples/extensions/confirm-destructive.ts +59 -0
  537. package/examples/extensions/custom-compaction.ts +127 -0
  538. package/examples/extensions/custom-footer.ts +64 -0
  539. package/examples/extensions/custom-header.ts +73 -0
  540. package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
  541. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  542. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  543. package/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
  544. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  545. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  546. package/examples/extensions/dirty-repo-guard.ts +56 -0
  547. package/examples/extensions/doom-overlay/README.md +46 -0
  548. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  549. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  550. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  551. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  552. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  553. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  554. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  555. package/examples/extensions/doom-overlay/index.ts +74 -0
  556. package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  557. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  558. package/examples/extensions/dynamic-resources/dynamic.json +79 -0
  559. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  560. package/examples/extensions/dynamic-resources/index.ts +15 -0
  561. package/examples/extensions/dynamic-tools.ts +74 -0
  562. package/examples/extensions/event-bus.ts +43 -0
  563. package/examples/extensions/file-trigger.ts +41 -0
  564. package/examples/extensions/git-checkpoint.ts +53 -0
  565. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  566. package/examples/extensions/handoff.ts +191 -0
  567. package/examples/extensions/hello.ts +26 -0
  568. package/examples/extensions/hidden-thinking-label.ts +53 -0
  569. package/examples/extensions/inline-bash.ts +94 -0
  570. package/examples/extensions/input-transform.ts +43 -0
  571. package/examples/extensions/interactive-shell.ts +196 -0
  572. package/examples/extensions/mac-system-theme.ts +47 -0
  573. package/examples/extensions/message-renderer.ts +59 -0
  574. package/examples/extensions/minimal-mode.ts +426 -0
  575. package/examples/extensions/modal-editor.ts +85 -0
  576. package/examples/extensions/model-status.ts +31 -0
  577. package/examples/extensions/notify.ts +55 -0
  578. package/examples/extensions/overlay-qa-tests.ts +1348 -0
  579. package/examples/extensions/overlay-test.ts +150 -0
  580. package/examples/extensions/permission-gate.ts +34 -0
  581. package/examples/extensions/pirate.ts +47 -0
  582. package/examples/extensions/plan-mode/README.md +65 -0
  583. package/examples/extensions/plan-mode/index.ts +340 -0
  584. package/examples/extensions/plan-mode/utils.ts +168 -0
  585. package/examples/extensions/preset.ts +430 -0
  586. package/examples/extensions/prompt-customizer.ts +97 -0
  587. package/examples/extensions/protected-paths.ts +30 -0
  588. package/examples/extensions/provider-payload.ts +18 -0
  589. package/examples/extensions/qna.ts +122 -0
  590. package/examples/extensions/question.ts +264 -0
  591. package/examples/extensions/questionnaire.ts +427 -0
  592. package/examples/extensions/rainbow-editor.ts +88 -0
  593. package/examples/extensions/reload-runtime.ts +37 -0
  594. package/examples/extensions/rpc-demo.ts +118 -0
  595. package/examples/extensions/sandbox/index.ts +321 -0
  596. package/examples/extensions/sandbox/package-lock.json +92 -0
  597. package/examples/extensions/sandbox/package.json +19 -0
  598. package/examples/extensions/send-user-message.ts +97 -0
  599. package/examples/extensions/session-name.ts +27 -0
  600. package/examples/extensions/shutdown-command.ts +63 -0
  601. package/examples/extensions/snake.ts +343 -0
  602. package/examples/extensions/space-invaders.ts +560 -0
  603. package/examples/extensions/ssh.ts +220 -0
  604. package/examples/extensions/status-line.ts +32 -0
  605. package/examples/extensions/structured-output.ts +65 -0
  606. package/examples/extensions/subagent/README.md +172 -0
  607. package/examples/extensions/subagent/agents/planner.md +37 -0
  608. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  609. package/examples/extensions/subagent/agents/scout.md +50 -0
  610. package/examples/extensions/subagent/agents/worker.md +24 -0
  611. package/examples/extensions/subagent/agents.ts +126 -0
  612. package/examples/extensions/subagent/index.ts +987 -0
  613. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  614. package/examples/extensions/subagent/prompts/implement.md +10 -0
  615. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  616. package/examples/extensions/summarize.ts +206 -0
  617. package/examples/extensions/system-prompt-header.ts +17 -0
  618. package/examples/extensions/tic-tac-toe.ts +1008 -0
  619. package/examples/extensions/timed-confirm.ts +70 -0
  620. package/examples/extensions/titlebar-spinner.ts +58 -0
  621. package/examples/extensions/todo.ts +297 -0
  622. package/examples/extensions/tool-override.ts +144 -0
  623. package/examples/extensions/tools.ts +141 -0
  624. package/examples/extensions/trigger-compact.ts +50 -0
  625. package/examples/extensions/truncated-tool.ts +195 -0
  626. package/examples/extensions/widget-placement.ts +9 -0
  627. package/examples/extensions/with-deps/index.ts +32 -0
  628. package/examples/extensions/with-deps/package-lock.json +31 -0
  629. package/examples/extensions/with-deps/package.json +22 -0
  630. package/examples/extensions/working-indicator.ts +123 -0
  631. package/examples/extensions/working-message-test.ts +25 -0
  632. package/examples/rpc-extension-ui.ts +632 -0
  633. package/examples/sdk/01-minimal.ts +22 -0
  634. package/examples/sdk/02-custom-model.ts +49 -0
  635. package/examples/sdk/03-custom-prompt.ts +62 -0
  636. package/examples/sdk/04-skills.ts +55 -0
  637. package/examples/sdk/05-tools.ts +44 -0
  638. package/examples/sdk/06-extensions.ts +90 -0
  639. package/examples/sdk/07-context-files.ts +42 -0
  640. package/examples/sdk/08-prompt-templates.ts +51 -0
  641. package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
  642. package/examples/sdk/10-settings.ts +53 -0
  643. package/examples/sdk/11-sessions.ts +48 -0
  644. package/examples/sdk/12-full-control.ts +73 -0
  645. package/examples/sdk/13-session-runtime.ts +67 -0
  646. package/examples/sdk/README.md +147 -0
  647. package/extensions/phi/init.ts +15 -1
  648. package/extensions/phi/keys.ts +186 -0
  649. package/extensions/phi/providers/alibaba.ts +126 -0
  650. package/extensions/phi/providers/opencode-go.ts +204 -0
  651. package/extensions/phi/setup.ts +692 -0
  652. package/extensions/phi/smart-router.ts +8 -0
  653. package/extensions/phi/web-search.ts +432 -186
  654. package/package.json +111 -106
  655. package/scripts/copy-assets.sh +0 -0
  656. package/scripts/migrate-sessions.sh +0 -0
package/README.md CHANGED
@@ -1,554 +1,653 @@
1
1
  <p align="center">
2
- <h1 align="center">Φ Phi Code</h1>
3
- <p align="center"><strong>The Ultimate Open-Source Coding Agent</strong></p>
4
- <p align="center">Built on <a href="https://github.com/badlogic/pi-mono">Pi</a> — supercharged with memory, sub-agents, orchestration, and smart routing.</p>
2
+ <a href="https://pi.dev">
3
+ <img alt="pi logo" src="https://pi.dev/logo-auto.svg" width="128">
4
+ </a>
5
+ </p>
6
+ <p align="center">
7
+ <a href="https://discord.com/invite/3cU7Bz4UPx"><img alt="Discord" src="https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white" /></a>
8
+ <a href="https://www.npmjs.com/package/@earendil-works/pi-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@earendil-works/pi-coding-agent?style=flat-square" /></a>
5
9
  </p>
6
-
7
10
  <p align="center">
8
- <a href="https://www.npmjs.com/package/@phi-code-admin/phi-code"><img alt="npm" src="https://img.shields.io/npm/v/@phi-code-admin/phi-code?style=flat-square&label=npm" /></a>
9
- <a href="https://github.com/uglyswap/phi-code"><img alt="GitHub" src="https://img.shields.io/badge/github-phi--code-181717?style=flat-square&logo=github" /></a>
10
- <a href="https://github.com/uglyswap/phi-code/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/badge/license-MIT-green?style=flat-square" /></a>
11
+ <a href="https://pi.dev">pi.dev</a> domain graciously donated by
12
+ <br /><br />
13
+ <a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
11
14
  </p>
12
15
 
16
+ > New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See [CONTRIBUTING.md](../../CONTRIBUTING.md).
17
+
13
18
  ---
14
19
 
15
- ## What is Phi Code?
20
+ Pi is a minimal terminal coding harness. Adapt pi to your workflows, not the other way around, without having to fork and modify pi internals. Extend it with TypeScript [Extensions](#extensions), [Skills](#skills), [Prompt Templates](#prompt-templates), and [Themes](#themes). Put your extensions, skills, prompt templates, and themes in [Pi Packages](#pi-packages) and share them with others via npm or git.
16
21
 
17
- Phi Code is a **production-grade** coding agent for the terminal. It extends [Pi](https://github.com/badlogic/pi-mono) (the minimal terminal coding harness) with everything you need for serious development work:
22
+ Pi ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask pi to build what you want or install a third party pi package that matches your workflow.
18
23
 
19
- - 🧠 **Persistent Memory** Notes, ontology, and vector search across sessions
20
- - 🤖 **5 Sub-Agents** — Specialized agents for code, exploration, planning, review, and testing
21
- - 🎯 **Smart Routing** — Automatically assigns the right model to the right task
22
- - 📋 **Orchestrator** — Plan complex projects, execute with parallel sub-agents
23
- - 🔍 **Web Search** — Brave API integration for real-time research
24
- - ⚡ **Benchmark** — Test your models and find the best ones for each role
25
- - 🧩 **12 Built-in Skills** — API design, security, testing, DevOps, and more
26
- - 🔌 **Provider-Neutral** — Works with any OpenAI-compatible API
24
+ Pi runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps. See [openclaw/openclaw](https://github.com/openclaw/openclaw) for a real-world SDK integration.
27
25
 
28
- **Phi Code works with any LLM provider:** Alibaba Cloud, OpenAI, Anthropic, Google, OpenRouter, Groq, Ollama, LM Studio, and more.
26
+ ## Share your OSS coding agent sessions
29
27
 
30
- ---
28
+ If you use pi for open source work, please share your coding agent sessions.
29
+
30
+ Public OSS session data helps improve models, prompts, tools, and evaluations using real development workflows.
31
+
32
+ For the full explanation, see [this post on X](https://x.com/badlogicgames/status/2037811643774652911).
33
+
34
+ To publish sessions, use [`badlogic/pi-share-hf`](https://github.com/badlogic/pi-share-hf). Read its README.md for setup instructions. All you need is a Hugging Face account, the Hugging Face CLI, and `pi-share-hf`.
35
+
36
+ You can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `pi-mono` sessions.
37
+
38
+ I regularly publish my own `pi-mono` work sessions here:
39
+
40
+ - [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)
31
41
 
32
42
  ## Table of Contents
33
43
 
34
44
  - [Quick Start](#quick-start)
35
- - [Setup Wizard](#setup-wizard)
36
- - [API Key Management](#api-key-management)
37
45
  - [Providers & Models](#providers--models)
38
- - [Commands](#commands)
39
- - [Sub-Agents](#sub-agents)
40
- - [Orchestrator](#orchestrator)
41
- - [Memory System](#memory-system)
42
- - [Smart Routing](#smart-routing)
43
- - [Benchmark](#benchmark)
44
- - [Skills](#skills)
45
- - [Extensions](#extensions)
46
- - [Configuration Files](#configuration-files)
47
- - [Keyboard Shortcuts](#keyboard-shortcuts)
46
+ - [Interactive Mode](#interactive-mode)
47
+ - [Editor](#editor)
48
+ - [Commands](#commands)
49
+ - [Keyboard Shortcuts](#keyboard-shortcuts)
50
+ - [Message Queue](#message-queue)
48
51
  - [Sessions](#sessions)
49
- - [CLI Reference](#cli-reference)
52
+ - [Branching](#branching)
53
+ - [Compaction](#compaction)
54
+ - [Settings](#settings)
55
+ - [Context Files](#context-files)
56
+ - [Customization](#customization)
57
+ - [Prompt Templates](#prompt-templates)
58
+ - [Skills](#skills)
59
+ - [Extensions](#extensions)
60
+ - [Themes](#themes)
61
+ - [Pi Packages](#pi-packages)
62
+ - [Programmatic Usage](#programmatic-usage)
50
63
  - [Philosophy](#philosophy)
51
- - [Credits](#credits)
64
+ - [CLI Reference](#cli-reference)
52
65
 
53
66
  ---
54
67
 
55
68
  ## Quick Start
56
69
 
57
- ### Install
58
-
59
70
  ```bash
60
- npm install -g @phi-code-admin/phi-code
71
+ curl -fsSL https://pi.dev/install.sh | sh
61
72
  ```
62
73
 
63
- The installer automatically sets up:
64
- - 9 extensions → `~/.phi/agent/extensions/`
65
- - 5 sub-agent definitions → `~/.phi/agent/agents/`
66
- - 12 skills → `~/.phi/agent/skills/`
67
-
68
- ### First Run
74
+ Or with npm:
69
75
 
70
76
  ```bash
71
- phi
77
+ npm install -g @earendil-works/pi-coding-agent
72
78
  ```
73
79
 
74
- Then run the setup wizard:
80
+ Authenticate with an API key:
75
81
 
82
+ ```bash
83
+ export ANTHROPIC_API_KEY=sk-ant-...
84
+ pi
76
85
  ```
77
- /phi-init
86
+
87
+ Or use your existing subscription:
88
+
89
+ ```bash
90
+ pi
91
+ /login # Then select provider
78
92
  ```
79
93
 
80
- The wizard will:
81
- 1. Ask you to **choose a provider** (numbered list)
82
- 2. Ask you to **paste your API key**
83
- 3. **Save everything** to `~/.phi/agent/models.json` (persistent)
84
- 4. Let you **choose models** for each role
94
+ Then just talk to pi. By default, pi gives the model four tools: `read`, `write`, `edit`, and `bash`. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [pi packages](#pi-packages).
85
95
 
86
- That's it. No environment variables, no JSON editing, no command line flags.
96
+ **Platform notes:** [Windows](docs/windows.md) | [Termux (Android)](docs/termux.md) | [tmux](docs/tmux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)
87
97
 
88
- ### Example
98
+ ---
89
99
 
90
- ```bash
91
- $ phi
92
- > /phi-init
93
- ⚠️ No API keys detected. Let's set one up!
94
-
95
- Available providers:
96
- 1. Alibaba Coding Plan
97
- 2. OpenAI
98
- 3. Anthropic
99
- 4. Google
100
- ...
101
-
102
- Choose provider (number): 1
103
- Enter your Alibaba Coding Plan API key: sk-sp-xxxxx
104
-
105
- ✅ API key saved to ~/.phi/agent/models.json
106
- ⚠️ Restart phi for models to load.
107
- ```
100
+ ## Providers & Models
108
101
 
109
- Restart `phi`, run `/phi-init` again models are detected pick a setup mode done.
102
+ For each built-in provider, pi maintains a list of tool-capable models, updated with every release. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L).
103
+
104
+ **Subscriptions:**
105
+ - Anthropic Claude Pro/Max
106
+ - OpenAI ChatGPT Plus/Pro (Codex)
107
+ - GitHub Copilot
108
+
109
+ **API keys:**
110
+ - Anthropic
111
+ - OpenAI
112
+ - Azure OpenAI
113
+ - DeepSeek
114
+ - Google Gemini
115
+ - Google Vertex
116
+ - Amazon Bedrock
117
+ - Mistral
118
+ - Groq
119
+ - Cerebras
120
+ - Cloudflare AI Gateway
121
+ - Cloudflare Workers AI
122
+ - xAI
123
+ - OpenRouter
124
+ - Vercel AI Gateway
125
+ - ZAI
126
+ - OpenCode Zen
127
+ - OpenCode Go
128
+ - Hugging Face
129
+ - Fireworks
130
+ - Together AI
131
+ - Kimi For Coding
132
+ - MiniMax
133
+ - Xiaomi MiMo
134
+ - Xiaomi MiMo Token Plan (China)
135
+ - Xiaomi MiMo Token Plan (Amsterdam)
136
+ - Xiaomi MiMo Token Plan (Singapore)
137
+
138
+ See [docs/providers.md](docs/providers.md) for detailed setup instructions.
139
+
140
+ **Custom providers & models:** Add providers via `~/.pi/agent/models.json` if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See [docs/models.md](docs/models.md) and [docs/custom-provider.md](docs/custom-provider.md).
110
141
 
111
142
  ---
112
143
 
113
- ## Setup Wizard
144
+ ## Interactive Mode
114
145
 
115
- The `/phi-init` wizard has **3 modes**:
146
+ <p align="center"><img src="docs/images/interactive-mode.png" alt="Interactive Mode" width="600"></p>
116
147
 
117
- | Mode | What it does | Time |
118
- |------|-------------|------|
119
- | **auto** | Assigns optimal defaults based on available models | Instant |
120
- | **benchmark** | Tests each model with real coding tasks, assigns by score | 10-15 min |
121
- | **manual** | You choose the model for each role interactively | 2-5 min |
148
+ The interface from top to bottom:
122
149
 
123
- The wizard creates:
124
- - `~/.phi/agent/routing.json` Model assignments per task type
125
- - `~/.phi/agent/agents/` — Sub-agent definitions
126
- - `~/.phi/memory/AGENTS.md` Your project instructions template
150
+ - **Startup header** - Shows shortcuts (`/hotkeys` for all), loaded AGENTS.md files, prompt templates, skills, and extensions
151
+ - **Messages** - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI
152
+ - **Editor** - Where you type; border color indicates thinking level
153
+ - **Footer** - Working directory, session name, total token/cache usage, cost, context usage, current model
127
154
 
128
- ---
155
+ The editor can be temporarily replaced by other UI, like built-in `/settings` or custom UI from extensions (e.g., a Q&A tool that lets the user answer model questions in a structured format). [Extensions](#extensions) can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.
129
156
 
130
- ## API Key Management
157
+ ### Editor
131
158
 
132
- ### Option 1: Interactive Setup (recommended)
159
+ | Feature | How |
160
+ |---------|-----|
161
+ | File reference | Type `@` to fuzzy-search project files |
162
+ | Path completion | Tab to complete paths |
163
+ | Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) |
164
+ | Images | Ctrl+V to paste (Alt+V on Windows), or drag onto terminal |
165
+ | Bash commands | `!command` runs and sends output to LLM, `!!command` runs without sending |
133
166
 
134
- Run `/phi-init` it asks for your provider and key, saves automatically.
167
+ Standard editing keybindings for delete word, undo, etc. See [docs/keybindings.md](docs/keybindings.md).
135
168
 
136
- ### Option 2: In-Session Command
169
+ ### Commands
137
170
 
138
- ```
139
- /api-key set alibaba sk-sp-your-key-here
140
- /api-key set openai sk-your-key-here
141
- /api-key set anthropic sk-ant-your-key-here
142
- ```
171
+ Type `/` in the editor to trigger commands. [Extensions](#extensions) can register custom commands, [skills](#skills) are available as `/skill:name`, and [prompt templates](#prompt-templates) expand via `/templatename`.
143
172
 
144
- This **saves to `~/.phi/agent/models.json`** (persistent across sessions).
145
- Restart `phi` for new models to load.
173
+ | Command | Description |
174
+ |---------|-------------|
175
+ | `/login`, `/logout` | OAuth authentication |
176
+ | `/model` | Switch models |
177
+ | `/scoped-models` | Enable/disable models for Ctrl+P cycling |
178
+ | `/settings` | Thinking level, theme, message delivery, transport |
179
+ | `/resume` | Pick from previous sessions |
180
+ | `/new` | Start a new session |
181
+ | `/name <name>` | Set session display name |
182
+ | `/session` | Show session info (file, ID, messages, tokens, cost) |
183
+ | `/tree` | Jump to any point in the session and continue from there |
184
+ | `/fork` | Create a new session from a previous user message |
185
+ | `/clone` | Duplicate the current active branch into a new session |
186
+ | `/compact [prompt]` | Manually compact context, optional custom instructions |
187
+ | `/copy` | Copy last assistant message to clipboard |
188
+ | `/export [file]` | Export session to HTML file |
189
+ | `/share` | Upload as private GitHub gist with shareable HTML link |
190
+ | `/reload` | Reload keybindings, extensions, skills, prompts, and context files (themes hot-reload automatically) |
191
+ | `/hotkeys` | Show all keyboard shortcuts |
192
+ | `/changelog` | Display version history |
193
+ | `/quit` | Quit pi |
194
+
195
+ ### Keyboard Shortcuts
196
+
197
+ See `/hotkeys` for the full list. Customize via `~/.pi/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
198
+
199
+ **Commonly used:**
146
200
 
147
- ### Option 3: View Configured Keys
201
+ | Key | Action |
202
+ |-----|--------|
203
+ | Ctrl+C | Clear editor |
204
+ | Ctrl+C twice | Quit |
205
+ | Escape | Cancel/abort |
206
+ | Escape twice | Open `/tree` |
207
+ | Ctrl+L | Open model selector |
208
+ | Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |
209
+ | Shift+Tab | Cycle thinking level |
210
+ | Ctrl+O | Collapse/expand tool output |
211
+ | Ctrl+T | Collapse/expand thinking blocks |
148
212
 
149
- ```
150
- /api-key list # Show configured keys (masked)
151
- /api-key providers # List all supported providers
152
- ```
213
+ ### Message Queue
214
+
215
+ Submit messages while the agent is working:
216
+
217
+ - **Enter** queues a *steering* message, delivered after the current assistant turn finishes executing its tool calls
218
+ - **Alt+Enter** queues a *follow-up* message, delivered only after the agent finishes all work
219
+ - **Escape** aborts and restores queued messages to editor
220
+ - **Alt+Up** retrieves queued messages back to editor
221
+
222
+ On Windows Terminal, `Alt+Enter` is fullscreen by default. Remap it in [docs/terminal-setup.md](docs/terminal-setup.md) so pi can receive the follow-up shortcut.
223
+
224
+ Configure delivery in [settings](docs/settings.md): `steeringMode` and `followUpMode` can be `"one-at-a-time"` (default, waits for response) or `"all"` (delivers all queued at once). `transport` selects provider transport preference (`"sse"`, `"websocket"`, or `"auto"`) for providers that support multiple transports.
225
+
226
+ ---
227
+
228
+ ## Sessions
153
229
 
154
- ### Option 4: Environment Variables
230
+ Sessions are stored as JSONL files with a tree structure. Each entry has an `id` and `parentId`, enabling in-place branching without creating new files. See [docs/session-format.md](docs/session-format.md) for file format.
155
231
 
156
- For CI/CD or scripting, you can still use environment variables:
232
+ ### Management
233
+
234
+ Sessions auto-save to `~/.pi/agent/sessions/` organized by working directory.
157
235
 
158
236
  ```bash
159
- # Linux/Mac
160
- export ALIBABA_CODING_PLAN_KEY="sk-sp-xxx"
161
- export OPENAI_API_KEY="sk-xxx"
162
- export ANTHROPIC_API_KEY="sk-ant-xxx"
163
-
164
- # Windows (persistent)
165
- setx ALIBABA_CODING_PLAN_KEY "sk-sp-xxx"
166
- setx OPENAI_API_KEY "sk-xxx"
237
+ pi -c # Continue most recent session
238
+ pi -r # Browse and select from past sessions
239
+ pi --no-session # Ephemeral mode (don't save)
240
+ pi --session <path|id> # Use specific session file or ID
241
+ pi --fork <path|id> # Fork specific session file or ID into a new session
167
242
  ```
168
243
 
169
- ### Option 5: models.json (Direct Edit)
244
+ Use `/session` in interactive mode to see the current session ID before reusing it with `--session <id>` or `--fork <id>`.
170
245
 
171
- Edit `~/.phi/agent/models.json` directly for advanced configurations:
246
+ ### Branching
172
247
 
173
- ```json
174
- {
175
- "providers": {
176
- "my-provider": {
177
- "baseUrl": "https://api.example.com/v1",
178
- "api": "openai-completions",
179
- "apiKey": "your-key-here",
180
- "models": [
181
- {
182
- "id": "model-name",
183
- "name": "Display Name",
184
- "reasoning": true,
185
- "input": ["text"],
186
- "contextWindow": 131072,
187
- "maxTokens": 16384
188
- }
189
- ]
190
- }
191
- }
192
- }
193
- ```
248
+ **`/tree`** - Navigate the session tree in-place. Select any previous point, continue from there, and switch between branches. All history preserved in a single file.
194
249
 
195
- The `apiKey` field supports:
196
- - **Direct value**: `"sk-xxx"` — uses as-is
197
- - **Environment variable name**: `"OPENAI_API_KEY"` — resolved at runtime
198
- - **Shell command**: `"!cat ~/.secrets/key"` — executed and output used
250
+ <p align="center"><img src="docs/images/tree-view.png" alt="Tree View" width="600"></p>
199
251
 
200
- ---
252
+ - Search by typing, fold/unfold and jump between branches with Ctrl+←/Ctrl+→ or Alt+←/Alt+→, page with ←/→
253
+ - Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
254
+ - Press Shift+L to label entries as bookmarks and Shift+T to toggle label timestamps
201
255
 
202
- ## Providers & Models
256
+ **`/fork`** - Create a new session file from a previous user message on the active branch. Opens a selector, copies the active path up to that point, and places the selected prompt in the editor for modification.
203
257
 
204
- ### Supported Providers
258
+ **`/clone`** - Duplicate the current active branch into a new session file at the current position. The new session keeps the full active-path history and opens with an empty editor.
205
259
 
206
- | Provider | API Key Env Var | Notes |
207
- |----------|----------------|-------|
208
- | Alibaba Cloud | `ALIBABA_CODING_PLAN_KEY` | DashScope (Qwen, Kimi, GLM, MiniMax) |
209
- | OpenAI | `OPENAI_API_KEY` | GPT-4o, o1, o3, etc. |
210
- | Anthropic | `ANTHROPIC_API_KEY` | Claude Sonnet, Opus, Haiku |
211
- | Google | `GOOGLE_API_KEY` | Gemini Pro, Flash, Ultra |
212
- | OpenRouter | `OPENROUTER_API_KEY` | 200+ models from all providers |
213
- | Groq | `GROQ_API_KEY` | Ultra-fast inference |
214
- | Ollama | — | Local, `ollama serve` on port 11434 |
215
- | LM Studio | — | Local, start server on port 1234 |
260
+ **`--fork <path|id>`** - Fork an existing session file or partial session UUID directly from the CLI. This copies the full source session into a new session file in the current project.
216
261
 
217
- Plus all Pi built-in providers: Azure OpenAI, Google Vertex, Amazon Bedrock, Mistral, Cerebras, xAI, Hugging Face, and more.
262
+ ### Compaction
218
263
 
219
- ### Switching Models
264
+ Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
220
265
 
221
- - **Ctrl+L** Open model selector (pick from list)
222
- - **Ctrl+P** — Cycle through scoped models
223
- - `/model <name>` Switch by name
266
+ **Manual:** `/compact` or `/compact <custom instructions>`
267
+
268
+ **Automatic:** Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via `/settings` or `settings.json`.
269
+
270
+ Compaction is lossy. The full history remains in the JSONL file; use `/tree` to revisit. Customize compaction behavior via [extensions](#extensions). See [docs/compaction.md](docs/compaction.md) for internals.
224
271
 
225
272
  ---
226
273
 
227
- ## Commands
274
+ ## Settings
228
275
 
229
- Phi Code adds these commands on top of Pi's built-in commands:
276
+ Use `/settings` to modify common options, or edit JSON files directly:
230
277
 
231
- | Command | Description |
232
- |---------|-------------|
233
- | `/phi-init` | Interactive setup wizard — configure providers, keys, and models |
234
- | `/api-key` | Manage API keys (`set`, `list`, `providers`, `help`) |
235
- | `/plan` | Full orchestration — analyze project, create spec, execute with sub-agents |
236
- | `/run` | Execute a todo.md plan with parallel sub-agents |
237
- | `/agents` | List available sub-agents and their capabilities |
238
- | `/benchmark` | Test model performance (`/benchmark all`, `/benchmark code-gen`) |
239
- | `/search` | Web search via Brave API |
240
- | `/crawl` | Fetch and extract content from a URL |
278
+ | Location | Scope |
279
+ |----------|-------|
280
+ | `~/.pi/agent/settings.json` | Global (all projects) |
281
+ | `.pi/settings.json` | Project (overrides global) |
241
282
 
242
- ### Pi Built-in Commands
283
+ See [docs/settings.md](docs/settings.md) for all options.
243
284
 
244
- | Command | Description |
245
- |---------|-------------|
246
- | `/login`, `/logout` | OAuth authentication |
247
- | `/model` | Switch models |
248
- | `/settings` | Thinking level, theme, transport |
249
- | `/resume` | Pick from previous sessions |
250
- | `/new` | Start a new session |
251
- | `/tree` | Navigate session history |
252
- | `/compact` | Manually compact context |
253
- | `/copy` | Copy last response to clipboard |
254
- | `/export` | Export session to HTML |
255
- | `/reload` | Reload extensions, skills, prompts |
285
+ ### Telemetry and update checks
286
+
287
+ Pi has two separate startup features:
288
+
289
+ - **Update check:** fetches `https://pi.dev/api/latest-version` to check whether a newer Pi version exists. Disable it with `PI_SKIP_VERSION_CHECK=1`. Disabling update checks only turns off this check.
290
+ - **Install/update telemetry:** after first install or a changelog-detected update, sends an anonymous version ping to `https://pi.dev/api/report-install`. Opt out by setting `enableInstallTelemetry` to `false` in `settings.json`, or by setting `PI_TELEMETRY=0`. This does not disable update checks; Pi may still contact `pi.dev` for the latest version unless update checks are disabled or offline mode is enabled.
291
+
292
+ Use `--offline` or `PI_OFFLINE=1` to disable all startup network operations described here, including update checks, package update checks, and install/update telemetry.
256
293
 
257
294
  ---
258
295
 
259
- ## Sub-Agents
296
+ ## Context Files
260
297
 
261
- Phi Code ships with **5 specialized sub-agents**, each with its own system prompt and tool set:
298
+ Pi loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
299
+ - `~/.pi/agent/AGENTS.md` (global)
300
+ - Parent directories (walking up from cwd)
301
+ - Current directory
262
302
 
263
- | Agent | Role | Tools |
264
- |-------|------|-------|
265
- | **code** | Write and edit code, run commands | `read`, `write`, `edit`, `bash` |
266
- | **explore** | Investigate codebases, read-only analysis | `read`, `bash` |
267
- | **plan** | Architecture, design, technical planning | `read`, `bash` |
268
- | **review** | Code review, security audit, best practices | `read`, `bash` |
269
- | **test** | Write tests, fix tests, run test suites | `read`, `write`, `edit`, `bash` |
303
+ Use for project instructions, conventions, common commands. All matching files are concatenated.
270
304
 
271
- View agents: `/agents`
272
- View details: `/agents code`
305
+ Disable context file loading with `--no-context-files` (or `-nc`).
273
306
 
274
- Agent definitions are Markdown files with YAML frontmatter in `~/.phi/agent/agents/`. You can customize them or add your own.
307
+ ### System Prompt
308
+
309
+ Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
275
310
 
276
311
  ---
277
312
 
278
- ## Orchestrator
313
+ ## Customization
279
314
 
280
- The `/plan` command is a **full-cycle project orchestrator**:
315
+ ### Prompt Templates
281
316
 
282
- ```
283
- /plan Build a REST API with authentication and tests
284
- ```
317
+ Reusable prompts as Markdown files. Type `/name` to expand.
285
318
 
286
- This single command:
287
- 1. **Analyzes** your project structure
288
- 2. **Creates** a detailed spec (`spec.md`)
289
- 3. **Generates** a task list with dependencies (`todo.md`)
290
- 4. **Executes** all tasks with parallel sub-agents
291
- 5. **Reports** progress in real-time (`progress.md`)
319
+ ```markdown
320
+ <!-- ~/.pi/agent/prompts/review.md -->
321
+ Review this code for bugs, security issues, and performance problems.
322
+ Focus on: {{focus}}
323
+ ```
292
324
 
293
- ### How It Works
325
+ Place in `~/.pi/agent/prompts/`, `.pi/prompts/`, or a [pi package](#pi-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).
294
326
 
295
- - Tasks are organized into **waves** based on dependencies
296
- - Independent tasks run **in parallel** via `Promise.all`
297
- - Each sub-agent receives **shared context**: project description, spec summary, and results from completed dependency tasks
298
- - Failed tasks are skipped; dependents are also skipped with a clear report
299
- - All files are written to `.phi/plans/<timestamp>/`
327
+ ### Skills
300
328
 
301
- ### Step-by-Step Mode
329
+ On-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.
302
330
 
303
- Use `/run` to execute an existing plan:
331
+ ```markdown
332
+ <!-- ~/.pi/agent/skills/my-skill/SKILL.md -->
333
+ # My Skill
334
+ Use this skill when the user asks about X.
304
335
 
305
- ```
306
- /run .phi/plans/2026-03-07T21-00-00/todo.md
336
+ ## Steps
337
+ 1. Do this
338
+ 2. Then that
307
339
  ```
308
340
 
309
- ---
341
+ Place in `~/.pi/agent/skills/`, `~/.agents/skills/`, `.pi/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [pi package](#pi-packages) to share with others. See [docs/skills.md](docs/skills.md).
310
342
 
311
- ## Memory System
343
+ ### Extensions
312
344
 
313
- Phi Code remembers across sessions via **sigma-memory**:
345
+ <p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
314
346
 
315
- ### Components
347
+ TypeScript modules that extend pi with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
316
348
 
317
- | Component | What it stores | Location |
318
- |-----------|---------------|----------|
319
- | **Notes** | Free-form text notes | `~/.phi/memory/notes/` |
320
- | **Ontology** | Structured knowledge graph (entities + relations) | `~/.phi/memory/ontology/` |
321
- | **QMD** | Vector embeddings for semantic search | `~/.phi/memory/qmd/` |
322
- | **AGENTS.md** | Global project instructions | `~/.phi/memory/AGENTS.md` |
349
+ ```typescript
350
+ export default function (pi: ExtensionAPI) {
351
+ pi.registerTool({ name: "deploy", ... });
352
+ pi.registerCommand("stats", { ... });
353
+ pi.on("tool_call", async (event, ctx) => { ... });
354
+ }
355
+ ```
323
356
 
324
- ### Auto-Recall
357
+ The default export can also be `async`. pi waits for async extension factories before startup continues, which is useful for one-time initialization such as fetching remote model lists before calling `pi.registerProvider()`.
325
358
 
326
- Memory is automatically searched before every response. When you ask "how did we implement the auth system?", Phi Code searches its memory and includes relevant context.
359
+ **What's possible:**
360
+ - Custom tools (or replace built-in tools entirely)
361
+ - Sub-agents and plan mode
362
+ - Custom compaction and summarization
363
+ - Permission gates and path protection
364
+ - Custom editors and UI components
365
+ - Status lines, headers, footers
366
+ - Git checkpointing and auto-commit
367
+ - SSH and sandbox execution
368
+ - MCP server integration
369
+ - Make pi look like Claude Code
370
+ - Games while waiting (yes, Doom runs)
371
+ - ...anything you can dream up
327
372
 
328
- ### Manual Commands
373
+ Place in `~/.pi/agent/extensions/`, `.pi/extensions/`, or a [pi package](#pi-packages) to share with others. See [docs/extensions.md](docs/extensions.md) and [examples/extensions/](examples/extensions/).
329
374
 
330
- Memory tools are available to the LLM:
331
- - `memory_search` — Semantic search across all memory
332
- - `memory_note` — Save a note for future sessions
333
- - `memory_entity` / `memory_relation` — Build the knowledge graph
375
+ ### Themes
334
376
 
335
- ---
377
+ Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and pi immediately applies changes.
336
378
 
337
- ## Smart Routing
379
+ Place in `~/.pi/agent/themes/`, `.pi/themes/`, or a [pi package](#pi-packages) to share with others. See [docs/themes.md](docs/themes.md).
338
380
 
339
- The smart router automatically assigns the best model to each task based on your `routing.json` configuration:
381
+ ### Pi Packages
340
382
 
341
- | Task Type | Best For |
342
- |-----------|----------|
343
- | **code-generation** | Writing new code, refactoring |
344
- | **debugging** | Finding and fixing bugs |
345
- | **planning** | Architecture, design decisions |
346
- | **tool-calling** | File operations, bash commands |
347
- | **orchestration** | Managing sub-agents, complex workflows |
348
- | **default** | Everything else |
383
+ Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Api-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).
384
+
385
+ > **Security:** Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
386
+
387
+ ```bash
388
+ pi install npm:@foo/pi-tools
389
+ pi install npm:@foo/pi-tools@1.2.3 # pinned version
390
+ pi install git:github.com/user/repo
391
+ pi install git:github.com/user/repo@v1 # tag or commit
392
+ pi install git:git@github.com:user/repo
393
+ pi install git:git@github.com:user/repo@v1 # tag or commit
394
+ pi install https://github.com/user/repo
395
+ pi install https://github.com/user/repo@v1 # tag or commit
396
+ pi install ssh://git@github.com/user/repo
397
+ pi install ssh://git@github.com/user/repo@v1 # tag or commit
398
+ pi remove npm:@foo/pi-tools
399
+ pi uninstall npm:@foo/pi-tools # alias for remove
400
+ pi list
401
+ pi update # update pi and packages (skips pinned packages)
402
+ pi update --extensions # update packages only
403
+ pi update --self # update pi only
404
+ pi update --self --force # reinstall pi even if current
405
+ pi update npm:@foo/pi-tools # update one package
406
+ pi config # enable/disable extensions, skills, prompts, themes
407
+ ```
349
408
 
350
- Configuration: `~/.phi/agent/routing.json`
409
+ Packages install to `~/.pi/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.pi/git/`, `.pi/npm/`). Git packages install dependencies with `npm install --omit=dev` by default, so runtime deps must be listed under `dependencies`; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers. If you use a Node version manager and want package installs to reuse a stable npm context, set `npmCommand` in `settings.json`, for example `["mise", "exec", "node@20", "--", "npm"]`.
410
+
411
+ Create a package by adding a `pi` key to `package.json`:
351
412
 
352
413
  ```json
353
414
  {
354
- "code-generation": { "preferred": "qwen3.5-plus", "fallback": "default" },
355
- "debugging": { "preferred": "kimi-k2.5", "fallback": "default" },
356
- "default": { "preferred": "default", "fallback": "default" }
415
+ "name": "my-pi-package",
416
+ "keywords": ["pi-package"],
417
+ "pi": {
418
+ "extensions": ["./extensions"],
419
+ "skills": ["./skills"],
420
+ "prompts": ["./prompts"],
421
+ "themes": ["./themes"]
422
+ }
357
423
  }
358
424
  ```
359
425
 
360
- Set models to `"default"` to use whatever model is currently active.
426
+ Without a `pi` manifest, pi auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
427
+
428
+ See [docs/packages.md](docs/packages.md).
361
429
 
362
430
  ---
363
431
 
364
- ## Benchmark
432
+ ## Programmatic Usage
365
433
 
366
- Test your models with real coding tasks:
434
+ ### SDK
367
435
 
436
+ ```typescript
437
+ import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@earendil-works/pi-coding-agent";
438
+
439
+ const authStorage = AuthStorage.create();
440
+ const modelRegistry = ModelRegistry.create(authStorage);
441
+ const { session } = await createAgentSession({
442
+ sessionManager: SessionManager.inMemory(),
443
+ authStorage,
444
+ modelRegistry,
445
+ });
446
+
447
+ await session.prompt("What files are in the current directory?");
368
448
  ```
369
- /benchmark all # Test all available models
370
- /benchmark code-gen # Test only code generation
371
- /benchmark debug # Test only debugging
372
- ```
373
449
 
374
- ### Categories
450
+ For advanced multi-session runtime replacement, use `createAgentSessionRuntime()` and `AgentSessionRuntime`.
451
+
452
+ See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).
453
+
454
+ ### RPC Mode
375
455
 
376
- | Category | Weight | What it tests |
377
- |----------|--------|---------------|
378
- | code-gen | ×2 | Write a function from spec |
379
- | debug | ×2 | Find and fix a bug |
380
- | planning | ×2 | Design an architecture |
381
- | tool-calling | ×1 | Structured tool use |
382
- | speed | ×1 | Response latency |
383
- | orchestration | ×2 | Multi-step task planning |
456
+ For non-Node.js integrations, use RPC mode over stdin/stdout:
384
457
 
385
- ### Scoring
458
+ ```bash
459
+ pi --mode rpc
460
+ ```
386
461
 
387
- Models are scored 0-100 and ranked into tiers:
462
+ RPC mode uses strict LF-delimited JSONL framing. Clients must split records on `\n` only. Do not use generic line readers like Node `readline`, which also split on Unicode separators inside JSON payloads.
388
463
 
389
- | Tier | Score | Meaning |
390
- |------|-------|---------|
391
- | **S** | 80+ | Elite — best for critical tasks |
392
- | **A** | 65+ | Strong — reliable for most work |
393
- | **B** | 50+ | Decent — good for simple tasks |
394
- | **C** | 35+ | Weak — use as fallback only |
395
- | **D** | <35 | Avoid — not recommended |
464
+ See [docs/rpc.md](docs/rpc.md) for the protocol.
396
465
 
397
466
  ---
398
467
 
399
- ## Skills
400
-
401
- Phi Code ships with **12 built-in skills**:
468
+ ## Philosophy
402
469
 
403
- | Skill | Description |
404
- |-------|-------------|
405
- | api-design | REST API patterns, versioning, error handling |
406
- | coding-standards | Code quality, naming conventions, best practices |
407
- | database | Database design, queries, migrations, optimization |
408
- | devops | CI/CD pipelines, deployment, monitoring |
409
- | docker-ops | Docker containers, Compose, orchestration |
410
- | git-workflow | Branching, commits, merges, collaboration |
411
- | github | GitHub Actions, PRs, issues, releases |
412
- | performance | Profiling, optimization, caching |
413
- | prompt-architect | Crafting structured prompts for AI systems |
414
- | security | Vulnerability scanning, hardening |
415
- | self-improving | Learning from errors and corrections |
416
- | testing | Test strategy, unit/integration tests |
470
+ Pi is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with [extensions](#extensions), [skills](#skills), or installed from third-party [pi packages](#pi-packages). This keeps the core minimal while letting you shape pi to fit how you work.
417
471
 
418
- Skills are loaded automatically when relevant. Invoke manually with `/skill:name`.
472
+ **No MCP.** Build CLI tools with READMEs (see [Skills](#skills)), or build an extension that adds MCP support. [Why?](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/)
419
473
 
420
- Add your own skills in `~/.phi/agent/skills/` or `.phi/skills/`.
474
+ **No sub-agents.** There's many ways to do this. Spawn pi instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
421
475
 
422
- ---
476
+ **No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
423
477
 
424
- ## Extensions
478
+ **No plan mode.** Write plans to files, or build it with [extensions](#extensions), or install a package.
425
479
 
426
- Phi Code ships with **9 extensions**:
480
+ **No built-in to-dos.** They confuse models. Use a TODO.md file, or build your own with [extensions](#extensions).
427
481
 
428
- | Extension | What it adds |
429
- |-----------|-------------|
430
- | **init** | `/phi-init` wizard + `/api-key` management |
431
- | **orchestrator** | `/plan` and `/run` commands with parallel sub-agents |
432
- | **memory** | Persistent memory (notes, ontology, QMD search) |
433
- | **smart-router** | Automatic model routing by task type |
434
- | **skill-loader** | Dynamic skill scanning and loading |
435
- | **benchmark** | `/benchmark` for model testing |
436
- | **web-search** | `/search` and `/crawl` commands via Brave API |
437
- | **agents** | `/agents` command to list sub-agents |
482
+ **No background bash.** Use tmux. Full observability, direct interaction.
438
483
 
439
- Extensions are TypeScript files loaded at runtime by [jiti](https://github.com/unjs/jiti). Add your own in `~/.phi/agent/extensions/`.
484
+ Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) for the full rationale.
440
485
 
441
486
  ---
442
487
 
443
- ## Configuration Files
488
+ ## CLI Reference
444
489
 
445
- All configuration lives in `~/.phi/agent/`:
490
+ ```bash
491
+ pi [options] [@files...] [messages...]
492
+ ```
446
493
 
447
- | File | Purpose |
448
- |------|---------|
449
- | `models.json` | **API keys & custom providers** (created by `/phi-init` or `/api-key`) |
450
- | `routing.json` | Model assignments per task type |
451
- | `settings.json` | Pi settings (thinking level, compaction, etc.) |
452
- | `agents/*.md` | Sub-agent definitions |
453
- | `skills/*/SKILL.md` | Skill definitions |
454
- | `extensions/*.ts` | Extension files |
455
- | `AGENTS.md` | Global project instructions |
456
- | `keybindings.json` | Custom keyboard shortcuts |
494
+ ### Package Commands
457
495
 
458
- Memory lives in `~/.phi/memory/`:
496
+ ```bash
497
+ pi install <source> [-l] # Install package, -l for project-local
498
+ pi remove <source> [-l] # Remove package
499
+ pi uninstall <source> [-l] # Alias for remove
500
+ pi update [source|self|pi] # Update pi and packages (skips pinned packages)
501
+ pi update --extensions # Update packages only
502
+ pi update --self # Update pi only
503
+ pi update --self --force # Reinstall pi even if current
504
+ pi update --extension <src> # Update one package
505
+ pi list # List installed packages
506
+ pi config # Enable/disable package resources
507
+ ```
459
508
 
460
- | Path | Content |
461
- |------|---------|
462
- | `AGENTS.md` | Global memory / instructions |
463
- | `notes/` | Saved notes |
464
- | `ontology/` | Knowledge graph |
465
- | `qmd/` | Vector search index |
509
+ ### Modes
466
510
 
467
- ---
511
+ | Flag | Description |
512
+ |------|-------------|
513
+ | (default) | Interactive mode |
514
+ | `-p`, `--print` | Print response and exit |
515
+ | `--mode json` | Output all events as JSON lines (see [docs/json.md](docs/json.md)) |
516
+ | `--mode rpc` | RPC mode for process integration (see [docs/rpc.md](docs/rpc.md)) |
517
+ | `--export <in> [out]` | Export session to HTML |
468
518
 
469
- ## Keyboard Shortcuts
519
+ In print mode, pi also reads piped stdin and merges it into the initial prompt:
470
520
 
471
- | Key | Action |
472
- |-----|--------|
473
- | **Ctrl+L** | Open model selector |
474
- | **Ctrl+P** | Cycle models forward |
475
- | **Shift+Ctrl+P** | Cycle models backward |
476
- | **Shift+Tab** | Cycle thinking level |
477
- | **Ctrl+O** | Collapse/expand tool output |
478
- | **Ctrl+T** | Collapse/expand thinking |
479
- | **Ctrl+G** | Open external editor |
480
- | **Escape** | Cancel/abort |
481
- | **Ctrl+C** | Clear editor |
482
- | **Ctrl+C twice** | Quit |
483
- | **Alt+Enter** | Queue follow-up message |
484
-
485
- Full list: `/hotkeys`
521
+ ```bash
522
+ cat README.md | pi -p "Summarize this text"
523
+ ```
486
524
 
487
- ---
525
+ ### Model Options
488
526
 
489
- ## Sessions
527
+ | Option | Description |
528
+ |--------|-------------|
529
+ | `--provider <name>` | Provider (anthropic, openai, google, etc.) |
530
+ | `--model <pattern>` | Model pattern or ID (supports `provider/id` and optional `:<thinking>`) |
531
+ | `--api-key <key>` | API key (overrides env vars) |
532
+ | `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |
533
+ | `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |
534
+ | `--list-models [search]` | List available models |
490
535
 
491
- Sessions auto-save to `~/.phi/agent/sessions/` as JSONL files with a tree structure.
536
+ ### Session Options
492
537
 
493
- ```bash
494
- phi -c # Continue last session
495
- phi -r # Browse past sessions
496
- phi --no-session # Ephemeral mode
497
- ```
538
+ | Option | Description |
539
+ |--------|-------------|
540
+ | `-c`, `--continue` | Continue most recent session |
541
+ | `-r`, `--resume` | Browse and select session |
542
+ | `--session <path\|id>` | Use specific session file or partial UUID |
543
+ | `--fork <path\|id>` | Fork specific session file or partial UUID into a new session |
544
+ | `--session-dir <dir>` | Custom session storage directory |
545
+ | `--no-session` | Ephemeral mode (don't save) |
498
546
 
499
- **Branching:** Use `/tree` to navigate history and branch from any point.
500
- **Compaction:** Automatic context management when approaching limits.
501
- **Export:** `/export file.html` or `--export` flag.
502
- **Debug log:** `~/.phi/agent/phi-debug.log` (toggle with Ctrl+D).
547
+ ### Tool Options
503
548
 
504
- ---
549
+ | Option | Description |
550
+ |--------|-------------|
551
+ | `--tools <list>`, `-t <list>` | Allowlist specific tool names across built-in, extension, and custom tools |
552
+ | `--no-builtin-tools`, `-nbt` | Disable built-in tools by default but keep extension/custom tools enabled |
553
+ | `--no-tools`, `-nt` | Disable all tools by default |
505
554
 
506
- ## CLI Reference
555
+ Available built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`
507
556
 
508
- ```bash
509
- phi [options] [@files...] [messages...]
510
- ```
557
+ ### Resource Options
558
+
559
+ | Option | Description |
560
+ |--------|-------------|
561
+ | `-e`, `--extension <source>` | Load extension from path, npm, or git (repeatable) |
562
+ | `--no-extensions` | Disable extension discovery |
563
+ | `--skill <path>` | Load skill (repeatable) |
564
+ | `--no-skills` | Disable skill discovery |
565
+ | `--prompt-template <path>` | Load prompt template (repeatable) |
566
+ | `--no-prompt-templates` | Disable prompt template discovery |
567
+ | `--theme <path>` | Load theme (repeatable) |
568
+ | `--no-themes` | Disable theme discovery |
569
+ | `--no-context-files`, `-nc` | Disable AGENTS.md and CLAUDE.md context file discovery |
570
+
571
+ Combine `--no-*` with explicit flags to load exactly what you need, ignoring settings.json (e.g., `--no-extensions -e ./my-ext.ts`).
572
+
573
+ ### Other Options
511
574
 
512
575
  | Option | Description |
513
576
  |--------|-------------|
514
- | `--provider <name>` | Provider name |
515
- | `--model <pattern>` | Model pattern or ID |
516
- | `--api-key <key>` | API key (session only) |
517
- | `--thinking <level>` | off, minimal, low, medium, high, xhigh |
518
- | `-c`, `--continue` | Continue last session |
519
- | `-r`, `--resume` | Browse sessions |
520
- | `-p`, `--print` | Print mode (non-interactive) |
521
- | `--no-session` | Don't save session |
522
- | `--verbose` | Verbose startup |
577
+ | `--system-prompt <text>` | Replace default prompt (context files and skills still appended) |
578
+ | `--append-system-prompt <text>` | Append to system prompt |
579
+ | `--verbose` | Force verbose startup |
580
+ | `-h`, `--help` | Show help |
523
581
  | `-v`, `--version` | Show version |
524
582
 
525
- Platform notes: [Windows](docs/windows.md) | [Termux](docs/termux.md) | [tmux](docs/tmux.md)
583
+ ### File Arguments
526
584
 
527
- ---
585
+ Prefix files with `@` to include in the message:
528
586
 
529
- ## Philosophy
587
+ ```bash
588
+ pi @prompt.md "Answer this"
589
+ pi -p @screenshot.png "What's in this image?"
590
+ pi @code.ts @test.ts "Review these files"
591
+ ```
592
+
593
+ ### Examples
594
+
595
+ ```bash
596
+ # Interactive with initial prompt
597
+ pi "List all .ts files in src/"
598
+
599
+ # Non-interactive
600
+ pi -p "Summarize this codebase"
601
+
602
+ # Non-interactive with piped stdin
603
+ cat README.md | pi -p "Summarize this text"
530
604
 
531
- Phi Code follows Pi's philosophy of **aggressive extensibility** while adding the features serious developers need out of the box:
605
+ # Different model
606
+ pi --provider openai --model gpt-4o "Help me refactor"
532
607
 
533
- - **Memory matters.** Context across sessions shouldn't require manual copy-paste.
534
- - **Sub-agents work.** The right agent for the right task, running in parallel.
535
- - **Routing saves money.** Don't use your most expensive model for `ls`.
536
- - **Setup should be easy.** `/phi-init` → pick provider → paste key → done.
537
- - **Provider-neutral.** Your choice of LLM. No vendor lock-in.
608
+ # Model with provider prefix (no --provider needed)
609
+ pi --model openai/gpt-4o "Help me refactor"
538
610
 
539
- Built on [Pi](https://github.com/badlogic/pi-mono) by [Mario Zechner](https://github.com/badlogic). Everything Phi adds is through Pi's extension system — 2 lines changed in core.
611
+ # Model with thinking level shorthand
612
+ pi --model sonnet:high "Solve this complex problem"
613
+
614
+ # Limit model cycling
615
+ pi --models "claude-*,gpt-4o"
616
+
617
+ # Read-only mode
618
+ pi --tools read,grep,find,ls -p "Review the code"
619
+
620
+ # High thinking level
621
+ pi --thinking high "Solve this complex problem"
622
+ ```
623
+
624
+ ### Environment Variables
625
+
626
+ | Variable | Description |
627
+ |----------|-------------|
628
+ | `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.pi/agent`) |
629
+ | `PI_CODING_AGENT_SESSION_DIR` | Override session storage directory (overridden by `--session-dir`) |
630
+ | `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
631
+ | `PI_OFFLINE` | Disable startup network operations, including update checks, package update checks, and install/update telemetry |
632
+ | `PI_SKIP_VERSION_CHECK` | Skip the Pi version update check at startup. This prevents the `pi.dev` latest-version request |
633
+ | `PI_TELEMETRY` | Override install/update telemetry. Use `1`/`true`/`yes` to enable or `0`/`false`/`no` to disable. This does not disable update checks |
634
+ | `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
635
+ | `VISUAL`, `EDITOR` | External editor for Ctrl+G |
540
636
 
541
637
  ---
542
638
 
543
- ## Credits
639
+ ## Contributing & Development
544
640
 
545
- - **[Pi](https://github.com/badlogic/pi-mono)** by Mario Zechner the foundation
546
- - **[sigma-memory](https://www.npmjs.com/package/sigma-memory)** — persistent memory system
547
- - **[sigma-agents](https://www.npmjs.com/package/sigma-agents)** — sub-agent routing
548
- - **[sigma-skills](https://www.npmjs.com/package/sigma-skills)** — skill scanning and loading
641
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines and [docs/development.md](docs/development.md) for setup, forking, and debugging.
549
642
 
550
643
  ---
551
644
 
552
645
  ## License
553
646
 
554
647
  MIT
648
+
649
+ ## See Also
650
+
651
+ - [@earendil-works/pi-ai](https://www.npmjs.com/package/@earendil-works/pi-ai): Core LLM toolkit
652
+ - [@earendil-works/pi-agent-core](https://www.npmjs.com/package/@earendil-works/pi-agent-core): Agent framework
653
+ - [@earendil-works/pi-tui](https://www.npmjs.com/package/@earendil-works/pi-tui): Terminal UI components