Skip to content

plugins: read plugins in the .claude-plugin layout as incode plugins - #83

Merged
blockmandev merged 1 commit into
mainfrom
feat/claude-plugin-layout
Nov 13, 2026
Merged

blockmandev merged 1 commit into
mainfrom
feat/claude-plugin-layout

Conversation

@blockmandev

Copy link
Copy Markdown
Member

A folder with .claude-plugin/plugin.json and no plugin.toml now installs (incode plugin add) and loads as an incode plugin. Its commands, skills, sub-agents, hooks and MCP servers then serve every agent incode drives (claude, codex, agy, the API route), because incode runs them itself.

What is read

In the plugin Becomes
.claude-plugin/plugin.json name/version/description the manifest
commands/, skills/ as before
agents/*.md sub-agents <plugin>:<agent> (new for both layouts); model: inherit = parent's model
hooks/hooks.json, or plugin.json hooks (path inside the folder, or the object) incode's hook events, translated
.mcp.json, or plugin.json mcpServers (bare map or mcpServers) servers via mcp_config::ServerEntry::to_spec (${VAR}, ${VAR:-default})
${CLAUDE_PLUGIN_ROOT} the plugin's folder

Hooks

  • hooks::HookCommand replaces the plain command string: optional matcher (a regex on the whole tool name; also accepted in admin.json / incode hooks.json as {"command","matcher"} — plain strings still read and written as before), the plugin's folder in CLAUDE_PLUGIN_ROOT and INCODE_PLUGIN_ROOT, and a posix flag that runs the command in the Bash tool's Git Bash on Windows (falls back to cmd /C with the folder written into the text when there is none).
  • Tool matchers kept; mcp__plugin_<p>_<s>__ renamed to incode's mcp__<p>_<s>__. SessionStart/PreCompact matchers are weighed against incode's startup/manual. Left out and listed by incode plugin list: prompt/agent hooks, events incode has no point for, Notification hooks with a matcher, bad matchers, and plugin.json keys incode does not read.
  • Small widening: an incode-layout plugin's ${INCODE_PLUGIN_ROOT} is now filled in every event's commands (it was pre/post tool only).

Not done / limits

  • Hook timeout is not read: every hook stays bounded at HOOK_TIMEOUT (10 s).
  • Extra command/agent paths in plugin.json and marketplaces are not supported.
  • A plugin agent whose tools names a tool incode lacks (e.g. Task) is left out and said by /agents, as for the operator's own.
  • Project plugins still need incode plugin approve; a project plugin still gets only tool hooks.

Tested (Windows)

  • 9 new tests: install with every part, hook translation and what is left out, plugin.json paths stay inside the folder, plugin.toml wins, matcher runs only for named tools, plugin folder in the hook environment, POSIX hook runs in Git Bash, admin.json round trip, plugin agents named and inherit.
  • Six controls (matcher filter, Git Bash path, cmd root fill, matcher rename, path-inside check, inherit) each failed its test on the intended assertion; restore byte-identical.
  • cargo test --lib --bins: 2444 + 59 pass; clippy --all-targets -D warnings and fmt --check clean.
  • Not run locally: Linux/macOS (CI).

A folder with .claude-plugin/plugin.json and no plugin.toml now installs
and loads as an incode plugin, so its parts serve every agent incode
drives (claude, codex, agy, the API route), not one CLI:

- manifest: name/version/description from plugin.json
- commands/, skills/ as before; agents/ now loaded for every plugin, as
  <plugin>:<agent> (subagents::load); `model: inherit` means the parent's
- hooks/hooks.json (or plugin.json `hooks`, a path inside the folder or
  the object) translated to incode's events; tool matchers kept, with
  mcp__plugin_<p>_<s>__ renamed to incode's mcp__<p>_<s>__; SessionStart
  and PreCompact matchers weighed against startup/manual; what incode
  cannot run (prompt hooks, unknown events, bad matchers) left out and
  listed by `incode plugin list`
- .mcp.json (or plugin.json `mcpServers`), bare map or mcpServers, built
  by mcp_config::ServerEntry::to_spec with ${CLAUDE_PLUGIN_ROOT}

hooks::HookCommand replaces the plain command string: an optional
matcher (also accepted in admin.json and incode's own hooks.json as
{"command", "matcher"}), the plugin's folder in CLAUDE_PLUGIN_ROOT and
INCODE_PLUGIN_ROOT, and a posix flag that runs the command in the Bash
tool's Git Bash on Windows instead of cmd.

Tested: 9 new tests; six controls (matcher filter, Git Bash path, cmd
root fill, matcher rename, path-inside check, inherit) each failed its
test on the intended assertion and were restored byte-identical. Lib
2444 + bin 59 pass, clippy -D warnings and fmt clean (Windows).
@blockmandev
blockmandev merged commit c72b248 into main Nov 13, 2026
12 checks passed
blockmandev added a commit that referenced this pull request Nov 15, 2026
…ls and PluginCall (#99)

* plugins: the memory engine's plugin tool servers offered as PluginTools and PluginCall

The second half of the Claude-plugins work (the first, reading plugins in
the .claude-plugin layout, is #83). The owner's decision of 2026-10-30:
build the incode side now, tested against a fake engine, and say plainly
when a plugin's server answers 401 (blocked on sign-in) instead of
failing silently.

- The memory engine runs plugin MCP servers for the owner. A session asks
  it once for the index (incord_describe) and offers two tools: PluginTools
  (one line per server; a server's tools on request) and PluginCall (run
  one). An index, not every tool, per the engine owner's decision: every
  plugin's tools in the context cost 8,029 tokens more.
- Both are Reach::Run, like every MCP tool: refused read-only, asked under
  prompt, refused when the engine cannot decide.
- A server a local plugin already runs is left out of the index, so no
  server is started twice. Plugin skills are read from the engine too.
- Not offered when the engine names no servers or does not answer.

This was left uncommitted on 2026-10-30 in the claude-plugins worktree;
it is ported onto current main (the one conflict was the module list in
toolbox/mod.rs after #96).

cargo clippy --all-targets: clean. cargo test --lib: 2290 passed, 0
failed, including the 5 engine_plugins tests against a fake engine. The
ignored live test against the real engine passed here: it described the
inbrowse server's 43 tools.

* plugins: engine_plugins_tests formatted with rustfmt
@blockmandev
blockmandev deleted the feat/claude-plugin-layout branch November 15, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant