Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

feat(plugins): load Claude plugins the way Claude does

Cursor Agent6175a2bab2e3
diff --git a/README.md b/README.md
index 6a799b70..297cb12d 100644
--- a/README.md
+++ b/README.md
@@ -579,8 +579,11 @@ one in `.harness/skills/<name>/SKILL.md` (or `~/.harness/skills/` for every
project), give it `name` and `description` frontmatter, and write the
instructions in the body. Skills already written for Claude Code, Cursor,
Grok, or Codex work as they are: `.claude/skills/`, `~/.cursor/skills-cursor/`,
-`~/.grok/skills/`, plugin `skills/` trees, and `~/.agents/skills/` are read
-in place (not copied). `/plugins` and `graff plugins` list the plugin trees.
+`~/.grok/skills/`, plugin `skills/` and Claude `commands/*.md` trees, and
+`~/.agents/skills/` are read in place (not copied). A Claude plugin works the
+same way it does in Claude Code: `commands/`, a root `SKILL.md`, inline
+`mcpServers`, and `${CLAUDE_PLUGIN_ROOT}` are honored. `/plugins` and
+`graff plugins` list the trees; `/plugins load <name>` shows one.
`GRAFF_NO_PLUGINS=1` skips them.
Only the name and description enter the system prompt, so a large skill library
@@ -599,8 +602,9 @@ Graff speaks both MCP transports directly: local stdio servers and remote
Streamable HTTP servers. Servers already configured for Claude, Cursor, or
Grok are read in place (plugin `mcp.json` / `.mcp.json`, `~/.claude.json`,
`~/.cursor/mcp.json`, `.cursor/mcp.json`) and fill names graff does not
-already define; they still need `/mcp trust` or `--yolo`. `/plugins` and
-`graff plugins` show which plugin trees contributed. Smolify (`https://app.smol.ly/mcp`) is available as a
+already define; they still need `/mcp trust` or `--yolo`. Plugin manifests
+may also declare `mcpServers` inline or as a path (Claude's shape).
+`/plugins` and `graff plugins` show which plugin trees contributed. Smolify (`https://app.smol.ly/mcp`) is available as a
core documentation service; it needs no Node bridge or project configuration.
Its public-read schemas are bundled locally, so startup makes no Smolify
request. The anonymous transport initializes only after an approved tool call,
diff --git a/docs/adr/0007-plugins-are-read-in-place.md b/docs/adr/0007-plugins-are-read-in-place.md
index fe48085f..1d16e566 100644
--- a/docs/adr/0007-plugins-are-read-in-place.md
+++ b/docs/adr/0007-plugins-are-read-in-place.md
@@ -23,11 +23,16 @@ config.
`.grok-plugin/plugin.json`, `plugin.json`, `.mcp.json`, `mcp.json`,
`skills/`, or `agents/`. The listing name comes from the manifest when
present (Cursor cache folders are content hashes). Skip `marketplaces/`.
- Cap 32.
+ Cap 32. A directory is also a plugin if it has Claude's `commands/` or a
+ root `SKILL.md`.
- Skills from those trees (and `~/.agents/skills`, `~/.grok/skills`,
`~/.codex/skills`, `~/.cursor/skills-cursor`, `~/.cursor/skills`) join the
- existing on-demand `skill` catalog. Bodies still load only when the model
- calls `skill`. Project `.harness/skills` still wins.
+ existing on-demand `skill` catalog. Claude `commands/*.md` and a plugin-root
+ `SKILL.md` (when there is no `skills/` tree) load the same way. Manifest
+ `skills` / `commands` / `agents` paths and inline or path-valued
+ `mcpServers` are honored; `${CLAUDE_PLUGIN_ROOT}` and
+ `${CLAUDE_PROJECT_DIR}` expand in MCP strings. Bodies still load only when
+ the model calls `skill`. Project `.harness/skills` still wins.
- Plugin `agents/` join the fleet after personal `~/.harness/agents` and
before project `.harness/agents`.
- Plugin `.mcp.json` / `mcp.json` plus Claude/Cursor/Grok MCP files
@@ -35,7 +40,8 @@ config.
**missing** server names only. graff's `~/.codegraff/mcp.json` and
`.mcp.json` still win. Consent is unchanged (`/mcp trust` / `--yolo`).
- `GRAFF_NO_PLUGINS=1` disables the scan. `/plugins` and `graff plugins`
- list origin. Do not vendor grok-build. Do not auto-run plugin hooks.
+ list origin; `/plugins load <name>` shows one tree. Do not vendor
+ grok-build. Do not auto-run plugin hooks. Do not add plugin `bin/` to PATH.
## Consequences
diff --git a/docs/skills.md b/docs/skills.md
index 6023f373..d3ba3abb 100644
--- a/docs/skills.md
+++ b/docs/skills.md
@@ -20,7 +20,7 @@ Two kinds of thing are called "skills" in graff, and `/skills` lists both:
| `~/.claude/skills/` | you, every project (compatibility) |
| `~/.harness/skills/` | you, every project |
| `~/.grok/skills/`, `~/.codex/skills/`, `~/.agents/skills/`, `~/.cursor/skills-cursor/` | you, every project (other harnesses, in place) |
-| `~/.cursor/plugins/*/skills/` and `~/.claude/plugins/*/skills/` (and Grok/Codex/graff plugin trees) | you, every project (ADR 0007) |
+| `~/.cursor/plugins/*/skills/` and `~/.claude/plugins/*/skills/` (and Grok/Codex/graff plugin trees, plus Claude `commands/*.md` and a plugin-root `SKILL.md`) | you, every project (ADR 0007) |
| `.claude/skills/` | this project (compatibility) |
| `.grok/skills/`, `.codex/skills/` | this project |
| `.claude/plugins/*/skills/` (and project plugin trees) | this project |
diff --git a/evals/harness_behavior.jsonl b/evals/harness_behavior.jsonl
index b59c54be..51515a0c 100644
--- a/evals/harness_behavior.jsonl
+++ b/evals/harness_behavior.jsonl
@@ -54,3 +54,4 @@
{"id": "plugin-skill-on-demand", "why": "ADR 0007: a Cursor cache plugin skill must appear in the catalog as (plugin) without its body, and skill name= loads the body. The regression is copying/adopting (body always in the prompt) or never walking plugins/cache/.", "args": [], "workspace_seed": {".cursor/plugins/cache/cursor-public/evalfix/2a8044425c7bddf429c3bdedf3ab61e791d34d65/.cursor-plugin/plugin.json": "{\"name\":\"eval-gmail\"}\n", ".cursor/plugins/cache/cursor-public/evalfix/2a8044425c7bddf429c3bdedf3ab61e791d34d65/skills/plugin-secret/SKILL.md": "---\nname: plugin-secret\ndescription: load before using the plugin secret handshake\n---\n\n# Plugin Secret\n\nPLUGIN_SKILL_BODY_TOKEN_9f3a\n", ".cursor/skills-cursor/env-setup/SKILL.md": "---\nname: env-setup\ndescription: personal skills-cursor playbook that survives GRAFF_NO_PLUGINS\n---\n\n# Env Setup\n\nPERSONAL_SKILL_BODY_TOKEN_c2e1\n"}, "prompt": "list available skills, then load plugin-secret", "script": [{"tool": "load_tool_schemas", "arguments": {"tools": ["skill"]}}, {"tool": "skill", "arguments": {}}, {"tool": "skill", "arguments": {"name": "plugin-secret"}}, {"text": "loaded the plugin secret playbook"}], "assert": [{"request_contains": {"index": 0, "text": "plugin-secret (plugin)"}}, {"request_contains": {"index": 0, "text": "env-setup (personal)"}}, {"request_lacks": {"index": 0, "text": "PLUGIN_SKILL_BODY_TOKEN_9f3a"}}, {"request_lacks": {"index": 0, "text": "PERSONAL_SKILL_BODY_TOKEN_c2e1"}}, {"event": {"type": "tool_call", "name": "skill"}}, {"request_contains": {"index": -1, "text": "PLUGIN_SKILL_BODY_TOKEN_9f3a"}}, {"final_text_contains": "loaded the plugin secret playbook"}]}
{"id": "plugin-off-keeps-personal-skills", "why": "GRAFF_NO_PLUGINS must drop plugin-tree skills while ~/.cursor/skills-cursor stays personal. The regression is treating skills-cursor as a plugin (it vanishes) or ignoring the opt-out (plugin-secret still loads).", "args": [], "env": {"GRAFF_NO_PLUGINS": "1"}, "workspace_seed": {".cursor/plugins/cache/cursor-public/evalfix/2a8044425c7bddf429c3bdedf3ab61e791d34d65/.cursor-plugin/plugin.json": "{\"name\":\"eval-gmail\"}\n", ".cursor/plugins/cache/cursor-public/evalfix/2a8044425c7bddf429c3bdedf3ab61e791d34d65/skills/plugin-secret/SKILL.md": "---\nname: plugin-secret\ndescription: load before using the plugin secret handshake\n---\n\n# Plugin Secret\n\nPLUGIN_SKILL_BODY_TOKEN_9f3a\n", ".cursor/skills-cursor/env-setup/SKILL.md": "---\nname: env-setup\ndescription: personal skills-cursor playbook that survives GRAFF_NO_PLUGINS\n---\n\n# Env Setup\n\nPERSONAL_SKILL_BODY_TOKEN_c2e1\n"}, "prompt": "load the handshake playbook if it exists", "script": [{"tool": "skill", "arguments": {"name": "plugin-secret"}}, {"text": "plugin skill is gone; personal env-setup remains"}], "assert": [{"request_contains": {"index": 0, "text": "env-setup (personal)"}}, {"request_lacks": {"index": 0, "text": "plugin-secret"}}, {"request_lacks": {"index": 0, "text": "plugin-secret (plugin)"}}, {"request_lacks": {"index": 0, "text": "PLUGIN_SKILL_BODY_TOKEN_9f3a"}}, {"event": {"type": "tool_call", "name": "skill"}}, {"request_contains": {"index": -1, "text": "no skill named 'plugin-secret'"}}, {"final_text_contains": "plugin skill is gone"}]}
{"id": "workspace-list-use", "why": "ADR 0006: workspace is a folded tool that must list real git worktrees and chdir the session. A skill cannot move file-tool cwd; bash-cd is not enough. Guards load_tool_schemas unfold + use by folder name.", "args": [], "env": {"GRAFF_NO_CODEDB_GUARD": "1"}, "prompt": "create a feature worktree, list workspaces, switch into it", "script": [{"tool": "bash", "arguments": {"command": "git init && git config user.email eval@invalid && git config user.name Eval && echo x > README && git add README && git commit -m init && git worktree add wt-feature -b feature && echo seeded-worktree"}}, {"tool": "load_tool_schemas", "arguments": {"tools": ["workspace"]}}, {"tool": "workspace", "arguments": {"action": "list"}}, {"tool": "workspace", "arguments": {"action": "use", "path": "wt-feature"}}, {"tool": "bash", "arguments": {"command": "basename \"$(pwd)\""}}, {"text": "switched into wt-feature"}], "assert": [{"event": {"type": "tool_call", "name": "load_tool_schemas"}}, {"event": {"type": "tool_call", "name": "workspace"}}, {"request_contains": {"index": -1, "text": "wt-feature"}}, {"request_contains": {"index": -1, "text": "now at"}}, {"final_text_contains": "switched into wt-feature"}]}
+{"id": "plugin-command-as-skill", "why": "Claude plugins ship playbooks as commands/*.md, not only skills/. A Claude tree must appear in the skill catalog as (plugin) without the body, and skill name= loads it — the same first-class load Claude uses.", "args": [], "workspace_seed": {".claude/plugins/greet/.claude-plugin/plugin.json": "{\"name\":\"greet\"}\n", ".claude/plugins/greet/commands/hello.md": "---\nname: hello\ndescription: Claude command playbook for the handshake\n---\n\n# Hello\n\nCLAUDE_COMMAND_BODY_TOKEN_7c1e\n"}, "prompt": "list skills, then load the hello playbook", "script": [{"tool": "skill", "arguments": {}}, {"tool": "skill", "arguments": {"name": "hello"}}, {"text": "loaded the Claude command playbook"}], "assert": [{"request_contains": {"index": 0, "text": "hello (plugin)"}}, {"request_lacks": {"index": 0, "text": "CLAUDE_COMMAND_BODY_TOKEN_7c1e"}}, {"event": {"type": "tool_call", "name": "skill"}}, {"request_contains": {"index": -1, "text": "CLAUDE_COMMAND_BODY_TOKEN_7c1e"}}, {"final_text_contains": "loaded the Claude command playbook"}]}
diff --git a/evals/plugins_oob/README.md b/evals/plugins_oob/README.md
index 456d1e41..f8358989 100644
--- a/evals/plugins_oob/README.md
+++ b/evals/plugins_oob/README.md
@@ -20,8 +20,10 @@ What it guards:
- Plugin MCP names appear on `graff mcp list`.
- A graff global wins a shared name (plugin command must not leak).
+- Claude inline `mcpServers` land, and `${CLAUDE_PLUGIN_ROOT}` expands.
- `GRAFF_NO_PLUGINS=1` hides plugin and foreign-harness names only.
- `graff plugins` prints the manifest name, not the Cursor cache hash.
+- Claude `commands/` is listed; `graff plugins load eval-claude` names it.
- The same opt-out prints `GRAFF_NO_PLUGINS` on `graff plugins`.
MCP fixtures use `command: /bin/false` so a mistaken connect cannot hang on
diff --git a/evals/plugins_oob/run.py b/evals/plugins_oob/run.py
index 158f0977..59fb2fb1 100644
--- a/evals/plugins_oob/run.py
+++ b/evals/plugins_oob/run.py
@@ -15,7 +15,7 @@ ROOT = Path(__file__).resolve().parent
REPO = ROOT.parents[1]
CURSOR_HASH = "2a8044425c7bddf429c3bdedf3ab61e791d34d65"
-PLUGIN_ONLY = ("eval-gmail", "eval-claude", "from-cursor")
+PLUGIN_ONLY = ("eval-gmail", "eval-claude", "eval-inline", "from-cursor")
GRAFF_ONLY = ("from-graff",)
SHARED = "shared"
@@ -50,13 +50,27 @@ def seed_home(home: Path) -> None:
claude = home / ".claude/plugins/demo"
(claude / ".claude-plugin").mkdir(parents=True)
+ (claude / "commands").mkdir(parents=True)
(claude / ".claude-plugin/plugin.json").write_text(
- '{"name":"eval-claude"}\n', encoding="utf-8"
+ json.dumps(
+ {
+ "name": "eval-claude",
+ "mcpServers": {
+ "eval-inline": {"command": "${CLAUDE_PLUGIN_ROOT}/missing-bin"}
+ },
+ }
+ )
+ + "\n",
+ encoding="utf-8",
)
(claude / ".mcp.json").write_text(
json.dumps({"mcpServers": {"eval-claude": {"command": "/bin/false"}}}) + "\n",
encoding="utf-8",
)
+ (claude / "commands/hello.md").write_text(
+ "---\nname: hello\ndescription: Claude command playbook\n---\n\nHi.\n",
+ encoding="utf-8",
+ )
(home / ".cursor").mkdir(parents=True, exist_ok=True)
(home / ".cursor/mcp.json").write_text(
@@ -127,6 +141,10 @@ def assert_mcp_merged(text: str) -> None:
raise SystemExit(f"plugin command leaked onto shared:\n{text}")
if "graff-wins" not in text:
raise SystemExit(f"graff global lost the shared name:\n{text}")
+ if "${CLAUDE_PLUGIN_ROOT}" in text:
+ raise SystemExit(f"CLAUDE_PLUGIN_ROOT was not expanded:\n{text}")
+ if "missing-bin" not in text:
+ raise SystemExit(f"inline Claude mcpServers did not land:\n{text}")
def assert_mcp_opt_out(text: str) -> None:
@@ -149,6 +167,8 @@ def assert_plugins_named(text: str) -> None:
raise SystemExit(f"graff plugins missed the Claude plugin:\n{text}")
if "[cursor/user]" not in text or "[claude/user]" not in text:
raise SystemExit(f"origin tags missing:\n{text}")
+ if "commands" not in text:
+ raise SystemExit(f"Claude commands/ was not listed:\n{text}")
def self_test(graff: str) -> None:
@@ -173,6 +193,15 @@ def self_test(graff: str) -> None:
listed = expect_ok(run_graff(graff, ["plugins"], home, cwd), "graff plugins")
assert_plugins_named(listed)
+ loaded = expect_ok(
+ run_graff(graff, ["plugins", "load", "eval-claude"], home, cwd),
+ "graff plugins load eval-claude",
+ )
+ if "commands/*.md" not in loaded:
+ raise SystemExit(f"plugins load missed Claude commands:\n{loaded}")
+ if "eval-claude" not in loaded:
+ raise SystemExit(f"plugins load missed the plugin name:\n{loaded}")
+
disabled = expect_ok(
run_graff(graff, ["plugins"], home, cwd, {"GRAFF_NO_PLUGINS": "1"}),
"graff plugins (GRAFF_NO_PLUGINS)",
diff --git a/evals/plugins_oob/test_eval.py b/evals/plugins_oob/test_eval.py
index d3160473..7b6e351a 100644
--- a/evals/plugins_oob/test_eval.py
+++ b/evals/plugins_oob/test_eval.py
@@ -41,9 +41,10 @@ class PluginOobTests(unittest.TestCase):
def test_assertions_reject_the_wrong_listing(self) -> None:
good = (
- "5 MCP server(s):\n"
+ "6 MCP server(s):\n"
" eval-gmail: /bin/false\n"
" eval-claude: /bin/false\n"
+ " eval-inline: /home/demo/missing-bin\n"
" from-cursor: /bin/false\n"
" from-graff: /bin/true (global)\n"
" shared: /bin/true graff-wins (global)\n"
@@ -60,9 +61,9 @@ class PluginOobTests(unittest.TestCase):
with self.assertRaises(SystemExit):
assert_mcp_opt_out(good)
plugins = (
- "2 plugin(s) (in-place, not copied):\n"
+ "2 plugin(s) (in-place, Claude layout, not copied):\n"
f" eval-gmail [cursor/user] skills mcp /home/{CURSOR_HASH}\n"
- " eval-claude [claude/user] mcp /home/demo\n"
+ " eval-claude [claude/user] skills commands mcp /home/demo\n"
)
assert_plugins_named(plugins)
with self.assertRaises(SystemExit):
diff --git a/src/cli.zig b/src/cli.zig
index 8d7f31e0..8a3e677d 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -158,7 +158,7 @@ pub const usage_text =
\\ graff mcp add <name> --url <url> add a Streamable HTTP MCP server
\\ graff mcp login <name> OAuth login for a remote MCP server
\\ graff mcp list configured MCP servers
- \\ graff plugins list Cursor/Claude/Grok/Codex plugin trees (in place)
+ \\ graff plugins [load <name>] list Claude/Cursor/Grok/Codex plugin trees (in place)
\\ graff learn [help] local mutate/evaluate/promote/rollback engine
\\ graff worktree list list the per-tab worktrees created by -w
\\ graff worktree merge <name> squash-land worktree-<name> onto the current branch + clean up
diff --git a/src/command_catalog.zig b/src/command_catalog.zig
index 1bdbcdc1..268f8428 100644
--- a/src/command_catalog.zig
+++ b/src/command_catalog.zig
@@ -51,7 +51,7 @@ pub const commands = [_]Item{
.{ .name = "/trajectory", .desc = "show this session's agent tree — turns + spawned subagents" },
.{ .name = "/agents", .desc = "list agent types — builtin personas + .harness/agents/*.md" },
.{ .name = "/skills", .usage = "/skills [add|remove <name>]", .desc = "list SKILL.md playbooks + companion tools; add/remove enables or disables one" },
- .{ .name = "/plugins", .desc = "list Cursor/Claude/Grok/Codex plugin trees graff is reading in place" },
+ .{ .name = "/plugins", .usage = "/plugins [list|load <name>]", .desc = "list Claude/Cursor/Grok/Codex plugin trees graff is reading in place; load names one" },
.{ .name = "/hooks", .desc = "list lifecycle hooks and the built-in codedb guard" },
.{ .name = "/doctor", .desc = "read-only health check: goal/todo invariants, and why steering will or will not be appended" },
.{ .name = "/btw", .usage = "/btw <question>", .desc = "ask one side question about this conversation — no tools, billed, never added to the session" },
diff --git a/src/plugin_layout.zig b/src/plugin_layout.zig
new file mode 100644
index 00000000..b0243dd9
--- /dev/null
+++ b/src/plugin_layout.zig
@@ -0,0 +1,302 @@
+//! Claude-compatible plugin layout (ADR 0007).
+//!
+//! Claude Code auto-discovers `skills/`, `commands/` (flat markdown playbooks),
+//! `agents/`, `.mcp.json`, and a root `SKILL.md` when there is no `skills/`
+//! tree. The optional `.claude-plugin/plugin.json` (or Cursor/Grok sibling)
+//! may add extra paths or inline `mcpServers`. `${CLAUDE_PLUGIN_ROOT}` and
+//! `${CLAUDE_PROJECT_DIR}` expand in MCP command/args/env/url strings.
+//!
+//! Hooks, LSP, monitors, and `bin/` PATH injection are not applied.
+
+const std = @import("std");
+const Io = std.Io;
+const Value = std.json.Value;
+const Allocator = std.mem.Allocator;
+
+const file_cap: std.Io.Limit = .limited(1 << 20);
+const reserved = "smolify";
+
+const manifest_files = [_][]const u8{
+ ".claude-plugin/plugin.json",
+ ".cursor-plugin/plugin.json",
+ ".grok-plugin/plugin.json",
+ "plugin.json",
+};
+
+pub const RootSkill = struct {
+ path: []const u8,
+ name: []const u8,
+ dir: []const u8,
+};
+
+pub const Layout = struct {
+ skill_dirs: []const []const u8 = &.{},
+ agent_dirs: []const []const u8 = &.{},
+ root_skill: ?RootSkill = null,
+ has_commands: bool = false,
+ has_mcp: bool = false,
+};
+
+fn exists(io: Io, path: []const u8) bool {
+ return (Io.Dir.cwd().statFile(io, path, .{}) catch null) != null;
+}
+
+fn join(arena: Allocator, a: []const u8, b: []const u8) []const u8 {
+ return std.fmt.allocPrint(arena, "{s}/{s}", .{ a, b }) catch "";
+}
+
+fn existsJoin(io: Io, a: []const u8, b: []const u8) bool {
+ var buf: [std.fs.max_path_bytes]u8 = undefined;
+ const p = std.fmt.bufPrint(&buf, "{s}/{s}", .{ a, b }) catch return false;
+ return exists(io, p);
+}
+
+/// Refuse `..` so a manifest cannot walk out of the plugin tree.
+fn resolveRel(arena: Allocator, plugin_path: []const u8, rel: []const u8) ?[]const u8 {
+ var r = std.mem.trim(u8, rel, " \t");
+ if (std.mem.startsWith(u8, r, "./")) r = r[2..];
+ if (r.len == 0 or std.mem.eql(u8, r, ".")) return plugin_path;
+ if (std.mem.indexOf(u8, r, "..") != null) return null;
+ const out = join(arena, plugin_path, r);
+ return if (out.len > 0) out else null;
+}
+
+fn appendDir(arena: Allocator, list: *std.ArrayList([]const u8), io: Io, path: []const u8) void {
+ if (path.len == 0 or !exists(io, path)) return;
+ for (list.items) |have| if (std.mem.eql(u8, have, path)) return;
+ list.append(arena, path) catch {};
+}
+
+fn collectPaths(arena: Allocator, list: *std.ArrayList([]const u8), io: Io, plugin_path: []const u8, field: ?Value) void {
+ const v = field orelse return;
+ switch (v) {
+ .string => if (resolveRel(arena, plugin_path, v.string)) |p| appendDir(arena, list, io, p),
+ .array => for (v.array.items) |item| {
+ if (item == .string) if (resolveRel(arena, plugin_path, item.string)) |p| appendDir(arena, list, io, p);
+ },
+ else => {},
+ }
+}
+
+fn readManifest(io: Io, arena: Allocator, plugin_path: []const u8) ?Value {
+ for (manifest_files) |rel| {
+ const text = Io.Dir.cwd().readFileAlloc(io, join(arena, plugin_path, rel), arena, .limited(64 * 1024)) catch continue;
+ const v = std.json.parseFromSliceLeaky(Value, arena, text, .{ .allocate = .alloc_always }) catch continue;
+ if (v == .object) return v;
+ }
+ return null;
+}
+
+pub fn expandPlaceholders(arena: Allocator, text: []const u8, plugin_root: []const u8, project_dir: []const u8) []const u8 {
+ if (std.mem.indexOf(u8, text, "${CLAUDE_") == null) return text;
+ const step = std.mem.replaceOwned(u8, arena, text, "${CLAUDE_PLUGIN_ROOT}", plugin_root) catch text;
+ if (project_dir.len == 0) return step;
+ return std.mem.replaceOwned(u8, arena, step, "${CLAUDE_PROJECT_DIR}", project_dir) catch step;
+}
+
+fn expandValue(arena: Allocator, v: Value, plugin_root: []const u8, project_dir: []const u8) Value {
+ return switch (v) {
+ .string => .{ .string = expandPlaceholders(arena, v.string, plugin_root, project_dir) },
+ .object => blk: {
+ var out: std.json.ObjectMap = .empty;
+ var it = v.object.iterator();
+ while (it.next()) |e| {
+ out.put(arena, e.key_ptr.*, expandValue(arena, e.value_ptr.*, plugin_root, project_dir)) catch {};
+ }
+ break :blk .{ .object = out };
+ },
+ .array => blk: {
+ var out = std.json.Array.init(arena);
+ for (v.array.items) |item| out.append(expandValue(arena, item, plugin_root, project_dir)) catch {};
+ break :blk .{ .array = out };
+ },
+ else => v,
+ };
+}
+
+fn putServers(arena: Allocator, servers: *std.json.ObjectMap, found: *bool, v: ?Value) void {
+ const obj = if (v) |x| (if (x == .object) x.object else return) else return;
+ var it = obj.iterator();
+ while (it.next()) |e| {
+ if (std.mem.eql(u8, e.key_ptr.*, reserved)) continue;
+ if (servers.get(e.key_ptr.*) != null) continue;
+ if (e.value_ptr.* != .object) continue;
+ servers.put(arena, e.key_ptr.*, e.value_ptr.*) catch continue;
+ found.* = true;
+ }
+}
+
+fn ingestText(arena: Allocator, servers: *std.json.ObjectMap, found: *bool, text: []const u8, plugin_root: []const u8, project_dir: []const u8) void {
+ const parsed = std.json.parseFromSliceLeaky(Value, arena, text, .{ .allocate = .alloc_always }) catch return;
+ if (parsed != .object) return;
+ const expanded = expandValue(arena, parsed, plugin_root, project_dir);
+ if (expanded != .object) return;
+ if (expanded.object.get("mcpServers")) |inner| {
+ putServers(arena, servers, found, inner);
+ return;
+ }
+ // Inline `{ "name": { "command": ... } }` — Claude plugin.json shape.
+ putServers(arena, servers, found, expanded);
+}
+
+fn ingestFile(io: Io, arena: Allocator, servers: *std.json.ObjectMap, found: *bool, path: []const u8, plugin_root: []const u8, project_dir: []const u8) void {
+ const text = Io.Dir.cwd().readFileAlloc(io, path, arena, file_cap) catch return;
+ ingestText(arena, servers, found, text, plugin_root, project_dir);
+}
+
+fn ingestMcpField(io: Io, arena: Allocator, servers: *std.json.ObjectMap, found: *bool, plugin_path: []const u8, project_dir: []const u8, field: Value) void {
+ switch (field) {
+ .string => if (resolveRel(arena, plugin_path, field.string)) |p| ingestFile(io, arena, servers, found, p, plugin_path, project_dir),
+ .array => for (field.array.items) |item| {
+ if (item == .string) if (resolveRel(arena, plugin_path, item.string)) |p|
+ ingestFile(io, arena, servers, found, p, plugin_path, project_dir);
+ },
+ .object => {
+ const expanded = expandValue(arena, field, plugin_path, project_dir);
+ if (expanded.object.get("mcpServers")) |inner| {
+ putServers(arena, servers, found, inner);
+ } else {
+ putServers(arena, servers, found, expanded);
+ }
+ },
+ else => {},
+ }
+}
+
+/// Claude defaults plus any extra dirs the manifest names.
+pub fn inspect(io: Io, arena: Allocator, plugin_path: []const u8) Layout {
+ var skills: std.ArrayList([]const u8) = .empty;
+ var agents: std.ArrayList([]const u8) = .empty;
+ appendDir(arena, &skills, io, join(arena, plugin_path, "skills"));
+ const commands = join(arena, plugin_path, "commands");
+ const has_commands = exists(io, commands);
+ if (has_commands) appendDir(arena, &skills, io, commands);
+ appendDir(arena, &agents, io, join(arena, plugin_path, "agents"));
+
+ const manifest = readManifest(io, arena, plugin_path);
+ if (manifest) |v| {
+ collectPaths(arena, &skills, io, plugin_path, v.object.get("skills"));
+ collectPaths(arena, &skills, io, plugin_path, v.object.get("commands"));
+ collectPaths(arena, &agents, io, plugin_path, v.object.get("agents"));
+ }
+
+ var root_skill: ?RootSkill = null;
+ if (skills.items.len == 0 and existsJoin(io, plugin_path, "SKILL.md")) {
+ const name = if (manifest) |v| blk: {
+ if (v.object.get("name")) |n| if (n == .string and n.string.len > 0) break :blk n.string;
+ break :blk std.fs.path.basename(plugin_path);
+ } else std.fs.path.basename(plugin_path);
+ root_skill = .{
+ .path = join(arena, plugin_path, "SKILL.md"),
+ .name = name,
+ .dir = plugin_path,
+ };
+ }
+
+ const has_mcp = existsJoin(io, plugin_path, ".mcp.json") or existsJoin(io, plugin_path, "mcp.json") or
+ (if (manifest) |v| v.object.get("mcpServers") != null else false);
+
+ return .{
+ .skill_dirs = skills.items,
+ .agent_dirs = agents.items,
+ .root_skill = root_skill,
+ .has_commands = has_commands,
+ .has_mcp = has_mcp,
+ };
+}
+
+/// Fill missing MCP names from Claude/Cursor default files and the manifest.
+pub fn mergeMcp(io: Io, arena: Allocator, plugin_path: []const u8, project_dir: []const u8, servers: *std.json.ObjectMap, found: *bool) void {
+ ingestFile(io, arena, servers, found, join(arena, plugin_path, ".mcp.json"), plugin_path, project_dir);
+ ingestFile(io, arena, servers, found, join(arena, plugin_path, "mcp.json"), plugin_path, project_dir);
+ if (readManifest(io, arena, plugin_path)) |v| {
+ if (v.object.get("mcpServers")) |field|
+ ingestMcpField(io, arena, servers, found, plugin_path, project_dir, field);
+ }
+}
+
+const testing = std.testing;
+
+fn tmpBase(io: Io, tmp: *testing.TmpDir, arena: Allocator) ![]const u8 {
+ var buf: [std.fs.max_path_bytes]u8 = undefined;
+ const n = try tmp.dir.realPath(io, &buf);
+ return arena.dupe(u8, buf[0..n]);
+}
+
+test "inspect: commands/ and root SKILL.md follow Claude defaults" {
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena_state.deinit();
+ const arena = arena_state.allocator();
+ const io = testing.io;
+ const base = try tmpBase(io, &tmp, arena);
+ const plug = join(arena, base, "greet");
+ try Io.Dir.cwd().createDirPath(io, join(arena, plug, ".claude-plugin"));
+ try Io.Dir.cwd().createDirPath(io, join(arena, plug, "commands"));
+ try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, plug, ".claude-plugin/plugin.json"), .data = "{\"name\":\"greet\"}" });
+ try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, plug, "commands/hello.md"), .data = "---\nname: hello\ndescription: say hi\n---\nHi.\n" });
+
+ const lay = inspect(io, arena, plug);
+ try testing.expect(lay.has_commands);
+ try testing.expectEqual(@as(usize, 1), lay.skill_dirs.len);
+ try testing.expect(std.mem.endsWith(u8, lay.skill_dirs[0], "commands"));
+ try testing.expect(lay.root_skill == null);
+
+ const lone = join(arena, base, "solo");
+ try Io.Dir.cwd().createDirPath(io, join(arena, lone, ".claude-plugin"));
+ try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, lone, ".claude-plugin/plugin.json"), .data = "{\"name\":\"solo\"}" });
+ try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, lone, "SKILL.md"), .data = "---\nname: solo\ndescription: one playbook\n---\nDo the thing.\n" });
+ const lone_lay = inspect(io, arena, lone);
+ try testing.expect(lone_lay.root_skill != null);
+ try testing.expectEqualStrings("solo", lone_lay.root_skill.?.name);
+ try testing.expectEqual(@as(usize, 0), lone_lay.skill_dirs.len);
+}
+
+test "mergeMcp: inline servers expand CLAUDE_PLUGIN_ROOT; extra file paths work" {
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena_state.deinit();
+ const arena = arena_state.allocator();
+ const io = testing.io;
+ const base = try tmpBase(io, &tmp, arena);
+ const plug = join(arena, base, "pack");
+ try Io.Dir.cwd().createDirPath(io, join(arena, plug, ".claude-plugin"));
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, plug, ".claude-plugin/plugin.json"),
+ .data = "{\"name\":\"pack\",\"mcpServers\":{\"inline\":{\"command\":\"${CLAUDE_PLUGIN_ROOT}/bin/tool\"}}}",
+ });
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, plug, "extra-mcp.json"),
+ .data = "{\"mcpServers\":{\"from-extra\":{\"command\":\"/bin/false\"}}}",
+ });
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, plug, ".claude-plugin/plugin.json"),
+ .data = "{\"name\":\"pack\",\"mcpServers\":[\"./extra-mcp.json\"]}",
+ });
+
+ var servers: std.json.ObjectMap = .empty;
+ var found = false;
+ mergeMcp(io, arena, plug, base, &servers, &found);
+ try testing.expect(found);
+ try testing.expect(servers.get("from-extra") != null);
+
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, plug, ".claude-plugin/plugin.json"),
+ .data = "{\"name\":\"pack\",\"mcpServers\":{\"inline\":{\"command\":\"${CLAUDE_PLUGIN_ROOT}/bin/tool\"}}}",
+ });
+ servers = .empty;
+ found = false;
+ mergeMcp(io, arena, plug, base, &servers, &found);
+ const cmd = servers.get("inline").?.object.get("command").?.string;
+ try testing.expect(std.mem.endsWith(u8, cmd, "pack/bin/tool"));
+ try testing.expect(std.mem.indexOf(u8, cmd, "${CLAUDE_") == null);
+}
+
+test "resolveRel refuses parent-directory escapes" {
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena_state.deinit();
+ try testing.expect(resolveRel(arena_state.allocator(), "/plugins/demo", "../secret") == null);
+ try testing.expectEqualStrings("/plugins/demo/commands", resolveRel(arena_state.allocator(), "/plugins/demo", "./commands").?);
+}
diff --git a/src/plugins.zig b/src/plugins.zig
index 1bfef185..eb875d35 100644
--- a/src/plugins.zig
+++ b/src/plugins.zig
@@ -12,6 +12,7 @@ const std = @import("std");
const Io = std.Io;
const Value = std.json.Value;
const Allocator = std.mem.Allocator;
+const layout = @import("plugin_layout.zig");
const plugin_cap = 32;
const walk_depth: u8 = 4;
@@ -27,6 +28,7 @@ pub const Plugin = struct {
skills: bool = false,
agents: bool = false,
mcp: bool = false,
+ commands: bool = false,
};
fn off() bool {
@@ -69,7 +71,9 @@ fn isPlugin(io: Io, path: []const u8) bool {
existsJoin(io, path, ".mcp.json") or
existsJoin(io, path, "mcp.json") or
existsJoin(io, path, "skills") or
- existsJoin(io, path, "agents");
+ existsJoin(io, path, "agents") or
+ existsJoin(io, path, "commands") or
+ existsJoin(io, path, "SKILL.md");
}
fn hasMcp(io: Io, path: []const u8) bool {
@@ -92,16 +96,16 @@ fn walk(io: Io, arena: Allocator, list: *std.ArrayList(Plugin), path: []const u8
var dir = Io.Dir.cwd().openDir(io, path, .{ .iterate = true }) catch return;
defer dir.close(io);
if (isPlugin(io, path)) {
- const skills_p = join(arena, path, "skills");
- const agents_p = join(arena, path, "agents");
+ const lay = layout.inspect(io, arena, path);
list.append(arena, .{
.name = pluginName(io, arena, path),
.path = path,
.origin = origin,
.personal = personal,
- .skills = exists(io, skills_p),
- .agents = exists(io, agents_p),
- .mcp = hasMcp(io, path),
+ .skills = lay.skill_dirs.len > 0 or lay.root_skill != null,
+ .agents = lay.agent_dirs.len > 0,
+ .mcp = lay.has_mcp or hasMcp(io, path),
+ .commands = lay.has_commands,
}) catch {};
return; // do not treat a plugin's skills/ as a nested plugin
}
@@ -164,9 +168,17 @@ pub fn discover(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Dir) []
pub fn skillDirs(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Dir, personal: bool) []const []const u8 {
var out: std.ArrayList([]const u8) = .empty;
for (discover(io, arena, home, project)) |p| {
- if (p.personal != personal or !p.skills) continue;
- const d = join(arena, p.path, "skills");
- if (d.len > 0) out.append(arena, d) catch {};
+ if (p.personal != personal) continue;
+ for (layout.inspect(io, arena, p.path).skill_dirs) |d| out.append(arena, d) catch {};
+ }
+ return out.items;
+}
+
+pub fn rootSkills(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Dir, personal: bool) []const layout.RootSkill {
+ var out: std.ArrayList(layout.RootSkill) = .empty;
+ for (discover(io, arena, home, project)) |p| {
+ if (p.personal != personal) continue;
+ if (layout.inspect(io, arena, p.path).root_skill) |rs| out.append(arena, rs) catch {};
}
return out.items;
}
@@ -174,9 +186,8 @@ pub fn skillDirs(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Dir, p
pub fn agentDirs(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Dir, personal: bool) []const []const u8 {
var out: std.ArrayList([]const u8) = .empty;
for (discover(io, arena, home, project)) |p| {
- if (p.personal != personal or !p.agents) continue;
- const d = join(arena, p.path, "agents");
- if (d.len > 0) out.append(arena, d) catch {};
+ if (p.personal != personal) continue;
+ for (layout.inspect(io, arena, p.path).agent_dirs) |d| out.append(arena, d) catch {};
}
return out.items;
}
@@ -227,15 +238,11 @@ fn takeRel(io: Io, arena: Allocator, dir: Io.Dir, servers: *std.json.ObjectMap,
/// Later-wins stays with those files: this only inserts missing names.
pub fn mergeMcp(io: Io, arena: Allocator, home: []const u8, dir: Io.Dir, servers: *std.json.ObjectMap, found: *bool) void {
if (off()) return;
- const plugs = discover(io, arena, if (home.len > 0) home else null, dir);
- for (plugs) |p| {
- takeAbs(io, arena, servers, found, join(arena, p.path, ".mcp.json"), null);
- takeAbs(io, arena, servers, found, join(arena, p.path, "mcp.json"), null);
- }
-
var buf: [std.fs.max_path_bytes]u8 = undefined;
const n = dir.realPath(io, &buf) catch 0;
const cwd = if (n > 0) buf[0..n] else null;
+ const plugs = discover(io, arena, if (home.len > 0) home else null, dir);
+ for (plugs) |p| layout.mergeMcp(io, arena, p.path, cwd orelse "", servers, found);
if (home.len > 0) {
takeAbs(io, arena, servers, found, join(arena, home, ".claude.json"), cwd);
takeAbs(io, arena, servers, found, join(arena, home, ".claude/settings.json"), null);
@@ -261,30 +268,55 @@ pub fn slashCommand(io: Io, arena: Allocator, home: []const u8, line: []const u8
try out.flush();
return true;
}
+ const rest = std.mem.trim(u8, line["/plugins".len..], " \t");
const list = discover(io, arena, if (home.len > 0) home else null, Io.Dir.cwd());
+ if (std.mem.startsWith(u8, rest, "load ")) {
+ const want = std.mem.trim(u8, rest["load ".len..], " \t");
+ for (list) |p| {
+ if (!std.ascii.eqlIgnoreCase(p.name, want)) continue;
+ const lay = layout.inspect(io, arena, p.path);
+ try out.print("{s} [{s}/{s}] {s}\n", .{ p.name, p.origin, if (p.personal) "user" else "project", p.path });
+ if (lay.has_commands) try out.writeAll(" commands/*.md load as skills (Claude default)\n");
+ if (lay.root_skill) |rs| try out.print(" root skill: {s}\n", .{rs.name});
+ if (p.skills) try out.writeAll(" skills: on-demand via the skill tool / /skills\n");
+ if (p.agents) try out.writeAll(" agents: in the fleet\n");
+ if (p.mcp) try out.writeAll(" mcp: in the merge (needs /mcp trust or --yolo)\n");
+ try out.writeAll("hooks are not run.\n");
+ try out.flush();
+ return true;
+ }
+ try out.print("no plugin named '{s}'. /plugins lists what graff is reading.\n", .{want});
+ try out.flush();
+ return true;
+ }
if (list.len == 0) {
- try out.writeAll("no plugins discovered. graff reads Cursor/Claude/Grok/Codex plugin trees in place (skills/, agents/, mcp.json). nothing to copy; GRAFF_NO_PLUGINS=1 disables.\n");
+ try out.writeAll("no plugins discovered. graff reads Claude/Cursor/Grok/Codex trees in place (skills/, commands/, agents/, mcp.json, root SKILL.md). nothing to copy; GRAFF_NO_PLUGINS=1 disables.\n");
try out.flush();
return true;
}
- try out.print("{d} plugin(s) (in-place, not copied):\n", .{list.len});
+ try out.print("{d} plugin(s) (in-place, Claude layout, not copied):\n", .{list.len});
for (list) |p| {
try out.print(" {s} [{s}/{s}]", .{ p.name, p.origin, if (p.personal) "user" else "project" });
if (p.skills) try out.writeAll(" skills");
+ if (p.commands) try out.writeAll(" commands");
if (p.agents) try out.writeAll(" agents");
if (p.mcp) try out.writeAll(" mcp");
try out.print(" {s}\n", .{p.path});
}
- try out.writeAll("skills load on demand (skill tool / /skills). MCP still needs /mcp trust or --yolo.\n");
+ try out.writeAll("skills and commands/*.md load on demand (skill tool / /skills). /plugins load <name> shows one. MCP still needs /mcp trust or --yolo.\n");
try out.flush();
return true;
}
/// `graff plugins` — same listing as `/plugins`, without starting a session.
-pub fn command(io: Io, arena: Allocator, home: []const u8) !void {
+pub fn command(io: Io, arena: Allocator, home: []const u8, args: []const []const u8) !void {
var obuf: [4096]u8 = undefined;
var out = Io.File.stdout().writer(io, &obuf);
- _ = try slashCommand(io, arena, home, "/plugins", &out.interface);
+ const line = if (args.len >= 2 and std.mem.eql(u8, args[0], "load"))
+ std.fmt.allocPrint(arena, "/plugins load {s}", .{args[1]}) catch "/plugins"
+ else
+ "/plugins";
+ _ = try slashCommand(io, arena, home, line, &out.interface);
}
const testing = std.testing;
@@ -295,6 +327,30 @@ fn tmpBase(io: Io, tmp: *testing.TmpDir, arena: Allocator) ![]const u8 {
return arena.dupe(u8, buf[0..n]);
}
+test "discover: Claude commands/ alone is a plugin and a skill dir" {
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena_state.deinit();
+ const arena = arena_state.allocator();
+ const io = testing.io;
+ const base = try tmpBase(io, &tmp, arena);
+ const home = join(arena, base, "home");
+ const plug = join(arena, home, ".claude/plugins/greet");
+ try Io.Dir.cwd().createDirPath(io, join(arena, plug, ".claude-plugin"));
+ try Io.Dir.cwd().createDirPath(io, join(arena, plug, "commands"));
+ try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, plug, ".claude-plugin/plugin.json"), .data = "{\"name\":\"greet\"}" });
+ try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, plug, "commands/hello.md"), .data = "---\nname: hello\ndescription: d\n---\nHi.\n" });
+
+ const list = discover(io, arena, home, tmp.dir);
+ try testing.expectEqual(@as(usize, 1), list.len);
+ try testing.expect(list[0].commands);
+ try testing.expect(list[0].skills);
+ const dirs = skillDirs(io, arena, home, tmp.dir, true);
+ try testing.expectEqual(@as(usize, 1), dirs.len);
+ try testing.expect(std.mem.endsWith(u8, dirs[0], "commands"));
+}
+
test "discover: a Claude plugin.json tree is a plugin; marketplaces are not" {
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
diff --git a/src/skill_docs.zig b/src/skill_docs.zig
index 01061ce8..7bed82e7 100644
--- a/src/skill_docs.zig
+++ b/src/skill_docs.zig
@@ -66,7 +66,7 @@ const desc_cap = 160; // per-skill description budget in the system prompt — t
/// a schema.ToolSpec) so schema.zig's catalog needs one entry and no import
/// cycle. The description must stay free of characters needing JSON escapes.
pub const tool_name = "skill";
-pub const tool_desc = "Load a skill: the full instructions for one kind of task, kept out of your context until you need them. The system prompt lists only skill names and descriptions, so call this to read the body BEFORE doing work a skill covers, then follow it. Omit name to list every available skill. Skills come from .harness/skills/, ~/.harness/skills/, .claude/skills/, Cursor/Claude/Grok/Codex plugin trees, plus bundled skill-creator, mcp-config, jspace, and workspace.";
+pub const tool_desc = "Load a skill: the full instructions for one kind of task, kept out of your context until you need them. The system prompt lists only skill names and descriptions, so call this to read the body BEFORE doing work a skill covers, then follow it. Omit name to list every available skill. Skills come from .harness/skills/, ~/.harness/skills/, .claude/skills/, Cursor/Claude/Grok/Codex plugin trees (including Claude commands/*.md and a root SKILL.md), plus bundled skill-creator, mcp-config, jspace, and workspace.";
pub const tool_schema =
\\{"type": "object", "properties": {"name": {"type": "string", "description": "Skill name to load; omit to list every available skill"}}}
;
@@ -167,11 +167,13 @@ fn collect(io: Io, arena: Allocator, home: ?[]const u8) std.ArrayList(Skill) {
loadDir(io, arena, &list, path, .personal);
};
for (plugins.skillDirs(io, arena, home, Io.Dir.cwd(), true)) |d| loadDir(io, arena, &list, d, .plugin);
+ for (plugins.rootSkills(io, arena, home, Io.Dir.cwd(), true)) |rs| mergeFile(io, arena, &list, rs.dir, rs.path, rs.name, .plugin);
loadDir(io, arena, &list, compat_dir, .project);
loadDir(io, arena, &list, ".grok/skills", .project);
loadDir(io, arena, &list, ".codex/skills", .project);
loadDir(io, arena, &list, ".cursor/skills", .project);
for (plugins.skillDirs(io, arena, home, Io.Dir.cwd(), false)) |d| loadDir(io, arena, &list, d, .plugin);
+ for (plugins.rootSkills(io, arena, home, Io.Dir.cwd(), false)) |rs| mergeFile(io, arena, &list, rs.dir, rs.path, rs.name, .plugin);
loadDir(io, arena, &list, project_dir, .project);
return list;
}
diff --git a/src/startup.zig b/src/startup.zig
index cefcac56..49a1ffd8 100644
--- a/src/startup.zig
+++ b/src/startup.zig
@@ -229,7 +229,7 @@ pub fn runSubcommand(io: Io, gpa: Allocator, arena: Allocator, init: std.process
if (flags.positionals.items.len > 0 and std.mem.eql(u8, flags.positionals.items[0], "plugins")) {
const home = keys_cli.homeEnv(init.environ_map) orelse "";
plugins.applyEnv(init.environ_map);
- try plugins.command(io, arena, home);
+ try plugins.command(io, arena, home, flags.positionals.items[1..]);
return true;
}
diff --git a/src/test_hooks.zig b/src/test_hooks.zig
index 071a4b8c..802e247e 100644
--- a/src/test_hooks.zig
+++ b/src/test_hooks.zig
@@ -128,6 +128,7 @@ const peer_inbox = @import("peer_inbox.zig"); // Claude-style list/inbox pull
const peer_target = @import("peer_target.zig"); // exact DM / goal targeting
const workspace_switch = @import("workspace_switch.zig"); // ADR 0006 mid-session worktree switch
const plugins = @import("plugins.zig"); // ADR 0007 in-place plugin / foreign MCP discovery
+const plugin_layout = @import("plugin_layout.zig"); // Claude commands/ + inline MCP + ${CLAUDE_PLUGIN_ROOT}
// #345: the global-vs-project MCP config merge. mcp.zig does reference its
// decls, but the hook makes the coverage explicit rather than contingent on
@@ -261,6 +262,7 @@ test {
_ = peer_target;
_ = workspace_switch;
_ = plugins;
+ _ = plugin_layout;
_ = shutdown_trace;
_ = credential_store;
_ = engine_events;