@oh-my-pi/pi-coding-agent 12.7.6 → 12.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -37
- package/README.md +9 -1052
- package/package.json +7 -7
- package/src/cli/args.ts +1 -0
- package/src/cli/update-cli.ts +49 -35
- package/src/cli/web-search-cli.ts +3 -2
- package/src/commands/web-search.ts +1 -0
- package/src/config/model-registry.ts +6 -0
- package/src/config/settings-schema.ts +25 -3
- package/src/config/settings.ts +1 -0
- package/src/extensibility/extensions/wrapper.ts +20 -13
- package/src/extensibility/slash-commands.ts +12 -91
- package/src/lsp/client.ts +24 -27
- package/src/lsp/index.ts +92 -42
- package/src/mcp/config-writer.ts +33 -0
- package/src/mcp/config.ts +6 -1
- package/src/mcp/types.ts +1 -0
- package/src/modes/components/custom-editor.ts +8 -5
- package/src/modes/components/settings-defs.ts +2 -1
- package/src/modes/controllers/command-controller.ts +12 -6
- package/src/modes/controllers/input-controller.ts +21 -186
- package/src/modes/controllers/mcp-command-controller.ts +60 -3
- package/src/modes/interactive-mode.ts +2 -2
- package/src/modes/types.ts +1 -1
- package/src/sdk.ts +23 -1
- package/src/secrets/index.ts +116 -0
- package/src/secrets/obfuscator.ts +269 -0
- package/src/secrets/regex.ts +21 -0
- package/src/session/agent-session.ts +143 -21
- package/src/session/compaction/branch-summarization.ts +2 -2
- package/src/session/compaction/compaction.ts +10 -3
- package/src/session/compaction/utils.ts +25 -1
- package/src/slash-commands/builtin-registry.ts +419 -0
- package/src/web/scrapers/github.ts +50 -12
- package/src/web/search/index.ts +5 -5
- package/src/web/search/provider.ts +13 -2
- package/src/web/search/providers/brave.ts +165 -0
- package/src/web/search/types.ts +1 -1
- package/docs/compaction.md +0 -436
- package/docs/config-usage.md +0 -176
- package/docs/custom-tools.md +0 -585
- package/docs/environment-variables.md +0 -257
- package/docs/extension-loading.md +0 -106
- package/docs/extensions.md +0 -1342
- package/docs/fs-scan-cache-architecture.md +0 -50
- package/docs/hooks.md +0 -906
- package/docs/models.md +0 -234
- package/docs/python-repl.md +0 -110
- package/docs/rpc.md +0 -1173
- package/docs/sdk.md +0 -1039
- package/docs/session-tree-plan.md +0 -84
- package/docs/session.md +0 -368
- package/docs/skills.md +0 -254
- package/docs/theme.md +0 -696
- package/docs/tree.md +0 -206
- package/docs/tui.md +0 -487
package/README.md
CHANGED
|
@@ -1,1055 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @oh-my-pi/pi-coding-agent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Core implementation package for the `omp` coding agent in the `oh-my-pi` monorepo.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For installation, setup, provider configuration, model roles, slash commands, and full CLI reference, see:
|
|
6
|
+
- [Monorepo README (local)](../../README.md)
|
|
7
|
+
- [Monorepo README (GitHub)](https://github.com/can1357/oh-my-pi#readme)
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- [
|
|
10
|
-
|
|
11
|
-
- [Windows Setup](#windows-setup)
|
|
12
|
-
- [Terminal Setup](#terminal-setup)
|
|
13
|
-
- [API Keys & OAuth](#api-keys--oauth)
|
|
14
|
-
- [Quick Start](#quick-start)
|
|
15
|
-
- [Usage](#usage)
|
|
16
|
-
- [Slash Commands](#slash-commands)
|
|
17
|
-
- [Editor Features](#editor-features)
|
|
18
|
-
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
19
|
-
- [Bash Mode](#bash-mode)
|
|
20
|
-
- [Image Support](#image-support)
|
|
21
|
-
- [Sessions](#sessions)
|
|
22
|
-
- [Session Management](#session-management)
|
|
23
|
-
- [Context Compaction](#context-compaction)
|
|
24
|
-
- [Branching](#branching)
|
|
25
|
-
- [Configuration](#configuration)
|
|
26
|
-
- [Project Context Files](#project-context-files)
|
|
27
|
-
- [Custom System Prompt](#custom-system-prompt)
|
|
28
|
-
- [Custom Models and Providers](#custom-models-and-providers)
|
|
29
|
-
- [Settings File](#settings-file)
|
|
30
|
-
- [Extensions](#extensions)
|
|
31
|
-
- [Themes](#themes)
|
|
32
|
-
- [Custom Slash Commands](#custom-slash-commands)
|
|
33
|
-
- [Skills](#skills)
|
|
34
|
-
- [Hooks](#hooks)
|
|
35
|
-
- [Custom Tools](#custom-tools)
|
|
36
|
-
- [CLI Reference](#cli-reference)
|
|
37
|
-
- [Tools](#tools)
|
|
38
|
-
- [Programmatic Usage](#programmatic-usage)
|
|
39
|
-
- [SDK](#sdk)
|
|
40
|
-
- [RPC Mode](#rpc-mode)
|
|
41
|
-
- [HTML Export](#html-export)
|
|
42
|
-
- [Philosophy](#philosophy)
|
|
43
|
-
- [Development](#development)
|
|
44
|
-
- [License](#license)
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Getting Started
|
|
49
|
-
|
|
50
|
-
### Installation
|
|
51
|
-
|
|
52
|
-
**npm (recommended):**
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm install -g @oh-my-pi/pi-coding-agent
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Standalone binary:**
|
|
59
|
-
|
|
60
|
-
Download from [GitHub Releases](https://github.com/can1357/oh-my-pi/releases):
|
|
61
|
-
|
|
62
|
-
| Platform | Binary |
|
|
63
|
-
| ------------------- | --------------------- |
|
|
64
|
-
| macOS Apple Silicon | `omp-darwin-arm64` |
|
|
65
|
-
| macOS Intel | `omp-darwin-x64` |
|
|
66
|
-
| Linux x64 | `omp-linux-x64` |
|
|
67
|
-
| Linux ARM64 | `omp-linux-arm64` |
|
|
68
|
-
| Windows x64 | `omp-windows-x64.exe` |
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# macOS/Linux
|
|
72
|
-
chmod +x omp-darwin-arm64
|
|
73
|
-
./omp-darwin-arm64
|
|
74
|
-
|
|
75
|
-
# Windows
|
|
76
|
-
omp-windows-x64.exe
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**macOS note:** The binary is unsigned. If blocked, run: `xattr -c ./omp`
|
|
80
|
-
|
|
81
|
-
**Build from source** (requires [Bun](https://bun.sh) 1.0+):
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
git clone https://github.com/can1357/oh-my-pi.git
|
|
85
|
-
cd pi-mono && npm install
|
|
86
|
-
cd packages/coding-agent && npm run build:binary
|
|
87
|
-
./dist/omp
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Windows Setup
|
|
91
|
-
|
|
92
|
-
Omp requires a bash shell on Windows. Checked locations (in order):
|
|
93
|
-
|
|
94
|
-
1. Custom path from `~/.omp/agent/settings.json`
|
|
95
|
-
2. Git Bash (`C:\Program Files\Git\bin\bash.exe`)
|
|
96
|
-
3. `bash.exe` on PATH (Cygwin, MSYS2, WSL)
|
|
97
|
-
|
|
98
|
-
For most users, [Git for Windows](https://git-scm.com/download/win) is sufficient.
|
|
99
|
-
|
|
100
|
-
**Custom shell path:**
|
|
101
|
-
|
|
102
|
-
```json
|
|
103
|
-
// ~/.omp/agent/settings.json
|
|
104
|
-
{
|
|
105
|
-
"shellPath": "C:\\cygwin64\\bin\\bash.exe"
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Terminal Setup
|
|
110
|
-
|
|
111
|
-
Pi uses the [Kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) for reliable modifier key detection. Most modern terminals support this protocol, but some require configuration.
|
|
112
|
-
|
|
113
|
-
**Kitty, iTerm2:** Work out of the box.
|
|
114
|
-
|
|
115
|
-
**Ghostty:** Add to your Ghostty config (`~/.config/ghostty/config`):
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
keybind = alt+backspace=text:\x1b\x7f
|
|
119
|
-
keybind = shift+enter=text:\n
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**wezterm:** Create `~/.wezterm.lua`:
|
|
123
|
-
|
|
124
|
-
```lua
|
|
125
|
-
local wezterm = require 'wezterm'
|
|
126
|
-
local config = wezterm.config_builder()
|
|
127
|
-
config.enable_kitty_keyboard = true
|
|
128
|
-
return config
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Windows Terminal:** Does not support the Kitty keyboard protocol. Shift+Enter cannot be distinguished from Enter. Use Ctrl+Enter for multi-line input instead. All other keybindings work correctly.
|
|
132
|
-
|
|
133
|
-
### API Keys & OAuth
|
|
134
|
-
|
|
135
|
-
**Option 1: Environment variables** (recommended)
|
|
136
|
-
|
|
137
|
-
| Provider | Auth Key | Environment Variable |
|
|
138
|
-
| ---------- | ------------ | -------------------- |
|
|
139
|
-
| Anthropic | `anthropic` | `ANTHROPIC_API_KEY` |
|
|
140
|
-
| OpenAI | `openai` | `OPENAI_API_KEY` |
|
|
141
|
-
| Google | `google` | `GEMINI_API_KEY` |
|
|
142
|
-
| Mistral | `mistral` | `MISTRAL_API_KEY` |
|
|
143
|
-
| Groq | `groq` | `GROQ_API_KEY` |
|
|
144
|
-
| Cerebras | `cerebras` | `CEREBRAS_API_KEY` |
|
|
145
|
-
| xAI | `xai` | `XAI_API_KEY` |
|
|
146
|
-
| OpenRouter | `openrouter` | `OPENROUTER_API_KEY` |
|
|
147
|
-
| ZAI | `zai` | `ZAI_API_KEY` |
|
|
148
|
-
|
|
149
|
-
**Option 2: OAuth**
|
|
150
|
-
|
|
151
|
-
Use `/login` to authenticate with subscription-based or free-tier providers:
|
|
152
|
-
|
|
153
|
-
| Provider | Models | Cost |
|
|
154
|
-
| -------------------------- | ----------------------------------------------- | --------------------- |
|
|
155
|
-
| Anthropic (Claude Pro/Max) | Claude models via your subscription | Subscription |
|
|
156
|
-
| Cursor | Claude, GPT-4o via Cursor Pro subscription | Subscription |
|
|
157
|
-
| GitHub Copilot | GPT-4o, Claude, Gemini via Copilot subscription | Subscription |
|
|
158
|
-
| OpenAI Codex | o3, o4-mini via ChatGPT Plus/Pro subscription | Subscription |
|
|
159
|
-
| Google Gemini CLI | Gemini 2.0/2.5 models | Free (Google account) |
|
|
160
|
-
| Google Antigravity | Gemini 3, Claude, GPT-OSS | Free (Google account) |
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
omp
|
|
164
|
-
/login # Select provider, authorize in browser
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**Note:** `/login` replaces any existing API keys for that provider with OAuth credentials. If OAuth credentials already exist, `/login` appends another entry.
|
|
168
|
-
|
|
169
|
-
**GitHub Copilot notes:**
|
|
170
|
-
|
|
171
|
-
- Press Enter for github.com, or enter your GitHub Enterprise Server domain
|
|
172
|
-
- If you get "model not supported" error, enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
|
|
173
|
-
|
|
174
|
-
**Google providers notes:**
|
|
175
|
-
|
|
176
|
-
- Gemini CLI uses the production Cloud Code Assist endpoint (standard Gemini models)
|
|
177
|
-
- Antigravity uses a sandbox endpoint with access to Gemini 3, Claude (sonnet/opus thinking), and GPT-OSS models
|
|
178
|
-
- Both are free with any Google account, subject to rate limits
|
|
179
|
-
- Paid Cloud Code Assist subscriptions: set `GOOGLE_CLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT_ID` env var to your project ID
|
|
180
|
-
|
|
181
|
-
Credentials stored in `~/.omp/agent/agent.db`. Use `/logout` to clear.
|
|
182
|
-
|
|
183
|
-
### Quick Start
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
export ANTHROPIC_API_KEY=sk-ant-...
|
|
187
|
-
omp
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Then chat:
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
You: Create a simple Express server in src/server.ts
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
The agent reads, writes, and edits files, and executes commands via bash.
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Usage
|
|
201
|
-
|
|
202
|
-
### Slash Commands
|
|
203
|
-
|
|
204
|
-
| Command | Description |
|
|
205
|
-
| ------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
206
|
-
| `/settings` | Open settings menu (thinking, theme, queue mode, toggles) |
|
|
207
|
-
| `/model` | Switch models mid-session. Use `/model <search>` or `provider/model` to prefilter/disambiguate. |
|
|
208
|
-
| `/export [file]` | Export session to HTML file |
|
|
209
|
-
| `/dump` | Copy session transcript to clipboard |
|
|
210
|
-
| `/share` | Upload session as secret GitHub gist, get shareable URL (requires `gh` CLI) |
|
|
211
|
-
| `/session` | Show session info: path, message counts, token usage, cost |
|
|
212
|
-
| `/hotkeys` | Show all keyboard shortcuts |
|
|
213
|
-
| `/changelog` | Display full version history |
|
|
214
|
-
| `/tree` | Navigate session tree in-place (search, filter, label entries) |
|
|
215
|
-
| `/branch` | Create new conversation branch from a previous message |
|
|
216
|
-
| `/resume` | Switch to a different session (interactive selector) |
|
|
217
|
-
| `/login` | OAuth login for subscription-based models |
|
|
218
|
-
| `/logout` | Clear OAuth tokens |
|
|
219
|
-
| `/new` | Start a new session |
|
|
220
|
-
| `/copy` | Copy last agent message to clipboard |
|
|
221
|
-
| `/compact [instructions]` | Manually compact conversation context |
|
|
222
|
-
|
|
223
|
-
### Editor Features
|
|
224
|
-
|
|
225
|
-
**File reference (`@`):** Type `@` to fuzzy-search project files. Respects `.gitignore`.
|
|
226
|
-
|
|
227
|
-
**Path completion (Tab):** Complete relative paths, `../`, `~/`, etc.
|
|
228
|
-
|
|
229
|
-
**Drag & drop:** Drag files from your file manager into the terminal.
|
|
230
|
-
|
|
231
|
-
**Multi-line paste:** Pasted content is collapsed to `[paste #N <lines> lines]` but sent in full.
|
|
232
|
-
|
|
233
|
-
**Message queuing:** Submit messages while the agent is working. They queue and process based on queue mode (configurable via `/settings`). Press Escape to abort and restore queued messages to editor.
|
|
234
|
-
|
|
235
|
-
### Keyboard Shortcuts
|
|
236
|
-
|
|
237
|
-
**Navigation:**
|
|
238
|
-
|
|
239
|
-
| Key | Action |
|
|
240
|
-
| ------------------------ | -------------------------------------------- |
|
|
241
|
-
| Arrow keys | Move cursor / browse history (Up when empty) |
|
|
242
|
-
| Option+Left/Right | Move by word |
|
|
243
|
-
| Ctrl+A / Home / Cmd+Left | Start of line |
|
|
244
|
-
| Ctrl+E / End / Cmd+Right | End of line |
|
|
245
|
-
|
|
246
|
-
**Editing:**
|
|
247
|
-
|
|
248
|
-
| Key | Action |
|
|
249
|
-
| ------------------------- | ----------------------------------------- |
|
|
250
|
-
| Enter | Send message |
|
|
251
|
-
| Shift+Enter | New line (Ctrl+Enter on Windows Terminal) |
|
|
252
|
-
| Ctrl+W / Option+Backspace | Delete word backwards |
|
|
253
|
-
| Ctrl+U | Delete to start of line |
|
|
254
|
-
| Ctrl+K | Delete to end of line |
|
|
255
|
-
|
|
256
|
-
**Other:**
|
|
257
|
-
|
|
258
|
-
| Key | Action |
|
|
259
|
-
| --------------------- | -------------------------------------------------------- |
|
|
260
|
-
| Tab | Path completion / accept autocomplete |
|
|
261
|
-
| Escape | Cancel autocomplete / abort streaming |
|
|
262
|
-
| Ctrl+C | Clear editor (first) / exit (second) |
|
|
263
|
-
| Ctrl+D | Exit (when editor is empty) |
|
|
264
|
-
| Ctrl+Z | Suspend to background (use `fg` in shell to resume) |
|
|
265
|
-
| Shift+Tab | Cycle thinking level |
|
|
266
|
-
| Ctrl+P / Shift+Ctrl+P | Cycle role models (slow/default/smol/plan) |
|
|
267
|
-
| Ctrl+L | Open model selector |
|
|
268
|
-
| Ctrl+O | Toggle tool output expansion |
|
|
269
|
-
| Ctrl+T | Toggle todo list expansion |
|
|
270
|
-
| Ctrl+G | Edit message in external editor (`$VISUAL` or `$EDITOR`) |
|
|
271
|
-
|
|
272
|
-
### Bash Mode
|
|
273
|
-
|
|
274
|
-
Prefix commands with `!` to execute them and add output to context:
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
!ls -la
|
|
278
|
-
!git status
|
|
279
|
-
!cat package.json | jq '.dependencies'
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
Output streams in real-time. Press Escape to cancel. Large outputs truncate at 2000 lines / 50KB.
|
|
283
|
-
|
|
284
|
-
The output becomes part of your next prompt, formatted as:
|
|
285
|
-
|
|
286
|
-
```
|
|
287
|
-
Ran `ls -la`
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
<output here>
|
|
291
|
-
```
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
Run multiple commands before prompting; all outputs are included together.
|
|
295
|
-
|
|
296
|
-
### Image Support
|
|
297
|
-
|
|
298
|
-
**Attaching images:** Include image paths in your message:
|
|
299
|
-
|
|
300
|
-
```
|
|
301
|
-
You: What's in this screenshot? /path/to/image.png
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
Supported formats: `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`
|
|
305
|
-
|
|
306
|
-
**Inline rendering:** On terminals that support the Kitty graphics protocol (Kitty, Ghostty, WezTerm) or iTerm2 inline images, images in tool output are rendered inline. On unsupported terminals, a text placeholder is shown instead.
|
|
307
|
-
|
|
308
|
-
Toggle inline images via `/settings` or set `terminal.showImages: false` in settings.
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
## Sessions
|
|
313
|
-
|
|
314
|
-
Sessions are stored as JSONL files with a **tree structure**. Each entry has an `id` and `parentId`, enabling in-place branching: navigate to any previous point with `/tree`, continue from there, and switch between branches while preserving all history in a single file.
|
|
315
|
-
|
|
316
|
-
See [docs/session.md](docs/session.md) for the file format and programmatic API.
|
|
317
|
-
|
|
318
|
-
### Session Management
|
|
319
|
-
|
|
320
|
-
Sessions auto-save to `~/.omp/agent/sessions/` organized by working directory.
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
omp --continue # Continue most recent session
|
|
324
|
-
omp -c # Short form
|
|
325
|
-
|
|
326
|
-
omp --resume # Browse and select from past sessions
|
|
327
|
-
omp -r # Short form
|
|
328
|
-
|
|
329
|
-
omp --no-session # Ephemeral mode (don't save)
|
|
330
|
-
|
|
331
|
-
omp --session /path/to/file.jsonl # Use specific session file
|
|
332
|
-
omp --session a8ec1c2a # Resume by session ID (partial UUID)
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
**Resuming by session ID:** The `--session` flag accepts a session UUID (or prefix). Session IDs are visible in filenames under `~/.omp/agent/sessions/<project>/` (e.g., `2025-12-13T17-47-46-817Z_a8ec1c2a-5a5f-4699-88cb-03e7d3cb9292.jsonl`). The UUID is the part after the underscore. You can also search by session ID in the `omp -r` picker.
|
|
336
|
-
|
|
337
|
-
### Context Compaction
|
|
338
|
-
|
|
339
|
-
Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
|
|
340
|
-
|
|
341
|
-
**Manual:** `/compact` or `/compact Focus on the API changes`
|
|
342
|
-
|
|
343
|
-
**Automatic:** Enable via `/settings`. When enabled, triggers in two cases:
|
|
344
|
-
|
|
345
|
-
- **Overflow recovery**: LLM returns context overflow error. Compacts and auto-retries.
|
|
346
|
-
- **Threshold maintenance**: Context exceeds `contextWindow - reserveTokens` after a successful turn. Compacts without retry.
|
|
347
|
-
|
|
348
|
-
When disabled, neither case triggers automatic compaction (use `/compact` manually if needed).
|
|
349
|
-
|
|
350
|
-
**Configuration** (`~/.omp/agent/settings.json`):
|
|
351
|
-
|
|
352
|
-
```json
|
|
353
|
-
{
|
|
354
|
-
"compaction": {
|
|
355
|
-
"enabled": true,
|
|
356
|
-
"reserveTokens": 16384,
|
|
357
|
-
"keepRecentTokens": 20000
|
|
358
|
-
},
|
|
359
|
-
"env": {
|
|
360
|
-
"ANTHROPIC_API_KEY": "sk-ant-...",
|
|
361
|
-
"OPENAI_API_KEY": "sk-proj-...",
|
|
362
|
-
"GEMINI_API_KEY": "AIzaSyD...",
|
|
363
|
-
"CUSTOM_VAR": "custom-value"
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
**Environment Variables (`env`):**
|
|
369
|
-
|
|
370
|
-
- Automatically sets environment variables when the application starts
|
|
371
|
-
- Only sets variables that aren't already present in `Bun.env`
|
|
372
|
-
- Supports any environment variable, not just API keys
|
|
373
|
-
- Order of precedence: existing env vars > settings.json env vars > agent.db
|
|
374
|
-
|
|
375
|
-
> **Note:** Compaction is lossy. The agent loses full conversation access afterward. Size tasks to avoid context limits when possible. For critical context, ask the agent to write a summary to a file, iterate on it until it covers everything, then start a new session with that file. The full session history is preserved in the JSONL file; use `/tree` to revisit any previous point.
|
|
376
|
-
|
|
377
|
-
See [docs/compaction.md](docs/compaction.md) for how compaction works internally and how to customize it via hooks.
|
|
378
|
-
|
|
379
|
-
### Branching
|
|
380
|
-
|
|
381
|
-
**In-place navigation (`/tree`):** Navigate the session tree without creating new files. Select any previous point, continue from there, and switch between branches while preserving all history.
|
|
382
|
-
|
|
383
|
-
- Search by typing, page with ←/→
|
|
384
|
-
- Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
|
|
385
|
-
- Press `l` to label entries as bookmarks
|
|
386
|
-
- When switching branches, you're prompted whether to generate a summary of the abandoned branch (messages up to the common ancestor)
|
|
387
|
-
|
|
388
|
-
**Create new session (`/branch`):** Branch to a new session file:
|
|
389
|
-
|
|
390
|
-
1. Opens selector showing all your user messages
|
|
391
|
-
2. Select a message to branch from
|
|
392
|
-
3. Creates new session with history up to that point
|
|
393
|
-
4. Selected message placed in editor for modification
|
|
394
|
-
|
|
395
|
-
---
|
|
396
|
-
|
|
397
|
-
## Configuration
|
|
398
|
-
|
|
399
|
-
### Project Context Files
|
|
400
|
-
|
|
401
|
-
Omp loads `AGENTS.md` (or `CLAUDE.md`) files at startup in this order:
|
|
402
|
-
|
|
403
|
-
1. **Global:** `~/.omp/agent/AGENTS.md`
|
|
404
|
-
2. **Parent directories:** Walking up from current directory
|
|
405
|
-
3. **Current directory:** `./AGENTS.md`
|
|
406
|
-
|
|
407
|
-
Use these for:
|
|
408
|
-
|
|
409
|
-
- Project instructions and guidelines
|
|
410
|
-
- Common commands and workflows
|
|
411
|
-
- Architecture documentation
|
|
412
|
-
- Coding conventions
|
|
413
|
-
- Testing instructions
|
|
414
|
-
|
|
415
|
-
```markdown
|
|
416
|
-
# Common Commands
|
|
417
|
-
|
|
418
|
-
- npm run build: Build the project
|
|
419
|
-
- npm test: Run tests
|
|
420
|
-
|
|
421
|
-
# Code Style
|
|
422
|
-
|
|
423
|
-
- Use TypeScript strict mode
|
|
424
|
-
- Prefer async/await over promises
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Custom System Prompt
|
|
428
|
-
|
|
429
|
-
Replace the default system prompt entirely by creating a `SYSTEM.md` file:
|
|
430
|
-
|
|
431
|
-
1. **Project-local:** `.omp/SYSTEM.md` (takes precedence)
|
|
432
|
-
2. **Global:** `~/.omp/agent/SYSTEM.md` (fallback)
|
|
433
|
-
|
|
434
|
-
This is useful when using omp as different types of agents across repos (coding assistant, personal assistant, domain-specific agent, etc.).
|
|
435
|
-
|
|
436
|
-
```markdown
|
|
437
|
-
You are a technical writing assistant. Help users write clear documentation.
|
|
438
|
-
|
|
439
|
-
Focus on:
|
|
440
|
-
|
|
441
|
-
- Concise explanations
|
|
442
|
-
- Code examples
|
|
443
|
-
- Proper formatting
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
The `--system-prompt` CLI flag overrides both files. Use `--append-system-prompt` to add to (rather than replace) the prompt.
|
|
447
|
-
|
|
448
|
-
### Custom Models and Providers
|
|
449
|
-
|
|
450
|
-
Add custom models (Ollama, vLLM, LM Studio, etc.) via `~/.omp/agent/models.yml` (`models.json` is still supported for legacy configs):
|
|
451
|
-
|
|
452
|
-
> See [models.yml provider integration guide](docs/models.md) for full schema, merge behavior, and provider integration patterns.
|
|
453
|
-
|
|
454
|
-
```json
|
|
455
|
-
{
|
|
456
|
-
"providers": {
|
|
457
|
-
"ollama": {
|
|
458
|
-
"baseUrl": "http://localhost:11434/v1",
|
|
459
|
-
"apiKey": "OLLAMA_API_KEY",
|
|
460
|
-
"api": "openai-completions",
|
|
461
|
-
"models": [
|
|
462
|
-
{
|
|
463
|
-
"id": "llama-3.1-8b",
|
|
464
|
-
"name": "Llama 3.1 8B (Local)",
|
|
465
|
-
"reasoning": false,
|
|
466
|
-
"input": ["text"],
|
|
467
|
-
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
|
|
468
|
-
"contextWindow": 128000,
|
|
469
|
-
"maxTokens": 32000
|
|
470
|
-
}
|
|
471
|
-
]
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
**Supported APIs:** `openai-completions`, `openai-responses`, `openai-codex-responses`, `anthropic-messages`, `google-generative-ai`, `google-vertex`
|
|
478
|
-
|
|
479
|
-
**API key resolution:** The `apiKey` field is checked as environment variable name first, then used as literal value.
|
|
480
|
-
|
|
481
|
-
**API override:** Set `api` at provider level (default for all models) or model level (override per model).
|
|
482
|
-
|
|
483
|
-
**Custom headers:**
|
|
484
|
-
|
|
485
|
-
```json
|
|
486
|
-
{
|
|
487
|
-
"providers": {
|
|
488
|
-
"custom-proxy": {
|
|
489
|
-
"baseUrl": "https://proxy.example.com/v1",
|
|
490
|
-
"apiKey": "YOUR_API_KEY",
|
|
491
|
-
"api": "anthropic-messages",
|
|
492
|
-
"headers": {
|
|
493
|
-
"User-Agent": "Mozilla/5.0 ...",
|
|
494
|
-
"X-Custom-Auth": "token"
|
|
495
|
-
},
|
|
496
|
-
"models": [...]
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
**Authorization header:** Set `authHeader: true` to add `Authorization: Bearer <apiKey>` automatically.
|
|
503
|
-
|
|
504
|
-
**OpenAI compatibility (`compat` field):**
|
|
505
|
-
|
|
506
|
-
| Field | Description |
|
|
507
|
-
| ------------------------- | ------------------------------------------- |
|
|
508
|
-
| `supportsStore` | Whether provider supports `store` field |
|
|
509
|
-
| `supportsDeveloperRole` | Use `developer` vs `system` role |
|
|
510
|
-
| `supportsReasoningEffort` | Support for `reasoning_effort` parameter |
|
|
511
|
-
| `maxTokensField` | Use `max_completion_tokens` or `max_tokens` |
|
|
512
|
-
|
|
513
|
-
**Live reload:** The file reloads each time you open `/model`. Edit during session; no restart needed.
|
|
514
|
-
|
|
515
|
-
**Model selection priority:**
|
|
516
|
-
|
|
517
|
-
1. CLI args (`--provider`, `--model`)
|
|
518
|
-
2. First from `--models` scope (new sessions only)
|
|
519
|
-
3. Restored from session (`--continue`, `--resume`)
|
|
520
|
-
4. Saved default from settings
|
|
521
|
-
5. First available model with valid API key
|
|
522
|
-
|
|
523
|
-
> omp can help you create custom provider and model configurations.
|
|
524
|
-
|
|
525
|
-
### Settings File
|
|
526
|
-
|
|
527
|
-
Settings are loaded from two locations and merged:
|
|
528
|
-
|
|
529
|
-
1. **Global:** `~/.omp/agent/settings.json` - user preferences
|
|
530
|
-
2. **Project:** `<cwd>/.omp/settings.json` - project-specific overrides (version control friendly)
|
|
531
|
-
|
|
532
|
-
Project settings override global settings. For nested objects, individual keys merge. Settings changed via TUI (model, thinking level, etc.) are saved to global preferences only.
|
|
533
|
-
|
|
534
|
-
Global `~/.omp/agent/settings.json` stores persistent preferences:
|
|
535
|
-
|
|
536
|
-
```json
|
|
537
|
-
{
|
|
538
|
-
"theme": "dark",
|
|
539
|
-
"modelRoles": {
|
|
540
|
-
"default": "anthropic/claude-sonnet-4-20250514"
|
|
541
|
-
},
|
|
542
|
-
"defaultThinkingLevel": "medium",
|
|
543
|
-
"enabledModels": ["anthropic/*", "*gpt*", "gemini-2.5-pro:high"],
|
|
544
|
-
"queueMode": "one-at-a-time",
|
|
545
|
-
"shellPath": "C:\\path\\to\\bash.exe",
|
|
546
|
-
"hideThinkingBlock": false,
|
|
547
|
-
"collapseChangelog": false,
|
|
548
|
-
"compaction": {
|
|
549
|
-
"enabled": true,
|
|
550
|
-
"reserveTokens": 16384,
|
|
551
|
-
"keepRecentTokens": 20000
|
|
552
|
-
},
|
|
553
|
-
"skills": {
|
|
554
|
-
"enabled": true
|
|
555
|
-
},
|
|
556
|
-
"retry": {
|
|
557
|
-
"enabled": true,
|
|
558
|
-
"maxRetries": 3,
|
|
559
|
-
"baseDelayMs": 2000
|
|
560
|
-
},
|
|
561
|
-
"terminal": {
|
|
562
|
-
"showImages": true
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
| Setting | Description | Default |
|
|
568
|
-
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
|
569
|
-
| `theme` | Color theme name | auto-detected |
|
|
570
|
-
| `modelRoles` | Model assignments by role (e.g., `{"default": "...", "slow": "...", "smol": "...", "plan": "..."}`) | - |
|
|
571
|
-
| `defaultThinkingLevel` | Thinking level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh` | - |
|
|
572
|
-
| `enabledModels` | Model patterns for cycling. Supports glob patterns (`github-copilot/*`, `*sonnet*`) and fuzzy matching. Same as `--models` CLI flag | - |
|
|
573
|
-
| `queueMode` | Message queue mode: `all` or `one-at-a-time` | `one-at-a-time` |
|
|
574
|
-
| `shellPath` | Custom bash path (Windows) | auto-detected |
|
|
575
|
-
| `hideThinkingBlock` | Hide thinking blocks in output | `false` |
|
|
576
|
-
| `collapseChangelog` | Show condensed changelog after update | `false` |
|
|
577
|
-
| `compaction.enabled` | Enable auto-compaction | `true` |
|
|
578
|
-
| `compaction.reserveTokens` | Tokens to reserve before compaction triggers | `16384` |
|
|
579
|
-
| `compaction.keepRecentTokens` | Recent tokens to keep after compaction | `20000` |
|
|
580
|
-
| `skills.enabled` | Enable skills discovery | `true` |
|
|
581
|
-
| `retry.enabled` | Auto-retry on transient errors | `true` |
|
|
582
|
-
| `retry.maxRetries` | Maximum retry attempts | `3` |
|
|
583
|
-
| `retry.baseDelayMs` | Base delay for exponential backoff | `2000` |
|
|
584
|
-
| `terminal.showImages` | Render images inline (supported terminals) | `true` |
|
|
585
|
-
|
|
586
|
-
---
|
|
587
|
-
|
|
588
|
-
## Extensions
|
|
589
|
-
|
|
590
|
-
### Themes
|
|
591
|
-
|
|
592
|
-
Built-in themes: `dark` (default), `light`. Auto-detected on first run.
|
|
593
|
-
|
|
594
|
-
Select theme via `/settings` or set in `~/.omp/agent/settings.json`.
|
|
595
|
-
|
|
596
|
-
**Custom themes:** Create `~/.omp/agent/themes/*.json`. Custom themes support live reload.
|
|
597
|
-
|
|
598
|
-
```bash
|
|
599
|
-
mkdir -p ~/.omp/agent/themes
|
|
600
|
-
cp $(npm root -g)/@oh-my-pi/pi-coding-agent/dist/theme/dark.json ~/.omp/agent/themes/my-theme.json
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
Select with `/settings`, then edit the file. Changes apply on save.
|
|
604
|
-
|
|
605
|
-
> See [Theme Documentation](docs/theme.md) on how to create custom themes in detail. Omp can help you create a new one.
|
|
606
|
-
|
|
607
|
-
**VS Code terminal fix:** Set `terminal.integrated.minimumContrastRatio` to `1` for accurate colors.
|
|
608
|
-
|
|
609
|
-
### Custom Slash Commands
|
|
610
|
-
|
|
611
|
-
Define reusable prompts as Markdown files:
|
|
612
|
-
|
|
613
|
-
**Locations:**
|
|
614
|
-
|
|
615
|
-
- Global: `~/.omp/agent/commands/*.md`
|
|
616
|
-
- Project: `.omp/commands/*.md`
|
|
617
|
-
|
|
618
|
-
**Format:**
|
|
619
|
-
|
|
620
|
-
```markdown
|
|
621
|
-
---
|
|
622
|
-
description: Review staged git changes
|
|
623
|
-
---
|
|
624
|
-
|
|
625
|
-
Review the staged changes (`git diff --cached`). Focus on:
|
|
626
|
-
|
|
627
|
-
- Bugs and logic errors
|
|
628
|
-
- Security issues
|
|
629
|
-
- Error handling gaps
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
Filename (without `.md`) becomes the command name. Description shown in autocomplete.
|
|
633
|
-
|
|
634
|
-
**Arguments:**
|
|
635
|
-
|
|
636
|
-
```markdown
|
|
637
|
-
---
|
|
638
|
-
description: Create a component
|
|
639
|
-
---
|
|
640
|
-
|
|
641
|
-
Create a React component named $1 with features: $@
|
|
642
|
-
```
|
|
643
|
-
|
|
644
|
-
Usage: `/component Button "onClick handler" "disabled support"`
|
|
645
|
-
|
|
646
|
-
- `$1` = `Button`
|
|
647
|
-
- `$@` = all arguments joined
|
|
648
|
-
|
|
649
|
-
**Namespacing:** Subdirectories create prefixes. `.omp/commands/frontend/component.md` → `/component (project:frontend)`
|
|
650
|
-
|
|
651
|
-
### Skills
|
|
652
|
-
|
|
653
|
-
Skills are self-contained capability packages that the agent loads on-demand. Omp implements the [Agent Skills standard](https://agentskills.io/specification), warning about violations but remaining lenient.
|
|
654
|
-
|
|
655
|
-
A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks. Skills are loaded when the agent decides a task matches the description, or when you explicitly ask to use one.
|
|
656
|
-
|
|
657
|
-
**Example use cases:**
|
|
658
|
-
|
|
659
|
-
- Web search and content extraction (Brave Search API)
|
|
660
|
-
- Browser automation via Chrome DevTools Protocol
|
|
661
|
-
- Google Calendar, Gmail, Drive integration
|
|
662
|
-
- PDF/DOCX processing and creation
|
|
663
|
-
- Speech-to-text transcription
|
|
664
|
-
- YouTube transcript extraction
|
|
665
|
-
|
|
666
|
-
**Skill locations:**
|
|
667
|
-
|
|
668
|
-
- Omp user: `~/.omp/agent/skills/*/SKILL.md`
|
|
669
|
-
- Omp project: `.omp/skills/*/SKILL.md`
|
|
670
|
-
- Claude Code: `~/.claude/skills/*/SKILL.md` and `.claude/skills/*/SKILL.md`
|
|
671
|
-
- Codex CLI: `~/.codex/skills/*/SKILL.md`
|
|
672
|
-
|
|
673
|
-
**Format:**
|
|
674
|
-
|
|
675
|
-
```markdown
|
|
676
|
-
---
|
|
677
|
-
name: brave-search
|
|
678
|
-
description: Web search via Brave Search API. Use for documentation, facts, or web content.
|
|
679
|
-
---
|
|
680
|
-
|
|
681
|
-
# Brave Search
|
|
682
|
-
|
|
683
|
-
## Setup
|
|
684
|
-
|
|
685
|
-
\`\`\`bash
|
|
686
|
-
cd /path/to/brave-search && npm install
|
|
687
|
-
\`\`\`
|
|
688
|
-
|
|
689
|
-
## Usage
|
|
690
|
-
|
|
691
|
-
\`\`\`bash
|
|
692
|
-
./search.js "query" # Basic search
|
|
693
|
-
./search.js "query" --content # Include page content
|
|
694
|
-
\`\`\`
|
|
695
|
-
```
|
|
696
|
-
|
|
697
|
-
- `name`: Required. Must match parent directory name. Lowercase, hyphens, max 64 chars.
|
|
698
|
-
- `description`: Required. Max 1024 chars. Determines when the skill is loaded.
|
|
699
|
-
|
|
700
|
-
**Disable skills:** `omp --no-skills` or set `skills.enabled: false` in settings.
|
|
701
|
-
|
|
702
|
-
> See [docs/skills.md](docs/skills.md) for details, examples, and links to skill repositories. omp can help you create new skills.
|
|
703
|
-
|
|
704
|
-
### Hooks
|
|
705
|
-
|
|
706
|
-
Hooks are TypeScript modules that extend omp's behavior by subscribing to lifecycle events. Use them to:
|
|
707
|
-
|
|
708
|
-
- **Block dangerous commands** (permission gates for `rm -rf`, `sudo`, etc.)
|
|
709
|
-
- **Checkpoint code state** (git stash at each turn, restore on `/branch`)
|
|
710
|
-
- **Protect paths** (block writes to `.env`, `node_modules/`, etc.)
|
|
711
|
-
- **Modify tool output** (filter or transform results before the LLM sees them)
|
|
712
|
-
- **Inject messages from external sources to wake up the agent** (file watchers, webhooks, CI systems)
|
|
713
|
-
|
|
714
|
-
**Hook locations:**
|
|
715
|
-
|
|
716
|
-
- Global: `~/.omp/agent/hooks/pre/*.ts`, `~/.omp/agent/hooks/post/*.ts`
|
|
717
|
-
- Project: `.omp/hooks/pre/*.ts`, `.omp/hooks/post/*.ts`
|
|
718
|
-
- CLI: `--hook <path>` (for debugging)
|
|
719
|
-
|
|
720
|
-
**Quick example** (permission gate):
|
|
721
|
-
|
|
722
|
-
```typescript
|
|
723
|
-
import type { HookAPI } from "@oh-my-pi/pi-coding-agent/hooks";
|
|
724
|
-
|
|
725
|
-
export default function (omp: HookAPI) {
|
|
726
|
-
omp.on("tool_call", async (event, ctx) => {
|
|
727
|
-
if (event.toolName === "bash" && /sudo/.test(event.input.command as string)) {
|
|
728
|
-
const ok = await ctx.ui.confirm("Allow sudo?", event.input.command as string);
|
|
729
|
-
if (!ok) return { block: true, reason: "Blocked by user" };
|
|
730
|
-
}
|
|
731
|
-
return undefined;
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
```
|
|
735
|
-
|
|
736
|
-
**Sending messages from hooks:**
|
|
737
|
-
|
|
738
|
-
Use `omp.sendMessage(message, triggerTurn?)` to inject messages into the session. Messages are persisted as `CustomMessageEntry` and sent to the LLM. If the agent is streaming, the message is queued; otherwise a new agent loop starts if `triggerTurn` is true.
|
|
739
|
-
|
|
740
|
-
```typescript
|
|
741
|
-
import * as fs from "node:fs";
|
|
742
|
-
import type { HookAPI } from "@oh-my-pi/pi-coding-agent/hooks";
|
|
743
|
-
|
|
744
|
-
export default function (omp: HookAPI) {
|
|
745
|
-
omp.on("session_start", async () => {
|
|
746
|
-
fs.watch("/tmp/trigger.txt", () => {
|
|
747
|
-
const content = fs.readFileSync("/tmp/trigger.txt", "utf-8").trim();
|
|
748
|
-
if (content) {
|
|
749
|
-
omp.sendMessage(
|
|
750
|
-
{
|
|
751
|
-
customType: "file-trigger",
|
|
752
|
-
content,
|
|
753
|
-
display: true,
|
|
754
|
-
},
|
|
755
|
-
true,
|
|
756
|
-
); // triggerTurn: start agent loop
|
|
757
|
-
}
|
|
758
|
-
});
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
```
|
|
762
|
-
|
|
763
|
-
> See [Hooks Documentation](docs/hooks.md) for full API reference. omp can help you create new hooks
|
|
764
|
-
|
|
765
|
-
> See [examples/hooks/](examples/hooks/) for working examples including permission gates, git checkpointing, and path protection.
|
|
766
|
-
|
|
767
|
-
### Custom Tools
|
|
768
|
-
|
|
769
|
-
Custom tools let you extend the built-in toolset (read, write, edit, bash, ...) and are called by the LLM directly. They are TypeScript modules that define tools with optional custom TUI integration for getting user input and custom tool call and result rendering.
|
|
770
|
-
|
|
771
|
-
**Tool locations (auto-discovered):**
|
|
772
|
-
|
|
773
|
-
- Global: `~/.omp/agent/tools/*/index.ts`
|
|
774
|
-
- Project: `.omp/tools/*/index.ts`
|
|
775
|
-
|
|
776
|
-
**Explicit paths:**
|
|
777
|
-
|
|
778
|
-
- CLI: `--tool <path>` (any .ts file)
|
|
779
|
-
- Settings: `customTools` array in `settings.json`
|
|
780
|
-
|
|
781
|
-
**Quick example:**
|
|
782
|
-
|
|
783
|
-
```typescript
|
|
784
|
-
import { Type } from "@sinclair/typebox";
|
|
785
|
-
import type { CustomToolFactory } from "@oh-my-pi/pi-coding-agent";
|
|
786
|
-
|
|
787
|
-
const factory: CustomToolFactory = (omp) => ({
|
|
788
|
-
name: "greet",
|
|
789
|
-
label: "Greeting",
|
|
790
|
-
description: "Generate a greeting",
|
|
791
|
-
parameters: Type.Object({
|
|
792
|
-
name: Type.String({ description: "Name to greet" }),
|
|
793
|
-
}),
|
|
794
|
-
|
|
795
|
-
async execute(toolCallId, params, onUpdate, ctx, signal) {
|
|
796
|
-
const { name } = params as { name: string };
|
|
797
|
-
return {
|
|
798
|
-
content: [{ type: "text", text: `Hello, ${name}!` }],
|
|
799
|
-
details: { greeted: name },
|
|
800
|
-
};
|
|
801
|
-
},
|
|
802
|
-
});
|
|
803
|
-
|
|
804
|
-
export default factory;
|
|
805
|
-
```
|
|
806
|
-
|
|
807
|
-
**Features:**
|
|
808
|
-
|
|
809
|
-
- Access to `omp.cwd`, `omp.exec()`, `omp.ui` (select/confirm/input dialogs)
|
|
810
|
-
- Session lifecycle via `onSession` callback (for state reconstruction)
|
|
811
|
-
- Custom rendering via `renderCall()` and `renderResult()` methods
|
|
812
|
-
- Streaming results via `onUpdate` callback
|
|
813
|
-
- Abort handling via `signal` parameter
|
|
814
|
-
- Multiple tools from one factory (return an array)
|
|
815
|
-
|
|
816
|
-
> See [Custom Tools Documentation](docs/custom-tools.md) for the full API reference, TUI component guide, and examples. omp can help you create custom tools.
|
|
817
|
-
|
|
818
|
-
> See [examples/custom-tools/](examples/custom-tools/) for working examples including a todo list with session state management and a question tool with UI interaction.
|
|
819
|
-
|
|
820
|
-
---
|
|
821
|
-
|
|
822
|
-
## CLI Reference
|
|
823
|
-
|
|
824
|
-
```bash
|
|
825
|
-
omp [options] [@files...] [messages...]
|
|
826
|
-
```
|
|
827
|
-
|
|
828
|
-
### Options
|
|
829
|
-
|
|
830
|
-
| Option | Description |
|
|
831
|
-
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
832
|
-
| `--provider <name>` | Provider: `anthropic`, `openai`, `google`, `mistral`, `xai`, `groq`, `cerebras`, `openrouter`, `zai`, `cursor`, `github-copilot`, `openai-codex`, `google-gemini-cli`, `google-antigravity`, or custom |
|
|
833
|
-
| `--model <id>` | Model ID |
|
|
834
|
-
| `--api-key <key>` | API key (overrides environment) |
|
|
835
|
-
| `--system-prompt <text\|file>` | Custom system prompt (text or file path) |
|
|
836
|
-
| `--append-system-prompt <text\|file>` | Append to system prompt |
|
|
837
|
-
| `--mode <mode>` | Output mode: `text`, `json`, `rpc` (implies `--print`) |
|
|
838
|
-
| `--print`, `-p` | Non-interactive: process prompt and exit |
|
|
839
|
-
| `--no-session` | Don't save session |
|
|
840
|
-
| `--session <path>` | Use specific session file |
|
|
841
|
-
| `--session-dir <dir>` | Directory for session storage and lookup |
|
|
842
|
-
| `--continue`, `-c` | Continue most recent session |
|
|
843
|
-
| `--resume`, `-r` | Select session to resume |
|
|
844
|
-
| `--models <patterns>` | Comma-separated patterns for model role cycling. Supports glob patterns (e.g., `anthropic/*`, `*sonnet*:high`) and fuzzy matching (e.g., `sonnet,haiku:low`) |
|
|
845
|
-
| `--no-tools` | Disable all built-in tools |
|
|
846
|
-
| `--tools <tools>` | Restrict to comma-separated tool list (default: all tools enabled) |
|
|
847
|
-
| `--thinking <level>` | Thinking level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |
|
|
848
|
-
| `--extension <path>`, `-e` | Load an extension file (can be used multiple times) |
|
|
849
|
-
| `--no-extensions` | Disable extension discovery (explicit `-e` paths still work) |
|
|
850
|
-
| `--no-skills` | Disable skills discovery and loading |
|
|
851
|
-
| `--skills <patterns>` | Comma-separated glob patterns to filter skills (e.g., `git-*,docker`) |
|
|
852
|
-
| `--no-lsp` | Disable LSP integration |
|
|
853
|
-
| `--hook <path>` | Load a hook file (for debugging) |
|
|
854
|
-
| `--export <file> [output]` | Export session to HTML |
|
|
855
|
-
| `--help`, `-h` | Show help |
|
|
856
|
-
| `--version`, `-v` | Show version |
|
|
857
|
-
|
|
858
|
-
### File Arguments
|
|
859
|
-
|
|
860
|
-
Include files with `@` prefix:
|
|
861
|
-
|
|
862
|
-
```bash
|
|
863
|
-
omp @prompt.md "Answer this"
|
|
864
|
-
omp @screenshot.png "What's in this image?"
|
|
865
|
-
omp @requirements.md @design.png "Implement this"
|
|
866
|
-
```
|
|
867
|
-
|
|
868
|
-
Text files wrapped in `<file name="path">content</file>`. Images attached as base64.
|
|
869
|
-
|
|
870
|
-
### Examples
|
|
871
|
-
|
|
872
|
-
```bash
|
|
873
|
-
# Interactive mode
|
|
874
|
-
omp
|
|
875
|
-
|
|
876
|
-
# Interactive with initial prompt
|
|
877
|
-
omp "List all .ts files in src/"
|
|
878
|
-
|
|
879
|
-
# Non-interactive
|
|
880
|
-
omp -p "List all .ts files in src/"
|
|
881
|
-
|
|
882
|
-
# With files
|
|
883
|
-
omp -p @code.ts "Review this code"
|
|
884
|
-
|
|
885
|
-
# JSON event stream
|
|
886
|
-
omp --mode json "List files"
|
|
887
|
-
|
|
888
|
-
# RPC mode (headless)
|
|
889
|
-
omp --mode rpc --no-session
|
|
890
|
-
|
|
891
|
-
# Continue session
|
|
892
|
-
omp -c "What did we discuss?"
|
|
893
|
-
|
|
894
|
-
# Specific model
|
|
895
|
-
omp --provider openai --model gpt-4o "Help me refactor"
|
|
896
|
-
|
|
897
|
-
# Model cycling with thinking levels
|
|
898
|
-
omp --models sonnet:high,haiku:low
|
|
899
|
-
|
|
900
|
-
# Limit to specific provider with glob pattern
|
|
901
|
-
omp --models "github-copilot/*"
|
|
902
|
-
|
|
903
|
-
# Read-only mode
|
|
904
|
-
omp --tools read,grep,find,ls -p "Review the architecture"
|
|
905
|
-
|
|
906
|
-
# Export session
|
|
907
|
-
omp --export session.jsonl output.html
|
|
908
|
-
```
|
|
909
|
-
|
|
910
|
-
### Environment Variables
|
|
911
|
-
|
|
912
|
-
| Variable | Description |
|
|
913
|
-
| ------------------------------------------- | ----------------------------------------------------------------- |
|
|
914
|
-
| `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, etc. | API keys for providers (see [API Keys & OAuth](#api-keys--oauth)) |
|
|
915
|
-
| `PI_CODING_AGENT_DIR` | Override the agent config directory (default: `~/.omp/agent`) |
|
|
916
|
-
| `VISUAL`, `EDITOR` | External editor for Ctrl+G (e.g., `vim`, `code --wait`) |
|
|
917
|
-
|
|
918
|
-
---
|
|
919
|
-
|
|
920
|
-
## Tools
|
|
921
|
-
|
|
922
|
-
All tools are enabled by default. Use `--tools <list>` to restrict to a subset.
|
|
923
|
-
|
|
924
|
-
### Core Tools
|
|
925
|
-
|
|
926
|
-
| Tool | Description |
|
|
927
|
-
| ------- | --------------------------------------------------------------------------------------------------------- |
|
|
928
|
-
| `read` | Read file contents. Images sent as attachments. Text: first 2000 lines. Use offset/limit for large files. |
|
|
929
|
-
| `write` | Write/overwrite file. Creates parent directories. |
|
|
930
|
-
| `edit` | Replace text in file with fuzzy whitespace matching. Fails if text appears multiple times or not found. |
|
|
931
|
-
| `bash` | Execute command. Returns stdout/stderr. Optional `timeout` parameter. |
|
|
932
|
-
| `grep` | Search file contents (regex or literal). Respects `.gitignore`. |
|
|
933
|
-
| `find` | Search for files by glob pattern. Respects `.gitignore`. |
|
|
934
|
-
| `ls` | List directory contents. Includes dotfiles. |
|
|
935
|
-
|
|
936
|
-
### Additional Built-in Tools
|
|
937
|
-
|
|
938
|
-
| Tool | Description |
|
|
939
|
-
| ------------ | ---------------------------------------------------------------------- |
|
|
940
|
-
| `task` | Spawn sub-agents for complex multi-step tasks |
|
|
941
|
-
| `lsp` | Language Server Protocol queries (go-to-definition, references, hover) |
|
|
942
|
-
| `todo_write` | Track task progress during sessions |
|
|
943
|
-
| `web_search` | Search the web |
|
|
944
|
-
| `fetch` | Fetch and process URLs |
|
|
945
|
-
| `python` | Execute Python code in IPython kernel |
|
|
946
|
-
| `notebook` | Edit Jupyter notebook cells |
|
|
947
|
-
|
|
948
|
-
Example: `--tools read,grep,find,ls` for read-only code review.
|
|
949
|
-
|
|
950
|
-
For adding new tools, see [Custom Tools](#custom-tools) in the Configuration section.
|
|
951
|
-
|
|
952
|
-
---
|
|
953
|
-
|
|
954
|
-
## Programmatic Usage
|
|
955
|
-
|
|
956
|
-
### SDK
|
|
957
|
-
|
|
958
|
-
For embedding omp in Node.js/TypeScript applications, use the SDK:
|
|
959
|
-
|
|
960
|
-
```typescript
|
|
961
|
-
import { createAgentSession, discoverAuthStorage, discoverModels, SessionManager } from "@oh-my-pi/pi-coding-agent";
|
|
962
|
-
|
|
963
|
-
const authStorage = await discoverAuthStorage();
|
|
964
|
-
const modelRegistry = await discoverModels(authStorage);
|
|
965
|
-
|
|
966
|
-
const { session } = await createAgentSession({
|
|
967
|
-
sessionManager: SessionManager.inMemory(),
|
|
968
|
-
authStorage,
|
|
969
|
-
modelRegistry,
|
|
970
|
-
});
|
|
971
|
-
|
|
972
|
-
session.subscribe((event) => {
|
|
973
|
-
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta") {
|
|
974
|
-
process.stdout.write(event.assistantMessageEvent.delta);
|
|
975
|
-
}
|
|
976
|
-
});
|
|
977
|
-
|
|
978
|
-
await session.prompt("What files are in the current directory?");
|
|
979
|
-
```
|
|
980
|
-
|
|
981
|
-
The SDK provides full control over:
|
|
982
|
-
|
|
983
|
-
- Model selection and thinking level
|
|
984
|
-
- System prompt (replace or modify)
|
|
985
|
-
- Tools (built-in subsets, custom tools)
|
|
986
|
-
- Hooks (inline or discovered)
|
|
987
|
-
- Skills, context files, slash commands
|
|
988
|
-
- Session persistence (`SessionManager`)
|
|
989
|
-
- Settings (`SettingsManager`)
|
|
990
|
-
- API key resolution and OAuth
|
|
991
|
-
|
|
992
|
-
**Philosophy:** "Omit to discover, provide to override." Omit an option and omp discovers from standard locations. Provide an option and your value is used.
|
|
993
|
-
|
|
994
|
-
> See [SDK Documentation](docs/sdk.md) for the full API reference. See [examples/sdk/](examples/sdk/) for working examples from minimal to full control.
|
|
995
|
-
|
|
996
|
-
### RPC Mode
|
|
997
|
-
|
|
998
|
-
For embedding omp from other languages or with process isolation:
|
|
999
|
-
|
|
1000
|
-
```bash
|
|
1001
|
-
omp --mode rpc --no-session
|
|
1002
|
-
```
|
|
1003
|
-
|
|
1004
|
-
Send JSON commands on stdin:
|
|
1005
|
-
|
|
1006
|
-
```json
|
|
1007
|
-
{"type":"prompt","message":"List all .ts files"}
|
|
1008
|
-
{"type":"abort"}
|
|
1009
|
-
```
|
|
1010
|
-
|
|
1011
|
-
> See [RPC Documentation](docs/rpc.md) for the full protocol.
|
|
1012
|
-
|
|
1013
|
-
### HTML Export
|
|
1014
|
-
|
|
1015
|
-
```bash
|
|
1016
|
-
omp --export session.jsonl # Auto-generated filename
|
|
1017
|
-
omp --export session.jsonl output.html # Custom filename
|
|
1018
|
-
```
|
|
1019
|
-
|
|
1020
|
-
Works with both session files and streaming event logs from `--mode json`.
|
|
1021
|
-
|
|
1022
|
-
---
|
|
1023
|
-
|
|
1024
|
-
## Philosophy
|
|
1025
|
-
|
|
1026
|
-
Omp is a fork of [Pi](https://github.com/badlogic/pi) by [Mario Zechner](https://github.com/badlogic). Pi is intentionally minimal—no MCP, no sub-agents, no built-in todos. Omp is the opposite: batteries included.
|
|
1027
|
-
|
|
1028
|
-
**Yin to Pi's Yang.** Same foundation, different philosophy. Pi strips away; omp adds on. Both are valid approaches—pick what fits your workflow.
|
|
1029
|
-
|
|
1030
|
-
**Full toolset by default.** Sub-agents, MCP, LSP, web search, Python execution, todo tracking—all enabled out of the box. Use `--tools` to restrict when needed.
|
|
1031
|
-
|
|
1032
|
-
**Agent orchestration built-in.** The Task tool spawns specialized sub-agents (explore, plan, reviewer, task) for complex multi-step work. Parallelism and delegation, not just chat.
|
|
1033
|
-
|
|
1034
|
-
**Multiple extension points.** [Skills](#skills) for on-demand capabilities, [Hooks](#hooks) for lifecycle control, [Custom Tools](#custom-tools) for new abilities, MCP for existing integrations.
|
|
1035
|
-
|
|
1036
|
-
---
|
|
1037
|
-
|
|
1038
|
-
## Development
|
|
1039
|
-
|
|
1040
|
-
### Debug Command
|
|
1041
|
-
|
|
1042
|
-
`/debug` (hidden) writes rendered lines with ANSI codes to `~/.omp/agent/omp-debug.log` for TUI debugging, as well as the last set of messages that were sent to the LLM.
|
|
1043
|
-
|
|
1044
|
-
For architecture and contribution guidelines, see [DEVELOPMENT.md](./DEVELOPMENT.md).
|
|
1045
|
-
|
|
1046
|
-
---
|
|
1047
|
-
|
|
1048
|
-
## License
|
|
1049
|
-
|
|
1050
|
-
MIT
|
|
1051
|
-
|
|
1052
|
-
## See Also
|
|
1053
|
-
|
|
1054
|
-
- [@oh-my-pi/pi-ai](https://www.npmjs.com/package/@oh-my-pi/pi-ai): Core LLM toolkit
|
|
1055
|
-
- [@oh-my-pi/pi-agent-core](https://www.npmjs.com/package/@oh-my-pi/pi-agent-core): Agent framework
|
|
9
|
+
Package-specific references:
|
|
10
|
+
- [CHANGELOG](./CHANGELOG.md)
|
|
11
|
+
- [Documentation](./docs/)
|
|
12
|
+
- [DEVELOPMENT](./DEVELOPMENT.md)
|