gentle-pi 4.6.0 → 4.7.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 (290) hide show
  1. package/README.md +10 -11
  2. package/assets/agents/gentle-ai-explore.md +1 -0
  3. package/assets/agents/gentle-ai-verify.md +5 -2
  4. package/assets/agents/gentle-ai-worker.md +3 -0
  5. package/assets/agents/jd-fix-agent.md +1 -0
  6. package/assets/agents/jd-judge-a.md +1 -0
  7. package/assets/agents/jd-judge-b.md +1 -0
  8. package/assets/design-canvas/canvas.css +13 -1
  9. package/assets/design-canvas/canvas.js +11 -2
  10. package/assets/install-wizard/wizard.js +1 -0
  11. package/assets/migrations/agent-body-history.json +16 -1
  12. package/assets/orchestrator-delegation-reference.md +4 -4
  13. package/assets/orchestrator-delegation.md +1 -1
  14. package/assets/orchestrator-full-delegation-card.md +65 -0
  15. package/assets/orchestrator-full-delegation.md +34 -0
  16. package/assets/orchestrator-memory.md +3 -3
  17. package/assets/orchestrator-prompts.md +1 -1
  18. package/assets/orchestrator-skills.md +1 -1
  19. package/assets/orchestrator-verification.md +7 -5
  20. package/assets/orchestrator.md +3 -3
  21. package/bin/gentle-shell.mjs +164 -56
  22. package/docs/agent-status.md +61 -0
  23. package/docs/bundled-install.md +7 -5
  24. package/docs/delegated-verification.md +29 -7
  25. package/docs/gentle-agents-activity.md +14 -0
  26. package/docs/gentle-shell.md +54 -16
  27. package/docs/install-wizard.md +1 -1
  28. package/docs/permission-modes.md +9 -4
  29. package/docs/readme-reference.md +75 -30
  30. package/docs/render-cache-performance.md +11 -1
  31. package/docs/review-coordinator.md +33 -0
  32. package/docs/review-request-context.md +19 -0
  33. package/docs/review-windows-acl.md +18 -0
  34. package/docs/voice.md +6 -3
  35. package/docs/yolo-mode.md +5 -5
  36. package/extensions/ask-user-choice.ts +1 -0
  37. package/extensions/ask-user-question.ts +1 -0
  38. package/extensions/child-safety.ts +3 -0
  39. package/extensions/gentle-agent-status.ts +99 -0
  40. package/extensions/gentle-agents.ts +326 -34
  41. package/extensions/gentle-ai.ts +1496 -454
  42. package/extensions/gentle-shell.ts +293 -63
  43. package/extensions/gentle-todo.ts +18 -2
  44. package/extensions/gentle-tps.ts +48 -0
  45. package/extensions/quiet-tools.ts +38 -8
  46. package/extensions/skill-registry.ts +175 -18
  47. package/extensions/startup-banner.ts +30 -3
  48. package/lib/agent-profile-pin.ts +3 -3
  49. package/lib/agent-profiles.ts +160 -2
  50. package/lib/agent-status.ts +105 -0
  51. package/lib/agents-config.ts +46 -0
  52. package/lib/agents-history.ts +24 -5
  53. package/lib/agents-messaging.ts +47 -5
  54. package/lib/agents-runner.ts +183 -12
  55. package/lib/auto-permission-runtime.ts +1 -1
  56. package/lib/bounded-writer-admission.ts +13 -1
  57. package/lib/card-content-policy.ts +8 -6
  58. package/lib/command-palette.ts +133 -17
  59. package/lib/context-backstop.ts +14 -5
  60. package/lib/destructive-command-guard.ts +48 -4
  61. package/lib/execution-surface-guard.ts +20 -0
  62. package/lib/exploration-budget.ts +4 -2
  63. package/lib/gentle-ai-binary.ts +1 -1
  64. package/lib/gentle-design.ts +3 -0
  65. package/lib/gentle-shell-bundled.ts +6 -19
  66. package/lib/gentle-shell-launcher.ts +43 -8
  67. package/lib/herdr-activity.ts +14 -2
  68. package/lib/herdr-busy.ts +45 -0
  69. package/lib/image-attachments.ts +33 -0
  70. package/lib/image-disk-cache.ts +137 -0
  71. package/lib/inprocess-reviewer.ts +270 -140
  72. package/lib/jobs-view.ts +198 -11
  73. package/lib/model-routing-authority.ts +22 -4
  74. package/lib/native-choice-list.ts +20 -2
  75. package/lib/native-review-cli.ts +96 -19
  76. package/lib/orchestrator-mode-policy.ts +105 -0
  77. package/lib/questionnaire/questionnaire-view.ts +105 -12
  78. package/lib/rdd-mode-control.ts +32 -0
  79. package/lib/reply-language-anchor.ts +104 -0
  80. package/lib/review-blocker.ts +92 -0
  81. package/lib/review-candidate-symlink-scan.ts +136 -0
  82. package/lib/review-candidate-view-owner.ts +81 -44
  83. package/lib/review-continuation-registry.ts +99 -0
  84. package/lib/review-coordinator.ts +163 -0
  85. package/lib/review-failure-facts.ts +49 -0
  86. package/lib/review-host-relay.ts +46 -10
  87. package/lib/review-integration-v2.ts +7 -1
  88. package/lib/review-relay-phase-timing.ts +45 -0
  89. package/lib/review-start-context.ts +17 -0
  90. package/lib/session-profile-freeze.ts +4 -2
  91. package/lib/shell-bar.ts +140 -58
  92. package/lib/shell-changes.ts +2 -0
  93. package/lib/shell-panel.ts +17 -3
  94. package/lib/shell-sidebar-layout.ts +112 -40
  95. package/lib/shell-sidebar.ts +7 -0
  96. package/lib/shell-todo.ts +10 -3
  97. package/lib/verifier-admission.ts +1 -1
  98. package/lib/visual-customization-policy.ts +36 -16
  99. package/lib/visual-customize-view.ts +216 -21
  100. package/lib/visual-layout-preview.ts +9 -5
  101. package/lib/visual-profiles.ts +2 -2
  102. package/lib/windows-session-transport.ts +53 -2
  103. package/lib/yolo-session-policy.ts +40 -15
  104. package/package.json +2 -1
  105. package/runtime/gentle-ai-binary.mjs +1 -1
  106. package/runtime/gentle-shell-bundled.mjs +6 -19
  107. package/runtime/gentle-shell-launcher.mjs +42 -7
  108. package/runtime/native-review-cli.mjs +93 -16
  109. package/runtime/review-integration-v2.mjs +7 -1
  110. package/scripts/build-full-delegation-card.mjs +175 -0
  111. package/scripts/bundled-install.mjs +38 -8
  112. package/scripts/download-progress.mjs +68 -0
  113. package/scripts/gentle-ai-installer.mjs +41 -18
  114. package/scripts/gentle-ai-proxy.mjs +294 -0
  115. package/scripts/install-gentle-ai.mjs +14 -1
  116. package/scripts/installer-preflight.mjs +5 -5
  117. package/scripts/installer-runner.mjs +27 -12
  118. package/scripts/installer-server.mjs +8 -7
  119. package/scripts/render-cache-host.mjs +72 -0
  120. package/scripts/render-cache-performance-worker.mjs +5 -4
  121. package/scripts/render-cache-performance.mjs +6 -1
  122. package/scripts/run-test-suite.mjs +40 -28
  123. package/scripts/verify-package-files.mjs +12 -2
  124. package/scripts/voice-worker.cjs +32 -6
  125. package/skills/design/SKILL.md +11 -8
  126. package/skills/gentle-ai/SKILL.md +2 -2
  127. package/skills/gentle-ui-design/SKILL.md +46 -0
  128. package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
  129. package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
  130. package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
  131. package/skills/gentle-ui-design/references/task-and-content.md +60 -0
  132. package/skills/skill-registry/SKILL.md +4 -2
  133. package/skills/work-unit-commits/SKILL.md +6 -7
  134. package/tests/agent-home.test.ts +28 -9
  135. package/tests/agent-profiles-workflow.test.ts +163 -0
  136. package/tests/agent-risk-escalation.test.ts +1 -1
  137. package/tests/agent-status.test.ts +143 -0
  138. package/tests/agents-config.test.ts +96 -0
  139. package/tests/agents-history.test.ts +31 -0
  140. package/tests/agents-jobs-frames.test.ts +93 -0
  141. package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
  142. package/tests/agents-runner-drain.test.ts +193 -0
  143. package/tests/agents-runner.test.ts +178 -2
  144. package/tests/append-system-prompt-route.test.ts +4 -1
  145. package/tests/ask-user-choice.test.ts +4 -3
  146. package/tests/ask-user-question.test.ts +97 -0
  147. package/tests/auto-permission-runtime.test.ts +1 -1
  148. package/tests/autonomous-guard.test.ts +346 -10
  149. package/tests/bounded-stop-contract.test.ts +43 -3
  150. package/tests/bridge-cost.test.ts +19 -4
  151. package/tests/bundled-install.test.ts +30 -5
  152. package/tests/card-content-policy.test.ts +3 -3
  153. package/tests/chained-pr-skill.test.ts +8 -6
  154. package/tests/child-safety.test.ts +11 -0
  155. package/tests/codegraph-tools.test.ts +11 -5
  156. package/tests/command-palette.test.ts +284 -1
  157. package/tests/delegate-for-reason-contract.test.ts +3 -3
  158. package/tests/design-canvas-assets.test.ts +185 -2
  159. package/tests/destructive-command-guard.test.ts +52 -0
  160. package/tests/download-progress.test.ts +71 -0
  161. package/tests/execution-surface-guard.test.ts +55 -0
  162. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +9 -5
  163. package/tests/fixtures/proxy-tls/proxy.crt +19 -0
  164. package/tests/fixtures/proxy-tls/proxy.key +28 -0
  165. package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
  166. package/tests/fixtures/session-profile-v1/replay.ts +53 -6
  167. package/tests/full-delegation-closure.test.ts +131 -0
  168. package/tests/full-delegation-notices.test.ts +76 -0
  169. package/tests/generic-agent-tools.test.ts +3 -3
  170. package/tests/gentle-agent-status.test.ts +74 -0
  171. package/tests/gentle-agents-child-jobs.test.ts +237 -0
  172. package/tests/gentle-agents.test.ts +1070 -12
  173. package/tests/gentle-ai-binary.test.ts +3 -1
  174. package/tests/gentle-ai-elapsed-store.test.ts +19 -0
  175. package/tests/gentle-ai-exploration-budget.test.ts +18 -2
  176. package/tests/gentle-ai-installer.test.ts +134 -51
  177. package/tests/gentle-ai-proxy.test.ts +434 -0
  178. package/tests/gentle-ai.test.ts +113 -38
  179. package/tests/gentle-design.test.ts +21 -0
  180. package/tests/gentle-herdr-activity.test.ts +9 -6
  181. package/tests/gentle-shell-bin.test.ts +123 -0
  182. package/tests/gentle-shell-bundled.test.ts +207 -31
  183. package/tests/gentle-shell-launcher.test.ts +77 -10
  184. package/tests/gentle-shell.test.ts +899 -59
  185. package/tests/gentle-todo.test.ts +19 -2
  186. package/tests/gentle-tps.test.ts +123 -0
  187. package/tests/gentle-ui-design-skill.test.ts +59 -0
  188. package/tests/herdr-busy.test.ts +59 -0
  189. package/tests/herdr-task-summary-policy.test.ts +8 -4
  190. package/tests/image-disk-cache.test.ts +163 -0
  191. package/tests/independent-recovery-delivery.test.ts +83 -0
  192. package/tests/inprocess-reviewer.test.ts +176 -4
  193. package/tests/installer-posix-bootstrap.test.ts +1 -1
  194. package/tests/installer-preflight.test.ts +5 -4
  195. package/tests/installer-runner.test.ts +79 -44
  196. package/tests/installer-server.test.ts +14 -11
  197. package/tests/jobs-view.test.ts +260 -6
  198. package/tests/modal-mouse-boundaries.test.ts +136 -0
  199. package/tests/model-routing-authority.test.ts +178 -2
  200. package/tests/native-choice-list.test.ts +77 -2
  201. package/tests/native-review-capability-contract.test.ts +7 -1
  202. package/tests/native-review-cli.test.ts +269 -1
  203. package/tests/no-self-pause-contract.test.ts +4 -1
  204. package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
  205. package/tests/orchestrator-budget.test.ts +7 -2
  206. package/tests/orchestrator-delegation-mode.test.ts +153 -0
  207. package/tests/orchestrator-mode-policy.test.ts +175 -0
  208. package/tests/orchestrator-prompt-budget.test.ts +3 -1
  209. package/tests/orchestrator-rdd-ownership.test.ts +2 -2
  210. package/tests/package-manifest.test.ts +11 -9
  211. package/tests/permission-allowlist.test.ts +202 -0
  212. package/tests/pi-update-launcher.test.ts +8 -0
  213. package/tests/pnpm-workspace-config.test.ts +58 -0
  214. package/tests/primary-session-prompt.test.ts +13 -0
  215. package/tests/profile-pin.test.ts +29 -2
  216. package/tests/profile-tier-footer.test.ts +5 -0
  217. package/tests/profiles-panel-delegation-mode.test.ts +422 -0
  218. package/tests/questionnaire-view.test.ts +115 -0
  219. package/tests/quiet-bash-runtime.test.ts +1 -1
  220. package/tests/quiet-tool-rendering.test.ts +48 -0
  221. package/tests/rdd-aware-verification-contract.test.ts +16 -11
  222. package/tests/rdd-customize.test.ts +287 -0
  223. package/tests/rdd-mode-cache.test.ts +450 -0
  224. package/tests/rdd-mode-control.test.ts +407 -0
  225. package/tests/rdd-mode-scope-regression.test.ts +137 -0
  226. package/tests/rdd-off-independent-regression.test.ts +69 -0
  227. package/tests/rdd-status-line.test.ts +18 -0
  228. package/tests/render-cache-performance.test.ts +171 -2
  229. package/tests/reply-language-anchor.test.ts +173 -0
  230. package/tests/review-agent-end-preflight.test.ts +1 -1
  231. package/tests/review-blocker.test.ts +193 -0
  232. package/tests/review-candidate-owner-retry.test.ts +1 -1
  233. package/tests/review-candidate-symlink-scan.test.ts +157 -0
  234. package/tests/review-candidate-view.test.ts +1 -1
  235. package/tests/review-candidate-windows-boundary.test.ts +131 -0
  236. package/tests/review-candidate-windows-probe.test.ts +63 -0
  237. package/tests/review-committed-restart-ack.test.ts +129 -0
  238. package/tests/review-continuation-registry.test.ts +76 -0
  239. package/tests/review-controller-native-routing.test.ts +261 -5
  240. package/tests/review-controller-workspace-root.test.ts +230 -3
  241. package/tests/review-controller.test.ts +96 -11
  242. package/tests/review-coordinator-runtime.test.ts +117 -0
  243. package/tests/review-coordinator.test.ts +195 -0
  244. package/tests/review-failure-facts.test.ts +87 -0
  245. package/tests/review-host-relay-routing.test.ts +258 -4
  246. package/tests/review-host-relay.test.ts +39 -0
  247. package/tests/review-integration-v2.test.ts +46 -3
  248. package/tests/review-json-arguments.test.ts +65 -10
  249. package/tests/review-last-event-closure.test.ts +68 -0
  250. package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
  251. package/tests/review-owner-identity.test.ts +60 -24
  252. package/tests/review-relay-phase-timing.test.ts +128 -0
  253. package/tests/review-relay-transport-agent.test.ts +12 -2
  254. package/tests/review-reviewer-evidence.test.ts +183 -0
  255. package/tests/review-risk-assessment.test.ts +74 -3
  256. package/tests/review-session-standing-permission-controller.test.ts +21 -1
  257. package/tests/review-start-context.test.ts +19 -0
  258. package/tests/review-tool-prose-budget.test.ts +121 -0
  259. package/tests/run-test-suite.test.ts +122 -1
  260. package/tests/runtime-harness.mjs +4 -1
  261. package/tests/sensitive-path-tools.test.ts +181 -5
  262. package/tests/session-profile-append-controller-pi.test.ts +60 -31
  263. package/tests/session-profile-binding.test.ts +19 -1
  264. package/tests/session-profile-disk-reader-pi.test.ts +58 -16
  265. package/tests/session-profile-v1-compat.test.ts +35 -1
  266. package/tests/shell-bar.test.ts +186 -42
  267. package/tests/shell-panel.test.ts +50 -22
  268. package/tests/shell-sidebar-fullscreen.test.ts +5 -5
  269. package/tests/shell-sidebar-layout.test.ts +294 -23
  270. package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
  271. package/tests/shell-surface-transparent.test.ts +89 -0
  272. package/tests/shell-todo.test.ts +12 -0
  273. package/tests/skill-registry.test.ts +838 -5
  274. package/tests/startup-banner.test.ts +152 -1
  275. package/tests/startup-home-repo.test.ts +2 -0
  276. package/tests/support/review-coordinator-runtime.ts +69 -0
  277. package/tests/task-size-routing-contract.test.ts +5 -3
  278. package/tests/verifier-admission.test.ts +49 -0
  279. package/tests/verify-first-launch-contract.test.ts +78 -3
  280. package/tests/visual-customization-policy.test.ts +39 -6
  281. package/tests/visual-customize-view.test.ts +573 -9
  282. package/tests/visual-layout-preview.test.ts +15 -1
  283. package/tests/visual-profiles.test.ts +11 -0
  284. package/tests/voice-worker.test.ts +73 -2
  285. package/tests/windows-session-transport.test.ts +126 -0
  286. package/tests/work-continuity-contract.test.ts +28 -0
  287. package/tests/writer-feature-document-admission.test.ts +92 -0
  288. package/tests/yolo-customize.test.ts +27 -4
  289. package/tests/yolo-mode.test.ts +23 -18
  290. package/tests/yolo-session-policy.test.ts +270 -1
@@ -1,6 +1,9 @@
1
1
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import { ScrollView, Text, truncateToWidth, type Component, type TUI } from "@earendil-works/pi-tui";
3
3
  import { appendSystemPromptOnce } from "../lib/append-system-prompt.ts";
4
+ import { gentlePiConfigHome } from "../lib/agent-home.ts";
5
+ import type { OrchestratorMode } from "../lib/agent-profiles.ts";
6
+ import { resolveOrchestratorMode } from "../lib/orchestrator-mode-policy.ts";
4
7
  import { NativePointerRegion } from "../lib/native-pointer-region.ts";
5
8
  import { panelHeaderRow } from "../lib/shell-card.ts";
6
9
  import { renderPanelRow } from "../lib/shell-panel.ts";
@@ -107,6 +110,19 @@ function sessionKey(ctx: ExtensionContext): string {
107
110
  return ctx.sessionManager.getSessionId() ?? "";
108
111
  }
109
112
 
113
+ /**
114
+ * The session's orchestrator mode, so the rules block tells a full delegation
115
+ * session to delegate a small task instead of doing it. Never throws: a profile
116
+ * store that cannot answer leaves today's organic block.
117
+ */
118
+ function todoOrchestratorMode(ctx: ExtensionContext, env: NodeJS.ProcessEnv): OrchestratorMode {
119
+ try {
120
+ return resolveOrchestratorMode({ cwd: ctx.cwd, configHome: gentlePiConfigHome(env), sessionId: ctx.sessionManager?.getSessionId?.(), env }).mode;
121
+ } catch {
122
+ return "organic";
123
+ }
124
+ }
125
+
110
126
  export default function gentleTodo(pi: ExtensionAPI, env: NodeJS.ProcessEnv = process.env): void {
111
127
  if (!todoEnabled(env)) return;
112
128
  const sessions = new Map<string, TodoSession>();
@@ -176,7 +192,7 @@ export default function gentleTodo(pi: ExtensionAPI, env: NodeJS.ProcessEnv = pr
176
192
  foot = lines.slice(-1);
177
193
  } else {
178
194
  headerRow = 0;
179
- const section = renderTodoSection(current.state, theme, width, { collapsed: current.collapsed, staleTurns: stale, hovered });
195
+ const section = renderTodoSection(current.state, theme, width, { collapsed: current.collapsed, staleTurns: stale, hovered, ...(collapseKey ? { collapseKey } : {}) });
180
196
  head = section.header ? [section.header] : [];
181
197
  body = section.body;
182
198
  foot = [];
@@ -367,7 +383,7 @@ export default function gentleTodo(pi: ExtensionAPI, env: NodeJS.ProcessEnv = pr
367
383
  // gentle-shell#1485: pi-claude-bridge drops a handler-returned
368
384
  // systemPrompt, so the rules block goes through appendSystemPrompt. It is
369
385
  // the same bytes on every turn, list or no list (gentle-shell#1662).
370
- appendSystemPromptOnce(event.systemPromptOptions, todoPromptBlock());
386
+ appendSystemPromptOnce(event.systemPromptOptions, todoPromptBlock(todoOrchestratorMode(ctx, env)));
371
387
  return undefined;
372
388
  });
373
389
 
@@ -0,0 +1,48 @@
1
+ import type { AssistantMessage } from "@earendil-works/pi-ai";
2
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
+
4
+ function isAssistantMessage(message: unknown): message is AssistantMessage {
5
+ if (!message || typeof message !== "object") return false;
6
+ const role = (message as { role?: unknown }).role;
7
+ return role === "assistant";
8
+ }
9
+
10
+ export default function (pi: ExtensionAPI) {
11
+ let agentStartMs: number | null = null;
12
+
13
+ pi.on("agent_start", () => {
14
+ agentStartMs = Date.now();
15
+ });
16
+
17
+ pi.on("agent_end", (event, ctx) => {
18
+ const startMs = agentStartMs;
19
+ // Consume every end, even headless ones, so a repeated end cannot reuse it.
20
+ agentStartMs = null;
21
+ if (!ctx.hasUI || startMs === null) return;
22
+
23
+ const elapsedMs = Date.now() - startMs;
24
+ if (elapsedMs <= 0) return;
25
+
26
+ let input = 0;
27
+ let output = 0;
28
+ let cacheRead = 0;
29
+ let cacheWrite = 0;
30
+ let totalTokens = 0;
31
+
32
+ for (const message of event.messages) {
33
+ if (!isAssistantMessage(message)) continue;
34
+ input += message.usage.input || 0;
35
+ output += message.usage.output || 0;
36
+ cacheRead += message.usage.cacheRead || 0;
37
+ cacheWrite += message.usage.cacheWrite || 0;
38
+ totalTokens += message.usage.totalTokens || 0;
39
+ }
40
+
41
+ if (output <= 0) return;
42
+
43
+ const elapsedSeconds = elapsedMs / 1000;
44
+ const tokensPerSecond = output / elapsedSeconds;
45
+ const message = `TPS ${tokensPerSecond.toFixed(1)} tok/s. out ${output.toLocaleString()}, in ${input.toLocaleString()}, cache r/w ${cacheRead.toLocaleString()}/${cacheWrite.toLocaleString()}, total ${totalTokens.toLocaleString()}, ${elapsedSeconds.toFixed(1)}s`;
46
+ ctx.ui.notify(message, "info");
47
+ });
48
+ }
@@ -8,7 +8,7 @@ import {
8
8
  createWriteTool,
9
9
  keyHint,
10
10
  } from "@earendil-works/pi-coding-agent";
11
- import { Text, type Component } from "@earendil-works/pi-tui";
11
+ import { Text, visibleWidth, type Component } from "@earendil-works/pi-tui";
12
12
  import { homedir } from "node:os";
13
13
  import { isAbsolute } from "node:path";
14
14
  import { resolveGentleAiDevBinaryOverride, type GentleAiDevBinaryOverride } from "../lib/gentle-ai-binary.ts";
@@ -485,7 +485,31 @@ interface ToolRenderContextLike {
485
485
  durationMs?: number;
486
486
  }
487
487
 
488
- function formatToolCall(toolName: QuietToolName, args: Record<string, unknown>, theme: ThemeLike): string {
488
+ // Columns of the card's top rule around the call: `╭─ <glyph> ` before it and ` ─ … ╮` after.
489
+ const CARD_TOP_CHROME = 8;
490
+ // A collapsed minimal bash card says what the command does in one row: its
491
+ // first line without leading `cd <dir> &&` hops, and how many lines fold behind.
492
+ function bashSummary(command: string, width: number): string {
493
+ const lines = command.replace(/\s+$/, "").split("\n");
494
+ const first = lines.findIndex((line) => line.trim() !== "");
495
+ const line = lines[first] ?? "";
496
+ const action = line.replace(/^\s*(?:cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*&&\s*)+/, "").trim() || line.trim();
497
+ const folded = lines.length - first - 1;
498
+ const suffix = folded > 0 ? ` … +${folded} line${folded === 1 ? "" : "s"}` : "";
499
+ const room = Math.max(1, width - visibleWidth(suffix));
500
+ return `${clipPlain(action, room)}${suffix}`;
501
+ }
502
+
503
+ // Clips plain text to `width` columns with a trailing ellipsis and no SGR reset,
504
+ // so the caller's title style still covers the suffix that follows.
505
+ function clipPlain(text: string, width: number): string {
506
+ if (visibleWidth(text) <= width) return text;
507
+ let clipped = Array.from(text);
508
+ while (clipped.length > 0 && visibleWidth(clipped.join("")) > width - 1) clipped = clipped.slice(0, -1);
509
+ return `${clipped.join("")}…`;
510
+ }
511
+
512
+ function formatToolCall(toolName: QuietToolName, args: Record<string, unknown>, theme: ThemeLike, summary?: { width: number }): string {
489
513
  switch (toolName) {
490
514
  case "read": {
491
515
  const path = safeText(shortenPath(args.path) || "...");
@@ -495,7 +519,9 @@ function formatToolCall(toolName: QuietToolName, args: Record<string, unknown>,
495
519
  const command = safeText(asString(args.command, "..."));
496
520
  const timeout = typeof args.timeout === "number" ? theme.fg("muted", ` (timeout ${args.timeout}s)`) : "";
497
521
  // Minimal cards title bash with the bare command; the card glyph supplies the `$` prompt.
498
- const title = cardContent() === CARD_CONTENT.MINIMAL ? command : `bash $ ${command}`;
522
+ // Collapsed, they keep it to one summary row; expanding shows every line.
523
+ const title = cardContent() !== CARD_CONTENT.MINIMAL ? `bash $ ${command}`
524
+ : summary ? bashSummary(command, Math.max(1, summary.width - visibleWidth(timeout))) : command;
499
525
  return `${theme.fg("toolTitle", theme.bold(title))}${timeout}`;
500
526
  }
501
527
  case "grep": {
@@ -599,14 +625,14 @@ class ToolCardRows {
599
625
 
600
626
  class ToolCardTop implements Component {
601
627
  private readonly rows = new ToolCardRows();
602
- private readonly header: () => string;
628
+ private readonly header: (inner: number) => string;
603
629
  private readonly glyph: string;
604
630
  private readonly tone: ToolTone;
605
631
  private readonly theme: CardTheme;
606
632
  private readonly hint: string | undefined;
607
633
  private readonly row: CardRowContext | undefined;
608
634
 
609
- constructor(header: () => string, tone: ToolTone, theme: CardTheme, glyph: string, hint?: string, row?: CardRowContext) {
635
+ constructor(header: (inner: number) => string, tone: ToolTone, theme: CardTheme, glyph: string, hint?: string, row?: CardRowContext) {
610
636
  this.header = header;
611
637
  this.glyph = glyph;
612
638
  this.tone = tone;
@@ -621,7 +647,7 @@ class ToolCardTop implements Component {
621
647
  if (target === 0) return [];
622
648
  const running = this.row !== undefined && cardAwaitingResult(this.row);
623
649
  return this.rows.render(target, running, () => floatRows(this.tone, this.theme, target, (inner) => ({
624
- head: cardTopRows({ title: this.header(), glyph: this.glyph, body: [], tone: this.tone }, this.theme, inner, this.hint),
650
+ head: cardTopRows({ title: this.header(inner), glyph: this.glyph, body: [], tone: this.tone }, this.theme, inner, this.hint),
625
651
  body: running ? [cardRunningLine(this.tone, this.theme, inner)] : undefined,
626
652
  bottom: running ? cardBottom(this.tone, this.theme, inner) : undefined,
627
653
  })));
@@ -749,9 +775,13 @@ export function createQuietToolRenderer(
749
775
  }
750
776
  const tone = toolTone(renderContext.isPartial !== false, renderContext.isError === true);
751
777
  // Same place and wording as the Gentle AI card: the expand key rides the top rule once the call finished.
752
- const finished = renderContext.isPartial === false && (renderContext.executionStarted === true || renderContext.isError === true);
778
+ // Pi flips isPartial to false only with a result; a card rebuilt from the
779
+ // session history has one even though Pi never saw its execution start.
780
+ const finished = renderContext.isPartial === false;
753
781
  const hint = finished ? stripAnsi(keyHint("app.tools.expand", renderContext.expanded === true ? "to collapse" : "to expand")) : undefined;
754
- return new ToolCardTop(() => formatToolCall(toolName, callArgs, theme), tone, theme, TOOL_GLYPH[toolName], hint, renderContext);
782
+ // Minimal collapsed cards fit the call in the top rule; the room leaves the rule's glyph, edges and hint.
783
+ const summary = renderContext.expanded === true ? undefined : (inner: number) => ({ width: inner - CARD_TOP_CHROME - (hint ? visibleWidth(hint) + 2 : 0) });
784
+ return new ToolCardTop((inner) => formatToolCall(toolName, callArgs, theme, summary?.(inner)), tone, theme, TOOL_GLYPH[toolName], hint, renderContext);
755
785
  },
756
786
  /** Builds the card component for this render pass; collapsed cards delegate to the wrapped-line cache keyed by the tool result object. */
757
787
  renderResult(result, options, theme, context) {
@@ -30,7 +30,7 @@ const WATCH_DEBOUNCE_MS = 500;
30
30
  // poll is the floor that keeps regeneration working when the OS cannot
31
31
  // deliver change events. The fingerprint gate makes a redundant poll cheap.
32
32
  const WATCH_FALLBACK_POLL_MS = 2_000;
33
- const REGISTRY_SCHEMA_VERSION = 7;
33
+ const REGISTRY_SCHEMA_VERSION = 9;
34
34
  const NO_SKILL_REGISTRY_FLAG = "no-skill-registry";
35
35
  const NO_SKILL_REGISTRY_ENV = "GENTLE_PI_NO_SKILL_REGISTRY";
36
36
  const LEGACY_PROJECT_REGISTRY_REL_PATH = ".pi/extensions/skill-registry.ts";
@@ -60,6 +60,23 @@ interface SkillEntry {
60
60
  scope?: string;
61
61
  }
62
62
 
63
+ // Structural mirror of pi's runtime-resolved skill record. Kept local on
64
+ // purpose: this seam must not import pi internals.
65
+ export interface ResolvedSkill {
66
+ name: string;
67
+ description: string;
68
+ filePath: string;
69
+ baseDir?: string;
70
+ disableModelInvocation?: boolean;
71
+ sourceInfo?: {
72
+ path?: string;
73
+ source?: string;
74
+ scope?: "user" | "project" | "temporary";
75
+ origin?: "package" | "top-level";
76
+ baseDir?: string;
77
+ };
78
+ }
79
+
63
80
  function userSkillDirs(): string[] {
64
81
  const home = homedir();
65
82
  return [
@@ -274,12 +291,99 @@ function dedupeBySkillName(entries: SkillEntry[], cwd: string): SkillEntry[] {
274
291
  }
275
292
  const out: SkillEntry[] = [];
276
293
  for (const [, list] of buckets) {
277
- const projectScoped = list.find((e) => comparablePath(e.path).startsWith(projectPrefix));
294
+ const projectScoped = list.find((e) =>
295
+ e.scope?.startsWith("project") ||
296
+ (e.scope === undefined && comparablePath(e.path).startsWith(projectPrefix)),
297
+ );
278
298
  out.push(projectScoped ?? list[0]);
279
299
  }
280
300
  return out.sort((a, b) => a.name.localeCompare(b.name));
281
301
  }
282
302
 
303
+ function resolvedScopeLabel(skill: ResolvedSkill): string {
304
+ const scope = skill.sourceInfo?.scope === "project" ? "project" : "user";
305
+ return skill.sourceInfo?.origin === "package" ? `${scope} · package` : scope;
306
+ }
307
+
308
+ // Runtime capture state: pi-resolved skills from the latest before_agent_start
309
+ // event, trimmed to only the fields the registry seam consumes. Never retain
310
+ // the full runtime event objects.
311
+ let lastResolvedSkills: ResolvedSkill[] = [];
312
+
313
+ function trimResolvedSkill(skill: ResolvedSkill): ResolvedSkill {
314
+ const trimmed: ResolvedSkill = {
315
+ name: skill.name,
316
+ description: skill.description,
317
+ filePath: skill.filePath,
318
+ };
319
+ if (skill.disableModelInvocation === true) trimmed.disableModelInvocation = true;
320
+ if (skill.sourceInfo) {
321
+ trimmed.sourceInfo = {
322
+ scope: skill.sourceInfo.scope,
323
+ origin: skill.sourceInfo.origin,
324
+ };
325
+ }
326
+ return trimmed;
327
+ }
328
+
329
+ function isResolvedSourceInfo(value: unknown): value is NonNullable<ResolvedSkill["sourceInfo"]> {
330
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
331
+ const sourceInfo = value as NonNullable<ResolvedSkill["sourceInfo"]>;
332
+ return (
333
+ (sourceInfo.scope === undefined ||
334
+ sourceInfo.scope === "user" ||
335
+ sourceInfo.scope === "project" ||
336
+ sourceInfo.scope === "temporary") &&
337
+ (sourceInfo.origin === undefined || sourceInfo.origin === "package" || sourceInfo.origin === "top-level")
338
+ );
339
+ }
340
+
341
+ function isResolvedSkill(value: unknown): value is ResolvedSkill {
342
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
343
+ const skill = value as Partial<ResolvedSkill>;
344
+ return (
345
+ typeof skill.name === "string" &&
346
+ typeof skill.description === "string" &&
347
+ typeof skill.filePath === "string" &&
348
+ (skill.disableModelInvocation === undefined || typeof skill.disableModelInvocation === "boolean") &&
349
+ (skill.sourceInfo === undefined || isResolvedSourceInfo(skill.sourceInfo))
350
+ );
351
+ }
352
+
353
+ async function applyResolvedSkillsUpdate(cwd: string, skills: ResolvedSkill[]): Promise<RegenResult> {
354
+ lastResolvedSkills = skills.map(trimResolvedSkill);
355
+ return regenerateRegistry(cwd, false, lastResolvedSkills);
356
+ }
357
+
358
+ function toResolvedEntry(skill: ResolvedSkill, cwd: string): SkillEntry | undefined {
359
+ // cwd is reserved: pi-resolved paths are already absolute, but the seam stays
360
+ // symmetric with the loose scan for future scoping needs.
361
+ void cwd;
362
+ if (skill.disableModelInvocation === true) return undefined;
363
+ if (isExcluded(skill.name)) return undefined;
364
+ return {
365
+ name: skill.name,
366
+ path: skill.filePath,
367
+ description: normalizeSkillDescription(skill.description),
368
+ scope: resolvedScopeLabel(skill),
369
+ };
370
+ }
371
+
372
+ function mergeResolvedWithLoose(
373
+ resolved: SkillEntry[],
374
+ loose: SkillEntry[],
375
+ cwd: string,
376
+ suppressedPaths: readonly string[] = [],
377
+ ): SkillEntry[] {
378
+ const resolvedPaths = new Set(resolved.map((entry) => comparablePath(entry.path)));
379
+ // Every runtime-resolved path was filtered by Pi's own rules, so a skill Pi
380
+ // hides (disableModelInvocation or an excluded name) must never come back
381
+ // as an active row through a loose root that still holds its SKILL.md.
382
+ for (const path of suppressedPaths) resolvedPaths.add(comparablePath(path));
383
+ const filteredLoose = loose.filter((entry) => !resolvedPaths.has(comparablePath(entry.path)));
384
+ return dedupeBySkillName([...resolved, ...filteredLoose], cwd);
385
+ }
386
+
283
387
  function scopeForPath(cwd: string, path: string): string {
284
388
  const cleanCwd = comparablePath(cwd);
285
389
  const projectPrefix = cleanCwd.endsWith(sep) ? cleanCwd : `${cleanCwd}${sep}`;
@@ -300,8 +404,19 @@ function isCacheFile(value: unknown): value is { fingerprint: string } {
300
404
  );
301
405
  }
302
406
 
303
- async function fingerprint(files: string[]): Promise<string> {
304
- const lines: string[] = [`schema:${REGISTRY_SCHEMA_VERSION}`];
407
+ async function fingerprint(files: string[], resolved: ResolvedSkill[] = []): Promise<string> {
408
+ const resolvedLines = resolved.map((skill) =>
409
+ JSON.stringify([
410
+ "resolved",
411
+ skill.name,
412
+ normalizeSkillDescription(skill.description),
413
+ skill.filePath,
414
+ skill.disableModelInvocation === true,
415
+ skill.sourceInfo?.scope ?? "",
416
+ skill.sourceInfo?.origin ?? "",
417
+ ]),
418
+ );
419
+ const fileLines: string[] = [];
305
420
  for (const file of files) {
306
421
  try {
307
422
  const info = await stat(file);
@@ -309,19 +424,20 @@ async function fingerprint(files: string[]): Promise<string> {
309
424
  try {
310
425
  contentHash = createHash("sha1").update(await readFile(file)).digest("hex");
311
426
  } catch {
312
- lines.push(`${file}:unreadable`);
427
+ fileLines.push(`${file}:unreadable`);
313
428
  continue;
314
429
  }
315
- lines.push(`${file}:${info.mtimeMs}:${info.size}:${contentHash}`);
430
+ fileLines.push(`${file}:${info.mtimeMs}:${info.size}:${contentHash}`);
316
431
  } catch {
317
- lines.push(`${file}:missing`);
432
+ fileLines.push(`${file}:missing`);
318
433
  }
319
434
  }
320
- lines.sort();
321
- return createHash("sha1").update(lines.join("\n")).digest("hex");
435
+ return createHash("sha1")
436
+ .update([`schema:${REGISTRY_SCHEMA_VERSION}`, ...resolvedLines, ...fileLines.sort()].join("\n"))
437
+ .digest("hex");
322
438
  }
323
439
 
324
- function renderRegistry(cwd: string, sources: string[], entries: SkillEntry[]): string {
440
+ function renderRegistry(cwd: string, sources: string[], entries: SkillEntry[], resolvedCount = 0): string {
325
441
  const projectName = basename(cwd);
326
442
  const today = new Date().toISOString().slice(0, 10);
327
443
  const lines: string[] = [];
@@ -333,6 +449,9 @@ function renderRegistry(cwd: string, sources: string[], entries: SkillEntry[]):
333
449
  lines.push("");
334
450
  lines.push("## Sources scanned");
335
451
  lines.push("");
452
+ if (resolvedCount > 0) {
453
+ lines.push(`- Pi-resolved runtime authority (before_agent_start.systemPromptOptions.skills): ${resolvedCount} skill(s)`);
454
+ }
336
455
  for (const src of sources) {
337
456
  lines.push(`- ${src}`);
338
457
  }
@@ -409,7 +528,9 @@ export async function automaticWriteWarning(
409
528
  });
410
529
  tracked = stdout.split("\0").filter(Boolean);
411
530
  } catch (error) {
412
- const failure = error as { code?: number; stderr?: string };
531
+ const failure = error as { code?: number | string; stderr?: string };
532
+ // A missing cwd cannot hold tracked targets, but git cannot even spawn there.
533
+ if (failure.code === "ENOENT" && !(await pathExists(cwd))) return undefined;
413
534
  if (failure.code === 128 && failure.stderr?.startsWith("fatal: not a git repository") && await hasNoGitMetadata(cwd)) return undefined;
414
535
  throw new Error(`Cannot verify Git tracking for ${targets.join(", ")}; automatic writes skipped. Resolve Git detection, or deliberately run /skill-registry:refresh.`);
415
536
  }
@@ -494,6 +615,7 @@ async function quarantineLegacyProjectRegistry(cwd: string, notifyWarning: (mess
494
615
  async function regenerateRegistry(
495
616
  cwd: string,
496
617
  force: boolean,
618
+ resolved: ResolvedSkill[] = [],
497
619
  intentional = false,
498
620
  ): Promise<RegenResult> {
499
621
  const existingDirs = await uniqueExistingDirs([
@@ -506,7 +628,7 @@ async function regenerateRegistry(
506
628
  }
507
629
  const cachePath = join(cwd, CACHE_REL_PATH);
508
630
  const registryPath = join(cwd, REGISTRY_REL_PATH);
509
- const fp = await fingerprint(files);
631
+ const fp = await fingerprint(files, resolved);
510
632
  let cached: string | undefined;
511
633
  if (await pathExists(cachePath)) {
512
634
  try {
@@ -528,12 +650,22 @@ async function regenerateRegistry(
528
650
  const entry = await loadSkill(file);
529
651
  if (entry) entries.push(entry);
530
652
  }
531
- const deduped = dedupeBySkillName(entries, cwd);
653
+ const resolvedEntries: SkillEntry[] = [];
654
+ for (const skill of resolved) {
655
+ const entry = toResolvedEntry(skill, cwd);
656
+ if (entry) resolvedEntries.push(entry);
657
+ }
658
+ const deduped = mergeResolvedWithLoose(
659
+ resolvedEntries,
660
+ entries,
661
+ cwd,
662
+ resolved.map((skill) => skill.filePath),
663
+ );
532
664
  const sources = existingDirs.map((d) => {
533
665
  const rel = relative(cwd, d);
534
666
  return rel.startsWith("..") ? d : rel || ".";
535
667
  });
536
- const md = renderRegistry(cwd, sources, deduped);
668
+ const md = renderRegistry(cwd, sources, deduped, resolvedEntries.length);
537
669
  try {
538
670
  await mkdir(join(cwd, ".atl"), { recursive: true });
539
671
  await writeFile(registryPath, md);
@@ -667,7 +799,7 @@ async function startSkillRegistryWatcher(
667
799
  void (async () => {
668
800
  try {
669
801
  await pendingStartups.get(cwd);
670
- const result = await regenerateRegistry(cwd, false);
802
+ const result = await regenerateRegistry(cwd, false, lastResolvedSkills);
671
803
  if (result.warning) {
672
804
  if (result.warning !== lastWarning) notify(result.warning, "warning");
673
805
  lastWarning = result.warning;
@@ -711,11 +843,14 @@ export const __testing = {
711
843
  isStorageUnavailableError,
712
844
  uniqueExistingDirs,
713
845
  dedupeBySkillName,
846
+ toResolvedEntry,
847
+ mergeResolvedWithLoose,
714
848
  scopeForPath,
715
849
  normalizeSkillDescription,
716
850
  parseFrontmatter,
717
851
  renderRegistry,
718
852
  regenerateRegistry,
853
+ applyResolvedSkillsUpdate,
719
854
  ensureAtlIgnored,
720
855
  shouldSkipSkillRegistryStartup,
721
856
  shouldSkipDuplicateExtensionLoad,
@@ -740,6 +875,7 @@ export default function (pi: ExtensionAPI) {
740
875
  pi.on("session_shutdown", () => {
741
876
  startupGeneration += 1;
742
877
  closeSkillRegistryWatchers();
878
+ lastResolvedSkills = [];
743
879
  });
744
880
 
745
881
  pi.registerFlag(NO_SKILL_REGISTRY_FLAG, {
@@ -762,7 +898,8 @@ export default function (pi: ExtensionAPI) {
762
898
  const ignoreWarning = await ensureAtlIgnored(cwd);
763
899
  if (ignoreWarning) notifyWarning(ignoreWarning);
764
900
  const quarantinedLegacy = await quarantineLegacyProjectRegistry(cwd, notifyWarning);
765
- const result = await regenerateRegistry(cwd, quarantinedLegacy);
901
+ // A capture that already arrived is newer authority than this scan.
902
+ const result = await regenerateRegistry(cwd, quarantinedLegacy, lastResolvedSkills);
766
903
  if (result.warning) notifyWarning(result.warning);
767
904
  if (result.regenerated && ctx.hasUI) {
768
905
  ctx.ui.notify(
@@ -781,7 +918,7 @@ export default function (pi: ExtensionAPI) {
781
918
  if (generation !== startupGeneration) return;
782
919
  void (async () => {
783
920
  try {
784
- const result = await regenerateRegistry(cwd, true);
921
+ const result = await regenerateRegistry(cwd, true, lastResolvedSkills);
785
922
  if (result.warning) notifyWarning(result.warning);
786
923
  } catch (error) {
787
924
  notifyWarning(`Skill registry refresh failed: ${error instanceof Error ? error.message : String(error)}`);
@@ -818,12 +955,32 @@ export default function (pi: ExtensionAPI) {
818
955
  }
819
956
  });
820
957
 
958
+ pi.on("before_agent_start", async (event, ctx) => {
959
+ if (shouldSkipSkillRegistryStartup(pi)) return;
960
+ const skills = event.systemPromptOptions?.skills;
961
+ if (!Array.isArray(skills) || !skills.every(isResolvedSkill)) return;
962
+ try {
963
+ // The startup scan this session scheduled must land before this newer
964
+ // capture, so an older loose-only scan never overwrites runtime authority.
965
+ await pendingStartups.get(ctx.cwd);
966
+ const result = await applyResolvedSkillsUpdate(ctx.cwd, skills);
967
+ if (result.regenerated && ctx.hasUI) {
968
+ ctx.ui.notify(
969
+ `Skill registry refreshed (${result.skillCount} skills)`,
970
+ "info",
971
+ );
972
+ }
973
+ } catch {
974
+ // Keep the runtime capture best-effort; a failed refresh must never break the agent turn.
975
+ }
976
+ });
977
+
821
978
  pi.registerCommand("skill-registry:refresh", {
822
979
  description: "Regenerate .atl/skill-registry.md from local skill sources.",
823
980
  handler: async (_args, ctx) => {
824
981
  try {
825
982
  await ensureAtlIgnored(ctx.cwd, true);
826
- const result = await regenerateRegistry(ctx.cwd, true, true);
983
+ const result = await regenerateRegistry(ctx.cwd, true, lastResolvedSkills, true);
827
984
  if (result.reason === "storage-unavailable") {
828
985
  ctx.ui.notify(result.warning ?? "Skill registry is unavailable.", "warning");
829
986
  return;
@@ -4,7 +4,7 @@ import { truncateToWidth } from "@earendil-works/pi-tui";
4
4
  import { execFile } from "node:child_process";
5
5
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
6
6
  import { join } from "node:path";
7
- import { resolveAnimationPolicy } from "../lib/animation-policy.ts";
7
+ import { resolveAnimationPolicy, type AnimationPolicy } from "../lib/animation-policy.ts";
8
8
  import { PI_SUBCOMMANDS } from "../lib/gentle-shell-launcher.ts";
9
9
  import { gentlePiConfigHome } from "../lib/agent-home.ts";
10
10
 
@@ -362,6 +362,23 @@ type LetterStroke = { orderMap: Map<string, number>; maxOrder: number };
362
362
 
363
363
  const WRITING_START_TICK = 6;
364
364
  const FALLBACK_LETTER_TICKS = 8;
365
+ // Every rose pulse step repaints every rose cell, which drives the TUI diff to
366
+ // redraw the whole header region and teleport the hardware cursor; on fast
367
+ // terminals (ghostty) that churn reads as flicker/ghosting (ghostty#12685).
368
+ // The resolved animation policy owns the step, so the cadence table in
369
+ // docs/readme-reference.md stays authoritative: quality paints every 25ms and
370
+ // takes the coarser ~100ms wave, while performance already paints every 250ms
371
+ // and keeps the merge-base 2-tick step instead of freezing the wave.
372
+ const ROSE_PULSE_TICKS: Record<AnimationPolicy, number> = {
373
+ quality: 4,
374
+ performance: 2,
375
+ potato: 2,
376
+ };
377
+
378
+ /** Ticks per rose pulse step under the resolved animation policy. */
379
+ export function rosePulseTicks(policy: AnimationPolicy): number {
380
+ return ROSE_PULSE_TICKS[policy];
381
+ }
365
382
 
366
383
  const LETTER_STROKES: Array<LetterStroke | null> = LETTER_SPANS.map(() => null);
367
384
  const LETTER_TICKS: number[] = LETTER_SPANS.map(() => FALLBACK_LETTER_TICKS);
@@ -662,6 +679,13 @@ export default function (pi: ExtensionAPI) {
662
679
  // CLI subcommands such as `pi update` or `pi install` skip the animated intro.
663
680
  if (isPiCliSubcommandInvocation(process.argv)) return;
664
681
 
682
+ // /reload re-fires session_start with reason "reload". The splash is a
683
+ // first-start experience, so the intro must not run again; but the
684
+ // disposeHeader() above already dropped the previous header, and banner
685
+ // changes are documented to apply on the next session or /reload. Returning
686
+ // early here would leave the editor without a header, so a reload repaints
687
+ // the complete static artwork instead (see the header factory below).
688
+ const reload = (_event as { reason?: string })?.reason === "reload";
665
689
  if (currentIntroMode() === "skip") return;
666
690
 
667
691
  // Pi has already started its renderer. Let setHeader schedule the paint;
@@ -767,8 +791,11 @@ export default function (pi: ExtensionAPI) {
767
791
  refreshStats = () => tui.requestRender();
768
792
  // Capture once: a command changes the live prompt, not this intro.
769
793
  const animationPolicy = resolveAnimationPolicy().policy;
794
+ const rosePulse = rosePulseTicks(animationPolicy);
770
795
  const animStart = Date.now();
771
- if (animationPolicy === "potato") {
796
+ if (reload || animationPolicy === "potato") {
797
+ // Completed static artwork, no animation interval: potato asks for no
798
+ // periodic animation, and a /reload repaint has no intro to replay.
772
799
  tick = Number.MAX_SAFE_INTEGER;
773
800
  state.timer = null;
774
801
  } else {
@@ -821,7 +848,7 @@ export default function (pi: ExtensionAPI) {
821
848
  tick >= flashStartTick
822
849
  ? Math.max(0, 1 - (tick - flashStartTick) / 12)
823
850
  : 0;
824
- const frame = Math.floor(tick / 2);
851
+ const frame = Math.floor(tick / rosePulse);
825
852
 
826
853
  const sideBySideMinWidth = roseBase.width + 3 + logoBase.width + 4;
827
854
  const horizontal =
@@ -26,7 +26,7 @@ import { existsSync, readFileSync, unlinkSync } from "node:fs";
26
26
  import { join } from "node:path";
27
27
  import { isValidProfileName, profileRoleEntries, profilesFilePath, readProfilesFileResult, writeJsonFileAtomicallySync } from "./agent-profiles.ts";
28
28
  import type { AgentModelConfig } from "./model-routing-authority.ts";
29
- import { resolveSessionWorktreeWithGit, type WorktreeIdentity, type WorktreeResolver } from "./session-worktree-registry.ts";
29
+ import { resolveSessionWorktree, type WorktreeIdentity, type WorktreeResolver } from "./session-worktree-registry.ts";
30
30
 
31
31
  export const PROFILE_PIN_KIND = "gentle-pi.agent_model_profile_pin";
32
32
  export const PROFILE_PIN_VERSION = 1;
@@ -178,7 +178,7 @@ export function readProfilePin(path: string): string | undefined {
178
178
  return result.status === "valid" ? result.profile : undefined;
179
179
  }
180
180
 
181
- let profilePinWorktreeResolver: WorktreeResolver = resolveSessionWorktreeWithGit;
181
+ let profilePinWorktreeResolver: WorktreeResolver = resolveSessionWorktree;
182
182
 
183
183
  /**
184
184
  * Test seam, mirroring the other injectable seams in `lib/`: the `/gentle:profiles`
@@ -187,7 +187,7 @@ let profilePinWorktreeResolver: WorktreeResolver = resolveSessionWorktreeWithGit
187
187
  * passes its own resolver instead, so it needs no seam.
188
188
  */
189
189
  export function setProfilePinWorktreeResolverForTesting(resolver?: WorktreeResolver): void {
190
- profilePinWorktreeResolver = resolver ?? resolveSessionWorktreeWithGit;
190
+ profilePinWorktreeResolver = resolver ?? resolveSessionWorktree;
191
191
  }
192
192
 
193
193
  function gentlePiWorktreeIdentity(