Skip to content
Back to skills

Charness Delegate Opencode

ASecurity

In a Charness-run session, use to launch, watch, finish and resume a builder, reviewer or researcher as a detached `opencode run` process instead of an in-process sub-agent: model and variant, deny rules, its JSON event log, the bot watch check, resuming the same session. Load charness-orchestration first.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 10, 2026
developmentrustgobashgit

Works with

  • cli

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add olosegres/charness --skill charness-delegate-opencode --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Charness Delegate Opencode?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Charness Delegate Opencode
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/olosegres-charness-delegate-opencode/badge)](https://www.skillsdirectory.com/skills/olosegres-charness-delegate-opencode)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: charness-delegate-opencode
description: "In a Charness-run session, use to launch, watch, finish and resume a builder, reviewer or researcher as a detached `opencode run` process instead of an in-process sub-agent: model and variant, deny rules, its JSON event log, the bot watch check, resuming the same session. Load charness-orchestration first."
---

# Detached OpenCode worker (Charness session)

A worker is `opencode run`: it exits when its turn goes idle and keeps the session for a later run. Load
`charness-orchestration` first — it holds the watch check this skill arms (the delivery loop is in the session's
general manager skill, else in `charness-delivery-loop`). A general delegate skill keeps the role policy (model and
variant per role); this one wins on the launch, detaching and the watch.

## Model and variant

- The first that names them decides: the model and variant the user named (the conversation, the plan, the brief, their
  own always-loaded instructions); otherwise a general delegate skill the session lists that names the role's model;
  otherwise `worker` of `claude_profiles` asked with the worker's `role` when it names OpenCode — the bot's default,
  your own instructions win; otherwise (`worker.unavailable`, a refused `role`) the ones this conversation runs on.
  `opencode models` lists what the configured providers offer — pick a listed model and a variant it supports.

## Launch

1. Make a private run directory and write the brief into `<run-dir>/brief.md`: the task and its context (the
   worker does not see this conversation), the skills it must load by name, every resource another live process
   holds, "spawn no sub-agents", "wait for your own tests before ending your turn", and "report every changed
   file and how you verified".
2. Run it:

```bash
setsid nohup env OPENCODE_CONFIG_CONTENT='{"permission":{"bash":{"git push*":"deny","git reset --hard*":"deny","git clean*":"deny","git branch -D*":"deny"}}}' \
  opencode run --auto --dir "<checkout>" --model "<provider>/<model>" --variant "<variant>" \
  --format json --title "<scope>" \
  < "<run-dir>/brief.md" > "<run-dir>/events.jsonl" 2> "<run-dir>/stderr.log" &
echo $! > "<run-dir>/pid"
```

- `setsid nohup` detaches the worker from your process, so the bot stopping your idle process never ends it.
- `--auto` approves every request that is not denied — the deny rules are the only guard, the brief is not one.
  Never edit the global OpenCode permissions for this.
- Without `--auto` the CLI refuses ordinary requests and the worker stalls.
3. Check the PID: `ps -o args= -p "$(cat "<run-dir>/pid")"` must show `opencode run … --title <scope>`. If it
   does not (the launcher handed over to a new process), take the newest match,
   `pgrep -n -f "opencode.* run .*--title <scope>"` (a launcher may run the binary as a child: two matches), and
   write that one PID into the pid file — the watch fires "worker exited" at once on a PID that is not the worker.
4. About a minute after the launch read `events.jsonl`: an `error` event there (a provider's usage limit, a refused
   model) means the worker never started — do not arm the watch; relaunch on another model. An empty log proves
   nothing yet.
5. Record the session id — the top-level `sessionID` of the first JSON event in `events.jsonl` — with the
   checkout and run directory in the plan, then arm the watch check from `charness-orchestration` with this PID and
   run directory.

## Watch and finish

- The log gets an event per finished step or tool call, not per token: one long command can leave it quiet. Add
  the folder that command writes to into the watch check.
- Read progress from the tool calls, not only the text events:

```bash
jq -r 'select(.type=="tool_use" or .type=="text") |
  (.part.tool // "SAY") + (.part.state.metadata.exit // "" | if .=="" then "" else " exit=\(.)" end)
  + " :: " + ((.part.state.title // .part.text // "") | gsub("\\s+";" ") | .[0:120])' \
  "<run-dir>/events.jsonl" | tail -30
```

- Trust the `exit=` of a command over what the worker says about it.
- Done means the process is gone AND its last turn holds the task's result without an `error` event or a failed
  tool. A `step_finish` may still be followed by another step. When unsure: `opencode export <session-id>`.

## Resume

- Confirm the old PID is gone, then repeat the launch with `--session "<session-id>"`, a new brief and new log
  files (`events-2.jsonl`, …), `touch "<run-dir>/watch-armed"` (the run directory is reused, so the marker of the first
  run is old) and arm a new check. Keep the checkout, model and variant. Never `--continue` or `--fork`.
- A turn stopped by a provider's usage limit: resume the same session with another provider's model whose
  context window holds the session.
- To stop a worker: confirm the PID is that worker (`ps -o args= -p <pid>`), `kill -TERM <pid>`, confirm it is
  gone. Never kill the OpenCode server or a process you did not start.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.