@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.
- package/CHANGELOG.md +194 -13
- package/README.md +90 -106
- package/agents/architect.md +45 -0
- package/agents/debugger.md +57 -0
- package/agents/git-committer.md +46 -0
- package/agents/implementer.md +25 -0
- package/agents/reviewer.md +52 -0
- package/agents/security-auditor.md +61 -0
- package/agents/verifier.md +44 -0
- package/bin/draht-tools.cjs +20 -20
- package/dist/agents/architect.md +45 -0
- package/dist/agents/debugger.md +57 -0
- package/dist/agents/git-committer.md +46 -0
- package/dist/agents/implementer.md +25 -0
- package/dist/agents/reviewer.md +52 -0
- package/dist/agents/security-auditor.md +61 -0
- package/dist/agents/verifier.md +44 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +0 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -14
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +14 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +167 -49
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +2 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/builtins/subagent.d.ts +14 -0
- package/dist/core/builtins/subagent.d.ts.map +1 -0
- package/dist/core/builtins/subagent.js +492 -0
- package/dist/core/builtins/subagent.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +4 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +6 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +19 -8
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-registry.d.ts +1 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +9 -6
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +35 -5
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resource-loader.d.ts +2 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +5 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +4 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts +4 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +34 -12
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -5
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +3 -3
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +5 -2
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +9 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +1 -1
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +28 -3
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +11 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +28 -27
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +5 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/prompts/commands/discuss-phase.md +3 -3
- package/dist/prompts/commands/execute-phase.md +9 -9
- package/dist/prompts/commands/fix.md +29 -0
- package/dist/prompts/commands/init-project.md +49 -0
- package/dist/prompts/commands/map-codebase.md +2 -2
- package/dist/prompts/commands/new-project.md +9 -9
- package/dist/prompts/commands/next-milestone.md +44 -0
- package/dist/prompts/commands/pause-work.md +2 -2
- package/dist/prompts/commands/plan-phase.md +5 -5
- package/dist/prompts/commands/progress.md +1 -1
- package/dist/prompts/commands/quick.md +4 -4
- package/dist/prompts/commands/resume-work.md +1 -1
- package/dist/prompts/commands/review.md +26 -0
- package/dist/prompts/commands/verify-work.md +4 -4
- package/docs/compaction.md +14 -14
- package/docs/custom-provider.md +19 -11
- package/docs/development.md +1 -1
- package/docs/extensions.md +52 -33
- package/docs/json.md +4 -4
- package/docs/packages.md +1 -1
- package/docs/providers.md +4 -2
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +24 -24
- package/docs/session.md +6 -6
- package/docs/settings.md +1 -0
- package/docs/termux.md +1 -1
- package/docs/themes.md +2 -2
- package/docs/tui.md +20 -20
- package/examples/extensions/README.md +5 -4
- package/examples/extensions/antigravity-image-gen.ts +3 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/doom-overlay/README.md +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/subagent/README.md +11 -11
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/README.md +3 -3
- package/package.json +11 -8
- package/prompts/commands/discuss-phase.md +3 -3
- package/prompts/commands/execute-phase.md +9 -9
- package/prompts/commands/fix.md +29 -0
- package/prompts/commands/init-project.md +49 -0
- package/prompts/commands/map-codebase.md +2 -2
- package/prompts/commands/new-project.md +9 -9
- package/prompts/commands/next-milestone.md +44 -0
- package/prompts/commands/pause-work.md +2 -2
- package/prompts/commands/plan-phase.md +5 -5
- package/prompts/commands/progress.md +1 -1
- package/prompts/commands/quick.md +4 -4
- package/prompts/commands/resume-work.md +1 -1
- package/prompts/commands/review.md +26 -0
- package/prompts/commands/verify-work.md +4 -4
- package/dist/extensions/gsd-commands.ts +0 -338
- package/dist/extensions/subagent.ts +0 -312
- package/extensions/gsd-commands.ts +0 -338
- package/extensions/subagent.ts +0 -312
package/README.md
CHANGED
|
@@ -1,32 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">@draht/coding-agent</h1>
|
|
2
2
|
|
|
3
|
-
**Issue tracker and PRs reopen March 2, 2026.**
|
|
4
|
-
|
|
5
|
-
All PRs will be auto-closed until then. Approved contributors can submit PRs after vacation without reapproval. For support, join [Discord](https://discord.com/invite/3cU7Bz4UPx).
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
<a href="https://shittycodingagent.ai">
|
|
11
|
-
<img src="https://shittycodingagent.ai/logo.svg" alt="pi logo" width="128">
|
|
12
|
-
</a>
|
|
13
|
-
</p>
|
|
14
|
-
<p align="center">
|
|
15
|
-
<a href="https://discord.com/invite/3cU7Bz4UPx"><img alt="Discord" src="https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white" /></a>
|
|
16
|
-
<a href="https://www.npmjs.com/package/@mariozechner/pi-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@mariozechner/pi-coding-agent?style=flat-square" /></a>
|
|
17
|
-
<a href="https://github.com/badlogic/pi-mono/actions/workflows/ci.yml"><img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/badlogic/pi-mono/ci.yml?style=flat-square&branch=main" /></a>
|
|
18
|
-
</p>
|
|
19
3
|
<p align="center">
|
|
20
|
-
<a href="https://
|
|
21
|
-
<
|
|
22
|
-
<a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
|
|
4
|
+
<a href="https://www.npmjs.com/package/@draht/coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@draht/coding-agent?style=flat-square" /></a>
|
|
5
|
+
<a href="https://github.com/draht-dev/draht/actions/workflows/ci.yml"><img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/draht-dev/draht/ci.yml?style=flat-square&branch=main" /></a>
|
|
23
6
|
</p>
|
|
24
7
|
|
|
25
|
-
|
|
8
|
+
Draht is a minimal terminal coding harness. Adapt it to your workflows, not the other way around, without having to fork and modify internals. Extend it with TypeScript [Extensions](#extensions), [Skills](#skills), [Prompt Templates](#prompt-templates), and [Themes](#themes). Put your extensions, skills, prompt templates, and themes in [Draht Packages](#draht-packages) and share them with others via npm or git.
|
|
26
9
|
|
|
27
|
-
|
|
10
|
+
Draht ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask draht to build what you want or install a third party package that matches your workflow.
|
|
28
11
|
|
|
29
|
-
|
|
12
|
+
Draht runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps.
|
|
30
13
|
|
|
31
14
|
## Table of Contents
|
|
32
15
|
|
|
@@ -47,7 +30,7 @@ Pi runs in four modes: interactive, print or JSON, RPC for process integration,
|
|
|
47
30
|
- [Skills](#skills)
|
|
48
31
|
- [Extensions](#extensions)
|
|
49
32
|
- [Themes](#themes)
|
|
50
|
-
- [
|
|
33
|
+
- [Draht Packages](#draht-packages)
|
|
51
34
|
- [Programmatic Usage](#programmatic-usage)
|
|
52
35
|
- [Philosophy](#philosophy)
|
|
53
36
|
- [CLI Reference](#cli-reference)
|
|
@@ -57,24 +40,24 @@ Pi runs in four modes: interactive, print or JSON, RPC for process integration,
|
|
|
57
40
|
## Quick Start
|
|
58
41
|
|
|
59
42
|
```bash
|
|
60
|
-
|
|
43
|
+
bun add -g @draht/coding-agent
|
|
61
44
|
```
|
|
62
45
|
|
|
63
46
|
Authenticate with an API key:
|
|
64
47
|
|
|
65
48
|
```bash
|
|
66
49
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
67
|
-
|
|
50
|
+
draht
|
|
68
51
|
```
|
|
69
52
|
|
|
70
53
|
Or use your existing subscription:
|
|
71
54
|
|
|
72
55
|
```bash
|
|
73
|
-
|
|
56
|
+
draht
|
|
74
57
|
/login # Then select provider
|
|
75
58
|
```
|
|
76
59
|
|
|
77
|
-
Then just talk to
|
|
60
|
+
Then just talk to draht. By default, draht gives the model four tools: `read`, `write`, `edit`, and `bash`. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [draht packages](#draht-packages).
|
|
78
61
|
|
|
79
62
|
**Platform notes:** [Windows](docs/windows.md) | [Termux (Android)](docs/termux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)
|
|
80
63
|
|
|
@@ -82,7 +65,7 @@ Then just talk to pi. By default, pi gives the model four tools: `read`, `write`
|
|
|
82
65
|
|
|
83
66
|
## Providers & Models
|
|
84
67
|
|
|
85
|
-
For each built-in provider,
|
|
68
|
+
For each built-in provider,draht maintains a list of tool-capable models, updated with every release. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L).
|
|
86
69
|
|
|
87
70
|
**Subscriptions:**
|
|
88
71
|
- Anthropic Claude Pro/Max
|
|
@@ -106,13 +89,14 @@ For each built-in provider, pi maintains a list of tool-capable models, updated
|
|
|
106
89
|
- Vercel AI Gateway
|
|
107
90
|
- ZAI
|
|
108
91
|
- OpenCode Zen
|
|
92
|
+
- OpenCode Go
|
|
109
93
|
- Hugging Face
|
|
110
94
|
- Kimi For Coding
|
|
111
95
|
- MiniMax
|
|
112
96
|
|
|
113
97
|
See [docs/providers.md](docs/providers.md) for detailed setup instructions.
|
|
114
98
|
|
|
115
|
-
**Custom providers & models:** Add providers via `~/.
|
|
99
|
+
**Custom providers & models:** Add providers via `~/.draht/agent/models.json` if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See [docs/models.md](docs/models.md) and [docs/custom-provider.md](docs/custom-provider.md).
|
|
116
100
|
|
|
117
101
|
---
|
|
118
102
|
|
|
@@ -164,11 +148,11 @@ Type `/` in the editor to trigger commands. [Extensions](#extensions) can regist
|
|
|
164
148
|
| `/reload` | Reload extensions, skills, prompts, context files (themes hot-reload automatically) |
|
|
165
149
|
| `/hotkeys` | Show all keyboard shortcuts |
|
|
166
150
|
| `/changelog` | Display version history |
|
|
167
|
-
| `/quit`, `/exit` |
|
|
151
|
+
| `/quit`, `/exit` | Quitdraht |
|
|
168
152
|
|
|
169
153
|
### Keyboard Shortcuts
|
|
170
154
|
|
|
171
|
-
See `/hotkeys` for the full list. Customize via `~/.
|
|
155
|
+
See `/hotkeys` for the full list. Customize via `~/.draht/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
|
|
172
156
|
|
|
173
157
|
**Commonly used:**
|
|
174
158
|
|
|
@@ -203,13 +187,13 @@ Sessions are stored as JSONL files with a tree structure. Each entry has an `id`
|
|
|
203
187
|
|
|
204
188
|
### Management
|
|
205
189
|
|
|
206
|
-
Sessions auto-save to `~/.
|
|
190
|
+
Sessions auto-save to `~/.draht/agent/sessions/` organized by working directory.
|
|
207
191
|
|
|
208
192
|
```bash
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
193
|
+
draht -c # Continue most recent session
|
|
194
|
+
draht -r # Browse and select from past sessions
|
|
195
|
+
draht --no-session # Ephemeral mode (don't save)
|
|
196
|
+
draht --session <path> # Use specific session file or ID
|
|
213
197
|
```
|
|
214
198
|
|
|
215
199
|
### Branching
|
|
@@ -242,8 +226,8 @@ Use `/settings` to modify common options, or edit JSON files directly:
|
|
|
242
226
|
|
|
243
227
|
| Location | Scope |
|
|
244
228
|
|----------|-------|
|
|
245
|
-
| `~/.
|
|
246
|
-
| `.
|
|
229
|
+
| `~/.draht/agent/settings.json` | Global (all projects) |
|
|
230
|
+
| `.draht/settings.json` | Project (overrides global) |
|
|
247
231
|
|
|
248
232
|
See [docs/settings.md](docs/settings.md) for all options.
|
|
249
233
|
|
|
@@ -251,8 +235,8 @@ See [docs/settings.md](docs/settings.md) for all options.
|
|
|
251
235
|
|
|
252
236
|
## Context Files
|
|
253
237
|
|
|
254
|
-
|
|
255
|
-
- `~/.
|
|
238
|
+
Draht loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
|
|
239
|
+
- `~/.draht/agent/AGENTS.md` (global)
|
|
256
240
|
- Parent directories (walking up from cwd)
|
|
257
241
|
- Current directory
|
|
258
242
|
|
|
@@ -260,7 +244,7 @@ Use for project instructions, conventions, common commands. All matching files a
|
|
|
260
244
|
|
|
261
245
|
### System Prompt
|
|
262
246
|
|
|
263
|
-
Replace the default system prompt with `.
|
|
247
|
+
Replace the default system prompt with `.draht/SYSTEM.md` (project) or `~/.draht/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
|
|
264
248
|
|
|
265
249
|
---
|
|
266
250
|
|
|
@@ -271,19 +255,19 @@ Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent
|
|
|
271
255
|
Reusable prompts as Markdown files. Type `/name` to expand.
|
|
272
256
|
|
|
273
257
|
```markdown
|
|
274
|
-
<!-- ~/.
|
|
258
|
+
<!-- ~/.draht/agent/prompts/review.md -->
|
|
275
259
|
Review this code for bugs, security issues, and performance problems.
|
|
276
260
|
Focus on: {{focus}}
|
|
277
261
|
```
|
|
278
262
|
|
|
279
|
-
Place in `~/.
|
|
263
|
+
Place in `~/.draht/agent/prompts/`, `.draht/prompts/`, or a [pi package](#draht-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).
|
|
280
264
|
|
|
281
265
|
### Skills
|
|
282
266
|
|
|
283
267
|
On-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.
|
|
284
268
|
|
|
285
269
|
```markdown
|
|
286
|
-
<!-- ~/.
|
|
270
|
+
<!-- ~/.draht/agent/skills/my-skill/SKILL.md -->
|
|
287
271
|
# My Skill
|
|
288
272
|
Use this skill when the user asks about X.
|
|
289
273
|
|
|
@@ -292,19 +276,19 @@ Use this skill when the user asks about X.
|
|
|
292
276
|
2. Then that
|
|
293
277
|
```
|
|
294
278
|
|
|
295
|
-
Place in `~/.
|
|
279
|
+
Place in `~/.draht/agent/skills/`, `~/.agents/skills/`, `.draht/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [pi package](#draht-packages) to share with others. See [docs/skills.md](docs/skills.md).
|
|
296
280
|
|
|
297
281
|
### Extensions
|
|
298
282
|
|
|
299
283
|
<p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
|
|
300
284
|
|
|
301
|
-
TypeScript modules that
|
|
285
|
+
TypeScript modules that extenddraht with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
|
|
302
286
|
|
|
303
287
|
```typescript
|
|
304
|
-
export default function (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
288
|
+
export default function (draht: ExtensionAPI) {
|
|
289
|
+
draht.registerTool({ name: "deploy", ... });
|
|
290
|
+
draht.registerCommand("stats", { ... });
|
|
291
|
+
draht.on("tool_call", async (event, ctx) => { ... });
|
|
308
292
|
}
|
|
309
293
|
```
|
|
310
294
|
|
|
@@ -318,50 +302,50 @@ export default function (pi: ExtensionAPI) {
|
|
|
318
302
|
- Git checkpointing and auto-commit
|
|
319
303
|
- SSH and sandbox execution
|
|
320
304
|
- MCP server integration
|
|
321
|
-
-
|
|
305
|
+
- Makedraht look like Claude Code
|
|
322
306
|
- Games while waiting (yes, Doom runs)
|
|
323
307
|
- ...anything you can dream up
|
|
324
308
|
|
|
325
|
-
Place in `~/.
|
|
309
|
+
Place in `~/.draht/agent/extensions/`, `.draht/extensions/`, or a [pi package](#draht-packages) to share with others. See [docs/extensions.md](docs/extensions.md) and [examples/extensions/](examples/extensions/).
|
|
326
310
|
|
|
327
311
|
### Themes
|
|
328
312
|
|
|
329
|
-
Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file
|
|
313
|
+
Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file anddraht immediately applies changes.
|
|
330
314
|
|
|
331
|
-
Place in `~/.
|
|
315
|
+
Place in `~/.draht/agent/themes/`, `.draht/themes/`, or a [pi package](#draht-packages) to share with others. See [docs/themes.md](docs/themes.md).
|
|
332
316
|
|
|
333
|
-
###
|
|
317
|
+
### Draht Packages
|
|
334
318
|
|
|
335
|
-
Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%
|
|
319
|
+
Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Adraht-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).
|
|
336
320
|
|
|
337
|
-
> **Security:**
|
|
321
|
+
> **Security:** Draht packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
|
|
338
322
|
|
|
339
323
|
```bash
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
324
|
+
draht install npm:@foo/draht-tools
|
|
325
|
+
draht install npm:@foo/draht-tools@1.2.3 # pinned version
|
|
326
|
+
draht install git:github.com/user/repo
|
|
327
|
+
draht install git:github.com/user/repo@v1 # tag or commit
|
|
328
|
+
draht install git:git@github.com:user/repo
|
|
329
|
+
draht install git:git@github.com:user/repo@v1 # tag or commit
|
|
330
|
+
draht install https://github.com/user/repo
|
|
331
|
+
draht install https://github.com/user/repo@v1 # tag or commit
|
|
332
|
+
draht install ssh://git@github.com/user/repo
|
|
333
|
+
draht install ssh://git@github.com/user/repo@v1 # tag or commit
|
|
334
|
+
draht remove npm:@foo/draht-tools
|
|
335
|
+
draht list
|
|
336
|
+
draht update # skips pinned packages
|
|
337
|
+
draht config # enable/disable extensions, skills, prompts, themes
|
|
354
338
|
```
|
|
355
339
|
|
|
356
|
-
Packages install to `~/.
|
|
340
|
+
Packages install to `~/.draht/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.draht/git/`, `.draht/npm/`).
|
|
357
341
|
|
|
358
|
-
Create a package by adding a `
|
|
342
|
+
Create a package by adding a `draht` key to `package.json`:
|
|
359
343
|
|
|
360
344
|
```json
|
|
361
345
|
{
|
|
362
|
-
"name": "my-
|
|
363
|
-
"keywords": ["
|
|
364
|
-
"
|
|
346
|
+
"name": "my-draht-package",
|
|
347
|
+
"keywords": ["draht-package"],
|
|
348
|
+
"draht": {
|
|
365
349
|
"extensions": ["./extensions"],
|
|
366
350
|
"skills": ["./skills"],
|
|
367
351
|
"prompts": ["./prompts"],
|
|
@@ -370,7 +354,7 @@ Create a package by adding a `pi` key to `package.json`:
|
|
|
370
354
|
}
|
|
371
355
|
```
|
|
372
356
|
|
|
373
|
-
Without a `
|
|
357
|
+
Without a `draht` manifest,draht auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
|
|
374
358
|
|
|
375
359
|
See [docs/packages.md](docs/packages.md).
|
|
376
360
|
|
|
@@ -381,7 +365,7 @@ See [docs/packages.md](docs/packages.md).
|
|
|
381
365
|
### SDK
|
|
382
366
|
|
|
383
367
|
```typescript
|
|
384
|
-
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@
|
|
368
|
+
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@draht/coding-agent";
|
|
385
369
|
|
|
386
370
|
const { session } = await createAgentSession({
|
|
387
371
|
sessionManager: SessionManager.inMemory(),
|
|
@@ -399,7 +383,7 @@ See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).
|
|
|
399
383
|
For non-Node.js integrations, use RPC mode over stdin/stdout:
|
|
400
384
|
|
|
401
385
|
```bash
|
|
402
|
-
|
|
386
|
+
draht --mode rpc
|
|
403
387
|
```
|
|
404
388
|
|
|
405
389
|
See [docs/rpc.md](docs/rpc.md) for the protocol.
|
|
@@ -408,11 +392,11 @@ See [docs/rpc.md](docs/rpc.md) for the protocol.
|
|
|
408
392
|
|
|
409
393
|
## Philosophy
|
|
410
394
|
|
|
411
|
-
|
|
395
|
+
Draht is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with [extensions](#extensions), [skills](#skills), or installed from third-party [pi packages](#draht-packages). This keeps the core minimal while letting you shapedraht to fit how you work.
|
|
412
396
|
|
|
413
397
|
**No MCP.** Build CLI tools with READMEs (see [Skills](#skills)), or build an extension that adds MCP support. [Why?](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/)
|
|
414
398
|
|
|
415
|
-
**No sub-agents.** There's many ways to do this.
|
|
399
|
+
**No sub-agents.** There's many ways to do this. Spawndraht instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
|
|
416
400
|
|
|
417
401
|
**No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
|
|
418
402
|
|
|
@@ -429,17 +413,17 @@ Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/)
|
|
|
429
413
|
## CLI Reference
|
|
430
414
|
|
|
431
415
|
```bash
|
|
432
|
-
|
|
416
|
+
draht [options] [@files...] [messages...]
|
|
433
417
|
```
|
|
434
418
|
|
|
435
419
|
### Package Commands
|
|
436
420
|
|
|
437
421
|
```bash
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
422
|
+
draht install <source> [-l] # Install package, -l for project-local
|
|
423
|
+
draht remove <source> [-l] # Remove package
|
|
424
|
+
draht update [source] # Update packages (skips pinned)
|
|
425
|
+
draht list # List installed packages
|
|
426
|
+
draht config # Enable/disable package resources
|
|
443
427
|
```
|
|
444
428
|
|
|
445
429
|
### Modes
|
|
@@ -512,47 +496,47 @@ Combine `--no-*` with explicit flags to load exactly what you need, ignoring set
|
|
|
512
496
|
Prefix files with `@` to include in the message:
|
|
513
497
|
|
|
514
498
|
```bash
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
499
|
+
draht @prompt.md "Answer this"
|
|
500
|
+
draht -p @screenshot.png "What's in this image?"
|
|
501
|
+
draht @code.ts @test.ts "Review these files"
|
|
518
502
|
```
|
|
519
503
|
|
|
520
504
|
### Examples
|
|
521
505
|
|
|
522
506
|
```bash
|
|
523
507
|
# Interactive with initial prompt
|
|
524
|
-
|
|
508
|
+
draht "List all .ts files in src/"
|
|
525
509
|
|
|
526
510
|
# Non-interactive
|
|
527
|
-
|
|
511
|
+
draht -p "Summarize this codebase"
|
|
528
512
|
|
|
529
513
|
# Different model
|
|
530
|
-
|
|
514
|
+
draht --provider openai --model gpt-4o "Help me refactor"
|
|
531
515
|
|
|
532
516
|
# Model with provider prefix (no --provider needed)
|
|
533
|
-
|
|
517
|
+
draht --model openai/gpt-4o "Help me refactor"
|
|
534
518
|
|
|
535
519
|
# Model with thinking level shorthand
|
|
536
|
-
|
|
520
|
+
draht --model sonnet:high "Solve this complex problem"
|
|
537
521
|
|
|
538
522
|
# Limit model cycling
|
|
539
|
-
|
|
523
|
+
draht --models "claude-*,gpt-4o"
|
|
540
524
|
|
|
541
525
|
# Read-only mode
|
|
542
|
-
|
|
526
|
+
draht --tools read,grep,find,ls -p "Review the code"
|
|
543
527
|
|
|
544
528
|
# High thinking level
|
|
545
|
-
|
|
529
|
+
draht --thinking high "Solve this complex problem"
|
|
546
530
|
```
|
|
547
531
|
|
|
548
532
|
### Environment Variables
|
|
549
533
|
|
|
550
534
|
| Variable | Description |
|
|
551
535
|
|----------|-------------|
|
|
552
|
-
| `
|
|
553
|
-
| `
|
|
554
|
-
| `
|
|
555
|
-
| `
|
|
536
|
+
| `DRAHT_CODING_AGENT_DIR` | Override config directory (default: `~/.draht/agent`) |
|
|
537
|
+
| `DRAHT_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
|
|
538
|
+
| `DRAHT_SKIP_VERSION_CHECK` | Skip version check at startup |
|
|
539
|
+
| `DRAHT_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
|
|
556
540
|
| `VISUAL`, `EDITOR` | External editor for Ctrl+G |
|
|
557
541
|
|
|
558
542
|
---
|
|
@@ -569,6 +553,6 @@ MIT
|
|
|
569
553
|
|
|
570
554
|
## See Also
|
|
571
555
|
|
|
572
|
-
- [@
|
|
573
|
-
- [@
|
|
574
|
-
- [@
|
|
556
|
+
- [@draht/ai](https://www.npmjs.com/package/@draht/ai): Core LLM toolkit
|
|
557
|
+
- [@draht/agent-core](https://www.npmjs.com/package/@draht/agent-core): Agent framework
|
|
558
|
+
- [@draht/tui](https://www.npmjs.com/package/@draht/tui): Terminal UI components
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architect
|
|
3
|
+
description: Reads codebase, analyzes requirements, and produces structured implementation plans with file lists, dependencies, and phased task breakdowns.
|
|
4
|
+
tools: read,bash,grep,find,ls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the Architect agent. Your job is to analyze requirements and produce clear, actionable implementation plans.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Understand the request** — read the task carefully, identify what is being asked
|
|
12
|
+
2. **Read the codebase** — use tools to explore relevant files, understand the current architecture, conventions, and patterns
|
|
13
|
+
3. **Identify constraints** — note existing patterns, dependencies, type systems, and conventions that must be followed
|
|
14
|
+
4. **Produce a plan** — output a structured implementation plan
|
|
15
|
+
|
|
16
|
+
## Output Format
|
|
17
|
+
|
|
18
|
+
Your plan MUST include:
|
|
19
|
+
|
|
20
|
+
### Goal
|
|
21
|
+
One sentence describing the outcome (not the activity).
|
|
22
|
+
|
|
23
|
+
### Context
|
|
24
|
+
What you learned from reading the codebase that informs the plan.
|
|
25
|
+
|
|
26
|
+
### Tasks
|
|
27
|
+
Numbered list of concrete tasks. For each task:
|
|
28
|
+
- What to do (specific, not vague)
|
|
29
|
+
- Which files to create or modify
|
|
30
|
+
- Key implementation details
|
|
31
|
+
- Dependencies on other tasks
|
|
32
|
+
|
|
33
|
+
### Risk Assessment
|
|
34
|
+
- What could go wrong
|
|
35
|
+
- What assumptions you are making
|
|
36
|
+
- What needs clarification from the user
|
|
37
|
+
|
|
38
|
+
## Rules
|
|
39
|
+
|
|
40
|
+
- DO read actual code before planning — never guess at APIs, types, or file structure
|
|
41
|
+
- DO follow existing conventions you find in the codebase
|
|
42
|
+
- DO keep plans minimal — smallest change that achieves the goal
|
|
43
|
+
- DO NOT produce code — only plans
|
|
44
|
+
- DO NOT make assumptions about APIs without reading the source
|
|
45
|
+
- DO NOT suggest removing existing functionality unless explicitly asked
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debugger
|
|
3
|
+
description: Diagnoses bugs, analyzes errors and stack traces, reproduces issues, and identifies root causes.
|
|
4
|
+
tools: read,bash,edit,write,grep,find,ls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the Debugger agent. Your job is to find and fix bugs.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Understand the problem** — read the error message, stack trace, or bug description
|
|
12
|
+
2. **Reproduce** — if possible, run the failing command or test to see the error firsthand
|
|
13
|
+
3. **Trace the cause** — follow the stack trace or logic path to find the root cause
|
|
14
|
+
4. **Read surrounding code** — understand the broader context and intent of the code
|
|
15
|
+
5. **Fix** — make the minimal change that fixes the root cause (not just the symptom)
|
|
16
|
+
6. **Verify** — run the failing command/test again to confirm the fix works
|
|
17
|
+
|
|
18
|
+
## Debugging Strategies
|
|
19
|
+
|
|
20
|
+
### Stack Traces
|
|
21
|
+
- Start from the bottom (root cause) not the top (symptom)
|
|
22
|
+
- Read each file in the trace to understand the call chain
|
|
23
|
+
- Look for incorrect assumptions about types, null values, or state
|
|
24
|
+
|
|
25
|
+
### Test Failures
|
|
26
|
+
- Read the test to understand what it expects
|
|
27
|
+
- Read the implementation to understand what it does
|
|
28
|
+
- Identify the gap between expected and actual behavior
|
|
29
|
+
|
|
30
|
+
### Type Errors
|
|
31
|
+
- Read the type definitions involved
|
|
32
|
+
- Check if types changed upstream without updating downstream consumers
|
|
33
|
+
- Look for implicit `any` or incorrect type assertions
|
|
34
|
+
|
|
35
|
+
### Runtime Errors
|
|
36
|
+
- Check for null/undefined access patterns
|
|
37
|
+
- Look for async race conditions
|
|
38
|
+
- Verify environment assumptions (env vars, file paths, dependencies)
|
|
39
|
+
|
|
40
|
+
## Output Format
|
|
41
|
+
|
|
42
|
+
### Root Cause
|
|
43
|
+
Clear explanation of why the bug occurs.
|
|
44
|
+
|
|
45
|
+
### Fix
|
|
46
|
+
What was changed and why. Reference specific files and lines.
|
|
47
|
+
|
|
48
|
+
### Verification
|
|
49
|
+
Show that the fix works (test output, command output).
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- ALWAYS reproduce the bug before attempting to fix it
|
|
54
|
+
- Fix the root cause, not the symptom
|
|
55
|
+
- Keep fixes minimal — do not refactor unrelated code
|
|
56
|
+
- If the fix is non-obvious, add a comment explaining why
|
|
57
|
+
- Run verification after fixing to confirm the issue is resolved
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-committer
|
|
3
|
+
description: Stages and commits changes with conventional commit messages. Reviews diffs before committing.
|
|
4
|
+
tools: bash,read,grep,find,ls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the Git Committer agent. Your job is to create clean, well-described git commits.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Check status** — run `git status` and `git diff --stat` to see what changed
|
|
12
|
+
2. **Review changes** — read the diffs to understand what was done
|
|
13
|
+
3. **Determine scope** — identify which package(s) or area(s) were affected
|
|
14
|
+
4. **Write commit message** — follow the conventional commit format
|
|
15
|
+
5. **Stage and commit** — stage only the relevant files, then commit
|
|
16
|
+
|
|
17
|
+
## Commit Message Format
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
type(scope): concise description
|
|
21
|
+
|
|
22
|
+
Optional body with more detail if the change is complex.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Types
|
|
26
|
+
- `feat` — new feature
|
|
27
|
+
- `fix` — bug fix
|
|
28
|
+
- `refactor` — code restructuring without behavior change
|
|
29
|
+
- `docs` — documentation only
|
|
30
|
+
- `test` — test changes
|
|
31
|
+
- `chore` — build, CI, dependencies
|
|
32
|
+
- `perf` — performance improvement
|
|
33
|
+
|
|
34
|
+
### Scopes
|
|
35
|
+
Use the package directory name (e.g., `ai`, `tui`, `agent`, `coding-agent`).
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
|
|
39
|
+
- NEVER use `git add -A` or `git add .` — always stage specific files
|
|
40
|
+
- NEVER use `git commit --no-verify`
|
|
41
|
+
- NEVER force push
|
|
42
|
+
- Review the diff before committing to ensure nothing unexpected is included
|
|
43
|
+
- One commit per logical change — split unrelated changes into separate commits
|
|
44
|
+
- Keep the first line under 72 characters
|
|
45
|
+
- No emojis in commit messages
|
|
46
|
+
- If there is a related issue, include `fixes #<number>` or `closes #<number>`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: implementer
|
|
3
|
+
description: Implements code changes based on a plan or task description. Reads existing code, writes new code, and edits files.
|
|
4
|
+
tools: read,bash,edit,write,grep,find,ls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the Implementer agent. Your job is to write code that fulfills the given task.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Understand the task** — read the task description or plan carefully
|
|
12
|
+
2. **Read existing code** — understand the codebase patterns, types, and conventions before writing
|
|
13
|
+
3. **Implement** — write or edit files to complete the task
|
|
14
|
+
4. **Verify** — run type checks or linting if applicable to catch errors early
|
|
15
|
+
|
|
16
|
+
## Rules
|
|
17
|
+
|
|
18
|
+
- ALWAYS read relevant existing code before writing — understand the patterns and conventions
|
|
19
|
+
- ALWAYS match the existing code style (naming, formatting, structure)
|
|
20
|
+
- NEVER use `any` types unless absolutely necessary
|
|
21
|
+
- NEVER use inline imports — always use standard top-level imports
|
|
22
|
+
- NEVER remove existing functionality unless the task explicitly requires it
|
|
23
|
+
- Keep changes minimal — do only what the task asks for
|
|
24
|
+
- If a task is ambiguous, implement the most conservative interpretation
|
|
25
|
+
- Run `npm run check` or equivalent after changes if the project has one
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reviewer
|
|
3
|
+
description: Reviews code changes for correctness, type safety, conventions, and potential issues.
|
|
4
|
+
tools: read,bash,grep,find,ls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the Reviewer agent. Your job is to review code changes and identify issues.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Identify changes** — use `git diff` or read the provided context to understand what changed
|
|
12
|
+
2. **Read surrounding code** — understand the broader context of the changes
|
|
13
|
+
3. **Check for issues** — evaluate against the criteria below
|
|
14
|
+
4. **Report findings** — produce a clear, prioritized list of issues
|
|
15
|
+
|
|
16
|
+
## Review Criteria
|
|
17
|
+
|
|
18
|
+
### Correctness
|
|
19
|
+
- Does the code do what it claims to do?
|
|
20
|
+
- Are there edge cases not handled?
|
|
21
|
+
- Are error cases handled properly?
|
|
22
|
+
|
|
23
|
+
### Type Safety
|
|
24
|
+
- Are types correct and specific (no unnecessary `any`)?
|
|
25
|
+
- Are type imports used where needed?
|
|
26
|
+
- Do function signatures match their usage?
|
|
27
|
+
|
|
28
|
+
### Conventions
|
|
29
|
+
- Does the code follow the project's existing patterns?
|
|
30
|
+
- Are naming conventions consistent?
|
|
31
|
+
- Is the code style consistent with surrounding code?
|
|
32
|
+
|
|
33
|
+
### Maintainability
|
|
34
|
+
- Is the code readable and self-documenting?
|
|
35
|
+
- Are there unnecessary abstractions or missing ones?
|
|
36
|
+
- Is there duplicated logic that should be extracted?
|
|
37
|
+
|
|
38
|
+
## Output Format
|
|
39
|
+
|
|
40
|
+
List findings by severity:
|
|
41
|
+
1. **Must fix** — bugs, type errors, logic errors
|
|
42
|
+
2. **Should fix** — convention violations, missing error handling
|
|
43
|
+
3. **Consider** — style suggestions, possible improvements
|
|
44
|
+
|
|
45
|
+
If no issues found, state that explicitly.
|
|
46
|
+
|
|
47
|
+
## Rules
|
|
48
|
+
|
|
49
|
+
- Be specific — reference exact file paths and line numbers
|
|
50
|
+
- Be actionable — say what to change, not just what is wrong
|
|
51
|
+
- Do not nitpick formatting if the project has a formatter
|
|
52
|
+
- Focus on substance over style
|