@oh-my-pi/pi-coding-agent 2.3.1337 → 3.1.1337
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 +72 -34
- package/README.md +100 -100
- package/docs/compaction.md +8 -8
- package/docs/config-usage.md +113 -0
- package/docs/custom-tools.md +8 -8
- package/docs/extension-loading.md +58 -58
- package/docs/hooks.md +11 -11
- package/docs/rpc.md +4 -4
- package/docs/sdk.md +14 -14
- package/docs/session-tree-plan.md +1 -1
- package/docs/session.md +2 -2
- package/docs/skills.md +16 -16
- package/docs/theme.md +9 -9
- package/docs/tui.md +1 -1
- package/examples/README.md +1 -1
- package/examples/custom-tools/README.md +4 -4
- package/examples/custom-tools/subagent/README.md +13 -13
- package/examples/custom-tools/subagent/agents.ts +2 -2
- package/examples/custom-tools/subagent/index.ts +5 -5
- package/examples/hooks/README.md +3 -3
- package/examples/hooks/auto-commit-on-exit.ts +1 -1
- package/examples/hooks/custom-compaction.ts +1 -1
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/05-tools.ts +1 -1
- package/examples/sdk/08-slash-commands.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
- package/examples/sdk/README.md +2 -2
- package/package.json +13 -11
- package/src/capability/context-file.ts +40 -0
- package/src/capability/extension.ts +48 -0
- package/src/capability/hook.ts +40 -0
- package/src/capability/index.ts +616 -0
- package/src/capability/instruction.ts +37 -0
- package/src/capability/mcp.ts +52 -0
- package/src/capability/prompt.ts +35 -0
- package/src/capability/rule.ts +52 -0
- package/src/capability/settings.ts +35 -0
- package/src/capability/skill.ts +49 -0
- package/src/capability/slash-command.ts +40 -0
- package/src/capability/system-prompt.ts +35 -0
- package/src/capability/tool.ts +38 -0
- package/src/capability/types.ts +166 -0
- package/src/cli/args.ts +2 -2
- package/src/cli/plugin-cli.ts +24 -19
- package/src/cli/update-cli.ts +10 -10
- package/src/config.ts +290 -6
- package/src/core/auth-storage.ts +32 -9
- package/src/core/bash-executor.ts +1 -1
- package/src/core/custom-commands/loader.ts +44 -50
- package/src/core/custom-tools/index.ts +1 -0
- package/src/core/custom-tools/loader.ts +67 -69
- package/src/core/custom-tools/types.ts +10 -1
- package/src/core/hooks/loader.ts +13 -42
- package/src/core/index.ts +0 -1
- package/src/core/logger.ts +7 -7
- package/src/core/mcp/client.ts +1 -1
- package/src/core/mcp/config.ts +94 -146
- package/src/core/mcp/index.ts +0 -4
- package/src/core/mcp/loader.ts +26 -22
- package/src/core/mcp/manager.ts +18 -23
- package/src/core/mcp/tool-bridge.ts +9 -1
- package/src/core/mcp/types.ts +2 -0
- package/src/core/model-registry.ts +25 -8
- package/src/core/plugins/installer.ts +1 -1
- package/src/core/plugins/loader.ts +17 -11
- package/src/core/plugins/manager.ts +2 -2
- package/src/core/plugins/paths.ts +12 -7
- package/src/core/plugins/types.ts +3 -3
- package/src/core/sdk.ts +48 -27
- package/src/core/session-manager.ts +4 -4
- package/src/core/settings-manager.ts +45 -21
- package/src/core/skills.ts +208 -293
- package/src/core/slash-commands.ts +34 -165
- package/src/core/system-prompt.ts +58 -65
- package/src/core/timings.ts +2 -2
- package/src/core/tools/lsp/config.ts +38 -17
- package/src/core/tools/task/agents.ts +21 -0
- package/src/core/tools/task/artifacts.ts +1 -1
- package/src/core/tools/task/bundled-agents/reviewer.md +2 -1
- package/src/core/tools/task/bundled-agents/task.md +1 -0
- package/src/core/tools/task/commands.ts +30 -107
- package/src/core/tools/task/discovery.ts +75 -66
- package/src/core/tools/task/executor.ts +25 -10
- package/src/core/tools/task/index.ts +35 -10
- package/src/core/tools/task/model-resolver.ts +27 -25
- package/src/core/tools/task/types.ts +6 -2
- package/src/core/tools/web-fetch.ts +3 -3
- package/src/core/tools/web-search/auth.ts +40 -34
- package/src/core/tools/web-search/index.ts +1 -1
- package/src/core/tools/web-search/providers/anthropic.ts +1 -1
- package/src/discovery/agents-md.ts +75 -0
- package/src/discovery/builtin.ts +646 -0
- package/src/discovery/claude.ts +623 -0
- package/src/discovery/cline.ts +102 -0
- package/src/discovery/codex.ts +571 -0
- package/src/discovery/cursor.ts +264 -0
- package/src/discovery/gemini.ts +368 -0
- package/src/discovery/github.ts +120 -0
- package/src/discovery/helpers.test.ts +127 -0
- package/src/discovery/helpers.ts +249 -0
- package/src/discovery/index.ts +84 -0
- package/src/discovery/mcp-json.ts +127 -0
- package/src/discovery/vscode.ts +99 -0
- package/src/discovery/windsurf.ts +216 -0
- package/src/main.ts +14 -13
- package/src/migrations.ts +24 -3
- package/src/modes/interactive/components/hook-editor.ts +1 -1
- package/src/modes/interactive/components/plugin-settings.ts +1 -1
- package/src/modes/interactive/components/settings-defs.ts +38 -2
- package/src/modes/interactive/components/settings-selector.ts +1 -0
- package/src/modes/interactive/components/welcome.ts +2 -2
- package/src/modes/interactive/interactive-mode.ts +233 -16
- package/src/modes/interactive/theme/theme-schema.json +1 -1
- package/src/utils/clipboard.ts +1 -1
- package/src/utils/shell-snapshot.ts +2 -2
- package/src/utils/shell.ts +7 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# omp
|
|
2
2
|
|
|
3
3
|
A terminal-based coding agent with multi-model support, mid-session model switching, and a simple CLI for headless coding tasks.
|
|
4
4
|
|
|
@@ -51,7 +51,7 @@ Works on Linux, macOS, and Windows (requires bash; see [Windows Setup](#windows-
|
|
|
51
51
|
**npm (recommended):**
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
npm install -g @oh-my-pi/
|
|
54
|
+
npm install -g @oh-my-pi/omp-coding-agent
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
**Standalone binary:**
|
|
@@ -60,23 +60,23 @@ Download from [GitHub Releases](https://github.com/badlogic/pi-mono/releases):
|
|
|
60
60
|
|
|
61
61
|
| Platform | Archive |
|
|
62
62
|
| ------------------- | ------------------------ |
|
|
63
|
-
| macOS Apple Silicon | `
|
|
64
|
-
| macOS Intel | `
|
|
65
|
-
| Linux x64 | `
|
|
66
|
-
| Linux ARM64 | `
|
|
67
|
-
| Windows x64 | `
|
|
63
|
+
| macOS Apple Silicon | `omp-darwin-arm64.tar.gz` |
|
|
64
|
+
| macOS Intel | `omp-darwin-x64.tar.gz` |
|
|
65
|
+
| Linux x64 | `omp-linux-x64.tar.gz` |
|
|
66
|
+
| Linux ARM64 | `omp-linux-arm64.tar.gz` |
|
|
67
|
+
| Windows x64 | `omp-windows-x64.zip` |
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
70
|
# macOS/Linux
|
|
71
|
-
tar -xzf
|
|
72
|
-
./
|
|
71
|
+
tar -xzf omp-darwin-arm64.tar.gz
|
|
72
|
+
./omp
|
|
73
73
|
|
|
74
74
|
# Windows
|
|
75
|
-
unzip
|
|
76
|
-
|
|
75
|
+
unzip omp-windows-x64.zip
|
|
76
|
+
omp.exe
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
**macOS note:** The binary is unsigned. If blocked, run: `xattr -c ./
|
|
79
|
+
**macOS note:** The binary is unsigned. If blocked, run: `xattr -c ./omp`
|
|
80
80
|
|
|
81
81
|
**Build from source** (requires [Bun](https://bun.sh) 1.0+):
|
|
82
82
|
|
|
@@ -84,14 +84,14 @@ pi.exe
|
|
|
84
84
|
git clone https://github.com/can1357/oh-my-pi.git
|
|
85
85
|
cd pi-mono && npm install
|
|
86
86
|
cd packages/coding-agent && npm run build:binary
|
|
87
|
-
./dist/
|
|
87
|
+
./dist/omp
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
### Windows Setup
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
Omp requires a bash shell on Windows. Checked locations (in order):
|
|
93
93
|
|
|
94
|
-
1. Custom path from `~/.
|
|
94
|
+
1. Custom path from `~/.omp/agent/settings.json`
|
|
95
95
|
2. Git Bash (`C:\Program Files\Git\bin\bash.exe`)
|
|
96
96
|
3. `bash.exe` on PATH (Cygwin, MSYS2, WSL)
|
|
97
97
|
|
|
@@ -100,7 +100,7 @@ For most users, [Git for Windows](https://git-scm.com/download/win) is sufficien
|
|
|
100
100
|
**Custom shell path:**
|
|
101
101
|
|
|
102
102
|
```json
|
|
103
|
-
// ~/.
|
|
103
|
+
// ~/.omp/agent/settings.json
|
|
104
104
|
{
|
|
105
105
|
"shellPath": "C:\\cygwin64\\bin\\bash.exe"
|
|
106
106
|
}
|
|
@@ -110,7 +110,7 @@ For most users, [Git for Windows](https://git-scm.com/download/win) is sufficien
|
|
|
110
110
|
|
|
111
111
|
**Option 1: Auth file** (recommended)
|
|
112
112
|
|
|
113
|
-
Add API keys to `~/.
|
|
113
|
+
Add API keys to `~/.omp/agent/auth.json`:
|
|
114
114
|
|
|
115
115
|
```json
|
|
116
116
|
{
|
|
@@ -148,7 +148,7 @@ Use `/login` to authenticate with subscription-based or free-tier providers:
|
|
|
148
148
|
| Google Antigravity | Gemini 3, Claude, GPT-OSS | Free (Google account) |
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
|
-
|
|
151
|
+
omp
|
|
152
152
|
/login # Select provider, authorize in browser
|
|
153
153
|
```
|
|
154
154
|
|
|
@@ -165,13 +165,13 @@ pi
|
|
|
165
165
|
- Antigravity uses a sandbox endpoint with access to Gemini 3, Claude (sonnet/opus thinking), and GPT-OSS models
|
|
166
166
|
- Both are free with any Google account, subject to rate limits
|
|
167
167
|
|
|
168
|
-
Credentials stored in `~/.
|
|
168
|
+
Credentials stored in `~/.omp/agent/auth.json`. Use `/logout` to clear.
|
|
169
169
|
|
|
170
170
|
### Quick Start
|
|
171
171
|
|
|
172
172
|
```bash
|
|
173
173
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
174
|
-
|
|
174
|
+
omp
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
Then chat:
|
|
@@ -303,18 +303,18 @@ See [docs/session.md](docs/session.md) for the file format and programmatic API.
|
|
|
303
303
|
|
|
304
304
|
### Session Management
|
|
305
305
|
|
|
306
|
-
Sessions auto-save to `~/.
|
|
306
|
+
Sessions auto-save to `~/.omp/agent/sessions/` organized by working directory.
|
|
307
307
|
|
|
308
308
|
```bash
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
omp --continue # Continue most recent session
|
|
310
|
+
omp -c # Short form
|
|
311
311
|
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
omp --resume # Browse and select from past sessions
|
|
313
|
+
omp -r # Short form
|
|
314
314
|
|
|
315
|
-
|
|
315
|
+
omp --no-session # Ephemeral mode (don't save)
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
omp --session /path/to/file.jsonl # Use specific session file
|
|
318
318
|
```
|
|
319
319
|
|
|
320
320
|
### Context Compaction
|
|
@@ -330,7 +330,7 @@ Long sessions can exhaust context windows. Compaction summarizes older messages
|
|
|
330
330
|
|
|
331
331
|
When disabled, neither case triggers automatic compaction (use `/compact` manually if needed).
|
|
332
332
|
|
|
333
|
-
**Configuration** (`~/.
|
|
333
|
+
**Configuration** (`~/.omp/agent/settings.json`):
|
|
334
334
|
|
|
335
335
|
```json
|
|
336
336
|
{
|
|
@@ -368,9 +368,9 @@ See [docs/compaction.md](docs/compaction.md) for how compaction works internally
|
|
|
368
368
|
|
|
369
369
|
### Project Context Files
|
|
370
370
|
|
|
371
|
-
|
|
371
|
+
Omp loads `AGENTS.md` (or `CLAUDE.md`) files at startup in this order:
|
|
372
372
|
|
|
373
|
-
1. **Global:** `~/.
|
|
373
|
+
1. **Global:** `~/.omp/agent/AGENTS.md`
|
|
374
374
|
2. **Parent directories:** Walking up from current directory
|
|
375
375
|
3. **Current directory:** `./AGENTS.md`
|
|
376
376
|
|
|
@@ -398,10 +398,10 @@ Use these for:
|
|
|
398
398
|
|
|
399
399
|
Replace the default system prompt entirely by creating a `SYSTEM.md` file:
|
|
400
400
|
|
|
401
|
-
1. **Project-local:** `.
|
|
402
|
-
2. **Global:** `~/.
|
|
401
|
+
1. **Project-local:** `.omp/SYSTEM.md` (takes precedence)
|
|
402
|
+
2. **Global:** `~/.omp/agent/SYSTEM.md` (fallback)
|
|
403
403
|
|
|
404
|
-
This is useful when using
|
|
404
|
+
This is useful when using omp as different types of agents across repos (coding assistant, personal assistant, domain-specific agent, etc.).
|
|
405
405
|
|
|
406
406
|
```markdown
|
|
407
407
|
You are a technical writing assistant. Help users write clear documentation.
|
|
@@ -417,7 +417,7 @@ The `--system-prompt` CLI flag overrides both files. Use `--append-system-prompt
|
|
|
417
417
|
|
|
418
418
|
### Custom Models and Providers
|
|
419
419
|
|
|
420
|
-
Add custom models (Ollama, vLLM, LM Studio, etc.) via `~/.
|
|
420
|
+
Add custom models (Ollama, vLLM, LM Studio, etc.) via `~/.omp/agent/models.json`:
|
|
421
421
|
|
|
422
422
|
```json
|
|
423
423
|
{
|
|
@@ -488,18 +488,18 @@ Add custom models (Ollama, vLLM, LM Studio, etc.) via `~/.pi/agent/models.json`:
|
|
|
488
488
|
4. Saved default from settings
|
|
489
489
|
5. First available model with valid API key
|
|
490
490
|
|
|
491
|
-
>
|
|
491
|
+
> omp can help you create custom provider and model configurations.
|
|
492
492
|
|
|
493
493
|
### Settings File
|
|
494
494
|
|
|
495
495
|
Settings are loaded from two locations and merged:
|
|
496
496
|
|
|
497
|
-
1. **Global:** `~/.
|
|
498
|
-
2. **Project:** `<cwd>/.
|
|
497
|
+
1. **Global:** `~/.omp/agent/settings.json` - user preferences
|
|
498
|
+
2. **Project:** `<cwd>/.omp/settings.json` - project-specific overrides (version control friendly)
|
|
499
499
|
|
|
500
500
|
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.
|
|
501
501
|
|
|
502
|
-
Global `~/.
|
|
502
|
+
Global `~/.omp/agent/settings.json` stores persistent preferences:
|
|
503
503
|
|
|
504
504
|
```json
|
|
505
505
|
{
|
|
@@ -563,18 +563,18 @@ Global `~/.pi/agent/settings.json` stores persistent preferences:
|
|
|
563
563
|
|
|
564
564
|
Built-in themes: `dark` (default), `light`. Auto-detected on first run.
|
|
565
565
|
|
|
566
|
-
Select theme via `/settings` or set in `~/.
|
|
566
|
+
Select theme via `/settings` or set in `~/.omp/agent/settings.json`.
|
|
567
567
|
|
|
568
|
-
**Custom themes:** Create `~/.
|
|
568
|
+
**Custom themes:** Create `~/.omp/agent/themes/*.json`. Custom themes support live reload.
|
|
569
569
|
|
|
570
570
|
```bash
|
|
571
|
-
mkdir -p ~/.
|
|
572
|
-
cp $(npm root -g)/@oh-my-pi/
|
|
571
|
+
mkdir -p ~/.omp/agent/themes
|
|
572
|
+
cp $(npm root -g)/@oh-my-pi/omp-coding-agent/dist/theme/dark.json ~/.omp/agent/themes/my-theme.json
|
|
573
573
|
```
|
|
574
574
|
|
|
575
575
|
Select with `/settings`, then edit the file. Changes apply on save.
|
|
576
576
|
|
|
577
|
-
> See [Theme Documentation](docs/theme.md) on how to create custom themes in detail.
|
|
577
|
+
> See [Theme Documentation](docs/theme.md) on how to create custom themes in detail. Omp can help you create a new one.
|
|
578
578
|
|
|
579
579
|
**VS Code terminal fix:** Set `terminal.integrated.minimumContrastRatio` to `1` for accurate colors.
|
|
580
580
|
|
|
@@ -584,8 +584,8 @@ Define reusable prompts as Markdown files:
|
|
|
584
584
|
|
|
585
585
|
**Locations:**
|
|
586
586
|
|
|
587
|
-
- Global: `~/.
|
|
588
|
-
- Project: `.
|
|
587
|
+
- Global: `~/.omp/agent/commands/*.md`
|
|
588
|
+
- Project: `.omp/commands/*.md`
|
|
589
589
|
|
|
590
590
|
**Format:**
|
|
591
591
|
|
|
@@ -618,11 +618,11 @@ Usage: `/component Button "onClick handler" "disabled support"`
|
|
|
618
618
|
- `$1` = `Button`
|
|
619
619
|
- `$@` = all arguments joined
|
|
620
620
|
|
|
621
|
-
**Namespacing:** Subdirectories create prefixes. `.
|
|
621
|
+
**Namespacing:** Subdirectories create prefixes. `.omp/commands/frontend/component.md` → `/component (project:frontend)`
|
|
622
622
|
|
|
623
623
|
### Skills
|
|
624
624
|
|
|
625
|
-
Skills are self-contained capability packages that the agent loads on-demand.
|
|
625
|
+
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.
|
|
626
626
|
|
|
627
627
|
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.
|
|
628
628
|
|
|
@@ -637,8 +637,8 @@ A skill provides specialized workflows, setup instructions, helper scripts, and
|
|
|
637
637
|
|
|
638
638
|
**Skill locations:**
|
|
639
639
|
|
|
640
|
-
-
|
|
641
|
-
-
|
|
640
|
+
- Omp user: `~/.omp/agent/skills/**/SKILL.md` (recursive)
|
|
641
|
+
- Omp project: `.omp/skills/**/SKILL.md` (recursive)
|
|
642
642
|
- Claude Code: `~/.claude/skills/*/SKILL.md` and `.claude/skills/*/SKILL.md`
|
|
643
643
|
- Codex CLI: `~/.codex/skills/**/SKILL.md` (recursive)
|
|
644
644
|
|
|
@@ -669,13 +669,13 @@ cd /path/to/brave-search && npm install
|
|
|
669
669
|
- `name`: Required. Must match parent directory name. Lowercase, hyphens, max 64 chars.
|
|
670
670
|
- `description`: Required. Max 1024 chars. Determines when the skill is loaded.
|
|
671
671
|
|
|
672
|
-
**Disable skills:** `
|
|
672
|
+
**Disable skills:** `omp --no-skills` or set `skills.enabled: false` in settings.
|
|
673
673
|
|
|
674
|
-
> See [docs/skills.md](docs/skills.md) for details, examples, and links to skill repositories.
|
|
674
|
+
> See [docs/skills.md](docs/skills.md) for details, examples, and links to skill repositories. omp can help you create new skills.
|
|
675
675
|
|
|
676
676
|
### Hooks
|
|
677
677
|
|
|
678
|
-
Hooks are TypeScript modules that extend
|
|
678
|
+
Hooks are TypeScript modules that extend omp's behavior by subscribing to lifecycle events. Use them to:
|
|
679
679
|
|
|
680
680
|
- **Block dangerous commands** (permission gates for `rm -rf`, `sudo`, etc.)
|
|
681
681
|
- **Checkpoint code state** (git stash at each turn, restore on `/branch`)
|
|
@@ -685,17 +685,17 @@ Hooks are TypeScript modules that extend pi's behavior by subscribing to lifecyc
|
|
|
685
685
|
|
|
686
686
|
**Hook locations:**
|
|
687
687
|
|
|
688
|
-
- Global: `~/.
|
|
689
|
-
- Project: `.
|
|
688
|
+
- Global: `~/.omp/agent/hooks/*.ts`
|
|
689
|
+
- Project: `.omp/hooks/*.ts`
|
|
690
690
|
- CLI: `--hook <path>` (for debugging)
|
|
691
691
|
|
|
692
692
|
**Quick example** (permission gate):
|
|
693
693
|
|
|
694
694
|
```typescript
|
|
695
|
-
import type { HookAPI } from "@oh-my-pi/
|
|
695
|
+
import type { HookAPI } from "@oh-my-pi/omp-coding-agent/hooks";
|
|
696
696
|
|
|
697
|
-
export default function (
|
|
698
|
-
|
|
697
|
+
export default function (omp: HookAPI) {
|
|
698
|
+
omp.on("tool_call", async (event, ctx) => {
|
|
699
699
|
if (event.toolName === "bash" && /sudo/.test(event.input.command as string)) {
|
|
700
700
|
const ok = await ctx.ui.confirm("Allow sudo?", event.input.command as string);
|
|
701
701
|
if (!ok) return { block: true, reason: "Blocked by user" };
|
|
@@ -707,18 +707,18 @@ export default function (pi: HookAPI) {
|
|
|
707
707
|
|
|
708
708
|
**Sending messages from hooks:**
|
|
709
709
|
|
|
710
|
-
Use `
|
|
710
|
+
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.
|
|
711
711
|
|
|
712
712
|
```typescript
|
|
713
713
|
import * as fs from "node:fs";
|
|
714
|
-
import type { HookAPI } from "@oh-my-pi/
|
|
714
|
+
import type { HookAPI } from "@oh-my-pi/omp-coding-agent/hooks";
|
|
715
715
|
|
|
716
|
-
export default function (
|
|
717
|
-
|
|
716
|
+
export default function (omp: HookAPI) {
|
|
717
|
+
omp.on("session_start", async () => {
|
|
718
718
|
fs.watch("/tmp/trigger.txt", () => {
|
|
719
719
|
const content = fs.readFileSync("/tmp/trigger.txt", "utf-8").trim();
|
|
720
720
|
if (content) {
|
|
721
|
-
|
|
721
|
+
omp.sendMessage(
|
|
722
722
|
{
|
|
723
723
|
customType: "file-trigger",
|
|
724
724
|
content,
|
|
@@ -732,7 +732,7 @@ export default function (pi: HookAPI) {
|
|
|
732
732
|
}
|
|
733
733
|
```
|
|
734
734
|
|
|
735
|
-
> See [Hooks Documentation](docs/hooks.md) for full API reference.
|
|
735
|
+
> See [Hooks Documentation](docs/hooks.md) for full API reference. omp can help you create new hooks
|
|
736
736
|
|
|
737
737
|
> See [examples/hooks/](examples/hooks/) for working examples including permission gates, git checkpointing, and path protection.
|
|
738
738
|
|
|
@@ -742,8 +742,8 @@ Custom tools let you extend the built-in toolset (read, write, edit, bash, ...)
|
|
|
742
742
|
|
|
743
743
|
**Tool locations (auto-discovered):**
|
|
744
744
|
|
|
745
|
-
- Global: `~/.
|
|
746
|
-
- Project: `.
|
|
745
|
+
- Global: `~/.omp/agent/tools/*/index.ts`
|
|
746
|
+
- Project: `.omp/tools/*/index.ts`
|
|
747
747
|
|
|
748
748
|
**Explicit paths:**
|
|
749
749
|
|
|
@@ -754,9 +754,9 @@ Custom tools let you extend the built-in toolset (read, write, edit, bash, ...)
|
|
|
754
754
|
|
|
755
755
|
```typescript
|
|
756
756
|
import { Type } from "@sinclair/typebox";
|
|
757
|
-
import type { CustomToolFactory } from "@oh-my-pi/
|
|
757
|
+
import type { CustomToolFactory } from "@oh-my-pi/omp-coding-agent";
|
|
758
758
|
|
|
759
|
-
const factory: CustomToolFactory = (
|
|
759
|
+
const factory: CustomToolFactory = (omp) => ({
|
|
760
760
|
name: "greet",
|
|
761
761
|
label: "Greeting",
|
|
762
762
|
description: "Generate a greeting",
|
|
@@ -778,14 +778,14 @@ export default factory;
|
|
|
778
778
|
|
|
779
779
|
**Features:**
|
|
780
780
|
|
|
781
|
-
- Access to `
|
|
781
|
+
- Access to `omp.cwd`, `omp.exec()`, `omp.ui` (select/confirm/input dialogs)
|
|
782
782
|
- Session lifecycle via `onSession` callback (for state reconstruction)
|
|
783
783
|
- Custom rendering via `renderCall()` and `renderResult()` methods
|
|
784
784
|
- Streaming results via `onUpdate` callback
|
|
785
785
|
- Abort handling via `signal` parameter
|
|
786
786
|
- Multiple tools from one factory (return an array)
|
|
787
787
|
|
|
788
|
-
> See [Custom Tools Documentation](docs/custom-tools.md) for the full API reference, TUI component guide, and examples.
|
|
788
|
+
> 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.
|
|
789
789
|
|
|
790
790
|
> 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.
|
|
791
791
|
|
|
@@ -794,7 +794,7 @@ export default factory;
|
|
|
794
794
|
## CLI Reference
|
|
795
795
|
|
|
796
796
|
```bash
|
|
797
|
-
|
|
797
|
+
omp [options] [@files...] [messages...]
|
|
798
798
|
```
|
|
799
799
|
|
|
800
800
|
### Options
|
|
@@ -828,9 +828,9 @@ pi [options] [@files...] [messages...]
|
|
|
828
828
|
Include files with `@` prefix:
|
|
829
829
|
|
|
830
830
|
```bash
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
831
|
+
omp @prompt.md "Answer this"
|
|
832
|
+
omp @screenshot.png "What's in this image?"
|
|
833
|
+
omp @requirements.md @design.png "Implement this"
|
|
834
834
|
```
|
|
835
835
|
|
|
836
836
|
Text files wrapped in `<file name="path">content</file>`. Images attached as base64.
|
|
@@ -839,40 +839,40 @@ Text files wrapped in `<file name="path">content</file>`. Images attached as bas
|
|
|
839
839
|
|
|
840
840
|
```bash
|
|
841
841
|
# Interactive mode
|
|
842
|
-
|
|
842
|
+
omp
|
|
843
843
|
|
|
844
844
|
# Interactive with initial prompt
|
|
845
|
-
|
|
845
|
+
omp "List all .ts files in src/"
|
|
846
846
|
|
|
847
847
|
# Non-interactive
|
|
848
|
-
|
|
848
|
+
omp -p "List all .ts files in src/"
|
|
849
849
|
|
|
850
850
|
# With files
|
|
851
|
-
|
|
851
|
+
omp -p @code.ts "Review this code"
|
|
852
852
|
|
|
853
853
|
# JSON event stream
|
|
854
|
-
|
|
854
|
+
omp --mode json "List files"
|
|
855
855
|
|
|
856
856
|
# RPC mode (headless)
|
|
857
|
-
|
|
857
|
+
omp --mode rpc --no-session
|
|
858
858
|
|
|
859
859
|
# Continue session
|
|
860
|
-
|
|
860
|
+
omp -c "What did we discuss?"
|
|
861
861
|
|
|
862
862
|
# Specific model
|
|
863
|
-
|
|
863
|
+
omp --provider openai --model gpt-4o "Help me refactor"
|
|
864
864
|
|
|
865
865
|
# Model cycling with thinking levels
|
|
866
|
-
|
|
866
|
+
omp --models sonnet:high,haiku:low
|
|
867
867
|
|
|
868
868
|
# Limit to specific provider with glob pattern
|
|
869
|
-
|
|
869
|
+
omp --models "github-copilot/*"
|
|
870
870
|
|
|
871
871
|
# Read-only mode
|
|
872
|
-
|
|
872
|
+
omp --tools read,grep,find,ls -p "Review the architecture"
|
|
873
873
|
|
|
874
874
|
# Export session
|
|
875
|
-
|
|
875
|
+
omp --export session.jsonl output.html
|
|
876
876
|
```
|
|
877
877
|
|
|
878
878
|
---
|
|
@@ -908,10 +908,10 @@ For adding new tools, see [Custom Tools](#custom-tools) in the Configuration sec
|
|
|
908
908
|
|
|
909
909
|
### SDK
|
|
910
910
|
|
|
911
|
-
For embedding
|
|
911
|
+
For embedding omp in Node.js/TypeScript applications, use the SDK:
|
|
912
912
|
|
|
913
913
|
```typescript
|
|
914
|
-
import { createAgentSession, discoverAuthStorage, discoverModels, SessionManager } from "@oh-my-pi/
|
|
914
|
+
import { createAgentSession, discoverAuthStorage, discoverModels, SessionManager } from "@oh-my-pi/omp-coding-agent";
|
|
915
915
|
|
|
916
916
|
const authStorage = discoverAuthStorage();
|
|
917
917
|
const modelRegistry = discoverModels(authStorage);
|
|
@@ -942,16 +942,16 @@ The SDK provides full control over:
|
|
|
942
942
|
- Settings (`SettingsManager`)
|
|
943
943
|
- API key resolution and OAuth
|
|
944
944
|
|
|
945
|
-
**Philosophy:** "Omit to discover, provide to override." Omit an option and
|
|
945
|
+
**Philosophy:** "Omit to discover, provide to override." Omit an option and omp discovers from standard locations. Provide an option and your value is used.
|
|
946
946
|
|
|
947
947
|
> See [SDK Documentation](docs/sdk.md) for the full API reference. See [examples/sdk/](examples/sdk/) for working examples from minimal to full control.
|
|
948
948
|
|
|
949
949
|
### RPC Mode
|
|
950
950
|
|
|
951
|
-
For embedding
|
|
951
|
+
For embedding omp from other languages or with process isolation:
|
|
952
952
|
|
|
953
953
|
```bash
|
|
954
|
-
|
|
954
|
+
omp --mode rpc --no-session
|
|
955
955
|
```
|
|
956
956
|
|
|
957
957
|
Send JSON commands on stdin:
|
|
@@ -966,8 +966,8 @@ Send JSON commands on stdin:
|
|
|
966
966
|
### HTML Export
|
|
967
967
|
|
|
968
968
|
```bash
|
|
969
|
-
|
|
970
|
-
|
|
969
|
+
omp --export session.jsonl # Auto-generated filename
|
|
970
|
+
omp --export session.jsonl output.html # Custom filename
|
|
971
971
|
```
|
|
972
972
|
|
|
973
973
|
Works with both session files and streaming event logs from `--mode json`.
|
|
@@ -976,11 +976,11 @@ Works with both session files and streaming event logs from `--mode json`.
|
|
|
976
976
|
|
|
977
977
|
## Philosophy
|
|
978
978
|
|
|
979
|
-
|
|
979
|
+
Omp is opinionated about what it won't do. These are intentional design decisions to minimize context bloat and avoid anti-patterns.
|
|
980
980
|
|
|
981
981
|
**No MCP.** Build CLI tools with READMEs (see [Skills](#skills)). The agent reads them on demand. [Would you like to know more?](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/)
|
|
982
982
|
|
|
983
|
-
**No sub-agents.** Spawn
|
|
983
|
+
**No sub-agents.** Spawn omp instances via tmux, or [build your own sub-agent tool](examples/custom-tools/subagent/) with [custom tools](#custom-tools). Full observability and steerability.
|
|
984
984
|
|
|
985
985
|
**No permission popups.** Security theater. Run in a container or build your own with [Hooks](#hooks).
|
|
986
986
|
|
|
@@ -1002,9 +1002,9 @@ Configure via `package.json`:
|
|
|
1002
1002
|
|
|
1003
1003
|
```json
|
|
1004
1004
|
{
|
|
1005
|
-
"
|
|
1006
|
-
"name": "
|
|
1007
|
-
"configDir": ".
|
|
1005
|
+
"ompConfig": {
|
|
1006
|
+
"name": "omp",
|
|
1007
|
+
"configDir": ".omp"
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
1010
|
```
|
|
@@ -1025,7 +1025,7 @@ Never use `__dirname` directly for package assets.
|
|
|
1025
1025
|
|
|
1026
1026
|
### Debug Command
|
|
1027
1027
|
|
|
1028
|
-
`/debug` (hidden) writes rendered lines with ANSI codes to `~/.
|
|
1028
|
+
`/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.
|
|
1029
1029
|
|
|
1030
1030
|
For architecture and contribution guidelines, see [DEVELOPMENT.md](./DEVELOPMENT.md).
|
|
1031
1031
|
|
|
@@ -1037,5 +1037,5 @@ MIT
|
|
|
1037
1037
|
|
|
1038
1038
|
## See Also
|
|
1039
1039
|
|
|
1040
|
-
- [@oh-my-pi/
|
|
1041
|
-
- [@oh-my-pi/
|
|
1040
|
+
- [@oh-my-pi/omp-ai](https://www.npmjs.com/package/@oh-my-pi/omp-ai): Core LLM toolkit
|
|
1041
|
+
- [@oh-my-pi/omp-agent](https://www.npmjs.com/package/@oh-my-pi/omp-agent): Agent framework
|
package/docs/compaction.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Compaction & Branch Summarization
|
|
2
2
|
|
|
3
|
-
LLMs have limited context windows. When conversations grow too long,
|
|
3
|
+
LLMs have limited context windows. When conversations grow too long, omp uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
|
4
4
|
|
|
5
5
|
**Source files:**
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ LLMs have limited context windows. When conversations grow too long, pi uses com
|
|
|
12
12
|
|
|
13
13
|
## Overview
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
OMP has two summarization mechanisms:
|
|
16
16
|
|
|
17
17
|
| Mechanism | Trigger | Purpose |
|
|
18
18
|
| -------------------- | ---------------------------------------- | ----------------------------------------- |
|
|
@@ -31,13 +31,13 @@ Auto-compaction triggers when:
|
|
|
31
31
|
contextTokens > contextWindow - reserveTokens
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
By default, `reserveTokens` is 16384 tokens (configurable in `~/.
|
|
34
|
+
By default, `reserveTokens` is 16384 tokens (configurable in `~/.omp/agent/settings.json` or `<project-dir>/.omp/settings.json`). This leaves room for the LLM's response.
|
|
35
35
|
|
|
36
36
|
You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
|
|
37
37
|
|
|
38
38
|
### How It Works
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
2. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.omp/agent/settings.json` or `<project-dir>/.omp/settings.json`) is reached
|
|
41
41
|
2. **Extract messages**: Collect messages from previous compaction (or start) up to cut point
|
|
42
42
|
3. **Generate summary**: Call LLM to summarize with structured format
|
|
43
43
|
4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`
|
|
@@ -99,7 +99,7 @@ Split turn (one huge turn exceeds budget):
|
|
|
99
99
|
turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
For split turns,
|
|
102
|
+
For split turns, omp generates two summaries and merges them:
|
|
103
103
|
|
|
104
104
|
1. **History summary**: Previous context (if any)
|
|
105
105
|
2. **Turn prefix summary**: The early part of the split turn
|
|
@@ -147,7 +147,7 @@ See [`prepareCompaction()`](../src/core/compaction/compaction.ts) and [`compact(
|
|
|
147
147
|
|
|
148
148
|
### When It Triggers
|
|
149
149
|
|
|
150
|
-
When you use `/tree` to navigate to a different branch,
|
|
150
|
+
When you use `/tree` to navigate to a different branch, omp offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
|
|
151
151
|
|
|
152
152
|
### How It Works
|
|
153
153
|
|
|
@@ -176,7 +176,7 @@ After navigation with summary:
|
|
|
176
176
|
|
|
177
177
|
### Cumulative File Tracking
|
|
178
178
|
|
|
179
|
-
Both compaction and branch summarization track files cumulatively. When generating a summary,
|
|
179
|
+
Both compaction and branch summarization track files cumulatively. When generating a summary, omp extracts file operations from:
|
|
180
180
|
|
|
181
181
|
- Tool calls in the messages being summarized
|
|
182
182
|
- Previous compaction or branch summary `details` (if any)
|
|
@@ -382,7 +382,7 @@ See `SessionBeforeTreeEvent` and `TreePreparation` in the types file.
|
|
|
382
382
|
|
|
383
383
|
## Settings
|
|
384
384
|
|
|
385
|
-
Configure compaction in `~/.
|
|
385
|
+
Configure compaction in `~/.omp/agent/settings.json` or `<project-dir>/.omp/settings.json`:
|
|
386
386
|
|
|
387
387
|
```json
|
|
388
388
|
{
|