my-durable 0.0.0-stage → 0.0.2

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 (259) hide show
  1. package/.env.example +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +328 -2
  4. package/ai_docs/durable_pi/announcement.md +860 -0
  5. package/ai_docs/durable_pi/changelog.md +51 -0
  6. package/ai_docs/durable_pi/chord-delta-findings.md +362 -0
  7. package/ai_docs/durable_pi/coding-agent-integration.md +70 -0
  8. package/ai_docs/durable_pi/pico-v5-chord-usage.md +391 -0
  9. package/ai_docs/durable_pi/pico-v5-handoff.md +921 -0
  10. package/ai_docs/durable_pi/readme.md +617 -0
  11. package/ai_docs/durable_pi/sources.md +22 -0
  12. package/ai_docs/durable_pi/spec.md +4696 -0
  13. package/ai_docs/durable_pi/vacation-planner.md +57 -0
  14. package/ai_docs/pi/chord.md +268 -0
  15. package/ai_docs/pi/cli-integration.md +110 -0
  16. package/ai_docs/pi/cli.md +325 -0
  17. package/ai_docs/pi/codemode.md +211 -0
  18. package/ai_docs/pi/compaction.md +467 -0
  19. package/ai_docs/pi/configuration.md +51 -0
  20. package/ai_docs/pi/containerization.md +187 -0
  21. package/ai_docs/pi/custom-provider.md +177 -0
  22. package/ai_docs/pi/environment-variables.md +102 -0
  23. package/ai_docs/pi/extensions.md +278 -0
  24. package/ai_docs/pi/how-pi-works.md +53 -0
  25. package/ai_docs/pi/index.md +43 -0
  26. package/ai_docs/pi/json.md +230 -0
  27. package/ai_docs/pi/keybindings.md +198 -0
  28. package/ai_docs/pi/llama-cpp.md +118 -0
  29. package/ai_docs/pi/mcp.md +274 -0
  30. package/ai_docs/pi/message-types.md +265 -0
  31. package/ai_docs/pi/models.md +209 -0
  32. package/ai_docs/pi/overview.md +166 -0
  33. package/ai_docs/pi/packages.md +133 -0
  34. package/ai_docs/pi/pi-agent-core.md +568 -0
  35. package/ai_docs/pi/pi-ai.md +1942 -0
  36. package/ai_docs/pi/prompt-templates.md +63 -0
  37. package/ai_docs/pi/providers.md +204 -0
  38. package/ai_docs/pi/quickstart.md +140 -0
  39. package/ai_docs/pi/readme.md +99 -0
  40. package/ai_docs/pi/rpc-commands.md +864 -0
  41. package/ai_docs/pi/rpc-extension-ui.md +204 -0
  42. package/ai_docs/pi/rpc.md +197 -0
  43. package/ai_docs/pi/sdk.md +151 -0
  44. package/ai_docs/pi/security.md +103 -0
  45. package/ai_docs/pi/session-format.md +297 -0
  46. package/ai_docs/pi/sessions.md +70 -0
  47. package/ai_docs/pi/settings.md +173 -0
  48. package/ai_docs/pi/shell-aliases.md +97 -0
  49. package/ai_docs/pi/skills.md +97 -0
  50. package/ai_docs/pi/slash-commands.md +64 -0
  51. package/ai_docs/pi/sources.md +57 -0
  52. package/ai_docs/pi/terminal-setup.md +223 -0
  53. package/ai_docs/pi/termux.md +121 -0
  54. package/ai_docs/pi/themes.md +140 -0
  55. package/ai_docs/pi/tmux.md +59 -0
  56. package/ai_docs/pi/toolkit.md +168 -0
  57. package/ai_docs/pi/tui.md +129 -0
  58. package/ai_docs/pi/usage.md +98 -0
  59. package/ai_docs/pi/virtual-models.md +118 -0
  60. package/ai_docs/pi/windows.md +71 -0
  61. package/apps/dpi-backend/.nvmrc +1 -0
  62. package/apps/dpi-backend/API.md +99 -0
  63. package/apps/dpi-backend/README.md +119 -0
  64. package/apps/dpi-backend/deploy/backend.env.example +9 -0
  65. package/apps/dpi-backend/deploy/dpi-backend.plist +26 -0
  66. package/apps/dpi-backend/deploy/dpi-backend.service +22 -0
  67. package/apps/dpi-backend/package.json +33 -0
  68. package/apps/dpi-backend/prompts/one_sentence.md +3 -0
  69. package/apps/dpi-backend/prompts/smart_ass_opus_fix.md +169 -0
  70. package/apps/dpi-backend/scripts/check-contract.mjs +151 -0
  71. package/apps/dpi-backend/scripts/migrate-playground.ts +66 -0
  72. package/apps/dpi-backend/scripts/record-nested-fixture.mts +154 -0
  73. package/apps/dpi-backend/scripts/token.ts +57 -0
  74. package/apps/dpi-backend/src/addons.ts +139 -0
  75. package/apps/dpi-backend/src/auth.ts +20 -0
  76. package/apps/dpi-backend/src/config.ts +54 -0
  77. package/apps/dpi-backend/src/contract-check.ts +118 -0
  78. package/apps/dpi-backend/src/errors.ts +50 -0
  79. package/apps/dpi-backend/src/extensions.ts +510 -0
  80. package/apps/dpi-backend/src/faux.ts +80 -0
  81. package/apps/dpi-backend/src/history.ts +165 -0
  82. package/apps/dpi-backend/src/idempotency.ts +20 -0
  83. package/apps/dpi-backend/src/jev.ts +43 -0
  84. package/apps/dpi-backend/src/jobs.ts +790 -0
  85. package/apps/dpi-backend/src/main.ts +76 -0
  86. package/apps/dpi-backend/src/model-catalog.ts +180 -0
  87. package/apps/dpi-backend/src/pairing-files.ts +142 -0
  88. package/apps/dpi-backend/src/pairing.ts +459 -0
  89. package/apps/dpi-backend/src/routes.ts +217 -0
  90. package/apps/dpi-backend/src/shared-state.ts +85 -0
  91. package/apps/dpi-backend/src/store.ts +1240 -0
  92. package/apps/dpi-backend/src/streams.ts +256 -0
  93. package/apps/dpi-backend/src/tunnel.ts +955 -0
  94. package/apps/dpi-backend/tsconfig.json +13 -0
  95. package/apps/dpi-playground/README.md +83 -0
  96. package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-CFGc7lHT.js +77 -0
  97. package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-DFdKpwm_.css +1 -0
  98. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/anthropic.png +0 -0
  99. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/deepseek.png +0 -0
  100. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/durable-pi.svg +14 -0
  101. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/gemini.png +0 -0
  102. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/grok.png +0 -0
  103. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/kimi.png +0 -0
  104. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/lab.png +0 -0
  105. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/meta.png +0 -0
  106. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/minimax.png +0 -0
  107. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/openai.png +0 -0
  108. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/qwen.png +0 -0
  109. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/xiaomi.png +0 -0
  110. package/apps/dpi-playground/apps/dpi-playground-fe/dist/icons/zai.png +0 -0
  111. package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +16 -0
  112. package/apps/dpi-playground/apps/dpi-playground-fe/index.html +15 -0
  113. package/apps/dpi-playground/apps/dpi-playground-fe/package.json +5 -0
  114. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/anthropic.png +0 -0
  115. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/deepseek.png +0 -0
  116. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/durable-pi.svg +14 -0
  117. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/gemini.png +0 -0
  118. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/grok.png +0 -0
  119. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/kimi.png +0 -0
  120. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/lab.png +0 -0
  121. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/meta.png +0 -0
  122. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/minimax.png +0 -0
  123. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/openai.png +0 -0
  124. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/qwen.png +0 -0
  125. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/xiaomi.png +0 -0
  126. package/apps/dpi-playground/apps/dpi-playground-fe/public/icons/zai.png +0 -0
  127. package/apps/dpi-playground/apps/dpi-playground-fe/src/App.vue +180 -0
  128. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/commands.ts +119 -0
  129. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/composables.ts +129 -0
  130. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/hub.ts +40 -0
  131. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/icon-path.ts +7 -0
  132. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/ids.ts +2 -0
  133. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/jobs.ts +80 -0
  134. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/link-policy.ts +16 -0
  135. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/markdown-policy.ts +115 -0
  136. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/markdown.ts +60 -0
  137. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/pair-close.ts +23 -0
  138. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/pair-handoff.ts +56 -0
  139. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/pair.ts +166 -0
  140. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/qrcode.ts +323 -0
  141. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/signature.ts +146 -0
  142. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/store.ts +373 -0
  143. package/apps/dpi-playground/apps/dpi-playground-fe/src/client/stream.ts +183 -0
  144. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/AgentView.vue +342 -0
  145. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/Composer.vue +198 -0
  146. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/ContextBar.vue +254 -0
  147. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/DeviceCredentialsDialog.vue +40 -0
  148. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/DeviceIcon.vue +56 -0
  149. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/DirBrowser.vue +95 -0
  150. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/ExtensionsPanel.vue +96 -0
  151. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/HelpDialog.vue +69 -0
  152. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/Inspector.vue +425 -0
  153. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/JobCard.vue +221 -0
  154. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/MobileNav.vue +39 -0
  155. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/ModelPicker.vue +71 -0
  156. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/NetworkSidebar.vue +236 -0
  157. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/NewSessionDialog.vue +114 -0
  158. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/OfflinePanel.vue +128 -0
  159. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/PairDeviceWizard.vue +433 -0
  160. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/PromptDialog.vue +89 -0
  161. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/StateEditor.vue +179 -0
  162. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TasksPanel.vue +280 -0
  163. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/Toast.vue +11 -0
  164. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TokenManager.vue +175 -0
  165. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TopBar.vue +114 -0
  166. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TranscriptItem.vue +152 -0
  167. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TreeRow.vue +195 -0
  168. package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TunnelStatusBar.vue +107 -0
  169. package/apps/dpi-playground/apps/dpi-playground-fe/src/extensions.css +105 -0
  170. package/apps/dpi-playground/apps/dpi-playground-fe/src/jobs.css +655 -0
  171. package/apps/dpi-playground/apps/dpi-playground-fe/src/main.ts +22 -0
  172. package/apps/dpi-playground/apps/dpi-playground-fe/src/network.css +675 -0
  173. package/apps/dpi-playground/apps/dpi-playground-fe/src/style.css +3203 -0
  174. package/apps/dpi-playground/apps/dpi-playground-fe/tsconfig.json +16 -0
  175. package/apps/dpi-playground/apps/dpi-playground-fe/vite.config.ts +14 -0
  176. package/apps/dpi-playground/apps/dpi-playground-hub/package.json +5 -0
  177. package/apps/dpi-playground/apps/dpi-playground-hub/src/audit.ts +406 -0
  178. package/apps/dpi-playground/apps/dpi-playground-hub/src/client-ip.ts +72 -0
  179. package/apps/dpi-playground/apps/dpi-playground-hub/src/credentials.ts +265 -0
  180. package/apps/dpi-playground/apps/dpi-playground-hub/src/guard.ts +43 -0
  181. package/apps/dpi-playground/apps/dpi-playground-hub/src/http-errors.ts +156 -0
  182. package/apps/dpi-playground/apps/dpi-playground-hub/src/identity.ts +60 -0
  183. package/apps/dpi-playground/apps/dpi-playground-hub/src/limiter.ts +165 -0
  184. package/apps/dpi-playground/apps/dpi-playground-hub/src/main.ts +460 -0
  185. package/apps/dpi-playground/apps/dpi-playground-hub/src/monitor.ts +320 -0
  186. package/apps/dpi-playground/apps/dpi-playground-hub/src/mux.ts +277 -0
  187. package/apps/dpi-playground/apps/dpi-playground-hub/src/pairing.ts +816 -0
  188. package/apps/dpi-playground/apps/dpi-playground-hub/src/proxy.ts +128 -0
  189. package/apps/dpi-playground/apps/dpi-playground-hub/src/rotation.ts +583 -0
  190. package/apps/dpi-playground/apps/dpi-playground-hub/src/seed.ts +11 -0
  191. package/apps/dpi-playground/apps/dpi-playground-hub/src/transport.ts +108 -0
  192. package/apps/dpi-playground/apps/dpi-playground-hub/src/tunnel-token.ts +11 -0
  193. package/apps/dpi-playground/apps/dpi-playground-hub/src/tunnel-transport.ts +560 -0
  194. package/apps/dpi-playground/apps/dpi-playground-hub/src/tunnel.ts +873 -0
  195. package/apps/dpi-playground/apps/dpi-playground-hub/tsconfig.json +13 -0
  196. package/apps/dpi-playground/package.json +37 -0
  197. package/apps/dpi-sdk/README.md +74 -0
  198. package/apps/dpi-sdk/package.json +20 -0
  199. package/apps/dpi-sdk/scripts/net.ts +73 -0
  200. package/apps/dpi-sdk/src/api.ts +631 -0
  201. package/apps/dpi-sdk/src/app-state.ts +111 -0
  202. package/apps/dpi-sdk/src/client.ts +330 -0
  203. package/apps/dpi-sdk/src/errors.ts +16 -0
  204. package/apps/dpi-sdk/src/jobs.ts +99 -0
  205. package/apps/dpi-sdk/src/models.ts +472 -0
  206. package/apps/dpi-sdk/src/node/chunk.ts +488 -0
  207. package/apps/dpi-sdk/src/node/config.ts +175 -0
  208. package/apps/dpi-sdk/src/node/drivers.ts +402 -0
  209. package/apps/dpi-sdk/src/node/ops.ts +114 -0
  210. package/apps/dpi-sdk/src/node/private-dir.ts +48 -0
  211. package/apps/dpi-sdk/src/node/registry-migration.ts +549 -0
  212. package/apps/dpi-sdk/src/node/registry.ts +390 -0
  213. package/apps/dpi-sdk/src/node/sse-writer.ts +151 -0
  214. package/apps/dpi-sdk/src/protocol/backoff.ts +31 -0
  215. package/apps/dpi-sdk/src/protocol/limits.ts +199 -0
  216. package/apps/dpi-sdk/src/protocol/pairing.ts +311 -0
  217. package/apps/dpi-sdk/src/protocol/rest-routes.ts +105 -0
  218. package/apps/dpi-sdk/src/protocol/tunnel.ts +331 -0
  219. package/apps/dpi-sdk/src/sse.ts +117 -0
  220. package/apps/dpi-sdk/src/transcript.ts +291 -0
  221. package/apps/dpi-sdk/tsconfig.json +13 -0
  222. package/apps/dpi-sdk/w +20 -0
  223. package/apps/dpi-tui/README.md +54 -0
  224. package/apps/dpi-tui/bin/dpi-tui.mjs +5 -0
  225. package/apps/dpi-tui/package.json +20 -0
  226. package/apps/dpi-tui/src/app.ts +433 -0
  227. package/apps/dpi-tui/src/commands.ts +151 -0
  228. package/apps/dpi-tui/src/main.ts +122 -0
  229. package/apps/dpi-tui/src/pairing.ts +287 -0
  230. package/apps/dpi-tui/src/pickers.ts +238 -0
  231. package/apps/dpi-tui/src/render.ts +164 -0
  232. package/apps/dpi-tui/src/theme.ts +57 -0
  233. package/apps/dpi-tui/tsconfig.json +14 -0
  234. package/bin/device.mjs +5 -0
  235. package/bin/hub.mjs +5 -0
  236. package/bin/tui.mjs +5 -0
  237. package/deploy/Caddyfile +120 -0
  238. package/docs/verification.md +102 -0
  239. package/dpi-network.example.yaml +62 -0
  240. package/images/01_durable_agent_network.svg +185 -0
  241. package/images/02_pi_made_durable.svg +204 -0
  242. package/images/03_restart_mid_tool.svg +168 -0
  243. package/images/07_one_api_every_client.svg +123 -0
  244. package/images/08_device_session_agent.svg +123 -0
  245. package/images/09_compact_keep_history.svg +143 -0
  246. package/images/10_shared_app_state.svg +177 -0
  247. package/images/11_durable_jobs_wait.svg +141 -0
  248. package/images/12_tools_change_mid_run.svg +231 -0
  249. package/images/13_hook_blocks_tool.svg +122 -0
  250. package/images/14_fork_at_any_entry.svg +119 -0
  251. package/images/15_web_client.png +0 -0
  252. package/images/16_terminal_client.svg +43 -0
  253. package/images/17_devices_are_data.svg +182 -0
  254. package/images/18_should_every_agent_be_durable.svg +118 -0
  255. package/images/19_sqlite_on_every_device.svg +155 -0
  256. package/images/20_admission_and_effects.svg +134 -0
  257. package/justfile +33 -0
  258. package/package.json +41 -4
  259. package/scripts/verify.mjs +210 -0
@@ -0,0 +1,140 @@
1
+ > Source: [packages/coding-agent/docs/themes.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/docs/themes.md)
2
+ > Retrieved with Firecrawl: 2026-10-05. Repository snapshot: `b78e6a9085343ec0f308c3d377da72528b4cf7ee`.
3
+ > Relative documentation links point to local copies where available, otherwise to the source snapshot.
4
+
5
+ # Customize Pi with themes
6
+
7
+ Themes control the colors Pi uses in interactive mode and HTML exports. Pi includes the `system`, `dark`, and `light` themes. You can select one theme, follow your terminal's light or dark appearance, or create your own palette.
8
+
9
+ ## Use your terminal's colors
10
+
11
+ The `system` theme is the default. It builds Pi's colors from your terminal's theme, so Pi matches the terminal instead of bringing its own palette:
12
+
13
+ - Pi queries the terminal's default foreground and background colors and its 16 ANSI colors.
14
+ - Each Pi color takes its hue from one ANSI color, for example errors from red and links from blue.
15
+ - Pi sets each color's lightness so that it stands out from the background by a minimum contrast. Body text keeps at least a 4.5:1 WCAG contrast ratio on the background and every panel.
16
+ - When the terminal switches between light and dark, Pi queries the colors again and rebuilds the theme.
17
+
18
+ The theme adapts to what the terminal reports:
19
+
20
+ | Terminal reports | Result |
21
+ |---|---|
22
+ | Background and ANSI colors | Colors from the terminal palette, placed for the actual background. |
23
+ | Background only | Pi's own hues, placed for the actual background. |
24
+ | Nothing | ANSI color indices and the terminal's default colors, which the terminal renders itself. Secondary text is faint, and panels have no background color. |
25
+
26
+ Pi asks the terminal for its colors when it starts. Terminals usually answer within a few milliseconds, and Pi waits at most 100 ms before showing the startup header. If the terminal does not answer in time, Pi uses the ANSI color fallback, and it still applies the colors if they arrive later, for example over a slow SSH connection. `system` is a reserved name: a custom theme with that name is ignored.
27
+
28
+ <a id="selecting-a-theme"></a>
29
+
30
+ ## Choose a theme
31
+
32
+ Open `/settings` and select **Theme**. You can use one theme for every terminal appearance or choose separate themes for light and dark terminals.
33
+
34
+ The selection is saved as the `theme` [setting](settings.md#terminal-and-display):
35
+
36
+ ```json
37
+ {
38
+ "theme": "dark"
39
+ }
40
+ ```
41
+
42
+ Without a `theme` setting, Pi uses `system`.
43
+
44
+ Automatic mode stores the light theme first and the dark theme second:
45
+
46
+ ```json
47
+ {
48
+ "theme": "light/dark"
49
+ }
50
+ ```
51
+
52
+ Pi decides whether the terminal is light or dark from its reported background and foreground colors. If the terminal does not report its background, Pi uses the terminal's light/dark notification, then the `COLORFGBG` environment variable, then dark. The same decision picks the theme of a light/dark pair and the appearance of `system`. When automatic mode is active, Pi changes themes when the terminal reports an appearance change. Theme names cannot contain `/` because Pi reserves it for this setting format.
53
+
54
+ Use `--use-theme` to choose the initial theme for one invocation without changing the saved setting:
55
+
56
+ ```bash
57
+ pi --use-theme light
58
+ pi --use-theme light/dark
59
+ ```
60
+
61
+ See [CLI resources](cli.md#resources) for the command-line option.
62
+
63
+ ## Create a custom theme
64
+
65
+ Copy one of the [built-in themes](https://github.com/earendil-works/pi/tree/main/packages/coding-agent/src/modes/interactive/theme) or create a new JSON file conforming to the [schema](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json). The built-in themes use OKHSL colors, with variables for colors that several roles share, so you can adjust a hue, saturation, or lightness directly.
66
+
67
+ 1. Save the file as `<agent-dir>/themes/my-theme.json`. The agent directory defaults to `~/.pi/agent`.
68
+ 2. Set its `name` to `my-theme`.
69
+ 3. Change values in `vars` and `colors`.
70
+ 4. Select `my-theme` through `/settings`.
71
+
72
+ Use the theme name as the filename. Pi hot-reloads the active user theme only from `<agent-dir>/themes/<name>.json`. Run `/reload` after adding or changing a theme from any other source.
73
+
74
+ ## Understand the theme file
75
+
76
+ | Property | Required | Responsibility |
77
+ |---|---|---|
78
+ | `$schema` | No | Enables editor validation and completion against Pi's published schema. |
79
+ | `name` | Yes | Identifies the theme in selectors and settings. It must be unique, cannot contain `/`, and cannot be `system`. |
80
+ | `appearance` | No | `"dark"` or `"light"`: the background the theme is designed for. Pi detects it from the theme colors when omitted. |
81
+ | `vars` | No | Defines reusable color values. Variables can reference other variables. |
82
+ | `colors` | Yes | Assigns colors to terminal UI roles. The schema identifies required and optional roles. |
83
+ | `export` | No | Overrides page and panel backgrounds in HTML exports. |
84
+
85
+ A color can be written in six forms:
86
+
87
+ | Form | Example | Meaning |
88
+ |---|---|---|
89
+ | RGB hexadecimal | `"#0af"` or `"#00aaff"` | A three- or six-digit sRGB color. |
90
+ | OKLCH | `"oklch(62% 0.1 200)"` | Perceptual lightness, chroma, and hue. |
91
+ | OKHSL | `"okhsl(250 60% 55%)"` | Hue, saturation, and lightness. Saturation is relative to the most the sRGB gamut allows at that hue and lightness, so every value is in gamut and equal saturation looks equally colorful. |
92
+ | 256-color index | `39` | An ANSI palette index from `0` through `255`. |
93
+ | Variable reference | `"primary"` | The value of an entry in `vars`. |
94
+ | Terminal default | `""` | The terminal's default foreground or background color. |
95
+
96
+ Terminal default colors render as the terminal's own colors. Where Pi needs a concrete value, such as HTML export or extension color math, it uses the default colors the terminal reports, or a black or white guess based on the theme's appearance.
97
+
98
+ Pi resolves chained variable references. A missing variable or circular reference makes the theme invalid. Pi uses truecolor when available, gamut-maps OKLCH to sRGB, and approximates colors for 256-color terminals. HTML exports convert OKHSL values to hexadecimal because CSS does not support them. If colors differ from their source values, check your terminal's truecolor detection and contrast settings. See [Configure Your Terminal](terminal-setup.md#override-detected-capabilities).
99
+
100
+ Use the [theme JSON schema](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json) for the exact properties, required colors, and accepted value types.
101
+
102
+ Pi reports invalid theme files during startup and `/reload`.
103
+
104
+ ## Find the color to change
105
+
106
+ Theme colors describe interface roles rather than individual components. Use these groups to find the relevant part of the schema:
107
+
108
+ | Area | Color names |
109
+ |---|---|
110
+ | General interface | `accent`, `border*`, `text`, `muted`, `dim`, `success`, `error`, `warning` |
111
+ | Selection and fullscreen | `selectedBg`, `searchMatch*`, `scrollbar*` |
112
+ | Messages | `userMessage*`, `customMessage*`, `thinkingText` |
113
+ | Tool execution | `toolPendingBg`, `toolSuccessBg`, `toolErrorBg`, `toolTitle`, `toolOutput` |
114
+ | Markdown | `md*` |
115
+ | Tool diffs | `toolDiff*` |
116
+ | Syntax highlighting | `syntax*` |
117
+ | Editor modes | `thinking*`, `bashMode` |
118
+ | HTML export | `export.pageBg`, `export.cardBg`, `export.infoBg` |
119
+
120
+ The schema is the format reference. The built-in themes provide complete values that you can copy and adjust.
121
+
122
+ Five colors are optional and inherit another color when omitted:
123
+
124
+ | Optional color | Fallback |
125
+ |---|---|
126
+ | `scrollbarTrack` | `muted` |
127
+ | `scrollbarThumb` | `text` |
128
+ | `searchMatchBg` | `selectedBg` |
129
+ | `searchMatchText` | `text` |
130
+ | `thinkingMax` | `thinkingXhigh` |
131
+
132
+ If `export` colors are omitted, Pi derives HTML page and panel backgrounds from `userMessageBg`.
133
+
134
+ ## Load a theme from a project or package
135
+
136
+ Place a project theme in `.pi/themes/`. Project themes load only after [project trust](security.md#understand-project-trust) is granted.
137
+
138
+ You can also load theme files and directories through the `themes` setting or distribute them in a Pi package. See [Configuration](configuration.md), [Settings](settings.md#resources), and [Pi Packages](packages.md).
139
+
140
+ Each loaded theme must have a unique name. Pi reports duplicate names as resource collisions.
@@ -0,0 +1,59 @@
1
+ > Source: [packages/coding-agent/docs/tmux.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/docs/tmux.md)
2
+ > Retrieved with Firecrawl: 2026-10-05. Repository snapshot: `b78e6a9085343ec0f308c3d377da72528b4cf7ee`.
3
+ > Relative documentation links point to local copies where available, otherwise to the source snapshot.
4
+
5
+ # Run Pi in tmux
6
+
7
+ Pi works inside tmux, but tmux can report `Shift+Enter`, `Ctrl+Enter`, and plain `Enter` as the same key. Enable extended keys so Pi can distinguish them.
8
+
9
+ ## Check your tmux version
10
+
11
+ ```bash
12
+ tmux -V
13
+ ```
14
+
15
+ For tmux 3.5 or newer, use the recommended CSI-u configuration below. For tmux 3.2 through 3.4, use the older-version configuration.
16
+
17
+ ## Enable extended keys in tmux 3.5 or newer
18
+
19
+ Add these lines to `~/.tmux.conf`:
20
+
21
+ ```tmux
22
+ set -g extended-keys on
23
+ set -g extended-keys-format csi-u
24
+ ```
25
+
26
+ Pi requests extended-key reporting when the terminal does not provide the Kitty keyboard protocol directly. CSI-u is the most reliable format for forwarding modified keys through tmux.
27
+
28
+ ## Restart tmux
29
+
30
+ The configuration applies to the tmux server. To guarantee that it is active, close your tmux sessions and start a new server.
31
+
32
+ If you choose to stop the server from the command line, save your work first. This command terminates every session managed by that server:
33
+
34
+ ```bash
35
+ tmux kill-server
36
+ tmux
37
+ ```
38
+
39
+ ## Verify modified keys
40
+
41
+ Start Pi inside the new tmux session and check that:
42
+
43
+ 1. `Shift+Enter` inserts a new line in the editor.
44
+ 2. `Enter` submits the prompt.
45
+ 3. `Alt+Enter` queues a follow-up on macOS and Linux. Windows and WSL use `Ctrl+Q` by default.
46
+
47
+ If these keys still behave like plain `Enter`, verify that the terminal outside tmux can report modified keys. See [Configure your terminal](terminal-setup.md).
48
+
49
+ ## Use tmux 3.2 through 3.4
50
+
51
+ These versions support extended keys but not `extended-keys-format csi-u`. Add only:
52
+
53
+ ```tmux
54
+ set -g extended-keys on
55
+ ```
56
+
57
+ Pi supports the xterm `modifyOtherKeys` format used by these versions. Restart tmux and repeat the verification steps.
58
+
59
+ For older versions, upgrade tmux or use Pi outside tmux rather than relying on modified Enter shortcuts.
@@ -0,0 +1,168 @@
1
+ > Source: [README.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/README.md)
2
+ > Retrieved with Firecrawl: 2026-10-05. Repository snapshot: `b78e6a9085343ec0f308c3d377da72528b4cf7ee`.
3
+ > Relative documentation links point to local copies where available, otherwise to the source snapshot.
4
+
5
+ <p align="center">
6
+ <a href="https://pi.dev">
7
+ <img alt="pi logo" src="https://pi.dev/logo-auto.svg" width="128">
8
+ </a>
9
+ </p>
10
+ <p align="center">
11
+ <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>
12
+ <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>
13
+ </p>
14
+
15
+ > New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See [CONTRIBUTING.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/CONTRIBUTING.md).
16
+
17
+ # Pi
18
+
19
+ Pi is a minimal, extensible agent harness that you can make your own.
20
+
21
+ Adapt Pi to your workflows, not the other way around. Customize Pi with [extensions](extensions.md), [skills](skills.md), [prompt templates](prompt-templates.md), and [themes](themes.md). Bundle them as [Pi packages](packages.md) and share via npm or git.
22
+
23
+ Pi ships with powerful defaults but skips features like sub-agents and plan mode. Ask Pi to build what you want, or install a package that does it your way.
24
+
25
+ Use Pi [interactively](usage.md), automate it in [print or JSON mode](cli.md), control it over [RPC](rpc.md), or build apps with the [Pi TypeScript SDK](sdk.md). See [OpenClaw](https://github.com/OpenClaw/OpenClaw) for a real-world integration.
26
+
27
+ ## Getting started
28
+
29
+ Install the command-line interface:
30
+
31
+ ```bash
32
+ curl -fsSL https://pi.dev/install.sh | sh
33
+ ```
34
+
35
+ On Windows:
36
+
37
+ ```shell
38
+ powershell -c "irm https://pi.dev/install.ps1 | iex"
39
+ ```
40
+
41
+ The installer pins all dependencies and updates Pi with `pi update`. Alternatively, install directly with npm, which does not pin transitive dependencies:
42
+
43
+ ```bash
44
+ npm install -g --ignore-scripts @earendil-works/pi-coding-agent
45
+ ```
46
+
47
+ Pi requires Node.js 22.19 or newer. The macOS, Linux, and Windows installers can install it if needed. Pi does not require dependency lifecycle scripts for a normal npm installation.
48
+
49
+ Start Pi in the directory where you want it to work:
50
+
51
+ ```bash
52
+ cd /path/to/project
53
+ pi
54
+ ```
55
+
56
+ For a built-in AI provider, run `/login` inside Pi to connect a subscription or API key. Then give Pi a task.
57
+
58
+ See the [documentation](https://pi.dev/docs/latest) for full setup and usage instructions, or [visit pi.dev](https://pi.dev) for demos.
59
+
60
+ ## Run with Nix
61
+
62
+ ```bash
63
+ nix run github:earendil-works/pi/stable
64
+ ```
65
+
66
+ `stable` points at the latest release. Install it with `nix profile add github:earendil-works/pi/stable` and update with `nix profile upgrade pi`. Use a release tag such as `github:earendil-works/pi/v1.0.0` to pin a version, or `github:earendil-works/pi` for unreleased changes on `main`. Nix builds Pi from source.
67
+
68
+ Supports ARM64 and x86-64 on Linux and macOS. Use `nix build .` or `nix run .` to build or run your checkout.
69
+
70
+ Nix builds are offline, so the bundled model data comes from a pi.dev model catalog revision pinned in `nix/model-catalog.json`. At runtime, Pi still overlays newer catalog data from pi.dev as usual. The Nix workflow replaces the pin on `main` when it no longer matches the checkout, for example after a provider is added or gains a new model type. To refresh it by hand:
71
+
72
+ ```bash
73
+ npm run update:model-catalog-pin
74
+ ```
75
+
76
+ ## Packages
77
+
78
+ This monorepo contains the Pi CLI and its supporting libraries.
79
+
80
+ | Package | Description |
81
+ |---------|-------------|
82
+ | **[@earendil-works/chord](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/chord)** | Standalone application-composition runtime for services, replicated state, RPC, and plugins |
83
+ | **[@earendil-works/pi-telemetry](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/telemetry)** | Vendor-neutral telemetry contracts, reference adapter, conformance tests, and typed schemas |
84
+ | **[@earendil-works/pi-ai](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/ai)** | Unified multi-provider LLM API (OpenAI, Anthropic, Google, etc.) |
85
+ | **[@earendil-works/pi-durable](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/durable)** | Durable conversation, task, and document runtime |
86
+ | **[@earendil-works/pi-agent-core](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/agent)** | Agent runtime with tool calling and state management |
87
+ | **[@earendil-works/pi-coding-agent](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent)** | Interactive coding agent CLI |
88
+ | **[@earendil-works/pi-tui](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/tui)** | Terminal UI library with differential rendering |
89
+
90
+ For Slack/chat automation and workflows see [earendil-works/pi-chat](https://github.com/earendil-works/pi-chat).
91
+
92
+ ## Permissions & Containerization
93
+
94
+ Pi does not include a built-in permission system for restricting filesystem, process, network, or credential access. By default, it runs with the permissions of the user and process that launched it.
95
+
96
+ If you need stronger boundaries, containerize or sandbox Pi. See [packages/coding-agent/docs/containerization.md](containerization.md) for three patterns:
97
+
98
+ - **Gondolin extension**: keep `pi` and provider auth on the host while routing built-in tools and `!` commands into a local Linux micro-VM.
99
+ - **Plain Docker**: run the whole `pi` process in a local container for simple isolation.
100
+ - **OpenShell**: run the whole `pi` process in a policy-controlled sandbox.
101
+
102
+ ## Contributing
103
+
104
+ See [CONTRIBUTING.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/CONTRIBUTING.md) for contribution guidelines and [AGENTS.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/AGENTS.md) for project-specific rules (for both humans and agents). Longer term plans for Pi can also be found in [RFCs](https://rfc.earendil.com/keyword/pi/).
105
+
106
+ ## Development
107
+
108
+ ```bash
109
+ npm install --ignore-scripts # Install all dependencies without running lifecycle scripts
110
+ npm run build # Refresh model data, then build all packages
111
+ npm run build:offline # Rebuild using existing model data without network access
112
+ npm run check # Lint, format, and type check
113
+ ./test.sh # Run tests (skips LLM-dependent tests without API keys)
114
+ ./pi-test.sh # Run pi from sources (can be run from any directory)
115
+ ```
116
+
117
+ ## Building standalone binaries from release source
118
+
119
+ GitHub releases include a versioned source archive covered by the release's `SHA256SUMS` file. Extract it and run the same build script used for the official standalone binaries:
120
+
121
+ ```bash
122
+ VERSION="<release-version>"
123
+ tar -xzf "pi-${VERSION}-source.tar.gz"
124
+ cd "pi-${VERSION}"
125
+ ./scripts/build-binaries.sh --offline-model-data --platform linux-x64 --out "$PWD/out"
126
+ ```
127
+
128
+ The archive includes release model data and native prebuilds. `--offline-model-data` uses that model data without refreshing provider catalogs. The script installs dependencies and builds the executable with its runtime assets; pass `--skip-install` if dependencies are already provided.
129
+
130
+ ## Supply-chain hardening
131
+
132
+ We treat npm dependency changes as reviewed code changes.
133
+
134
+ - Direct external dependencies are pinned to exact versions. Internal workspace packages remain version-ranged.
135
+ - `.npmrc` sets `save-exact=true` and `min-release-age=2` to avoid same-day dependency releases during npm resolution.
136
+ - `package-lock.json` is the dependency ground truth. Pre-commit blocks accidental lockfile commits unless `PI_ALLOW_LOCKFILE_CHANGE=1` is set.
137
+ - `npm run check` verifies pinned direct deps, native TypeScript import compatibility, and the generated coding-agent install lock.
138
+ - The pi.dev installer installs from `packages/coding-agent/install-lock/`, generated from the root lockfile, to pin transitive deps. The npm package does not pin transitive deps.
139
+ - Release smoke tests use `npm run release:local` to build, pack, and create isolated npm and Bun installs outside the repo before tagging a release.
140
+ - Local release installs, documented npm installs, and `pi update --self` use `--ignore-scripts` where supported.
141
+ - CI installs with `npm ci --ignore-scripts`, and a scheduled GitHub workflow runs `npm audit --omit=dev` plus `npm audit signatures --omit=dev`.
142
+ - Install lock generation has an explicit allowlist for dependency lifecycle scripts; new lifecycle-script deps fail checks until reviewed.
143
+
144
+ ## Share your OSS coding agent sessions
145
+
146
+ If you use Pi or other coding agents for open source work, please share your sessions.
147
+
148
+ Public OSS session data helps improve coding agents with real-world tasks, tool use, failures, and fixes instead of toy benchmarks.
149
+
150
+ For the full explanation, see [this post on X](https://x.com/badlogicgames/status/2037811643774652911).
151
+
152
+ 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`.
153
+
154
+ You can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `pi-mono` sessions.
155
+
156
+ I regularly publish my own `pi-mono` work sessions here:
157
+
158
+ - [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)
159
+
160
+ ## License
161
+
162
+ MIT
163
+
164
+ <p align="center">
165
+ <a href="https://pi.dev">pi.dev</a> domain graciously donated by
166
+ <br /><br />
167
+ <a href="https://exe.dev"><img src="https://raw.githubusercontent.com/earendil-works/pi/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
168
+ </p>
@@ -0,0 +1,129 @@
1
+ > Source: [packages/coding-agent/docs/tui.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/docs/tui.md)
2
+ > Retrieved with Firecrawl: 2026-10-05. Repository snapshot: `b78e6a9085343ec0f308c3d377da72528b4cf7ee`.
3
+ > Relative documentation links point to local copies where available, otherwise to the source snapshot.
4
+
5
+ # Terminal UI
6
+
7
+ `@earendil-works/pi-tui` provides the terminal component system used by Pi. Extensions use it when built-in dialogs, notifications, status text, and widgets are not enough for the interaction they need.
8
+
9
+ Start with `ctx.ui` methods from an [extension](extensions.md#interact-with-the-user). Build a custom component only when the UI needs its own rendering, keyboard or mouse input, focus, layout, or lifecycle.
10
+
11
+ ## Choose an integration point
12
+
13
+ | Need | Use |
14
+ |---|---|
15
+ | Select, confirm, input, or multi-line editor | `ctx.ui.select()`, `confirm()`, `input()`, or `editor()` |
16
+ | Non-blocking feedback | `ctx.ui.notify()` or `setStatus()` |
17
+ | Persistent content near the editor | `ctx.ui.setWidget()` |
18
+ | Replace the header, footer, or editor | The corresponding `ctx.ui` component factory |
19
+ | Temporary interactive screen or overlay | `ctx.ui.custom()` |
20
+ | Custom rendering for a tool or session entry | An extension renderer |
21
+
22
+ These APIs receive Pi’s active theme and keybindings where needed. Do not create a second terminal renderer inside an extension.
23
+
24
+ ## Understand the component model
25
+
26
+ A component renders an array of terminal lines for an available width. It can optionally handle keyboard and mouse input, and it must invalidate cached output when its state or theme-dependent content changes.
27
+
28
+ Every rendered line must fit within the supplied width. Measure visible terminal columns rather than string length because ANSI escapes, wide characters, emoji, and combining characters change display width.
29
+
30
+ Use `visibleWidth()`, `truncateToWidth()`, `sliceByColumn()`, and `wrapTextWithAnsi()` instead of implementing terminal-width handling yourself. Pi resets styling and hyperlinks after every line, so reapply styles on each rendered line.
31
+
32
+ After changing component state, invalidate the affected component and call the injected `tui.requestRender()`. The TUI coalesces render requests and updates the terminal.
33
+
34
+ ## Compose built-in components
35
+
36
+ The package includes components for common layouts and controls:
37
+
38
+ - `Text`, `Markdown`, `Image`, and `TruncatedText` render content.
39
+ - `Container`, `VStack`, `HStack`, `Box`, and `Spacer` compose layouts.
40
+ - `Input` and `Editor` accept text.
41
+ - `SelectList` and `SettingsList` implement searchable selection and settings flows.
42
+ - `ScrollView` provides a bounded scrollable viewport.
43
+ - `Loader` and `CancellableLoader` report ongoing work.
44
+ - `MouseRegion` adds pointer behavior around another component.
45
+
46
+ Prefer these components over rebuilding selection, scrolling, text editing, or width handling. The extension examples show how to combine them with Pi’s borders and themes.
47
+
48
+ ## Handle keyboard input and focus
49
+
50
+ Use `matchesKey()` and `Key` for terminal keyboard input. The parser accounts for supported terminal protocols and key modifiers. Extension components should use the injected `KeybindingsManager` for configurable application actions.
51
+
52
+ A component that displays a text cursor should implement `Focusable` and place `CURSOR_MARKER` immediately before its visual cursor. The TUI uses that marker to position the hardware cursor for input method editors.
53
+
54
+ Containers that wrap an `Input` or `Editor` must propagate their `focused` state to that child. Without propagation, Chinese, Japanese, Korean, and other IME candidate windows can appear at the wrong screen position.
55
+
56
+ Extend Pi’s `CustomEditor` when replacing the main editor. It preserves application shortcuts and agent controls.
57
+
58
+ Forward keys your editor does not own to the base implementation, and restore the default by clearing the custom editor factory.
59
+
60
+ ## Handle mouse input
61
+
62
+ Fullscreen mode routes normalized mouse events to components. A handler can mark an event handled, capture a drag sequence, request focus, or request a render.
63
+
64
+ Unhandled wheel events scroll the nearest `ScrollView`. Unhandled primary-button drags remain available for transcript selection. OSC 8 links take precedence over enclosing click regions.
65
+
66
+ Regular mode leaves mouse input to the terminal because the terminal owns scrollback. Design every interaction with a keyboard path even when fullscreen mouse input is available.
67
+
68
+ ## Use custom screens and overlays
69
+
70
+ `ctx.ui.custom()` temporarily gives one component control of the interactive area and resolves when that component calls the supplied completion callback.
71
+
72
+ Pass `overlay: true` to draw above existing content. Overlay options control size, anchors, offsets, margins, and responsive visibility. An overlay handle can change focus or temporarily hide and show the overlay with `setHidden()` while the interaction remains active.
73
+
74
+ Focused overlays retain input ownership across ordinary renders. If another component should receive input while an overlay remains visible, explicitly release or redirect focus through the handle.
75
+
76
+ Treat each custom component instance as belonging to one interaction. Create a new instance when starting that interaction again.
77
+
78
+ Finish the interaction with the completion callback supplied to the component factory. It resolves the `ctx.ui.custom()` promise and disposes the component. Do not call `OverlayHandle.hide()` on an overlay created by `ctx.ui.custom()`.
79
+
80
+ See [`overlay-qa-tests.ts`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/overlay-qa-tests.ts) for positioning, stacking, focus, responsive visibility, and animation behavior.
81
+
82
+ ## Apply themes correctly
83
+
84
+ Use the theme passed to the extension or component callback. Theme helpers produce ANSI-styled strings for semantic colors such as accent, muted text, success, warnings, errors, tool output, and Markdown.
85
+
86
+ Use `theme.style()` to combine foreground and background colors with text attributes:
87
+
88
+ ```typescript
89
+ return new Text(
90
+ theme.style("Done!", {
91
+ fg: "success",
92
+ bg: "toolSuccessBg",
93
+ bold: true,
94
+ }),
95
+ 0,
96
+ 0,
97
+ );
98
+ ```
99
+
100
+ A style color can be a semantic theme token or a concrete `Color`. Foreground tokens are accepted as `fg` and background tokens as `bg`; to use a token's color in the other position, pass its concrete color, for example `{ fg: theme.colors.userMessageBg }`. Access concrete colors through `theme.colors` and use utilities such as `mixColors()` from `@earendil-works/pi-tui` when color math is needed. Tokens that a theme sets to the terminal default render with the terminal's own color; `theme.colors` reports the color the terminal announced for them, or a guess when it did not. Use `theme.appearance` (`"dark"` or `"light"`) to decide, for example, whether to lighten or darken a color. Pi converts the result to truecolor or 256-color output based on terminal capabilities. Theme tokens are converted once per theme; compute concrete colors outside the render path when possible.
101
+
102
+ The existing `theme.fg()` and `theme.bg()` helpers remain available for applying one semantic color.
103
+
104
+ Do not permanently store strings with theme colors unless `invalidate()` rebuilds them. A theme change clears render caches, but it cannot remove old ANSI colors embedded in application state.
105
+
106
+ Theme callbacks evaluated during rendering do not need special rebuilding. Stateless components can also calculate themed output on every render.
107
+
108
+ Use [Themes](themes.md) to create terminal palettes. Use Pi’s `getMarkdownTheme()` when rendering Markdown that should match the active application theme.
109
+
110
+ ## Keep rendering responsive
111
+
112
+ Rendering runs on the interactive path. Cache expensive layout and highlighting work by width and content, then clear that cache from `invalidate()`.
113
+
114
+ Keep the default view compact and reveal detail through expansion or a dedicated screen. For custom tool rendering, handle partial results and reuse the previous component when it can be updated safely.
115
+
116
+ Use `PI_TUI_WRITE_LOG` to capture the raw ANSI stream when diagnosing rendering problems. Test narrow widths, wide characters, resize events, theme changes, focus transitions, and both regular and fullscreen modes.
117
+
118
+ ## Examples and source
119
+
120
+ The checked extension examples cover the main patterns:
121
+
122
+ - [`preset.ts`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/preset.ts) and [`tools.ts`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/tools.ts) use selection and settings lists.
123
+ - [`qna.ts`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/qna.ts) uses cancellable asynchronous UI.
124
+ - [`modal-editor.ts`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/modal-editor.ts) replaces the editor.
125
+ - [`custom-footer.ts`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/custom-footer.ts) replaces the footer.
126
+ - [`widget-placement.ts`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/widget-placement.ts) places persistent content around the editor.
127
+ - [`doom-overlay/`](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/examples/extensions/doom-overlay) demonstrates a continuously rendered overlay.
128
+
129
+ The public exports are defined in [`packages/tui/src/index.ts`](https://github.com/earendil-works/pi/blob/main/packages/tui/src/index.ts). See [Extensions](extensions.md) for extension lifecycle, state, tools, events, and mode behavior.
@@ -0,0 +1,98 @@
1
+ > Source: [packages/coding-agent/docs/usage.md](https://github.com/earendil-works/pi/blob/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/docs/usage.md)
2
+ > Retrieved with Firecrawl: 2026-10-05. Repository snapshot: `b78e6a9085343ec0f308c3d377da72528b4cf7ee`.
3
+ > Relative documentation links point to local copies where available, otherwise to the source snapshot.
4
+
5
+ # Use Pi in the terminal
6
+
7
+ Run `pi` from the folder you want to work in. Pi uses that folder to discover files, instructions, and configuration, and to group saved sessions. If you have not installed Pi or chosen a model yet, follow the [Quickstart](quickstart.md).
8
+
9
+ Pi may ask whether you trust the working folder before loading its project resources. See [Project trust](security.md#understand-project-trust).
10
+
11
+ <p align="center"><img src="https://raw.githubusercontent.com/earendil-works/pi/b78e6a9085343ec0f308c3d377da72528b4cf7ee/packages/coding-agent/docs/images/interactive-mode.png" alt="Pi interactive mode showing a conversation, editor, and status information" width="750"></p>
12
+
13
+ The transcript shows your prompts, Pi's responses, tool calls, results, and errors. You write prompts and commands in the editor. The footer shows the current folder, session, model, context usage, and accumulated usage and cost.
14
+
15
+ ## Enter a prompt
16
+
17
+ Type a request and press `Enter` to send it. Use `Shift+Enter` to add a line, or press `Ctrl+G` to work on a longer prompt in your configured external editor.
18
+
19
+ To include files or images:
20
+
21
+ - Type `@` to search for a file and add it to your prompt.
22
+ - Press `Tab` to complete a path.
23
+ - Paste an image or drag it into a compatible terminal.
24
+
25
+ ## Follow Pi's work
26
+
27
+ Pi shows each tool call and result while it works. Press `Ctrl+O` to expand or collapse tool output. Press `Ctrl+T` to show or hide thinking blocks.
28
+
29
+ The startup header lists the instructions and resources Pi loaded. The editor border indicates the current thinking level. The footer updates as the model uses context and reports usage.
30
+
31
+ Pi does not ask before every tool call. Review commands and changed files, and use a sandbox for untrusted or unattended work. See [Security](security.md).
32
+
33
+ ## Change direction
34
+
35
+ You can send more input while Pi is working:
36
+
37
+ | What you want | Action |
38
+ |---|---|
39
+ | Adjust the current task | Type a message and press `Enter` |
40
+ | Add work after the current task | Type a message and press `Alt+Enter` |
41
+ | Return queued messages to the editor | Press `Alt+Up` |
42
+ | Stop the current task | Press `Escape` |
43
+
44
+ A message sent with `Enter` waits until the current response and its tool calls finish, then guides the next response. A follow-up sent with `Alt+Enter` waits until Pi finishes the current task. Aborting returns queued messages to the editor.
45
+
46
+ Windows Terminal reserves some Alt shortcuts. See [Terminal Setup](terminal-setup.md) for the Windows alternatives.
47
+
48
+ ## Change the model or settings
49
+
50
+ Type `/` to search the available commands. The commands you will use most often are:
51
+
52
+ - `/model` selects a model. Press `Ctrl+L` to open the same selector.
53
+ - `/thinking` selects how much reasoning the current model uses. Press `Shift+Tab` to cycle through supported levels.
54
+ - `/login` and `/logout` manage provider access.
55
+ - `/settings` changes common preferences.
56
+
57
+ Prompt templates, skills, and extensions can add more commands to the same menu. See [Choose a Model](models.md), [Configuration](configuration.md), or the complete [Slash Commands reference](slash-commands.md).
58
+
59
+ ## Continue or start over
60
+
61
+ Pi saves sessions automatically unless session persistence is disabled.
62
+
63
+ - `/new` starts a new session.
64
+ - `/resume` opens another saved session.
65
+ - `/name` gives the current session a recognizable name.
66
+ - `/session` shows its file, ID, message count, token usage, and cost.
67
+
68
+ Use `/tree`, `/fork`, or `/clone` when you want to explore another approach without losing existing work. Use `/compact` to reduce the conversation history sent to the model. See [Sessions and Context](sessions.md) for these workflows.
69
+
70
+ After leaving Pi, run `pi --continue` from the same folder to resume its most recent session.
71
+
72
+ ## Run a terminal command
73
+
74
+ Prefix a command with `!` to run it and include its output in the conversation:
75
+
76
+ ```text
77
+ !git status
78
+ ```
79
+
80
+ Use `!!` when you want to run a command without sending its output to the model.
81
+
82
+ ## Copy, export, or share results
83
+
84
+ Press `Ctrl+X` or run `/copy` to copy the last assistant response. Use `/export` to save the session as HTML or JSONL.
85
+
86
+ Use `/share` to upload the session and get a viewer link. With Radius authentication, the artifact is visible to your Radius organization. Otherwise, Pi creates a private GitHub gist through the GitHub CLI. Review the session first because it can contain prompts, tool output, file contents, and credentials exposed during the conversation.
87
+
88
+ ## Adjust the terminal
89
+
90
+ Fullscreen mode, the default, keeps the editor and status area fixed while the transcript scrolls within the terminal window. Regular mode uses the terminal's normal scrollback. Choose a mode through `/settings` or `--tui-mode`.
91
+
92
+ Terminal support for mouse input, keyboard shortcuts, and inline images varies. See [Terminal Setup](terminal-setup.md) for platform-specific configuration and [Keybindings](keybindings.md) for every configurable shortcut. Run `/hotkeys` to inspect the shortcuts active in your current session.
93
+
94
+ ## Collect diagnostic information
95
+
96
+ When troubleshooting terminal rendering or conversation state, run `/debug`. Pi writes the rendered terminal lines and current session messages to `pi-debug.log` in your [agent directory](configuration.md#agent-directory).
97
+
98
+ Review this file before sharing it. It can contain prompts, model responses, tool output, file contents, and terminal data.