Skip to content

feat(harness): OpenCode support for spec-loop + agent-isolation; rename to agent-iso.sh - #687

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:opencode-harness-spec-loop-agent-isolation
Jul 3, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:opencode-harness-spec-loop-agent-isolation

Conversation

@potiuk

@potiuk potiuk commented Jul 3, 2026

Copy link
Copy Markdown
Member

What

Closes two more Claude-Code-coupled substrate tools on the agent-harness
axis, each via a genuine OpenCode integration over its already
harness-agnostic core. With agent-guard (#686) merged, this brings the
agent-harness score to 18/20 (90%) — OpenCode now backs 3 tools.

spec-loop

loop.sh builds the headless-run argv per harness. SPEC_LOOP_HARNESS
(defaulted from the agent basename, so SPEC_LOOP_AGENT=opencode is
enough) selects:

  • claude — claude -p --dangerously-skip-permissions --output-format …,
    prompt on stdin (unchanged default).
  • opencode — opencode run --auto --model … "<prompt>", prompt as a
    positional arg. --auto is OpenCode's auto-approve (the equivalent of
    --dangerously-skip-permissions); --format json matches stream-json.

OpenCode has no per-invocation --disallowedTools; the push/gh denial that
flag adds as defense-in-depth is left to the OS sandbox (the real guard,
per loop.sh's SECURITY header), the agent-guard OpenCode plugin, and the
project's opencode.json permission config.

agent-isolation

  • The clean-env launcher is renamed claude-iso.sh → agent-iso.sh
    and its core (agent_iso_run) is parameterized by agent. One env -i
    credential strip backs two entry points: claude-iso (default) and
    opencode-iso. The Claude-only in-process --settings sandbox grant is
    gated to the claude agent; OpenCode takes filesystem isolation from the
    OS-level sandbox. The claude-iso / opencode-iso function/alias
    names are unchanged, so alias claude=claude-iso keeps working.
  • setup-isolated-setup-update gains a rename-migration step: when a
    pre-rename claude-iso.sh copy is found on disk it surfaces removing the
    stale file + installing agent-iso.sh (read-only posture — user
    confirms; shows the exact cp/rm).
  • All references to the renamed file swept across docs, skills, and eval
    fixtures.

Tests / verification

  • New OpenCode tests: env-strip parity with the Claude path + assert the
    Claude-only --settings is not injected for OpenCode + symlink-name
    and default-agent selection. Existing 21 claude-iso tests still pass.
  • Both READMEs: **Harness:** → Claude Code, OpenCode.
  • Full pre-commit suite green (mypy/pytest/ruff workspace, validator,
    doctoc, markdownlint, lychee). Scorer: agent-harness 18/20 (90%).

Remaining

permission-audit and sandbox-lint stay coupled — they audit/lint
Claude's specific .claude/settings.json schema, so an OpenCode
equivalent is a genuine opencode.json auditing feature (separate,
security-sensitive work), not a label flip.

…me to agent-iso.sh

Closes two more Claude-Code-coupled substrate tools on the agent-harness
axis by giving each a genuine OpenCode integration over its already
harness-agnostic core.

spec-loop:
- loop.sh builds the headless-run argv per harness. SPEC_LOOP_HARNESS
  (defaulted from the agent basename) selects `claude` (`claude -p
  --dangerously-skip-permissions --output-format …`, prompt on stdin) or
  `opencode` (`opencode run --auto --model … "<prompt>"`, prompt as a
  positional arg; --auto is OpenCode's auto-approve, --format json matches
  stream-json). OpenCode has no per-invocation --disallowedTools; the
  push/gh denial is left to the OS sandbox + the agent-guard OpenCode
  plugin + opencode.json permission config, as the SECURITY header already
  documents the OS sandbox as the real guard.

agent-isolation:
- The clean-env launcher is renamed claude-iso.sh -> agent-iso.sh and its
  core (agent_iso_run) is parameterized by agent. It exposes two entry
  points sharing one `env -i` credential strip: `claude-iso` (default) and
  `opencode-iso`. The Claude-only in-process `--settings` sandbox grant is
  gated to the claude agent; OpenCode takes filesystem isolation from the
  OS-level sandbox. The `claude-iso`/`opencode-iso` shell function names
  are unchanged, so `alias claude=claude-iso` keeps working.
- setup-isolated-setup-update gains a rename-migration step: when a
  pre-rename claude-iso.sh copy is found, it surfaces removing the stale
  file + installing agent-iso.sh (read-only posture — user confirms).

Both tools: **Harness:** -> `Claude Code, OpenCode`. Tests cover the
OpenCode path (env-strip parity + no --settings for OpenCode; the
spec-loop argv branch by inspection). Regenerated the score block; the
agent-harness score rises to 17/20 here (18/20 once the agent-guard
OpenCode PR also lands). All references to the renamed file swept across
docs, skills, and eval fixtures.
@potiuk
potiuk merged commit d98602b into apache:main Jul 3, 2026
33 checks passed
@potiuk potiuk added substrate:framework-dev Tool substrate: build / validate / eval the framework itself substrate:sandbox Tool substrate: agent isolation, egress control, settings audit labels Sep 25, 2026
@potiuk potiuk added capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) family:docs Docs, MISSION.md, READMEs family:setup setup-* skills family:tools tools/* labels Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) family:docs Docs, MISSION.md, READMEs family:setup setup-* skills family:tools tools/* substrate:framework-dev Tool substrate: build / validate / eval the framework itself substrate:sandbox Tool substrate: agent isolation, egress control, settings audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant