pi-orchestrator-config 4.1.5

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 (175) hide show
  1. package/README.md +808 -0
  2. package/agents/api-documenter.md +32 -0
  3. package/agents/bash-expert.md +53 -0
  4. package/agents/code-reviewer-docs.md +145 -0
  5. package/agents/code-reviewer-guidelines.md +97 -0
  6. package/agents/code-reviewer-quality.md +142 -0
  7. package/agents/code-reviewer-security.md +107 -0
  8. package/agents/code-reviewer-spec.md +164 -0
  9. package/agents/debugger.md +63 -0
  10. package/agents/docker-expert.md +40 -0
  11. package/agents/docs-fetcher.md +48 -0
  12. package/agents/git-expert.md +63 -0
  13. package/agents/github-expert.md +83 -0
  14. package/agents/go-expert.md +62 -0
  15. package/agents/issue-reviewer-feasibility.md +60 -0
  16. package/agents/issue-reviewer-scope.md +63 -0
  17. package/agents/issue-reviewer-spec.md +77 -0
  18. package/agents/java-expert.md +31 -0
  19. package/agents/jenkins-expert.md +38 -0
  20. package/agents/kubernetes-expert.md +40 -0
  21. package/agents/planner.md +42 -0
  22. package/agents/python-expert.md +61 -0
  23. package/agents/reviewer.md +26 -0
  24. package/agents/scout.md +40 -0
  25. package/agents/security-auditor.md +254 -0
  26. package/agents/technical-documentation-writer.md +37 -0
  27. package/agents/test-automator.md +55 -0
  28. package/agents/test-runner.md +47 -0
  29. package/agents/ts-expert.md +23 -0
  30. package/agents/worker.md +30 -0
  31. package/extensions/acpx-provider/index.ts +104 -0
  32. package/extensions/acpx-provider/load-runtime.ts +99 -0
  33. package/extensions/acpx-provider/runtime-models.ts +40 -0
  34. package/extensions/cli-provider/agents/claude.ts +128 -0
  35. package/extensions/cli-provider/agents/cursor.ts +84 -0
  36. package/extensions/cli-provider/agents/gemini.ts +100 -0
  37. package/extensions/cli-provider/discover.ts +77 -0
  38. package/extensions/cli-provider/index.ts +57 -0
  39. package/extensions/cli-provider/parsers.ts +304 -0
  40. package/extensions/cli-provider/providers.ts +58 -0
  41. package/extensions/cli-provider/runner.ts +225 -0
  42. package/extensions/cli-provider/runtime-models.ts +32 -0
  43. package/extensions/cli-provider/session-reaper.ts +122 -0
  44. package/extensions/cli-provider/sessions.ts +533 -0
  45. package/extensions/cli-provider/shared/discover-cache.ts +235 -0
  46. package/extensions/cli-provider/types.ts +48 -0
  47. package/extensions/coms/coms-net-server.ts +1642 -0
  48. package/extensions/coms/coms-net-wrapper.ts +521 -0
  49. package/extensions/coms/coms-net.ts +1589 -0
  50. package/extensions/coms/coms-p2p.ts +1879 -0
  51. package/extensions/coms/coms-shared.ts +510 -0
  52. package/extensions/coms/coms-wrapper.ts +138 -0
  53. package/extensions/coms/index.ts +20 -0
  54. package/extensions/coms/themeMap.ts +147 -0
  55. package/extensions/image-gen/image-gen.ts +332 -0
  56. package/extensions/image-gen/index.ts +14 -0
  57. package/extensions/orchestrator/agents.ts +134 -0
  58. package/extensions/orchestrator/ask-user.ts +293 -0
  59. package/extensions/orchestrator/async-agents.ts +1037 -0
  60. package/extensions/orchestrator/async-capability.ts +129 -0
  61. package/extensions/orchestrator/async-runner.ts +324 -0
  62. package/extensions/orchestrator/async-status-parse.ts +31 -0
  63. package/extensions/orchestrator/async-status-ui.ts +201 -0
  64. package/extensions/orchestrator/async-wait.ts +36 -0
  65. package/extensions/orchestrator/btw.ts +210 -0
  66. package/extensions/orchestrator/cron-status-format.ts +126 -0
  67. package/extensions/orchestrator/cron-status-ui.ts +132 -0
  68. package/extensions/orchestrator/cron.ts +730 -0
  69. package/extensions/orchestrator/dreaming.ts +355 -0
  70. package/extensions/orchestrator/enforcement-helpers.ts +530 -0
  71. package/extensions/orchestrator/enforcement-rules.ts +329 -0
  72. package/extensions/orchestrator/enforcement.ts +828 -0
  73. package/extensions/orchestrator/extended-autocomplete.ts +593 -0
  74. package/extensions/orchestrator/git-helpers.ts +420 -0
  75. package/extensions/orchestrator/github-autocomplete.ts +250 -0
  76. package/extensions/orchestrator/icons.ts +17 -0
  77. package/extensions/orchestrator/index.ts +100 -0
  78. package/extensions/orchestrator/memory-embeddings.ts +281 -0
  79. package/extensions/orchestrator/memory-promotion.ts +449 -0
  80. package/extensions/orchestrator/memory-provenance.ts +80 -0
  81. package/extensions/orchestrator/memory-query-class.ts +90 -0
  82. package/extensions/orchestrator/memory-scoring.ts +434 -0
  83. package/extensions/orchestrator/memory-tools.ts +883 -0
  84. package/extensions/orchestrator/memory-tree.ts +212 -0
  85. package/extensions/orchestrator/nvim.ts +169 -0
  86. package/extensions/orchestrator/overlay-dashboard-utils.ts +25 -0
  87. package/extensions/orchestrator/overlay-dashboard.ts +512 -0
  88. package/extensions/orchestrator/pi-config-review-state.ts +303 -0
  89. package/extensions/orchestrator/preference-extractor.ts +106 -0
  90. package/extensions/orchestrator/project-settings.ts +468 -0
  91. package/extensions/orchestrator/promotion-queue.ts +311 -0
  92. package/extensions/orchestrator/resolve-agent-model.ts +32 -0
  93. package/extensions/orchestrator/review-ui.ts +204 -0
  94. package/extensions/orchestrator/rule-placeholders.ts +12 -0
  95. package/extensions/orchestrator/rules.ts +481 -0
  96. package/extensions/orchestrator/session-search.ts +243 -0
  97. package/extensions/orchestrator/session-validation.ts +374 -0
  98. package/extensions/orchestrator/situation-report.ts +370 -0
  99. package/extensions/orchestrator/status-bar.ts +31 -0
  100. package/extensions/orchestrator/status-line.ts +192 -0
  101. package/extensions/orchestrator/status.ts +110 -0
  102. package/extensions/orchestrator/subagent-tool.ts +1748 -0
  103. package/extensions/orchestrator/task-lifecycle.ts +88 -0
  104. package/extensions/orchestrator/utils.ts +227 -0
  105. package/extensions/pidash/index.ts +15 -0
  106. package/extensions/pidash/pidash.ts +941 -0
  107. package/extensions/pidiff/index.ts +13 -0
  108. package/extensions/pidiff/pidiff.ts +369 -0
  109. package/extensions/providers/acpx-driver.ts +479 -0
  110. package/extensions/providers/built-in-drivers.ts +52 -0
  111. package/extensions/providers/claude-driver.ts +319 -0
  112. package/extensions/providers/cursor-acpx-driver.ts +398 -0
  113. package/extensions/providers/cursor-cli-driver.ts +484 -0
  114. package/extensions/providers/gemini-driver.ts +302 -0
  115. package/extensions/providers/index.ts +513 -0
  116. package/extensions/shared/build-system-prompt.ts +57 -0
  117. package/extensions/shared/create-runtime-provider.ts +190 -0
  118. package/extensions/shared/daemon-manager.ts +248 -0
  119. package/extensions/shared/file-logger.ts +115 -0
  120. package/extensions/shared/managed-refresh.ts +211 -0
  121. package/extensions/shared/provider-driver.ts +295 -0
  122. package/extensions/shared/provider-errors.ts +305 -0
  123. package/extensions/shared/provider-registry.ts +388 -0
  124. package/extensions/shared/stream-builder.ts +275 -0
  125. package/extensions/shared/types.ts +20 -0
  126. package/extensions/shared/ui/README.md +10 -0
  127. package/extensions/shared/ui/badge.tsx +52 -0
  128. package/extensions/shared/ui/button.tsx +58 -0
  129. package/extensions/shared/ui/collapsible.tsx +21 -0
  130. package/extensions/shared/ui/dropdown-menu.tsx +266 -0
  131. package/extensions/shared/ui/input.tsx +20 -0
  132. package/extensions/shared/ui/popover.tsx +114 -0
  133. package/extensions/shared/ui/resizable.tsx +48 -0
  134. package/extensions/shared/ui/scroll-area.tsx +53 -0
  135. package/extensions/shared/ui/select.tsx +201 -0
  136. package/extensions/shared/ui/separator.tsx +25 -0
  137. package/extensions/shared/ui/tooltip.tsx +64 -0
  138. package/extensions/shared/ws-client.ts +74 -0
  139. package/package.json +59 -0
  140. package/prompts/coderabbit-rate-limit.md +95 -0
  141. package/prompts/create-coms-feature-manager.md +186 -0
  142. package/prompts/create-skill.md +128 -0
  143. package/prompts/domain-model.md +109 -0
  144. package/prompts/external-ai.md +665 -0
  145. package/prompts/implement-and-review.md +25 -0
  146. package/prompts/implement.md +26 -0
  147. package/prompts/issue-review.md +256 -0
  148. package/prompts/pr-review.md +753 -0
  149. package/prompts/query-db.md +154 -0
  150. package/prompts/refine-review.md +208 -0
  151. package/prompts/release.md +235 -0
  152. package/prompts/remember.md +33 -0
  153. package/prompts/review-handler-status.md +27 -0
  154. package/prompts/review-handler.md +677 -0
  155. package/prompts/review-local.md +159 -0
  156. package/prompts/scout-and-plan.md +21 -0
  157. package/rules/00-orchestrator-core.md +42 -0
  158. package/rules/05-issue-first-workflow.md +119 -0
  159. package/rules/10-agent-routing.md +58 -0
  160. package/rules/15-mcp-launchpad.md +46 -0
  161. package/rules/20-code-review-loop.md +234 -0
  162. package/rules/25-documentation-updates.md +15 -0
  163. package/rules/30-prompt-templates.md +19 -0
  164. package/rules/35-memory.md +240 -0
  165. package/rules/40-critical-rules.md +124 -0
  166. package/rules/45-file-preview.md +29 -0
  167. package/rules/50-agent-bug-reporting.md +90 -0
  168. package/rules/55-coms-protocol.md +63 -0
  169. package/rules/60-task-tracking.md +66 -0
  170. package/skills/conflict-resolver/SKILL.md +213 -0
  171. package/skills/skill-creator/SKILL.md +85 -0
  172. package/skills/systematic-debugging/SKILL.md +353 -0
  173. package/skills/test-driven-development/SKILL.md +335 -0
  174. package/skills/update-agents-md/SKILL.md +282 -0
  175. package/templates/coms-feature-manager-prompt.md +313 -0
package/README.md ADDED
@@ -0,0 +1,808 @@
1
+ # Pi Orchestrator Config
2
+
3
+ A [pi package](https://github.com/badlogic/pi-mono) that implements an **orchestrator pattern** — the main agent delegates all work to specialist subagents.
4
+
5
+ 📚 **[Full Documentation](https://myk-org.github.io/pi-config/)**
6
+
7
+ ## What's Included
8
+
9
+ ### Extension: `orchestrator`
10
+
11
+ Single extension that provides:
12
+
13
+ | Feature | Description |
14
+ |---------|-------------|
15
+ | **Subagent tool** | Delegate tasks to specialist agents (single, parallel, chain, async modes) |
16
+ | **Async background agents** | Spawn agents in background with `async: true` — results surface automatically when complete. Fullscreen overlay dashboard with live output, keyboard nav, and kill support (`/async-status`, `/async-kill`). On **acpx** parents, optional async is coerced to sync; dream/cron need `async_llm_provider` + `async_llm_model`. `cli-*` providers support async natively (see `dev-docs/cli-provider.md`) |
17
+ | **CLI / ACPX providers** | Optional `cli_agents` / `acpx_agents` register `cli-*` / `acpx-*` via native `createProvider` (pi ≥ 0.81): `/login cli-<agent>` or `/login acpx-<agent>`, model refresh, filter when unavailable |
18
+ | **`/btw` command** | Quick side questions without polluting conversation history — ephemeral overlay |
19
+ | **`/async-status` command** | Show status of background agents — select one for live output streaming |
20
+ | **`/async-kill` command** | Kill async agents (overlay picker or by name/id) |
21
+ | **`ask_user` tool** | Structured user input with options and free-text — used by workflows |
22
+ | **Python/pip enforcement** | Auto-fixes `python`/`python3` → `uv run python`; blocks `pip`/`pip3` — requires `uv` |
23
+ | **Git protection** | Blocks commits/pushes to main/master, merged branches, `--no-verify`, `git add .` |
24
+ | **Remote script exec block** | Blocks `curl \| bash`, `eval $(curl)`, etc. Allows safe `VAR=$(curl ...)` variable assignments |
25
+ | **Dangerous command gate** | Confirms `rm -rf`, `sudo`, `mkfs`, etc. |
26
+ | **Rule injection** | Injects orchestrator routing rules into system prompt |
27
+ | **Git status** | Live git status in status line with colored icons — updates after every tool call. Shows clickable `#N` when the branch has an open PR. Last-activity clock `⏱ HH:MM (Xm/Xh ago)` shows time since last response |
28
+ | **Desktop notifications** | Notifies via `notify-send` on task completion, waiting for input, and action required |
29
+ | **File preview** | Serves generated HTML/frontend files via HTTP for browser preview from container |
30
+ | **Pidash dashboard** | Live web dashboard — multi-session monitoring, browser messaging, model switching, live session name updates, reasoning token display |
31
+ | **Pidiff viewer** | Per-project diff viewer with review comments — branch diffs, file tree, inline comments, git-based ignore rules |
32
+ | **Dreaming** | Background memory consolidation — extracts memories from sessions, deduplicates, maintains topic-based memory |
33
+ | **Memory enforcement** | Code-enforced memory entries — triggers on bash/tool/file events, actions: block, run_after, warn. LLM cannot ignore enforced rules. Dreaming-safe via *(enforced)* marker |
34
+ | **Upgrade changelog** | Shows release notes on session start after pi-config version upgrade |
35
+ | **Task tracking** | Structured task lists for multi-step workflows — live widget, progress tracking, reminder nudges ([@tintinweb/pi-tasks](https://github.com/tintinweb/pi-tasks)) |
36
+ | **Neovim integration** | Send changed files and review findings to nvim's quickfix list — only active when running inside nvim |
37
+ | **Inter-agent communication** | P2P (`/coms`) and networked (`/coms-net`) agent communication — on-demand activation via slash commands |
38
+ | **Slash commands** | `/pr-review`, `/issue-review`, `/release`, `/review-local`, `/review-status`, `/query-db`, `/btw`, `/async-status`, `/async-kill`, `/status`, `/dream`, `/remember`, `/coms`, `/coms-net` — with autocomplete argument hints |
39
+ | **GitHub autocomplete** | Type `#` in the editor to get issue/PR suggestions from the current repo — lazy-loaded, 5min cache |
40
+ | **Command arg completions** | Tab-complete arguments for slash commands — providers and models for `/external-ai`, branches for `/review-local`, PR numbers for `/pr-review`, and more |
41
+ | **Discord bot** | Control pi sessions from your phone via Discord DMs — send prompts, answer ask_user dialogs, switch sessions |
42
+
43
+ ### Agents (26)
44
+
45
+ | Category | Agents |
46
+ |----------|--------|
47
+ | Languages | python-expert, go-expert, ts-expert, java-expert, bash-expert |
48
+ | Infrastructure | docker-expert, kubernetes-expert, jenkins-expert |
49
+ | Dev workflow | git-expert, github-expert, test-runner, test-automator, debugger |
50
+ | Documentation | technical-documentation-writer, api-documenter, docs-fetcher |
51
+ | Code review | code-reviewer-quality, code-reviewer-guidelines, code-reviewer-security, code-reviewer-docs, code-reviewer-spec |
52
+ | Security | security-auditor |
53
+ | Workflow | scout, planner, worker, reviewer |
54
+
55
+ ### Prompt Templates
56
+
57
+ | Prompt | Description |
58
+ |--------|-------------|
59
+ | `/implement <task>` | scout → planner → worker |
60
+ | `/scout-and-plan <task>` | scout → planner |
61
+ | `/implement-and-review <task>` | worker → 5 reviewers → worker |
62
+ | `/pr-review [number\|url]` | Fetch PR diff, check past review comments, review with guidelines, post and track comments |
63
+ | `/issue-review` | Review a GitHub issue spec and fix it |
64
+ | `/release [flags]` | Create GitHub release with changelog and version bumping |
65
+ | `/review-local [branch]` | Review local uncommitted or branch changes |
66
+ | `/review-handler [url] [--autorabbit] [--autoqodo]` | Process PR review comments, fix approved items |
67
+ | `/domain-model [focus area]` | Scan codebase and build/update a CONTEXT.md domain glossary for consistent AI vocabulary |
68
+ | `/refine-review <url>` | Refine and improve existing PR review comments |
69
+ | `/coderabbit-rate-limit [number\|url]` | Handle CodeRabbit rate limiting on PRs |
70
+ | `/create-coms-feature-manager` | Generate a coms feature-manager prompt customized for the current project (source template: `templates/coms-feature-manager-prompt.md`) |
71
+ | `/query-db <command>` | Query the review comments database |
72
+ | `/external-ai <agent> [--model <model>] [--session-id <id>] [--fix\|--peer\|--resume] <prompt>` | Run prompts via AI CLIs directly (cursor, claude, gemini) — full model access |
73
+ | `/external-ai-models-refresh` | Refresh cached AI CLI models for autocomplete |
74
+ | `/dream` | Run memory consolidation — extract, deduplicate, maintain topic-based memory |
75
+ | `/remember <what>` | Save a memory for future sessions |
76
+ | `/dream-auto` | Toggle automatic memory dreaming (every 3h + session end) |
77
+ | `/cron add\|list\|list-all\|remove` | Schedule recurring tasks within the pi session (e.g., `/cron add every 2h check for new issues`, `/cron add at 12:00 /review-handler`). `/cron list` and `/cron list-all` open overlay UI (view / remove; list-all = all sessions). Tasks run while pi is active, survive `/reload`, and stop on exit |
78
+ | `/async-kill [name\|id\|all]` | Kill async agents (overlay picker or by name/id) |
79
+ | `/status` | Unified session snapshot — async agents, cron tasks, git branch, context usage |
80
+ | `/nvim-changed-files` | Send git changed files to nvim's quickfix list (only inside nvim) |
81
+ | `/pidiff start\|stop\|restart\|status` | Manage the pidiff diff viewer server (per-project) |
82
+ | `/coms start\|stop\|status` | P2P local agent communication (Unix socket) |
83
+ | `/coms-net start\|connect\|disconnect\|stop\|status` | Networked agent communication (HTTP/SSE hub) |
84
+
85
+ ### Inter-Agent Communication (coms & coms-net)
86
+
87
+ Two systems for Pi agents to communicate with each other, activated on-demand via slash commands:
88
+
89
+ **P2P Local (`/coms`)** — Direct Unix socket communication between agents on the same machine. No server needed.
90
+
91
+ ```text
92
+ /coms start --name planner --purpose "Plans the work"
93
+ /coms stop
94
+ /coms status
95
+ ```
96
+
97
+ **Networked (`/coms-net`)** — HTTP/SSE hub for communication across machines. Server auto-starts on localhost.
98
+
99
+ ```text
100
+ /coms-net start --name dev --purpose "Development agent"
101
+ /coms-net connect
102
+ /coms-net disconnect
103
+ /coms-net stop
104
+ /coms-net status
105
+ ```
106
+
107
+ For LAN/remote access, set `PI_COMS_NET_AUTH_TOKEN` and `PI_COMS_NET_HOST=0.0.0.0` in your environment.
108
+
109
+ **Tools available once activated:**
110
+
111
+ | Tool | Description |
112
+ |------|-------------|
113
+ | `*_list` | List peer agents with names, models, context usage, queue depth |
114
+ | `*_send` | Send a prompt to a peer agent |
115
+ | `*_get` | Non-blocking poll for a response |
116
+ | `*_await` | Block until response arrives |
117
+
118
+ Forked from [disler/pi-vs-claude-code](https://github.com/disler/pi-vs-claude-code) coms extensions. We own these files — FIFO message queue, structured task delegation via coms protocol.
119
+
120
+ ## Installation
121
+
122
+ ### Docker (Recommended)
123
+
124
+ The recommended way to run pi-config is via the pre-built container image. It provides filesystem isolation, consistent tooling, and all dependencies pre-installed.
125
+
126
+ ```bash
127
+ docker pull ghcr.io/myk-org/pi-config:latest
128
+ ```
129
+
130
+ See the [Docker section](#docker-sandboxed-execution) below for the full run command and shell alias.
131
+
132
+ ### Native (without Docker)
133
+
134
+ Run the interactive installer — it walks you through each component with multi-select checkboxes:
135
+
136
+ ```bash
137
+ uv run https://raw.githubusercontent.com/myk-org/pi-config/main/scripts/install.py
138
+ ```
139
+
140
+ Or if you already have the repo cloned:
141
+
142
+ ```bash
143
+ uv run scripts/install.py
144
+ ```
145
+
146
+ The installer covers:
147
+
148
+ - **Pi Packages** — pi-config, pi-vertex-claude, pi-web-access, myk-pi-tools, bun
149
+ - **Python Tools** — mcp-launchpad (mcpl), prek
150
+ - **npm Packages** — acpx, agent-browser
151
+ - **Browser Automation** — playwright + chromium
152
+ - **Environment Setup** — gitignore configuration
153
+
154
+ For non-interactive (CI) usage:
155
+
156
+ ```bash
157
+ uv run scripts/install.py --all
158
+ ```
159
+
160
+ ## Updating
161
+
162
+ ### Docker
163
+
164
+ ```bash
165
+ docker pull ghcr.io/myk-org/pi-config:latest
166
+ ```
167
+
168
+ The container runs `pi update` automatically on each start.
169
+
170
+ ### Native
171
+
172
+ ```bash
173
+ pi update # Pi package
174
+ uv tool upgrade myk-pi-tools # CLI tool
175
+ ```
176
+
177
+ After updating, run `/reload` in pi or restart pi to pick up changes.
178
+ Refresh the global agent package after acpx-provider / cli-provider / settings
179
+ changes so `~/.pi` is not a mixed checkout (see issue #651).
180
+
181
+ ## Usage
182
+
183
+ ### Automatic delegation
184
+
185
+ Just describe your task — the orchestrator routes to the right specialist:
186
+
187
+ ```text
188
+ Add retry logic to the HTTP client in src/api.py
189
+ ```
190
+
191
+ ### Workflow prompts
192
+
193
+ ```text
194
+ /implement add Redis caching to the session store
195
+ /scout-and-plan refactor auth to support OAuth
196
+ /implement-and-review add input validation to API endpoints
197
+ ```
198
+
199
+ ### Slash commands
200
+
201
+ ```text
202
+ /pr-review 42
203
+ /release --dry-run
204
+ /review-local main
205
+ /query-db stats
206
+ ```
207
+
208
+ ### Direct subagent usage
209
+
210
+ ```text
211
+ Use python-expert to fix the type errors in src/models.py
212
+ Run scout and planner in a chain to analyze the auth module
213
+ ```
214
+
215
+ ## Code Review Loop
216
+
217
+ After any code change, the orchestrator runs 6 agents **in parallel** (5 reviewers + test-automator):
218
+
219
+ 1. **code-reviewer-quality** — Code quality & maintainability
220
+ 2. **code-reviewer-guidelines** — Project guidelines adherence
221
+ 3. **code-reviewer-security** — Bugs, logic errors, security
222
+ 4. **code-reviewer-docs** — Documentation quality, completeness, accuracy
223
+ 5. **code-reviewer-spec** — Code/PR/issue spec alignment
224
+ 6. **test-automator** — Runs project tests (pytest, node tests, pre-commit)
225
+
226
+ When `review_loop_enforcement` is enabled, the loop stops once all reviewers approve with 0 findings and tests pass
227
+ (`tests_passed: true` in `pi-config-review-state.json`), OR after `review_loop_max_cycles` total cycles (default `3`,
228
+ valid integers `1`-`10`; env: digit string `"1"`-`"10"` only (after trim)) — whichever comes first. Each cycle
229
+ always completes fix/explain (5a) before the cap check; the cap only blocks re-dispatch
230
+ (step 2 / all 6 agents, including test-automator), not responding to findings.
231
+ At cap, report **Not fixed** (explained why not → outstanding) vs **Fixed**
232
+ (verification blocked by the cap — cannot re-dispatch to confirm clean). Invalid values (including non-digit
233
+ forms like `"10.0"` / `"1e1"`) fall through to the next resolution layer / default `3`. Disable the review loop via
234
+ `review_loop_enforcement: false`, not via max_cycles. The max-cycles stop is via injected orchestrator rules
235
+ (LLM compliance only); commit blocking remains code-enforced — blocked unless both `status: clean` and
236
+ `tests_passed: true`; hitting the cycle cap does NOT bypass it.
237
+
238
+ Staged mode (`--autorabbit`/`--autoqodo` in `/review-handler`) shares one total `review_loop_max_cycles` budget
239
+ across both its Spec Compliance and Code Quality stages — not a separate cap per stage.
240
+
241
+ Use `/review-status` to inspect the current review loop state. Pass a worktree path to check a specific worktree (e.g., `/review-status .worktrees/issue-42`).
242
+
243
+ ## Customization
244
+
245
+ ### Project Settings
246
+
247
+ Create `.pi/pi-config-settings.json` in your project to override global defaults:
248
+
249
+ ```json
250
+ {
251
+ "commit_trailer": "Assisted-by",
252
+ "allow_push_to_protected_branches": false,
253
+ "use_worktrees": true,
254
+ "dream_interval_hours": 6,
255
+ "review_loop_enforcement": false,
256
+ "review_loop_max_cycles": 3,
257
+ "pidash_enable": true,
258
+ "pidiff_enable": true,
259
+ "pidash_port": 19190,
260
+ "image_model": "gemini-3-pro-image",
261
+ "acpx_agents": ["cursor"],
262
+ "cli_agents": ["claude", "cursor"],
263
+ "async_llm_provider": "anthropic",
264
+ "async_llm_model": "claude-sonnet-4-20250514",
265
+ "agent_provider": "cli-cursor",
266
+ "agent_model": "cursor:cursor-grok-4.5-high-fast",
267
+ "agent_overrides": {
268
+ "git-expert": { "provider": null, "model": null }
269
+ }
270
+ }
271
+ ```
272
+
273
+ Resolution order: project file → global `~/.pi/pi-config-settings.json` → env var → default.
274
+
275
+ See `dev-docs/project-settings.md` for the full settings table and env vars.
276
+
277
+ #### Reviewer Environment Variables
278
+
279
+ These are set automatically by the orchestrator when spawning reviewer agents:
280
+
281
+ | Variable | Description |
282
+ |----------|-------------|
283
+ | `PI_REVIEW_BASE_BRANCH` | Base branch for diff comparison (auto-detected from PR or falls back to main) |
284
+ | `PI_HAS_PR` | `true` if a PR exists for the current branch, `false` for pre-push reviews. When `false`, reviewers skip Review History and `code-reviewer-spec` runs a reduced flow (issue-only checks) |
285
+
286
+ #### Per-Project Resource Management
287
+
288
+ Use `pi config -l` to manage which resources (reviewers, skills, prompt templates) are enabled per-project:
289
+
290
+ ```bash
291
+ pi config -l # Open project-local resource config
292
+ ```
293
+
294
+ Press **Tab** to switch between global and project-local views. This lets you disable specific reviewers or skills for a project without editing JSON files.
295
+
296
+ ### Override agents
297
+
298
+ Place a `.md` file with the same `name` frontmatter in `~/.pi/agent/agents/` (user) or `.pi/agents/` (project) to override a bundled agent.
299
+
300
+ Priority: project > user > package (bundled).
301
+
302
+ ### Custom Rules
303
+
304
+ The orchestrator loads rules from three directories (later layers override same-filename entries):
305
+
306
+ | Layer | Path | Scope | Number range |
307
+ |-------|------|-------|--------------|
308
+ | Package | `<pi-config>/rules/` | All users, all projects | `00-69` |
309
+ | User | `~/.pi/agent/rules/` | All projects for this user | `70-89` |
310
+ | Project | `<project>/.pi/rules/` | Current project only | `90-99` |
311
+
312
+ To add a custom rule, create a `.md` file in the appropriate directory:
313
+
314
+ ```bash
315
+ # User-level rule (applies to all projects)
316
+ mkdir -p ~/.pi/agent/rules
317
+ cat > ~/.pi/agent/rules/75-my-rule.md << 'EOF'
318
+ # My Rule
319
+
320
+ Your orchestrator instructions here.
321
+ EOF
322
+
323
+ # Project-level rule (applies to current project only)
324
+ mkdir -p .pi/rules
325
+ cat > .pi/rules/90-project-rule.md << 'EOF'
326
+ # Project Rule
327
+
328
+ Project-specific instructions.
329
+ EOF
330
+ ```
331
+
332
+ Rules auto-load alphabetically. Same-filename entries are overridden (project > user > package). Missing directories are silently skipped.
333
+
334
+ ### Add project agents
335
+
336
+ Create `.pi/agents/my-agent.md` in your project with frontmatter:
337
+
338
+ ```markdown
339
+ ---
340
+ name: my-agent
341
+ description: What this agent does
342
+ tools: read, write, edit, bash
343
+ ---
344
+
345
+ Agent system prompt here.
346
+ ```
347
+
348
+ Project agents included by default (`agentScope` defaults to `"both"`).
349
+
350
+ ### Image Generation
351
+
352
+ The `generate_image` tool creates images from structured descriptions via Gemini API.
353
+
354
+ **Configuration:**
355
+
356
+ Set `image_model` in `pi-config-settings.json` or use `PI_IMAGE_MODEL` env var.
357
+
358
+ | Setting / Variable | Description |
359
+ |----------|-------------|
360
+ | `image_model` / `PI_IMAGE_MODEL` | Gemini model name (e.g., `gemini-3-pro-image`). No default. |
361
+ | `GEMINI_API_KEY` or `GOOGLE_API_KEY` | Gemini API key (env only) |
362
+
363
+ **Usage:** Ask naturally — "generate an image of a sunset" — or use structured params: `subject`, `action`, `scene`, `composition`, `lighting`, `style`, `text`, `aspect_ratio`.
364
+
365
+ In containers, images are auto-served via HTTP for browser preview.
366
+
367
+ ### Cache Miss Notices
368
+
369
+ Enable `showCacheMissNotices` in pi settings to see transcript notices on significant prompt-cache misses — useful for investigating unexpected token costs:
370
+
371
+ ```bash
372
+ pi config # Toggle showCacheMissNotices in settings UI
373
+ ```
374
+
375
+ Defaults to `false`. Enable when debugging cost spikes from cache invalidation.
376
+
377
+ ## Docker (Sandboxed Execution)
378
+
379
+ Run pi inside a disposable container for **filesystem isolation** — the agent can only access your mounted project directory and pi settings. Everything else on the host is protected.
380
+
381
+ ### Why?
382
+
383
+ - **Safety** — Prevents accidental `rm -rf`, modifications outside the project, or unintended system changes
384
+ - **Filesystem isolation** — pi can only read/write the mounted project directory
385
+ - **Consistent tooling** — All required tools pre-installed in a single image
386
+ - **Disposable** — Container is destroyed after each session (`--rm`)
387
+
388
+ **CLI provider binaries (optional `cli_agents`):** The image installs the CLIs used by
389
+ `cli-*` providers — `claude` (Claude Code), `gemini` (`@google/gemini-cli`), and
390
+ `agent` (Cursor Agent CLI). Enable with `cli_agents` in settings (e.g.
391
+ `["claude","cursor","gemini"]`). Binary missing at load → `cli-*` not registered.
392
+ After register, `filterModels` hides models when unavailable: PATH cleared while
393
+ agent state remains → restore PATH; after `session_shutdown` (AgentState cleared)
394
+ → `/reload` or restart (PATH alone is not enough). See `dev-docs/cli-provider.md`.
395
+
396
+ **CLI specialist agents (Cursor / Claude / Gemini):** On container start, `entrypoint.sh`
397
+ symlinks package `agents/*.md` into the mounted project:
398
+
399
+ - `.cursor/agents/`
400
+ - `.claude/agents/`
401
+ - `.gemini/agents/`
402
+
403
+ Uses `ln -sfn` (safe if multiple `pi-docker` sessions share the same folder). Those three
404
+ directories are added to the container global gitignore. **Native** installs do not auto-
405
+ sync — copy or symlink yourself (see `dev-docs/cli-provider.md`).
406
+
407
+ **Extension ops logs:** `cli-provider` and dreaming write to `~/.pi/logs/` (not the chat
408
+ UI). Fallback: `$TMPDIR/pi-logs/`. Details in `dev-docs/cli-provider.md` (Logging).
409
+
410
+ ### Pre-built image
411
+
412
+ ```bash
413
+ docker pull ghcr.io/myk-org/pi-config:latest
414
+ ```
415
+
416
+ ### Build from source (optional)
417
+
418
+ > **Note:** The image is built for **linux/amd64** only.
419
+ > On ARM hosts, build with `--platform linux/amd64`.
420
+
421
+ ```bash
422
+ git clone https://github.com/myk-org/pi-config.git
423
+ cd pi-config
424
+ docker build -t ghcr.io/myk-org/pi-config:latest .
425
+ ```
426
+
427
+ ### Run
428
+
429
+ ```bash
430
+ docker run --rm -it \
431
+ --name "pi-config-$(basename $PWD)-$(date +%s)" \
432
+ --network host \
433
+ --env-file /path/to/.env \
434
+ -v "$PWD":"$PWD":rw \
435
+ -v "$HOME/.pi":"$HOME/.pi":rw \
436
+ -v "$HOME/.gitconfig":"$HOME/.gitconfig":ro \
437
+ -v "$HOME/.gitignore-global":"$HOME/.gitignore-global":ro \
438
+ -v "$HOME/.ssh":"$HOME/.ssh":ro \
439
+ -v "$HOME/.config/gh":"$HOME/.config/gh":ro \
440
+ -w "$PWD" \
441
+ ghcr.io/myk-org/pi-config:latest
442
+ ```
443
+
444
+ ### Environment file
445
+
446
+ Create a `.env` file with container-specific variables:
447
+
448
+ ```env
449
+ # Timezone (host timezone for correct timestamps)
450
+ TZ=Asia/Jerusalem
451
+
452
+ # Host username (creates /home/<user> -> container home symlink so host paths resolve)
453
+ PI_HOST_USER=myakove
454
+
455
+ # Google Cloud / Vertex AI
456
+ GOOGLE_CLOUD_PROJECT=your-project-id
457
+ GOOGLE_CLOUD_LOCATION=us-east5
458
+ GOOGLE_APPLICATION_CREDENTIALS=/home/myakove/.config/gcloud/application_default_credentials.json
459
+ VERTEX_PROJECT_ID=your-project-id
460
+ VERTEX_REGION=us-east5
461
+ VERTEX_CLAUDE_1M=true
462
+
463
+ # GitHub
464
+ GITHUB_TOKEN=ghp_xxx
465
+ GITHUB_API_TOKEN=ghp_xxx
466
+ GH_CONFIG_DIR=/home/myakove/.config/gh
467
+
468
+ # Gemini (optional — required for image generation)
469
+ GEMINI_API_KEY=xxx
470
+
471
+ # Image generation model (required for generate_image tool)
472
+ PI_IMAGE_MODEL=gemini-3-pro-image
473
+
474
+ # acpx agents (optional)
475
+ # ACPX_AGENTS=cursor
476
+
477
+ # mcpl (MCP Launchpad) config path inside the container (must match mount target)
478
+ # Use your actual home path — it resolves inside the container via the PI_HOST_USER symlink
479
+ MCPL_CONFIG_FILES=/home/myakove/.config/mcpl/mcp.json
480
+ ```
481
+
482
+ Pass via `--env-file /path/to/.env` in the docker run command.
483
+
484
+ ### Project memory
485
+
486
+ The memory system stores per-repo lessons and patterns in `.pi/memory/topics/` as markdown
487
+ files organized by category (lessons, preferences, patterns, decisions, completions, mistakes).
488
+
489
+ - **Pinned** — user-requested memories (via `/remember`), never auto-removed
490
+ - **Learned** — auto-extracted by dreaming, can be reorganized/removed
491
+
492
+ The `.pi/memory/` directory is auto-added to the global gitignore in the container
493
+ (along with `.pi/`, `.worktrees/`, `.cursor/agents/`, `.claude/agents/`, and
494
+ `.gemini/agents/`).
495
+
496
+ For **native** (non-container) usage, add memory (and optionally CLI agent dirs) to your
497
+ global gitignore:
498
+
499
+ ```bash
500
+ echo '.pi/memory/' >> ~/.gitignore-global
501
+ # If you symlink pi agents for cli-cursor / cli-claude / cli-gemini:
502
+ echo '.cursor/agents/' >> ~/.gitignore-global
503
+ echo '.claude/agents/' >> ~/.gitignore-global
504
+ echo '.gemini/agents/' >> ~/.gitignore-global
505
+ git config --global core.excludesFile ~/.gitignore-global
506
+ ```
507
+
508
+ ### Pidash — live web dashboard
509
+
510
+ Pidash is a web-based dashboard that runs alongside the TUI, accessible from any browser including mobile phones.
511
+
512
+ **How it works:**
513
+
514
+ - A daemon (`pidash-server.ts`) runs on port `19190` and aggregates all pi sessions
515
+ - Each pi session's extension (`pidash.ts`) connects to the daemon and forwards events
516
+ - The React web UI shows live conversations, tool calls, and session status
517
+
518
+ **Features:**
519
+
520
+ - Multi-session dashboard with sidebar grouped by project
521
+ - Live conversation streaming (user, assistant, tool, thinking)
522
+ - Send messages from browser to pi
523
+ - Model and thinking level switching from browser
524
+ - Extension commands (`/release`, `/dream`, `/remember`, etc.) work from browser
525
+ - Info bar: model, tokens, context %, git status (with PR `#N` when present)
526
+ - TUI status line: clickable `pi-diff` / `pi-dash` labels and open-PR `#N` hyperlink
527
+ - Per-project diff viewer (pidiff) — opens in browser via clickable `pi-diff` status-line link, powered by `@pierre/diffs` + `@pierre/trees`, with review comments
528
+ - Collapsible thinking and tool blocks with copy buttons
529
+ - ask_user tool bridging (answer from browser or TUI)
530
+ - Mobile responsive
531
+ - Event buffering for message replay on refresh
532
+ - Browser push notifications for background events (configurable per event type)
533
+ - Async agent live streaming (real-time tool calls and output inline in chat)
534
+ - Sidebar session working indicator (pulsing green dot when AI is active)
535
+ - `[HH:MM]` timestamps on all messages
536
+
537
+ **Access:**
538
+
539
+ ```bash
540
+ # Automatically starts with pi — open in browser:
541
+ http://localhost:19190
542
+
543
+ # From other devices on your network:
544
+ http://<your-ip>:19190
545
+
546
+ # Custom port (or set pidash_port in pi-config-settings.json):
547
+ PI_PIDASH_PORT=9999 pi
548
+
549
+ # Disable pidash (or set pidash_enable: false in pi-config-settings.json):
550
+ PI_PIDASH_ENABLE=false pi
551
+ ```
552
+
553
+ **Management:**
554
+
555
+ ```bash
556
+ /pidash status # Check server status
557
+ /pidash stop # Stop the daemon
558
+ /pidash start # Start the daemon
559
+ /pidash restart # Restart the daemon
560
+ ```
561
+
562
+ **Building the UI (first run only — auto-built):**
563
+
564
+ ```bash
565
+ cd extensions/pidash/pidash-ui
566
+ npm install && npm run build
567
+ ```
568
+
569
+ > **Note:** Session switching (`/resume`) and new sessions (`/new`) from the browser are not yet supported due to a pi API limitation. Use the TUI for these operations.
570
+
571
+ ### Pidiff — per-project diff viewer
572
+
573
+ Pidiff is a per-project diff viewer that opens in your browser, providing rich branch diffs with inline review comments.
574
+
575
+ **How it works:**
576
+
577
+ - Each pi session spawns its own server (`pidiff-server.ts`) on a random free port
578
+ - Container and native sessions get separate servers automatically
579
+ - Lockfiles in `.pi/tmp/` track port and PID for each server
580
+ - The extension (`pidiff.ts`) connects to its session's server and registers its repo
581
+ - The React UI uses `@pierre/diffs` and `@pierre/trees` for a full-featured diff experience
582
+
583
+ **Features:**
584
+
585
+ - Branch diff and commit comparison
586
+ - File tree with search and filtering
587
+ - Inline review comments on specific lines
588
+ - Publish review comments back to the pi session
589
+ - Per-project isolation — no port conflicts between sessions
590
+ - Accessible via clickable `pi-diff` label in the status line (and from pidash)
591
+
592
+ **Access:**
593
+
594
+ ```bash
595
+ # Open in browser (click `pi-diff` in the status line, or use the port):
596
+ http://localhost:<port>
597
+
598
+ # Disable pidiff (or set pidiff_enable: false in pi-config-settings.json):
599
+ PI_PIDIFF_ENABLE=false pi
600
+ ```
601
+
602
+ **Management:**
603
+
604
+ ```bash
605
+ /pidiff status # Check server status
606
+ /pidiff stop # Stop the server
607
+ /pidiff start # Start the server
608
+ /pidiff restart # Restart the server
609
+ ```
610
+
611
+ ### Optional mounts
612
+
613
+ | Mount | Purpose |
614
+ |---|---|
615
+ | `-v "<PATH_TO_MCPL_CONFIG>":"$HOME/.config/mcpl/mcp.json":ro` | MCP server config for `mcpl` |
616
+ | `-v "$HOME/.agents":"$HOME/.agents":rw` | User-level skills (install/uninstall from container) |
617
+ | `-v "$HOME/.config/gcloud/application_default_credentials.json":"$HOME/.config/gcloud/application_default_credentials.json":ro` | Google Cloud ADC (for Claude via Vertex AI) |
618
+ | `-v "$HOME/.config/cursor/auth.json":"$HOME/.config/cursor/auth.json":ro` | Cursor CLI auth (for acpx cursor models) |
619
+ | `-v "$HOME/.config/glab-cli":"$HOME/.config/glab-cli":ro` | GitLab CLI config (auth tokens, host settings) |
620
+ | `-v "$HOME/.coderabbit":"$HOME/.coderabbit":rw` | CodeRabbit CLI auth and review data |
621
+ | `-v "$HOME/screenshots":"$HOME/screenshots"` | Share screenshots/images with the agent |
622
+ | `-v /var/run/docker.sock:/var/run/docker.sock:ro` + `--group-add $(stat -c '%g' /var/run/docker.sock)` | Docker container inspection via `docker-safe` |
623
+ | `-v /var/run/podman/podman.sock:/var/run/podman/podman.sock:ro` | Podman container inspection via `docker-safe` |
624
+
625
+ ### What's in the image
626
+
627
+ | Tool | Purpose |
628
+ |---|---|
629
+ | `pi` | Coding agent |
630
+ | `git` | Version control |
631
+ | `gh` | GitHub CLI (PRs, issues) |
632
+ | `glab` | GitLab CLI (MRs, issues, pipelines) — install [gitlab-cli-skills](https://github.com/vince-winkintel/gitlab-cli-skills) for full agent support |
633
+ | `uv` / `uvx` | Python execution (enforced by orchestrator) |
634
+ | `go` | Go development and code review |
635
+ | `mcpl` | MCP server access (search, Jenkins, etc.) |
636
+ | `myk-pi-tools` | PR review, release, and other CLI utilities |
637
+ | `prek` | Pre-commit hook runner |
638
+ | `acpx` | Agent proxy for remote models |
639
+ | `kubectl` / `oc` | Kubernetes and OpenShift CLI |
640
+ | `agent-browser` | Browser automation CLI (navigate, click, screenshot, forms) |
641
+ | `procps` | Process utilities (ps, top, pgrep, pkill) |
642
+ | `docker` / `podman` | Container CLIs (used via `docker-safe` read-only wrapper) |
643
+ | `docker-safe` | Restricted Docker/Podman wrapper — container only (ps, logs, inspect, top, stats) |
644
+ | `jq` | JSON processing |
645
+ | `rg` (ripgrep) | Fast recursive search |
646
+ | `cr` | CodeRabbit CLI — local AI code reviews |
647
+ | `curl` | HTTP requests |
648
+
649
+ #### `myk-pi-tools` subcommands
650
+
651
+ | Command | Description |
652
+ |---------|-------------|
653
+ | `myk-pi-tools pr diff` | Fetch PR diff and metadata |
654
+ | `myk-pi-tools pr info` | Fetch PR information as structured JSON |
655
+ | `myk-pi-tools pr post-comment` | Post inline comments to a PR |
656
+ | `myk-pi-tools pr store-pr-review` | Store posted PR review comments to `pr-reviews.db` |
657
+ | `myk-pi-tools pr update-resolution` | Update resolution status for a previously posted review comment. Used by Phase 1c of `/pr-review` to persist LLM evaluation verdicts |
658
+ | `myk-pi-tools pr get-review-history` | Return complete review history for a PR as JSON (posted, skipped, resolved findings). Used by reviewers to avoid re-raising dismissed findings |
659
+ | `myk-pi-tools pr get-skipped-comments` | Get previously skipped review comments for a PR |
660
+ | `myk-pi-tools pr claude-md` | Fetch `CLAUDE.md` and `AGENTS.md` content for a PR's repository |
661
+ | `myk-pi-tools release create` | Create a GitHub release with changelog |
662
+ | `myk-pi-tools db` | Review database query commands |
663
+ | `myk-pi-tools reviews` | Review handling commands |
664
+ | `myk-pi-tools memory` | Project memory commands — persistent per-repo learning |
665
+ | `myk-pi-tools ai-cli` | AI CLI commands (cursor, claude, gemini) |
666
+ | `myk-pi-tools coderabbit` | CodeRabbit commands |
667
+
668
+ ### What's protected
669
+
670
+ **Filesystem isolation** — the container cannot access anything outside the mounted volumes:
671
+
672
+ - ✅ `$PWD` (your project) — read/write
673
+ - ✅ `~/.pi` (pi settings/sessions) — read/write
674
+ - ✅ Git, GitHub, SSH config — read-only
675
+ - ❌ Other directories on your host — not accessible
676
+ - ❌ Other git repos — not accessible
677
+ - ❌ System files — not accessible
678
+
679
+ **Network** — `--network host` shares the host network stack,
680
+ so the container can reach any service your host can (LAN, localhost),
681
+ and the host can reach services started inside the container.
682
+ This is required for local MCP servers, LiteLLM proxy, and file preview
683
+ (agents serve generated HTML/frontend files via HTTP for browser access).
684
+ If your LLM provider is cloud-based, you don't use local MCPs,
685
+ and you don't need file preview, you can omit `--network host`.
686
+
687
+ ### Shell alias
688
+
689
+ Add to your `~/.bashrc` or `~/.zshrc`:
690
+
691
+ ```bash
692
+ alias pi-docker='docker pull ghcr.io/myk-org/pi-config:latest && \
693
+ docker run --rm -it \
694
+ --name "pi-config-$(basename $PWD)-$(date +%s)" \
695
+ --network host \
696
+ --env-file "$HOME/.pi/.env" \
697
+ -v "$PWD":"$PWD":rw \
698
+ -v "$HOME/.pi":"$HOME/.pi":rw \
699
+ -v "$HOME/.gitconfig":"$HOME/.gitconfig":ro \
700
+ -v "$HOME/.gitignore-global":"$HOME/.gitignore-global":ro \
701
+ -v "$HOME/.ssh":"$HOME/.ssh":ro \
702
+ -v "$HOME/.config/gh":"$HOME/.config/gh":ro \
703
+ -v "$HOME/.config/mcpl/mcp.json":"$HOME/.config/mcpl/mcp.json":ro \ # adjust host path to your mcpl config location
704
+ -v "$HOME/.agents":"$HOME/.agents":rw \
705
+ -v "$HOME/.config/gcloud/application_default_credentials.json":"$HOME/.config/gcloud/application_default_credentials.json":ro \
706
+ -v "$HOME/.config/cursor/auth.json":"$HOME/.config/cursor/auth.json":ro \
707
+ -v "$HOME/.config/glab-cli":"$HOME/.config/glab-cli":ro \
708
+ -v "$HOME/screenshots":"$HOME/screenshots":ro \
709
+ -v /var/run/docker.sock:/var/run/docker.sock:ro \
710
+ --group-add $(stat -c '%g' /var/run/docker.sock) \
711
+ -w "$PWD" \
712
+ ghcr.io/myk-org/pi-config:latest'
713
+ ```
714
+
715
+ Then just run `pi-docker` from any project directory.
716
+
717
+ > **Startup note:** The container runs as non-root user `node` (UID 1000).
718
+ > `pi install` runs on each start.
719
+ > A `WARNING` on stderr is normal when the package is already cached in `~/.pi`.
720
+ > If pi misbehaves or the warning persists, verify network connectivity
721
+ > and run `pi install git:github.com/myk-org/pi-config` manually.
722
+
723
+ ## Discord Bot
724
+
725
+ Control your pi sessions from your phone via Discord DMs.
726
+
727
+ ### Setup
728
+
729
+ 1. **Create a Discord bot:**
730
+ - Go to [Discord Developer Portal](https://discord.com/developers/applications)
731
+ - Click "New Application" → name it (e.g., "pi-agent")
732
+ - Go to "Bot" section → click "Reset Token" → copy the token
733
+ - Enable "Message Content Intent" under "Privileged Gateway Intents"
734
+ - Go to "OAuth2 > URL Generator" → select scope `bot` → select permissions:
735
+ `Send Messages`, `Read Message History`, `Add Reactions`, `View Channels`
736
+ - Open the generated URL → add bot to your server
737
+
738
+ 2. **Configure:**
739
+
740
+ ```bash
741
+ # Create config file
742
+ cat > ~/.pi/discord.env << EOF
743
+ DISCORD_BOT_TOKEN=your-token-here
744
+ DISCORD_ALLOWED_USERS=your-discord-user-id
745
+ EOF
746
+ ```
747
+
748
+ Find your Discord user ID: Settings > Advanced > Developer Mode ON, then right-click yourself > Copy User ID.
749
+
750
+ 3. **Restart pidash:**
751
+ The Discord bot runs inside the pidash server daemon. Restart it to pick up the config:
752
+
753
+ ```text
754
+ /pidash restart
755
+ ```
756
+
757
+ ### Discord Commands
758
+
759
+ | Command | Description |
760
+ |---------|-------------|
761
+ | `!sessions` | List active pi sessions |
762
+ | `!watch N` | Watch/switch to session N |
763
+ | `!status` | Show current session info |
764
+ | `!abort` | Abort current operation |
765
+ | `!help` | Show commands |
766
+ | Any text | Send as prompt to watched session |
767
+ | `/command` | Forward slash command to pi session |
768
+
769
+ ### How It Works
770
+
771
+ The Discord bot runs inside the pidash server daemon (no separate process):
772
+
773
+ ```text
774
+ Discord app (phone) ↔ Discord cloud ↔ pidash server (localhost) ↔ pi sessions
775
+ ```
776
+
777
+ No ports to open — the bot connects outbound to Discord’s API.
778
+ The bot starts automatically with pidash when `DISCORD_BOT_TOKEN` is configured.
779
+
780
+ ## Development
781
+
782
+ See [DEVELOPMENT.md](DEVELOPMENT.md) for tips on testing extensions locally, running tests, and managing Python dependencies.
783
+
784
+ ## Prerequisites
785
+
786
+ - [pi](https://github.com/badlogic/pi-mono) (minimum version: **0.81.0**)
787
+ - `gh` CLI (for GitHub operations)
788
+ - `uv` (for Python execution)
789
+ - `myk-pi-tools` (optional, for `/pr-review` and `/release`)
790
+
791
+ ## Workspace Packages
792
+
793
+ ### pi-sidecar
794
+
795
+ A standalone HTTP sidecar wrapping the Pi SDK, living under `packages/pi-sidecar/`.
796
+
797
+ | Package | Language | Registry |
798
+ |---------|----------|----------|
799
+ | `@myk-org/pi-sidecar` | TypeScript | npm |
800
+ | `pi-sidecar-client` | Python | PyPI |
801
+
802
+ CLI commands: `npx pi-sidecar` (start server), `npx pi-sidecar-start` (background start/stop).
803
+
804
+ See [`packages/pi-sidecar/README.md`](packages/pi-sidecar/README.md) for full documentation.
805
+
806
+ ## License
807
+
808
+ MIT