@oh-my-pi/pi-coding-agent 13.2.0 → 13.3.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 (243) hide show
  1. package/CHANGELOG.md +54 -1
  2. package/package.json +7 -7
  3. package/scripts/format-prompts.ts +33 -14
  4. package/scripts/generate-docs-index.ts +2 -2
  5. package/src/capability/index.ts +1 -2
  6. package/src/cli/args.ts +3 -3
  7. package/src/cli/config-cli.ts +1 -1
  8. package/src/cli/file-processor.ts +1 -2
  9. package/src/cli/grep-cli.ts +1 -1
  10. package/src/cli/jupyter-cli.ts +1 -1
  11. package/src/cli/plugin-cli.ts +1 -1
  12. package/src/cli/setup-cli.ts +1 -1
  13. package/src/cli/shell-cli.ts +1 -1
  14. package/src/cli/ssh-cli.ts +1 -1
  15. package/src/cli/stats-cli.ts +1 -2
  16. package/src/cli/update-cli.ts +1 -2
  17. package/src/cli/web-search-cli.ts +1 -1
  18. package/src/cli.ts +1 -1
  19. package/src/commands/launch.ts +2 -1
  20. package/src/commit/agentic/agent.ts +2 -1
  21. package/src/commit/agentic/index.ts +1 -2
  22. package/src/commit/agentic/prompts/system.md +3 -3
  23. package/src/commit/agentic/tools/propose-changelog.ts +30 -19
  24. package/src/commit/changelog/generate.ts +16 -6
  25. package/src/commit/changelog/index.ts +2 -1
  26. package/src/commit/pipeline.ts +1 -2
  27. package/src/commit/prompts/reduce-system.md +1 -1
  28. package/src/commit/types.ts +10 -1
  29. package/src/config/keybindings.ts +1 -2
  30. package/src/config/model-registry.ts +1 -1
  31. package/src/config/prompt-templates.ts +14 -2
  32. package/src/config/settings-schema.ts +36 -4
  33. package/src/config/settings.ts +19 -2
  34. package/src/config.ts +1 -2
  35. package/src/debug/index.ts +1 -1
  36. package/src/debug/report-bundle.ts +1 -2
  37. package/src/debug/system-info.ts +1 -2
  38. package/src/discovery/agents.ts +2 -2
  39. package/src/discovery/builtin.ts +8 -9
  40. package/src/discovery/claude-plugins.ts +2 -2
  41. package/src/discovery/claude.ts +30 -12
  42. package/src/discovery/codex.ts +3 -3
  43. package/src/discovery/cursor.ts +5 -4
  44. package/src/discovery/gemini.ts +5 -5
  45. package/src/discovery/helpers.ts +47 -69
  46. package/src/discovery/mcp-json.ts +3 -3
  47. package/src/discovery/opencode.ts +7 -8
  48. package/src/discovery/ssh.ts +3 -3
  49. package/src/discovery/vscode.ts +3 -2
  50. package/src/discovery/windsurf.ts +3 -2
  51. package/src/exa/company.ts +1 -1
  52. package/src/exa/factory.ts +1 -6
  53. package/src/exa/linkedin.ts +1 -1
  54. package/src/exa/mcp-client.ts +19 -8
  55. package/src/exa/search.ts +2 -2
  56. package/src/exa/types.ts +3 -3
  57. package/src/exec/bash-executor.ts +2 -1
  58. package/src/exec/non-interactive-env.ts +43 -0
  59. package/src/export/custom-share.ts +1 -1
  60. package/src/export/html/index.ts +1 -2
  61. package/src/extensibility/custom-commands/loader.ts +1 -2
  62. package/src/extensibility/plugins/installer.ts +1 -2
  63. package/src/extensibility/plugins/loader.ts +1 -2
  64. package/src/extensibility/plugins/manager.ts +3 -2
  65. package/src/extensibility/skills.ts +59 -115
  66. package/src/index.ts +1 -3
  67. package/src/internal-urls/docs-index.generated.ts +1 -1
  68. package/src/ipy/executor.ts +1 -2
  69. package/src/ipy/gateway-coordinator.ts +1 -2
  70. package/src/ipy/modules.ts +1 -1
  71. package/src/ipy/runtime.ts +2 -3
  72. package/src/main.ts +1 -2
  73. package/src/mcp/config.ts +2 -2
  74. package/src/mcp/transports/stdio.ts +1 -2
  75. package/src/memories/index.ts +1 -2
  76. package/src/modes/components/extensions/extension-dashboard.ts +1 -1
  77. package/src/modes/components/extensions/inspector-panel.ts +8 -2
  78. package/src/modes/components/footer.ts +1 -2
  79. package/src/modes/components/settings-defs.ts +17 -1
  80. package/src/modes/components/status-line/segments.ts +1 -2
  81. package/src/modes/components/status-line.ts +7 -5
  82. package/src/modes/components/tool-execution.ts +3 -10
  83. package/src/modes/components/welcome.ts +1 -1
  84. package/src/modes/controllers/command-controller.ts +1 -2
  85. package/src/modes/controllers/mcp-command-controller.ts +5 -4
  86. package/src/modes/controllers/selector-controller.ts +22 -1
  87. package/src/modes/controllers/ssh-command-controller.ts +1 -1
  88. package/src/modes/interactive-mode.ts +11 -3
  89. package/src/modes/oauth-manual-input.ts +42 -0
  90. package/src/modes/shared.ts +1 -2
  91. package/src/modes/theme/theme.ts +1 -2
  92. package/src/modes/types.ts +2 -0
  93. package/src/patch/hashline.ts +19 -1
  94. package/src/patch/index.ts +1 -25
  95. package/src/prompts/agents/designer.md +7 -10
  96. package/src/prompts/agents/explore.md +15 -23
  97. package/src/prompts/agents/init.md +23 -23
  98. package/src/prompts/agents/plan.md +14 -77
  99. package/src/prompts/agents/reviewer.md +6 -5
  100. package/src/prompts/agents/task.md +13 -11
  101. package/src/prompts/compaction/branch-summary.md +3 -3
  102. package/src/prompts/compaction/compaction-short-summary.md +7 -7
  103. package/src/prompts/compaction/compaction-summary-context.md +1 -1
  104. package/src/prompts/compaction/compaction-summary.md +5 -5
  105. package/src/prompts/compaction/compaction-turn-prefix.md +3 -3
  106. package/src/prompts/compaction/compaction-update-summary.md +11 -11
  107. package/src/prompts/memories/consolidation.md +5 -5
  108. package/src/prompts/memories/read-path.md +6 -6
  109. package/src/prompts/memories/stage_one_input.md +1 -1
  110. package/src/prompts/memories/stage_one_system.md +5 -5
  111. package/src/prompts/review-request.md +4 -4
  112. package/src/prompts/system/agent-creation-architect.md +17 -17
  113. package/src/prompts/system/agent-creation-user.md +2 -2
  114. package/src/prompts/system/commit-message-system.md +2 -0
  115. package/src/prompts/system/custom-system-prompt.md +4 -4
  116. package/src/prompts/system/plan-mode-active.md +20 -20
  117. package/src/prompts/system/plan-mode-approved.md +7 -7
  118. package/src/prompts/system/plan-mode-reference.md +2 -2
  119. package/src/prompts/system/plan-mode-subagent.md +8 -8
  120. package/src/prompts/system/subagent-submit-reminder.md +5 -5
  121. package/src/prompts/system/subagent-system-prompt.md +29 -22
  122. package/src/prompts/system/subagent-user-prompt.md +7 -3
  123. package/src/prompts/system/summarization-system.md +1 -1
  124. package/src/prompts/system/system-prompt.md +214 -226
  125. package/src/prompts/system/title-system.md +2 -2
  126. package/src/prompts/system/ttsr-interrupt.md +1 -1
  127. package/src/prompts/system/web-search.md +16 -16
  128. package/src/prompts/tools/ask.md +1 -3
  129. package/src/prompts/tools/await.md +2 -4
  130. package/src/prompts/tools/bash.md +5 -7
  131. package/src/prompts/tools/browser.md +4 -6
  132. package/src/prompts/tools/calculator.md +1 -3
  133. package/src/prompts/tools/cancel-job.md +2 -4
  134. package/src/prompts/tools/exit-plan-mode.md +7 -7
  135. package/src/prompts/tools/fetch.md +0 -2
  136. package/src/prompts/tools/find.md +3 -5
  137. package/src/prompts/tools/gemini-image.md +6 -22
  138. package/src/prompts/tools/grep.md +4 -6
  139. package/src/prompts/tools/hashline.md +56 -15
  140. package/src/prompts/tools/lsp.md +1 -3
  141. package/src/prompts/tools/patch.md +7 -9
  142. package/src/prompts/tools/python.md +10 -14
  143. package/src/prompts/tools/read.md +0 -2
  144. package/src/prompts/tools/replace.md +5 -7
  145. package/src/prompts/tools/ssh.md +3 -5
  146. package/src/prompts/tools/task-summary.md +4 -4
  147. package/src/prompts/tools/task.md +7 -9
  148. package/src/prompts/tools/todo-write.md +7 -9
  149. package/src/prompts/tools/web-search.md +3 -5
  150. package/src/prompts/tools/write.md +3 -5
  151. package/src/sdk.ts +4 -2
  152. package/src/session/agent-session.ts +10 -26
  153. package/src/session/agent-storage.ts +1 -2
  154. package/src/session/history-storage.ts +1 -2
  155. package/src/session/session-manager.ts +10 -2
  156. package/src/slash-commands/builtin-registry.ts +26 -1
  157. package/src/ssh/connection-manager.ts +11 -2
  158. package/src/ssh/sshfs-mount.ts +7 -1
  159. package/src/system-prompt.ts +29 -103
  160. package/src/task/agents.ts +1 -1
  161. package/src/task/index.ts +211 -70
  162. package/src/task/render.ts +24 -8
  163. package/src/task/types.ts +6 -1
  164. package/src/task/worktree.ts +394 -32
  165. package/src/tools/ask.ts +0 -1
  166. package/src/tools/bash-interactive.ts +2 -45
  167. package/src/tools/bash.ts +5 -5
  168. package/src/tools/browser.ts +1 -2
  169. package/src/tools/gemini-image.ts +8 -28
  170. package/src/tools/json-tree.ts +2 -1
  171. package/src/tools/python.ts +1 -1
  172. package/src/tools/read.ts +1 -2
  173. package/src/tools/submit-result.ts +22 -23
  174. package/src/utils/commit-message-generator.ts +132 -0
  175. package/src/utils/tools-manager.ts +1 -2
  176. package/src/web/scrapers/artifacthub.ts +2 -1
  177. package/src/web/scrapers/aur.ts +2 -1
  178. package/src/web/scrapers/biorxiv.ts +2 -1
  179. package/src/web/scrapers/bluesky.ts +2 -1
  180. package/src/web/scrapers/chocolatey.ts +2 -1
  181. package/src/web/scrapers/cisa-kev.ts +2 -1
  182. package/src/web/scrapers/clojars.ts +2 -1
  183. package/src/web/scrapers/coingecko.ts +2 -1
  184. package/src/web/scrapers/crates-io.ts +2 -1
  185. package/src/web/scrapers/crossref.ts +2 -1
  186. package/src/web/scrapers/discogs.ts +3 -1
  187. package/src/web/scrapers/discourse.ts +2 -1
  188. package/src/web/scrapers/dockerhub.ts +2 -1
  189. package/src/web/scrapers/fdroid.ts +2 -1
  190. package/src/web/scrapers/firefox-addons.ts +2 -1
  191. package/src/web/scrapers/flathub.ts +2 -1
  192. package/src/web/scrapers/gitlab.ts +1 -1
  193. package/src/web/scrapers/go-pkg.ts +2 -1
  194. package/src/web/scrapers/hackage.ts +2 -1
  195. package/src/web/scrapers/hackernews.ts +2 -1
  196. package/src/web/scrapers/hex.ts +2 -1
  197. package/src/web/scrapers/huggingface.ts +2 -1
  198. package/src/web/scrapers/jetbrains-marketplace.ts +2 -1
  199. package/src/web/scrapers/lemmy.ts +2 -1
  200. package/src/web/scrapers/lobsters.ts +2 -1
  201. package/src/web/scrapers/mastodon.ts +2 -1
  202. package/src/web/scrapers/maven.ts +2 -1
  203. package/src/web/scrapers/mdn.ts +2 -1
  204. package/src/web/scrapers/metacpan.ts +2 -1
  205. package/src/web/scrapers/musicbrainz.ts +3 -1
  206. package/src/web/scrapers/npm.ts +2 -1
  207. package/src/web/scrapers/nuget.ts +2 -1
  208. package/src/web/scrapers/nvd.ts +2 -1
  209. package/src/web/scrapers/ollama.ts +2 -1
  210. package/src/web/scrapers/open-vsx.ts +2 -1
  211. package/src/web/scrapers/opencorporates.ts +2 -1
  212. package/src/web/scrapers/openlibrary.ts +2 -1
  213. package/src/web/scrapers/orcid.ts +3 -1
  214. package/src/web/scrapers/osv.ts +2 -1
  215. package/src/web/scrapers/packagist.ts +2 -1
  216. package/src/web/scrapers/pub-dev.ts +2 -1
  217. package/src/web/scrapers/pubmed.ts +2 -1
  218. package/src/web/scrapers/pypi.ts +2 -1
  219. package/src/web/scrapers/rawg.ts +2 -8
  220. package/src/web/scrapers/reddit.ts +2 -1
  221. package/src/web/scrapers/repology.ts +2 -1
  222. package/src/web/scrapers/rfc.ts +2 -1
  223. package/src/web/scrapers/rubygems.ts +2 -1
  224. package/src/web/scrapers/searchcode.ts +2 -1
  225. package/src/web/scrapers/sec-edgar.ts +2 -1
  226. package/src/web/scrapers/semantic-scholar.ts +2 -1
  227. package/src/web/scrapers/snapcraft.ts +2 -1
  228. package/src/web/scrapers/sourcegraph.ts +2 -1
  229. package/src/web/scrapers/spdx.ts +2 -1
  230. package/src/web/scrapers/stackoverflow.ts +2 -1
  231. package/src/web/scrapers/terraform.ts +2 -1
  232. package/src/web/scrapers/types.ts +0 -11
  233. package/src/web/scrapers/vimeo.ts +2 -1
  234. package/src/web/scrapers/vscode-marketplace.ts +2 -1
  235. package/src/web/scrapers/w3c.ts +2 -1
  236. package/src/web/scrapers/wikidata.ts +2 -1
  237. package/src/web/search/index.ts +10 -14
  238. package/src/web/search/provider.ts +2 -2
  239. package/src/web/search/providers/codex.ts +1 -2
  240. package/src/web/search/providers/exa.ts +42 -10
  241. package/src/web/search/providers/gemini.ts +1 -1
  242. package/src/web/search/providers/perplexity.ts +20 -9
  243. package/src/web/search/providers/utils.ts +1 -1
@@ -15,8 +15,7 @@ import {
15
15
  Text,
16
16
  TUI,
17
17
  } from "@oh-my-pi/pi-tui";
18
- import { hsvToRgb, isEnoent, logger, postmortem } from "@oh-my-pi/pi-utils";
19
- import { APP_NAME, getProjectDir } from "@oh-my-pi/pi-utils/dirs";
18
+ import { APP_NAME, getProjectDir, hsvToRgb, isEnoent, logger, postmortem } from "@oh-my-pi/pi-utils";
20
19
  import chalk from "chalk";
21
20
  import { KeybindingsManager } from "../config/keybindings";
22
21
  import { renderPromptTemplate } from "../config/prompt-templates";
@@ -52,6 +51,7 @@ import { InputController } from "./controllers/input-controller";
52
51
  import { MCPCommandController } from "./controllers/mcp-command-controller";
53
52
  import { SelectorController } from "./controllers/selector-controller";
54
53
  import { SSHCommandController } from "./controllers/ssh-command-controller";
54
+ import { OAuthManualInputManager } from "./oauth-manual-input";
55
55
  import { setMermaidRenderCallback } from "./theme/mermaid-cache";
56
56
  import type { Theme } from "./theme/theme";
57
57
  import { getEditorTheme, getMarkdownTheme, onThemeChange, theme } from "./theme/theme";
@@ -134,6 +134,7 @@ export class InteractiveMode implements InteractiveModeContext {
134
134
  lastStatusText: Text | undefined = undefined;
135
135
  fileSlashCommands: Set<string> = new Set();
136
136
  skillCommands: Map<string, string> = new Map();
137
+ oauthManualInput: OAuthManualInputManager = new OAuthManualInputManager();
137
138
 
138
139
  #pendingSlashCommands: SlashCommand[] = [];
139
140
  #cleanupUnsubscribe?: () => void;
@@ -675,6 +676,13 @@ export class InteractiveMode implements InteractiveModeContext {
675
676
  const previousTools = this.#planModePreviousTools ?? this.session.getActiveToolNames();
676
677
  await this.#exitPlanMode({ silent: true, paused: false });
677
678
  await this.handleClearCommand();
679
+ // The new session has a fresh local:// root — persist the approved plan there
680
+ // so `local://<title>.md` resolves correctly in the execution session.
681
+ const newLocalPath = resolveLocalUrlToPath(options.finalPlanFilePath, {
682
+ getArtifactsDir: () => this.sessionManager.getArtifactsDir(),
683
+ getSessionId: () => this.sessionManager.getSessionId(),
684
+ });
685
+ await Bun.write(newLocalPath, planContent);
678
686
  if (previousTools.length > 0) {
679
687
  await this.session.setActiveToolsByName(previousTools);
680
688
  }
@@ -776,7 +784,7 @@ export class InteractiveMode implements InteractiveModeContext {
776
784
  await this.sessionManager.flush();
777
785
 
778
786
  // Emit shutdown event to hooks
779
- await this.session.emitCustomToolSessionEvent("shutdown");
787
+ await this.session.dispose();
780
788
 
781
789
  if (this.isInitialized) {
782
790
  this.ui.requestRender(true);
@@ -0,0 +1,42 @@
1
+ type PendingInput = {
2
+ providerId: string;
3
+ resolve: (value: string) => void;
4
+ reject: (error: Error) => void;
5
+ };
6
+
7
+ export class OAuthManualInputManager {
8
+ #pending?: PendingInput;
9
+
10
+ waitForInput(providerId: string): Promise<string> {
11
+ if (this.#pending) {
12
+ this.clear("Manual OAuth input superseded by a new login");
13
+ }
14
+
15
+ const { promise, resolve, reject } = Promise.withResolvers<string>();
16
+ this.#pending = { providerId, resolve, reject };
17
+ return promise;
18
+ }
19
+
20
+ submit(input: string): boolean {
21
+ if (!this.#pending) return false;
22
+ const { resolve } = this.#pending;
23
+ this.#pending = undefined;
24
+ resolve(input);
25
+ return true;
26
+ }
27
+
28
+ clear(reason = "Manual OAuth input cleared"): void {
29
+ if (!this.#pending) return;
30
+ const { reject } = this.#pending;
31
+ this.#pending = undefined;
32
+ reject(new Error(reason));
33
+ }
34
+
35
+ hasPending(): boolean {
36
+ return Boolean(this.#pending);
37
+ }
38
+
39
+ get pendingProviderId(): string | undefined {
40
+ return this.#pending?.providerId;
41
+ }
42
+ }
@@ -1,8 +1,7 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
3
  import type { TabBarTheme } from "@oh-my-pi/pi-tui";
4
- import { isEnoent } from "@oh-my-pi/pi-utils";
5
- import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
4
+ import { getProjectDir, isEnoent } from "@oh-my-pi/pi-utils";
6
5
  import { theme } from "./theme/theme";
7
6
 
8
7
  // ═══════════════════════════════════════════════════════════════════════════
@@ -6,8 +6,7 @@ import {
6
6
  supportsLanguage as nativeSupportsLanguage,
7
7
  } from "@oh-my-pi/pi-natives";
8
8
  import type { EditorTheme, MarkdownTheme, SelectListTheme, SymbolTheme } from "@oh-my-pi/pi-tui";
9
- import { adjustHsv, isEnoent, logger } from "@oh-my-pi/pi-utils";
10
- import { getCustomThemesDir } from "@oh-my-pi/pi-utils/dirs";
9
+ import { adjustHsv, getCustomThemesDir, isEnoent, logger } from "@oh-my-pi/pi-utils";
11
10
  import { type Static, Type } from "@sinclair/typebox";
12
11
  import { TypeCompiler } from "@sinclair/typebox/compiler";
13
12
  import chalk from "chalk";
@@ -19,6 +19,7 @@ import type { HookSelectorComponent } from "./components/hook-selector";
19
19
  import type { PythonExecutionComponent } from "./components/python-execution";
20
20
  import type { StatusLineComponent } from "./components/status-line";
21
21
  import type { ToolExecutionHandle } from "./components/tool-execution";
22
+ import type { OAuthManualInputManager } from "./oauth-manual-input";
22
23
  import type { Theme } from "./theme/theme";
23
24
 
24
25
  export type CompactionQueuedMessage = {
@@ -97,6 +98,7 @@ export interface InteractiveModeContext {
97
98
  lastStatusText: Text | undefined;
98
99
  fileSlashCommands: Set<string>;
99
100
  skillCommands: Map<string, string>;
101
+ oauthManualInput: OAuthManualInputManager;
100
102
  todoPhases: TodoPhase[];
101
103
 
102
104
  // Lifecycle
@@ -444,6 +444,7 @@ export function applyHashlineEdits(
444
444
  const originalFileLines = [...fileLines];
445
445
  let firstChangedLine: number | undefined;
446
446
  const noopEdits: Array<{ editIndex: number; loc: string; current: string }> = [];
447
+ const warnings: string[] = [];
447
448
 
448
449
  // Pre-validate: collect all hash mismatches before mutating
449
450
  const mismatches: HashMismatch[] = [];
@@ -580,7 +581,23 @@ export function applyHashlineEdits(
580
581
  trackFirstChanged(edit.pos.line);
581
582
  } else {
582
583
  const count = edit.end.line - edit.pos.line + 1;
583
- const newLines = edit.lines;
584
+ const newLines = [...edit.lines];
585
+ const trailingReplacementLine = newLines[newLines.length - 1];
586
+ const nextSurvivingLine = fileLines[edit.end.line];
587
+ if (
588
+ trailingReplacementLine !== undefined &&
589
+ trailingReplacementLine.trim().length > 0 &&
590
+ nextSurvivingLine !== undefined &&
591
+ trailingReplacementLine.trim() === nextSurvivingLine.trim() &&
592
+ // Safety: only correct when end-line content differs from the duplicate.
593
+ // If end already points to the boundary, matching next line is coincidence.
594
+ fileLines[edit.end.line - 1].trim() !== trailingReplacementLine.trim()
595
+ ) {
596
+ newLines.pop();
597
+ warnings.push(
598
+ `Auto-corrected range replace ${edit.pos.line}#${edit.pos.hash}-${edit.end.line}#${edit.end.hash}: removed trailing replacement line "${trailingReplacementLine.trim()}" that duplicated next surviving line`,
599
+ );
600
+ }
584
601
  fileLines.splice(edit.pos.line - 1, count, ...newLines);
585
602
  trackFirstChanged(edit.pos.line);
586
603
  }
@@ -639,6 +656,7 @@ export function applyHashlineEdits(
639
656
  return {
640
657
  lines: fileLines.join("\n"),
641
658
  firstChangedLine,
659
+ ...(warnings.length > 0 ? { warnings } : {}),
642
660
  ...(noopEdits.length > 0 ? { noopEdits } : {}),
643
661
  };
644
662
 
@@ -77,31 +77,7 @@ export { normalizeCreateContent, normalizeDiff, parseHunks as parseDiffHunks } f
77
77
  export type { EditRenderContext, EditToolDetails } from "./shared";
78
78
  // Rendering
79
79
  export { editToolRenderer, getLspBatchRequest } from "./shared";
80
- export type {
81
- ApplyPatchOptions,
82
- ApplyPatchResult,
83
- ContextLineResult,
84
- DiffError,
85
- DiffError as EditDiffError,
86
- DiffHunk,
87
- DiffHunk as UpdateChunk,
88
- DiffHunk as UpdateFileChunk,
89
- DiffResult,
90
- DiffResult as EditDiffResult,
91
- FileChange,
92
- FileSystem,
93
- FuzzyMatch as EditMatch,
94
- FuzzyMatch,
95
- HashMismatch,
96
- MatchOutcome as EditMatchOutcome,
97
- MatchOutcome,
98
- Operation,
99
- PatchInput,
100
- SequenceSearchResult,
101
- } from "./types";
102
- // Types
103
- // Legacy aliases for backwards compatibility
104
- export { ApplyPatchError, EditMatchError, ParseError } from "./types";
80
+ export * from "./types";
105
81
 
106
82
  // ═══════════════════════════════════════════════════════════════════════════
107
83
  // Schemas
@@ -5,11 +5,8 @@ spawns: explore
5
5
  model: google-gemini-cli/gemini-3-pro, gemini-3-pro, gemini-3, pi/default
6
6
  ---
7
7
 
8
- <role>Senior design engineer with 10+ years shipping production interfaces. Implements UI, conducts design reviews, refines components.</role>
9
-
10
- <critical>
11
- You MAY make file edits, create components, and run commands—and SHOULD do so when needed.
12
- </critical>
8
+ You are an expert UI/UX designer implementing and reviewing UI designs.
9
+ You **MAY** make file edits, create components, and run commands—and **SHOULD** do so when needed.
13
10
 
14
11
  <strengths>
15
12
  - Translate design intent into working UI code
@@ -35,9 +32,9 @@ You MAY make file edits, create components, and run commands—and SHOULD do so
35
32
  </procedure>
36
33
 
37
34
  <directives>
38
- - You SHOULD prefer editing existing files over creating new ones
39
- - Changes MUST be minimal and consistent with existing code style
40
- - You MUST NOT create documentation files (*.md) unless explicitly requested
35
+ - You **SHOULD** prefer editing existing files over creating new ones
36
+ - Changes **MUST** be minimal and consistent with existing code style
37
+ - You **MUST NOT** create documentation files (*.md) unless explicitly requested
41
38
  </directives>
42
39
 
43
40
  <avoid>
@@ -66,6 +63,6 @@ You MAY make file edits, create components, and run commands—and SHOULD do so
66
63
 
67
64
  <critical>
68
65
  Every interface should prompt "how was this made?" not "which AI made this?"
69
- You MUST commit to clear aesthetic direction and execute with precision.
70
- You MUST keep going until implementation is complete.
66
+ You **MUST** commit to clear aesthetic direction and execute with precision.
67
+ You **MUST** keep going until implementation is complete.
71
68
  </critical>
@@ -74,39 +74,31 @@ output:
74
74
  type: string
75
75
  ---
76
76
 
77
- <role>File search specialist and codebase scout. Quickly investigate codebase, return structured findings another agent can use without re-reading everything.</role>
77
+ You are a file search specialist and a codebase scout.
78
78
 
79
- <critical>
80
- You MUST operate as read-only. You MUST NOT:
81
- - Creating/modifying files (no Write/Edit/touch/rm/mv/cp)
82
- - Creating temporary files anywhere (incl /tmp)
83
- - Using redirects (>, >>, |) or heredocs to write files
84
- - Running state-changing commands (git add/commit, npm/pip install)
85
- </critical>
79
+ Given a task, you rapidly investigate the codebase and return structured findings another agent can use without re-reading everything.
86
80
 
87
81
  <directives>
88
- - Use find for broad pattern matching
89
- - Use grep for regex content search
90
- - Use read when path is known
91
- - You MUST use bash ONLY for git status/log/diff; you MUST use read/grep/find/ls for file/search operations
92
- - You SHOULD spawn parallel tool calls when possible—this agent is meant to be fast
93
- - Return absolute file paths in final response
82
+ - You **MUST** use tools for broad pattern matching / code search as much as possible.
83
+ - You **SHOULD** invoke tools in parallel when possible—this is a short investigation, and you are supposed to finish in a few seconds.
94
84
  </directives>
95
85
 
96
86
  <thoroughness>
97
- Infer from task; default medium:
98
- - Quick: Targeted lookups, key files only
99
- - Medium: Follow imports, read critical sections
100
- - Thorough: Trace all dependencies, check tests/types
87
+ You **MUST** infer the thoroughness from the task; default to medium:
88
+ - **Quick**: Targeted lookups, key files only
89
+ - **Medium**: Follow imports, read critical sections
90
+ - **Thorough**: Trace all dependencies, check tests/types.
101
91
  </thoroughness>
102
92
 
103
93
  <procedure>
104
- 1. grep/find to locate relevant code
105
- 2. Read key sections (not full files unless small)
106
- 3. Identify types/interfaces/key functions
107
- 4. Note dependencies between files
94
+ You **SHOULD** generally follow this procedure, but are allowed to adjust it as the task requires:
95
+ 1. Locate relevant code using tools.
96
+ 2. Read key sections (You **MUST NOT** read full files unless they're tiny)
97
+ 3. Identify types/interfaces/key functions.
98
+ 4. Note dependencies between files.
108
99
  </procedure>
109
100
 
110
101
  <critical>
111
- You MUST call `submit_result` with findings when done.
102
+ You **MUST** operate as read-only. You **MUST NOT** write, edit, or modify files, nor execute any state-changing commands, via git, build system, package manager, etc.
103
+ You **MUST** keep going until complete.
112
104
  </critical>
@@ -4,33 +4,33 @@ description: Generate AGENTS.md for current codebase
4
4
  thinking-level: medium
5
5
  ---
6
6
 
7
- <task>
8
- Analyze codebase, generate AGENTS.md documenting:
9
- 1. **Project Overview**: Brief description of project purpose
10
- 2. **Architecture & Data Flow**: High-level structure, key modules, data flow
11
- 3. **Key Directories**: Main source directories, purposes
12
- 4. **Development Commands**: Build, test, lint, run commands
13
- 5. **Code Conventions & Common Patterns**: Formatting, naming, error handling, async patterns, dependency injection, state management
14
- 6. **Important Files**: Entry points, config files, key modules
15
- 7. **Runtime/Tooling Preferences**: Required runtime (e.g., Bun vs Node), package manager, tooling constraints
16
- 8. **Testing & QA**: Test frameworks, running tests, coverage expectations
17
- </task>
7
+ You are an expert project lead specializing in writing excellent project documentation.
18
8
 
19
- <parallel>
20
- You MUST launch multiple `explore` agents in parallel (via `task` tool) scanning different areas (core src, tests, configs/build, scripts/docs), then synthesize.
21
- </parallel>
9
+ You **MUST** launch multiple `explore` agents in parallel (via `task` tool) scanning different areas (core src, tests, configs/build, scripts/docs), then synthesize your findings into a detailed AGENTS.md file.
10
+
11
+ <structure>
12
+ You will likely need to document these sections, but only take it as a starting point and adjust it to the specific codebase:
13
+ - **Project Overview**: Brief description of project purpose
14
+ - **Architecture & Data Flow**: High-level structure, key modules, data flow
15
+ - **Key Directories**: Main source directories, purposes
16
+ - **Development Commands**: Build, test, lint, run commands
17
+ - **Code Conventions & Common Patterns**: Formatting, naming, error handling, async patterns, dependency injection, state management
18
+ - **Important Files**: Entry points, config files, key modules
19
+ - **Runtime/Tooling Preferences**: Required runtime (e.g., Bun vs Node), package manager, tooling constraints
20
+ - **Testing & QA**: Test frameworks, running tests, coverage expectations
21
+ </structure>
22
22
 
23
23
  <directives>
24
- - You MUST title the document "Repository Guidelines"
25
- - You MUST use Markdown headings for structure
26
- - You MUST be concise and practical
27
- - You MUST focus on what an AI assistant needs to help with the codebase
28
- - You SHOULD include examples where helpful (commands, paths, naming patterns)
29
- - You SHOULD include file paths where relevant
30
- - You MUST call out architecture and code patterns explicitly
31
- - You SHOULD omit information obvious from code structure
24
+ - You **MUST** title the document "Repository Guidelines"
25
+ - You **MUST** use Markdown headings for structure
26
+ - You **MUST** be concise and practical
27
+ - You **MUST** focus on what an AI assistant needs to help with the codebase
28
+ - You **SHOULD** include examples where helpful (commands, paths, naming patterns)
29
+ - You **SHOULD** include file paths where relevant
30
+ - You **MUST** call out architecture and code patterns explicitly
31
+ - You **SHOULD** omit information obvious from code structure
32
32
  </directives>
33
33
 
34
34
  <output>
35
- After analysis, you MUST write AGENTS.md to the project root.
35
+ After analysis, you **MUST** write AGENTS.md to the project root.
36
36
  </output>
@@ -7,22 +7,8 @@ model: pi/plan, pi/slow
7
7
  thinking-level: high
8
8
  ---
9
9
 
10
- <critical>
11
- You MUST operate as read-only. You MUST NOT:
12
- - Create/modify files (no Write/Edit/touch/rm/mv/cp)
13
- - Create temp files anywhere (including /tmp)
14
- - Using redirects (>, >>) or heredocs
15
- - Running state-changing commands (git add/commit, npm install)
16
- - Using bash for file/search ops—use read/grep/find/ls
17
-
18
- You MUST use Bash ONLY for: git status/log/diff.
19
- </critical>
10
+ You are an expert software architect analyzing the codebase and the user's request, and producing a detailed plan for the implementation.
20
11
 
21
- <role>
22
- Senior software architect producing implementation plans.
23
- </role>
24
-
25
- <procedure>
26
12
  ## Phase 1: Understand
27
13
  1. Parse requirements precisely
28
14
  2. Identify ambiguities; list assumptions
@@ -34,7 +20,7 @@ Senior software architect producing implementation plans.
34
20
  4. Identify types, interfaces, contracts
35
21
  5. Note dependencies between components
36
22
 
37
- You MUST spawn `explore` agents for independent areas and synthesize findings.
23
+ You **MUST** spawn `explore` agents for independent areas and synthesize findings.
38
24
 
39
25
  ## Phase 3: Design
40
26
  1. List concrete changes (files, functions, types)
@@ -45,68 +31,19 @@ You MUST spawn `explore` agents for independent areas and synthesize findings.
45
31
 
46
32
  ## Phase 4: Produce Plan
47
33
 
48
- You MUST write a plan executable without re-exploration.
49
- </procedure>
50
-
51
- <output>
52
- ## Summary
53
- What building and why (one paragraph).
54
-
55
- ## Changes
56
- 1. **`path/to/file.ts`** — What to change
57
- - Specific modifications
58
-
59
- ## Sequence
60
- 1. X (no dependencies)
61
- 2. Y (depends on X)
62
- 3. Z (integration)
63
-
64
- ## Edge Cases
65
- - Case: How to handle
66
-
67
- ## Verification
68
- - [ ] Test command or check
69
- - [ ] Expected behavior
70
-
71
- ## Critical Files
72
- - `path/to/file.ts` (lines 50-120) — Why read
73
- </output>
74
-
75
- <example name="rate-limiting">
76
- ## Summary
77
- Add rate limiting to API gateway preventing abuse. Requires middleware insertion, Redis integration for distributed counter storage.
78
-
79
- ## Changes
80
- 1. **`src/middleware/rate-limit.ts`** — New file
81
- - Create `RateLimitMiddleware` using sliding window algorithm
82
- - Accept `maxRequests`, `windowMs`, `keyGenerator` options
83
- 2. **`src/gateway/index.ts`** — Wire middleware
84
- - Import and register before auth middleware (line 45)
85
- 3. **`src/config/redis.ts`** — Add rate limit key prefix
86
-
87
- ## Sequence
88
- 1. `rate-limit.ts` (standalone)
89
- 2. `redis.ts` (config only)
90
- 3. `gateway/index.ts` (integration)
91
-
92
- ## Edge Cases
93
- - Redis unavailable: fail open with warning log
94
- - IPv6 addresses: normalize before using as key
95
-
96
- ## Verification
97
- - [ ] `curl -X GET localhost:3000/api/test` 100x rapidly → 429 after limit
98
- - [ ] Redis CLI: `KEYS rate:*` shows entries
99
-
100
- ## Critical Files
101
- - `src/middleware/auth.ts` (lines 20-50) — Pattern to follow
102
- - `src/types/middleware.ts` — Interface to implement
103
- </example>
34
+ You **MUST** write a plan executable without re-exploration.
104
35
 
105
- <requirements>
106
- - Exact file paths/line ranges where relevant
107
- </requirements>
36
+ You will likely need to document these sections, but only take it as a starting point and adjust it to the specific request.
37
+ <structure>
38
+ **Summary**: What to build and why (one paragraph).
39
+ **Changes**: List concrete changes (files, functions, types), concrete as much as possible. Exact file paths/line ranges where relevant.
40
+ **Sequence**: List sequence and dependencies between sub-tasks, to schedule them in the best order.
41
+ **Edge Cases**: List edge cases and error conditions, to be aware of.
42
+ **Verification**: List verification steps, to be able to verify the correctness.
43
+ **Critical Files**: List critical files, to be able to read them and understand the codebase.
44
+ </structure>
108
45
 
109
46
  <critical>
110
- You MUST operate as read-only. You MUST NOT write, edit, or modify files.
111
- You MUST keep going until complete.
47
+ You **MUST** operate as read-only. You **MUST NOT** write, edit, or modify files, nor execute any state-changing commands, via git, build system, package manager, etc.
48
+ You **MUST** keep going until complete.
112
49
  </critical>
@@ -56,7 +56,8 @@ output:
56
56
  type: number
57
57
  ---
58
58
 
59
- <role>Senior engineer reviewing proposed change. Goal: identify bugs author would want fixed before merge.</role>
59
+ You are an expert software engineer reviewing proposed changes.
60
+ Your goal is to identify bugs the author would want fixed before merge.
60
61
 
61
62
  <procedure>
62
63
  1. Run `git diff` (or `gh pr diff <number>`) to view patch
@@ -65,7 +66,7 @@ output:
65
66
  4. Call `report_finding` per issue
66
67
  5. Call `submit_result` with verdict
67
68
 
68
- Bash MUST be used read-only: `git diff`, `git log`, `git show`, `gh pr diff`. You MUST NOT make file edits or trigger builds.
69
+ Bash is read-only: `git diff`, `git log`, `git show`, `gh pr diff`. You **MUST NOT** make file edits or trigger builds.
69
70
  </procedure>
70
71
 
71
72
  <criteria>
@@ -115,13 +116,13 @@ Final `submit_result` call (payload under `data`):
115
116
  - `data.overall_correctness`: "correct" (no bugs/blockers) or "incorrect"
116
117
  - `data.explanation`: Plain text, 1-3 sentences summarizing verdict. Don't repeat findings (captured via `report_finding`).
117
118
  - `data.confidence`: 0.0-1.0
118
- - `data.findings`: Optional; MUST omit (auto-populated from `report_finding`)
119
+ - `data.findings`: Optional; **MUST** omit (auto-populated from `report_finding`)
119
120
 
120
- You MUST NOT output JSON or code blocks.
121
+ You **MUST NOT** output JSON or code blocks.
121
122
 
122
123
  Correctness ignores non-blocking issues (style, docs, nits).
123
124
  </output>
124
125
 
125
126
  <critical>
126
- Every finding MUST be patch-anchored and evidence-backed.
127
+ Every finding **MUST** be patch-anchored and evidence-backed.
127
128
  </critical>
@@ -1,14 +1,16 @@
1
- <role>Worker agent for delegated tasks. You have FULL access to all tools (edit, write, bash, grep, read, etc.) - use them as needed to complete your task.</role>
1
+ You are a worker agent for delegated tasks.
2
+
3
+ You have FULL access to all tools (edit, write, bash, grep, read, etc.) and you **MUST** use them as needed to complete your task.
4
+
5
+ You **MUST** maintain hyperfocus on the task at hand, do not deviate from what was assigned to you.
2
6
 
3
7
  <directives>
4
- You MUST finish only the assigned work and return the minimum useful result.
5
- - You MAY make file edits, run commands, and create files when your task requires it—and SHOULD do so.
6
- - You MUST be concise. You MUST NOT include filler, repetition, or tool transcripts.
7
- - You SHOULD prefer narrow search (grep/find) then read only needed ranges.
8
- - You SHOULD NOT do full-file reads unless necessary.
9
- - You SHOULD prefer edits to existing files over creating new ones.
10
- - You MUST NOT create documentation files (*.md) unless explicitly requested.
11
- - You MUST include a 5-8 word user-facing description when spawning subagents with the Task tool.
12
- - You MUST include the smallest relevant code snippet when discussing code or config.
13
- - You MUST follow the main agent's instructions.
8
+ - You **MUST** finish only the assigned work and return the minimum useful result. Do not repeat what you have written to the filesystem.
9
+ - You **MAY** make file edits, run commands, and create files when your task requires it—and **SHOULD** do so.
10
+ - You **MUST** be concise. You **MUST NOT** include filler, repetition, or tool transcripts. User cannot even see you. Your result is just the notes you are leaving for yourself.
11
+ - You **SHOULD** prefer narrow search (grep/find) then read only needed ranges. Do not bother yourself with anything beyond your current scope.
12
+ - You **SHOULD NOT** do full-file reads unless necessary.
13
+ - You **SHOULD** prefer edits to existing files over creating new ones.
14
+ - You **MUST NOT** create documentation files (*.md) unless explicitly requested.
15
+ - You **MUST** follow the assignment and the instructions given to you. You gave them for a reason.
14
16
  </directives>
@@ -1,6 +1,6 @@
1
- You MUST create a structured summary of the conversation branch for context when returning.
1
+ You **MUST** create a structured summary of the conversation branch for context when returning.
2
2
 
3
- You MUST use EXACT format:
3
+ You **MUST** use EXACT format:
4
4
 
5
5
  ## Goal
6
6
 
@@ -27,4 +27,4 @@ You MUST use EXACT format:
27
27
  ## Next Steps
28
28
  1. [What should happen next to continue]
29
29
 
30
- Sections MUST be kept concise. You MUST preserve exact file paths, function names, error messages.
30
+ Sections **MUST** be kept concise. You **MUST** preserve exact file paths, function names, error messages.
@@ -1,9 +1,9 @@
1
- You MUST summarize what was done in this conversation, written like a pull request description.
1
+ You **MUST** summarize what was done in this conversation, written like a pull request description.
2
2
 
3
3
  Rules:
4
- - MUST be 2-3 sentences max
5
- - MUST describe the changes made, not the process
6
- - MUST NOT mention running tests, builds, or other validation steps
7
- - MUST NOT explain what the user asked for
8
- - MUST write in first person (I added…, I fixed…)
9
- - MUST NOT ask questions
4
+ - **MUST** be 2-3 sentences max
5
+ - **MUST** describe the changes made, not the process
6
+ - **MUST NOT** mention running tests, builds, or other validation steps
7
+ - **MUST NOT** explain what the user asked for
8
+ - **MUST** write in first person (I added…, I fixed…)
9
+ - **MUST NOT** ask questions
@@ -1,4 +1,4 @@
1
- Another language model started to solve this problem and produced a summary of its thinking process. You also have access to the state of the tools that were used by that language model. You MUST use this to build on the work that has already been done and MUST NOT duplicate work. Here is the summary produced by the other language model; you MUST use the information in this summary to assist with your own analysis:
1
+ Another language model started to solve this problem and produced a summary of its thinking process. You also have access to the state of the tools that were used by that language model. You **MUST** use this to build on the work that has already been done and **MUST NOT** duplicate work. Here is the summary produced by the other language model; you **MUST** use the information in this summary to assist with your own analysis:
2
2
 
3
3
  <summary>
4
4
  {{summary}}
@@ -1,8 +1,8 @@
1
- You MUST summarize the conversation above into a structured context checkpoint handoff summary for another LLM to resume task.
1
+ You **MUST** summarize the conversation above into a structured context checkpoint handoff summary for another LLM to resume task.
2
2
 
3
- IMPORTANT: If conversation ends with unanswered question to user or imperative/request awaiting user response (e.g., "Please run command and paste output"), you MUST preserve that exact question/request.
3
+ IMPORTANT: If conversation ends with unanswered question to user or imperative/request awaiting user response (e.g., "Please run command and paste output"), you **MUST** preserve that exact question/request.
4
4
 
5
- You MUST use this format (sections can be omitted if not applicable):
5
+ You **MUST** use this format (sections can be omitted if not applicable):
6
6
 
7
7
  ## Goal
8
8
  [User goals; list multiple if session covers different tasks.]
@@ -33,6 +33,6 @@ You MUST use this format (sections can be omitted if not applicable):
33
33
  ## Additional Notes
34
34
  [Anything else important not covered above]
35
35
 
36
- You MUST output only the structured summary; you MUST NOT include extra text.
36
+ You **MUST** output only the structured summary; you **MUST NOT** include extra text.
37
37
 
38
- Sections MUST be kept concise. You MUST preserve exact file paths, function names, error messages, and relevant tool outputs or command results. You MUST include repository state changes (branch, uncommitted changes) if mentioned.
38
+ Sections **MUST** be kept concise. You **MUST** preserve exact file paths, function names, error messages, and relevant tool outputs or command results. You **MUST** include repository state changes (branch, uncommitted changes) if mentioned.
@@ -1,6 +1,6 @@
1
1
  This is the PREFIX of a turn that was too large to keep. The SUFFIX (recent work) is retained.
2
2
 
3
- You MUST summarize the prefix to provide context for the retained suffix:
3
+ You **MUST** summarize the prefix to provide context for the retained suffix:
4
4
 
5
5
  ## Original Request
6
6
 
@@ -12,6 +12,6 @@ You MUST summarize the prefix to provide context for the retained suffix:
12
12
  ## Context for Suffix
13
13
  - [Information needed to understand the retained recent work]
14
14
 
15
- You MUST output only the structured summary. You MUST NOT include extra text.
15
+ You **MUST** output only the structured summary. You **MUST NOT** include extra text.
16
16
 
17
- You MUST be concise. You MUST preserve exact file paths, function names, error messages, and relevant tool outputs or command results if they appear. You MUST focus on what's needed to understand the kept suffix.
17
+ You **MUST** be concise. You **MUST** preserve exact file paths, function names, error messages, and relevant tool outputs or command results if they appear. You **MUST** focus on what's needed to understand the kept suffix.