@draht/coding-agent 2026.3.2 → 2026.3.4

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 (194) hide show
  1. package/CHANGELOG.md +194 -13
  2. package/README.md +90 -106
  3. package/agents/architect.md +45 -0
  4. package/agents/debugger.md +57 -0
  5. package/agents/git-committer.md +46 -0
  6. package/agents/implementer.md +25 -0
  7. package/agents/reviewer.md +52 -0
  8. package/agents/security-auditor.md +61 -0
  9. package/agents/verifier.md +44 -0
  10. package/bin/draht-tools.cjs +20 -20
  11. package/dist/agents/architect.md +45 -0
  12. package/dist/agents/debugger.md +57 -0
  13. package/dist/agents/git-committer.md +46 -0
  14. package/dist/agents/implementer.md +25 -0
  15. package/dist/agents/reviewer.md +52 -0
  16. package/dist/agents/security-auditor.md +61 -0
  17. package/dist/agents/verifier.md +44 -0
  18. package/dist/cli/args.d.ts.map +1 -1
  19. package/dist/cli/args.js +1 -0
  20. package/dist/cli/args.js.map +1 -1
  21. package/dist/cli.d.ts.map +1 -1
  22. package/dist/cli.js +5 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/config.d.ts +0 -7
  25. package/dist/config.d.ts.map +1 -1
  26. package/dist/config.js +2 -14
  27. package/dist/config.js.map +1 -1
  28. package/dist/core/agent-session.d.ts +14 -4
  29. package/dist/core/agent-session.d.ts.map +1 -1
  30. package/dist/core/agent-session.js +167 -49
  31. package/dist/core/agent-session.js.map +1 -1
  32. package/dist/core/auth-storage.d.ts +1 -1
  33. package/dist/core/auth-storage.d.ts.map +1 -1
  34. package/dist/core/auth-storage.js +2 -1
  35. package/dist/core/auth-storage.js.map +1 -1
  36. package/dist/core/builtins/subagent.d.ts +14 -0
  37. package/dist/core/builtins/subagent.d.ts.map +1 -0
  38. package/dist/core/builtins/subagent.js +492 -0
  39. package/dist/core/builtins/subagent.js.map +1 -0
  40. package/dist/core/compaction/compaction.d.ts.map +1 -1
  41. package/dist/core/compaction/compaction.js +4 -1
  42. package/dist/core/compaction/compaction.js.map +1 -1
  43. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  44. package/dist/core/export-html/tool-renderer.js +6 -0
  45. package/dist/core/export-html/tool-renderer.js.map +1 -1
  46. package/dist/core/extensions/loader.d.ts.map +1 -1
  47. package/dist/core/extensions/loader.js +19 -8
  48. package/dist/core/extensions/loader.js.map +1 -1
  49. package/dist/core/extensions/runner.d.ts.map +1 -1
  50. package/dist/core/extensions/runner.js +1 -0
  51. package/dist/core/extensions/runner.js.map +1 -1
  52. package/dist/core/extensions/types.d.ts +8 -2
  53. package/dist/core/extensions/types.d.ts.map +1 -1
  54. package/dist/core/extensions/types.js.map +1 -1
  55. package/dist/core/model-registry.d.ts +1 -0
  56. package/dist/core/model-registry.d.ts.map +1 -1
  57. package/dist/core/model-registry.js +9 -6
  58. package/dist/core/model-registry.js.map +1 -1
  59. package/dist/core/model-resolver.d.ts.map +1 -1
  60. package/dist/core/model-resolver.js +35 -5
  61. package/dist/core/model-resolver.js.map +1 -1
  62. package/dist/core/prompt-templates.js.map +1 -1
  63. package/dist/core/resource-loader.d.ts +2 -0
  64. package/dist/core/resource-loader.d.ts.map +1 -1
  65. package/dist/core/resource-loader.js +5 -1
  66. package/dist/core/resource-loader.js.map +1 -1
  67. package/dist/core/sdk.d.ts +1 -1
  68. package/dist/core/sdk.d.ts.map +1 -1
  69. package/dist/core/sdk.js.map +1 -1
  70. package/dist/core/session-manager.js.map +1 -1
  71. package/dist/core/settings-manager.d.ts +3 -0
  72. package/dist/core/settings-manager.d.ts.map +1 -1
  73. package/dist/core/settings-manager.js +4 -0
  74. package/dist/core/settings-manager.js.map +1 -1
  75. package/dist/core/system-prompt.d.ts +4 -0
  76. package/dist/core/system-prompt.d.ts.map +1 -1
  77. package/dist/core/system-prompt.js +34 -12
  78. package/dist/core/system-prompt.js.map +1 -1
  79. package/dist/core/tools/edit-diff.js.map +1 -1
  80. package/dist/core/tools/path-utils.js.map +1 -1
  81. package/dist/index.d.ts +1 -1
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/main.d.ts.map +1 -1
  86. package/dist/main.js +5 -5
  87. package/dist/main.js.map +1 -1
  88. package/dist/migrations.d.ts +1 -1
  89. package/dist/migrations.d.ts.map +1 -1
  90. package/dist/migrations.js +3 -3
  91. package/dist/migrations.js.map +1 -1
  92. package/dist/modes/interactive/components/armin.js.map +1 -1
  93. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  94. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  95. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  96. package/dist/modes/interactive/components/extension-editor.d.ts +5 -2
  97. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  98. package/dist/modes/interactive/components/extension-editor.js +9 -1
  99. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  100. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  101. package/dist/modes/interactive/components/footer.js.map +1 -1
  102. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/login-dialog.js +1 -1
  104. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  105. package/dist/modes/interactive/components/model-selector.d.ts +1 -1
  106. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  108. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  109. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  110. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  111. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  112. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  113. package/dist/modes/interactive/components/session-selector.js +1 -1
  114. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  115. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  116. package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
  117. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  118. package/dist/modes/interactive/components/tool-execution.js +28 -3
  119. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  120. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  121. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  122. package/dist/modes/interactive/components/user-message.d.ts +1 -0
  123. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  124. package/dist/modes/interactive/components/user-message.js +11 -0
  125. package/dist/modes/interactive/components/user-message.js.map +1 -1
  126. package/dist/modes/interactive/interactive-mode.d.ts +1 -1
  127. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  128. package/dist/modes/interactive/interactive-mode.js +28 -27
  129. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  130. package/dist/modes/interactive/theme/dark.json +1 -1
  131. package/dist/modes/interactive/theme/light.json +1 -1
  132. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  133. package/dist/modes/interactive/theme/theme.js +5 -0
  134. package/dist/modes/interactive/theme/theme.js.map +1 -1
  135. package/dist/prompts/commands/discuss-phase.md +3 -3
  136. package/dist/prompts/commands/execute-phase.md +9 -9
  137. package/dist/prompts/commands/fix.md +29 -0
  138. package/dist/prompts/commands/init-project.md +49 -0
  139. package/dist/prompts/commands/map-codebase.md +2 -2
  140. package/dist/prompts/commands/new-project.md +9 -9
  141. package/dist/prompts/commands/next-milestone.md +44 -0
  142. package/dist/prompts/commands/pause-work.md +2 -2
  143. package/dist/prompts/commands/plan-phase.md +5 -5
  144. package/dist/prompts/commands/progress.md +1 -1
  145. package/dist/prompts/commands/quick.md +4 -4
  146. package/dist/prompts/commands/resume-work.md +1 -1
  147. package/dist/prompts/commands/review.md +26 -0
  148. package/dist/prompts/commands/verify-work.md +4 -4
  149. package/docs/compaction.md +14 -14
  150. package/docs/custom-provider.md +19 -11
  151. package/docs/development.md +1 -1
  152. package/docs/extensions.md +52 -33
  153. package/docs/json.md +4 -4
  154. package/docs/packages.md +1 -1
  155. package/docs/providers.md +4 -2
  156. package/docs/rpc.md +1 -1
  157. package/docs/sdk.md +24 -24
  158. package/docs/session.md +6 -6
  159. package/docs/settings.md +1 -0
  160. package/docs/termux.md +1 -1
  161. package/docs/themes.md +2 -2
  162. package/docs/tui.md +20 -20
  163. package/examples/extensions/README.md +5 -4
  164. package/examples/extensions/antigravity-image-gen.ts +3 -1
  165. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  166. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  167. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  168. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  169. package/examples/extensions/doom-overlay/README.md +1 -1
  170. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  171. package/examples/extensions/dynamic-tools.ts +74 -0
  172. package/examples/extensions/subagent/README.md +11 -11
  173. package/examples/extensions/with-deps/package-lock.json +2 -2
  174. package/examples/extensions/with-deps/package.json +1 -1
  175. package/examples/sdk/README.md +3 -3
  176. package/package.json +11 -8
  177. package/prompts/commands/discuss-phase.md +3 -3
  178. package/prompts/commands/execute-phase.md +9 -9
  179. package/prompts/commands/fix.md +29 -0
  180. package/prompts/commands/init-project.md +49 -0
  181. package/prompts/commands/map-codebase.md +2 -2
  182. package/prompts/commands/new-project.md +9 -9
  183. package/prompts/commands/next-milestone.md +44 -0
  184. package/prompts/commands/pause-work.md +2 -2
  185. package/prompts/commands/plan-phase.md +5 -5
  186. package/prompts/commands/progress.md +1 -1
  187. package/prompts/commands/quick.md +4 -4
  188. package/prompts/commands/resume-work.md +1 -1
  189. package/prompts/commands/review.md +26 -0
  190. package/prompts/commands/verify-work.md +4 -4
  191. package/dist/extensions/gsd-commands.ts +0 -338
  192. package/dist/extensions/subagent.ts +0 -312
  193. package/extensions/gsd-commands.ts +0 -338
  194. package/extensions/subagent.ts +0 -312
package/docs/tui.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
6
6
 
7
- **Source:** [`@mariozechner/pi-tui`](https://github.com/badlogic/pi-mono/tree/main/packages/tui)
7
+ **Source:** [`@draht/tui`](https://github.com/draht-dev/draht/tree/main/packages/tui)
8
8
 
9
9
  ## Component Interface
10
10
 
@@ -33,7 +33,7 @@ The TUI appends a full SGR reset and OSC 8 reset at the end of each rendered lin
33
33
  Components that display a text cursor and need IME (Input Method Editor) support should implement the `Focusable` interface:
34
34
 
35
35
  ```typescript
36
- import { CURSOR_MARKER, type Component, type Focusable } from "@mariozechner/pi-tui";
36
+ import { CURSOR_MARKER, type Component, type Focusable } from "@draht/tui";
37
37
 
38
38
  class MyInput implements Component, Focusable {
39
39
  focused: boolean = false; // Set by TUI when focus changes
@@ -59,7 +59,7 @@ This enables IME candidate windows to appear at the correct position for CJK inp
59
59
  When a container component (dialog, selector, etc.) contains an `Input` or `Editor` child, the container must implement `Focusable` and propagate the focus state to the child. Otherwise, the hardware cursor won't be positioned correctly for IME input.
60
60
 
61
61
  ```typescript
62
- import { Container, type Focusable, Input } from "@mariozechner/pi-tui";
62
+ import { Container, type Focusable, Input } from "@draht/tui";
63
63
 
64
64
  class SearchDialog extends Container implements Focusable {
65
65
  private searchInput: Input;
@@ -179,10 +179,10 @@ See [overlay-qa-tests.ts](../examples/extensions/overlay-qa-tests.ts) for compre
179
179
 
180
180
  ## Built-in Components
181
181
 
182
- Import from `@mariozechner/pi-tui`:
182
+ Import from `@draht/tui`:
183
183
 
184
184
  ```typescript
185
- import { Text, Box, Container, Spacer, Markdown } from "@mariozechner/pi-tui";
185
+ import { Text, Box, Container, Spacer, Markdown } from "@draht/tui";
186
186
  ```
187
187
 
188
188
  ### Text
@@ -264,7 +264,7 @@ const image = new Image(
264
264
  Use `matchesKey()` for key detection:
265
265
 
266
266
  ```typescript
267
- import { matchesKey, Key } from "@mariozechner/pi-tui";
267
+ import { matchesKey, Key } from "@draht/tui";
268
268
 
269
269
  handleInput(data: string) {
270
270
  if (matchesKey(data, Key.up)) {
@@ -290,7 +290,7 @@ handleInput(data: string) {
290
290
  **Critical:** Each line from `render()` must not exceed the `width` parameter.
291
291
 
292
292
  ```typescript
293
- import { visibleWidth, truncateToWidth } from "@mariozechner/pi-tui";
293
+ import { visibleWidth, truncateToWidth } from "@draht/tui";
294
294
 
295
295
  render(width: number): string[] {
296
296
  // Truncate long lines
@@ -311,7 +311,7 @@ Example: Interactive selector
311
311
  import {
312
312
  matchesKey, Key,
313
313
  truncateToWidth, visibleWidth
314
- } from "@mariozechner/pi-tui";
314
+ } from "@draht/tui";
315
315
 
316
316
  class MySelector {
317
317
  private items: string[];
@@ -425,8 +425,8 @@ renderResult(result, options, theme) {
425
425
  **For Markdown**, use `getMarkdownTheme()`:
426
426
 
427
427
  ```typescript
428
- import { getMarkdownTheme } from "@mariozechner/pi-coding-agent";
429
- import { Markdown } from "@mariozechner/pi-tui";
428
+ import { getMarkdownTheme } from "@draht/coding-agent";
429
+ import { Markdown } from "@draht/tui";
430
430
 
431
431
  renderResult(result, options, theme) {
432
432
  const mdTheme = getMarkdownTheme();
@@ -587,12 +587,12 @@ These patterns cover the most common UI needs in extensions. **Copy these patter
587
587
 
588
588
  ### Pattern 1: Selection Dialog (SelectList)
589
589
 
590
- For letting users pick from a list of options. Use `SelectList` from `@mariozechner/pi-tui` with `DynamicBorder` for framing.
590
+ For letting users pick from a list of options. Use `SelectList` from `@draht/tui` with `DynamicBorder` for framing.
591
591
 
592
592
  ```typescript
593
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
594
- import { DynamicBorder } from "@mariozechner/pi-coding-agent";
595
- import { Container, type SelectItem, SelectList, Text } from "@mariozechner/pi-tui";
593
+ import type { ExtensionAPI } from "@draht/coding-agent";
594
+ import { DynamicBorder } from "@draht/coding-agent";
595
+ import { Container, type SelectItem, SelectList, Text } from "@draht/tui";
596
596
 
597
597
  pi.registerCommand("pick", {
598
598
  handler: async (_args, ctx) => {
@@ -650,7 +650,7 @@ pi.registerCommand("pick", {
650
650
  For operations that take time and should be cancellable. `BorderedLoader` shows a spinner and handles escape to cancel.
651
651
 
652
652
  ```typescript
653
- import { BorderedLoader } from "@mariozechner/pi-coding-agent";
653
+ import { BorderedLoader } from "@draht/coding-agent";
654
654
 
655
655
  pi.registerCommand("fetch", {
656
656
  handler: async (_args, ctx) => {
@@ -679,11 +679,11 @@ pi.registerCommand("fetch", {
679
679
 
680
680
  ### Pattern 3: Settings/Toggles (SettingsList)
681
681
 
682
- For toggling multiple settings. Use `SettingsList` from `@mariozechner/pi-tui` with `getSettingsListTheme()`.
682
+ For toggling multiple settings. Use `SettingsList` from `@draht/tui` with `getSettingsListTheme()`.
683
683
 
684
684
  ```typescript
685
- import { getSettingsListTheme } from "@mariozechner/pi-coding-agent";
686
- import { Container, type SettingItem, SettingsList, Text } from "@mariozechner/pi-tui";
685
+ import { getSettingsListTheme } from "@draht/coding-agent";
686
+ import { Container, type SettingItem, SettingsList, Text } from "@draht/tui";
687
687
 
688
688
  pi.registerCommand("settings", {
689
689
  handler: async (_args, ctx) => {
@@ -792,8 +792,8 @@ Token stats available via `ctx.sessionManager.getBranch()` and `ctx.model`.
792
792
  Replace the main input editor with a custom implementation. Useful for modal editing (vim), different keybindings (emacs), or specialized input handling.
793
793
 
794
794
  ```typescript
795
- import { CustomEditor, type ExtensionAPI } from "@mariozechner/pi-coding-agent";
796
- import { matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
795
+ import { CustomEditor, type ExtensionAPI } from "@draht/coding-agent";
796
+ import { matchesKey, truncateToWidth } from "@draht/tui";
797
797
 
798
798
  type Mode = "normal" | "insert";
799
799
 
@@ -9,7 +9,7 @@ Example extensions for pi-coding-agent.
9
9
  pi --extension examples/extensions/permission-gate.ts
10
10
 
11
11
  # Or copy to extensions directory for auto-discovery
12
- cp permission-gate.ts ~/.pi/agent/extensions/
12
+ cp permission-gate.ts ~/.draht/agent/extensions/
13
13
  ```
14
14
 
15
15
  ## Examples
@@ -33,6 +33,7 @@ cp permission-gate.ts ~/.pi/agent/extensions/
33
33
  | `question.ts` | Demonstrates `ctx.ui.select()` for asking the user questions with custom UI |
34
34
  | `questionnaire.ts` | Multi-question input with tab bar navigation between questions |
35
35
  | `tool-override.ts` | Override built-in tools (e.g., add logging/access control to `read`) |
36
+ | `dynamic-tools.ts` | Register tools after startup (`session_start`) and at runtime via command, with prompt snippets and tool-specific prompt guidelines |
36
37
  | `built-in-tool-renderer.ts` | Custom compact rendering for built-in tools (read, bash, edit, write) while keeping original behavior |
37
38
  | `minimal-mode.ts` | Override built-in tool rendering for minimal display (only tool calls, no output in collapsed mode) |
38
39
  | `truncated-tool.ts` | Wraps ripgrep with proper output truncation (50KB/2000 lines) |
@@ -91,7 +92,7 @@ cp permission-gate.ts ~/.pi/agent/extensions/
91
92
 
92
93
  | Extension | Description |
93
94
  |-----------|-------------|
94
- | `mac-system-theme.ts` | Syncs pi theme with macOS dark/light mode |
95
+ | `mac-system-theme.ts` | Syncs draht theme with macOS dark/light mode |
95
96
 
96
97
  ### Resources
97
98
 
@@ -133,7 +134,7 @@ cp permission-gate.ts ~/.pi/agent/extensions/
133
134
  See [docs/extensions.md](../../docs/extensions.md) for full documentation.
134
135
 
135
136
  ```typescript
136
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
137
+ import type { ExtensionAPI } from "@draht/coding-agent";
137
138
  import { Type } from "@sinclair/typebox";
138
139
 
139
140
  export default function (pi: ExtensionAPI) {
@@ -175,7 +176,7 @@ export default function (pi: ExtensionAPI) {
175
176
 
176
177
  **Use StringEnum for string parameters** (required for Google API compatibility):
177
178
  ```typescript
178
- import { StringEnum } from "@mariozechner/pi-ai";
179
+ import { StringEnum } from "@draht/ai";
179
180
 
180
181
  // Good
181
182
  action: StringEnum(["list", "add"] as const)
@@ -49,8 +49,10 @@ type SaveMode = (typeof SAVE_MODES)[number];
49
49
 
50
50
  const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
51
51
 
52
+ const DEFAULT_ANTIGRAVITY_VERSION = "1.18.3";
53
+
52
54
  const ANTIGRAVITY_HEADERS = {
53
- "User-Agent": "antigravity/1.15.8 darwin/arm64",
55
+ "User-Agent": `antigravity/${process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION} darwin/arm64`,
54
56
  "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
55
57
  "Client-Metadata": JSON.stringify({
56
58
  ideType: "IDE_UNSPECIFIED",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.6.3",
9
+ "version": "1.7.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.6.3",
4
+ "version": "1.7.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.6.3",
4
+ "version": "1.7.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-qwen-cli",
3
3
  "private": true,
4
- "version": "1.5.3",
4
+ "version": "1.6.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -43,4 +43,4 @@ Height is calculated from width to maintain DOOM's 3.2:1 aspect ratio (accountin
43
43
 
44
44
  - [id Software](https://github.com/id-Software/DOOM) for the original DOOM
45
45
  - [doomgeneric](https://github.com/ozkl/doomgeneric) for the portable DOOM implementation
46
- - [pi-doom](https://github.com/badlogic/pi-doom) for the original pi integration
46
+ - [pi-doom](https://github.com/badlogic/pi-doom) for the original draht integration
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/draht-dev/draht/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
3
3
  "name": "dynamic-resources",
4
4
  "vars": {
5
5
  "cyan": "#00d7ff",
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Dynamic Tools Extension
3
+ *
4
+ * Demonstrates registering tools after session initialization.
5
+ *
6
+ * - Registers one tool during session_start
7
+ * - Registers additional tools at runtime via /add-echo-tool <name>
8
+ */
9
+
10
+ import type { ExtensionAPI } from "@draht/coding-agent";
11
+ import { Type } from "@sinclair/typebox";
12
+
13
+ const ECHO_PARAMS = Type.Object({
14
+ message: Type.String({ description: "Message to echo" }),
15
+ });
16
+
17
+ function normalizeToolName(input: string): string | undefined {
18
+ const trimmed = input.trim().toLowerCase();
19
+ if (!trimmed) return undefined;
20
+ if (!/^[a-z0-9_]+$/.test(trimmed)) return undefined;
21
+ return trimmed;
22
+ }
23
+
24
+ export default function dynamicToolsExtension(pi: ExtensionAPI) {
25
+ const registeredToolNames = new Set<string>();
26
+
27
+ const registerEchoTool = (name: string, label: string, prefix: string): boolean => {
28
+ if (registeredToolNames.has(name)) {
29
+ return false;
30
+ }
31
+
32
+ registeredToolNames.add(name);
33
+ pi.registerTool({
34
+ name,
35
+ label,
36
+ description: `Echo a message with prefix: ${prefix}`,
37
+ promptSnippet: `Echo back user-provided text with ${prefix.trim()} prefix`,
38
+ promptGuidelines: ["Use this tool when the user asks for exact echo output."],
39
+ parameters: ECHO_PARAMS,
40
+ async execute(_toolCallId, params) {
41
+ return {
42
+ content: [{ type: "text", text: `${prefix}${params.message}` }],
43
+ details: { tool: name, prefix },
44
+ };
45
+ },
46
+ });
47
+
48
+ return true;
49
+ };
50
+
51
+ pi.on("session_start", (_event, ctx) => {
52
+ registerEchoTool("echo_session", "Echo Session", "[session] ");
53
+ ctx.ui.notify("Registered dynamic tool: echo_session", "info");
54
+ });
55
+
56
+ pi.registerCommand("add-echo-tool", {
57
+ description: "Register a new echo tool dynamically: /add-echo-tool <tool_name>",
58
+ handler: async (args, ctx) => {
59
+ const toolName = normalizeToolName(args);
60
+ if (!toolName) {
61
+ ctx.ui.notify("Usage: /add-echo-tool <tool_name> (lowercase, numbers, underscores)", "warning");
62
+ return;
63
+ }
64
+
65
+ const created = registerEchoTool(toolName, `Echo ${toolName}`, `[${toolName}] `);
66
+ if (!created) {
67
+ ctx.ui.notify(`Tool already registered: ${toolName}`, "warning");
68
+ return;
69
+ }
70
+
71
+ ctx.ui.notify(`Registered dynamic tool: ${toolName}`, "info");
72
+ },
73
+ });
74
+ }
@@ -35,20 +35,20 @@ From the repository root, symlink the files:
35
35
 
36
36
  ```bash
37
37
  # Symlink the extension (must be in a subdirectory with index.ts)
38
- mkdir -p ~/.pi/agent/extensions/subagent
39
- ln -sf "$(pwd)/packages/coding-agent/examples/extensions/subagent/index.ts" ~/.pi/agent/extensions/subagent/index.ts
40
- ln -sf "$(pwd)/packages/coding-agent/examples/extensions/subagent/agents.ts" ~/.pi/agent/extensions/subagent/agents.ts
38
+ mkdir -p ~/.draht/agent/extensions/subagent
39
+ ln -sf "$(pwd)/packages/coding-agent/examples/extensions/subagent/index.ts" ~/.draht/agent/extensions/subagent/index.ts
40
+ ln -sf "$(pwd)/packages/coding-agent/examples/extensions/subagent/agents.ts" ~/.draht/agent/extensions/subagent/agents.ts
41
41
 
42
42
  # Symlink agents
43
- mkdir -p ~/.pi/agent/agents
43
+ mkdir -p ~/.draht/agent/agents
44
44
  for f in packages/coding-agent/examples/extensions/subagent/agents/*.md; do
45
- ln -sf "$(pwd)/$f" ~/.pi/agent/agents/$(basename "$f")
45
+ ln -sf "$(pwd)/$f" ~/.draht/agent/agents/$(basename "$f")
46
46
  done
47
47
 
48
48
  # Symlink workflow prompts
49
- mkdir -p ~/.pi/agent/prompts
49
+ mkdir -p ~/.draht/agent/prompts
50
50
  for f in packages/coding-agent/examples/extensions/subagent/prompts/*.md; do
51
- ln -sf "$(pwd)/$f" ~/.pi/agent/prompts/$(basename "$f")
51
+ ln -sf "$(pwd)/$f" ~/.draht/agent/prompts/$(basename "$f")
52
52
  done
53
53
  ```
54
54
 
@@ -56,9 +56,9 @@ done
56
56
 
57
57
  This tool executes a separate `pi` subprocess with a delegated system prompt and tool/model configuration.
58
58
 
59
- **Project-local agents** (`.pi/agents/*.md`) are repo-controlled prompts that can instruct the model to read files, run bash commands, etc.
59
+ **Project-local agents** (`.draht/agents/*.md`) are repo-controlled prompts that can instruct the model to read files, run bash commands, etc.
60
60
 
61
- **Default behavior:** Only loads **user-level agents** from `~/.pi/agent/agents`.
61
+ **Default behavior:** Only loads **user-level agents** from `~/.draht/agent/agents`.
62
62
 
63
63
  To enable project-local agents, pass `agentScope: "both"` (or `"project"`). Only do this for repositories you trust.
64
64
 
@@ -136,8 +136,8 @@ System prompt for the agent goes here.
136
136
  ```
137
137
 
138
138
  **Locations:**
139
- - `~/.pi/agent/agents/*.md` - User-level (always loaded)
140
- - `.pi/agents/*.md` - Project-level (only with `agentScope: "project"` or `"both"`)
139
+ - `~/.draht/agent/agents/*.md` - User-level (always loaded)
140
+ - `.draht/agents/*.md` - Project-level (only with `agentScope: "project"` or `"both"`)
141
141
 
142
142
  Project agents override user agents with the same name when `agentScope: "both"`.
143
143
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "1.19.3",
3
+ "version": "1.20.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "1.19.3",
9
+ "version": "1.20.0",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "1.19.3",
4
+ "version": "1.20.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -29,7 +29,7 @@ npx tsx examples/sdk/01-minimal.ts
29
29
  ## Quick Reference
30
30
 
31
31
  ```typescript
32
- import { getModel } from "@mariozechner/pi-ai";
32
+ import { getModel } from "@draht/ai";
33
33
  import {
34
34
  AuthStorage,
35
35
  createAgentSession,
@@ -40,7 +40,7 @@ import {
40
40
  codingTools,
41
41
  readOnlyTools,
42
42
  readTool, bashTool, editTool, writeTool,
43
- } from "@mariozechner/pi-coding-agent";
43
+ } from "@draht/coding-agent";
44
44
 
45
45
  // Auth and models setup
46
46
  const authStorage = AuthStorage.create();
@@ -111,7 +111,7 @@ await session.prompt("Hello");
111
111
  | `authStorage` | `AuthStorage.create()` | Credential storage |
112
112
  | `modelRegistry` | `new ModelRegistry(authStorage)` | Model registry |
113
113
  | `cwd` | `process.cwd()` | Working directory |
114
- | `agentDir` | `~/.pi/agent` | Config directory |
114
+ | `agentDir` | `~/.draht/agent` | Config directory |
115
115
  | `model` | From settings/first available | Model to use |
116
116
  | `thinkingLevel` | From settings/"off" | off, low, medium, high |
117
117
  | `tools` | `codingTools` | Built-in tools |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draht/coding-agent",
3
- "version": "2026.3.2",
3
+ "version": "2026.3.4",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drahtConfig": {
@@ -8,6 +8,7 @@
8
8
  "configDir": ".draht"
9
9
  },
10
10
  "bin": {
11
+ "coding-agent": "dist/cli.js",
11
12
  "draht": "dist/cli.js",
12
13
  "draht-tools": "bin/draht-tools.cjs"
13
14
  },
@@ -29,7 +30,7 @@
29
30
  "examples",
30
31
  "prompts",
31
32
  "hooks",
32
- "extensions",
33
+ "agents",
33
34
  "bin",
34
35
  "CHANGELOG.md"
35
36
  ],
@@ -38,16 +39,16 @@
38
39
  "dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
39
40
  "build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js && bun run copy-assets",
40
41
  "build:binary": "bun run build && bun build --compile ./dist/cli.js --outfile dist/pi && bun run copy-binary-assets",
41
- "copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/ && shx rm -rf dist/prompts dist/hooks dist/extensions && shx cp -r prompts dist/prompts && shx cp -r hooks dist/hooks && shx cp -r extensions dist/extensions",
42
- "copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp -r prompts dist/ && shx cp -r hooks dist/ && shx cp -r extensions dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
42
+ "copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/ && shx rm -rf dist/prompts dist/hooks dist/agents && shx cp -r prompts dist/prompts && shx cp -r hooks dist/hooks && shx cp -r agents dist/agents",
43
+ "copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp -r prompts dist/ && shx cp -r hooks dist/ && shx cp -r agents dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
43
44
  "test": "vitest --run",
44
45
  "prepublishOnly": "bun run clean && bun run build"
45
46
  },
46
47
  "dependencies": {
47
48
  "@mariozechner/jiti": "^2.6.2",
48
- "@draht/agent-core": "workspace:*",
49
- "@draht/ai": "workspace:*",
50
- "@draht/tui": "workspace:*",
49
+ "@draht/agent-core": "2026.3.4",
50
+ "@draht/ai": "2026.3.4",
51
+ "@draht/tui": "2026.3.4",
51
52
  "@silvia-odwyer/photon-node": "^0.3.4",
52
53
  "chalk": "^5.5.0",
53
54
  "cli-highlight": "^2.1.11",
@@ -60,6 +61,8 @@
60
61
  "marked": "^15.0.12",
61
62
  "minimatch": "^10.2.3",
62
63
  "proper-lockfile": "^4.1.2",
64
+ "strip-ansi": "^7.1.0",
65
+ "undici": "^7.19.1",
63
66
  "yaml": "^2.8.2"
64
67
  },
65
68
  "overrides": {
@@ -96,7 +99,7 @@
96
99
  },
97
100
  "repository": {
98
101
  "type": "git",
99
- "url": "git+https://github.com/badlogic/pi-mono.git",
102
+ "url": "git+https://github.com/draht-dev/draht.git",
100
103
  "directory": "packages/coding-agent"
101
104
  },
102
105
  "engines": {
@@ -8,12 +8,12 @@ Capture implementation decisions before planning a phase.
8
8
  ```
9
9
 
10
10
  ## Steps
11
- 1. Run `draht phase-info N` to load phase context
11
+ 1. Run `draht-tools phase-info N` to load phase context
12
12
  2. Identify gray areas based on what's being built
13
13
  3. Present 1-2 questions at a time about preferences
14
14
  4. If `.planning/DOMAIN.md` exists, load it and validate discovered terms against the glossary. Add any new domain terms found during discussion.
15
- 5. Record decisions with `draht save-context N`
16
- 6. Commit: `draht commit-docs "capture phase N context"`
15
+ 5. Record decisions with `draht-tools save-context N`
16
+ 6. Commit: `draht-tools commit-docs "capture phase N context"`
17
17
 
18
18
  ## Gray Area Categories
19
19
  - **Visual features** → Layout, density, interactions, empty states
@@ -8,36 +8,36 @@ Execute all plans in a phase with atomic commits.
8
8
  ```
9
9
 
10
10
  ## Steps
11
- 1. Run `draht discover-plans N` to find and order plans
11
+ 1. Run `draht-tools discover-plans N` to find and order plans
12
12
  2. For each plan in dependency order:
13
- a. Load plan: `draht read-plan N P`
13
+ a. Load plan: `draht-tools read-plan N P`
14
14
  b. Execute each task in strict TDD cycle:
15
15
 
16
16
  **🔴 RED — Write failing tests first**
17
17
  - Write the test cases from `<test>`
18
18
  - Run tests — confirm they FAIL (if they pass, the test is wrong)
19
- - Commit failing tests: `draht commit-task N P T "red: test description"`
19
+ - Commit failing tests: `draht-tools commit-task N P T "red: test description"`
20
20
 
21
21
  **🟢 GREEN — Minimal implementation**
22
22
  - Write the minimum code from `<action>` to make tests pass
23
23
  - Use domain language from `<context>` and `<domain>` for all names
24
24
  - Run tests — confirm they PASS
25
- - Commit: `draht commit-task N P T "green: task name"`
25
+ - Commit: `draht-tools commit-task N P T "green: task name"`
26
26
 
27
27
  **🔵 REFACTOR — Clean up with safety net**
28
28
  - Apply improvements from `<refactor>` (if any)
29
29
  - Run tests after each change — must stay green
30
30
  - Verify domain language compliance (names match DOMAIN.md)
31
- - Commit: `draht commit-task N P T "refactor: description"`
31
+ - Commit: `draht-tools commit-task N P T "refactor: description"`
32
32
 
33
33
  **✅ VERIFY**
34
34
  - Run the `<verify>` step
35
35
  - Confirm `<done>` criteria met
36
36
 
37
- c. Write summary: `draht write-summary N P`
38
- 3. Phase verification: `draht verify-phase N`
39
- 4. Update state: `draht update-state`
40
- 5. Final commit: `draht commit-docs "complete phase N execution"`
37
+ c. Write summary: `draht-tools write-summary N P`
38
+ 3. Phase verification: `draht-tools verify-phase N`
39
+ 4. Update state: `draht-tools update-state`
40
+ 5. Final commit: `draht-tools commit-docs "complete phase N execution"`
41
41
 
42
42
  ## TDD Rules
43
43
  - Never write implementation before a failing test exists
@@ -0,0 +1,29 @@
1
+ # /fix
2
+
3
+ Diagnose and fix a specific bug or failing task with TDD discipline.
4
+
5
+ ## Usage
6
+ ```
7
+ /fix [description of what's broken]
8
+ ```
9
+
10
+ ## Steps
11
+ 1. **Diagnose**: Read the relevant code and error output to identify the root cause
12
+ - If a test is failing, run it first to see the actual error
13
+ - If a runtime bug, reproduce it and capture the error
14
+ 2. **Write a reproducing test**: Before touching any implementation:
15
+ - Write a test that demonstrates the bug (it must fail)
16
+ - Commit: `draht-tools commit-docs "red: reproduce bug"`
17
+ 3. **Minimal fix**: Write the smallest change that makes the test pass
18
+ - Do not refactor or add features — just fix the bug
19
+ - Run the full test suite to check for regressions
20
+ - Commit: `draht-tools commit-docs "green: fix description"`
21
+ 4. **Refactor** (if needed): Clean up without changing behavior
22
+ - Tests must stay green after every change
23
+ - Commit: `draht-tools commit-docs "refactor: description"`
24
+ 5. **Update state**: `draht-tools update-state`
25
+
26
+ ## Rules
27
+ - Always reproduce before fixing — a fix without a test is a guess
28
+ - One bug, one fix, one commit. Do not bundle unrelated changes.
29
+ - If the root cause spans multiple files, explain the chain in the commit message
@@ -0,0 +1,49 @@
1
+ # /init-project
2
+
3
+ Initialize GSD planning framework for an existing project: codebase mapping → questioning → domain model → requirements → roadmap.
4
+
5
+ ## Usage
6
+ ```
7
+ /init-project [focus area or goal]
8
+ ```
9
+
10
+ Use this when you have an existing codebase and want to add GSD methodology.
11
+ For greenfield projects, use `/new-project` instead.
12
+
13
+ ## Steps
14
+ 1. Run `draht-tools init` to check preconditions (git repo, etc.)
15
+ 2. Run `draht-tools map-codebase` to build a structural map of the existing code
16
+ 3. Analyze the codebase map to understand architecture, tech stack, and conventions
17
+ 4. Deep questioning phase (3-7 rounds, 1-2 questions at a time):
18
+ - What is this project? Who uses it?
19
+ - What are the current pain points or goals?
20
+ - What is MVP vs aspirational scope?
21
+ - What constraints exist (infra, team size, deadlines)?
22
+ 5. Run `draht-tools create-project` with gathered info
23
+ 6. Run `draht-tools create-domain-model` to define bounded contexts, entities, and ubiquitous language
24
+ 7. Create `.planning/DOMAIN.md` with:
25
+ - `## Bounded Contexts` — each context with name, responsibility, and brief description
26
+ - `## Ubiquitous Language` — glossary of domain terms agreed with the user (term → definition)
27
+ - `## Context Map` — how bounded contexts relate to each other (upstream/downstream, shared kernel, ACL)
28
+ - `## Aggregates` — aggregates and their root entities per context
29
+ - `## Domain Events` — named events that cross context boundaries
30
+ 8. Create `.planning/TEST-STRATEGY.md` with:
31
+ - `## Test Framework` — chosen framework and rationale
32
+ - `## Directory Conventions` — where test files live relative to source
33
+ - `## Coverage Goals` — target coverage percentage and which paths are critical
34
+ - `## Testing Levels` — what is tested at unit level vs integration vs e2e, with examples
35
+ - `## Excluded` — what is explicitly not tested and why (config files, generated code, etc.)
36
+ 9. Optional research phase via `draht-tools research`
37
+ 10. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
38
+ 11. Run `draht-tools create-roadmap` with phases
39
+ 12. Run `draht-tools init-state`
40
+ 13. Git commit via `draht-tools commit-docs "initialize GSD planning"`
41
+
42
+ ## Rules
43
+ - Ask 1-2 questions at a time, never dump 10 at once
44
+ - Follow threads based on answers
45
+ - Use examples ("Like Stripe Checkout, or custom?")
46
+ - Confirm, don't assume
47
+ - 3-7 follow-up rounds typical
48
+ - Respect what already exists — do not propose rewriting working code
49
+ - Stop when you have: current state, goals, MVP scope, constraints, success criteria
@@ -8,7 +8,7 @@ Analyze existing codebase before planning.
8
8
  ```
9
9
 
10
10
  ## Steps
11
- 1. Run `draht map-codebase [dir]`
11
+ 1. Run `draht-tools map-codebase [dir]`
12
12
  2. Tool generates: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md
13
13
  3. Review output, supplement with your own analysis if needed
14
14
  4. Identify implicit bounded contexts from directory structure:
@@ -29,4 +29,4 @@ Analyze existing codebase before planning.
29
29
  - Existing coverage configuration and goals (if any)
30
30
  - Which layers have tests today (unit, integration, e2e)
31
31
  - Gaps and recommendations
32
- 8. Commit: `draht commit-docs "map existing codebase"`
32
+ 8. Commit: `draht-tools commit-docs "map existing codebase"`