Ward

How do I use Ward with OpenCode?

Updated

Run ward integrate opencode in your project. Ward installs an OpenCode plugin that runs a quality check after each file edit and shows the failure to the agent.

What does the integration install?

Ward keeps the command .opencode/commands/ward-check.md and creates the plugin .opencode/plugins/ward-edit-write.js. The plugin targets the OpenCode V2 plugin API. Keep ward on your PATH.

Hook When What Ward does
execute.after After an edit, write, multiedit, apply_patch or patch call Runs a partial quality check, then validates edited spec files
session.idle When the agent finishes its turn Runs every configured spec check

What does the agent see when a check fails?

Ward appends its output to the tool result the agent reads, so the agent sees it at once. The tool call still completes: OpenCode V2 does not let a post-tool hook fail a call. Files changed by shell commands are not quality-checked until the Git hooks or CI run.

How do I install and remove it?

ward integrate opencode
ward integrate opencode --remove

Plugins from Ward 0.0.7 and earlier do not load in OpenCode V2. Upgrade OpenCode, run ward integrate opencode again and reload the project.

Can I guard approved specs?

Yes: ward integrate opencode --guard-approved-specs adds a separate plugin that refuses changes to openspec/specs/** and openspec/changes/archive/**. It is a best-effort filter for shell commands, not a security boundary. Ward is in alpha, so the CLI and the configuration may change before 1.0.

Where do I go next?

Ready to try it? Install Ward and run ward init in your project.