Rebuild the object in a reference image as a code-only, procedural, quality-gated, animation-ready Three.js model. Token-efficient image-to-3D.
Python 3dai-agentsclaude-codecomputer-graphicsgenerativeimage-to-3dprocedural-generationthreejstypescriptwebgl
docs: add PLUGINS.md — installing and using plugins from the pipeline side (#166)
TamL.64f43a8a05c1
diff --git a/README.md b/README.mdindex fe2416b..52c2f68 100644--- a/README.md+++ b/README.md@@ -82,7 +82,7 @@ The gallery source lives in [img2threejs/img2threejs-showcase](https://github.coYou give it one reference image of an object. It produces a `THREE.Group` factory written in TypeScript that recreates that object from primitives, procedural shaders, and generated geometry — with a runtime hierarchy (pivots, sockets, colliders) so the result is ready to animate, not an inert lump.-It runs under Claude Code, Codex, or OpenCode. It is agent-agnostic: wherever the docs say "agent vision" or "agent browser tool", it uses whatever the host provides — native image reading, a browser MCP, the project preview, or a user-supplied screenshot.+It runs under Hermes, Claude Code, Codex, or OpenCode. It is agent-agnostic: wherever the docs say "agent vision" or "agent browser tool", it uses whatever the host provides — native image reading, a browser MCP, the project preview, or a user-supplied screenshot.### Subjects and detail accuracy@@ -99,9 +99,6 @@ It runs under Claude Code, Codex, or OpenCode. It is agent-agnostic: wherever th## How it works-A staged sculpting pipeline turns the reference image into a spec, then generates and vision-reviews one build pass at a time — `blockout → structural → form → material → surface → lighting → interaction → optimization` — self-correcting until every identity-defining feature clears its threshold.--**→ Full pipeline diagram, gates, self-correction logic, and the token-efficiency design: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)**A staged sculpting pipeline turns the reference image into a spec, then generates and vision-reviews one build pass at a time — `blockout → structural → form → material → surface → lighting → interaction → optimization` — self-correcting until every identity-defining feature clears its threshold. Deterministic Python scripts handle validation and gating; model tokens are spent only on visual judgment and code.**→ Full pipeline diagram, gates, self-correction logic, script reference, and the token-efficiency design: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)**@@ -110,98 +107,40 @@ A staged sculpting pipeline turns the reference image into a spec, then generate## Quick start-### Which project and CLI do I need?--| Project | Role | CLI |-|---|---|---|-| **[img2threejs](https://github.com/img2threejs/img2threejs)** — this repository | Base reconstruction skill, procedural Three.js pipeline, scripts and quality gates | `npx --yes img2threejs@latest <command>` |-| **[img2](https://github.com/img2threejs/img2)** | Optional plugin harness: catalog, registry, host links and capability lookup | `npx --yes @img2threejs/img2@latest <command>` |-| **Domain and output plugins** — linked below | Additional workflows, domain rules or explicitly selected output routes | Install through `img2 add <plugin-id>` |--The two CLIs are separate packages with independent versions. Installing the harness does-**not** install this base skill; adding a plugin does **not** generate a model.-Start with the base skill. Add the harness only when you need plugins.+Needs **Node.js ≥ 18, Git and Python ≥ 3.10**, and one of Claude Code, Codex, OpenCode or Hermes.### 1. Install the base skill-The CLI needs **Node.js ≥ 18 and Git**; the reconstruction scripts need **Python ≥ 3.10**.-Configure your agent host first. The base installer detects Hermes, Claude Code, Codex and-OpenCode; the plugin harness currently integrates with Claude Code, Codex and OpenCode.--Preview, install into all detected hosts, then inspect their base-skill links:--```bash-npx --yes img2threejs@latest install --dry-run-npx --yes img2threejs@latest install-npx --yes img2threejs@latest doctor-```--To install into just one detected host instead, use:--```bash-npx --yes img2threejs@latest install --host claude-```--The `--yes` above belongs to **npx**, allowing the CLI package download. It is not an-overwrite flag for the base installer.--Supported host directories are `~/.hermes`, `~/.claude`, `~/.codex`, and-`$XDG_CONFIG_HOME/opencode` (default `~/.config/opencode`). The CLI fetches the base skill-from GitHub at `v2.0.0` by default. Its `--ref` accepts a semantic tag (including prereleases)-or a full 40-character commit SHA, **not a branch**:-```bash-npx --yes img2threejs@latest update --ref v2.0.0+npx --yes img2threejs@latest install # links the skill into every agent it finds+npx --yes img2threejs@latest doctor # one line per agent: "managed" means installed```-Checkouts live under `~/.img2threejs/releases/<sha>/img2threejs`; hosts installing the same-commit share that checkout. `update` refuses lower skill versions, including prerelease-downgrades. The installer refuses manual installs and unrelated links rather than-overwriting them. Keep those installations, or deliberately move their entries yourself-before switching to CLI-managed installs. `--dry-run` is offline and writes nothing; it-does not verify remote ref availability or downgrades.--**Manual alternative — choose this or the CLI, not both at the same skill path:**+**Hermes users**, also link the skill into your profile (the installer only writes `~/.hermes/skills/`):```bash-git clone https://github.com/img2threejs/img2threejs.git ~/.claude/skills/img2threejs+ln -sfn ~/.hermes/skills/img2threejs ~/.hermes/profiles/${HERMES_ACTIVE_PROFILE:-img2threejs}/skills/img2threejs```-For multiple hosts, keep one checkout and point each host's `img2threejs` skill entry at-it with a symlink so copies cannot drift apart. A manual clone follows the repository's-default branch rather than the CLI's pinned release.--You can also install the CLI globally with `npm install -g img2threejs`, then run-`img2threejs install`. To test it from this checkout, run-`node bin/img2threejs.mjs install --dry-run`; see [CONTRIBUTING.md](CONTRIBUTING.md)-for packaging and publication checks.+Then **restart your agent** and go to [step 4](#4-run-a-reconstruction-in-your-agent). Prefer to let+your agent install it, want a manual or single-agent install, or something failed:+[`docs/INSTALL.md`](docs/INSTALL.md) (paste-to-agent prompt, expected output, troubleshooting,+update and uninstall, other agents such as Cursor).### 2. Install the plugin harness, if needed-Use harness CLI **0.4.0 or newer** for short plugin IDs:+Skip this unless you need a plugin from the table below. Plugins come from a separate CLI, the+`img2` harness (`~/.img2`); install it once:```bashnpx --yes @img2threejs/img2@latest install --yes-npx --yes @img2threejs/img2@latest plugins-```--The harness uses `~/.img2` and tries to link an `img2` launcher onto your `PATH`. Read-the install output for its location. `plugins` lists the official live catalog; `list`-shows registrations on your machine.--For short commands that use the latest published harness, set this bash/zsh alias:--```bash-alias img2='npx --yes @img2threejs/img2@latest'+npx --yes @img2threejs/img2@latest plugins # the live catalog```-It lasts for this shell session. Add it to `~/.zshrc` and run `source ~/.zshrc` to keep-it in future zsh sessions. Every `img2 ...` command below also works with the explicit-`npx --yes @img2threejs/img2@latest ...` prefix. An existing harness checkout and its-older launcher are not automatically upgraded by running `install` again.--The first `--yes` in the harness install command belongs to npx; the final one skips-the harness consent prompt. Neither permits replacing an existing plugin.+It links an `img2` command if `~/.local/bin`, `/opt/homebrew/bin` or `/usr/local/bin` is on your+`PATH`; otherwise use the `npx --yes @img2threejs/img2@latest` form, or+`alias img2='npx --yes @img2threejs/img2@latest'`. What it changes on your machine:+[`docs/INSTALL.md` §3](docs/INSTALL.md#3-add-a-plugin-only-if-you-need-one).### 3. Choose plugins — do not install everything by default@@ -215,11 +154,10 @@ the harness consent prompt. Neither permits replacing an existing plugin.These are announced plugins; use `img2 plugins` for the current catalog. Open eachplugin's linked README for its input requirements, dependencies and tool setup.-For CS2 and character workflows:+For example, the CS2 plugin:```bashimg2 add cs2 --yes-img2 add character --yesimg2 listimg2 doctorimg2 sync --check@@ -231,23 +169,16 @@ installed, the base has `generic` and `character` profiles. A profile whose plugmissing (`cs2`, `animated-character`) fails loud naming what is installed; it never silentlydowngrades. The base skill is not a plugin: **do not use `img2 add` to install this repository.**-**Private environment source:** GitHub access and working Git credentials are required.-The link may return 404 when you are signed out or lack permission. The public-[`img2-environment` npm installer](https://www.npmjs.com/package/img2-environment) can-bootstrap the harness, but does not grant access to the private source:--```bash-npx --yes img2-environment install --dry-run-npx --yes img2-environment install --yes-```--That installer has its own SDK pin and may retain older CLI presentation.-For lifecycle and trust details, read the [harness usage guide](https://github.com/img2threejs/img2#quickstart).+**Private `environment` plugin:** needs a GitHub account with access to its repository and working+Git credentials. The public [`img2-environment`](https://www.npmjs.com/package/img2-environment)+installer can bootstrap the harness but does not grant that access. Hermes users link each plugin+by hand ([`docs/INSTALL.md` §3](docs/INSTALL.md#3-add-a-plugin-only-if-you-need-one)). Why a run+cannot see an installed plugin, and how plugins reach the pipeline: [`docs/PLUGINS.md`](docs/PLUGINS.md).To write a plugin, follow [WRITING_A_PLUGIN.md](https://github.com/img2threejs/img2/blob/main/docs/WRITING_A_PLUGIN.md).### 4. Run a reconstruction in your agent-Start a new agent session or restart the current one after installing skills.+Restart the agent (or start a new session) after installing skills.In Claude Code, attach an image or give its path and invoke:```text@@ -292,16 +223,9 @@ Neither doctor command proves visual likeness or animation quality; those requirreconstruction's render and domain gates. `img2 update --check` exits 1 when an update ispending, not only on errors. Local `--link` checkouts are live and are not fetched by update.-| Finding / refusal | Meaning and next action |-|---|---|-| `WARN ... multi-capability provider` | The plugin declares multiple capabilities; each edge resolves independently. This warning alone does not fail `img2 doctor`. Do not delete capabilities or reinstall just to remove it. |-| `FAIL ... opencode link missing` | The reported OpenCode skill link is missing. Inspect the reported path and registered checkout; it is not proof that the reconstruction code is broken. `sync` regenerates harness data, not host links. |-| Plugin already registered | Use `img2 list` and `img2 update <id>`, not another ordinary `add`. Use `add --force` only when deliberately replacing a registration; it backs up and reinstalls rather than merely repairing a link. |-| Unmanaged base skill | Keep the manual checkout, or deliberately move its host entry before using the base installer. The base CLI does not overwrite it. |-| Private source returns 404 / access denied | Sign in with a GitHub account authorized for that repository and configure Git credentials. A public npm installer cannot bypass source permissions. |--For plugin audit exit codes, replacement behavior and additional troubleshooting, see-the [img2 README](https://github.com/img2threejs/img2#refs-replacement-and-common-refusals).+Symptoms and fixes: [`docs/INSTALL.md` §6](docs/INSTALL.md#6-when-something-is-off); plugin+audit exit codes and replacement behaviour: the+[img2 README](https://github.com/img2threejs/img2#refs-replacement-and-common-refusals).### Driving it harderdiff --git a/SKILL.md b/SKILL.mdindex 258754d..8c1fcf9 100644--- a/SKILL.md+++ b/SKILL.md@@ -15,9 +15,9 @@ subsequently be *exported* to; an explicitly-selected emission target (`--targetterminal, whole-artifact transform of the already-built model, verified to its own stated limit,never a second way to build one.-Agent-agnostic: works under Claude Code, Codex, or OpenCode. Wherever this doc says "agent-vision" or "agent browser tool", use whatever the host provides — native image reading, a-browser MCP (playwright/chrome-devtools), the project preview, or a user-supplied screenshot.+Agent-agnostic: works under Hermes, Claude Code, Codex, or OpenCode. Wherever this doc says "agent vision" or "agent browser tool", use+whatever the host provides — native image reading, a browser MCP (playwright/chrome-devtools), the+project preview, or a user-supplied screenshot.This file is the always-loaded router: it holds the order of operations and every hard rule as oneline. The full contract behind each rule lives in the `grimoire/` or `docs/` file that rule names —@@ -25,13 +25,13 @@ read the named file at the moment you reach that stage, not before.## Canonical shared checkout-Keep one checkout of this repository and let every host enter it through a symlink, so Claude and-Codex execute the same code instead of drifting apart:--```text-~/.claude/skills/img2threejs -> <your checkout>-~/.codex/skills/img2threejs -> <your checkout>-```+Keep one checkout of this repository and let every host enter it through a symlink, so the hosts+execute the same code instead of drifting apart. `npx --yes img2threejs@latest install` does this+for the hosts it detects (`hermes`, `claude`, `codex`, `opencode`); it refuses (exit 2) to replace a+link it does not manage, so a hand-made link is never silently swapped for a release copy.+**Hermes** reads skills per profile: also link `~/.hermes/profiles/<profile>/skills/img2threejs`+(the installer writes only `~/.hermes/skills/`). Install, manual symlinks, and troubleshooting:+[`docs/INSTALL.md`](docs/INSTALL.md).## When To Use@@ -39,6 +39,24 @@ The user attaches/points to an object image and wants a procedural Three.js modereconstruction/animation/destruction plan, a sculpt spec, or code. Also for material studies,action-ready props, game objects, botanical/mechanical parts, and stylized reconstructions.+## Profile preflight (once per run, before `forge/next.py`)++Domain knowledge (CS2 skins, animated characters, emission targets) lives in plugins, not in this+checkout. Pick the profile from the subject, then confirm this environment can start it:++```bash+python3 forge/state.py init --help | grep -- --profile # profiles available here+```++- `generic` / `character` are built in: no harness, no plugin, nothing else to check.+- A missing domain profile (e.g. `cs2`) is a setup gap: never downgrade to+ `generic` silently. Installing it edits the user's machine, so give them the commands in+ [`docs/INSTALL.md` §3](docs/INSTALL.md#3-add-a-plugin-only-if-you-need-one), get their go-ahead,+ re-check, and continue.+- Installed but not listed (wrong `$IMG2_HOME`), or a Hermes plugin link: [`docs/PLUGINS.md`](docs/PLUGINS.md).+- Then read what the profile's own steps name, at the moment you reach them: the plugin's+ `SKILL.md` and contracts govern that domain.+## Core PromiseSculpt from a photo, in order — never one-shot a mesh:@@ -384,9 +402,9 @@ infer the shape from the reference, as for any other object.Plugins are installed and managed by the `img2` harness([img2threejs/img2](https://github.com/img2threejs/img2)), a separate dependency-free CLI (Node-launcher, Python core). This skill-never installs anything itself: when `state.py init` names a profile as unavailable, name the-`img2 add` command that installs it and stop — never vendor domain logic instead.+launcher, Python core). This skill vendors no domain logic and never writes a substitute for it;+a missing profile is handled by the preflight above, and only a plugin that does not exist+upstream is a blocker to report.```bashimg2 add img2threejs/plugin-<id> --ref <tag> # install a plugin at a tag (e.g. plugin-cs2)diff --git a/docs/INSTALL.md b/docs/INSTALL.mdnew file mode 100644index 0000000..f765757--- /dev/null+++ b/docs/INSTALL.md@@ -0,0 +1,193 @@+# Install img2threejs++One command installs the skill into every supported coding agent on your machine. Plugins are+optional and only needed for specific domains, for example CS2 skins.++You need **Node.js ≥ 18**, **Git**, and **Python ≥ 3.10**, plus one of: Claude Code, Codex,+OpenCode, Hermes. Other agents: [§7](#7-other-coding-agents).++## Paste this to your agent++If you would rather let your coding agent do it, paste:++```text+Install the img2threejs skill for me, following+https://github.com/img2threejs/img2threejs/blob/main/docs/INSTALL.md+1. Run `npx --yes img2threejs@latest install`, then `npx --yes img2threejs@latest doctor`.+ Always use the npx form, never a bare `img2threejs` command.+ Exit 2 means an existing skill is in the way: show me the path and stop.+2. If ~/.hermes exists, run the Hermes step in §1.+3. Install the plugin harness only if I asked for something a plugin provides (§3; `img2 plugins` lists them).+4. Re-running any step is safe. Do not edit dotfiles by hand.+5. Tell me which agents were linked and that I must restart them.+```++## 1. Install the skill++```bash+npx --yes img2threejs@latest install # links the skill into every agent it finds+npx --yes img2threejs@latest doctor # one line per agent: "managed" means installed+```++Expected output of `install` (one `✓` line per agent found):++```text+→ install skill img2threejs/img2threejs @ v2.0.0 into: hermes, claude+✓ hermes: ~/.hermes/skills/img2threejs → ~/.img2threejs/releases/<sha>/img2threejs (2.0.0, <sha>)+✓ claude: ~/.claude/skills/img2threejs → ~/.img2threejs/releases/<sha>/img2threejs (2.0.0, <sha>)+```++An agent is found when its folder exists: `~/.claude`, `~/.codex`, `~/.config/opencode`+(or `$XDG_CONFIG_HOME/opencode`), `~/.hermes`. Install into one only with `--host claude`+(or `codex`, `opencode`, `hermes`). Preview without changing anything with `--dry-run`.++**Hermes only — one more line.** Hermes loads skills per profile, and the installer only writes+`~/.hermes/skills/`. Link the skill into the profile you use (default `img2threejs`):++```bash+ln -sfn ~/.hermes/skills/img2threejs ~/.hermes/profiles/${HERMES_ACTIVE_PROFILE:-img2threejs}/skills/img2threejs+```++Use `ln -sfn`, not `ln -s`: running `ln -s` a second time on an existing directory link silently+creates a stray link *inside* the skill checkout. Repeat the line for each profile that should see+the skill. Without it, Hermes reports "Unknown skill".++## 2. Restart your agent and try it++Restart the agent (or start a new session) so it loads the skill. Then, with an image in your+project:++| Agent | Type |+|---|---|+| Claude Code | `/img2threejs Rebuild the object in ./reference.png as a procedural Three.js model.` |+| Codex, OpenCode, Hermes | `Use the img2threejs skill to rebuild the object in ./reference.png as a procedural Three.js model.` |++That is all a generic object needs. More prompts: [README §4](../README.md#4-run-a-reconstruction-in-your-agent).++## 3. Add a plugin (only if you need one)++Plugins come from a second, separate CLI, the `img2` harness. Install it once, then add plugins+by id (list them with `img2 plugins`; harness 0.4.0 or newer):++```bash+npx --yes @img2threejs/img2@latest install --yes # once per machine: creates ~/.img2+npx --yes @img2threejs/img2@latest add cs2 --yes # example id; `img2 plugins` lists all+npx --yes @img2threejs/img2@latest list # the plugin must be listed here+```++Then restart the agent. `add` before `install` fails with `no harness checkout at …/harness` / ``run `img2 install` first``.++What `install` changes on your machine:++- creates `~/.img2` (or `$IMG2_HOME`) with the harness checkout and plugin registry;+- if `~/.claude/` exists, adds that folder to `permissions.additionalDirectories` in+ `~/.claude/settings.json`, whether or not Claude Code is installed;+- links an `img2` command into `~/.local/bin`, `/opt/homebrew/bin` or `/usr/local/bin`, whichever+ is on your `PATH` and writable. Other `PATH` folders are not used. If none qualifies it prints+ `No writable launcher directory on PATH; use npx instead`, and you keep using the `npx` form+ (or `alias img2='npx --yes @img2threejs/img2@latest'`).++`add` links the plugin as a skill (`img2-<id>`) for Claude Code, Codex and OpenCode. **Hermes**+needs it by hand, per plugin:++```bash+ln -sfn "${IMG2_HOME:-$HOME/.img2}/plugins/cs2" ~/.hermes/profiles/${HERMES_ACTIVE_PROFILE:-img2threejs}/skills/img2-cs2+```++The `environment` plugin is private: it needs a GitHub account with access to its repository.+Why a run cannot see an installed plugin, and how plugins reach the pipeline:+[`PLUGINS.md`](PLUGINS.md).++## 4. Update and uninstall++```bash+npx --yes img2threejs@latest update # newest pinned release of the skill+npx --yes img2threejs@latest update --ref v2.0.0 # a specific tag or full 40-char SHA+img2 update --check # exits 1 when a plugin update is pending+img2 update cs2+img2 remove cs2 # unlinks it and moves its checkout to ~/.img2/backups+```++`update` never downgrades. `--ref` takes a `vX.Y.Z` tag or a 40-character SHA; branches and short+SHAs are refused.++There is no uninstall command for the skill. Delete each agent's `img2threejs` link (the paths in+`doctor` output, plus any Hermes profile link), then `~/.img2threejs/`. For the harness, `img2 remove`+each plugin, then delete `~/.img2` and the `img2` launcher.++## 5. Manual install (no CLI)++Keep one checkout and symlink it into each agent, so copies cannot drift. Use either this or the+CLI for a given path, not both: the CLI refuses (exit 2) to replace a link it did not create.++```bash+git clone https://github.com/img2threejs/img2threejs.git ~/src/img2threejs+ln -sfn ~/src/img2threejs ~/.claude/skills/img2threejs+ln -sfn ~/src/img2threejs ~/.codex/skills/img2threejs+ln -sfn ~/src/img2threejs ~/.config/opencode/skills/img2threejs+ln -sfn ~/src/img2threejs ~/.hermes/profiles/${HERMES_ACTIVE_PROFILE:-img2threejs}/skills/img2threejs+ln -sfn ~/src/img2threejs ~/.hermes/skills/img2threejs # only so `doctor` sees Hermes+```++Create the parent `skills/` folder first if it does not exist. A clone follows the default+branch; the CLI pins a release.++## 6. When something is off++| Symptom | Cause | Fix |+|---|---|---|+| `img2threejs: command not found` or `img2: command not found` | not installed globally (expected) | use the `npx --yes …@latest` form shown above |+| `img2threejs` starts something else (e.g. Hermes) | another program owns that name on your `PATH` | use the `npx` form; check `which img2threejs` |+| An agent is missing from the `install` plan | its folder does not exist yet | run that agent once, or pass `--host <name>` |+| `error (2): refusing to replace an unmanaged skill at <path>` | a manual install or other link is already there | keep it, or move that path away and re-run |+| `error (2): ref must be a vX.Y.Z tag or 40-char SHA` | `--ref` got a branch or short SHA | pass a tag or the full SHA |+| Slash command or skill not found after install | the agent was not restarted | restart it / open a new session |+| Hermes says "Unknown skill" | no link in the profile folder | the Hermes line in [§1](#1-install-the-skill) |+| `doctor` shows `hermes … (no link)` though Hermes works | `doctor` checks only `~/.hermes/skills/` | link that path too, or ignore |+| A plugin is installed but the run does not offer its profile | it is registered in a different `$IMG2_HOME` | [`PLUGINS.md`](PLUGINS.md#what-a-run-sees-depends-on-img2_home) |+| `~/.claude/settings.json` changed after `img2 install` | `~/.claude/` exists (see §3) | expected; back the file up first if you want to restore it |+| `git ls-remote … failed` / `could not read Username for 'https://github.com'` | private plugin, no GitHub access | sign in with an account that has access and configure Git credentials |++Neither `doctor` proves the result looks right; that is what the reconstruction's own render+gates check.++## 7. Other coding agents++The installer knows four agents. Others can load the skill by hand: clone it (§5) and link or+reference it where the agent reads skills or instructions. **The paths below come from each+vendor's documentation and have not been tested with img2threejs**; check the vendor's docs if one+does not work, and tell us so we can fix the row.++| Agent | Where it reads skills / instructions | Note |+|---|---|---|+| Cursor | `.cursor/skills/<name>/SKILL.md`, `~/.cursor/skills/` | rules use `.cursor/rules/*.mdc` |+| JetBrains Junie | `.junie/skills/<name>/SKILL.md`, `~/.junie/skills/` | prefers `.junie/AGENTS.md` |+| Kiro | `.kiro/skills/<name>/SKILL.md`, `~/.kiro/skills/` | steering in `.kiro/steering/*.md` |+| Pi | `~/.pi/skills/<name>/SKILL.md` | also reads root `AGENTS.md` |+| Droid (Factory) | `~/.factory/skills/` | |+| Crush | `./.crush/skills/`, `~/.config/crush/skills/` | |+| Warp | scans `.agents/`, `.warp/`, `.claude/`, `.codex/` | a Claude/Codex link may be enough |+| Aider | root `AGENTS.md` / `CONVENTIONS.md` | add the file to `read:` in `.aider.conf.yml` |+| Mistral Vibe, Amp, Auggie, Zed | root `AGENTS.md` | point it at the checkout's `SKILL.md` |+| Trae | `AGENTS.md` (enable in Settings → Rules & Memories) | |+| Windsurf | `.windsurf/rules/*.md` | |+| Continue | `.continue/rules/*.md` | CLI is `cn` |++Plugins (`img2 add`) are linked only for Claude Code, Codex and OpenCode. In any other agent, have+it read the plugin's `SKILL.md` from `~/.img2/plugins/<id>/`.++## Reference: the two CLIs++| | Skill CLI | Plugin harness CLI |+|---|---|---|+| npm package | `img2threejs` | `@img2threejs/img2` |+| Installs | this skill into agents | plugins (domain steps, gates, output targets) |+| Agents it links | hermes, claude, codex, opencode | claude, codex, opencode |+| Version check | `npx --yes img2threejs@latest --version` (plain text) | `npx --yes @img2threejs/img2@latest --version --json` (JSON) |++Installing one does not install the other, and neither generates a model: the agent does that+when you ask it to. The first `--yes` in every command belongs to `npx` (allow the package+download); a trailing `--yes` on `img2` skips its confirmation prompt. Neither overwrites anything.+Skill checkouts live in `~/.img2threejs/releases/<sha>/img2threejs`, shared by every agent on the+same release. To test the CLI from a clone: `node bin/img2threejs.mjs install --dry-run`; packaging+checks are in [`CONTRIBUTING.md`](../CONTRIBUTING.md).diff --git a/docs/PLUGINS.md b/docs/PLUGINS.mdnew file mode 100644index 0000000..cca925b--- /dev/null+++ b/docs/PLUGINS.md@@ -0,0 +1,224 @@+# Installing and using plugins++Domain knowledge does not live in this checkout. It lives in **plugins**, installed and managed by+the [`img2` harness](https://github.com/img2threejs/img2). This page is the pipeline-facing view:+what a run sees, how a plugin's declarations reach this pipeline's checklist, and what to check when+a profile you expect is missing.++The normative rules for plugins themselves are the harness repo's+[`docs/PLUGIN_CONTRACT.md`](https://github.com/img2threejs/img2/blob/main/docs/PLUGIN_CONTRACT.md) —+where anything here disagrees with it, that file wins. To *write* a plugin, start from its+[`docs/WRITING_A_PLUGIN.md`](https://github.com/img2threejs/img2/blob/main/docs/WRITING_A_PLUGIN.md).++## Three layers, and why they do not couple++| Layer | Owns |+|---|---|+| harness `img2` | install/link plumbing, the plugin registry, the workspace state envelope, the gate runner, the contract. Ships **no** domain capability |+| this pipeline | `forge/`, the staged build, the deterministic gates, the checklist authority (`.img2threejs/state.json`) |+| a plugin | its own checkout steps, gates, reference material, spec augmentation |++Neither side imports the other's code. The harness never executes plugin code during+`add`/`doctor`/`sync`, and this pipeline consumes a plugin only as **declared data**+(`plugins.json`, `domain.json`, `spec-augmentation.json`). That is why installing or removing a+plugin can never change what this pipeline emits: it may *add* steps and *raise* quality floors+(the merge clamps — a plugin can raise a floor, never lower one), and nothing else.++## Install++Nothing here is required for a `generic` or `character` run: those are satisfied by this checkout+alone. Reach for the harness when a **domain plugin** serves the item — and note that **every+command below works before you install anything**, as+`npx --yes @img2threejs/img2@latest <command>`. Measured on an empty, throwaway `$IMG2_HOME`:+`--version --json` and `list` exit 0 and write nothing (`list` reports `Registered 0` and points at+`img2 plugins`), `capabilities` answers `providers: []`, and only `doctor` exits 1, with a `FAIL` line+`` no harness checkout at <home>/harness; run `img2 install` ``.++```bash+npx --yes @img2threejs/img2@latest install # once per machine: ~/.img2 + an `img2` launcher on PATH+img2 plugins # the official live catalog (harness CLI >= 0.4.0)+img2 update [<id>] [--check] # update managed plugins, or check for newer versions (0.4.0)+img2 add cs2 --yes # short id; `img2 add img2threejs/plugin-cs2` is the portable form+img2 list # id, version, ref, sha+img2 doctor # fail-loud static audit of every registered row+img2 sync --check # generated index == manifests (CI-able)+img2 remove cs2 # unlink every host, move clone to backups, drop the row+```++- Short ids and `img2 plugins` require harness CLI **0.4.0 or newer**; the `img2threejs/plugin-<id>`+ form works on any version.+- `--ref <branch>` installs a moving branch explicitly and records it as such; `--link <path>`+ symlinks a local checkout for plugin development (no clone); anything outside the `img2threejs`+ org needs `--allow-any-source`. Some plugins are distributed from **private** repositories and+ need authorized Git access — see the README's plugin table for each plugin's access level.+- A plugin whose `requires.harness` / `requires.coreApi` the installed harness does not satisfy+ **blocks** the install. It is not a warning: a mismatch that got through could emit wrong geometry+ that passes visual gates by luck.+- Keep the plugin's own `SKILL.md` reachable in whatever agent host you use. The harness links each+ plugin as its own skill (`<host-skills-dir>/img2-<id>`) **for the hosts it knows about** — see+ [Host skills](#host-skills) if yours is not one of them.++### Where `img2` itself lives++The npm package is only an entry point. `install` clones the harness into `$IMG2_HOME/harness` and+links that checkout's own CLI (`$IMG2_HOME/harness/bin/img2.mjs`, a zero-dependency Node script) as+`img2` in `~/.local/bin`, `/opt/homebrew/bin` or `/usr/local/bin` (whichever is on `PATH` and+writable; other `PATH` directories are not used), so `which img2` resolves **into the checkout**, not into a+global npm prefix — and the CLI's version is the checkout's tag, not the npm dist-tag. That makes the+CLI version a machine property worth checking (`img2 --version --json`) rather than an assumption:+this block's `plugins`, `update`, `npm:<name>` and short-id forms are 0.4.0 additions, while an older+checkout accepts only the `img2threejs/plugin-<id>` form.++### What `install` actually does++Run against a throwaway `$IMG2_HOME` (nothing of an existing setup touched), in three steps:++1. **Installation home** — creates `$IMG2_HOME/{plugins,generated,backups}` plus `plugins.json`+ (`{"version":1,"plugins":[]}`) and `receipts.json` (`[]`).+2. **Harness checkout** — clones the harness into `$IMG2_HOME/harness`, following the repository's+ **default branch rather than the newest tag** (measured: `v0.4.0-1-g06634bd`), so the checkout can+ sit a commit past the tag it reports.+3. **Agent access** — links the launcher into `~/.local/bin`, `/opt/homebrew/bin` or `/usr/local/bin`,+ whichever is on `PATH` and writable. When none+ qualifies it links **nothing**: it warns `No writable launcher directory on PATH; use npx+ instead` and prints the `npx` form. That is why the block above is written to work whether or not+ an `img2` launcher exists. Claude host detection is **directory-existence** at `~/.claude/`, not+ `claude`-on-`PATH`: when that directory exists the harness writes+ `permissions.additionalDirectories` to `~/.claude/settings.json` regardless of whether Claude+ Code is installed; the message `Claude Code not detected; settings left unchanged` means only+ that the directory is absent. Side-effect contract and how to suppress it:+ [`docs/INSTALL.md` §3](INSTALL.md#3-add-a-plugin-only-if-you-need-one).++## What a run sees depends on `$IMG2_HOME`++Composition is **data**: the set of active plugins is the registry at `$IMG2_HOME/plugins.json`+(`IMG2_HOME` defaults to `~/.img2`). Nothing else is consulted — in particular this pipeline reads+the registry, never a glob of the `plugins/` directory, so a checkout left behind by a removed+plugin contributes nothing.++That makes "I installed it" and "this run sees it" two different statements whenever more than one+`$IMG2_HOME` exists on a machine (a per-project home next to the default one is the common case).++```bash+img2 --version --json # harness, maxPluginSchema, coreApi, contract, commands[] — a positive probe+img2 list # what the ACTIVE home has registered+python3 forge/state.py init --help | grep profile # profiles this pipeline can actually start+```++`--profile`'s choices are generated from the registry, so that list is the authoritative answer for+the environment the command runs in. If a profile is missing:++```bash+export IMG2_HOME=<the home you installed into> # for this shell+# or register the plugin into the default home:+img2 add img2threejs/plugin-character && img2 doctor && img2 sync --check+```++## What a domain plugin contributes++A domain plugin ships an optional `domain.json`. This pipeline reads it from+`$IMG2_HOME/plugins/<id>/domain.json` (registered rows only) at+`forge/state.py init --profile <id>`, and splices:++- `setupSteps` **before** the base step in `setupAnchorBefore`;+- `passSteps` **before** the base step in `passAnchorBefore` (every correction pass);+- `rigSteps` **after** the terminal steps (no anchor by design — the rig track always follows them);+- `specCollection` as an extra local-evidence collection for Local Spec Search.++`{plugin_dir}` is substituted when the profile is spliced in, so a command in the checklist is+runnable from the workspace without the caller knowing where the plugin lives. Rows are+`[stepId, command]` **pairs** (not `{id, command}` objects), and `domain.json` has **no `actor`+field** — a different shape from `steps.json`/`gates.json`, and a **different closed placeholder+set**: `{plugin_dir}`, `{reference}`, `{spec}`, `{pass_id}`. The pipeline renders it with Python+`str.format()`, which raises on any other name, so `{workspace}`/`{image}` are legal in+`steps.json` and a run-time crash here — `img2 doctor` refuses the wrong set up front, naming the+placeholder, the file, and that file's own valid set.++Failure modes are loud, by construction:++- a missing profile raises naming **what is installed** (`available: generic, character`);+- an unknown key in `domain.json` is refused rather than ignored (a typo would otherwise silently+ contribute nothing);+- two plugins declaring the same domain `id` raise `declared twice` — the pipeline refuses to pick+ one.++In-repo profiles are `generic` and `character`. Installed plugins add their own+profiles: `img2 plugins` lists the catalog, and `python3 forge/state.py init --help` the profiles+this environment can start.+`steps.json` and `gates.json` are the harness-side surfaces (contributed steps ordered among+themselves, and gates); `domain.json` is the one this pipeline consumes.++## Plugin gates++A gate is a CLI that prints **one** verdict envelope and exits `0` (pass) / `1` (fail) / `2`+(error/refused):++```json+{ "kind": "img2.gate-verdict", "version": 1, "gate": "cs2-review", "plugin": "cs2",+ "status": "pass", "reasons": [], "evidence": {} }+```++A malformed envelope is an `error`, never a pass, and a gate must be `actor: "program"` — a gate has+to produce a verdict. `img2_core.gate_runner` aggregates them and stops the workflow on a blocking+fail (later gates are recorded `skipped`, never run). In this pipeline a plugin gate is attached to+the review record with `--domain-review-json <report>.json --review-scene-json <scene.json>` — the+checklist step carries the resolved paths, and a failed domain gate blocks `continue` even when the+global fidelity score passes.++## Host skills++The harness's `HOSTS` table (`~/.img2/harness/bin/img2.mjs`) names **Claude Code, Codex and+OpenCode**; on `img2 add` it creates `<host-skills-dir>/img2-<id>` for each one it detects, using+a harness-derived name — a plugin never chooses it. **Hermes is not in that table today.** So for+a Hermes user, `img2 add <id>` registers the plugin and clones it under `$IMG2_HOME/plugins/<id>`,+but **does not create** `~/.hermes/profiles/<active>/skills/img2-<id>` — the plugin's own+`SKILL.md` (intake contracts, finish rulebooks, review gates) is not in your model's context+unless you create that link yourself, one per plugin.++`img2 doctor` only walks the harness `HOSTS` table, so for a Hermes-only host it says nothing about+plugin-skill links, and the base CLI's `img2threejs doctor` reports only the **base** skill link.+Neither sees a Hermes plugin link you made by hand: check it with+`ls -l ~/.hermes/profiles/<profile>/skills/` or the host's own skill listing.++Two workarounds for hosts the harness does not know about (Hermes today, anything new until+upstream lands the row), in order of preference:++1. Link it yourself with the same name convention, from your host's skills directory to+ `$IMG2_HOME/plugins/<id>` — the same target the harness would have used. For the active Hermes+ profile:++ ```bash+ ln -sfn "${IMG2_HOME:-$HOME/.img2}/plugins/cs2" ~/.hermes/profiles/${HERMES_ACTIVE_PROFILE:-img2threejs}/skills/img2-cs2+ ```++ A homemade Hermes link is visible to your model and invisible to `img2 doctor`. If you want it+ under harness bookkeeping, put the row upstream in `img2/bin/img2.mjs` rather than per-machine.++2. Read the files directly: every step a profile splices in prints an **absolute** path, so the+ contract a step names can be read without a skill link at all.++Adding your host to the harness's `HOSTS` table is the real fix, and it belongs upstream in the+harness, not in a local patch.++## Troubleshooting++| Symptom | Cause | Action |+|---|---|---|+| `no installed provider serves profile 'X'; available: …` | the plugin is not in the registry the run is reading | `img2 list`, then `img2 add …` or fix `$IMG2_HOME` |+| `domain id 'X' is declared twice` | two providers claim one id | remove one; the pipeline must not choose |+| `doctor` names a row and two versions | `requires.harness` / `coreApi` mismatch | update the harness, or the plugin's floor |+| `capabilities` → `ambiguous`, exit 3 | two plugins claim one edge | `--plugin <id>` disambiguates |+| `capabilities` → `data-fault`, exit 1 | a manifest failed to validate, or `argv[0]` does not resolve | read `problems[]`; `doctor` and `capabilities` must agree |+| A domain step's command crashes the checklist | a placeholder from the wrong file's vocabulary | fix the plugin; `doctor` catches it first |+| A prose row executed as a command | missing `actor: agent\|human` | declare `actor` on that row |++## Where to read next++- This pipeline's README — the plugin table (what each adds, its access level, its install command)+ and the harness setup steps.+- Harness `docs/PLUGIN_CONTRACT.md` — every normative rule (manifest schema, steps, gates,+ `domain.json`, the gate runner envelope, the emission-target socket).+- Harness `docs/WRITING_A_PLUGIN.md` and `docs/plugin-wiki/` — authoring, worked scenarios, and the+ field-by-field reference.+- Harness `SECURITY.md` — the threat model: a plugin is arbitrary code your agent will later run.+ `add` pins, attributes and names it; it cannot make it safe.