@kokorolx/ai-sandbox-wrapper 3.4.3-beta.2 → 3.4.3
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/bin/ai-run +1 -370
- package/bin/cli.js +0 -2
- package/dockerfiles/base/Dockerfile +74 -0
- package/dockerfiles/base/skills/rtk/SKILL.md +103 -0
- package/dockerfiles/base/skills/rtk-setup/SKILL.md +118 -0
- package/dockerfiles/opencode/Dockerfile +9 -0
- package/dockerfiles/sandbox/Dockerfile +91 -0
- package/dockerfiles/sandbox/skills/rtk/SKILL.md +103 -0
- package/dockerfiles/sandbox/skills/rtk-setup/SKILL.md +118 -0
- package/lib/build-sandbox.sh +0 -6
- package/lib/install-base.sh +0 -45
- package/package.json +1 -1
- package/setup.sh +6 -71
- package/lib/install-open-design.sh +0 -60
- package/skills/dd-pup/SKILL.md +0 -186
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rtk-setup
|
|
3
|
+
description: "One-time setup + ongoing enforcement of RTK (Rust Token Killer) across sessions and subagents. Persists RTK instructions to AGENTS.md and propagates to delegated tasks."
|
|
4
|
+
compatibility: "OpenCode with RTK binary installed"
|
|
5
|
+
metadata:
|
|
6
|
+
author: Sisyphus
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# RTK Setup — Persistent RTK Enforcement
|
|
11
|
+
|
|
12
|
+
This skill performs **setup** (persist RTK instructions) and **ongoing enforcement** (use rtk, propagate to subagents).
|
|
13
|
+
|
|
14
|
+
## Phase 1: Detection (ALWAYS run first)
|
|
15
|
+
|
|
16
|
+
Run these checks before anything else:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
rtk --version
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- If `rtk` is NOT found → **STOP**. Tell the user: "RTK is not installed. Install it first: `cargo install --git https://github.com/rtk-ai/rtk --locked`". Do NOT proceed with setup.
|
|
23
|
+
- If `rtk` IS found → continue.
|
|
24
|
+
|
|
25
|
+
### Check oh-my-opencode
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
ls ~/.config/opencode/oh-my-opencode.json 2>/dev/null
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- If found → omo is installed. Note this for Phase 2.
|
|
32
|
+
- If not found → skip omo-specific steps.
|
|
33
|
+
|
|
34
|
+
## Phase 2: Setup (persist to AGENTS.md)
|
|
35
|
+
|
|
36
|
+
Check BOTH of these files for the RTK managed block:
|
|
37
|
+
|
|
38
|
+
1. **User-level**: `~/.config/opencode/AGENTS.md`
|
|
39
|
+
2. **Project-level**: `./AGENTS.md` (current workspace)
|
|
40
|
+
|
|
41
|
+
For EACH file, check if `<!-- RTK:START -->` exists. If it does NOT exist, **append** the following managed block to the file (create the file if it doesn't exist). NEVER replace existing content — only append.
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
<!-- RTK:START -->
|
|
45
|
+
<!-- Managed block - do not edit manually. Updated by: rtk-setup skill -->
|
|
46
|
+
|
|
47
|
+
## RTK Token Optimizer
|
|
48
|
+
|
|
49
|
+
This project uses **RTK** (Rust Token Killer) to reduce LLM token consumption by 60-90%.
|
|
50
|
+
|
|
51
|
+
### Rules for ALL agents (including subagents)
|
|
52
|
+
|
|
53
|
+
**ALWAYS** prefix these commands with `rtk`:
|
|
54
|
+
|
|
55
|
+
| Command | Use instead |
|
|
56
|
+
|---------|-------------|
|
|
57
|
+
| `git status/diff/log/add/commit/push/pull` | `rtk git ...` |
|
|
58
|
+
| `ls`, `ls -la` | `rtk ls` |
|
|
59
|
+
| `cat file` | `rtk read file` |
|
|
60
|
+
| `grep pattern .` / `rg pattern` | `rtk grep pattern .` |
|
|
61
|
+
| `npm test` / `cargo test` / `pytest` | `rtk test <cmd>` |
|
|
62
|
+
| `npm run build` / `cargo build` | `rtk err <cmd>` |
|
|
63
|
+
| `gh pr list/view` | `rtk gh pr list/view` |
|
|
64
|
+
| `docker ps` | `rtk docker ps` |
|
|
65
|
+
| `eslint` / `tsc` | `rtk lint` / `rtk tsc` |
|
|
66
|
+
|
|
67
|
+
**Do NOT** prefix: `npx`, `npm install`, `pip install`, `node`, `python3`, heredocs, piped commands.
|
|
68
|
+
|
|
69
|
+
<!-- RTK:END -->
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### If oh-my-opencode is installed
|
|
73
|
+
|
|
74
|
+
After updating AGENTS.md files, check if the omo config at `~/.config/opencode/oh-my-opencode.json` has `prompt_append` fields on agents. If it does, inform the user:
|
|
75
|
+
|
|
76
|
+
> "omo is installed. For maximum coverage, you can add RTK instructions to agent `prompt_append` fields in `oh-my-opencode.json`. This ensures subagents always use rtk even when AGENTS.md is not loaded. Want me to do this?"
|
|
77
|
+
|
|
78
|
+
**Only modify `oh-my-opencode.json` if the user explicitly confirms.** If they confirm, append this line to the `prompt_append` of `sisyphus-junior` agent (the primary coder):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
\n\nRTK: ALWAYS prefix shell commands with `rtk` when available (git, ls, grep, test, build). Example: `rtk git status` not `git status`.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Do NOT modify other agents' prompt_append unless asked.
|
|
85
|
+
|
|
86
|
+
## Phase 3: Ongoing Enforcement (EVERY time this skill is loaded)
|
|
87
|
+
|
|
88
|
+
### For the current agent
|
|
89
|
+
|
|
90
|
+
From this point forward in this session, **you MUST**:
|
|
91
|
+
|
|
92
|
+
1. **Use `rtk` prefix** for all supported shell commands (see table above)
|
|
93
|
+
2. **Verify rtk is available** before first use: `rtk --version`
|
|
94
|
+
3. If rtk is not available in the current environment, fall back to normal commands silently
|
|
95
|
+
|
|
96
|
+
### For subagent delegation
|
|
97
|
+
|
|
98
|
+
When delegating ANY task that involves shell commands (via `task()`, `delegate_task()`, or any delegation mechanism), **ALWAYS** add this to the `MUST DO` section of the delegation prompt:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
- Use `rtk` prefix for shell commands when available (git, ls, grep, test, build). Run `rtk --version` first to check. If not installed, use normal commands. Examples: `rtk git status`, `rtk ls`, `rtk grep pattern .`, `rtk test npm test`.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This is NON-NEGOTIABLE. Subagents do not read AGENTS.md, so RTK instructions MUST be passed explicitly in every delegation prompt.
|
|
105
|
+
|
|
106
|
+
### Quick reference for subagent prompts
|
|
107
|
+
|
|
108
|
+
Copy-paste this one-liner into MUST DO sections:
|
|
109
|
+
|
|
110
|
+
> Use `rtk` prefix for all shell commands (git, ls, grep, test, build, docker). Example: `rtk git status` not `git status`. If `rtk` is not found, use normal commands.
|
|
111
|
+
|
|
112
|
+
## Summary
|
|
113
|
+
|
|
114
|
+
| Phase | When | What |
|
|
115
|
+
|-------|------|------|
|
|
116
|
+
| Detection | Always first | Check rtk installed, check omo |
|
|
117
|
+
| Setup | Once (idempotent) | Append RTK block to AGENTS.md (user + project) |
|
|
118
|
+
| Enforcement | Every session | Use rtk yourself, propagate to all subagents |
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
FROM node:22-bookworm-slim
|
|
3
|
+
|
|
4
|
+
ARG AGENT_UID=1001
|
|
5
|
+
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git curl ssh ca-certificates jq python3 python3-pip python3-venv python3-dev python3-setuptools build-essential libopenblas-dev pipx unzip xclip wl-clipboard ripgrep tmux vim-nox fd-find sqlite3 poppler-utils qpdf tesseract-ocr && curl -LsSf https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh && rm -rf /var/lib/apt/lists/* && pipx ensurepath
|
|
7
|
+
|
|
8
|
+
# Install Python PDF processing tools for PDF skill
|
|
9
|
+
RUN pip3 install --no-cache-dir --break-system-packages pypdf pdfplumber reportlab pytesseract pdf2image
|
|
10
|
+
|
|
11
|
+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && apt-get update && apt-get install -y gh && rm -rf /var/lib/apt/lists/*
|
|
12
|
+
|
|
13
|
+
# Install bun (used by most AI tool install scripts)
|
|
14
|
+
RUN npm install -g bun
|
|
15
|
+
|
|
16
|
+
# Install pnpm globally using npm (not bun, for stability)
|
|
17
|
+
RUN npm install -g pnpm
|
|
18
|
+
|
|
19
|
+
# Install TypeScript and LSP tools using npm
|
|
20
|
+
RUN npm install -g typescript typescript-language-server pyright vscode-langservers-extracted
|
|
21
|
+
|
|
22
|
+
# Verify installations
|
|
23
|
+
RUN node --version && npm --version && pnpm --version && tsc --version
|
|
24
|
+
|
|
25
|
+
# Install additional tools (if selected)
|
|
26
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
27
|
+
libglib2.0-0 \
|
|
28
|
+
libnspr4 \
|
|
29
|
+
libnss3 \
|
|
30
|
+
libdbus-1-3 \
|
|
31
|
+
libatk1.0-0 \
|
|
32
|
+
libatk-bridge2.0-0 \
|
|
33
|
+
libcups2 \
|
|
34
|
+
libxcb1 \
|
|
35
|
+
libxkbcommon0 \
|
|
36
|
+
libatspi2.0-0 \
|
|
37
|
+
libx11-6 \
|
|
38
|
+
libxcomposite1 \
|
|
39
|
+
libxdamage1 \
|
|
40
|
+
libxext6 \
|
|
41
|
+
libxfixes3 \
|
|
42
|
+
libxrandr2 \
|
|
43
|
+
libgbm1 \
|
|
44
|
+
libdrm2 \
|
|
45
|
+
libcairo2 \
|
|
46
|
+
libpango-1.0-0 \
|
|
47
|
+
libasound2 \
|
|
48
|
+
fonts-liberation \
|
|
49
|
+
libappindicator3-1 \
|
|
50
|
+
libu2f-udev \
|
|
51
|
+
libvulkan1 \
|
|
52
|
+
libxshmfence1 \
|
|
53
|
+
xdg-utils \
|
|
54
|
+
wget \
|
|
55
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
56
|
+
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright-browsers
|
|
57
|
+
RUN mkdir -p /opt/playwright-browsers && \
|
|
58
|
+
npm install -g @playwright/mcp@latest && \
|
|
59
|
+
touch /opt/.mcp-playwright-installed
|
|
60
|
+
ENV CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS=1
|
|
61
|
+
RUN npm install -g chrome-devtools-mcp@latest && \
|
|
62
|
+
touch /opt/.mcp-chrome-devtools-installed
|
|
63
|
+
RUN touch /opt/.mcp-playwright-installed
|
|
64
|
+
|
|
65
|
+
# Create workspace
|
|
66
|
+
WORKDIR /workspace
|
|
67
|
+
|
|
68
|
+
# Non-root user for security (match host UID)
|
|
69
|
+
RUN useradd -m -u ${AGENT_UID} -d /home/agent agent && \
|
|
70
|
+
mkdir -p /home/agent/.cache /home/agent/.npm /home/agent/.opencode /home/agent/.config && \
|
|
71
|
+
chown -R agent:agent /home/agent/.cache /home/agent/.npm /home/agent/.opencode /home/agent/.config /workspace && \
|
|
72
|
+
([ -d /opt/playwright-browsers ] && chown -R agent:agent /opt/playwright-browsers || true)
|
|
73
|
+
|
|
74
|
+
# === opencode ===
|
|
75
|
+
USER root
|
|
76
|
+
RUN curl -fsSL https://opencode.ai/install | bash && \
|
|
77
|
+
mv /root/.opencode/bin/opencode /usr/local/bin/opencode && \
|
|
78
|
+
rm -rf /root/.opencode
|
|
79
|
+
|
|
80
|
+
# === codex ===
|
|
81
|
+
USER root
|
|
82
|
+
RUN mkdir -p /usr/local/lib/codex && \
|
|
83
|
+
cd /usr/local/lib/codex && \
|
|
84
|
+
bun init -y && \
|
|
85
|
+
bun add @openai/codex && \
|
|
86
|
+
ln -s /usr/local/lib/codex/node_modules/.bin/codex /usr/local/bin/codex
|
|
87
|
+
USER agent
|
|
88
|
+
|
|
89
|
+
USER agent
|
|
90
|
+
ENV HOME=/home/agent
|
|
91
|
+
CMD ["bash"]
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rtk
|
|
3
|
+
description: "Token optimizer for AI coding agents. Wraps common CLI commands with rtk to reduce LLM token consumption by 60-90%."
|
|
4
|
+
compatibility: "OpenCode with RTK binary installed"
|
|
5
|
+
metadata:
|
|
6
|
+
author: Sisyphus
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# RTK — Rust Token Killer
|
|
11
|
+
|
|
12
|
+
**Purpose**: Reduce token consumption by 60-90% on shell commands. RTK filters and compresses command output before it reaches your context.
|
|
13
|
+
|
|
14
|
+
## When This Skill Activates
|
|
15
|
+
|
|
16
|
+
This skill is loaded automatically. Once active, **always** prefix supported commands with `rtk`.
|
|
17
|
+
|
|
18
|
+
## Command Mappings (MANDATORY)
|
|
19
|
+
|
|
20
|
+
When running shell commands via Bash tool, use `rtk` prefix for these commands:
|
|
21
|
+
|
|
22
|
+
| Instead of | Use | Savings |
|
|
23
|
+
|-----------|-----|---------|
|
|
24
|
+
| `git status` | `rtk git status` | ~80% |
|
|
25
|
+
| `git diff` | `rtk git diff` | ~75% |
|
|
26
|
+
| `git log` | `rtk git log` | ~80% |
|
|
27
|
+
| `git add/commit/push/pull` | `rtk git add/commit/push/pull` | ~90% |
|
|
28
|
+
| `ls` / `ls -la` | `rtk ls` | ~80% |
|
|
29
|
+
| `cat file` | `rtk read file` | ~70% |
|
|
30
|
+
| `grep pattern .` | `rtk grep pattern .` | ~80% |
|
|
31
|
+
| `rg pattern` | `rtk grep pattern .` | ~80% |
|
|
32
|
+
| `npm test` / `cargo test` / `pytest` | `rtk test <cmd>` | ~90% |
|
|
33
|
+
| `npm run build` / `cargo build` | `rtk err <cmd>` | ~80% |
|
|
34
|
+
| `gh pr list/view` | `rtk gh pr list/view` | ~70% |
|
|
35
|
+
| `docker ps` | `rtk docker ps` | ~80% |
|
|
36
|
+
| `eslint` / `tsc` | `rtk lint` / `rtk tsc` | ~80% |
|
|
37
|
+
|
|
38
|
+
## Searching Inside `node_modules` / Ignored Directories
|
|
39
|
+
|
|
40
|
+
By default, `rtk grep` respects `.gitignore` rules — meaning `node_modules`, `.nuxt`, `dist`, etc. are **excluded**. This is the right behavior 99% of the time.
|
|
41
|
+
|
|
42
|
+
When you **need** to search inside ignored directories (debugging a library, checking an API signature, tracing a dependency bug):
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Search all files including node_modules (--no-ignore bypasses .gitignore)
|
|
46
|
+
rtk grep "defineStore" . --no-ignore
|
|
47
|
+
|
|
48
|
+
# Search a specific package only (combine --no-ignore with --glob)
|
|
49
|
+
rtk grep "defineStore" . --no-ignore --glob 'node_modules/pinia/**'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**What does NOT work:**
|
|
53
|
+
- `rtk grep "pattern" node_modules/pinia/` — still excluded even with direct path
|
|
54
|
+
- `rtk grep "pattern" . --glob 'node_modules/**'` — glob alone doesn't override .gitignore
|
|
55
|
+
|
|
56
|
+
**Key flag: `--no-ignore`** — this is the ONLY way to search ignored directories with rtk grep.
|
|
57
|
+
|
|
58
|
+
### Other useful `rtk grep` flags
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
rtk grep "pattern" . -t ts # Filter by file type (ts, py, rust, etc.)
|
|
62
|
+
rtk grep "pattern" . -m 100 # Increase max results (default: 50)
|
|
63
|
+
rtk grep "pattern" . -u # Ultra-compact mode (even fewer tokens)
|
|
64
|
+
rtk grep "pattern" . -l 120 # Max line length before truncation (default: 80)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Commands to NOT Wrap
|
|
68
|
+
|
|
69
|
+
Do NOT prefix these with `rtk` (unsupported or counterproductive):
|
|
70
|
+
|
|
71
|
+
- `npx`, `npm install`, `pip install` (package managers)
|
|
72
|
+
- `node`, `python3`, `ruby` (interpreters)
|
|
73
|
+
- `nano-brain`, `openspec`, `opencode` (custom tools)
|
|
74
|
+
- Heredocs (`<<EOF`)
|
|
75
|
+
- Piped commands (`cmd1 | cmd2`) — wrap only the first command if applicable
|
|
76
|
+
- Commands already prefixed with `rtk`
|
|
77
|
+
|
|
78
|
+
## How RTK Works
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Without RTK: git status → 50 lines raw output → 2,000 tokens
|
|
82
|
+
With RTK: rtk git status → "3 modified, 1 untracked ✓" → 200 tokens
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
RTK runs the real command, then filters/compresses the output. The agent sees a compact summary instead of verbose raw output.
|
|
86
|
+
|
|
87
|
+
## Detection
|
|
88
|
+
|
|
89
|
+
Before using RTK commands, verify it's installed:
|
|
90
|
+
```bash
|
|
91
|
+
rtk --version
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If `rtk` is not found, skip this skill — run commands normally without the `rtk` prefix.
|
|
95
|
+
|
|
96
|
+
## Token Savings Reference
|
|
97
|
+
|
|
98
|
+
Typical 30-min coding session:
|
|
99
|
+
- Without RTK: ~150,000 tokens
|
|
100
|
+
- With RTK: ~45,000 tokens
|
|
101
|
+
- **Savings: ~70%**
|
|
102
|
+
|
|
103
|
+
Biggest wins: test output (`rtk test` — 90%), git operations (`rtk git` — 80%), file reading (`rtk read` — 70%).
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rtk-setup
|
|
3
|
+
description: "One-time setup + ongoing enforcement of RTK (Rust Token Killer) across sessions and subagents. Persists RTK instructions to AGENTS.md and propagates to delegated tasks."
|
|
4
|
+
compatibility: "OpenCode with RTK binary installed"
|
|
5
|
+
metadata:
|
|
6
|
+
author: Sisyphus
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# RTK Setup — Persistent RTK Enforcement
|
|
11
|
+
|
|
12
|
+
This skill performs **setup** (persist RTK instructions) and **ongoing enforcement** (use rtk, propagate to subagents).
|
|
13
|
+
|
|
14
|
+
## Phase 1: Detection (ALWAYS run first)
|
|
15
|
+
|
|
16
|
+
Run these checks before anything else:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
rtk --version
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- If `rtk` is NOT found → **STOP**. Tell the user: "RTK is not installed. Install it first: `cargo install --git https://github.com/rtk-ai/rtk --locked`". Do NOT proceed with setup.
|
|
23
|
+
- If `rtk` IS found → continue.
|
|
24
|
+
|
|
25
|
+
### Check oh-my-opencode
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
ls ~/.config/opencode/oh-my-opencode.json 2>/dev/null
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- If found → omo is installed. Note this for Phase 2.
|
|
32
|
+
- If not found → skip omo-specific steps.
|
|
33
|
+
|
|
34
|
+
## Phase 2: Setup (persist to AGENTS.md)
|
|
35
|
+
|
|
36
|
+
Check BOTH of these files for the RTK managed block:
|
|
37
|
+
|
|
38
|
+
1. **User-level**: `~/.config/opencode/AGENTS.md`
|
|
39
|
+
2. **Project-level**: `./AGENTS.md` (current workspace)
|
|
40
|
+
|
|
41
|
+
For EACH file, check if `<!-- RTK:START -->` exists. If it does NOT exist, **append** the following managed block to the file (create the file if it doesn't exist). NEVER replace existing content — only append.
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
<!-- RTK:START -->
|
|
45
|
+
<!-- Managed block - do not edit manually. Updated by: rtk-setup skill -->
|
|
46
|
+
|
|
47
|
+
## RTK Token Optimizer
|
|
48
|
+
|
|
49
|
+
This project uses **RTK** (Rust Token Killer) to reduce LLM token consumption by 60-90%.
|
|
50
|
+
|
|
51
|
+
### Rules for ALL agents (including subagents)
|
|
52
|
+
|
|
53
|
+
**ALWAYS** prefix these commands with `rtk`:
|
|
54
|
+
|
|
55
|
+
| Command | Use instead |
|
|
56
|
+
|---------|-------------|
|
|
57
|
+
| `git status/diff/log/add/commit/push/pull` | `rtk git ...` |
|
|
58
|
+
| `ls`, `ls -la` | `rtk ls` |
|
|
59
|
+
| `cat file` | `rtk read file` |
|
|
60
|
+
| `grep pattern .` / `rg pattern` | `rtk grep pattern .` |
|
|
61
|
+
| `npm test` / `cargo test` / `pytest` | `rtk test <cmd>` |
|
|
62
|
+
| `npm run build` / `cargo build` | `rtk err <cmd>` |
|
|
63
|
+
| `gh pr list/view` | `rtk gh pr list/view` |
|
|
64
|
+
| `docker ps` | `rtk docker ps` |
|
|
65
|
+
| `eslint` / `tsc` | `rtk lint` / `rtk tsc` |
|
|
66
|
+
|
|
67
|
+
**Do NOT** prefix: `npx`, `npm install`, `pip install`, `node`, `python3`, heredocs, piped commands.
|
|
68
|
+
|
|
69
|
+
<!-- RTK:END -->
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### If oh-my-opencode is installed
|
|
73
|
+
|
|
74
|
+
After updating AGENTS.md files, check if the omo config at `~/.config/opencode/oh-my-opencode.json` has `prompt_append` fields on agents. If it does, inform the user:
|
|
75
|
+
|
|
76
|
+
> "omo is installed. For maximum coverage, you can add RTK instructions to agent `prompt_append` fields in `oh-my-opencode.json`. This ensures subagents always use rtk even when AGENTS.md is not loaded. Want me to do this?"
|
|
77
|
+
|
|
78
|
+
**Only modify `oh-my-opencode.json` if the user explicitly confirms.** If they confirm, append this line to the `prompt_append` of `sisyphus-junior` agent (the primary coder):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
\n\nRTK: ALWAYS prefix shell commands with `rtk` when available (git, ls, grep, test, build). Example: `rtk git status` not `git status`.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Do NOT modify other agents' prompt_append unless asked.
|
|
85
|
+
|
|
86
|
+
## Phase 3: Ongoing Enforcement (EVERY time this skill is loaded)
|
|
87
|
+
|
|
88
|
+
### For the current agent
|
|
89
|
+
|
|
90
|
+
From this point forward in this session, **you MUST**:
|
|
91
|
+
|
|
92
|
+
1. **Use `rtk` prefix** for all supported shell commands (see table above)
|
|
93
|
+
2. **Verify rtk is available** before first use: `rtk --version`
|
|
94
|
+
3. If rtk is not available in the current environment, fall back to normal commands silently
|
|
95
|
+
|
|
96
|
+
### For subagent delegation
|
|
97
|
+
|
|
98
|
+
When delegating ANY task that involves shell commands (via `task()`, `delegate_task()`, or any delegation mechanism), **ALWAYS** add this to the `MUST DO` section of the delegation prompt:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
- Use `rtk` prefix for shell commands when available (git, ls, grep, test, build). Run `rtk --version` first to check. If not installed, use normal commands. Examples: `rtk git status`, `rtk ls`, `rtk grep pattern .`, `rtk test npm test`.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This is NON-NEGOTIABLE. Subagents do not read AGENTS.md, so RTK instructions MUST be passed explicitly in every delegation prompt.
|
|
105
|
+
|
|
106
|
+
### Quick reference for subagent prompts
|
|
107
|
+
|
|
108
|
+
Copy-paste this one-liner into MUST DO sections:
|
|
109
|
+
|
|
110
|
+
> Use `rtk` prefix for all shell commands (git, ls, grep, test, build, docker). Example: `rtk git status` not `git status`. If `rtk` is not found, use normal commands.
|
|
111
|
+
|
|
112
|
+
## Summary
|
|
113
|
+
|
|
114
|
+
| Phase | When | What |
|
|
115
|
+
|-------|------|------|
|
|
116
|
+
| Detection | Always first | Check rtk installed, check omo |
|
|
117
|
+
| Setup | Once (idempotent) | Append RTK block to AGENTS.md (user + project) |
|
|
118
|
+
| Enforcement | Every session | Use rtk yourself, propagate to all subagents |
|
package/lib/build-sandbox.sh
CHANGED
|
@@ -18,8 +18,6 @@ echo "🔄 Generating unified sandbox Dockerfile..."
|
|
|
18
18
|
echo " Tools: $TOOLS"
|
|
19
19
|
|
|
20
20
|
GENERATE_ONLY=1 INSTALL_RTK="${INSTALL_RTK:-0}" \
|
|
21
|
-
INSTALL_PUP="${INSTALL_PUP:-0}" \
|
|
22
|
-
INSTALL_OD_HELPERS="${INSTALL_OD_HELPERS:-1}" \
|
|
23
21
|
INSTALL_PLAYWRIGHT_MCP="${INSTALL_PLAYWRIGHT_MCP:-0}" \
|
|
24
22
|
INSTALL_CHROME_DEVTOOLS_MCP="${INSTALL_CHROME_DEVTOOLS_MCP:-0}" \
|
|
25
23
|
INSTALL_PLAYWRIGHT="${INSTALL_PLAYWRIGHT:-0}" \
|
|
@@ -67,10 +65,6 @@ if [[ -d "dockerfiles/base/skills" ]]; then
|
|
|
67
65
|
cp -r "dockerfiles/base/skills" "$SANDBOX_DIR/"
|
|
68
66
|
fi
|
|
69
67
|
|
|
70
|
-
if [[ -d "dockerfiles/base/scripts" ]]; then
|
|
71
|
-
cp -r "dockerfiles/base/scripts" "$SANDBOX_DIR/"
|
|
72
|
-
fi
|
|
73
|
-
|
|
74
68
|
echo "✅ Dockerfile generated at $SANDBOX_DIR/Dockerfile"
|
|
75
69
|
|
|
76
70
|
echo "🔨 Building ai-sandbox:latest..."
|
package/lib/install-base.sh
CHANGED
|
@@ -67,51 +67,6 @@ COPY skills/rtk-setup/SKILL.md /home/agent/.config/opencode/skills/rtk-setup/SKI
|
|
|
67
67
|
fi
|
|
68
68
|
fi
|
|
69
69
|
|
|
70
|
-
if [[ "${INSTALL_PUP:-0}" -eq 1 ]]; then
|
|
71
|
-
echo "📦 Pup (Datadog CLI) will be installed in base image (multi-stage build)"
|
|
72
|
-
DOCKERFILE_BUILD_STAGES+='# Build Pup from source (multi-stage: only binary is kept, Rust toolchain discarded)
|
|
73
|
-
FROM rust:bookworm AS pup-builder
|
|
74
|
-
RUN cargo install --git https://github.com/DataDog/pup --locked
|
|
75
|
-
'
|
|
76
|
-
ADDITIONAL_TOOLS_INSTALL+='# Install Pup - Datadog CLI for AI agents (built from source)
|
|
77
|
-
COPY --from=pup-builder /usr/local/cargo/bin/pup /usr/local/bin/pup
|
|
78
|
-
'
|
|
79
|
-
# Copy Pup OpenCode skill into build context so it can be COPY'd into the image
|
|
80
|
-
SCRIPT_BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
81
|
-
PUP_SKILLS_SRC="${SCRIPT_BASE_DIR}/../skills"
|
|
82
|
-
if [[ -d "$PUP_SKILLS_SRC/dd-pup" ]]; then
|
|
83
|
-
mkdir -p "dockerfiles/base/skills/dd-pup"
|
|
84
|
-
cp "$PUP_SKILLS_SRC/dd-pup/SKILL.md" "dockerfiles/base/skills/dd-pup/SKILL.md"
|
|
85
|
-
ADDITIONAL_TOOLS_INSTALL+='# Install Pup OpenCode skill (auto-discovered by OpenCode agents)
|
|
86
|
-
RUN mkdir -p /home/agent/.config/opencode/skills/dd-pup
|
|
87
|
-
COPY skills/dd-pup/SKILL.md /home/agent/.config/opencode/skills/dd-pup/SKILL.md
|
|
88
|
-
'
|
|
89
|
-
echo " ✅ Pup OpenCode skill will be copied into container"
|
|
90
|
-
else
|
|
91
|
-
echo " ⚠️ Pup skill not found at $PUP_SKILLS_SRC/dd-pup — skipping skill installation"
|
|
92
|
-
fi
|
|
93
|
-
fi
|
|
94
|
-
|
|
95
|
-
if [[ "${INSTALL_OD_HELPERS:-1}" -eq 1 ]]; then
|
|
96
|
-
echo "📦 open-design helper scripts (od-status, od-health) will be installed in base image"
|
|
97
|
-
# Copy helper scripts into build context so they can be COPY'd into the image
|
|
98
|
-
SCRIPT_BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
99
|
-
OD_HELPERS_SRC="${SCRIPT_BASE_DIR}/../scripts"
|
|
100
|
-
if [[ -f "$OD_HELPERS_SRC/od-status" && -f "$OD_HELPERS_SRC/od-health" ]]; then
|
|
101
|
-
mkdir -p "dockerfiles/base/scripts"
|
|
102
|
-
cp "$OD_HELPERS_SRC/od-status" "dockerfiles/base/scripts/od-status"
|
|
103
|
-
cp "$OD_HELPERS_SRC/od-health" "dockerfiles/base/scripts/od-health"
|
|
104
|
-
ADDITIONAL_TOOLS_INSTALL+='# Install open-design helper scripts (od-status, od-health) for agent containers
|
|
105
|
-
COPY scripts/od-status /usr/local/bin/od-status
|
|
106
|
-
COPY scripts/od-health /usr/local/bin/od-health
|
|
107
|
-
RUN chmod +x /usr/local/bin/od-status /usr/local/bin/od-health
|
|
108
|
-
'
|
|
109
|
-
echo " ✅ open-design helpers will be copied into container"
|
|
110
|
-
else
|
|
111
|
-
echo " ⚠️ open-design helpers not found at $OD_HELPERS_SRC — skipping"
|
|
112
|
-
fi
|
|
113
|
-
fi
|
|
114
|
-
|
|
115
70
|
if [[ "${INSTALL_PLAYWRIGHT:-0}" -eq 1 ]]; then
|
|
116
71
|
echo "📦 Playwright will be installed in base image"
|
|
117
72
|
ADDITIONAL_TOOLS_INSTALL+='# Install Playwright system dependencies
|
package/package.json
CHANGED
package/setup.sh
CHANGED
|
@@ -281,8 +281,8 @@ echo "📁 Legacy workspaces file: $WORKSPACES_FILE"
|
|
|
281
281
|
WORKSPACE="${WORKSPACES[0]}"
|
|
282
282
|
|
|
283
283
|
# Tool definitions
|
|
284
|
-
TOOL_OPTIONS="amp,opencode,openclaw,
|
|
285
|
-
TOOL_DESCS="AI coding assistant from @sourcegraph/amp,Open-source coding tool from opencode-ai,OpenClaw AI gateway (Docker Compose),
|
|
284
|
+
TOOL_OPTIONS="amp,opencode,openclaw,droid,claude,gemini,kilo,qwen,codex,qoder,auggie,codebuddy,jules,shai"
|
|
285
|
+
TOOL_DESCS="AI coding assistant from @sourcegraph/amp,Open-source coding tool from opencode-ai,OpenClaw AI gateway (Docker Compose),Factory CLI from factory.ai,Claude Code CLI from Anthropic,Google Gemini CLI (free tier),AI pair programmer (Git-native),Kilo Code (500+ models),Alibaba Qwen CLI (1M context),OpenAI Codex terminal agent,Qoder AI CLI assistant,Augment Auggie CLI,Tencent CodeBuddy CLI,Google Jules CLI,OVHcloud SHAI agent"
|
|
286
286
|
|
|
287
287
|
# Pre-select previously installed tools
|
|
288
288
|
PRESELECTED_TOOLS=""
|
|
@@ -303,7 +303,7 @@ echo "Installing tools: ${TOOLS[*]}"
|
|
|
303
303
|
|
|
304
304
|
CONTAINERIZED_TOOLS=()
|
|
305
305
|
for tool in "${TOOLS[@]}"; do
|
|
306
|
-
if [[ "$tool" =~ ^(amp|opencode|openclaw|
|
|
306
|
+
if [[ "$tool" =~ ^(amp|opencode|openclaw|claude|aider|droid|gemini|kilo|qwen|codex|qoder|auggie|codebuddy|jules|shai)$ ]]; then
|
|
307
307
|
CONTAINERIZED_TOOLS+=("$tool")
|
|
308
308
|
fi
|
|
309
309
|
done
|
|
@@ -311,8 +311,8 @@ done
|
|
|
311
311
|
echo ""
|
|
312
312
|
if [[ ${#CONTAINERIZED_TOOLS[@]} -gt 0 ]]; then
|
|
313
313
|
# Category 1: AI Enhancement Tools (spec-driven development, UI/UX, browser automation)
|
|
314
|
-
AI_TOOL_OPTIONS="spec-kit,ux-ui-promax,openspec,playwright,rtk
|
|
315
|
-
AI_TOOL_DESCS="Spec-driven development toolkit,UI/UX design intelligence tool,OpenSpec - spec-driven development,Browser automation + Chromium/Firefox/WebKit (~500MB),RTK token optimizer - reduces LLM token usage by 60-90% (~5MB)
|
|
314
|
+
AI_TOOL_OPTIONS="spec-kit,ux-ui-promax,openspec,playwright,rtk"
|
|
315
|
+
AI_TOOL_DESCS="Spec-driven development toolkit,UI/UX design intelligence tool,OpenSpec - spec-driven development,Browser automation + Chromium/Firefox/WebKit (~500MB),RTK token optimizer - reduces LLM token usage by 60-90% (~5MB)"
|
|
316
316
|
|
|
317
317
|
multi_select "Select AI Enhancement Tools (installed in containers)" "$AI_TOOL_OPTIONS" "$AI_TOOL_DESCS"
|
|
318
318
|
AI_ENHANCEMENT_TOOLS=("${SELECTED_ITEMS[@]}")
|
|
@@ -390,8 +390,6 @@ if [[ $NEEDS_BASE_IMAGE -eq 1 ]]; then
|
|
|
390
390
|
INSTALL_CHROME_DEVTOOLS_MCP="${INSTALL_CHROME_DEVTOOLS_MCP:-0}"
|
|
391
391
|
INSTALL_PLAYWRIGHT_MCP="${INSTALL_PLAYWRIGHT_MCP:-0}"
|
|
392
392
|
INSTALL_RTK="${INSTALL_RTK:-0}"
|
|
393
|
-
INSTALL_PUP="${INSTALL_PUP:-0}"
|
|
394
|
-
INSTALL_OPEN_DESIGN="${INSTALL_OPEN_DESIGN:-0}"
|
|
395
393
|
|
|
396
394
|
for addon in "${ADDITIONAL_TOOLS[@]}"; do
|
|
397
395
|
case "$addon" in
|
|
@@ -419,16 +417,10 @@ if [[ $NEEDS_BASE_IMAGE -eq 1 ]]; then
|
|
|
419
417
|
rtk)
|
|
420
418
|
INSTALL_RTK=1
|
|
421
419
|
;;
|
|
422
|
-
pup)
|
|
423
|
-
INSTALL_PUP=1
|
|
424
|
-
;;
|
|
425
|
-
open-design)
|
|
426
|
-
INSTALL_OPEN_DESIGN=1
|
|
427
|
-
;;
|
|
428
420
|
esac
|
|
429
421
|
done
|
|
430
422
|
|
|
431
|
-
export INSTALL_SPEC_KIT INSTALL_UX_UI_PROMAX INSTALL_OPENSPEC INSTALL_PLAYWRIGHT INSTALL_RUBY INSTALL_CHROME_DEVTOOLS_MCP INSTALL_PLAYWRIGHT_MCP INSTALL_RTK
|
|
423
|
+
export INSTALL_SPEC_KIT INSTALL_UX_UI_PROMAX INSTALL_OPENSPEC INSTALL_PLAYWRIGHT INSTALL_RUBY INSTALL_CHROME_DEVTOOLS_MCP INSTALL_PLAYWRIGHT_MCP INSTALL_RTK
|
|
432
424
|
|
|
433
425
|
# Save MCP selections to ~/.ai-sandbox/config.json for ai-run auto-configuration
|
|
434
426
|
SANDBOX_CONFIG="$HOME/.ai-sandbox/config.json"
|
|
@@ -443,54 +435,6 @@ if [[ $NEEDS_BASE_IMAGE -eq 1 ]]; then
|
|
|
443
435
|
jq --argjson mcp "$MCP_INSTALLED" '.mcp.installed = $mcp' "$SANDBOX_CONFIG" > "$SANDBOX_CONFIG.tmp" && mv "$SANDBOX_CONFIG.tmp" "$SANDBOX_CONFIG"
|
|
444
436
|
chmod 600 "$SANDBOX_CONFIG"
|
|
445
437
|
echo "✅ MCP tool selections saved to config"
|
|
446
|
-
|
|
447
|
-
# Auto-detect host browser for ai-run's "Host Chrome CDP mode". That mode
|
|
448
|
-
# is gated on .mcp.chromePath being set in config.json, but setup never
|
|
449
|
-
# wrote it -- users had to manually edit the file. Detect a sensible
|
|
450
|
-
# default the first time an MCP browser tool is selected; preserve any
|
|
451
|
-
# existing value the user set themselves.
|
|
452
|
-
if [[ "$INSTALL_CHROME_DEVTOOLS_MCP" -eq 1 || "$INSTALL_PLAYWRIGHT_MCP" -eq 1 ]]; then
|
|
453
|
-
EXISTING_CHROME_PATH=$(jq -r '.mcp.chromePath // empty' "$SANDBOX_CONFIG" 2>/dev/null)
|
|
454
|
-
if [[ -z "$EXISTING_CHROME_PATH" ]]; then
|
|
455
|
-
DETECTED_CHROME_PATH=""
|
|
456
|
-
case "$(uname -s)" in
|
|
457
|
-
Darwin)
|
|
458
|
-
# Stable Chrome first, then Chromium, then popular forks.
|
|
459
|
-
for candidate in \
|
|
460
|
-
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
|
|
461
|
-
"/Applications/Chromium.app/Contents/MacOS/Chromium" \
|
|
462
|
-
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser" \
|
|
463
|
-
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" \
|
|
464
|
-
"/Applications/Arc.app/Contents/MacOS/Arc"; do
|
|
465
|
-
if [[ -f "$candidate" ]]; then
|
|
466
|
-
DETECTED_CHROME_PATH="$candidate"
|
|
467
|
-
break
|
|
468
|
-
fi
|
|
469
|
-
done
|
|
470
|
-
;;
|
|
471
|
-
Linux)
|
|
472
|
-
for cmd in google-chrome-stable google-chrome chromium chromium-browser brave-browser microsoft-edge; do
|
|
473
|
-
if command -v "$cmd" &>/dev/null; then
|
|
474
|
-
DETECTED_CHROME_PATH=$(command -v "$cmd")
|
|
475
|
-
break
|
|
476
|
-
fi
|
|
477
|
-
done
|
|
478
|
-
;;
|
|
479
|
-
esac
|
|
480
|
-
|
|
481
|
-
if [[ -n "$DETECTED_CHROME_PATH" ]]; then
|
|
482
|
-
jq --arg path "$DETECTED_CHROME_PATH" '.mcp.chromePath = $path' "$SANDBOX_CONFIG" > "$SANDBOX_CONFIG.tmp" \
|
|
483
|
-
&& mv "$SANDBOX_CONFIG.tmp" "$SANDBOX_CONFIG"
|
|
484
|
-
chmod 600 "$SANDBOX_CONFIG"
|
|
485
|
-
echo "🌐 Host browser detected for CDP: $DETECTED_CHROME_PATH"
|
|
486
|
-
echo " (ai-run will launch this with --remote-debugging-port for MCP browser tools.)"
|
|
487
|
-
echo " To change or disable, edit .mcp.chromePath in $SANDBOX_CONFIG"
|
|
488
|
-
else
|
|
489
|
-
echo "ℹ️ No host browser auto-detected for CDP mode."
|
|
490
|
-
echo " To enable, set .mcp.chromePath in $SANDBOX_CONFIG to a Chrome/Chromium binary."
|
|
491
|
-
fi
|
|
492
|
-
fi
|
|
493
|
-
fi
|
|
494
438
|
fi
|
|
495
439
|
fi
|
|
496
440
|
|
|
@@ -504,14 +448,8 @@ TOOLS="$TOOLS_CSV" \
|
|
|
504
448
|
INSTALL_CHROME_DEVTOOLS_MCP="$INSTALL_CHROME_DEVTOOLS_MCP" \
|
|
505
449
|
INSTALL_PLAYWRIGHT_MCP="$INSTALL_PLAYWRIGHT_MCP" \
|
|
506
450
|
INSTALL_RTK="$INSTALL_RTK" \
|
|
507
|
-
INSTALL_PUP="$INSTALL_PUP" \
|
|
508
451
|
bash "$SCRIPT_DIR/lib/build-sandbox.sh"
|
|
509
452
|
|
|
510
|
-
# Install open-design as a separate daemon container (not part of sandbox image)
|
|
511
|
-
if [[ "${INSTALL_OPEN_DESIGN:-0}" -eq 1 ]]; then
|
|
512
|
-
bash "$SCRIPT_DIR/lib/install-open-design.sh"
|
|
513
|
-
fi
|
|
514
|
-
|
|
515
453
|
OLD_IMAGES=()
|
|
516
454
|
for tool in "${TOOLS[@]}"; do
|
|
517
455
|
if docker image inspect "ai-${tool}:latest" &>/dev/null; then
|
|
@@ -600,9 +538,6 @@ if [[ ${#ADDITIONAL_TOOLS[@]} -gt 0 ]]; then
|
|
|
600
538
|
rtk)
|
|
601
539
|
echo " rtk - Token optimizer for AI coding agents (60-90% savings)"
|
|
602
540
|
;;
|
|
603
|
-
open-design)
|
|
604
|
-
echo " open-design - AI design generation daemon (port 7456)"
|
|
605
|
-
;;
|
|
606
541
|
esac
|
|
607
542
|
done
|
|
608
543
|
fi
|