OpenCode Plugin
The OpenCode plugin provides an enhanced integration experience on the OpenCode platform, upgrading from a basic “AGENTS.md compatibility mode” to a “plugin-first + document-fallback” dual-track architecture.
- Deliver an interaction experience close to the Claude Code plugin (command bridging + lifecycle context)
- Maximize reuse of existing CLI (
openlogos *) and Skills (logos/skills/*) - Preserve
AGENTS.mdas a fallback to ensure workflow continuity when the plugin is unavailable
Operating Modes
Section titled “Operating Modes”Mode A: Compatibility Mode
Section titled “Mode A: Compatibility Mode”- Input:
AGENTS.md+logos/skills/*/SKILL.md - When to use: Plugin not installed, or plugin encounters an error
- Characteristics: Zero additional installation, more basic experience
Mode B: Native Plugin Mode (Recommended)
Section titled “Mode B: Native Plugin Mode (Recommended)”- Input: Auto-generated
.opencode/plugins/openlogos.jsandopencode.json - When to use: Default when the plugin is installed
- Characteristics: Enhanced experience with command entry, auto Phase injection, unified workflow control
Build & Distribution
Section titled “Build & Distribution”- Plugin template ships with
@miniidealab/openlogos(CLI single package), not published as a separate npm package - Plugin only handles “command routing + hook injection + result formatting” — no CLI business logic duplication
- Plugin template version stays in sync with CLI version
openlogos init --ai-tool opencodeandopenlogos syncauto-deploy the plugin template to.opencode/plugins/
Event Model
Section titled “Event Model”session.created
Section titled “session.created”Fires when a new session starts:
- Check if the project is initialized (
logos/logos.config.jsonexists) - Call
openlogos status(prefer JSON output) - Build injection context: current Phase, next step suggestion, key blockers (missing documents)
- On failure: degrade silently, never block the session
tui.command.execute
Section titled “tui.command.execute”Fires when a /openlogos:* command is entered:
- Identify the
/openlogos:*prefix command - Validate parameters
- Call
cli-bridgeto execute the corresponding CLI command - Format output uniformly (success/failure)
- Show hints for high-value actions (e.g., “change proposal created”)
Optional Enhancement Events
Section titled “Optional Enhancement Events”tool.execute.before— Restrict high-risk calls (e.g., reading sensitive files)tui.toast.show— Key result notifications
Command Mapping
Section titled “Command Mapping”| OpenCode Command | CLI Equivalent | Description |
|---|---|---|
/openlogos:status | openlogos status | Show phase status |
/openlogos:next | openlogos status | Show next step suggestion |
/openlogos:init [name] | openlogos init [name] | Initialize project |
/openlogos:sync | openlogos sync | Sync instructions and Skills |
/openlogos:change <slug> | openlogos change <slug> | Create change proposal |
/openlogos:merge <slug> | openlogos merge <slug> | Generate merge instructions |
/openlogos:archive <slug> | openlogos archive <slug> | Archive change |
/openlogos:verify | openlogos verify | Run acceptance verification |
/openlogos:launch | openlogos launch | Activate change management |
Parameter Conventions
Section titled “Parameter Conventions”- No-arg commands:
status,next,sync,verify,launch - Optional-arg command:
init [name] - Required-arg commands:
change <slug>,merge <slug>,archive <slug>
Parsing rules:
- Unified prefix:
/openlogos: - Arguments are space-delimited, no shell string concatenation
slugvalidation:^[a-z0-9]+(-[a-z0-9]+)*$- Missing required arguments return a user-readable error without triggering CLI
Error Handling
Section titled “Error Handling”Error Code Conventions
Section titled “Error Code Conventions”| Code | Scenario | User Message |
|---|---|---|
E_CLI_NOT_FOUND | openlogos not in PATH | Please install or add openlogos to PATH |
E_PROJECT_NOT_INIT | Missing logos/logos.config.json | Please run openlogos init in the project root |
E_ARG_INVALID | Missing or invalid argument | Check command arguments (e.g., slug) and retry |
E_CMD_TIMEOUT | CLI timed out | Retry later or run manually in terminal |
E_CMD_FAILED | CLI non-zero exit | See error details and fix accordingly |
E_PERMISSION_DENIED | OpenCode permission rejected | Allow the capability in opencode.json |
Error Branches
Section titled “Error Branches”The plugin must handle at minimum:
- CLI not found (
openlogosnot in PATH) - Project not initialized (missing
logos/logos.config.json) - Incomplete command arguments (e.g.,
changewithout slug) - Command timeout or non-zero exit
- Permission denied (OpenCode permission block)
Security
Section titled “Security”Recommended Permissions
Section titled “Recommended Permissions”{ "$schema": "https://opencode.ai/config.json", "permission": { "bash": "ask", "edit": "ask", "read": "allow", "glob": "allow", "grep": "allow", "skill": "allow" }}Internal Security Policies
Section titled “Internal Security Policies”- Never execute arbitrary shell strings unrelated to OpenLogos
- All CLI calls use argument arrays, no string concatenation
- Only workspace-internal paths allowed as command context
- Structured logging (command name, duration, exit code, error code) — no sensitive content logged
Fallback Strategy
Section titled “Fallback Strategy”When the plugin is unavailable:
- AI reads
AGENTS.mdat project root → understands methodology and rules - AI reads
logos/skills/*/SKILL.mddirectly → can follow any Skill guidance - User runs
openlogos *CLI commands in terminal manually
The plugin enhances the experience but is never a hard requirement. This dual-track design ensures OpenLogos works reliably regardless of plugin availability.
Related Specifications
Section titled “Related Specifications”- AGENTS.md Specification — The fallback instruction file format
- Project Structure — Where plugin files are deployed
openlogos init— Auto-deploys plugin template for OpenCodeopenlogos sync— Re-deploys and updates plugin files