Plugin Development
Status: 2026-11-16. How to build, test and ship an Orquelo plugin. The wire protocol is in plugin protocol; hooks in detail are in the hook reference. Back to the guide index.
Status: 2026-11-16. How to build, test and ship an Orquelo plugin. The wire protocol is in plugin protocol; hooks in detail are in the hook reference. Back to the guide index.
1. What a Plugin Is
A plugin is a directory with a plugin.yaml. An instance is one configured use of it under plugins: in the Host configuration, with its own id, configuration, options, data directory and scope. A plugin acts only in the roles its manifest declares, and only for runtimes that list its instance in uses. Identity and authority always come from the Host (CallContext), never from a plugin or a model.
2. Quick Start A: No Code
A manifest plugin that offers an MCP server's tools, a skill, a hook that blocks dangerous shell commands, and a hook that adds context to every request.
release-helper/
plugin.yaml
skills/release-notes/SKILL.md
hooks/no-force-push.py
hooks/add-branch.pyplugin.yaml:
1api: v1
2name: release-helper
3version: 0.1.0
4description: Release tools from an MCP server, a release-notes skill, and two hooks.
5host: ">=0.1.0 <1.0.0"
6execution: manifest
7roles: [tool, skill, guard] # tool: mcp_servers; skill: skills; guard: pre_tool and user_input hooks
8mcp_servers:
9 - name: gh
10 command: [npx, -y, "@modelcontextprotocol/server-github"]
11 env: {GITHUB_TOKEN: "${option.token}"}
12 approval: ["create_*", "merge_*"] # these tools need a person's approval
13options:
14 token: {type: string, title: GitHub token, required: true, sensitive: true}
15skills:
16 - skills/release-notes
17hooks:
18 - {event: pre_tool, match: "bash|powershell", command: [python3, "${PLUGIN_ROOT}/hooks/no-force-push.py"], timeout: 5s}
19 - {event: user_input, command: [python3, "${PLUGIN_ROOT}/hooks/add-branch.py"], on_error: ignore}skills/release-notes/SKILL.md:
1---
2name: release-notes
3description: Write release notes from the merged pull requests since the last tag.
4---
5
6List the pull requests merged since the last tag with the gh tools, group them
7by label, and write one line per change in the imperative mood.hooks/no-force-push.py blocks with exit code 2; stderr is the reason the model sees:
1#!/usr/bin/env python3
2import json, sys
3event = json.load(sys.stdin)
4if "push --force" in json.dumps(event.get("tool_input", {})):
5 print("force pushes are not allowed; push a new commit instead", file=sys.stderr)
6 sys.exit(2)hooks/add-branch.py adds context the model sees as reference material of that run:
1#!/usr/bin/env python3
2import json, sys
3json.load(sys.stdin)
4print(json.dumps({"hookSpecificOutput": {"hookEventName": "UserPromptSubmit",
5 "additionalContext": "Releases are cut from the main branch."}}))If the Host configuration sets policy.mcp_commands, hook executables (here python3) must be listed there too. user_input context reaches the model only when the plugin also declares the context role (roles: [tool, skill, guard, context]); without it the text is held and never read. See the hook reference for every event.
Load it. In the Host configuration:
1plugin_dirs: [/path/to/plugins] # the parent directory of release-helper/
2plugins:
3 - {id: release, plugin: release-helper}
4 - {id: agent, plugin: agent, uses: [kimi, files, release], config: {model: kimi}}Then:
| Step | Command |
|---|---|
| Store the sensitive option (value read from stdin) | orquelo secret set -c CONFIG release token |
| See each instance, and each MCP server and skill, with its status | orquelo plugins -c CONFIG |
| Apply the configuration to a running Host | orquelo reload -c CONFIG |
| Before the first start, and after changing the plugin's files | orquelo plugin approve -c CONFIG release-helper (until then the plugin is unavailable with not_approved, or changed_since_approved once its files changed) |
orquelo plugin add -c CONFIG [-uses a,b] [-option KEY=VALUE]... ID PLUGIN adds an instance without editing the file.
3. Quick Start B: Any Language
A process plugin is an executable that speaks JSON-RPC 2.0 over its stdin and stdout. plugins/notes-python is a complete example in Python with only the standard library: two tools, a guard, context and a skill. It passes the same conformance suites as Go plugins (TestPythonPlugin in internal/process).
plugin.yaml:
1api: v1
2name: notes-python
3version: 0.1.0
4description: Example process plugin in Python (standard library only) with tools, a guard, context and a skill.
5execution: process
6roles: [tool, guard, context, skill]
7platforms: [darwin, linux]
8process:
9 command: # os/arch → executable, relative to the plugin directory
10 darwin/arm64: main.py
11 darwin/amd64: main.py
12 linux/amd64: main.py
13 linux/arm64: main.py
14config_schema:
15 type: object
16 properties:
17 blocked_words: {type: array, items: {type: string}}main.py, in order:
| Part | What it does |
|---|---|
read() / write() | One message = Content-Length: N\r\n\r\n + N bytes of JSON. Writes hold a lock because replies and callbacks share stdout |
initialize | Saves data_dir and config; returns {"manifest": {"name", "version", "roles"}}. The Host refuses the process if these three differ from plugin.yaml |
HANDLERS | Method name → function: tool/list, tool/invoke, guard/check, context/get, skill/list, skill/load, shutdown. Unknown methods answer -32601 |
call_host() | A callback: a request from the plugin to the Host, here host/remind with the call_id that tool/invoke gave. It is only allowed during that call |
main() | Reads messages. A reply wakes the waiting call_host; a notification ($/cancel) is ignored; each request runs on its own thread, so a tool call can wait for a callback's reply while the loop keeps reading |
| Errors | A raised exception becomes {"code": -32000, "message", "data": {"code": "notes.failed", "message"}} |
The process runs with the plugin directory as its working directory and a minimal environment (PATH, HOME, USER, LANG, LC_ALL, TMPDIR, TZ; on Windows also the system variables). Write only protocol frames to stdout; write logs to stderr, which the Host keeps in its log (redacted, at most 8 MiB per process).
Windows. process.command names an executable that is started without a shell. A script needs a launcher (for example a .exe or a .cmd the system can run directly); notes-python declares platforms: [darwin, linux] for that reason.
4. Go SDK
pkg/plugin/serve runs a Go plugin as a process: serve.Main(manifestYAML, New) where New is a plugin.Factory (func(plugin.Env) (plugin.Plugin, error)). The plugin implements the role interfaces of pkg/plugin (Tool, Guard, ContextProvider, …); the SDK speaks the protocol and turns callbacks into the Caller/ToolHost/RuntimeHost methods. The same code can be compiled into the Host as a builtin (first-party only) or shipped as a process plugin; internal/process tests run localenv both ways with the same results.
5. plugin.yaml Reference
Unknown fields are refused, so a typo never drops a declaration silently.
| Field | Type | Required | Meaning and rules |
|---|---|---|---|
api | string | yes | Contract version; v1 |
name | string | yes | ^[a-z0-9][a-z0-9-]{0,62}$; stable id |
version | string | yes | The plugin's version; must match what a process reports at initialize |
description | string | recommended | English; shown to operators and models |
host | string | no | Host versions the plugin works with, e.g. ">=0.1.0 <1.0.0" |
execution | string | no | manifest, process or builtin; manifest when omitted |
roles | list | yes | At least one of the roles in section 6; a process must report the same list |
publisher | string | no | A claim shown to operators; the Host records the real source |
default | string | no | available (default) or enabled (part of the starter configuration of orquelo init) |
platforms | list | no | os or os/arch, e.g. darwin, linux/amd64; elsewhere the instance is unavailable (platform_unsupported) |
works_with | object | no | transports: [feishu]: only with these channels |
resumable | bool | no | Runtimes only: continue from the checkpoint after a Host restart |
requires | list | no | Roles that must be offered by the instances it uses (requirement_missing) |
depends | list | no | Other plugins that must be installed: name or name@range |
prerequisites | list | no | Software outside Orquelo with a check and install steps (dependencies) |
shell | map | no | path: directories under ${PLUGIN_ROOT} or ${PLUGIN_DEPS} first on the shell's PATH; env: variables for the shell (same page, ADR 0001 decision 9) |
permissions | object | no | Requested, shown at install; never a grant |
options | map | no | Typed settings (section 7); key ^[A-Za-z_][A-Za-z0-9_]{0,63}$; type one of string, number, boolean, file, directory, and a title |
config_schema | JSON Schema | no | Validates the instance config at load (config_invalid) |
display, locales | object | no | Message keys and locale files for operator interfaces |
inputs | list | no | Models only: text, image |
process | object | process | command (os/arch → executable), args |
mcp_servers | list | manifest | name, exactly one of command (stdio) or url (Streamable HTTP), env, tools.include/exclude, approval, parallel; for URL servers only, headers (sent with every request, such as X-API-Key: "${option.api_key}"; an instance's config.headers overrides a header of the same name), auth: oauth and scopes. Every ${option.<key>} in url, command, env and headers must name a declared option, or the manifest is refused |
skills | list | manifest | Directories with a SKILL.md |
hooks | list | manifest | event, match, command, timeout (default 10s), on_error (deny default or ignore); each event needs the role it fills (hook reference) |
A manifest plugin needs at least one of mcp_servers, skills or hooks. Values in MCP commands, URLs, env, headers and hook commands may use ${PLUGIN_ROOT} (the plugin directory), ${PLUGIN_DATA} (the instance's data directory), ${PLUGIN_DEPS} and ${option.KEY}. A sensitive option may not appear in an MCP or hook command line, which any process on the machine can read: the server or hook then fails to start with a message to pass it in env (or a header) instead (Feishu #255).
6. Roles
A role is an interface in pkg/plugin and a set of protocol methods. Powers are fixed: an extension can only do what its role allows.
| Role | Methods (protocol) | May | On failure | Host timeout |
|---|---|---|---|---|
tool | tool/list, tool/invoke | Offer tools; each call goes through the ledger and approvals | Error result for the model | The tool's own (call_timeout for MCP, default 2m) |
skill | skill/list, skill/load | Offer cards and text; grants nothing | That instance's skills are left out | — |
guard | guard/check; optional check_input, check_result, check_completion | Deny or ask before a call; refuse an input; withhold a result or add a note; ask for more work | Deny / refuse / withhold; completion check skipped | 5 s check; 10 s others (longer with hooks) |
guard (optional, hook model) | guard/rewrite, guard/filter_tools, guard/before_model, guard/after_model, guard/check_step | Rewrite a call's arguments or a model call (needs grants: [rewrite], ADR 0005); remove tools from a run; refuse a model call; add context or stop the run after a batch of tool calls | Rewrites and model checks refuse the call; tool filters and step checks are skipped | 5 s rewrite; 10 s others |
reviewer | reviewer/review | Approve, deny or escalate an approval; needs grants: [review] | Escalates to a person | 30 s |
context | context/get | Add reference items at run start; cannot instruct, except an instance in the operator's policy.hooks, whose items reach the model as instructions | Omitted | 5 s |
observer | observer/observe; optional observer/before_compact | Read committed facts (run.finished, session.*, tool.finished, question.*, compaction.done, delivery.*); name facts a summary must keep | Retried from a durable cursor | 2 min per event; 30 s before compact |
compactor | compactor/compact | Write a session summary record | Next compactor, then the builtin one | 120 s |
context_processor | processor/process | Return typed edits of the history (shorten, redact, hide, annotate) | That processor's edits are dropped | 5 s |
service | service/serve | Its own long work, through BackgroundHost | Restarted with backoff, 1 s doubling to 5 min | — |
model | model/chat (+ model/delta stream) | Produce responses | The run fails | Run timeout |
runtime | runtime/execute | Run a task, with the RuntimeHost callbacks | The run fails or is retried | Run timeout |
transport, trigger, presentation, delivery | transport/start, transport/fetch, trigger/match, presentation/present, delivery/deliver | The channel stages of a connection | Per stage (architecture) | — |
Rules shared by all roles are in extension points §6: tighten only, fixed per run, deterministic order (uses order), scope decides presence, bounded inputs and outputs, effects are tool calls, recovery reuses records.
7. Configuration and Secrets
config | options | |
|---|---|---|
| Declared by | config_schema (JSON Schema) | options: with typed entries |
| Set in | config: of the instance | options: of the instance, the secret store, or the default |
| Sensitive values | Not allowed: use an option (orquelo plugin test fails on a property named like a credential, such as api_key, token or password) | sensitive: true, stored with orquelo secret set -c CONFIG INSTANCE NAME (stdin), or ${ENV} |
| The plugin receives | Env.Config / initialize.config | Env.Options / initialize.options; ${option.KEY} in manifest values |
Every top-level config_schema property needs a description (orquelo plugin test fails without one): the admin plugin's config_describe shows it to the model that configures the Host from a chat, so write what the setting does, its default and units, and any cost or security effect, in English.
A missing required option makes the instance unavailable with option_missing. Secrets are encrypted at rest; plugins must not log or return option values. For per-user secrets at call time (a user's own token), use host/secret_get, host/secret_put, host/secret_delete: they are keyed by the calling principal, and no other instance or principal sees them. Durable plugin state belongs in the instance data directory (Env.DataDir, initialize.data_dir, ${PLUGIN_DATA}), which survives restarts and upgrades.
Logins (ADR 0012) give the agent CLIs and websites. A login lands where the CLI or the site keeps it, so a tool gets nothing extra in its call. A tool that takes a secret: reference from the model, for something the person typed into a sign-in, resolves it with host/resolve_secret (plugin.SecretResolver for builtin plugins); the Host removes the value from the run's later tool results. Websites are reached through the agent-browser CLI, so a site's code goes in through localenv's secret_env like any CLI's (P87 S6). The login skill is the one skill marked with metadata.orquelo.login: true.
8. Testing
| Plugin | How |
|---|---|
| Go | The suites of pkg/plugin/plugintest: ManifestSuite, ToolSuite, GuardSuite, ContextSuite, SkillSuite, ModelSuite, TriggerSuite, PresentationSuite, DeliverySuite, RuntimeSuite, TransportSuite. They take a plugintest.T, which *testing.T satisfies |
| Any language | orquelo plugin test [-config JSON] [-options JSON] DIR (-options: the plugin's option values, as an instance's options): reads DIR/plugin.yaml, checks the manifest, starts the plugin the way the Host does, and runs the suite of each declared role over the real protocol. It prints PASS <suite> or FAIL <suite> with one indented line per problem, and exits non-zero on any failure. Roles that need a live backend (model, delivery, transport, service, observer) are reported as SKIP |
| Messages | Validate requests and replies against schemas/protocol/v1 (JSON Schema 2020-12, generated from the Go code) |
Examples of what the suites catch: a skill/load that returns a file outside the skill directory, a guard that errors on an ordinary intent, a tool list with invalid parameter schemas, locale files with different keys.
9. Publishing and Installing
orquelo plugin install -c CONFIG [-upgrade] [-yes] SOURCE accepts:
| Source | Form |
|---|---|
| Local directory | ./release-helper |
| Git, pinned | git+https://github.com/org/repo#<40-hex commit>[:subdir]; branches and tags are refused |
| Archive | https://…/plugin.tgz#sha256=<64 hex> (.tar.gz, .tgz, .zip, at most 200 MiB) |
| Catalog | A plugin name from the configured catalogs (orquelo plugin search) |
Install stages the plugin, plans dependencies and prerequisites (-yes, or the policy allow_system_installs, allows system packages; a plugin's own dependencies also install when a configured instance loads), commits by swapping directories, and rolls back on failure; -upgrade replaces an installed version and keeps a backup. orquelo plugin doctor -c CONFIG NAME rechecks prerequisites. A plugin never activates on install: only instances in the configuration run.
Claude Code and Codex packages. Installing a directory with .claude-plugin/plugin.json, .codex-plugin/plugin.json or a root plugin.json converts it into a manifest plugin without running its code:
| Converted | Left out, with a note |
|---|---|
Skills; commands (as skills); MCP servers (stdio and HTTP) with path and option variables mapped; command hooks of PreToolUse, PostToolUse, UserPromptSubmit, Stop, SubagentStop, SessionStart, PreCompact, PermissionRequest (with on_error: ignore, matching those tools) | Agents, output styles, LSP, workflows, themes, monitors, channels, apps, bin/, dependencies, legacy SSE servers, non-command hooks, hooks that need a shell, other hook events |
10. Rules Every Plugin Follows
- ◆Identity from the Host only. Key per-user data by
CallContext.principal.user; never trust ids in arguments or model output. - ◆Tighten only. Guards restrict, context adds, reviewers decide approvals only with the grant, observers read. Nothing relaxes another's decision or the operator's
policy. - ◆Effects are tool calls. A side effect during a run is a tool, so it goes through the ledger and approvals.
- ◆Idempotent by key. A tool call carries
key, stable across retries; a call whose outcome is unknown after a crash is reported, never replayed blindly. - ◆No shell. Commands and executables start without a shell; commands that need one are refused at import.
- ◆stdout is the protocol. A process writes only frames to stdout; stderr is logged and redacted.
- ◆Bounded. Every call has a Host timeout; return short text; keep files in the data directory.