Delegate coding tasks to an attached OpenCode server via `opencode run --attach`. Use when: (1) building new features, (2) refactoring, (3) reviewing changes, (4) iterative coding with background monitoring. This skill is server-only and always uses `--attach` with `--dir` (server-side path).
Use this skill to run coding tasks through a remote OpenCode server.
Always use this shape:
opencode run --attach <server_url> "<task>" --dir "<server_path>"
Example:
opencode run --attach http://127.0.0.1:4096 "what is in this folder" --dir "/home/richard/FeedMob"
Read these values from environment variables:
# Example values
export OPENCODE_SERVER_URL=http://127.0.0.1:4096
export OPENCODE_SERVER_DIR=/home/richard/FeedMob
# Check values
printenv OPENCODE_SERVER_URL && printenv OPENCODE_SERVER_DIR
If either value is missing, ask the user to provide the missing value(s) before running commands. Never assume, infer, or hardcode OPENCODE_SERVER_URL or OPENCODE_SERVER_DIR.
Preflight requirement before any attached run:
printenv OPENCODE_SERVER_URL && printenv OPENCODE_SERVER_DIR.opencode run --attach $OPENCODE_SERVER_URL 'pwd && ls -1d */ || true' --dir "$OPENCODE_SERVER_DIR", then list results for the user.opencode run --attach $OPENCODE_SERVER_URL 'mkdir -p <task-folder>' --dir "$OPENCODE_SERVER_DIR".OpenCode is interactive. Always run with pty:true.
# Correct
bash pty:true command:"opencode run --attach $OPENCODE_SERVER_URL 'Explain async/await in JavaScript' --dir '$OPENCODE_SERVER_DIR'"
# Wrong (no PTY)
bash command:"opencode run --attach $OPENCODE_SERVER_URL 'Explain async/await in JavaScript' --dir '$OPENCODE_SERVER_DIR'"
--dir is required by this skill and points to a path on the machine where opencode server is running.
--dir as a client/local path unless server and client are the same machine.--dir.workdir field in bash does not replace --dir for attached OpenCode execution.bash pty:true command:"opencode run --attach $OPENCODE_SERVER_URL 'Add error handling to API calls' --dir '$OPENCODE_SERVER_DIR'"
# Start
bash pty:true background:true command:"opencode run --attach $OPENCODE_SERVER_URL 'Refactor auth module and run tests' --dir '$OPENCODE_SERVER_DIR'"
# Monitor
process action:log sessionId:XXX
process action:poll sessionId:XXX
# Respond if needed
process action:submit sessionId:XXX data:"yes"
# Stop
process action:kill sessionId:XXX
| Parameter | Type | Description |
| --- | --- | --- |
| command | string | The shell command to run |
| pty | boolean | Use for coding agents! Allocates a pseudo-terminal for interactive CLIs |
| workdir | string | Working directory (agent sees only this folder's context) |
| background | boolean | Run in background, returns sessionId for monitoring |
| timeout | number | Timeout in seconds (kills process on expiry) |
| elevated | boolean | Run on host instead of sandbox (if allowed) |
| Action | Description | | --- | --- | | list | List all running/recent sessions | | poll | Check if session is still running | | log | Get session output (with optional offset/limit) | | write | Send raw data to stdin | | submit | Send data + newline (like typing and pressing Enter) | | send-keys | Send key tokens or hex bytes | | paste | Paste text (with optional bracketed mode) | | kill | Terminate the session |
opencode run --attach.--dir.pty:true.# Start server
opencode server --port 4096
OPENCODE_SERVER_URL points to a live server.OPENCODE_SERVER_DIR exists on the server machine.pty:true is set and check process action:log.Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer