mu-agent 0.1.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 (280) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +62 -0
  4. package/dist/bundle/chunks/anthropic-messages-MYU5ZMRF.js +6 -0
  5. package/dist/bundle/chunks/anthropic.js +75 -0
  6. package/dist/bundle/chunks/azure-openai-responses-HUSQ3GP2.js +2 -0
  7. package/dist/bundle/chunks/bedrock-converse-stream.js +83 -0
  8. package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
  9. package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
  10. package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
  11. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  12. package/dist/bundle/chunks/chunk-A3JYRWB6.js +2 -0
  13. package/dist/bundle/chunks/chunk-DRQDKNXA.js +2 -0
  14. package/dist/bundle/chunks/chunk-DTD7JQ7Y.js +42 -0
  15. package/dist/bundle/chunks/chunk-FUXEF6JQ.js +44 -0
  16. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  17. package/dist/bundle/chunks/chunk-NUHFSC37.js +25 -0
  18. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  19. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  20. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  21. package/dist/bundle/chunks/chunk-QB4HYZZE.js +1561 -0
  22. package/dist/bundle/chunks/chunk-RCZIEVGO.js +11 -0
  23. package/dist/bundle/chunks/chunk-S7SZN6Z3.js +2 -0
  24. package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
  25. package/dist/bundle/chunks/chunk-TRDNDS6A.js +4 -0
  26. package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  27. package/dist/bundle/chunks/chunk-WIUZI2CJ.js +11 -0
  28. package/dist/bundle/chunks/chunk-XDUWOHPL.js +6 -0
  29. package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
  30. package/dist/bundle/chunks/chunk-Z2DUOAN4.js +2 -0
  31. package/dist/bundle/chunks/github-copilot.js +2 -0
  32. package/dist/bundle/chunks/google-generative-ai-IMS5EK2Y.js +2 -0
  33. package/dist/bundle/chunks/google-vertex-O4YJEQUW.js +2 -0
  34. package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
  35. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  36. package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +21 -0
  37. package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +2 -0
  38. package/dist/bundle/chunks/kimi-coding.js +2 -0
  39. package/dist/bundle/chunks/lib-HGQMNYVT.js +9 -0
  40. package/dist/bundle/chunks/mistral-conversations-NOSQHBEY.js +5 -0
  41. package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
  42. package/dist/bundle/chunks/node-O3RIBJRH.js +16 -0
  43. package/dist/bundle/chunks/node-TWVVAGPO.js +2 -0
  44. package/dist/bundle/chunks/openai-codex-responses-QDSOTBBO.js +10 -0
  45. package/dist/bundle/chunks/openai-codex.js +75 -0
  46. package/dist/bundle/chunks/openai-completions-KQPOPEVM.js +7 -0
  47. package/dist/bundle/chunks/openai-responses-HWEUZ6WZ.js +2 -0
  48. package/dist/bundle/chunks/openrouter-images-N4XVVFSD.js +2 -0
  49. package/dist/bundle/chunks/openrouter.js +75 -0
  50. package/dist/bundle/chunks/pi-messages-GFKBWJHZ.js +8 -0
  51. package/dist/bundle/chunks/radius.js +75 -0
  52. package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
  53. package/dist/bundle/chunks/virtual-modules-ROULVYS3.js +2 -0
  54. package/dist/bundle/chunks/xai.js +2 -0
  55. package/dist/bundle/cli.js +3 -0
  56. package/dist/bundle/index.js +2 -0
  57. package/dist/bundle/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  58. package/dist/bundle/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  59. package/dist/bundle/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  60. package/dist/bundle/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  61. package/dist/bundle/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  62. package/dist/bundle/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  63. package/dist/bundle/rpc-entry.js +3 -0
  64. package/dist/core/export-html/template.css +1066 -0
  65. package/dist/core/export-html/template.html +55 -0
  66. package/dist/core/export-html/template.js +1864 -0
  67. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  68. package/dist/core/export-html/vendor/marked.min.js +78 -0
  69. package/dist/modes/interactive/assets/clankolas.png +0 -0
  70. package/dist/modes/interactive/theme/dark.json +91 -0
  71. package/dist/modes/interactive/theme/light.json +90 -0
  72. package/dist/modes/interactive/theme/theme-controller.d.ts +41 -0
  73. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  74. package/dist/modes/interactive/theme/theme-controller.js +130 -0
  75. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  76. package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
  77. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  78. package/dist/modes/interactive/theme/theme-json.js +130 -0
  79. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  80. package/dist/modes/interactive/theme/theme-schema.json +356 -0
  81. package/dist/modes/interactive/theme/theme.d.ts +131 -0
  82. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  83. package/dist/modes/interactive/theme/theme.js +991 -0
  84. package/dist/modes/interactive/theme/theme.js.map +1 -0
  85. package/dist/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  86. package/dist/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  87. package/dist/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  88. package/dist/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  89. package/dist/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  90. package/dist/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  91. package/docs/compaction.md +444 -0
  92. package/docs/containerization.md +156 -0
  93. package/docs/custom-provider.md +786 -0
  94. package/docs/development.md +90 -0
  95. package/docs/docs.json +160 -0
  96. package/docs/environment-variables.md +100 -0
  97. package/docs/extensions.md +3037 -0
  98. package/docs/images/doom-extension.png +0 -0
  99. package/docs/images/exy.png +0 -0
  100. package/docs/images/interactive-mode.png +0 -0
  101. package/docs/images/tree-view.png +0 -0
  102. package/docs/index.md +84 -0
  103. package/docs/json.md +98 -0
  104. package/docs/keybindings.md +239 -0
  105. package/docs/llama-cpp.md +101 -0
  106. package/docs/models.md +605 -0
  107. package/docs/packages.md +228 -0
  108. package/docs/prompt-templates.md +96 -0
  109. package/docs/providers.md +317 -0
  110. package/docs/quickstart.md +167 -0
  111. package/docs/rpc.md +1618 -0
  112. package/docs/sdk.md +1226 -0
  113. package/docs/security.md +59 -0
  114. package/docs/session-format.md +480 -0
  115. package/docs/sessions.md +172 -0
  116. package/docs/settings.md +428 -0
  117. package/docs/shell-aliases.md +13 -0
  118. package/docs/skills.md +232 -0
  119. package/docs/terminal-setup.md +192 -0
  120. package/docs/termux.md +126 -0
  121. package/docs/themes.md +322 -0
  122. package/docs/tmux.md +63 -0
  123. package/docs/tui.md +961 -0
  124. package/docs/usage.md +312 -0
  125. package/docs/windows.md +39 -0
  126. package/examples/README.md +28 -0
  127. package/examples/extensions/README.md +212 -0
  128. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  129. package/examples/extensions/bash-spawn-hook.ts +30 -0
  130. package/examples/extensions/bookmark.ts +50 -0
  131. package/examples/extensions/border-status-editor.ts +150 -0
  132. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  133. package/examples/extensions/claude-rules.ts +86 -0
  134. package/examples/extensions/commands.ts +72 -0
  135. package/examples/extensions/confirm-destructive.ts +59 -0
  136. package/examples/extensions/custom-compaction.ts +117 -0
  137. package/examples/extensions/custom-footer.ts +64 -0
  138. package/examples/extensions/custom-header.ts +73 -0
  139. package/examples/extensions/custom-provider-anthropic/index.ts +617 -0
  140. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  141. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  142. package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  143. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  144. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  145. package/examples/extensions/dirty-repo-guard.ts +56 -0
  146. package/examples/extensions/doom-overlay/README.md +46 -0
  147. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  148. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  149. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  150. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  151. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  152. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  153. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  154. package/examples/extensions/doom-overlay/index.ts +74 -0
  155. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  156. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  157. package/examples/extensions/dynamic-resources/dynamic.json +81 -0
  158. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  159. package/examples/extensions/dynamic-resources/index.ts +15 -0
  160. package/examples/extensions/dynamic-tools.ts +74 -0
  161. package/examples/extensions/entry-renderer.ts +41 -0
  162. package/examples/extensions/event-bus.ts +43 -0
  163. package/examples/extensions/file-trigger.ts +41 -0
  164. package/examples/extensions/git-checkpoint.ts +53 -0
  165. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  166. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  167. package/examples/extensions/gondolin/index.ts +531 -0
  168. package/examples/extensions/gondolin/package-lock.json +185 -0
  169. package/examples/extensions/gondolin/package.json +19 -0
  170. package/examples/extensions/handoff.ts +190 -0
  171. package/examples/extensions/hello.ts +26 -0
  172. package/examples/extensions/hidden-thinking-label.ts +53 -0
  173. package/examples/extensions/inline-bash.ts +94 -0
  174. package/examples/extensions/input-transform-streaming.ts +39 -0
  175. package/examples/extensions/input-transform.ts +43 -0
  176. package/examples/extensions/interactive-shell.ts +196 -0
  177. package/examples/extensions/mac-system-theme.ts +47 -0
  178. package/examples/extensions/message-renderer.ts +59 -0
  179. package/examples/extensions/minimal-mode.ts +426 -0
  180. package/examples/extensions/modal-editor.ts +85 -0
  181. package/examples/extensions/model-status.ts +31 -0
  182. package/examples/extensions/notify.ts +57 -0
  183. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  184. package/examples/extensions/overlay-test.ts +153 -0
  185. package/examples/extensions/permission-gate.ts +34 -0
  186. package/examples/extensions/pirate.ts +47 -0
  187. package/examples/extensions/plan-mode/README.md +66 -0
  188. package/examples/extensions/plan-mode/index.ts +390 -0
  189. package/examples/extensions/plan-mode/utils.ts +168 -0
  190. package/examples/extensions/preset.ts +436 -0
  191. package/examples/extensions/project-trust.ts +64 -0
  192. package/examples/extensions/prompt-customizer.ts +49 -0
  193. package/examples/extensions/protected-paths.ts +30 -0
  194. package/examples/extensions/provider-payload.ts +18 -0
  195. package/examples/extensions/qna.ts +118 -0
  196. package/examples/extensions/question.ts +286 -0
  197. package/examples/extensions/questionnaire.ts +448 -0
  198. package/examples/extensions/rainbow-editor.ts +88 -0
  199. package/examples/extensions/reload-runtime.ts +37 -0
  200. package/examples/extensions/rpc-demo.ts +118 -0
  201. package/examples/extensions/sandbox/index.ts +321 -0
  202. package/examples/extensions/sandbox/package-lock.json +92 -0
  203. package/examples/extensions/sandbox/package.json +19 -0
  204. package/examples/extensions/send-user-message.ts +97 -0
  205. package/examples/extensions/session-name.ts +27 -0
  206. package/examples/extensions/shutdown-command.ts +63 -0
  207. package/examples/extensions/snake.ts +343 -0
  208. package/examples/extensions/space-invaders.ts +560 -0
  209. package/examples/extensions/ssh.ts +220 -0
  210. package/examples/extensions/status-line.ts +32 -0
  211. package/examples/extensions/structured-output.ts +65 -0
  212. package/examples/extensions/subagent/README.md +177 -0
  213. package/examples/extensions/subagent/agents/planner.md +37 -0
  214. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  215. package/examples/extensions/subagent/agents/scout.md +50 -0
  216. package/examples/extensions/subagent/agents/worker.md +24 -0
  217. package/examples/extensions/subagent/agents.ts +157 -0
  218. package/examples/extensions/subagent/index.ts +1038 -0
  219. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  220. package/examples/extensions/subagent/prompts/implement.md +10 -0
  221. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  222. package/examples/extensions/summarize.ts +199 -0
  223. package/examples/extensions/system-prompt-header.ts +17 -0
  224. package/examples/extensions/tic-tac-toe.ts +1008 -0
  225. package/examples/extensions/timed-confirm.ts +70 -0
  226. package/examples/extensions/titlebar-spinner.ts +58 -0
  227. package/examples/extensions/todo.ts +297 -0
  228. package/examples/extensions/tool-override.ts +144 -0
  229. package/examples/extensions/tools.ts +146 -0
  230. package/examples/extensions/trigger-compact.ts +50 -0
  231. package/examples/extensions/truncated-tool.ts +195 -0
  232. package/examples/extensions/widget-placement.ts +9 -0
  233. package/examples/extensions/with-deps/index.ts +32 -0
  234. package/examples/extensions/with-deps/package-lock.json +31 -0
  235. package/examples/extensions/with-deps/package.json +22 -0
  236. package/examples/extensions/working-indicator.ts +123 -0
  237. package/examples/extensions/working-message-test.ts +25 -0
  238. package/examples/plugins/pi-example-plugin/README.md +38 -0
  239. package/examples/plugins/pi-example-plugin/package.json +10 -0
  240. package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  241. package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
  242. package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  243. package/examples/rpc-extension-ui.ts +641 -0
  244. package/examples/sdk/01-minimal.ts +26 -0
  245. package/examples/sdk/02-custom-model.ts +49 -0
  246. package/examples/sdk/03-custom-prompt.ts +75 -0
  247. package/examples/sdk/04-skills.ts +55 -0
  248. package/examples/sdk/05-tools.ts +48 -0
  249. package/examples/sdk/06-extensions.ts +99 -0
  250. package/examples/sdk/07-context-files.ts +47 -0
  251. package/examples/sdk/08-prompt-templates.ts +51 -0
  252. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  253. package/examples/sdk/10-settings.ts +53 -0
  254. package/examples/sdk/11-sessions.ts +52 -0
  255. package/examples/sdk/12-full-control.ts +74 -0
  256. package/examples/sdk/13-session-runtime.ts +67 -0
  257. package/examples/sdk/README.md +140 -0
  258. package/judge/THIRD_PARTY_NOTICES.md +35 -0
  259. package/judge/agents/browser.md +17 -0
  260. package/judge/agents/investigator.md +16 -0
  261. package/judge/agents/planner.md +15 -0
  262. package/judge/agents/reviewer.md +17 -0
  263. package/judge/agents/scout.md +19 -0
  264. package/judge/agents/worker.md +15 -0
  265. package/judge/dist/chrome.js +326 -0
  266. package/judge/dist/kyrn-judge.js +52542 -0
  267. package/judge/package.json +6 -0
  268. package/judge/prompts/implement-and-review.md +14 -0
  269. package/judge/prompts/implement.md +15 -0
  270. package/judge/prompts/init.md +18 -0
  271. package/judge/prompts/scout-and-plan.md +12 -0
  272. package/judge/skills/mu-browser/SKILL.md +30 -0
  273. package/judge/skills/mu-github/SKILL.md +90 -0
  274. package/kyrn/bin/kyrn-doctor +202 -0
  275. package/kyrn/bin/kyrn-judge-local +131 -0
  276. package/kyrn/bin/kyrn-ledger +90 -0
  277. package/kyrn/bin/mu.mjs +1120 -0
  278. package/kyrn/local-judge/requirements.lock.txt +26 -0
  279. package/kyrn/local-judge/server.py +332 -0
  280. package/package.json +45 -0
package/docs/skills.md ADDED
@@ -0,0 +1,232 @@
1
+ > pi can create skills. Ask it to build one for your use case.
2
+
3
+ # Skills
4
+
5
+ Skills are self-contained capability packages that the agent loads on-demand. A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks.
6
+
7
+ Pi implements the [Agent Skills standard](https://agentskills.io/specification), warning about most violations but remaining lenient. Pi allows skill names to differ from their parent directory even though the standard disallows it; that rule is suboptimal for shared skill directories used across multiple agent harnesses.
8
+
9
+ ## Table of Contents
10
+
11
+ - [Locations](#locations)
12
+ - [How Skills Work](#how-skills-work)
13
+ - [Skill Commands](#skill-commands)
14
+ - [Skill Structure](#skill-structure)
15
+ - [Frontmatter](#frontmatter)
16
+ - [Validation](#validation)
17
+ - [Example](#example)
18
+ - [Skill Repositories](#skill-repositories)
19
+
20
+ ## Locations
21
+
22
+ > **Security:** Skills can instruct the model to perform any action and may include executable code the model invokes. Review skill content before use.
23
+
24
+ Pi loads skills from:
25
+
26
+ - Global:
27
+ - `~/.pi/agent/skills/`
28
+ - `~/.agents/skills/`
29
+ - Project (only after the project is trusted):
30
+ - `.pi/skills/`
31
+ - `.agents/skills/` in `cwd` and ancestor directories (up to git repo root, or filesystem root when not in a repo)
32
+ - Packages: `skills/` directories or `pi.skills` entries in `package.json`
33
+ - Settings: `skills` array with files or directories
34
+ - CLI: `--skill <path>` (repeatable, additive even with `--no-skills`)
35
+
36
+ Discovery rules:
37
+ - In `~/.pi/agent/skills/` and `.pi/skills/`, direct root `.md` files are discovered as individual skills when they have valid skill frontmatter with a non-empty `description`
38
+ - In all skill locations, directories containing `SKILL.md` are discovered recursively
39
+ - In `~/.agents/skills/` and project `.agents/skills/`, root `.md` files are ignored, but nested `.md` files in grouping folders are discovered when they declare skill frontmatter
40
+ - Root Markdown files other than `SKILL.md` that do not look like skills are ignored silently
41
+
42
+ Disable discovery with `--no-skills` (explicit `--skill` paths still load).
43
+
44
+ ### Using Skills from Other Harnesses
45
+
46
+ To use skills from Claude Code or OpenAI Codex, add their directories to settings:
47
+
48
+ ```json
49
+ {
50
+ "skills": [
51
+ "~/.claude/skills",
52
+ "~/.codex/skills"
53
+ ]
54
+ }
55
+ ```
56
+
57
+ For project-level Claude Code skills, add to `.pi/settings.json`:
58
+
59
+ ```json
60
+ {
61
+ "skills": ["../.claude/skills"]
62
+ }
63
+ ```
64
+
65
+ ## How Skills Work
66
+
67
+ 1. At startup, pi scans skill locations and extracts names and descriptions
68
+ 2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
69
+ 3. When a task matches, the agent uses `read`, or `bash` when `read` is unavailable, to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
70
+ 4. The agent follows the instructions, using relative paths to reference scripts and assets
71
+
72
+ This is progressive disclosure: only descriptions are always in context, full instructions load on-demand.
73
+
74
+ ## Skill Commands
75
+
76
+ Skills register as `/skill:name` commands:
77
+
78
+ ```bash
79
+ /skill:brave-search # Load and execute the skill
80
+ /skill:pdf-tools extract # Load skill with arguments
81
+ ```
82
+
83
+ Arguments after the command are appended to the skill content as `User: <args>`.
84
+
85
+ Toggle skill commands via `/settings` in interactive mode or in `settings.json`:
86
+
87
+ ```json
88
+ {
89
+ "enableSkillCommands": true
90
+ }
91
+ ```
92
+
93
+ ## Skill Structure
94
+
95
+ A skill is a directory with a `SKILL.md` file. Everything else is freeform.
96
+
97
+ ```
98
+ my-skill/
99
+ ├── SKILL.md # Required: frontmatter + instructions
100
+ ├── scripts/ # Helper scripts
101
+ │ └── process.sh
102
+ ├── references/ # Detailed docs loaded on-demand
103
+ │ └── api-reference.md
104
+ └── assets/
105
+ └── template.json
106
+ ```
107
+
108
+ ### SKILL.md Format
109
+
110
+ ````markdown
111
+ ---
112
+ name: my-skill
113
+ description: What this skill does and when to use it. Be specific.
114
+ ---
115
+
116
+ # My Skill
117
+
118
+ ## Setup
119
+
120
+ Run once before first use:
121
+ ```bash
122
+ cd /path/to/skill && npm install
123
+ ```
124
+
125
+ ## Usage
126
+
127
+ ```bash
128
+ ./scripts/process.sh <input>
129
+ ```
130
+ ````
131
+
132
+ Use relative paths from the skill directory:
133
+
134
+ ```markdown
135
+ See [the reference guide](references/REFERENCE.md) for details.
136
+ ```
137
+
138
+ ## Frontmatter
139
+
140
+ Per the [Agent Skills specification](https://agentskills.io/specification#frontmatter-required):
141
+
142
+ | Field | Required | Description |
143
+ |-------|----------|-------------|
144
+ | `name` | Yes | Max 64 chars. Lowercase a-z, 0-9, hyphens. Unlike the standard, Pi does not require this to match the parent directory because that standard requirement is suboptimal for shared skill directories. |
145
+ | `description` | Yes | Max 1024 chars. What the skill does and when to use it. |
146
+ | `license` | No | License name or reference to bundled file. |
147
+ | `compatibility` | No | Max 500 chars. Environment requirements. |
148
+ | `metadata` | No | Arbitrary key-value mapping. |
149
+ | `allowed-tools` | No | Space-delimited list of pre-approved tools (experimental). |
150
+ | `disable-model-invocation` | No | When `true`, skill is hidden from system prompt. Users must use `/skill:name`. |
151
+
152
+ ### Name Rules
153
+
154
+ - 1-64 characters
155
+ - Lowercase letters, numbers, hyphens only
156
+ - No leading/trailing hyphens
157
+ - No consecutive hyphens
158
+ Pi does not require the name to match the parent directory. The Agent Skills standard does, but that requirement is suboptimal for shared skill directories used by multiple tools.
159
+
160
+ Valid: `pdf-processing`, `data-analysis`, `code-review`
161
+ Invalid: `PDF-Processing`, `-pdf`, `pdf--processing`
162
+
163
+ ### Description Best Practices
164
+
165
+ The description determines when the agent loads the skill. Be specific.
166
+
167
+ Good:
168
+ ```yaml
169
+ description: Extracts text and tables from PDF files, fills PDF forms, and merges multiple PDFs. Use when working with PDF documents.
170
+ ```
171
+
172
+ Poor:
173
+ ```yaml
174
+ description: Helps with PDFs.
175
+ ```
176
+
177
+ ## Validation
178
+
179
+ Pi validates skills against the Agent Skills standard. Most issues produce warnings but still load the skill:
180
+
181
+ - Name exceeds 64 characters or contains invalid characters
182
+ - Name starts/ends with hyphen or has consecutive hyphens
183
+ - Description exceeds 1024 characters
184
+
185
+ Unknown frontmatter fields are ignored.
186
+
187
+ Declared skills with missing descriptions are not loaded. Malformed `SKILL.md` files and `SKILL.md` files without a description produce warnings and are not loaded. Other Markdown files without valid skill frontmatter are ignored.
188
+
189
+ Name collisions (same name from different locations) warn and keep the first skill found.
190
+
191
+ ## Example
192
+
193
+ ```
194
+ brave-search/
195
+ ├── SKILL.md
196
+ ├── search.js
197
+ └── content.js
198
+ ```
199
+
200
+ **SKILL.md:**
201
+ ````markdown
202
+ ---
203
+ name: brave-search
204
+ description: Web search and content extraction via Brave Search API. Use for searching documentation, facts, or any web content.
205
+ ---
206
+
207
+ # Brave Search
208
+
209
+ ## Setup
210
+
211
+ ```bash
212
+ cd /path/to/brave-search && npm install
213
+ ```
214
+
215
+ ## Search
216
+
217
+ ```bash
218
+ ./search.js "query" # Basic search
219
+ ./search.js "query" --content # Include page content
220
+ ```
221
+
222
+ ## Extract Page Content
223
+
224
+ ```bash
225
+ ./content.js https://example.com
226
+ ```
227
+ ````
228
+
229
+ ## Skill Repositories
230
+
231
+ - [Anthropic Skills](https://github.com/anthropics/skills) - Document processing (docx, pdf, pptx, xlsx), web development
232
+ - [Pi Skills](https://github.com/badlogic/pi-skills) - Web search, browser automation, Google APIs, transcription
@@ -0,0 +1,192 @@
1
+ # Terminal Setup
2
+
3
+ Pi uses the [Kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) for reliable modifier key detection. Most modern terminals support this protocol, but some require configuration.
4
+
5
+ ## Capability Overrides
6
+
7
+ Pi auto-detects OSC 8 hyperlinks, inline image protocols, and truecolor. If detection fails behind a terminal proxy or multiplexer, use these advanced overrides:
8
+
9
+ | Capability | Environment variable | JSON setting |
10
+ |------------|----------------------|--------------|
11
+ | OSC 8 hyperlinks | `PI_HYPERLINKS=1\|0\|auto` | `terminal.hyperlinks: true\|false\|"auto"` |
12
+ | Inline images | `PI_IMAGE_PROTOCOL=kitty\|iterm2\|none\|auto` | `terminal.images: "kitty"\|"iterm2"\|false\|"auto"` |
13
+ | Truecolor | `PI_TRUE_COLOR=1\|0\|auto` | `terminal.trueColor: true\|false\|"auto"` |
14
+
15
+ Settings take precedence over environment variables; unset or `auto` preserves detection. Only force capabilities supported by the complete terminal path, since unsupported escape sequences can corrupt rendering.
16
+
17
+ ## Kitty
18
+
19
+ Works out of the box.
20
+
21
+ ## iTerm2
22
+
23
+ ### Regular TUI mode
24
+
25
+ Works out of the box.
26
+
27
+ ### Fullscreen TUI mode
28
+
29
+ Pi owns the viewport, so iTerm2 sends mouse-wheel reports instead of scrolling its native scrollback. With iTerm2's default fast-trackpad behavior, those reports can lose most of an accelerated wheel delta, making fullscreen scrolling much slower than regular scrolling.
30
+
31
+ If fast mouse-wheel gestures move only about one line at a time in fullscreen mode:
32
+
33
+ 1. Open **iTerm2 → Settings → Advanced**.
34
+ 2. Search for **Trackpad scrolls fast?** and set it to **No**.
35
+
36
+ This is an iTerm2-wide workaround and may also change native trackpad scrolling. The underlying behavior is tracked in [iTerm2 issue 9619](https://gitlab.com/gnachman/iterm2/-/work_items/9619).
37
+
38
+ ## Apple Terminal
39
+
40
+ Pi enables enhanced key reporting when available. If Terminal.app still sends plain Return for `Shift+Enter`, pi uses a local macOS modifier fallback to treat that Return as `Shift+Enter`.
41
+
42
+ This fallback only works when pi runs on the same Mac as Terminal.app. It cannot detect the local keyboard over remote SSH.
43
+
44
+ ## Ghostty
45
+
46
+ Add to your Ghostty config (`~/Library/Application Support/com.mitchellh.ghostty/config` on macOS, `~/.config/ghostty/config` on Linux):
47
+
48
+ ```
49
+ keybind = alt+backspace=text:\x1b\x7f
50
+ ```
51
+
52
+ Older Claude Code versions may have added this Ghostty mapping:
53
+
54
+ ```
55
+ keybind = shift+enter=text:\n
56
+ ```
57
+
58
+ That mapping sends a raw linefeed byte. Inside pi, that is indistinguishable from `Ctrl+J`, so tmux and pi no longer see a real `shift+enter` key event.
59
+
60
+ If Claude Code 2.x or newer is the only reason you added that mapping, you can remove it, unless you want to use Claude Code in tmux, where it still requires that Ghostty mapping.
61
+
62
+ Pi binds `Ctrl+J` as a default newline alias, so `Shift+Enter` keeps working in tmux via that remap without extra pi configuration.
63
+
64
+ ### Fullscreen TUI mode
65
+
66
+ In fullscreen mode, links remain clickable, but Ghostty does not show its hover underline or lower-left URL preview while pi captures mouse input. Hold `Shift+Command` on macOS or `Shift+Ctrl` on Linux to use Ghostty's native link handling.
67
+
68
+ ## WezTerm
69
+
70
+ WezTerm usually works out of the box for `Shift+Enter` via xterm modifyOtherKeys. To use the Kitty keyboard protocol explicitly, create `~/.wezterm.lua`:
71
+
72
+ ```lua
73
+ local wezterm = require 'wezterm'
74
+ local config = wezterm.config_builder()
75
+ config.enable_kitty_keyboard = true
76
+ return config
77
+ ```
78
+
79
+ On macOS, WezTerm binds `Option+Enter` to fullscreen by default. To use `Option+Enter` for pi follow-up queueing, add this key override:
80
+
81
+ ```lua
82
+ local wezterm = require 'wezterm'
83
+ local config = wezterm.config_builder()
84
+ config.keys = {
85
+ {
86
+ key = 'Enter',
87
+ mods = 'ALT',
88
+ action = wezterm.action.SendString('\x1b[13;3u'),
89
+ },
90
+ }
91
+ return config
92
+ ```
93
+
94
+ If you already have a `config.keys` table, add the entry to it.
95
+
96
+ On WSL, WezTerm may require a visible hardware cursor for IME candidate window positioning. If CJK IME candidates do not follow the text cursor, set `PI_HARDWARE_CURSOR=1` before running pi or set `showHardwareCursor` to `true` in settings.
97
+
98
+ ## Alacritty
99
+
100
+ Alacritty usually works out of the box for `Shift+Enter`. On macOS, `Option+Enter` may arrive as plain `Enter`. To use `Option+Enter` for pi follow-up queueing, add to `~/.config/alacritty/alacritty.toml`:
101
+
102
+ ```toml
103
+ [[keyboard.bindings]]
104
+ key = "Enter"
105
+ mods = "Alt"
106
+ chars = "\u001b[13;3u"
107
+ ```
108
+
109
+ Restart Alacritty after changing the config.
110
+
111
+ ## VS Code (Integrated Terminal)
112
+
113
+ VS Code 1.109.5 and newer enable Kitty keyboard protocol in the integrated terminal by default, so `Shift+Enter` should work out of the box.
114
+
115
+ VS Code versions older than 1.109.5 need an explicit terminal keybinding for `Shift+Enter`.
116
+
117
+ `keybindings.json` locations:
118
+ - macOS: `~/Library/Application Support/Code/User/keybindings.json`
119
+ - Linux: `~/.config/Code/User/keybindings.json`
120
+ - Windows: `%APPDATA%\\Code\\User\\keybindings.json`
121
+
122
+ Add to `keybindings.json`:
123
+
124
+ ```json
125
+ {
126
+ "key": "shift+enter",
127
+ "command": "workbench.action.terminal.sendSequence",
128
+ "args": { "text": "\u001b[13;2u" },
129
+ "when": "terminalFocus"
130
+ }
131
+ ```
132
+
133
+ ## Zed (Integrated Terminal)
134
+
135
+ Add these key bindings to your Zed `keymap.json`:
136
+
137
+ ```json
138
+ {
139
+ "context": "Terminal",
140
+ "bindings": {
141
+ "shift-enter": ["terminal::SendText", "\u001b[13;2u"],
142
+ "ctrl--": ["terminal::SendText", "\u001b[45;5u"],
143
+ "ctrl-alt-]": ["terminal::SendText", "\u001b[93;7u"]
144
+ }
145
+ }
146
+ ```
147
+
148
+ ## Windows Terminal
149
+
150
+ Pi uses Windows-style keybindings when running natively on Windows or in WSL:
151
+
152
+ - `Alt+V` pastes an image or clipboard text.
153
+ - `Ctrl+F` searches the transcript in fullscreen mode, and `Ctrl+Up`/`Ctrl+Down` jump between marked messages.
154
+ - `Alt+P` cycles to the previous model.
155
+ - `Ctrl+Z` undoes editing on native Windows; WSL uses `Alt+Z` so `Ctrl+Z` can suspend pi.
156
+ - `Ctrl+Q` queues a follow-up message and `Alt+Q` restores queued messages.
157
+
158
+ Add to `settings.json` (Ctrl+Shift+, or Settings → Open JSON file) to forward `Shift+Enter` for inserting a new line:
159
+
160
+ ```json
161
+ {
162
+ "actions": [
163
+ {
164
+ "command": { "action": "sendInput", "input": "\u001b[13;2u" },
165
+ "keys": "shift+enter"
166
+ }
167
+ ]
168
+ }
169
+ ```
170
+
171
+ Windows Terminal binds `Alt+Enter` to fullscreen by default. To use it instead of pi's `Ctrl+Q` default for follow-up queueing, configure Windows Terminal to send the key and bind `app.message.followUp` to `alt+enter` in pi.
172
+
173
+ If you already have an `actions` array, add the object to it. Fully close and reopen Windows Terminal after changing its settings.
174
+
175
+ ## xfce4-terminal, terminator
176
+
177
+ These terminals have limited escape sequence support. Modified Enter keys like `Ctrl+Enter` and `Shift+Enter` cannot be distinguished from plain `Enter`, preventing custom keybindings such as `submit: ["ctrl+enter"]` from working.
178
+
179
+ For the best experience, use a terminal that supports the Kitty keyboard protocol:
180
+ - [Kitty](https://sw.kovidgoyal.net/kitty/)
181
+ - [Ghostty](https://ghostty.org/)
182
+ - [WezTerm](https://wezfurlong.org/wezterm/)
183
+ - [iTerm2](https://iterm2.com/)
184
+ - [Alacritty](https://github.com/alacritty/alacritty) (requires compilation with Kitty protocol support)
185
+
186
+ ## IntelliJ IDEA (Integrated Terminal)
187
+
188
+ The built-in terminal has limited escape sequence support. Shift+Enter cannot be distinguished from Enter in IntelliJ's terminal.
189
+
190
+ If you want the hardware cursor visible, set `PI_HARDWARE_CURSOR=1` before running pi (disabled by default for compatibility).
191
+
192
+ Consider using a dedicated terminal emulator for the best experience.
package/docs/termux.md ADDED
@@ -0,0 +1,126 @@
1
+ # Termux (Android) Setup
2
+
3
+ Pi runs on Android via [Termux](https://termux.dev/), a terminal emulator and Linux environment for Android.
4
+
5
+ ## Prerequisites
6
+
7
+ 1. Install [Termux](https://github.com/termux/termux-app#installation) from GitHub or F-Droid (not Google Play, that version is deprecated)
8
+ 2. Install [Termux:API](https://github.com/termux/termux-api#installation) from GitHub or F-Droid for clipboard and other device integrations
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ # Update packages
14
+ pkg update && pkg upgrade
15
+
16
+ # Install dependencies
17
+ pkg install nodejs termux-api git
18
+
19
+ # Install pi
20
+ npm install -g --ignore-scripts @earendil-works/pi-coding-agent
21
+
22
+ # Create config directory
23
+ mkdir -p ~/.pi/agent
24
+
25
+ # Run pi
26
+ pi
27
+ ```
28
+
29
+ ## Clipboard Support
30
+
31
+ Clipboard operations use `termux-clipboard-set` and `termux-clipboard-get` when running in Termux. The Termux:API app must be installed for these to work.
32
+
33
+ Image clipboard is not supported on Termux (the `ctrl+v` image paste feature will not work).
34
+
35
+ ## Example AGENTS.md for Termux
36
+
37
+ Create `~/.pi/agent/AGENTS.md` to help the agent understand the Termux environment:
38
+
39
+ ````markdown
40
+ # Agent Environment: Termux on Android
41
+
42
+ ## Location
43
+ - **OS**: Android (Termux terminal emulator)
44
+ - **Home**: `/data/data/com.termux/files/home`
45
+ - **Prefix**: `/data/data/com.termux/files/usr`
46
+ - **Shared storage**: `/storage/emulated/0` (Downloads, Documents, etc.)
47
+
48
+ ## Opening URLs
49
+ ```bash
50
+ termux-open-url "https://example.com"
51
+ ```
52
+
53
+ ## Opening Files
54
+ ```bash
55
+ termux-open file.pdf # Opens with default app
56
+ termux-open --chooser image.jpg # Choose app
57
+ ```
58
+
59
+ ## Clipboard
60
+ ```bash
61
+ termux-clipboard-set "text" # Copy
62
+ termux-clipboard-get # Paste
63
+ ```
64
+
65
+ ## Notifications
66
+ ```bash
67
+ termux-notification -t "Title" -c "Content"
68
+ ```
69
+
70
+ ## Device Info
71
+ ```bash
72
+ termux-battery-status # Battery info
73
+ termux-wifi-connectioninfo # WiFi info
74
+ termux-telephony-deviceinfo # Device info
75
+ ```
76
+
77
+ ## Sharing
78
+ ```bash
79
+ termux-share -a send file.txt # Share file
80
+ ```
81
+
82
+ ## Other Useful Commands
83
+ ```bash
84
+ termux-toast "message" # Quick toast popup
85
+ termux-vibrate # Vibrate device
86
+ termux-tts-speak "hello" # Text to speech
87
+ termux-camera-photo out.jpg # Take photo
88
+ ```
89
+
90
+ ## Notes
91
+ - Termux:API app must be installed for `termux-*` commands
92
+ - Use `pkg install termux-api` for the command-line tools
93
+ - Storage permission needed for `/storage/emulated/0` access
94
+ ````
95
+
96
+ ## Limitations
97
+
98
+ - **No image clipboard**: Termux clipboard API only supports text
99
+ - **Storage access**: To access files in `/storage/emulated/0` (Downloads, etc.), run `termux-setup-storage` once to grant permissions
100
+
101
+ ## Troubleshooting
102
+
103
+ ### Clipboard not working
104
+
105
+ Ensure both apps are installed:
106
+ 1. Termux (from GitHub or F-Droid)
107
+ 2. Termux:API (from GitHub or F-Droid)
108
+
109
+ Then install the CLI tools:
110
+ ```bash
111
+ pkg install termux-api
112
+ ```
113
+
114
+ ### Permission denied for shared storage
115
+
116
+ Run once to grant storage permissions:
117
+ ```bash
118
+ termux-setup-storage
119
+ ```
120
+
121
+ ### Node.js installation issues
122
+
123
+ If npm fails, try clearing the cache:
124
+ ```bash
125
+ npm cache clean --force
126
+ ```