Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
{
"name": "jstack",
"source": "./",
"description": "17 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.",
"version": "0.2.1",
"description": "18 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.",
"version": "0.3.0",
"author": {
"name": "justcarlson"
},
Expand Down
4 changes: 2 additions & 2 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "jstack",
"displayName": "jstack",
"version": "0.2.1",
"description": "17 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.",
"version": "0.3.0",
"description": "18 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.",
"author": {
"name": "justcarlson"
},
Expand Down
6 changes: 3 additions & 3 deletions .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jstack",
"version": "0.2.1",
"description": "17 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.",
"version": "0.3.0",
"description": "18 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.",
"author": {
"name": "justcarlson"
},
Expand All @@ -13,7 +13,7 @@
"interface": {
"displayName": "jstack",
"shortDescription": "Ship pull requests end to end: council, sol-loop, full-send, babysit-pr",
"longDescription": "A patched distribution of t3dotgg/tstack with companion skills for PR bodies, epics, retros, CI speed, upstream bugs, Omarchy VMs, and T3 worktree launches.",
"longDescription": "A patched distribution of t3dotgg/tstack with companion skills for PR bodies, epics, retros, CI speed, upstream bugs, Omarchy VMs, OpenCode sandboxes, and T3 worktree launches.",
"developerName": "justcarlson",
"category": "Developer Tools",
"capabilities": ["Interactive", "Read", "Write"],
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ The nine tstack skills, patched. [UPSTREAM.md](UPSTREAM.md) pins the upstream co
| `bug` | Take an upstream bug from first error to a merged fix |
| `omarchy-dev` | Test Omarchy changes in throwaway Omarchy VMs, the way upstream does |
| `t3-launch-worktrees` | Launch T3 Code threads in the right checkout |
| `oc-sandbox` | Lease a throwaway OpenCode sandbox for risky or custom work delegated through T3 Code |

## Make them yours

Expand Down
111 changes: 111 additions & 0 deletions skills/oc-sandbox/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
name: oc-sandbox
description: Lease a just-in-time OpenCode sandbox for T3 Code delegation. Use for refusal handoffs to an untrusted model, custom OS or GUI specs, or high-risk verification. Declare a SandboxSpec, delegate, adjust grants live, land safely.
---

# OpenCode sandbox

Run risky or custom work in a throwaway sandbox that holds one OpenCode agent. The orchestrator stays on the host, delegates through T3 Code, and checks the proof itself.

This skill is stock: no host, account or path. It assumes an `oc-sandbox` CLI and T3 provider slots your own setup supplies. Slot names and any extra rules come from your `AGENTS.md` or `rig.json`. Those win over this skill.

## When to use

- A model refused or is a poor fit, and you hand the task to an abliterated or untrusted model.
- The task needs OS packages, a GUI or a toolchain the host lacks.
- Verification or UAT is high-risk: it installs, executes or browses untrusted code.

Skip it for ordinary edits. Use a plain `delegate_task` worktree.

## Workflow

### 1. Write a SandboxSpec

Declare what the sandbox gets. Nothing else exists inside it.

```toml
name = "repro-1"
tier = "auto" # bwrap (default, ~20 ms), podman when [image] is set, kvm opt-in

[image] # optional: custom OS packages or GUI
packages = ["chromium", "xvfb"]

[network]
mode = "none" # default: empty network

[git]
airlock = true # repo enters as a bundle; changes leave only through `land`

[limits]
cpu = 2
memory = "4G"
pids = 512
wall = "1h"
```

Give each option the least it needs. Add a `[image]` only for packages the default root lacks. Pick `kvm` only when you need a kernel or nested virtualization.

### 2. Provision and lease a slot

```sh
oc-sandbox up --spec repro-1.toml --json
```

The JSON gives `sandbox_id` and `slot`. A slot is a T3 provider instance leased 1:1 to the sandbox, for example `opencode-sbx-1` to `opencode-sbx-4`, or whatever your config lists. No free slot means wait or tear one down. Never share a slot.

### 3. Delegate through T3 Code

Call `orchestrator_capabilities` once, then `delegate_task`:

- `target.providerInstanceId`: the leased `slot`.
- `isolation: "worktree"` for code edits.
- `isolation: "shared"` for read-only work or a repro.

Put the goal, the stopping point and the allowed paths in the brief. Say the agent is sandboxed, and that it must write artifacts to `/out`.

### 4. Observe and adjust live

Watch the delegate. When it needs more, grant it without a restart. Every grant gets a `grant-id`.

```sh
oc-sandbox allow <id> mount <path> --as <name> [--ro|--rw] [--ttl 15m]
oc-sandbox allow <id> port --dir in ... # inbound: UAT of a dev server in the sandbox
oc-sandbox allow <id> port --dir out ... # narrow outbound tunnel to one service
oc-sandbox allow <id> tool --bin <name> # or --mcp <server>
oc-sandbox allow <id> egress <domain>
oc-sandbox allow <id> model <model-id>
oc-sandbox revoke <id> <grant-id>
```

`mount` and `umount` are shorthands for the first and last. Prefer `--ro` and a short `--ttl`. Revoke a grant when its step ends.

These stay blocked: sensitive mounts, host admin ports and orchestration MCP tools. Open one only with `--allow-sensitive` and the user's explicit approval for that grant. Never infer approval.

### 5. Prove it on the host's terms

Run proof inside the sandbox. Collect artifacts from `/out`.

```sh
oc-sandbox run <id> -- <cmd>
```

Read the output and the artifacts yourself. Do not trust the delegate's report alone. Do not run sandbox output, scripts or binaries on the host before review.

### 6. Land and tear down

```sh
oc-sandbox land <id> # fsck and tripwire checks, then a review ref
oc-sandbox down <id>
```

`land` brings the changes in as a review ref, never into a working branch. Review that ref like an outside contribution: read the diff, then merge it by the normal PR path. If `land` reports a tripwire, stop and tell the user. Do not bypass it.

Run `down` when done, and on every failure path. It releases the slot. Check that the slot is free before you finish.

## Rules

- One sandbox, one slot, one task.
- Default to the empty network. Open egress by domain, never wide.
- Grants are narrow, timed and revocable.
- Secrets never enter a spec, a mount or a brief.
- Report the `sandbox_id`, the grants you made and the review ref in your handoff.
4 changes: 2 additions & 2 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def entries(folder: Path) -> list[str]:
return sorted(p.name for p in folder.iterdir()) if folder.exists() else []


def test_seventeen_skills_and_deps_exist():
assert len(ALL) == 17
def test_eighteen_skills_and_deps_exist():
assert len(ALL) == 18
for name, deps in install.DEPS.items():
assert name in ALL
assert set(deps) <= set(ALL), name
Expand Down
6 changes: 3 additions & 3 deletions tests/test_validate_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ def errors(root: Path) -> list[str]:

def test_repo_is_valid():
assert vs.validate(ROOT) == []
assert len(vs.skill_dirs(ROOT)) == 17
assert len(vs.skill_dirs(ROOT)) == 18


def test_cli_ok():
proc = subprocess.run(
[sys.executable, str(ROOT / "scripts" / "validate_skills.py")], capture_output=True, text=True, check=False
)
assert proc.returncode == 0, proc.stderr
assert "17 skills valid" in proc.stdout
assert "18 skills valid" in proc.stdout


def test_parser_matches_pyyaml():
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_manifest_version_mismatch(repo: Path):


def test_manifests_share_version():
assert set(vs.manifest_versions(ROOT).values()) == {"0.2.1"}
assert set(vs.manifest_versions(ROOT).values()) == {"0.3.0"}


def test_pr_body_workflow_must_match(repo: Path):
Expand Down