diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index c638999..79073ea 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -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" }, diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index c81e803..6ee170b 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -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" }, diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 24146ce..61a40f5 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -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" }, @@ -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"], diff --git a/README.md b/README.md index dd6eecc..723afe9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/skills/oc-sandbox/SKILL.md b/skills/oc-sandbox/SKILL.md new file mode 100644 index 0000000..4fc3083 --- /dev/null +++ b/skills/oc-sandbox/SKILL.md @@ -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 mount --as [--ro|--rw] [--ttl 15m] +oc-sandbox allow port --dir in ... # inbound: UAT of a dev server in the sandbox +oc-sandbox allow port --dir out ... # narrow outbound tunnel to one service +oc-sandbox allow tool --bin # or --mcp +oc-sandbox allow egress +oc-sandbox allow model +oc-sandbox revoke +``` + +`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 -- +``` + +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 # fsck and tripwire checks, then a review ref +oc-sandbox down +``` + +`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. diff --git a/tests/test_install.py b/tests/test_install.py index e61ef86..63709b6 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -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 diff --git a/tests/test_validate_skills.py b/tests/test_validate_skills.py index 0e107e6..20f1463 100644 --- a/tests/test_validate_skills.py +++ b/tests/test_validate_skills.py @@ -53,7 +53,7 @@ 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(): @@ -61,7 +61,7 @@ def test_cli_ok(): [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(): @@ -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):