Install
Install with PiG
pig install npm:opencode-dev-frameworkInstall with Pi
pi install npm:opencode-dev-frameworkPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"skills": [
"./templates/.opencode/skills"
],
"extensions": [
"./dist/adapters/pi/index.js"
]
}README
Written by the package's publisher, shown as published in version 1.14.0 (README.md). PiG does not review it.
opencode-dev-framework
AI agents can say they're done without proving it. This plugin replaces assertion with evidence: guardrails, per-edit lint feedback (and formatting on DSH, where the host provides none), a completion gate that runs your real checks, and verified goals that require a tool-result PASS on the final tree. Exit codes don't negotiate.
One shared enforcement core powers adapters for OpenCode, DSH (DeepSeek Harness, via Cordis), and Pi (Pi coding agent, via the extension API), with the same config, profiles, rules, and gates on all three.
Inspired by anticomputer/dev-framework, which supports Copilot CLI, Claude Code, and Codex CLI; this is an independent implementation.
Principles
These principles guide every mechanism in this plugin:
- Verbatim evidence. Work is judged as performed — original output or explicitly marked pointers, never silently rewritten. No output redaction, no revised reports, no laundered context.
- Read-only reviewers. The judging party cannot touch the work. Findings are reported visibly; rework happens in the open, and the gate re-verifies from scratch.
- Reveal, don't sanitize. Audit trails over hidden rewrites — what happened stays inspectable.
- No bypass-required measures. Nothing that fights legitimate use; if a control needs a workaround, it's the control that's wrong.
- Bounded and loud. Enforcement budgets are explicit and stand-down is announced, never a quiet pass.
- Evidence over heuristics. The gate reads tool exit codes and reviewer judgment — it never scans agent prose for forbidden phrases. A duty stated positively ("run the suite, write the review") has no wording to false-positive on.
- One job. This plugin enforces dev discipline: verification, review, guardrails. It runs your tools instead of replacing them, and leaves unrelated concerns (like secret handling) to dedicated plugins. Every control family bundled into one engine is a new family of false positives.
Install
On OpenCode:
Requires OpenCode v2.x (live-verified on v2.0.26 and v2.2.0). V1 agent frontmatter and the V1 plugin API are deprecated upstream and unsupported — agent names come from filenames.
opencode plugin add opencode-dev-framework
Or declare it in opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugins": ["opencode-dev-framework"]
}
Full OpenCode reference: docs/user/opencode.md.
On DSH:
Requires DSH 0.2.2-rc.3 or newer (live-verified on 0.2.2-rc.5).
dsh plugin --profile <name> add opencode-dev-framework
df install-dsh --profile <name> # preset seam + verification
Full DSH reference: docs/user/dsh.md.
On Pi:
Requires Pi 1.7.0 or newer (live-verified on 1.7.0).
pi install opencode-dev-framework
Then run pi from the project directory. /df-goal registers when a
compatible third-party goal provider is loaded (verified with
@timmyjl12/pi-goal); see verified goals.
Full Pi reference: docs/user/pi.md.
Quickstart
Five minutes from zero to your first gated session.
In any project, run:
/df-init
It scaffolds the templates, writes a detected config, trial-runs it, and
hands your session agent a brief — what was detected, what passed, Makefile
targets worth mapping to wrappers, at most 3 open questions. The agent
resolves what it can, asks only genuinely user-only questions, and ends with
a config + hardening.md draft for your review. Budget ~5 minutes,
review-only at the end; imperfections assumed, manual always possible.
Prefer a shell? Same thing non-interactively — for CI, dotfiles, and
scripted runs (add --dsh on DSH so the host-visible skill mirror is
scaffolded too):
npx opencode-dev-framework init [--dsh]
Conflicts need --overwrite-existing or --skip-existing — everything
else is under npx opencode-dev-framework --help.
On DSH, run dsh from the project root (or export ODF_WORKDIR), and
accept template drift via /df-update if the session reports any.
Then ask the agent for a small edit. You will see the plugin working: the
edit is checked against guardrails before it lands, your linter runs on the
edited file, and when the session goes idle the completion gate runs your
typecheck/tests. /df-status shows the live state at any time. Start with
profile: advisory if you want to observe before enforcing.
Sharing the setup with a team? See docs/user/team-setup.md.
Local development
From a checkout — the contributor loop. Build once, then wire the profile directly at the built file (no registry needed):
npm run build
df install-dsh --profile <name> --dist /path/to/opencode-dev-framework/dist/adapters/dsh/index.js
Rebuild after every source change; rerun df install-dsh any time
(it is idempotent outside its managed block). Human validation and development
workflow: docs/dev/contributing.md. AI coding
agents also follow AGENTS.md.
Harness differences
Same core, same config, same profiles — different wiring where the hosts differ. No harness is the "real" one; each is stronger somewhere:
| Area | OpenCode | DSH | Pi |
|---|---|---|---|
| Completion gate | Synthetic continuation at the idle boundary (re-prompt round-trip) | Blocks termination pre-terminal; failure work continues in the same turn | Bounded settlement continuation (agent_before_settle + one custom_message entry, exactly one more provider request) |
| Per-edit lint | Logged against the landed edit | Fails the tool call (block) — agent retries same turn | Appended to the result as model-facing feedback (isError in standard/strict) |
Guard warn | Logged (advisory never blocks) | Logged, or prompts the human as ask when the approval seam is injected | Logged (advisory never blocks) |
Redirect targets (a > file) | Not guard-checked | Guard-checked (wider than OpenCode) | Guard-checked (same core seam as DSH) |
| denial identity | Reason text | Reason text + structured {name, code} | Reason text |
| Skills | .opencode/skills (native) | .dsh/skills (installed by df-init, kept current by df-update) | .opencode/skills via the package manifest (declare + enable in pi config) |
| Reviewer agents | .opencode/agents specialists run as subagents (least-privilege permissions frontmatter: no edits, no shell except test-grounder) | Adapter-dispatched DSH children on review-blocks (one per kind; read-only preset where the registry exists; findings fold into the steer; customize via .dev-framework/agents/); inline steer when the seam is absent | Adapter-dispatched pi subprocesses on review-blocks (one per kind; read-only --tools allowlist; findings fold into the continuation; customize via .dev-framework/agents/); inline review when unavailable |
| Goals | /df-goal wraps native /goal | df-goal creates the host goal with the same verification contract | /df-goal registers when a compatible provider is loaded (verified @timmyjl12/pi-goal, checks-only); see verified goals |
| Install | One command (opencode plugin add) | dsh plugin add + df install-dsh (bundle auto-wires the base entry) | One command (pi install, manifest-declared entry) |
| Review UI | Instant TUI modals, never feed the LLM | Host commands returning text | Host commands returning text |
Bold marks where DSH currently enforces harder — the host exposes
pre-terminal hooks, tool-call blocking, and human approval, so the
same verdict bites earlier and louder there. OpenCode keeps the edge
in install simplicity and instant review UI; Pi matches DSH's install
simplicity (one manifest-declared command) with OpenCode-style
post-edit feedback and its own settlement-continuation gate. All three
run the identical gate contract (typecheck, tests, acceptance, review artifact,
max_blocks budgeting).
Identical on all three: pre-execute deny hardness, pre-flight ordering and
semantics, block budgeting, protect_off scope, and the same command and
agent-tool contracts. Details:
docs/user/opencode.md (OpenCode),
docs/user/dsh.md (DSH),
docs/user/pi.md (Pi).
What it does
- Constitution injection. Adds a project quality bar to the system prompt at session start (bundled default, overridable per project).
- Guardrails. Blocks or warns on protected paths (
.env, vendored code, your own globs) and dangerous shell commands (git push,rm -rf). Secrets are blocked at the write, never scrubbed from sight — secret handling recommends gitleaks at the commit boundary. - Per-edit lint. Runs your linter on each edited file. On OpenCode the result is logged against the landed edit; on DSH a finding fails the tool call so the agent retries clean in the same turn.
- Completion gate. At the would-go-idle boundary, runs typecheck, tests,
acceptance checks, and (in
strict, lint on changed files) — plus a required substantive peer-review artifact instandard/strict(length floors, no template checkboxes, written after the latest session edit). On OpenCode, failures steer the session back via a synthetic continuation, bounded bygate.max_blocks(fewer when the failure repeats with no new edits — the gate stands down early on zero progress). On DSH the same verdict runs pre-terminal in the same turn — no re-prompt round-trip. Scratch and generated files can skip evaluation viagate.ignoreor/df-ignore. - Verified goals (
/df-goal). Wraps a task in native/goalwith a verification contract the reviewer weighs as evidence. - Pre-flight gate (optional). Denies edits until the agent records required upfront research.
- Custom tools + CLI.
dev_framework_*tools for in-agent use;df init [--dsh] / profile / status / version / install-dsh --profile <name>from the shell (children may not invoke gate tools — deny + redirect).
Minimal configuration
Create .dev-framework.yml in your project root (the legacy
.opencode-dev-framework.yml name is still read when no neutral-named
file exists):
profile: standard
commands:
typecheck: "npm run typecheck"
test: "npm test"
Full reference (all keys, acceptance checks, pre-flight, rule overrides):
docs/user/configuration.md. Copy-paste
starters: examples/go-service/.
How it fits together
Every session runs the same loop — constitution, guardrails, lint, gate —
whether or not it starts under /df-goal. A goal just wraps that loop in
native verification. The diagram below shows the blocking OpenCode path
(standard/strict, idle synthetic continuation); on DSH the same verdict
bites earlier — the pre-terminal completion block, same-turn lint blocks, and
dispatched reviewers above all run inside the turn instead of round-tripping
through it:
Flow source lives in docs/user/opencode.md
as mermaid; docs/assets/flow.svg is rendered from it
(npx @mermaid-js/mermaid-cli -i <mermaid> -o docs/assets/flow.svg) and
embedded above by absolute URL so it renders on npm too — update both together.
Profiles
| Profile | Guardrails | Gate failures | Lint on edit | Pre-flight | Review required | Notes |
|---|---|---|---|---|---|---|
off | disabled | not reported | no | no | no | Plugin registers no hooks at all. |
advisory | warn | warn | yes | warn only | warned, not blocked | Nothing blocks; everything is logged. |
standard | deny | error | yes | deny edits | blocks completion | The default when a config file exists. |
strict | deny | error | yes | deny edits | blocks completion | Also lints changed files in the gate. |
Shared enforcement semantics: docs/user/enforcement.md.
Host mechanics: OpenCode ·
DSH · Pi.
Commands
| Command | What it does |
|---|---|
/df-status | Instant modal: profile, guardrails, gate, configured commands. |
/df-runtime | Instant modal: plugin version + live hook/gate runtime state. |
/df-help | Instant modal: lists the dev-framework commands. |
/df-profile | Instant modal picker (or /df-profile <name>): switches profile now, written to config. |
/df-verify | Runs the verification suite manually; pass/fail summary in a modal. |
/df-ignore | Server-side command: marks scratch files so the gate skips them — globs ignored for this session (-s stores to gate.ignore, -l lists, -r removes). See the scratch pitfall. |
/df-init | Server-side command: scaffolds templates, writes the detected config, trial-runs it, hands the brief to the agent. |
/df-update | Server-side command: diffs installed templates against shipped, refresh/add each with user approval (detection only, never writes). Drift is also mentioned once at session startup. |
/df-goal <objective> | Server-side command: starts a verified native goal (requires native /goal, a blocking profile, and at least one real check). |
The TUI commands open instantly and never feed the LLM; /df-init,
/df-update, and /df-goal are server-side and drive the session. Same
nine names on DSH, where they run as host commands returning text instead
of modals. Full reference:
docs/user/commands.md.
Limitations (short version)
All harnesses
- Completion enforcement is bounded by
gate.max_blocks(and stands down earlier after repeated failures with no new edits). Stand-down is loud, and you can always close the session; this is not an unlimited trap. - Pre-flight and guardrail denials are pre-edit hard blocks, distinct from the bounded completion mechanisms below.
- A cached pass never survives a restart — after a restart the gate always re-verifies the final tree from scratch.
- Session ignore patterns (
/df-ignorewithout-s) also live in server memory — a restart clears them. Store what must survive with-s. - Formatting and linting use your project tooling — the framework never
reimplements them. On OpenCode the host runs the formatter; on DSH the
adapter runs your configured formatter command before linting. Want
formatting on OpenCode? Configure the host
formatterinopencode.json(docs) — the plugin defers to it and never runs its own.
OpenCode
- A failed completion gate admits a synthetic continuation at the idle
boundary. A genuine pre-stop veto was proposed upstream
(
anomalyco/opencode#54487, closed unmerged) — restoration is tracked indocs/plans/08-notes.mdif the hook ever lands. - Guardrails add to OpenCode permissions; they never replace them. Formatting is OpenCode core's job, not the plugin's.
DSH
- In
standard/strict, a failed completion gate blocks termination pre-terminal and enqueues required same-turn work until pass or stand-down. - After a restart, all prior gate state is unknown (block budget
included) — the gate re-verifies from scratch.
df-statusreports continuity per session (clean,resumed after interruption, orunknown). - Human approval prompts, reviewer dispatch, and the read-only reviewer
preset depend on services provided by the DSH profile. Missing optional
services disable only their enhancement;
df-statusreports the seams.df install-dshhandles the profile-dependent preset wiring.
Pi
- In
standard/strict, a failed completion gate appends one entry and requests exactly one more provider request atagent_before_settle, until pass or stand-down. - After a restart, all prior gate state is unknown (block budget
included) — the gate re-verifies from scratch. State is memory-only
by design;
df-statusreports the live settlement state. - Reviewer dispatch spawns isolated
pisubprocesses with a read-only tool allowlist; when unavailable (no model, spawn failure, timeout), review stays inline./df-goalregisters when a compatible third-party goal provider is loaded (verified with@timmyjl12/pi-goal); see verified goals.
Full story: docs/user/opencode.md
(OpenCode), docs/user/dsh.md (DSH),
docs/user/pi.md (Pi).
Troubleshooting
Upgrade, disable, or remove: docs/user/lifecycle.md.
Shared gate and review diagnostics: docs/user/troubleshooting.md.
Host-specific failures: OpenCode ·
DSH · Pi.
Contributing
Human development workflow: docs/dev/contributing.md.
AI coding agents also follow AGENTS.md.
Disclaimer
This plugin changes how an AI agent behaves in your repository. Review the
constitution, protected paths, and gate commands before enabling the
standard or strict profiles, and start with advisory if you want to
observe behavior without enforcement.
License
MIT