man oscar The manual Automation

Plugins

Plugins: writing one, installing, catalogs and updates, permissions, exec commands, dashboard pages, the example.

MANUAL / AUTOMATION 21 / 29

A plugin is a folder that bundles things Oscar already knows how to use: Lua tools, skills, hooks, MCP servers, slash commands (aliases, and commands that run one of the plugin's programs after approval), static pages for the web dashboard, and the plugin's own settings. It lives in $OSCAR_HOME/plugins/<name>/ and is described by a plugin.toml.

Code in a plugin is either Lua, run in the same sandbox as your own Lua tools, or programs the manifest lists, run the way hooks and MCP stdio servers run: as separate processes. Nothing from a plugin is ever loaded into Oscar's own process.

Installing

shell
oscar plugins install https://git.example.org/me/word-tools.git   # git
oscar plugins install git+https://git.example.org/me/word-tools#v1.2
oscar plugins install ./word-tools                                 # a folder
oscar plugins install https://example.org/word-tools-1.0.tar.gz    # an archive
oscar plugins install ~/Downloads/word-tools.zip

Before anything is written, Oscar shows the plugin's name, version, author, license, where it comes from, what it brings (tools with their capabilities, skills, hooks, MCP servers, commands, settings), its permissions, and what the safety scan found. The plugin is installed and enabled only after your yes: a prompt on a terminal, --yes elsewhere. A plugin the scan calls dangerous (prompt injection, credential grabbing, piping a download into a shell, a binary file…) is refused unless you pass --force after reading the files. Nothing the plugin ships runs during the install.

  • Git sources are cloned with the system's git (install it if you use git sources), with hooks, templates, symlinks and unexpected transports turned off, no credential prompts, and plain http:// refused. #ref picks a branch, tag or commit; the commit installed is recorded.
  • Archives may hold the plugin at the top or in one folder; url#dir names another folder. Downloads are capped at 25 MiB and send User-Agent: Oscar-Agent/<version>.
  • Limits: 500 files, 1 MiB per file, 16 MiB in all; no symlinks, no paths that leave the folder; hidden files (.git, .github) are skipped.
  • Files are written without the executable bit, except the programs the manifest lists in permissions.commands.
  • $OSCAR_HOME/plugins/.installed.json records the source, its kind, the commit (git), the version, a SHA-256 hash of the content and when it was installed and updated; oscar plugins info shows it and says whether the files were edited since.

oscar plugins update [name] fetches again from the recorded source. A new version that asks for more (a wider files, a new program, hook event, secret or host) needs your yes again, with the additions listed; --check only reports. A copy you edited is replaced only with --force.

oscar plugins remove <name> deletes the folder, its record and its settings.

Finding plugins: catalogs

A catalog is a JSON index someone publishes, listing plugins and where to install them from. Name one or more with plugin_catalog (comma-separated https:// URLs, or files on this machine):

shell
oscar config set plugin_catalog https://plugins.example.org/index.json
oscar plugins search words          # name, description or tags with every word
oscar plugins browse                # everything the catalogs list
oscar plugins outdated              # installed plugins a catalog has newer

An index looks like this:

json
{"plugins": [
  {"name": "word-tools", "version": "1.2.0",
   "description": "Count the words of workspace files.",
   "source": "https://git.example.org/me/word-tools.git",
   "homepage": "https://example.org/word-tools", "tags": ["text"],
   "min_oscar": "0.0.1"}
]}

A catalog only points: installing from it is oscar plugins install <source> with every check above, the same scan and the same yes. An entry whose source is not a remote URL (git or https) is left out (an index can never point into your machine), and so are malformed entries; the first catalog wins a name two list. What was fetched is cached in $OSCAR_HOME/cache/plugin-catalog.json for six hours (--refresh fetches again). oscar plugins outdated compares versions and says when the catalog's source is not the one a plugin was installed from; oscar plugins update <name> installs the newer version from the recorded source. oscar doctor mentions available updates from the cached catalog, without going to the network.

On and off

A plugin contributes nothing until it is enabled. Installing enables it (that is what your yes was for); a folder you put into plugins/ by hand is found but stays off until oscar plugins enable <name>, which shows its permissions and scan first. oscar plugins disable <name> turns one off and keeps its settings.

Enabling accepts the permissions exactly as declared. If they change later (an update, or someone edits plugin.toml), the plugin stops — oscar plugins list says "stopped: permissions changed" — until you enable it again and see what changed.

oscar plugins list, oscar plugins info <name> and oscar doctor show every plugin, its state, and anything that keeps part of it from loading: a tool whose name or capabilities break the rules, a broken skill, a missing hook program, an alias that would replace one of Oscar's commands, an MCP server whose secret is not set, a plugin that needs a newer Oscar.

New conversations pick up a newly enabled plugin. Restart a running gateway or dashboard to be sure all of it is loaded.

Permissions

toml
[permissions]
files = "read"                        # none (default) | read | write
network = ["api.example.org"]         # false (default) | true | host names
commands = ["hooks/notify.sh", "bin/notes-server"]
hooks = ["turn_end", "before_tool"]
secrets = ["NOTES_API_TOKEN"]
dashboard = true                      # static pages in the web dashboard
Permission What it means What Oscar enforces
files how far the plugin's Lua tools reach in the workspace the sandbox gives a tool fs.read only with read or write, fs.write only with write; a tool asking for more is not loaded. Tools that write ask for approval on every call, like your own
network that its programs or remote servers use the network Lua tools have no network at all. A remote MCP server must be https:// on a listed host (or true). Programs a plugin runs are not network-confined in host mode: this line is what you agree to
commands the programs it runs: paths inside the plugin, or program names on PATH a hook or MCP server whose program is not listed is refused when the manifest is read
hooks the hook events it watches or guards a hook on an event not listed is refused
secrets names from your environment / credentials.env its MCP servers receive only these ${NAME} references are resolved; a server whose secret is not set is left out with a note in oscar doctor
dashboard that it adds pages to the web dashboard a [[pages]] table without it is refused; its pages are served sandboxed (below)

A plugin's MCP servers are untrusted: a call to one of their tools that is not marked read-only asks a human every time, even in auto mode, and no rule or session grant covers it. To trust one, add a server of the same name to your own mcp.json (oscar mcp add … --trust trusted); yours wins.

Programs from plugins run like your own hooks: on the host as you, in the workspace, with a cleared environment (no keys unless a secret is declared and given to an MCP server), a timeout and capped output. That is outside the workspace sandbox, which is why every program is listed and shown before you agree.

Naming rules

  • A plugin's name is 1 to 32 of a-z, 0-9 and single -, and its folder has the same name.
  • Its Lua tools are named plugin_<name>_… (dashes become underscores), or <namespace>_… when the manifest declares a namespace (2–16 letters and digits; names that read like Oscar's own tools — bash, web, mcp, memory, browser, … — are reserved, as is a namespace another plugin already took). A name that is already a tool (a built-in, one of your own Lua tools, another plugin's) is refused, never shadowed.
  • Its MCP servers are named plugin-<name>-<server>, so their tools are mcp_plugin-<name>-<server>_…; a server of the same name in your mcp.json wins. Every MCP tool asks before each call.
  • Its skills are read-only and rank below the bundled skills and yours: a skill of the same name elsewhere wins. oscar skills list tags them [plugin <name>, read-only]. In host mode their folders are readable by tools, like other skill folders, so skills can run their scripts in place.
  • Its slash commands never replace one of Oscar's; the first plugin (by name) wins a command two plugins declare.

Writing a plugin

text
word-tools/
├── plugin.toml
├── tools/count.lua          # Lua tools, one per file
├── skills/word-counting/SKILL.md
├── hooks/log-turn.sh        # a program a hook runs
├── bin/report               # a program an exec command runs
└── dashboard/               # static pages for the dashboard
    ├── index.html
    └── app.js

plugin.toml:

toml
name = "word-tools"
version = "1.0.0"                 # x.y.z
description = "Count the words, lines and characters of workspace files."
author = "Your Name"              # optional
license = "MIT"                   # optional
homepage = "https://example.org"  # optional
min_oscar = "0.0.1"               # optional: refused by older Oscar
namespace = "words"               # optional: tools may be named words_…

[permissions]
files = "read"
commands = ["hooks/log-turn.sh", "bin/report"]
hooks = ["turn_end"]
dashboard = true

[[hooks]]                         # like [[hooks]] in config.toml
event = "turn_end"                # any event of hooks.md: turn_end, before_tool, pre_llm_call, …
command = "hooks/log-turn.sh"     # one of permissions.commands
args = []                         # optional
tools = []                        # tool events: which tools (a trailing * matches a prefix)
timeout = 5                       # seconds, 1-600 (default 10)
on_error = "continue"             # before_tool / pre_llm_call: "block" when the hook itself fails

[[mcp]]                           # a local server (stdio)
name = "notes"                    # becomes plugin-word-tools-notes
command = "bin/notes-server"      # one of permissions.commands
args = []
env = { NOTES_TOKEN = "${NOTES_API_TOKEN}", MODE = "plain" }

[[mcp]]                           # or a remote one
name = "remote"
url = "https://api.example.org/mcp"           # https, a host in permissions.network
headers = { Authorization = "Bearer ${NOTES_API_TOKEN}" }

[[commands]]                      # a slash-command alias
name = "wc"
description = "Count the words of a workspace file"
prompt = "Use the words_count tool on {args} and give me the counts in one short line."

[[commands]]                      # a command that runs a program
name = "report"
description = "This week's word report"
type = "exec"
command = "bin/report"            # one of permissions.commands
args = ["--week", "{args}"]       # {args}: what was typed after /report, as one argument
timeout = 30                      # seconds, 1-600 (default 60)

[[pages]]                         # a page in the dashboard (needs permissions.dashboard)
title = "Words"
file = "index.html"               # in the plugin's dashboard/ folder

[config]                          # the plugin's own settings and their defaults
top = 5

Unknown keys are errors (a newer Oscar may know them). Secrets never go in the manifest: a value that looks like a key is refused; reference it as ${NAME} and list NAME in permissions.secrets.

Lua tools are written exactly like your own, with two additions: the name follows the rules above, and oscar.config holds the plugin's settings (strings) — the manifest's defaults, overridden by oscar plugins config <plugin> <key> <value>. Their descriptions start with (plugin <name>) so the model and you can see where they come from.

Hooks and MCP servers get OSCAR_PLUGIN (its name), OSCAR_PLUGIN_DIR (its folder) and OSCAR_PLUGIN_CONFIG (its settings as JSON) in their environment, besides what hooks get. A hook's output follows the hook rules: a before_tool hook may block a call the approval gate already cleared, never approve one.

Aliases: /wc notes.txt in a chat sends the prompt with {args} replaced by notes.txt (without {args}, the words follow the prompt after a blank line). Aliases work in the full-screen chat, the line chat and the dashboard's chat, and /help lists them.

Exec commands (type = "exec"): /report spring runs the declared program with its declared arguments, {args} replaced by spring as one argument (never split, never given to a shell). It goes through the approval gate like any tool call (plugin_command, showing the plugin and the exact command line): asked in ask mode, approved and audited in auto mode, judged in smart mode, refused in never mode; your allow and deny rules apply. It then runs like the plugin's hooks: on the host as you, in the workspace, with a cleared environment (plus OSCAR_PLUGIN, OSCAR_PLUGIN_DIR, OSCAR_PLUGIN_CONFIG), its timeout, and at most 16 KiB of output shown (masked). Exec commands work in the full-screen chat, the line chat and the dashboard's chat; the chat gateways do not run plugin commands.

Dashboard pages ([[pages]], with permissions.dashboard = true): the Plugins page of the web dashboard links to them. They are plain files from the plugin's dashboard/ folder — HTML, JavaScript, CSS, JSON, images, fonts; at most 2 MiB each; no hidden files, nothing reached through a link that leaves the folder — served under /plugins/<name>/<key>/… with the dashboard's Content-Security-Policy (scripts and styles from files only, no inline code) plus sandbox allow-scripts. That puts each page in an origin of its own: its scripts run, but it cannot use your sign-in, read the dashboard's API, change anything or answer an approval. The <key> is random at every dashboard start and handed only to signed-in pages; a page refers to its own files with relative links (<script src="app.js">).

Skills go in skills/<name>/SKILL.md, as described in skills-and-learning.

A plugin cannot change Oscar's own settings (approve, sandbox, the provider…); its [config] is its own.

The example

examples/plugins/word-tools in Oscar's source is a complete small plugin: a Lua tool words_count (reads a workspace file, counts words, lines and characters, and lists the most frequent words — how many is the top setting), a skill that tells the model when to use it, a turn_end hook that appends a line to ~/.local/state/oscar-word-tools/turns.log, and the alias /wc <file>.

shell
oscar plugins install examples/plugins/word-tools
oscar plugins info word-tools
oscar plugins config word-tools top 3
oscar run "how many words are in README.md?"