view source

Octomind AI Agent Plugins: Write, Install

skill

Write, install and debug an Octomind AI agent plugin: the config entry, transports, events, effects, time limits and signed install. For your own plugins.

Apache-2.0 Requires: octomind binary and a config.toml you can edit. A stdio plugin needs the program it names. Socket type is not available on Windows.

agents that use this skill

instructions

Overview

An Octomind plugin is a separate program. Octomind sends it an event at fixed points of the agent loop and applies the effects the plugin answers with. Use it to write a plugin, add an entry to plugins, or find out why one does nothing. Besydr, the plugin a new configuration lists, is covered by octomind-supervisor; do not repeat it here.

The word "plugin" names two things in Octomind. This skill covers the program in the plugins list of config.toml. The other is an Agent Plugin package (a folder with plugin.json, skills and an optional mcp.json); see "Tap packages" below. A tap ships the package, not an event plugin program.

Mental model

Octomind runs the loop, the plugin only answers. It never starts a request. Every event is one JSON-RPC 2.0 request: the method is the event name, params is the event, result is the answer, and each field of the answer is one effect. Effects only add: a note, a context block, a refusal of a tool call, a replaced tool result, a continued turn. A plugin cannot edit or remove a message a model request already carried. It runs with the user's rights and no sandbox, and sees every message, tool argument and result.

Rules

The plugins entry

Unknown keys are rejected. Names are unique. Put an inline plugins = [...] above the first [table] header, or put [[plugins]] blocks last, because keys after the header belong to that entry. Restart Octomind after a code change: a stdio plugin starts once per process.

FieldType, defaultMeaning
namestring, requiredShown in notices and logs; names the install directory
typestdio, socket or http, requiredTransport
command, argsstring; list, []Program to start. Required for stdio
pathstringUnix socket path. Required for socket
url, headersstring; table, {}Required for http; must start with http:// or https://
enabledbool, truefalse keeps the entry and starts nothing
roleslist, []Empty means all. An entry matches the agent tag exactly or its namespace (developer covers developer:acme)
timeout_secondsinteger 1-3600, noneTime for initialize; can only lower the limit of other events
install_manifest, install_keystringsBoth or neither; signed install, stdio and socket only

{{ENV:KEY}} works in command, args and header values. An unset or empty variable stops the plugin from starting and shows a notice.

Transports

  • stdio: Octomind starts command in its own process group and talks over standard input and output, one JSON object per line. Standard error goes to the debug log as Plugin 'name' stderr: .... A line on standard output that is not a JSON-RPC response or a progress notification is ignored.
  • socket: Octomind connects to path. Only when nothing answers and command is set does it start the program detached and retry for 5 seconds. That program may outlive Octomind and serve other processes.
  • http: each message is one POST to url, the answer is the response body, a non-2xx status is a failure. Notifications get 10 seconds. There is no progress. All session data leaves the machine, so use https://.

A request has an id and needs a response with the same id. A message without id is a notification: do not answer it. One connection per plugin serves every session in the process, so two sessions can send requests at once.

Lifecycle

  1. At session start, for each enabled plugin whose roles match, Octomind sends initialize with protocol: 1, host and events (each event with the effects it applies).
  2. The plugin answers with protocol: 1, plugin (name, version) and subscribe. Optional: options, status_fields, commands, timeouts. Another protocol number, an error, no answer in time or an unreadable answer switches the plugin off for the session with one notice; the next session tries again. Unknown names in subscribe are ignored.
  3. Octomind sends only subscribed events, plugins one after another in list order.
  4. session.end is the last event. A closed connection is reopened before the next event, initialize repeats and the next event carries the full message list with messages_reset.

options (all optional): min_output_tokens, result_chars, returned_chars, diff_chars, read_max_files (at most 200), read_max_file_bytes (at most 65536). Without them Octomind sends the plain default.

Events and effects

Every event carries session_id, role, workdir, project, messages (new ones since the last answer) and messages_reset, and often model, status, plan, tools, files. Common effects, allowed on every event that is answered except where noted: context, pin, usage, report, read, notice, register, history, plan, note.

EventSent whenExtra effects, winner
session.startsystem prompt final; source is startup, resume or compactnone
prompt.submituser prompt, before the model; promptreplace_prompt, block; first block wins
request.beforebefore each model request; phasenone
tool.beforebefore a round of tools; callsdeny, lift; first deny wins
tool.afterresults ready, model has not seen them; calls with resultreplace, result_note, stop; first stop wins
turn.endmodel answered with no tool call; answers, changescontinue, verified; first continue wins
compact.beforebefore a compaction; forcednone
subagent.startbefore a subagent; promptinherit (a note is dropped)
commanduser ran a slash command the plugin declaredoutput; no note, no plan
status/info asksrows; no note, no plan
judgeOctomind asks for a judgement; purpose is skills, capabilities, taps or compressionjudgements; only usage, report, notice besides
session.endsession ends; reasononly usage, report, notice

compact.after and subagent.end are notifications: no answer, no effects. An effect an event does not allow is dropped and only the debug log says so; the rest of the answer counts.

Effect shapes: context and pin are lists of {name, text} (no text clears the block); notice, note, result_note are lists of strings; deny is [{call_id, reason}]; lift is [{call_id, rules}] for rules the same plugin registered; replace is [{call_id, text, keep_original}] and {original_path} in text becomes the saved original's path; stop and continue are strings (continue becomes the next input, at most 5 per user turn); plan is {action: start|advance|revise|finish, ...}; read is a list of paths or globs, whose texts arrive in files with the next event.

register

register is {rules, skill_dirs}. rules is TOML text in the format of .agents/guardrails.toml (the pipe, guard, hook and validator sections); each rule needs an id and a mode of apply or observe, and a rule without them is skipped. skill_dirs is a list of {id, path, mode}, where path is a directory holding one SKILL.md. Sending register again replaces what the plugin registered before; invalid TOML is only logged. Rule format: see octomind-guardrails.

Time limits and failures

  • initialize: timeout_seconds, else 30 seconds; progress does not extend it.
  • Other events: the seconds the plugin declares in timeouts for that event, else 30; timeout_seconds only lowers it. Range 1-3600. A progress notification {"id": n} restarts the wait, but nothing waits longer than 3600 seconds in total.
  • session.end gets at most 5 seconds.
  • Failure (timeout, closed connection, error, unreadable answer): the agent goes on without that answer and Octomind sends cancel with the request id. A notice says plugin 'name' did not answer EVENT: reason.
  • After 3 failures in a row the plugin is paused 30 seconds, then one trial event; each failed trial doubles the pause up to 600 seconds. One answered event ends it with plugin 'name' answers again.
  • Notices print to standard error only on a terminal and not with --format jsonl. The paused and failed-handshake notices are also reported as errors.

Signed install

With install_manifest and install_key (base64 of a 32-byte Ed25519 public key), Octomind downloads a missing command on first connect. Lookup order: a command with a path separator is used as given and never downloaded; then PATH; then plugins/<name>/ in the data directory; then the download. The manifest is {"version": "...", "targets": {"<target>": {"url": "...", "sha256": "..."}}}, fetched with its signature at the same URL plus .sig. Octomind checks the signature over the exact bytes, then the archive hash, and extracts one entry named like command (.tar.gz, or .zip on Windows). Targets: x86_64-unknown-linux-musl, aarch64-unknown-linux-musl, aarch64-apple-darwin, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc. The manifest is at most 64 KiB, the archive 200 MiB, the program 1 GiB; connecting with a download may take 300 seconds. An installed program is never updated.

Seeing what a plugin did

  • Set log_level = "debug" or run /loglevel debug: the log shows the handshake, stderr lines, failures, ignored effects and unknown events.
  • /info shows the plugin's usage and status rows.
  • /plan is built in and shows the plan a plugin set with plan. A plugin adds slash commands by declaring commands (name, hint, description); a plugin command wins over a built-in of the same name. Besydr's /learning is one.

Tap packages

A tap's plugins/<name>/ holds an Agent Plugin package: plugin.json (with the $schema URL and a lowercase name of 1-64 characters), skills/<skill>/SKILL.md and an optional mcp.json. Octomind also scans <workdir>/.agents/plugins/ and ~/.config/agents/plugins/; the first source wins on a name. Its skills join the skill pool and its servers load when one of its skills activates. It does not start a program and adds no plugins entry. To ship an event plugin, publish the program with a signed manifest and give the user the plugins entry.

Common mistakes

  • Printing logs to standard output. Use standard error.
  • Answering a notification, or not answering a request.
  • Missing protocol: 1 or subscribe in the initialize answer.
  • Declaring no timeouts for a slow event and expecting timeout_seconds = 300 to raise the 30-second limit.
  • Sending an effect on the wrong event, for example deny on tool.after.
  • A rule in register.rules without id or mode.
  • install_manifest without install_key, or with type = "http".

Examples

Entry for a program written in Python:

toml
plugins = [
	{ name = "tutorial", type = "stdio", command = "python3", args = ["/abs/path/plugin.py"], roles = ["developer"], timeout_seconds = 10 },
]

Handshake answer, then one tool.before request and reply that refuses a call:

json
{"jsonrpc":"2.0","id":1,"result":{"protocol":1,"plugin":{"name":"tutorial","version":"0.1.0"},"subscribe":["tool.before"],"timeouts":{"tool.before":5}}}
{"jsonrpc":"2.0","id":2,"method":"tool.before","params":{"session_id":"s1","role":"developer","calls":[{"id":"c1","tool":"shell","arguments":{"command":"rm -rf /"}}]}}
{"jsonrpc":"2.0","id":2,"result":{"deny":[{"call_id":"c1","reason":"not allowed here"}]}}

Bad: log with print("ready") and answer tool.before with replace. Good: log to standard error and answer deny.

Checklist

  • The user means a program in plugins, not an Agent Plugin package?
  • The entry has the fields its type needs, and install_manifest has install_key?
  • The initialize answer has protocol: 1, plugin and subscribe?
  • Each effect is allowed on the event that carries it?
  • Declared timeouts cover the slow events?
  • Debug log checked for ignored effects, failures and stderr lines?

References

  • octomind-config for the config file layout, octomind-guardrails for the rule format, octomind-supervisor for Besydr.
  • Octomind docs: doc/integration/05-plugins.md (wire types, five-step tutorial in Python, security notes) and doc/integration/04-tap-system.md; the same pages are served at https://octomind.run/docs/.