Skip to content

Write a plugin ​

A plugin is one folder holding a manifest plus, optionally, MCP servers and skills. YUI runs each server. The brain reaches its tools through the bridge tools yui_tool_describe and yui_tool_call, and its skills through plugin_skill.

To build one with a coding agent, paste this line:

text
Build a YUI plugin that <what it should do>, following https://raw.githubusercontent.com/yw0nam/YUI/main/coding-agents/yui-dev/skills/yui-plugin/SKILL.md
flowchart LR
  folder["my-plugin/"] --> manifest[".claude-plugin/plugin.json"]
  folder --> mcp[".mcp.json"]
  folder --> server["bin/my-plugin"]
  folder --> skills["skills/greet/SKILL.md"]
  mcp --> host["YUI MCP host"]
  host -->|"starts"| server
  brain["Brain"] -->|"bridge tools"| host

The work takes four steps:

  1. Lay out the folder
  2. Write the server
  3. Declare tools and skills
  4. Test it locally

Layout ​

bin/ holds a built server, though a server written in another language can sit wherever its command points.

YUI reads three fields of plugin.json and ignores the rest:

FieldYUI uses it for
nameThe plugin id: the catalog id, the log file name, and the name in every error. Lowercase letters, digits and -, starting with a letter or digit.
versionThe version beside the plugin, and the one compared with the catalog to decide an update.
descriptionThe line under the plugin's name on the Plugins page.
json
{
  "name": "my-plugin",
  "version": "0.1.0",
  "description": "One line on what the plugin lets a character do."
}

Servers ​

.mcp.json names each server under mcpServers, with command required and args and env optional. YUI starts and lists the servers in the order their keys appear.

json
{
  "mcpServers": {
    "my-plugin": {
      "command": "${CLAUDE_PLUGIN_ROOT}/bin/my-plugin",
      "args": ["--stdio"],
      "env": { "MY_PLUGIN_DATA": "${CLAUDE_PLUGIN_DATA}" }
    }
  }
}

YUI starts command with args as argv and no shell, so an argument reaches the server as written. It replaces ${CLAUDE_PLUGIN_ROOT} and ${CLAUDE_PLUGIN_DATA} in command, in every argument and in every env value.

The server gets two folders:

  • ROOT is the plugin folder, which is also the working directory.
  • DATA is the plugin's data folder. YUI creates it before the start and deletes it when the user removes the plugin.

The server inherits YUI's environment, with env applied over it.

What YUI expectsWhat happens
initialize and tools/list answer within 30 s togetherA miss shows Unavailable, naming the step it stopped at.
A server that ends on its ownIt shows Exited with Restart; the next app start runs it again.
A stopYUI closes the connection, waits up to 1 s, then kills the server and every process it started.
The app killed without quittingEvery process the server started ends: with the app on Windows, at the next app start on macOS.
stdoutThe MCP channel, and nothing else.
stderrEach line goes to the plugin log, prefixed [<server>] and cut at 2000 bytes.

On Windows, a process started with CREATE_BREAKAWAY_FROM_JOB leaves the tree and outlives a stop.

Tools and skills ​

A tool name held by a built-in client tool or by an already enabled plugin is hidden, though the later plugin still runs (Plugins).

These names belong to built-in client tools: address_character, body_action, generate_express, look, plugin_skill, rate_relation, terminal_close, terminal_list, terminal_open, terminal_read, terminal_write, threads_list, threads_search, yui_tool_call, yui_tool_describe.

_meta keyWhereWhat it does
io.github.yw0nam.yui/summarythe tool's _meta in tools/listThe one-line summary a turn shows for the tool (Client Context § on-demand tools).
io.github.yw0nam.yui/wait_msthe tool's _meta in tools/listHow long the host waits for one call (Client Tools).
io.github.yw0nam.yui/presetthe request _meta of every tools/callThe preset id of the calling character, so a tool keeps one state per character.

YUI checks arguments against the tool's inputSchema before it sends a call, and it sends no arguments field when that object is empty. It also sends notifications/cancelled when a wait has passed or a turn stops (Client Tools).

A skill is skills/<folder>/SKILL.md, one level deep. Its frontmatter sits between --- lines:

markdown
---
name: greet
description: Greets the user in one line.
---
FieldRule
descriptionRequired. A skill without one is skipped, with a warning in the app log.
nameOptional; the folder name when absent. plugin_skill and the per-turn line use it.

plugin_skill returns the text after the frontmatter and nothing else, so the body carries every instruction. YUI serves no other file of the skill folder.

The body is read on each call. The name and description are read at turn-on, so a frontmatter edit needs the plugin off and on again.

Test locally ​

  1. Run the app (pnpm tauri dev, or a release build).
  2. Open Plugins.
  3. Choose Add from folder….
  4. Turn the plugin on, then choose Allow once.

The approval holds for that folder path while its files change. A different path asks again.

A change to plugin.json, .mcp.json or a skill's frontmatter needs the plugin off and on.

Retry and Restart start the server process again from the .mcp.json entry read at turn-on, so they pick up rebuilt server code but not a manifest change.

While a server is running, neither button appears.

Tips ​

  • Start from the test fixture: one server, one tool with _meta, and one skill.
  • plugins/browser is a worked plugin with one tool.
  • A server that the backend agent connects to itself is Backend-attached, so you configure it in that agent rather than in the plugin folder.

Go deeper ​

To share it with other users, see Contribute a plugin.