Xpersona
O

Opencode Cli

CLAWHUB · Unverified

OpenCode CLI integration skill. Designed for AI agents like OpenClaw to execute coding tasks via OpenCode CLI. Core features: (1) Plan→Build workflow (2) Ses...

62
Rank
84
Safety
1.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17b12qx0p6efxh9932kka5t1n848b99:opencode-cli
  1. Install using `clawhub skill install s17b12qx0p6efxh9932kka5t1n848b99:opencode-cli` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/tchen6500/opencode-cli before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-tchen6500-opencode-cli/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

131,248 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: opencode-cli
description: "OpenCode CLI integration skill. Designed for AI agents like OpenClaw to execute coding tasks via OpenCode CLI. Core features: (1) Plan→Build workflow (2) Session management (3) MCP integration (4) Background task monitoring. Use this skill when you need: multi-step coding, Plan→Build workflow, MCP integration, or background task monitoring. NOT for: simple one-line edits (use edit tool directly), quick file reads (use read tool directly)."
dependencies:
  skills:
    - using-superpowers
  tools:
    - bash
    - read
    - write
    - edit
    - process
env:
  optional:
    - CONTEXT7_API_KEY
    - SUPABASE_URL
    - SUPABASE_ANON_KEY
---

# OpenCode CLI Integration

This skill is designed for **AI agents like OpenClaw to execute coding tasks via OpenCode CLI**.

OpenCode is an AI-powered code editor CLI. When called via OpenClaw, **only CLI mode is used**.

---

## Security Scope

**What this skill does:**
- Integrates with OpenCode CLI for coding tasks
- Manages sessions, plans, and builds
- Optionally connects to configured MCP servers (Playwright, Supabase, Context7)

**What this skill does NOT do:**
- Install or modify system-wide packages
- Access credentials outside configured MCP servers
- Persist beyond user-initiated sessions

**Credential access:**
- MCP servers (if configured) may use environment variables like `SUPABASE_URL`, `SUPABASE_ANON_KEY`, `CONTEXT7_API_KEY`
- Skills run in project context; avoid committing secrets to version control
- Only use this skill in repositories/environments you trust

---

## Core Command

```bash
opencode run -m <provider/model> -- "<prompt>"
```

**Example:**
```bash
opencode run -m <provider/model> -- "Add error handling to the login function"
```

---

## Plan→Build Workflow (Core)

### ⚠️ Key Rule: Maintain Same Session

**Correct approach:**
```bash
# 1. Start Plan (creates session)
opencode run -m <model> -- 'Analyze task, output plan.'

# 2. Wait for user APPROVE

# 3. Switch to Build (continue same session)
opencode run --continue --agent build -- 'Implement approved plan.'
```

**Wrong approach (context lost):**
```bash
❌ opencode run --agent plan "..."   # session A
❌ opencode run --agent build "..."  # session B (separate!)
```

### Agent Options

| Agent | Purpose |
|-------|---------|
| `plan` | Planning, analysis, design |
| `build` | Implementation, coding, modification |
| `explore` | Codebase exploration |

---

## Session Management

```bash
opencode run --continue -- '<prompt>'
opencode run --session <id> -- '<prompt>'
opencode run --continue --fork -- '<prompt>'
opencode session list
opencode session delete <id>
```

---

## OpenClaw Integration

### Standard Task
```bash
opencode run -m <model> -- '<task>'
```

### Background Task
```bash
opencode run -m <model> -- '<task>'
process action:poll sessionId:<id> timeout:30000
process action:log sessionId:<id>
process action:kill sessionId:<id>
```

### Monitoring Discipline

> ⚠️ **Mandatory**: A

_meta.json

{
  "ownerId": "kn727egtvc7akvwc7ekaf2g61d8499h1",
  "slug": "opencode-cli",
  "version": "1.1.0",
  "publishedAt": 1775372559621
}

references/built-in-tools-guide.md

# Built-in Tools Guide

> OpenCode Agent available tools reference

---

## File Operations

| Tool | Purpose | Example |
|------|---------|---------|
| `read` | Read file contents | `read path/to/file.ts` |
| `write` | Create or overwrite file | `write path/to/file.ts "content"` |
| `edit` | Exact string replacement | `edit old "new" in file.ts` |

## Shell Operations

| Tool | Purpose | Example |
|------|---------|---------|
| `bash` | Execute shell commands | `bash "npm test"` |
| `grep` | Regex search file contents | `grep "pattern" in src/` |
| `glob` | Pattern match find files | `glob "**/*.ts"` |

## Task Management

| Tool | Purpose |
|------|---------|
| `todowrite` | Create/update task lists |
| `todoread` | Read current task state |

## Others

| Tool | Purpose |
|------|---------|
| `skill` | Load skill files into conversation |
| `webfetch` | Fetch web page content |
| `lsp` | Language Server integration (experimental) |

---

## Tool Permissions

Different agents have different tool permissions:

| Agent | File Operations | Shell | Read-only Operations |
|-------|-----------------|-------|---------------------|
| `build` | ✅ Full access | ✅ Full access | ✅ |
| `plan` | ⚠️ Requires approval | ⚠️ Requires approval | ✅ |
| `explore` | ❌ | ❌ | ✅ |

---

*Tools Guide v1.0 - 2026-04-05*

references/mcp-config-guide.md

# MCP Configuration Guide

> OpenCode MCP (Model Context Protocol) integration configuration reference

---

## Contents

- [Configuration Levels](#configuration-levels)
- [Security Considerations](#security-considerations)
- [Global MCP Configuration](#global-mcp-configuration)
  - [Playwright MCP](#playwright-mcp-ui-automation-testing)
  - [Context7 MCP](#context7-mcp-context-management)
- [Project-level MCP Configuration](#project-level-mcp-configuration)
  - [Supabase MCP](#supabase-mcp-database)
- [Complete Configuration Example](#complete-configuration-example)
- [Running Constraints](#running-constraints)
- [Adding New MCP](#adding-new-mcp)
- [Troubleshooting](#troubleshooting)

---

## Configuration Levels

| Level | Location | Purpose | Example |
|-------|----------|---------|---------|
| Global | `~/.config/opencode/opencode.json` | Common tools | Playwright, Context7 |
| Project | `<project>/.opencode/opencode.json` | Project-specific tools | Supabase |

---

## Security Considerations

### ⚠️ Remote Code Execution Risk

MCP servers run as separate processes. Different configuration methods have different security profiles:

| Method | Risk Level | Description |
|--------|------------|-------------|
| **Global Install** | Low | Code verified once, runs locally |
| **npx** | Medium | Downloads remote code each run |

### ✅ Recommended: Global Install Only

**Why**: Verifies package integrity once, no repeated downloads, no network dependency at runtime.

**Steps:**
```bash
# 1. Verify package
npm view <package-name>

# 2. Install globally
npm install -g <package-name>

# 3. Configure with binary name
"command": ["<binary-name>"]
```

---

## Global MCP Configuration

### Playwright MCP (UI Testing)

**Package**: `playwright-mcp-server` (search npm for current package name)

```bash
npm install -g playwright-mcp-server
```

```json
{
  "mcp": {
    "playwright": {
      "type": "local",
      "command": ["playwright-mcp-server"]
    }
  }
}
```

**Purpose:**
- UI automation testing
- Page interaction simulation
- Screenshot comparison

**Tool chain:**
| Tool | Purpose |
|------|---------|
| `browser snapshot` | Get page state |
| `browser act` | Click/input operations |
| `browser screenshot` | Screenshot comparison |

---

### Context7 MCP (Context Management)

**Package**: `context7-mcp` (search npm for current package name)

```bash
npm install -g context7-mcp
```

```json
{
  "mcp": {
    "context7": {
      "type": "local",
      "command": ["context7-mcp"],
      "environment": {
        "CONTEXT7_API_KEY": "<your-api-key>",
        "DEFAULT_MINIMUM_TOKENS": "10000"
      }
    }
  }
}
```

**Purpose:**
- Long-term context storage
- Cross-session memory

**Get API Key:** https://upstash.com

---

## Project-level MCP Configuration

### Supabase MCP (Database)

**Package**: `mcp-server-supabase` (search npm for current package name)

```bash
npm install -g mcp-server-supabase
```

**Config file:** `<project>/.opencode/opencode.json`

references/skills-config-guide.md

# Skills Configuration Guide

> OpenCode Skills file locations and format specification

---

## Configuration Locations

Skill files are auto-discovered in these directories:

| Location | Purpose | Priority |
|----------|---------|----------|
| `.agents/skills/<skill>/SKILL.md` | Project-level | High |
| `~/.config/opencode/skills/<skill>/SKILL.md` | Global | Low |

**Priority note:** Project-level skills override same-name global skills.

---

## Skill Format

```markdown
---
name: my-skill
description: Description of what this skill does and when to use it.
---

# Skill Content

Instructions and documentation here...
```

---

## Naming Rules

- Lowercase letters, numbers, single hyphens
- Cannot start or end with hyphen
- No consecutive hyphens (`--`)
- Must match directory name

**Correct examples:**
- `opencode`
- `my-skill`
- `test-helper`

**Wrong examples:**
- `My-Skill` (uppercase)
- `-my-skill` (starts with hyphen)
- `my--skill` (consecutive hyphens)

---

## Directory Structure

```
~/.config/opencode/skills/
├── opencode-cli/
│   ├── SKILL.md
│   └── references/
│       ├── mcp-config-guide.md
│       └── skills-config-guide.md
└── another-skill/
    └── SKILL.md
```

```
<project>/.agents/skills/
├── project-specific-skill/
│   └── SKILL.md
└── another-project-skill/
    └── SKILL.md
```

---

## References

- [AgentSkills Specification](https://agentskills.io/specification)
- [OpenCode Documentation](https://opencode.ai/docs)

---

*Configuration Guide v1.0 - 2026-04-05*

Sponsored

Ads related to Opencode Cli and adjacent AI workflows.