Skip to content

Plugins

xmsadik edited this page Nov 29, 2026 · 2 revisions

Plugins

A plugin is a tool you add yourself. It is one TypeScript file that calls defineTool, placed in the tools/ folder of the configuration folder. Kit loads it, runs it in a sandbox, and lists it with the built-in tools in the palette, the sidebar and the CLI.

You can write a plugin yourself, or install a ready-made one from the signed kit-tools repository with kit add.

The sandbox

Plugins never run in Kit's own process space. Each plugin gets its own QuickJS sandbox with:

  • no network, no file system and no DOM access,
  • a CPU budget of 50 ms per call,
  • a memory cap of 32 MB.

Types are stripped from the TypeScript file; it is not bundled or type-checked. A plugin file may import only defineTool and fail from @kotilo/kit-core; any other import is refused. Each file may contain exactly one defineTool call.

If a plugin goes over the CPU budget, Kit stops it and shows "The plugin used more than 50 ms of CPU and was stopped". If it reaches the memory cap you see "The plugin hit the 32 MB memory limit and was stopped".

Install a plugin from kit-tools

Installing is the only time Kit goes online, and it asks every time. There is no "do not ask again".

In the app

  1. Open Settings › Plugins.

  2. Click Add from kit-tools….

  3. Type the plugin's name. A dialog titled "Install a plugin from kit-tools" shows exactly what will happen:

    The kit-tools install dialog listing what Kit connects to, downloads, sends and how it verifies the file.

    Row Meaning
    Plugin The name you typed (a to z, 0 to 9 and hyphen).
    Connects to kotilo.dev/kit-tools.
    Downloads index.json, index.json.sig and tools/<name>.ts.
    Sends "Only the file requests. No clipboard, settings or usage data."
    Verification "The ed25519 signature is checked against the key built into Kit. If it does not match, nothing is installed."
  4. Click Connect and install, or Cancel (Esc) to stop with nothing downloaded.

When it finishes, Kit says " installed from kit-tools." For an update it says " updated to ."

In a terminal

kotilo kit add slug

With the single-file CLI that is node kotilo-kit-cli-v1.1.3.cjs add slug. Kit prints what it will connect to, then asks "Connect and install? [y/N]". Type y or yes to continue; anything else cancels with "Cancelled. Nothing was downloaded."

Flag Meaning
--yes Approves this one install without asking. Needed in scripts. Without a terminal and without --yes, Kit refuses: "kit add asks before going online. Run it in a terminal, or add --yes to approve this one install."
--force Overwrites a local file of the same name that was not installed from kit-tools.

Results you may see:

  • "Installed → "
  • "Updated → ()"
  • " is already installed."

How the download is checked

  1. Kit downloads index.json and index.json.sig from https://kotilo.dev/kit-tools/.
  2. It verifies the ed25519 signature of index.json against the public key built into the app.
  3. index.json pins each tool's version and sha256. Kit downloads tools/<name>.ts and checks that its sha256 matches.
  4. Only if every step passes, the file is written to tools/ and the version and hash are recorded in config.toml.

If any step fails, nothing is written. Kit sends no clipboard, settings or usage data, follows no redirects and sends no cookies. See Privacy and Security.

Plugins installed this way show a "kit-tools · signature verified" badge in Settings. If you later edit the file, the hash no longer matches and the badge becomes "local file".

Manage plugins in Settings

Settings › Plugins lists every file in tools/ with a summary such as "2 enabled · 1 failed". Each plugin card shows its name, id and version, its description, where it came from ("kit-tools · signature verified" or "local file"), and:

  • Enabled checkbox: turns the plugin off without deleting the file.
  • Remove: deletes the file. A notice " removed." has an Undo link.
  • Reload: shown for a plugin that failed to load, to try again after you fix the file.

The header has Open folder and Add from kit-tools…. See Settings.

Settings, Plugins: the sandbox notice, the folder path and the list of plugins with their source badge and Enabled checkbox.

With no plugins, the page says "No plugins yet. Put a .ts file that calls defineTool into the folder."

Write a plugin

Create a .ts file in <config>/tools/. This example adds a ROT13 tool.

import { defineTool } from '@kotilo/kit-core';

export default defineTool<{ mode: 'encode' | 'decode' }>({
  id: 'rot13',
  category: 'encoding',
  name: { en: 'ROT13', tr: 'ROT13' },
  description: { en: 'Rotate letters by 13', tr: 'Harfleri 13 kaydır' },
  detect: () => 0,
  options: [{ key: 'mode', type: 'segmented', values: ['encode', 'decode'], default: 'encode', hotkey: 'm' }],
  run: (input) => ({ output: input.replace(/[a-z]/gi, (c) => /* … */ c) }),
  examples: [{ input: 'abc', output: 'nop' }],
});

Points to know:

  • id must be unique. If it matches a built-in tool, a pipeline or another plugin, the plugin is not loaded ("The id “…” is already taken by another tool or pipeline"). Use lowercase letters, digits and hyphens.
  • category is one of encoding, format, text, time, generate, web, visual.
  • run is a pure function from the input text and the option values to a result. Use the context passed to it for the clock, time zone and randomness (ctx.now, ctx.tz, ctx.random) instead of Date.now() or Math.random().
  • options describe the UI; plugins never contain HTML or React. Option types include segmented, select, toggle, number and text. A hotkey letter lets people change the option with Alt+letter.
  • detect returns a score from 0 to 1 for how well an input fits the tool. Return 0 if the plugin should never be suggested. Each call has a budget of 5 ms.
  • messages (optional) adds translated labels and error texts: defineTool({ messages: { en: {…}, tr: {…} } }). Keys must start with tool.<id>. or error.<id>..
  • Use fail('code', params) to report an error to the user.
  • Intl objects are not available in the sandbox, but toLocaleLowerCase, toLocaleUpperCase and localeCompare are bridged, so Turkish İ and ı work.

Keep the file self-contained: apart from defineTool and fail, nothing can be imported.

Loading errors

Kit reports a plugin that fails to load in Settings › Plugins ("Could not load: …") and, in the CLI, on the error output of kotilo kit list ("Skipped plugin : …"). The reasons:

Message Meaning
Syntax error: … The TypeScript could not be read. The line and column are shown when known.
Error while loading: … The file threw an error when it ran.
Only defineTool and fail can be imported from @kotilo/kit-core (found “…”) Remove the other import.
The file has no defineTool call Add exactly one.
One tool per file: defineTool was called N times Split the file.
The defineTool call is missing “…” A required field such as id or run is absent.
Invalid defineTool call: … A field has the wrong shape.
The id “…” is already taken by another tool or pipeline Rename the id.

Related pages

Clone this wiki locally