@duckmind/dm-linux-x64 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +3551 -0
  2. package/README.md +618 -0
  3. package/assets/clankolas.png +0 -0
  4. package/dm +0 -0
  5. package/docs/compaction.md +394 -0
  6. package/docs/custom-provider.md +596 -0
  7. package/docs/development.md +71 -0
  8. package/docs/extensions.md +2262 -0
  9. package/docs/images/doom-extension.png +0 -0
  10. package/docs/images/exy.png +0 -0
  11. package/docs/images/interactive-mode.png +0 -0
  12. package/docs/images/tree-view.png +0 -0
  13. package/docs/json.md +82 -0
  14. package/docs/keybindings.md +175 -0
  15. package/docs/models.md +392 -0
  16. package/docs/packages.md +218 -0
  17. package/docs/prompt-templates.md +67 -0
  18. package/docs/providers.md +195 -0
  19. package/docs/rpc.md +1377 -0
  20. package/docs/sdk.md +1124 -0
  21. package/docs/session.md +412 -0
  22. package/docs/settings.md +246 -0
  23. package/docs/shell-aliases.md +13 -0
  24. package/docs/skills.md +232 -0
  25. package/docs/terminal-setup.md +106 -0
  26. package/docs/termux.md +127 -0
  27. package/docs/themes.md +295 -0
  28. package/docs/tmux.md +61 -0
  29. package/docs/tree.md +231 -0
  30. package/docs/tui.md +887 -0
  31. package/docs/windows.md +17 -0
  32. package/examples/README.md +25 -0
  33. package/examples/extensions/README.md +206 -0
  34. package/examples/extensions/antigravity-image-gen.ts +418 -0
  35. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  36. package/examples/extensions/bash-spawn-hook.ts +30 -0
  37. package/examples/extensions/bookmark.ts +50 -0
  38. package/examples/extensions/built-in-tool-renderer.ts +246 -0
  39. package/examples/extensions/claude-rules.ts +86 -0
  40. package/examples/extensions/commands.ts +72 -0
  41. package/examples/extensions/confirm-destructive.ts +59 -0
  42. package/examples/extensions/custom-compaction.ts +127 -0
  43. package/examples/extensions/custom-footer.ts +64 -0
  44. package/examples/extensions/custom-header.ts +73 -0
  45. package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
  46. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  47. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  48. package/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
  49. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  50. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  51. package/examples/extensions/custom-provider-qwen-cli/index.ts +345 -0
  52. package/examples/extensions/custom-provider-qwen-cli/package.json +16 -0
  53. package/examples/extensions/dirty-repo-guard.ts +56 -0
  54. package/examples/extensions/doom-overlay/README.md +46 -0
  55. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  56. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  57. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  58. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  59. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  60. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  61. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  62. package/examples/extensions/doom-overlay/index.ts +74 -0
  63. package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  64. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  65. package/examples/extensions/dynamic-resources/dynamic.json +79 -0
  66. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  67. package/examples/extensions/dynamic-resources/index.ts +15 -0
  68. package/examples/extensions/dynamic-tools.ts +74 -0
  69. package/examples/extensions/event-bus.ts +43 -0
  70. package/examples/extensions/file-trigger.ts +41 -0
  71. package/examples/extensions/git-checkpoint.ts +53 -0
  72. package/examples/extensions/handoff.ts +153 -0
  73. package/examples/extensions/hello.ts +26 -0
  74. package/examples/extensions/hidden-thinking-label.ts +53 -0
  75. package/examples/extensions/inline-bash.ts +94 -0
  76. package/examples/extensions/input-transform.ts +43 -0
  77. package/examples/extensions/interactive-shell.ts +196 -0
  78. package/examples/extensions/mac-system-theme.ts +47 -0
  79. package/examples/extensions/message-renderer.ts +59 -0
  80. package/examples/extensions/minimal-mode.ts +426 -0
  81. package/examples/extensions/modal-editor.ts +85 -0
  82. package/examples/extensions/model-status.ts +31 -0
  83. package/examples/extensions/notify.ts +55 -0
  84. package/examples/extensions/overlay-qa-tests.ts +1348 -0
  85. package/examples/extensions/overlay-test.ts +150 -0
  86. package/examples/extensions/permission-gate.ts +34 -0
  87. package/examples/extensions/pirate.ts +47 -0
  88. package/examples/extensions/plan-mode/README.md +65 -0
  89. package/examples/extensions/plan-mode/index.ts +340 -0
  90. package/examples/extensions/plan-mode/utils.ts +168 -0
  91. package/examples/extensions/preset.ts +397 -0
  92. package/examples/extensions/protected-paths.ts +30 -0
  93. package/examples/extensions/provider-payload.ts +14 -0
  94. package/examples/extensions/qna.ts +122 -0
  95. package/examples/extensions/question.ts +264 -0
  96. package/examples/extensions/questionnaire.ts +427 -0
  97. package/examples/extensions/rainbow-editor.ts +88 -0
  98. package/examples/extensions/reload-runtime.ts +37 -0
  99. package/examples/extensions/rpc-demo.ts +118 -0
  100. package/examples/extensions/sandbox/index.ts +321 -0
  101. package/examples/extensions/sandbox/package-lock.json +92 -0
  102. package/examples/extensions/sandbox/package.json +19 -0
  103. package/examples/extensions/send-user-message.ts +97 -0
  104. package/examples/extensions/session-name.ts +27 -0
  105. package/examples/extensions/shutdown-command.ts +63 -0
  106. package/examples/extensions/snake.ts +343 -0
  107. package/examples/extensions/space-invaders.ts +560 -0
  108. package/examples/extensions/ssh.ts +220 -0
  109. package/examples/extensions/status-line.ts +32 -0
  110. package/examples/extensions/subagent/README.md +172 -0
  111. package/examples/extensions/subagent/agents/planner.md +37 -0
  112. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  113. package/examples/extensions/subagent/agents/scout.md +50 -0
  114. package/examples/extensions/subagent/agents/worker.md +24 -0
  115. package/examples/extensions/subagent/agents.ts +126 -0
  116. package/examples/extensions/subagent/index.ts +986 -0
  117. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  118. package/examples/extensions/subagent/prompts/implement.md +10 -0
  119. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  120. package/examples/extensions/summarize.ts +206 -0
  121. package/examples/extensions/system-prompt-header.ts +17 -0
  122. package/examples/extensions/timed-confirm.ts +70 -0
  123. package/examples/extensions/titlebar-spinner.ts +58 -0
  124. package/examples/extensions/todo.ts +297 -0
  125. package/examples/extensions/tool-override.ts +144 -0
  126. package/examples/extensions/tools.ts +141 -0
  127. package/examples/extensions/trigger-compact.ts +50 -0
  128. package/examples/extensions/truncated-tool.ts +195 -0
  129. package/examples/extensions/widget-placement.ts +9 -0
  130. package/examples/extensions/with-deps/index.ts +32 -0
  131. package/examples/extensions/with-deps/package-lock.json +31 -0
  132. package/examples/extensions/with-deps/package.json +22 -0
  133. package/examples/rpc-extension-ui.ts +632 -0
  134. package/examples/sdk/01-minimal.ts +22 -0
  135. package/examples/sdk/02-custom-model.ts +49 -0
  136. package/examples/sdk/03-custom-prompt.ts +55 -0
  137. package/examples/sdk/04-skills.ts +52 -0
  138. package/examples/sdk/05-tools.ts +56 -0
  139. package/examples/sdk/06-extensions.ts +88 -0
  140. package/examples/sdk/07-context-files.ts +40 -0
  141. package/examples/sdk/08-prompt-templates.ts +48 -0
  142. package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
  143. package/examples/sdk/10-settings.ts +51 -0
  144. package/examples/sdk/11-sessions.ts +48 -0
  145. package/examples/sdk/12-full-control.ts +81 -0
  146. package/examples/sdk/13-session-runtime.ts +67 -0
  147. package/examples/sdk/README.md +147 -0
  148. package/export-html/template.html +55 -0
  149. package/export-html/vendor/highlight.min.js +1213 -0
  150. package/export-html/vendor/marked.min.js +6 -0
  151. package/package.json +29 -0
  152. package/photon_rs_bg.wasm +0 -0
  153. package/theme/dark.json +85 -0
  154. package/theme/duckmind.json +72 -0
  155. package/theme/light.json +84 -0
  156. package/theme/theme-schema.json +335 -0
package/README.md ADDED
@@ -0,0 +1,618 @@
1
+ <!-- OSS_WEEKEND_START -->
2
+ # 🏖️ OSS Weekend
3
+
4
+ **Issue tracker reopens Monday, April 13, 2026.**
5
+
6
+ OSS weekend runs Thursday, April 2, 2026 through Monday, April 13, 2026. New issues and PRs from unapproved contributors are auto-closed during this time. Approved contributors can still open issues and PRs if something is genuinely urgent, but please keep that to pressing matters only. For support, join [Discord](https://discord.com/invite/3cU7Bz4UPx).
7
+
8
+ > _Current focus: at the moment i'm deep in refactoring internals, and need to focus._
9
+ <!-- OSS_WEEKEND_END -->
10
+
11
+ ---
12
+
13
+ <p align="center">
14
+ <a href="https://shittycodingagent.ai">
15
+ <img src="https://shittycodingagent.ai/logo.svg" alt="dm logo" width="128">
16
+ </a>
17
+ </p>
18
+ <p align="center">
19
+ <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>
20
+ <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>
21
+ <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>
22
+ </p>
23
+ <p align="center">
24
+ <a href="https://pi.dev">pi.dev</a> domain graciously donated by
25
+ <br /><br />
26
+ <a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
27
+ </p>
28
+
29
+ DM is a minimal terminal coding harness. Adapt dm to your workflows, not the other way around, without having to fork and modify dm 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 [DM Packages](#dm-packages) and share them with others via npm or git.
30
+
31
+ DM ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask dm to build what you want or install a third party dm package that matches your workflow.
32
+
33
+ DM runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps. See [openclaw/openclaw](https://github.com/openclaw/openclaw) for a real-world SDK integration.
34
+
35
+ ## Share your OSS coding agent sessions
36
+
37
+ If you use dm for open source work, please share your coding agent sessions.
38
+
39
+ Public OSS session data helps improve models, prompts, tools, and evaluations using real development workflows.
40
+
41
+ For the full explanation, see [this post on X](https://x.com/badlogicgames/status/2037811643774652911).
42
+
43
+ To publish sessions, use [`badlogic/pi-share-hf`](https://github.com/badlogic/pi-share-hf). Read its README.md for setup instructions. All you need is a Hugging Face account, the Hugging Face CLI, and `pi-share-hf`.
44
+
45
+ You can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `dm` sessions.
46
+
47
+ I regularly publish my own `dm` work sessions here:
48
+
49
+ - [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)
50
+
51
+ ## Table of Contents
52
+
53
+ - [Quick Start](#quick-start)
54
+ - [Providers & Models](#providers--models)
55
+ - [Interactive Mode](#interactive-mode)
56
+ - [Editor](#editor)
57
+ - [Commands](#commands)
58
+ - [Keyboard Shortcuts](#keyboard-shortcuts)
59
+ - [Message Queue](#message-queue)
60
+ - [Sessions](#sessions)
61
+ - [Branching](#branching)
62
+ - [Compaction](#compaction)
63
+ - [Settings](#settings)
64
+ - [Context Files](#context-files)
65
+ - [Customization](#customization)
66
+ - [Prompt Templates](#prompt-templates)
67
+ - [Skills](#skills)
68
+ - [Extensions](#extensions)
69
+ - [Themes](#themes)
70
+ - [DM Packages](#dm-packages)
71
+ - [Programmatic Usage](#programmatic-usage)
72
+ - [Philosophy](#philosophy)
73
+ - [CLI Reference](#cli-reference)
74
+
75
+ ---
76
+
77
+ ## Quick Start
78
+
79
+ ```bash
80
+ npm install -g @mariozechner/pi-coding-agent
81
+ ```
82
+
83
+ Authenticate with an API key:
84
+
85
+ ```bash
86
+ export ANTHROPIC_API_KEY=sk-ant-...
87
+ dm
88
+ ```
89
+
90
+ Or use your existing subscription:
91
+
92
+ ```bash
93
+ dm
94
+ /login # Then select provider
95
+ ```
96
+
97
+ Then just talk to dm. By default, dm 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 [dm packages](#dm-packages).
98
+
99
+ **Platform notes:** [Windows](docs/windows.md) | [Termux (Android)](docs/termux.md) | [tmux](docs/tmux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)
100
+
101
+ ---
102
+
103
+ ## Providers & Models
104
+
105
+ For each built-in provider, dm 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).
106
+
107
+ **Subscriptions:**
108
+ - Anthropic Claude Pro/Max
109
+ - OpenAI ChatGPT Plus/Pro (Codex)
110
+ - GitHub Copilot
111
+ - Google Gemini CLI
112
+ - Google Antigravity
113
+
114
+ **API keys:**
115
+ - Anthropic
116
+ - OpenAI
117
+ - Azure OpenAI
118
+ - Google Gemini
119
+ - Google Vertex
120
+ - Amazon Bedrock
121
+ - Mistral
122
+ - Groq
123
+ - Cerebras
124
+ - xAI
125
+ - OpenRouter
126
+ - Vercel AI Gateway
127
+ - ZAI
128
+ - OpenCode Zen
129
+ - OpenCode Go
130
+ - Hugging Face
131
+ - Kimi For Coding
132
+ - MiniMax
133
+
134
+ See [docs/providers.md](docs/providers.md) for detailed setup instructions.
135
+
136
+ **Custom providers & models:** Add providers via `~/.dm/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).
137
+
138
+ ---
139
+
140
+ ## Interactive Mode
141
+
142
+ <p align="center"><img src="docs/images/interactive-mode.png" alt="Interactive Mode" width="600"></p>
143
+
144
+ The interface from top to bottom:
145
+
146
+ - **Startup header** - Shows shortcuts (`/hotkeys` for all), loaded AGENTS.md files, prompt templates, skills, and extensions
147
+ - **Messages** - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI
148
+ - **Editor** - Where you type; border color indicates thinking level
149
+ - **Footer** - Working directory, session name, total token/cache usage, cost, context usage, current model
150
+
151
+ The editor can be temporarily replaced by other UI, like built-in `/settings` or custom UI from extensions (e.g., a Q&A tool that lets the user answer model questions in a structured format). [Extensions](#extensions) can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.
152
+
153
+ ### Editor
154
+
155
+ | Feature | How |
156
+ |---------|-----|
157
+ | File reference | Type `@` to fuzzy-search project files |
158
+ | Path completion | Tab to complete paths |
159
+ | Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) |
160
+ | Images | Ctrl+V to paste (Alt+V on Windows), or drag onto terminal |
161
+ | Bash commands | `!command` runs and sends output to LLM, `!!command` runs without sending |
162
+
163
+ Standard editing keybindings for delete word, undo, etc. See [docs/keybindings.md](docs/keybindings.md).
164
+
165
+ ### Commands
166
+
167
+ Type `/` in the editor to trigger commands. [Extensions](#extensions) can register custom commands, [skills](#skills) are available as `/skill:name`, and [prompt templates](#prompt-templates) expand via `/templatename`.
168
+
169
+ | Command | Description |
170
+ |---------|-------------|
171
+ | `/login`, `/logout` | OAuth authentication |
172
+ | `/model` | Switch models |
173
+ | `/scoped-models` | Enable/disable models for Ctrl+P cycling |
174
+ | `/settings` | Thinking level, theme, message delivery, transport |
175
+ | `/resume` | Pick from previous sessions |
176
+ | `/new` | Start a new session |
177
+ | `/name <name>` | Set session display name |
178
+ | `/session` | Show session info (path, tokens, cost) |
179
+ | `/tree` | Jump to any point in the session and continue from there |
180
+ | `/fork` | Create a new session from the current branch |
181
+ | `/compact [prompt]` | Manually compact context, optional custom instructions |
182
+ | `/copy` | Copy last assistant message to clipboard |
183
+ | `/export [file]` | Export session to HTML file |
184
+ | `/share` | Upload as private GitHub gist with shareable HTML link |
185
+ | `/reload` | Reload keybindings, extensions, skills, prompts, and context files (themes hot-reload automatically) |
186
+ | `/hotkeys` | Show all keyboard shortcuts |
187
+ | `/changelog` | Display version history |
188
+ | `/quit` | Quit dm |
189
+
190
+ ### Keyboard Shortcuts
191
+
192
+ See `/hotkeys` for the full list. Customize via `~/.dm/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
193
+
194
+ **Commonly used:**
195
+
196
+ | Key | Action |
197
+ |-----|--------|
198
+ | Ctrl+C | Clear editor |
199
+ | Ctrl+C twice | Quit |
200
+ | Escape | Cancel/abort |
201
+ | Escape twice | Open `/tree` |
202
+ | Ctrl+L | Open model selector |
203
+ | Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |
204
+ | Shift+Tab | Cycle thinking level |
205
+ | Ctrl+O | Collapse/expand tool output |
206
+ | Ctrl+T | Collapse/expand thinking blocks |
207
+
208
+ ### Message Queue
209
+
210
+ Submit messages while the agent is working:
211
+
212
+ - **Enter** queues a *steering* message, delivered after the current assistant turn finishes executing its tool calls
213
+ - **Alt+Enter** queues a *follow-up* message, delivered only after the agent finishes all work
214
+ - **Escape** aborts and restores queued messages to editor
215
+ - **Alt+Up** retrieves queued messages back to editor
216
+
217
+ On Windows Terminal, `Alt+Enter` is fullscreen by default. Remap it in [docs/terminal-setup.md](docs/terminal-setup.md) so dm can receive the follow-up shortcut.
218
+
219
+ Configure delivery in [settings](docs/settings.md): `steeringMode` and `followUpMode` can be `"one-at-a-time"` (default, waits for response) or `"all"` (delivers all queued at once). `transport` selects provider transport preference (`"sse"`, `"websocket"`, or `"auto"`) for providers that support multiple transports.
220
+
221
+ ---
222
+
223
+ ## Sessions
224
+
225
+ Sessions are stored as JSONL files with a tree structure. Each entry has an `id` and `parentId`, enabling in-place branching without creating new files. See [docs/session.md](docs/session.md) for file format.
226
+
227
+ ### Management
228
+
229
+ Sessions auto-save to `~/.dm/agent/sessions/` organized by working directory.
230
+
231
+ ```bash
232
+ dm -c # Continue most recent session
233
+ dm -r # Browse and select from past sessions
234
+ dm --no-session # Ephemeral mode (don't save)
235
+ dm --session <path> # Use specific session file or ID
236
+ dm --fork <path> # Fork specific session file or ID into a new session
237
+ ```
238
+
239
+ ### Branching
240
+
241
+ **`/tree`** - Navigate the session tree in-place. Select any previous point, continue from there, and switch between branches. All history preserved in a single file.
242
+
243
+ <p align="center"><img src="docs/images/tree-view.png" alt="Tree View" width="600"></p>
244
+
245
+ - Search by typing, fold/unfold and jump between branches with Ctrl+←/Ctrl+→ or Alt+←/Alt+→, page with ←/→
246
+ - Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
247
+ - Press Shift+L to label entries as bookmarks and Shift+T to toggle label timestamps
248
+
249
+ **`/fork`** - Create a new session file from the current branch. Opens a selector, copies history up to the selected point, and places that message in the editor for modification.
250
+
251
+ **`--fork <path|id>`** - Fork an existing session file or partial session UUID directly from the CLI. This copies the full source session into a new session file in the current project.
252
+
253
+ ### Compaction
254
+
255
+ Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
256
+
257
+ **Manual:** `/compact` or `/compact <custom instructions>`
258
+
259
+ **Automatic:** Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via `/settings` or `settings.json`.
260
+
261
+ Compaction is lossy. The full history remains in the JSONL file; use `/tree` to revisit. Customize compaction behavior via [extensions](#extensions). See [docs/compaction.md](docs/compaction.md) for internals.
262
+
263
+ ---
264
+
265
+ ## Settings
266
+
267
+ Use `/settings` to modify common options, or edit JSON files directly:
268
+
269
+ | Location | Scope |
270
+ |----------|-------|
271
+ | `~/.dm/agent/settings.json` | Global (all projects) |
272
+ | `.dm/settings.json` | Project (overrides global) |
273
+
274
+ See [docs/settings.md](docs/settings.md) for all options.
275
+
276
+ ---
277
+
278
+ ## Context Files
279
+
280
+ DM loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
281
+ - `~/.dm/agent/AGENTS.md` (global)
282
+ - Parent directories (walking up from cwd)
283
+ - Current directory
284
+
285
+ Use for project instructions, conventions, common commands. All matching files are concatenated.
286
+
287
+ ### System Prompt
288
+
289
+ Replace the default system prompt with `.dm/SYSTEM.md` (project) or `~/.dm/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
290
+
291
+ ---
292
+
293
+ ## Customization
294
+
295
+ ### Prompt Templates
296
+
297
+ Reusable prompts as Markdown files. Type `/name` to expand.
298
+
299
+ ```markdown
300
+ <!-- ~/.dm/agent/prompts/review.md -->
301
+ Review this code for bugs, security issues, and performance problems.
302
+ Focus on: {{focus}}
303
+ ```
304
+
305
+ Place in `~/.dm/agent/prompts/`, `.dm/prompts/`, or a [dm package](#dm-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).
306
+
307
+ ### Skills
308
+
309
+ On-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.
310
+
311
+ ```markdown
312
+ <!-- ~/.dm/agent/skills/my-skill/SKILL.md -->
313
+ # My Skill
314
+ Use this skill when the user asks about X.
315
+
316
+ ## Steps
317
+ 1. Do this
318
+ 2. Then that
319
+ ```
320
+
321
+ Place in `~/.dm/agent/skills/`, `~/.agents/skills/`, `.dm/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [dm package](#dm-packages) to share with others. See [docs/skills.md](docs/skills.md).
322
+
323
+ ### Extensions
324
+
325
+ <p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
326
+
327
+ TypeScript modules that extend dm with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
328
+
329
+ ```typescript
330
+ export default function (dm: ExtensionAPI) {
331
+ dm.registerTool({ name: "deploy", ... });
332
+ dm.registerCommand("stats", { ... });
333
+ dm.on("tool_call", async (event, ctx) => { ... });
334
+ }
335
+ ```
336
+
337
+ **What's possible:**
338
+ - Custom tools (or replace built-in tools entirely)
339
+ - Sub-agents and plan mode
340
+ - Custom compaction and summarization
341
+ - Permission gates and path protection
342
+ - Custom editors and UI components
343
+ - Status lines, headers, footers
344
+ - Git checkpointing and auto-commit
345
+ - SSH and sandbox execution
346
+ - MCP server integration
347
+ - Make dm look like Claude Code
348
+ - Games while waiting (yes, Doom runs)
349
+ - ...anything you can dream up
350
+
351
+ Place in `~/.dm/agent/extensions/`, `.dm/extensions/`, or a [dm package](#dm-packages) to share with others. See [docs/extensions.md](docs/extensions.md) and [examples/extensions/](examples/extensions/).
352
+
353
+ ### Themes
354
+
355
+ Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and dm immediately applies changes.
356
+
357
+ Place in `~/.dm/agent/themes/`, `.dm/themes/`, or a [dm package](#dm-packages) to share with others. See [docs/themes.md](docs/themes.md).
358
+
359
+ ### DM Packages
360
+
361
+ Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Api-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).
362
+
363
+ > **Security:** DM 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.
364
+
365
+ ```bash
366
+ dm install npm:@foo/dm-tools
367
+ dm install npm:@foo/dm-tools@1.2.3 # pinned version
368
+ dm install git:github.com/user/repo
369
+ dm install git:github.com/user/repo@v1 # tag or commit
370
+ dm install git:git@github.com:user/repo
371
+ dm install git:git@github.com:user/repo@v1 # tag or commit
372
+ dm install https://github.com/user/repo
373
+ dm install https://github.com/user/repo@v1 # tag or commit
374
+ dm install ssh://git@github.com/user/repo
375
+ dm install ssh://git@github.com/user/repo@v1 # tag or commit
376
+ dm remove npm:@foo/dm-tools
377
+ dm uninstall npm:@foo/dm-tools # alias for remove
378
+ dm list
379
+ dm update # skips pinned packages
380
+ dm config # enable/disable extensions, skills, prompts, themes
381
+ ```
382
+
383
+ Packages install to `~/.dm/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.dm/git/`, `.dm/npm/`). If you use a Node version manager and want package installs to reuse a stable npm context, set `npmCommand` in `settings.json`, for example `["mise", "exec", "node@20", "--", "npm"]`.
384
+
385
+ Create a package by adding a `pi` key to `package.json`:
386
+
387
+ ```json
388
+ {
389
+ "name": "my-pi-package",
390
+ "keywords": ["pi-package"],
391
+ "pi": {
392
+ "extensions": ["./extensions"],
393
+ "skills": ["./skills"],
394
+ "prompts": ["./prompts"],
395
+ "themes": ["./themes"]
396
+ }
397
+ }
398
+ ```
399
+
400
+ Without a `pi` manifest, dm auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
401
+
402
+ See [docs/packages.md](docs/packages.md).
403
+
404
+ ---
405
+
406
+ ## Programmatic Usage
407
+
408
+ ### SDK
409
+
410
+ ```typescript
411
+ import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@mariozechner/pi-coding-agent";
412
+
413
+ const authStorage = AuthStorage.create();
414
+ const modelRegistry = ModelRegistry.create(authStorage);
415
+ const { session } = await createAgentSession({
416
+ sessionManager: SessionManager.inMemory(),
417
+ authStorage,
418
+ modelRegistry,
419
+ });
420
+
421
+ await session.prompt("What files are in the current directory?");
422
+ ```
423
+
424
+ For advanced multi-session runtime replacement, use `createAgentSessionRuntime()` and `AgentSessionRuntime`.
425
+
426
+ See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).
427
+
428
+ ### RPC Mode
429
+
430
+ For non-Node.js integrations, use RPC mode over stdin/stdout:
431
+
432
+ ```bash
433
+ dm --mode rpc
434
+ ```
435
+
436
+ RPC mode uses strict LF-delimited JSONL framing. Clients must split records on `\n` only. Do not use generic line readers like Node `readline`, which also split on Unicode separators inside JSON payloads.
437
+
438
+ See [docs/rpc.md](docs/rpc.md) for the protocol.
439
+
440
+ ---
441
+
442
+ ## Philosophy
443
+
444
+ DM 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 [dm packages](#dm-packages). This keeps the core minimal while letting you shape dm to fit how you work.
445
+
446
+ **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/)
447
+
448
+ **No sub-agents.** There's many ways to do this. Spawn dm instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
449
+
450
+ **No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
451
+
452
+ **No plan mode.** Write plans to files, or build it with [extensions](#extensions), or install a package.
453
+
454
+ **No built-in to-dos.** They confuse models. Use a TODO.md file, or build your own with [extensions](#extensions).
455
+
456
+ **No background bash.** Use tmux. Full observability, direct interaction.
457
+
458
+ Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) for the full rationale.
459
+
460
+ ---
461
+
462
+ ## CLI Reference
463
+
464
+ ```bash
465
+ dm [options] [@files...] [messages...]
466
+ ```
467
+
468
+ ### Package Commands
469
+
470
+ ```bash
471
+ dm install <source> [-l] # Install package, -l for project-local
472
+ dm remove <source> [-l] # Remove package
473
+ dm uninstall <source> [-l] # Alias for remove
474
+ dm update [source] # Update packages (skips pinned)
475
+ dm list # List installed packages
476
+ dm config # Enable/disable package resources
477
+ ```
478
+
479
+ ### Modes
480
+
481
+ | Flag | Description |
482
+ |------|-------------|
483
+ | (default) | Interactive mode |
484
+ | `-p`, `--print` | Print response and exit |
485
+ | `--mode json` | Output all events as JSON lines (see [docs/json.md](docs/json.md)) |
486
+ | `--mode rpc` | RPC mode for process integration (see [docs/rpc.md](docs/rpc.md)) |
487
+ | `--export <in> [out]` | Export session to HTML |
488
+
489
+ In print mode, dm also reads piped stdin and merges it into the initial prompt:
490
+
491
+ ```bash
492
+ cat README.md | dm -p "Summarize this text"
493
+ ```
494
+
495
+ ### Model Options
496
+
497
+ | Option | Description |
498
+ |--------|-------------|
499
+ | `--provider <name>` | Provider (anthropic, openai, google, etc.) |
500
+ | `--model <pattern>` | Model pattern or ID (supports `provider/id` and optional `:<thinking>`) |
501
+ | `--api-key <key>` | API key (overrides env vars) |
502
+ | `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |
503
+ | `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |
504
+ | `--list-models [search]` | List available models |
505
+
506
+ ### Session Options
507
+
508
+ | Option | Description |
509
+ |--------|-------------|
510
+ | `-c`, `--continue` | Continue most recent session |
511
+ | `-r`, `--resume` | Browse and select session |
512
+ | `--session <path>` | Use specific session file or partial UUID |
513
+ | `--fork <path>` | Fork specific session file or partial UUID into a new session |
514
+ | `--session-dir <dir>` | Custom session storage directory |
515
+ | `--no-session` | Ephemeral mode (don't save) |
516
+
517
+ ### Tool Options
518
+
519
+ | Option | Description |
520
+ |--------|-------------|
521
+ | `--tools <list>` | Enable specific built-in tools (default: `read,bash,edit,write`) |
522
+ | `--no-tools` | Disable all built-in tools (extension tools still work) |
523
+
524
+ Available built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`
525
+
526
+ ### Resource Options
527
+
528
+ | Option | Description |
529
+ |--------|-------------|
530
+ | `-e`, `--extension <source>` | Load extension from path, npm, or git (repeatable) |
531
+ | `--no-extensions` | Disable extension discovery |
532
+ | `--skill <path>` | Load skill (repeatable) |
533
+ | `--no-skills` | Disable skill discovery |
534
+ | `--prompt-template <path>` | Load prompt template (repeatable) |
535
+ | `--no-prompt-templates` | Disable prompt template discovery |
536
+ | `--theme <path>` | Load theme (repeatable) |
537
+ | `--no-themes` | Disable theme discovery |
538
+
539
+ Combine `--no-*` with explicit flags to load exactly what you need, ignoring settings.json (e.g., `--no-extensions -e ./my-ext.ts`).
540
+
541
+ ### Other Options
542
+
543
+ | Option | Description |
544
+ |--------|-------------|
545
+ | `--system-prompt <text>` | Replace default prompt (context files and skills still appended) |
546
+ | `--append-system-prompt <text>` | Append to system prompt |
547
+ | `--verbose` | Force verbose startup |
548
+ | `-h`, `--help` | Show help |
549
+ | `-v`, `--version` | Show version |
550
+
551
+ ### File Arguments
552
+
553
+ Prefix files with `@` to include in the message:
554
+
555
+ ```bash
556
+ dm @prompt.md "Answer this"
557
+ dm -p @screenshot.png "What's in this image?"
558
+ dm @code.ts @test.ts "Review these files"
559
+ ```
560
+
561
+ ### Examples
562
+
563
+ ```bash
564
+ # Interactive with initial prompt
565
+ dm "List all .ts files in src/"
566
+
567
+ # Non-interactive
568
+ dm -p "Summarize this codebase"
569
+
570
+ # Non-interactive with piped stdin
571
+ cat README.md | dm -p "Summarize this text"
572
+
573
+ # Different model
574
+ dm --provider openai --model gpt-4o "Help me refactor"
575
+
576
+ # Model with provider prefix (no --provider needed)
577
+ dm --model openai/gpt-4o "Help me refactor"
578
+
579
+ # Model with thinking level shorthand
580
+ dm --model sonnet:high "Solve this complex problem"
581
+
582
+ # Limit model cycling
583
+ dm --models "claude-*,gpt-4o"
584
+
585
+ # Read-only mode
586
+ dm --tools read,grep,find,ls -p "Review the code"
587
+
588
+ # High thinking level
589
+ dm --thinking high "Solve this complex problem"
590
+ ```
591
+
592
+ ### Environment Variables
593
+
594
+ | Variable | Description |
595
+ |----------|-------------|
596
+ | `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.dm/agent`) |
597
+ | `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
598
+ | `PI_SKIP_VERSION_CHECK` | Skip version check at startup |
599
+ | `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
600
+ | `VISUAL`, `EDITOR` | External editor for Ctrl+G |
601
+
602
+ ---
603
+
604
+ ## Contributing & Development
605
+
606
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines and [docs/development.md](docs/development.md) for setup, forking, and debugging.
607
+
608
+ ---
609
+
610
+ ## License
611
+
612
+ MIT
613
+
614
+ ## See Also
615
+
616
+ - [@mariozechner/pi-ai](https://www.npmjs.com/package/@mariozechner/pi-ai): Core LLM toolkit
617
+ - [@mariozechner/pi-agent](https://www.npmjs.com/package/@mariozechner/pi-agent): Agent framework
618
+ - [@mariozechner/pi-tui](https://www.npmjs.com/package/@mariozechner/pi-tui): Terminal UI components
Binary file
package/dm ADDED
Binary file