Skip to content
Back to skills

Rule Plugins

ASecurity

Custom plugins — the plugin file, approval by exact copy, the folder rule, the command runner, buttons, save_plugin and the chat block. A repository rule for apps/daemon/src/v1/plugins/**, apps/daemon/src/v1/mcp/tools/save-plugin/**, apps/daemon/src/v1/agents/**/plugin-proposal*, apps/daemon/src/v1/agents/**/host-plugin*, apps/ui/src/renderer/chats/plugin-*, apps/ui/src/renderer/settings/plugins-*; read it before editing a file there.

  • 8 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 26, 2026
ai-agentsgoshellsqlawsgitapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add geniro-io/geniro-app --skill rule-plugins --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rule Plugins?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rule Plugins
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/geniro-io-rule-plugins/badge)](https://www.skillsdirectory.com/skills/geniro-io-rule-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rule-plugins
description: "Custom plugins — the plugin file, approval by exact copy, the folder rule, the command runner, buttons, save_plugin and the chat block. A repository rule for apps/daemon/src/v1/plugins/**, apps/daemon/src/v1/mcp/tools/save-plugin/**, apps/daemon/src/v1/agents/**/plugin-proposal*, apps/daemon/src/v1/agents/**/host-plugin*, apps/ui/src/renderer/chats/plugin-*, apps/ui/src/renderer/settings/plugins-*; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/plugins.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->

# Plugins

A Geniro Plugin is a block in the chat's right panel, in its Plugins tab: one shell command and a view of its JSON result. `v1/plugins` owns the files, approvals, runs and routes; `save_plugin` is how an agent proposes one. No plugin code runs in the renderer.

## The file

- `<userData>/plugins/<slug>.plugin.yaml`, slug lowercase only (`^[a-z0-9][a-z0-9-_]*$`). `.backups/` keeps the newest 20 copies per slug. Never SQLite, never settings.json; the storage group is `plugins`.
- Fields: `name` (1–80 chars, one line); `enabled` (true); `folders` (absolute, `~` expanded at read; empty or absent = every folder); `refresh_minutes` (1–1440, default 5); `command` (one line, ≤ 4000 chars, no line break, no control, invisible or bidi character); `timeout_seconds` (1–120, default 30); `view` (A2UI components, one with id `root`, bound to `{"data": <parsed stdout>}` through `{"@path": "/data/…"}`); `buttons` (≤ 10: `id`, `command`, `confirm` (false), `timeout_minutes` (1–60, default 10), `env` mapping `PLUGIN_*` names to JSON pointers into the data).
- The view is validated as an A2UI surface (`readA2uiMessages`) plus plugin rules: a Button names a declared button; a Button's functionCall is only `openUrl`; input components (TextField, CheckBox, ChoicePicker, Slider, DateTimeInput) and Modal are refused. Every refusal names a pointer and a reason.
- A write keeps the user's comments, as team YAML does.

## Approval

- A plugin is `approved` only when its text equals `<userData>/plugins/.approved/<slug>.plugin.yaml`; `unapproved` when there is no approved copy (a file never approved), `changed` when the approved copy differs (a hand edit). Nothing of an unapproved or changed plugin runs.
- A write the user makes by a press (Approve, the Settings switch, folders) goes file first, approved copy last, each atomically (temp file + rename). A crash between them leaves the plugin `unapproved` or `changed`, never approved by accident.
- A run reads the file once, compares that text with the approved copy and runs the command parsed from the same text.
- The user's own edit (`PUT /v1/plugins/:slug/file`, `{text, baseHash}`, the file editor) writes the file only, through the store's one write path: `PLUGIN_NOT_FOUND` for a plugin with no file (it never creates one), `PLUGIN_CHANGED` (409) once the file moved on from the hash the editor opened, `PLUGIN_INVALID` (400, pointer and reason) for text that does not read as a plugin, and nothing written in any of them. It never writes the approved copy (user decision): a saved text that differs from it leaves the plugin `changed` until it is reviewed. Open to a paired device, as approving is.
- No file watcher. Hand edits are found by comparing on every read (list, for-run, run, press).
- Approve answers `PLUGIN_CHANGED` (409) when the text has moved on from the hash the user read.

## Folders

- A run matches a plugin when one of its candidates lies inside one of the plugin's folders. Candidates: the run's folder (`Run.cwd`) and its root (`ProjectRootsService.rootsOf`) — a board card's worktree maps to its card's folder (else its project's), another git worktree to its main repository.
- Plugin folders are canonicalized (realpath) at read. Both sides compare case-insensitively, segment by segment (`isWithinDirectory`).
- Empty `folders` = everywhere. A run with no folder gets no blocks; a run whose candidates match none is refused `PLUGIN_FOLDER_MISMATCH`.

## Runner

- Runs `["/bin/sh", "-c", command]` through `runManagedCommand` in the folder, with the plugin's timeout, 1 MiB output kept from the head, `endGroupOnExit`, `buildChildEnv` inside the runner and ProcessRegistry label `plugin:<slug>`. No run-tag env: a plugin's command is not the run's work.
- Single flight per (slug, folder): a second caller joins the first run.
- The last result per (slug, folder), `{at, data, error, exitCode, stderrTail}`, lives in memory only and is lost on restart.
- `force` is the user's own ask — ↻ and Try again (user decision): it always runs, never answered from the cache, and joins a run already in flight instead of starting a second.
- Without `force` (the block's open and its timer), the cached result answers while it is fresh: younger than `refresh_minutes`, never under a minute (`PLUGIN_MIN_REFRESH_MS`), counted from when its run STARTED, less `PLUGIN_REFRESH_SLACK_MS` so a tick that arrives on the minute still runs. Counting from `at` (when the command ended) let a 1-minute timer run every 2 minutes.
- The refresh right after a button press skips the cache and waits for a run already in flight, then runs again.
- stdout must parse as JSON; otherwise the result's `error` says so, with the first 2 KB. A failed run is a result with `data: null` and its `error`, never a thrown error. stderr and error text pass `redactSecrets` and are cut to 4 KB.
- Checks at run and press, in order: folder, approval (`PLUGIN_NOT_APPROVED`), `PLUGIN_DISABLED`.

## Buttons

- A press sends `{runId, dataAt}`. Env values are read by the daemon from its own cached result, never from the client; a pointer the data lacks refuses `PLUGIN_NO_DATA`. Values are stringified, ≤ 1024 chars, no NUL (`PLUGIN_VALUE_TOO_LONG`).
- Env names match `^PLUGIN_[A-Z0-9_]{1,57}$` only: `buildChildEnv` merges extra keys last, so any other name would let the data pick what runs.
- `dataAt` is when the user read the data. A cache that has moved on, or that an earlier text of the file produced, refuses `PLUGIN_DATA_CHANGED` (409); the block refreshes and the user presses again.
- One press at a time per (slug, button, folder); a second is `PLUGIN_BUSY`. Label `plugin-button:<slug>:<id>`, `endGroupOnExit`, the button's `timeout_minutes`, output tail masked, then cut as command actions are (`maskedTail`, shared with them). `plugin-button:` counts as work; data runs do not. After a press the data command runs again, skipping the cache.
- Confirmation is the renderer's (`confirm-dialog`). The daemon runs a press it is sent.

## Routes and events

- All token-gated with no `DesktopOnlyGuard`: a paired device may refresh, press, approve, re-folder and delete (user decisions 10 and 10.1). Only Show file in Finder stays desktop-only.
- `controllers/plugins.controller.ts`; `GET /v1/plugins/for-run/:runId` is declared before `:slug`. `POST :slug/run` runs in a thread's folder; there is no run in a folder picked outside a chat (user decision 2026-12-01: a block runs in the chats of its folders, nowhere else). A route change means `pnpm generate:api` with the regenerated client committed.
- `plugins_changed {slug | null}` goes out after every store write geniro makes.

## save_plugin

- `HOST_PLUGIN_TOOL = 'save_plugin'` (`agents/chat.types.ts`), module `mcp/tools/save-plugin/`. Arguments: `{slug?, name, folders?, refresh_minutes?, timeout_seconds?, command, view, buttons?, sample?}`. A refusal answers `INVALID_ARGS: <pointer>: <reason>` and parks nothing.
- Every valid call parks a card (`PluginProposalBroker`, `parkWriteCard`) in every approval mode; a team lead's card is the run's one standing lead card (`Run.pendingTeamProjectCard`, kind `plugin`), shared with `save_project_instructions`. Only Approve writes, file then approved copy; Reject tells the agent nothing was saved. The receipt names the slug and the file's path.
- `folders` absent = the chat's folder. A `slug` naming an existing plugin is an update: what the call leaves out (folders, buttons, timings) is kept, the card shows a diff, and the write quotes the hash it was read at.
- `sample` is output the agent got by running the command itself; the card previews from it. The daemon never runs an unapproved command to make a preview.
- Offered to a chat and to a team's lead in its own conversation. A CLI that cannot hold a tool call open (`hostQuestionDeferredReason`) gets a deferred card that survives a restart, as project instructions do.
- `v1/plugins` imports `v1/agents`, so `v1/agents` never imports `v1/plugins`: the store writer reaches the agent side through a seam the plugins module provides.
- The tool's instructions say to create or change plugins only through `save_plugin`, never by writing files, and to set `confirm: true` on every button that deploys, deletes or writes. An agent deletes a plugin only through `delete_plugin`, a resource card whose press runs `PluginsService.delete` (`.claude/rules/mcp-tools.md` → `ResourceCardTool`).

## Renderer

- `chats/plugin-blocks.tsx`, `chats/use-plugin-blocks.ts`, `chats/plugin-surface.ts`, `chats/plugin-file-dialog.tsx`. `Chats.tsx` reads for-run on open, on `plugins_changed` and after a reconnect; the thread inspector's Plugins tab shows one section per plugin, folded per thread (user decision 2026-12-02: the blocks left the Agents tab). With no block the tab is left out; a thread remembered on it then shows Agents. The tab carries how many blocks there are. Its title says how many wait for review or failed (`pluginNeedOf`: an invalid file, a failed request or an errored result is failed; any other unapproved state waits for review); the state glyph shows only while one waits for review. A failure is said in the title and drawn in its own block.
- A block draws only through `SurfaceBody`, over a `SurfaceDto` that `plugin-surface.ts` fills in full; its press maps a Button event to the plugin's button. A link opens only when its resolved URL is http(s).
- The timer runs only while the section is open, the inspector open (on any tab: the Plugins tab stays mounted, hidden, behind the others) and the document visible, every `refresh_minutes`. The data and its time come from the daemon's result, so a remount loses nothing.
- Header: fold chevron, name and row count, ↻ (forced), ⋯ with Edit file and Open settings (Settings → Plugins); no Ask (user decision 2026-12-02). The folder chip names the run's repository for a worktree cut from one (`folderName`), the full path on its tooltip.
- Edit file opens `PluginFileDialog`: the file as read from `readPlugin`, edited in a monospace field, Save only once it differs, a discard question before closing with unsaved edits, the daemon's refusal shown under the field with the text kept, a moved file offered Reload. A save that leaves the plugin not approved opens `PluginReviewDialog` next.
- A button with `confirm: true` opens the confirm dialog with its command line, folder and plugin; the others run at once.
- States: loading, error (with Try again), empty, not approved yet ("Plugin not approved yet · not run", Review), file changed (last data dimmed, "Plugin file changed · not run since", Review).
- Review shows the approved text against the current one as a diff; Approve posts `{hash}`.
- Settings → Plugins (`settings/plugins-settings.tsx`): one row per plugin with its folders, last run (a failed one with its error, in the error colour), its buttons with the ones that ask first marked, its switch, Edit file, Edit folders, Show file in Finder (desktop only) and Delete. Edit folders suggests the recent chat folders (`Settings.recentFolders`). An `unapproved` ("Not approved yet") or `changed` ("Changed since you approved it") plugin shows Review… in its row and its menu: the block's own `PluginReviewDialog` and approve, so the same gate holds wherever it is approved.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.