From 7eb64309fbafccc2b0f71ee5a5700c1023818d22 Mon Sep 17 00:00:00 2001 From: omartelo Date: Fri, 13 Nov 2026 21:31:17 -0300 Subject: [PATCH 1/3] feat(skills): add the manual-only extension skill --- skills/extension/SKILL.md | 235 ++++++++++++++++++++++++++++ skills/extension/agents/openai.yaml | 2 + 2 files changed, 237 insertions(+) create mode 100644 skills/extension/SKILL.md create mode 100644 skills/extension/agents/openai.yaml diff --git a/skills/extension/SKILL.md b/skills/extension/SKILL.md new file mode 100644 index 0000000..292747d --- /dev/null +++ b/skills/extension/SKILL.md @@ -0,0 +1,235 @@ +--- +name: extension +description: Write, develop and publish a lich extension, a separate Go program that draws its own screens in lich's window. Run it by hand when you want to start an extension from the template, shape its manifest, permissions and translations, try it in place, tag a release, or list it in the catalog. +disable-model-invocation: true +user-invocable: true +--- + +# lich extensions + +An extension is a compiled Go program that lich starts with its backend and talks +to over JSON lines on stdin and stdout. It sends a tree of components for a +surface (a screen in the window) and lich draws it with its own UI kit. lich +never clones or builds source: what it runs is a release archive. + +The contract is `docs/extensions.md` in the lich repository, and it is the source +of truth for everything below: + + +Read it before answering a question this file only points at, and never type a +component, a method or a limit from memory. This skill is the order of the work +and the traps; the tables stay in that file. + +## Ask this first: new extension, or an existing one? + +**Ask the user which one they are doing** unless they already said. A new one +starts at "Start from the template". An existing one starts at whichever step +they are stuck on, and the checklist at the end says what is still open. + +## Start from the template + +Work in the user's own directory, not in the lich checkout. The template +repository carries a manifest, a Go module and a release workflow that already +builds the archives lich installs: + +```bash +gh repo create --template lichdotdev/extension-template --public --clone +cd +``` + +`` is the repository, and the extension's `id` is a separate choice, set in +the manifest. Keep them equal unless there is a reason not to: the release +archive is named after the `id`. + +Without `gh`, use the repository's **Use this template** button on GitHub, or +clone it and drop `.git`. + +## The manifest + +`manifest.json` at the root. A first one: + +```json +{ + "formatVersion": 1, + "id": "hello", + "name": "Hello", + "description": "Says hello from a screen in lich.", + "version": "0.1.0", + "executable": "hello", + "surfaces": [{ "id": "main", "title": "Hello", "icon": "hand" }], + "permissions": [] +} +``` + +The rules that fail an install: + +- `id` is lowercase letters, digits, dots, underscores or dashes, starts with a + letter or digit, at most 64 long, and **equals the directory name**. +- `executable` resolves inside the directory to a regular file, symlinks + included. On Windows it names the `.exe`. +- `version` is `MAJOR.MINOR.PATCH`. +- `description` is one line of at most 160 characters saying what the extension + does for the person using it. lich runs one without it; the catalog does not + list it. +- A surface's `place` is none (a full screen from the top bar), `dock` or + `panel`. Set `minLichVersion` when the extension needs something only a recent + lich has. +- A name in `permissions` this lich does not know makes the manifest invalid. + +An extension that fails the checks is listed with its error and never started. +Surface fields, `iconFile` and the rest: the manifest section of the docs. + +## The Go SDK + +Import `github.com/lichdotdev/lich/extension` rather than writing the JSON by +hand. The SDK has the component builders, the message types and `extension.Conn`, +the loop that correlates call ids and hands every other message from lich over +`Messages()`. Exit when `Messages()` closes: lich closed stdin and kills the +process 3 seconds later. + +Three things to get right from the first commit: + +- Stdout is the protocol. A stray `fmt.Println` corrupts it; log to stderr, which + lich writes to its own log. +- A call is refused unless the manifest lists the permission its method names. + List exactly what the extension uses, no more: the install confirmation shows + the person one line per permission, and `sessions:write` is set apart there. +- Any exit lich did not ask for is a crash, exit 0 included. + +The permission table, every method and the limits lich enforces are in the docs +under Calling lich and What lich enforces. + +## Keeping data + +Anything the extension saves goes in the directory named by +`LICH_EXTENSION_DATA` (`extension.DataDirEnv`), never next to the executable: an +update replaces the extension's own directory whole. The data directory survives +updates and a remove, so the next version of the same id finds what the last one +saved. + +## Translating + +Ship catalogs beside the manifest, in the format lich uses for its own screens: +`locales//.json`. Write `en` first and every other language from +it. lich reads the name and each surface's title from the `extension` namespace +(`manifest.name`, `manifest.description`, `manifest.surfaces..title`), and +tells the extension the interface language through `LICH_LANGUAGE` and the +`language` message. Everything else the extension draws, it looks up itself with +`github.com/lichdotdev/lich/extension/i18n`. + +Ask which languages the user wants before writing any. The tags lich ships are in +the docs, under Translating an extension. + +## Developing in place + +Link the working directory into the extensions directory instead of installing +the same code again after every edit. The link's name is the extension's id: + +| OS | Directory | +|---|---| +| Linux | `${XDG_CONFIG_HOME:-$HOME/.config}/lich/extensions/` | +| macOS | `~/Library/Application Support/lich/extensions/` | +| Windows | `%AppData%\lich\extensions\` | + +A lich started with `LICH_DEV` reads `extensions-dev/` in the same place, which is +the one to link into when the user develops against a development build of lich +and the safe one when they would rather not touch the extensions they use. + +```bash +ln -s "$PWD" "${XDG_CONFIG_HOME:-$HOME/.config}/lich/extensions-dev/" +``` + +Build the executable the manifest names, then restart lich: an extension added or +edited by hand is read at startup. Do not write into the extensions directory +any other way, and never into one lich installed (it has a `.lich-source.json`). + +## Check before you ship + +```bash +lich extension check dist/_linux_amd64.tar.gz +lich extension check . +``` + +It runs the install's own checks on an archive or on a folder, installs nothing, +and exits non-zero naming what fails. Run it on **every** archive the release +carries, not only the one for this machine. + +## Release + +lich installs a repository's latest release: the newest one that is neither a +draft nor a pre-release, tagged `MAJOR.MINOR.PATCH` (with or without a leading +`v`). A repository whose tags are not versions is never offered as an update. It +carries: + +- one `__.tar.gz` per platform, holding `manifest.json` and the + executable at its root, no top-level folder, no symlinks; +- `checksums.txt` in the `sha256sum` format. + +The template's workflow builds and uploads both when a tag is pushed. Bump +`version` in the manifest in the same commit as the change, then tag it, and +**ask the user before pushing the tag**: a release is public. + +```bash +git tag -a v0.1.0 -m "v0.1.0" +git push origin v0.1.0 +``` + +An update has to ship the same `id`, and a new permission makes lich ask the +person again, so say so in the release notes when one is added. + +## Listing in the catalog + +The catalog is what the site and lich's Settings show. A repository is listed +when it is public, neither a fork nor archived, its latest release is published as +above, every archive passes `lich extension check`, the manifest sets +`description`, and its `id` is not listed from another repository. An `id` +starting with `lich` is kept for `lichdotdev`. + +What the catalog shows besides the manifest comes from a `listing/` folder at the +root of the repository, read at the commit the release tag points to: + +``` +listing/ + listing.json + cover.png + screenshots/board.png +``` + +```json +{ + "categories": ["issues", "git"], + "cover": "cover.png", + "screenshots": [{ "file": "screenshots/board.png", "alt": "Board with issues grouped by state" }] +} +``` + +`categories` is one or two of `agents`, `git`, `issues`, `notes`, `services`, +`tools`. `cover` and `screenshots` are optional and have size, ratio and count +limits (16:10 images, `alt` required on each screenshot), all in the docs under +What the catalog shows. Without `listing/listing.json` the extension is listed +under `tools`, with no pictures. Tag the release **after** `listing/` is +committed: it is read at the tag. + +Then ask for the listing with one line in a pull request on +`lichdotdev/extensions`: add `"/"` to `extensions.json`. Its checks +run on your latest release and say what fails. A maintainer approves the first +listing; each release after it is picked up within an hour with no person. Open +the pull request only when the user asks. + +The catalog records each version's archive checksums the first time it sees them +and never changes them, so a release is not something to re-upload. Ship a new +version instead. + +## Checklist + +- [ ] The user was asked new or existing, or had already said +- [ ] Working in the user's own directory, not the lich checkout +- [ ] `id` equals the directory name, `version` is `MAJOR.MINOR.PATCH`, + `description` is one line of at most 160 characters +- [ ] `permissions` lists what the extension calls, and nothing it does not +- [ ] Nothing but the protocol on stdout; saved data goes in `LICH_EXTENSION_DATA` +- [ ] `locales/en` written first, then each language the user asked for +- [ ] Tried in place through a link, after a restart of lich +- [ ] `lich extension check` passes on every archive +- [ ] `listing/` committed before the tag, when it is going in the catalog +- [ ] Tag pushed only after the user said so; catalog pull request likewise diff --git a/skills/extension/agents/openai.yaml b/skills/extension/agents/openai.yaml new file mode 100644 index 0000000..5b1f887 --- /dev/null +++ b/skills/extension/agents/openai.yaml @@ -0,0 +1,2 @@ +policy: + allow_implicit_invocation: false From 58c05ee106e21ba93988199cc185297645483a44 Mon Sep 17 00:00:00 2001 From: omartelo Date: Fri, 13 Nov 2026 21:31:40 -0300 Subject: [PATCH 2/3] docs: list the extension skill in the README, CLAUDE.md and CHANGELOG --- CHANGELOG.md | 8 ++++++++ CLAUDE.md | 1 + README.md | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e3e6d1..24040f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- **An `extension` skill walks you through writing a lich extension.** Run it by + hand (`/lich:extension` in Claude Code, `$extension` on Codex, `/extension` on + Antigravity) and it takes you from the template repository to a release and the + catalog listing, pointing at lich's docs for the tables. No agent loads it on + its own. + ## [0.21.0] - 2026-11-08 ### Security diff --git a/CLAUDE.md b/CLAUDE.md index 7393072..0c8a01f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -77,6 +77,7 @@ Each doc carries the event mapping for **every** provider, one column each — a ## Skills - [skills/theme](skills/theme/SKILL.md) — writing, porting and validating lich color themes, as a single file or as a versioned theme repository. Mirrors the theme contract in the lich repository (`docs/themes.md` there); `template.json` is a copy of the starter lich itself hands out, vendored at `tests/lich-ref` by `tests/refresh-fixtures.sh` and diffed by CI like the fixtures, and `validate.mjs` derives its token sets from that copy. A change to the theme shape, or to the repository contract, lands here too. The harnesses that read no skills out of a plugin (opencode, oh-my-pi, Crush, Kiro CLI) get the skill from lich's install, which fetches `SKILL.md`, `template.json` and `validate.mjs` from the release tag and rewrites the `name: theme` frontmatter line to `name: lich-theme` (`internal/agentplugin/skill.go` in the lich repository): adding, renaming or moving a file the skill needs, or renaming the skill, means changing that list in lich first. +- [skills/extension](skills/extension/SKILL.md) — writing, developing and publishing a lich extension. Mirrors `docs/extensions.md` in the lich repository, which holds every table, limit and the catalog rules: the skill links to it on GitHub `main` instead of copying them, so a change to that contract lands in the skill's steps only when an order or a trap moved. It is manual only on every harness that reads it: `disable-model-invocation: true` (Claude Code, and Antigravity, which documents the same key) with `user-invocable: true` (Crush needs it to make a command), and `agents/openai.yaml` with `policy.allow_implicit_invocation: false` for Codex, which ignores the frontmatter key. It stays in `skills/`: Antigravity's extra skill directories and Claude Code's `skills` key could host it elsewhere, but Codex's `skills` is one path, so it would lose theme or this. lich's install of the opencode, oh-my-pi, Crush and Kiro CLI copies fetches a fixed list of files (see theme above), so this skill reaches them only once that list names it. ## Tests diff --git a/README.md b/README.md index 4065f77..0c4ac51 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ such as `/compact`, the session runs it on itself once its turn ends It also ships skills for the parts of lich you configure from inside a session: - **theme** (`/lich:theme` in Claude Code; on Codex and Antigravity the `theme` skill loads from its description; Cursor CLI loads it from the Claude Code install; lich copies it as `lich-theme` into opencode, where it is `/lich-theme`, oh-my-pi, Crush and Kiro CLI when it installs the plugin there): write, port or fix a lich color theme: the app tokens, the xterm palette, where the file goes, and a validator for the rules that otherwise fail silently +- **extension** (`/lich:extension` in Claude Code, `$extension` on Codex, `/extension` on Antigravity; run by hand only, no agent loads it on its own; Cursor CLI loads it from the Claude Code install; opencode, oh-my-pi, Crush and Kiro CLI do not get it until lich's install ships it): write, develop and publish a lich extension: the template repository, the manifest, permissions, translations, trying it in place, `lich extension check`, a release and the catalog listing ## Structure @@ -75,6 +76,7 @@ opencode/lich.js # opencode client: all four reports plus the s omp/lich.js # omp client: the reports, one module docs/ # client-side docs, one per contract skills/theme/ # theme skill: SKILL.md, template.json, validate.mjs +skills/extension/ # extension skill, manual only: SKILL.md, agents/openai.yaml tests/ # hook payloads asserted against lich's fixtures ``` @@ -111,7 +113,7 @@ mkdir -p ~/.gemini/config/plugins ln -s "$PWD" ~/.gemini/config/plugins/lich ``` -That is the whole install: the hooks come from `hooks.json` beside the manifest, and the `theme` skill from `skills/`. `agy plugin validate .` checks the bundle from the clone before you link it, `agy plugin list` shows it afterwards, and `agy plugin disable lich` turns it off again. +That is the whole install: the hooks come from `hooks.json` beside the manifest, and the `theme` and `extension` skills from `skills/` (`extension` runs only when you invoke it). `agy plugin validate .` checks the bundle from the clone before you link it, `agy plugin list` shows it afterwards, and `agy plugin disable lich` turns it off again. Without the plugin, [`hooks.json`](hooks.json) can be merged into `~/.gemini/config/hooks.json` (global) or `.agents/hooks.json` (per project) — but a hook's working directory is the folder holding the `hooks.json` that declared it, so replace each `hooks/` prefix with the absolute path to this clone. From 4bbd8555efc6286bd6025bb58cf9a4286d41d878 Mon Sep 17 00:00:00 2001 From: omartelo Date: Fri, 13 Nov 2026 21:32:49 -0300 Subject: [PATCH 3/3] docs: say Antigravity cannot keep the extension skill manual only --- CHANGELOG.md | 8 ++++---- CLAUDE.md | 2 +- README.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24040f8..d88cfba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - **An `extension` skill walks you through writing a lich extension.** Run it by - hand (`/lich:extension` in Claude Code, `$extension` on Codex, `/extension` on - Antigravity) and it takes you from the template repository to a release and the - catalog listing, pointing at lich's docs for the tables. No agent loads it on - its own. + hand (`/lich:extension` in Claude Code, `$extension` on Codex) and it takes you + from the template repository to a release and the catalog listing, pointing at + lich's docs for the tables. No agent loads it on its own, except on Antigravity, + which has no way to keep a skill out of the agent's reach. ## [0.21.0] - 2026-11-08 diff --git a/CLAUDE.md b/CLAUDE.md index 0c8a01f..35d467d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -77,7 +77,7 @@ Each doc carries the event mapping for **every** provider, one column each — a ## Skills - [skills/theme](skills/theme/SKILL.md) — writing, porting and validating lich color themes, as a single file or as a versioned theme repository. Mirrors the theme contract in the lich repository (`docs/themes.md` there); `template.json` is a copy of the starter lich itself hands out, vendored at `tests/lich-ref` by `tests/refresh-fixtures.sh` and diffed by CI like the fixtures, and `validate.mjs` derives its token sets from that copy. A change to the theme shape, or to the repository contract, lands here too. The harnesses that read no skills out of a plugin (opencode, oh-my-pi, Crush, Kiro CLI) get the skill from lich's install, which fetches `SKILL.md`, `template.json` and `validate.mjs` from the release tag and rewrites the `name: theme` frontmatter line to `name: lich-theme` (`internal/agentplugin/skill.go` in the lich repository): adding, renaming or moving a file the skill needs, or renaming the skill, means changing that list in lich first. -- [skills/extension](skills/extension/SKILL.md) — writing, developing and publishing a lich extension. Mirrors `docs/extensions.md` in the lich repository, which holds every table, limit and the catalog rules: the skill links to it on GitHub `main` instead of copying them, so a change to that contract lands in the skill's steps only when an order or a trap moved. It is manual only on every harness that reads it: `disable-model-invocation: true` (Claude Code, and Antigravity, which documents the same key) with `user-invocable: true` (Crush needs it to make a command), and `agents/openai.yaml` with `policy.allow_implicit_invocation: false` for Codex, which ignores the frontmatter key. It stays in `skills/`: Antigravity's extra skill directories and Claude Code's `skills` key could host it elsewhere, but Codex's `skills` is one path, so it would lose theme or this. lich's install of the opencode, oh-my-pi, Crush and Kiro CLI copies fetches a fixed list of files (see theme above), so this skill reaches them only once that list names it. +- [skills/extension](skills/extension/SKILL.md) — writing, developing and publishing a lich extension. Mirrors `docs/extensions.md` in the lich repository, which holds every table, limit and the catalog rules: the skill links to it on GitHub `main` instead of copying them, so a change to that contract lands in the skill's steps only when an order or a trap moved. It is manual only wherever the harness can say so: `disable-model-invocation: true` (Claude Code, Cursor CLI, opencode, oh-my-pi) with `user-invocable: true` (Crush needs it to make a command), and `agents/openai.yaml` with `policy.allow_implicit_invocation: false` for Codex, which ignores the frontmatter key. Antigravity documents only `name` and `description` and lists every skill to the agent on every turn, so there it costs its description and the agent may load it; it stays in `skills/` anyway, because Codex's manifest `skills` is one path and moving it out would cost theme or this. lich's install of the opencode, oh-my-pi, Crush and Kiro CLI copies fetches a fixed list of files (see theme above), so this skill reaches them only once that list names it. ## Tests diff --git a/README.md b/README.md index 0c4ac51..f568ffa 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ such as `/compact`, the session runs it on itself once its turn ends It also ships skills for the parts of lich you configure from inside a session: - **theme** (`/lich:theme` in Claude Code; on Codex and Antigravity the `theme` skill loads from its description; Cursor CLI loads it from the Claude Code install; lich copies it as `lich-theme` into opencode, where it is `/lich-theme`, oh-my-pi, Crush and Kiro CLI when it installs the plugin there): write, port or fix a lich color theme: the app tokens, the xterm palette, where the file goes, and a validator for the rules that otherwise fail silently -- **extension** (`/lich:extension` in Claude Code, `$extension` on Codex, `/extension` on Antigravity; run by hand only, no agent loads it on its own; Cursor CLI loads it from the Claude Code install; opencode, oh-my-pi, Crush and Kiro CLI do not get it until lich's install ships it): write, develop and publish a lich extension: the template repository, the manifest, permissions, translations, trying it in place, `lich extension check`, a release and the catalog listing +- **extension** (`/lich:extension` in Claude Code, `$extension` on Codex; run by hand only, no agent loads it on its own, except on Antigravity, which has no manual-only setting and lists it to the agent like any skill; Cursor CLI loads it from the Claude Code install; opencode, oh-my-pi, Crush and Kiro CLI do not get it until lich's install ships it): write, develop and publish a lich extension: the template repository, the manifest, permissions, translations, trying it in place, `lich extension check`, a release and the catalog listing ## Structure @@ -113,7 +113,7 @@ mkdir -p ~/.gemini/config/plugins ln -s "$PWD" ~/.gemini/config/plugins/lich ``` -That is the whole install: the hooks come from `hooks.json` beside the manifest, and the `theme` and `extension` skills from `skills/` (`extension` runs only when you invoke it). `agy plugin validate .` checks the bundle from the clone before you link it, `agy plugin list` shows it afterwards, and `agy plugin disable lich` turns it off again. +That is the whole install: the hooks come from `hooks.json` beside the manifest, and the `theme` and `extension` skills from `skills/`. `agy plugin validate .` checks the bundle from the clone before you link it, `agy plugin list` shows it afterwards, and `agy plugin disable lich` turns it off again. Without the plugin, [`hooks.json`](hooks.json) can be merged into `~/.gemini/config/hooks.json` (global) or `.agents/hooks.json` (per project) — but a hook's working directory is the folder holding the `hooks.json` that declared it, so replace each `hooks/` prefix with the absolute path to this clone.