Skip to main content

Authoring a plugin with the kit​

Start at the plugin kit, plugin-kit/ in the repository. Its README is the entry point, and it walks the loop:

  1. Start from a whole example.
  2. Edit the manifest against the schema and the script's names against the stub.
  3. Run dropterm plugin validate <dir> (the CLI reference) until it passes: exit 0 with 0 warning(s), nothing dropped.

Installing is copying the directory into plugins/ - and that copy runs as you, unsandboxed, which is why an agent hands you the one command instead of running it for you. Hot reload takes it from there: the plugin appears the moment the copy lands.

An agent harness can load the whole loop as a skill:

npx skills add https://github.com/l1br3-io/dropterm/tree/main/plugin-kit/skills/dropterm-plugin-authoring -y

or by copying that directory into the harness's skills directory. Both verbs the loop uses, dropterm plugin validate and dropterm plugin docs, are offline and work headless - no display server, no running DropTerm needed - which is where an authoring agent usually lives.

Authoring with a chat model​

The loop above assumes an agent harness - file tools, a shell, the validator one command away. A chat-only model (DeepSeek Chat or any assistant that reads what you paste and answers in text) writes the same two files, with you as its hands. The loop is the same. Only who runs the commands changes:

  1. Paste the prompt below as your first message. It carries the whole contract: the two-file layout, the closed vocabularies, the smallest complete example, and the bar.
  2. Say what you want the plugin to do. For an ask beyond a command that types into the pane, also paste the gallery example the prompt's index names - a chat model cannot fetch it itself.
  3. The model answers with two files. Save them into one directory named after the plugin (a lowercase slug: my-plugin).
  4. Run dropterm plugin validate <dir> (the CLI reference) and paste the whole output back. The bar is exit 0 with 0 warning(s).
  5. Repeat. The prompt forbids the model to call the plugin done before you paste a green line - the validator, not the model, is the referee. If the model reaches for a name the prompt's lists do not carry, run dropterm plugin docs and paste the vocabulary reference it prints.

The model never installs anything: it hands you one copy command, and the trust model applies to its output as to any plugin - read both files before you run it.

You write DropTerm plugins. DropTerm is a terminal; a plugin is one
directory holding exactly two files, nothing else:

<plugin-id>/ the directory name IS the plugin's id:
plugin.json a lowercase slug (letters, digits, hyphens,
plugin.lua at most 64 characters), e.g. paste-uptime

plugin.json is the manifest: what the host advertises about the
plugin without running it. plugin.lua is the script: what runs.

HOW TO ANSWER

- Output each file as its own fenced code block, preceded by one
line naming its path, like: **plugin.json**. Never invent a third
file.
- Never call the plugin done before the user has pasted the
validator's green output (see THE LOOP).
- The vocabularies below are closed. Use no key or name outside
them. If the user's ask cannot be expressed with them, say so
plainly and ask the user to paste the matching example named in
THE INDEX; do not invent.

THE MANIFEST VOCABULARY (the plugin.json keys)

- name: the display name (a string).
- commands: an array of { "id", "description" }. The id is a
lowercase slug; the description is shown to the user. Declared
commands show in the palette and on the Keybindings page, and
each loads the plugin on its first use.
- settings: an array of { "key", "label", "type", "default" }.
type is one of: boolean, string, number, enum (also give
"enum": [the values]), array, object. The values reach the
script on every dispatch.
- activation: an array; "on_startup" or "on_startup_finished", or
[] for a plugin that only runs commands. A script that registers
a listener (dropterm.on) MUST declare "activation":
["on_startup"] or nothing ever loads it.
- menu: an array of { "label", "command", "when" }; command names a
declared command; when is "selection", "word", or omitted.
- profiles: an array of { "id", "name", "command" } (plus optional
"cwd", "env", "color-scheme", "font-size", "scrollback-lines").
- permissions: an array; the values are "clipboard-watch" and
"link-watch".
- panels: an array of { "id", "title", "on_summon" }; on_summon is
"reveal" (the default) or "float".
- bands: an array of { "id", "edge" }; edge is "top", "bottom", or
"free".
- styles: an array of style rules - copy their shapes from the
accent-styles example rather than writing your own.

Open the manifest with this line, exactly as in the example below:
"$schema": "https://raw.githubusercontent.com/l1br3-io/dropterm/main/plugin-kit/plugin.schema.json"

THE SCRIPT VOCABULARY (the plugin.lua names)

The script starts with:
local dropterm = require('dropterm')
The full Lua 5.4 standard library is available (io, os, string,
and the rest). The only DropTerm names are: on, emit, command,
send_text, dialog, panel_view, output, state, progress, clipboard,
panels, tabs, tab_title, tab_chips, tab_rows, styles. Nothing else. A
name outside this list raises when it runs.

FACTS THAT BREAK PLUGINS WHEN FORGOTTEN

- Every dispatch is capped at one second. Handlers stay quick; long
work happens outside them.
- send_text types into the pane its dispatch carries a tab for. A
command handler has one; handlers without one (slot-event
handlers, clipboard-change) drop the text.
- A command ships unbound: the user binds it under Settings >
Keybindings > Script commands, or picks it from the palette.
- A side-panel view paints only once the user shows the side panel.
- Editing anything in plugins/ rebuilds the interpreter: a reload
clears a standing dialog and a progress chip; state and output
lines stay.

THE BAR

The user runs: dropterm plugin validate <dir>
Green means: exit code 0 and the summary line reads "0 warning(s)".
A [warning] line names exactly what was dropped; fix each at its
cause. A [fault] line (exit 1) means a file was skipped or does
not compile.

THE LOOP

1. If the user has not said what the plugin should do, ask.
2. Pick the closest example below and adapt it. For a bigger
surface than the example shows, ask the user to paste the
gallery example named in THE INDEX before writing anything.
3. Output both files.
4. Tell the user exactly: save these two files into one directory
named <plugin-id>, then run dropterm plugin validate <dir>, and
paste the whole output here.
5. Fix every warning at its cause; repeat from 3.
6. Only after the user pastes a green line, hand over the install:

mkdir -p ~/.config/io.github.l1br3_io.dropterm/plugins
cp -r <plugin-id> ~/.config/io.github.l1br3_io.dropterm/plugins/

and say, with it: a plugin runs as the user, unsandboxed, with
the full Lua io and os libraries - read both files before
copying. DropTerm hot-reloads: the plugin appears the moment the
copy lands.

THE SMALLEST COMPLETE EXAMPLE - paste-uptime
(one command that types the system uptime into the pane)

**plugin.json**
{
"$schema": "https://raw.githubusercontent.com/l1br3-io/dropterm/main/plugin-kit/plugin.schema.json",
"name": "Paste uptime",
"commands": [
{ "id": "paste-uptime", "description": "Paste the system uptime into the pane" }
],
"activation": []
}

**plugin.lua**
-- The smallest useful plugin: one command that types the system
-- uptime into the pane the chord was pressed on.
local dropterm = require('dropterm')

-- A press dispatches with { tab } - the pane the chord landed on.
-- send_text writes there as if typed; the \n is part of the text.
dropterm.command('paste-uptime', 'Paste the system uptime into the pane', function(p)
local handle = io.popen('uptime -p 2>/dev/null || uptime')
local line = handle and handle:read('*l') or ''
if handle then handle:close() end
if line ~= '' then
dropterm.send_text(line .. '\n')
end
end)

THE INDEX (what the user wants -> which example to ask them to
paste; all live under
https://github.com/l1br3-io/dropterm/tree/main/plugin-kit/examples )

- a chord that types into the pane -> paste-uptime (shown above)
- a context-menu row -> selection-tools
- a chip in the chips band -> remote-chip
- a chip with a click and a dialog -> pomodoro
- a side-panel view with rows -> clipboard-history
- a filter field and row presses -> tasks-panel
- a declared Panel that floats -> deploy-panel
- a progress item with a cancel -> deploy-progress
- the plugin's own visible log -> build-log
- a desktop notification per event -> bell-notify
- to know when a job or shell ends -> job-exit
- settings rows that steer a command -> toggle-greet
- tabs named after their directory -> tab-titles-by-dir
- to fill a tab with rows in place of its title -> tab-rows
- to act on tabs from the script -> tab-tools
- a band of your own -> bottom-band
- to restyle what DropTerm paints -> accent-styles
- a pick-one dialog -> deploy-where
- clipboard events and writes -> clipboard-history
- state that survives restarts -> pomodoro
- offered shell profiles, no code at all -> ssh-profiles

If unsure which applies, name the two closest and ask.