Skip to content

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

Python

perf(plugins): resolve Codex cache from config.toml

Cursor Agentf68db3933722
diff --git a/docs/adr/0007-plugins-are-read-in-place.md b/docs/adr/0007-plugins-are-read-in-place.md
index 7dd6a7bd..fbad83c4 100644
--- a/docs/adr/0007-plugins-are-read-in-place.md
+++ b/docs/adr/0007-plugins-are-read-in-place.md
@@ -22,9 +22,11 @@ config.
globs named skill trees; grok-build lists immediate children). `cache/` and
`marketplaces/` are not walked. Cache installs come from Claude/Cursor
`installed_plugins.json` `installPath` entries, the same index grok-build
- reads. Codex installs live under `~/.codex/plugins/cache/` via its store,
- not a walk; we take `.codex/plugins/installed_plugins.json` when present
- and recognize `.codex-plugin/plugin.json` first (Codex's manifest order).
+ reads. Codex does not write that file: enabled ids in `~/.codex/config.toml`
+ (`[plugins."name@marketplace"]`) resolve to
+ `plugins/cache/<marketplace>/<name>/<version>` (prefer `local`, else the
+ last sorted version). We still recognize `.codex-plugin/plugin.json` first
+ (Codex's manifest order) and do not list the cache tree.
A directory is a plugin if it has `.codex-plugin/plugin.json`,
`.cursor-plugin/plugin.json`,
`.claude-plugin/plugin.json`, `.grok-plugin/plugin.json`, `plugin.json`,
@@ -64,7 +66,7 @@ config.
list still rescans without rewriting the prefix.
Production caches the first walk (MCP + fleet + skills share it); tests
do not. `/plugins` and the interactive boot line print wall time so a
- slow home directory is visible. A plugin that lives only under `cache/`
- and is missing from `installed_plugins.json` is invisible until the other
- harness records it — same as grok-build.
+ slow home directory is visible. A plugin that lives only under `cache/`
+ and is missing from `installed_plugins.json` (Claude/Cursor) or
+ `config.toml` (Codex) is invisible until the other harness records it.
- Revisit if a user needs to disable one plugin without `GRAFF_NO_PLUGINS`.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index e78e0920..cf85a8a1 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -17,7 +17,7 @@ record only when you need the evidence or the edge cases.
| [0004](0004-peer-speech-is-a-working-set.md) | Peer speech is pull: a one-line `[peer]` wake in history, bodies in the inbox ring; compact drops spent injects and never treats them as the human. |
| [0005](0005-standing-goal-lives-in-the-prefix.md) | Standing goal is one prefix line; the user-message essay injects on change only, never every N turns. |
| [0006](0006-workspace-switch-is-a-tool.md) | Mid-session worktree switch is a real `workspace` tool; a skill cannot move file-tool cwd. |
-| [0007](0007-plugins-are-read-in-place.md) | Cursor/Claude/Grok/Codex plugins and MCP are read in place (cache via installed_plugins.json, never walked); skills stay on-demand; MCP stays consent-gated. |
+| [0007](0007-plugins-are-read-in-place.md) | Cursor/Claude/Grok/Codex plugins and MCP are read in place (Claude/Cursor cache via installed_plugins.json, Codex via config.toml PluginStore, never walked); skills stay on-demand; MCP stays consent-gated. |
| [0008](0008-synthetic-evals-use-external-verifiers.md) | Synthetic coding evals promote only external-verifier passes; model judges may tiebreak correctness, never decide it. |
## When to write one
diff --git a/src/plugin_codex.zig b/src/plugin_codex.zig
new file mode 100644
index 00000000..60ebfa24
--- /dev/null
+++ b/src/plugin_codex.zig
@@ -0,0 +1,291 @@
+//! Codex PluginStore (ADR 0007).
+//!
+//! Codex never writes `installed_plugins.json` and never lists `plugins/cache/`.
+//! Enabled ids in `config.toml` (`[plugins."name@marketplace"]`) resolve to
+//! `plugins/cache/<marketplace>/<name>/<version>`. Prefer version `local`,
+//! else the last sorted version dir. Disabled and invalid keys are skipped.
+//!
+//! Skill bodies stay off the system-prompt prefix (prompt-cache max): this
+//! module only yields install roots; `skill_docs.promptCatalog` prints names.
+
+const std = @import("std");
+const Io = std.Io;
+const Allocator = std.mem.Allocator;
+const plugin_index = @import("plugin_index.zig");
+
+pub const Entry = plugin_index.Entry;
+
+const file_cap: std.Io.Limit = .limited(1 << 20);
+const cap = 32;
+
+const Key = struct {
+ name: []const u8,
+ marketplace: []const u8,
+ enabled: bool,
+};
+
+/// `codex_home` is `~/.codex` or `<cwd>/.codex`. Empty on missing config.
+pub fn load(io: Io, arena: Allocator, codex_home: []const u8) []const Entry {
+ if (codex_home.len == 0) return &.{};
+ const toml_path = std.fmt.allocPrint(arena, "{s}/config.toml", .{codex_home}) catch return &.{};
+ const text = Io.Dir.cwd().readFileAlloc(io, toml_path, arena, file_cap) catch return &.{};
+ var out: std.ArrayList(Entry) = .empty;
+ for (keys(arena, text)) |k| {
+ if (!k.enabled or out.items.len >= cap) continue;
+ const path = activeRoot(io, arena, codex_home, k.name, k.marketplace) orelse continue;
+ out.append(arena, .{ .name = k.name, .path = path }) catch {};
+ }
+ return out.items;
+}
+
+fn keys(arena: Allocator, text: []const u8) []const Key {
+ var out: std.ArrayList(Key) = .empty;
+ var current: ?usize = null;
+ var inline_plugins = false;
+ var lines = std.mem.splitScalar(u8, text, '\n');
+ while (lines.next()) |raw| {
+ const line = stripComment(raw);
+ if (line.len == 0) continue;
+ if (line[0] == '[') {
+ current = null;
+ inline_plugins = false;
+ const inner = tableName(line) orelse continue;
+ if (std.mem.eql(u8, inner, "plugins")) {
+ inline_plugins = true;
+ continue;
+ }
+ const key = pluginTableKey(inner) orelse continue;
+ const id = parseId(key) orelse continue;
+ if (out.items.len >= cap) continue;
+ out.append(arena, .{ .name = id.name, .marketplace = id.marketplace, .enabled = true }) catch continue;
+ current = out.items.len - 1;
+ continue;
+ }
+ if (inline_plugins) {
+ const ik = inlineKey(line) orelse continue;
+ const id = parseId(ik.key) orelse continue;
+ if (out.items.len >= cap) continue;
+ out.append(arena, .{ .name = id.name, .marketplace = id.marketplace, .enabled = ik.enabled }) catch {};
+ continue;
+ }
+ if (current) |i| {
+ if (enabledLine(line)) |en| out.items[i].enabled = en;
+ }
+ }
+ return out.items;
+}
+
+fn stripComment(line: []const u8) []const u8 {
+ const hash = std.mem.indexOfScalar(u8, line, '#') orelse return std.mem.trim(u8, line, " \t\r");
+ if (std.mem.indexOfScalar(u8, line[0..hash], '"') != null) return std.mem.trim(u8, line, " \t\r");
+ return std.mem.trim(u8, line[0..hash], " \t\r");
+}
+
+fn tableName(line: []const u8) ?[]const u8 {
+ if (line.len < 3 or line[0] != '[' or line[line.len - 1] != ']') return null;
+ return std.mem.trim(u8, line[1 .. line.len - 1], " \t");
+}
+
+fn pluginTableKey(inner: []const u8) ?[]const u8 {
+ const prefix = "plugins.";
+ if (!std.mem.startsWith(u8, inner, prefix)) return null;
+ return unquote(inner[prefix.len..]);
+}
+
+fn unquote(s: []const u8) []const u8 {
+ const t = std.mem.trim(u8, s, " \t");
+ if (t.len >= 2 and ((t[0] == '"' and t[t.len - 1] == '"') or (t[0] == '\'' and t[t.len - 1] == '\'')))
+ return t[1 .. t.len - 1];
+ return t;
+}
+
+fn parseId(key: []const u8) ?struct { name: []const u8, marketplace: []const u8 } {
+ const at = std.mem.lastIndexOfScalar(u8, key, '@') orelse return null;
+ const name = key[0..at];
+ const marketplace = key[at + 1 ..];
+ if (!validName(name) or !validMarketplace(marketplace)) return null;
+ return .{ .name = name, .marketplace = marketplace };
+}
+
+fn validName(s: []const u8) bool {
+ if (s.len == 0 or std.mem.eql(u8, s, ".") or std.mem.eql(u8, s, "..")) return false;
+ if (s[0] == '.' or s[s.len - 1] == '.' or std.mem.indexOf(u8, s, "..") != null) return false;
+ for (s) |c| {
+ if (!std.ascii.isAlphanumeric(c) and c != '-' and c != '_' and c != '.') return false;
+ }
+ return true;
+}
+
+fn validMarketplace(s: []const u8) bool {
+ if (s.len == 0) return false;
+ for (s) |c| {
+ if (!std.ascii.isAlphanumeric(c) and c != '-' and c != '_') return false;
+ }
+ return true;
+}
+
+fn validVersion(s: []const u8) bool {
+ if (s.len == 0 or std.mem.eql(u8, s, ".") or std.mem.eql(u8, s, "..")) return false;
+ for (s) |c| {
+ if (!std.ascii.isAlphanumeric(c) and c != '-' and c != '_' and c != '.' and c != '+') return false;
+ }
+ return true;
+}
+
+fn enabledLine(line: []const u8) ?bool {
+ if (!std.mem.startsWith(u8, line, "enabled")) return null;
+ const rest = std.mem.trim(u8, line["enabled".len..], " \t");
+ if (rest.len == 0 or rest[0] != '=') return null;
+ const val = std.mem.trim(u8, rest[1..], " \t");
+ if (std.mem.startsWith(u8, val, "false")) return false;
+ if (std.mem.startsWith(u8, val, "true")) return true;
+ return null;
+}
+
+fn inlineKey(line: []const u8) ?struct { key: []const u8, enabled: bool } {
+ const eq = std.mem.indexOfScalar(u8, line, '=') orelse return null;
+ const key = unquote(line[0..eq]);
+ if (std.mem.indexOfScalar(u8, key, '@') == null) return null;
+ const rhs = line[eq + 1 ..];
+ const enabled = if (std.mem.indexOf(u8, rhs, "enabled")) |i|
+ std.mem.indexOf(u8, rhs[i..], "false") == null
+ else
+ true;
+ return .{ .key = key, .enabled = enabled };
+}
+
+fn activeRoot(io: Io, arena: Allocator, home: []const u8, name: []const u8, marketplace: []const u8) ?[]const u8 {
+ const base = std.fmt.allocPrint(arena, "{s}/plugins/cache/{s}/{s}", .{ home, marketplace, name }) catch return null;
+ var dir = Io.Dir.cwd().openDir(io, base, .{ .iterate = true }) catch return null;
+ defer dir.close(io);
+ var names: std.ArrayList([]const u8) = .empty;
+ var it = dir.iterate();
+ while (it.next(io) catch null) |e| {
+ if (e.kind != .directory and e.kind != .sym_link) continue;
+ if (!validVersion(e.name)) continue;
+ names.append(arena, arena.dupe(u8, e.name) catch continue) catch continue;
+ }
+ var best: ?[]const u8 = null;
+ for (names.items) |n| {
+ if (std.mem.eql(u8, n, "local")) return std.fmt.allocPrint(arena, "{s}/local", .{base}) catch null;
+ if (best == null or std.mem.order(u8, n, best.?) == .gt) best = n;
+ }
+ const ver = best orelse return null;
+ return std.fmt.allocPrint(arena, "{s}/{s}", .{ base, ver }) catch null;
+}
+
+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]);
+}
+
+fn join(arena: Allocator, a: []const u8, b: []const u8) []const u8 {
+ return std.fmt.allocPrint(arena, "{s}/{s}", .{ a, b }) catch "";
+}
+
+test "load: config.toml enabled id resolves cache version; disabled and decoys stay invisible" {
+ 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 home = try tmpBase(io, &tmp, arena);
+ const pack = join(arena, home, "plugins/cache/official/pack/local");
+ const decoy = join(arena, home, "plugins/cache/official/decoy/local");
+ const old = join(arena, home, "plugins/cache/official/pack/1.0.0");
+ try Io.Dir.cwd().createDirPath(io, join(arena, pack, ".codex-plugin"));
+ try Io.Dir.cwd().createDirPath(io, join(arena, decoy, "skills"));
+ try Io.Dir.cwd().createDirPath(io, old);
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, home, "config.toml"),
+ .data =
+ \\[plugins."pack@official"]
+ \\enabled = true
+ \\
+ \\[plugins."decoy@official"]
+ \\enabled = false
+ \\
+ \\[plugins.invalid]
+ \\enabled = true
+ \\
+ \\[plugins."missing@official"]
+ \\enabled = true
+ ,
+ });
+
+ try testing.expectEqual(@as(usize, 0), load(io, arena, join(arena, home, "nope")).len);
+
+ const got = load(io, arena, home);
+ try testing.expectEqual(@as(usize, 1), got.len);
+ try testing.expectEqualStrings("pack", got[0].name);
+ try testing.expect(std.mem.endsWith(u8, got[0].path, "official/pack/local"));
+}
+
+test "load: inline [plugins] table and newest version when local is absent" {
+ 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 home = try tmpBase(io, &tmp, arena);
+ try Io.Dir.cwd().createDirPath(io, join(arena, home, "plugins/cache/test/demo/1.2.0"));
+ try Io.Dir.cwd().createDirPath(io, join(arena, home, "plugins/cache/test/demo/0.9.0"));
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, home, "config.toml"),
+ .data =
+ \\[plugins]
+ \\"demo@test" = { enabled = true }
+ ,
+ });
+ const got = load(io, arena, home);
+ try testing.expectEqual(@as(usize, 1), got.len);
+ try testing.expect(std.mem.endsWith(u8, got[0].path, "test/demo/1.2.0"));
+}
+
+test "discover: Codex store is visible; cache/ is still not walked" {
+ 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 user = join(arena, base, "home");
+ const pack = join(arena, user, ".codex/plugins/cache/official/pack/local");
+ const decoy = join(arena, user, ".codex/plugins/cache/official/decoy/local");
+ try Io.Dir.cwd().createDirPath(io, join(arena, pack, ".codex-plugin"));
+ try Io.Dir.cwd().createDirPath(io, join(arena, pack, "skills/hi"));
+ try Io.Dir.cwd().createDirPath(io, join(arena, decoy, "skills/nope"));
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, pack, ".codex-plugin/plugin.json"),
+ .data = "{\"name\":\"pack\"}",
+ });
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, pack, "skills/hi/SKILL.md"),
+ .data = "---\nname: pack-hi\ndescription: d\n---\nbody\n",
+ });
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, decoy, "skills/nope/SKILL.md"),
+ .data = "---\nname: nope\ndescription: d\n---\nbody\n",
+ });
+ const plugins = @import("plugins.zig");
+ try testing.expectEqual(@as(usize, 0), plugins.discover(io, arena, user, tmp.dir).len);
+
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, user, ".codex/config.toml"),
+ .data =
+ \\[plugins."pack@official"]
+ \\enabled = true
+ ,
+ });
+ const list = plugins.discover(io, arena, user, tmp.dir);
+ try testing.expectEqual(@as(usize, 1), list.len);
+ try testing.expectEqualStrings("pack", list[0].name);
+ try testing.expectEqualStrings("codex", list[0].origin);
+ try testing.expect(list[0].skills);
+}
diff --git a/src/plugin_index.zig b/src/plugin_index.zig
index 28a88795..31280867 100644
--- a/src/plugin_index.zig
+++ b/src/plugin_index.zig
@@ -15,6 +15,19 @@ pub const Entry = struct {
path: []const u8,
};
+/// JSON string literal, including quotes. Tests must use this when a native
+/// path goes into JSON — Windows `\` is an escape and silently empties parse.
+pub fn quote(arena: Allocator, s: []const u8) []const u8 {
+ var aw: Io.Writer.Allocating = .init(arena);
+ aw.writer.writeByte('"') catch return "\"\"";
+ for (s) |c| {
+ if (c == '\\' or c == '"') aw.writer.writeByte('\\') catch return "\"\"";
+ aw.writer.writeByte(c) catch return "\"\"";
+ }
+ aw.writer.writeByte('"') catch return "\"\"";
+ return aw.writer.buffered();
+}
+
fn strField(obj: std.json.ObjectMap, key: []const u8) []const u8 {
const v = obj.get(key) orelse return "";
return if (v == .string) v.string else "";
@@ -96,8 +109,8 @@ test "load: names and installPath; project scope is cwd-gated" {
try Io.Dir.cwd().writeFile(io, .{
.sub_path = json_path,
.data = try std.fmt.allocPrint(arena,
- \\{{"plugins":{{"gmail@cursor":[{{"installPath":"{s}"}}],"pack@official":[{{"installPath":"{s}","scope":"project","projectPath":"{s}"}}]}}}}
- , .{ user_plug, proj_plug, project }),
+ \\{{"plugins":{{"gmail@cursor":[{{"installPath":{s}}}],"pack@official":[{{"installPath":{s},"scope":"project","projectPath":{s}}}]}}}}
+ , .{ quote(arena, user_plug), quote(arena, proj_plug), quote(arena, project) }),
});
const user_only = load(io, arena, json_path, "/elsewhere");
diff --git a/src/plugins.zig b/src/plugins.zig
index 45885b4d..474eeb71 100644
--- a/src/plugins.zig
+++ b/src/plugins.zig
@@ -1,12 +1,8 @@
//! In-place plugins and foreign-harness MCP (ADR 0007).
//!
-//! Grok-build never walks `plugins/cache/` (OpenCode never does either — it
-//! globs `.claude/skills/**/SKILL.md` and `.opencode/`). Cache installs come
-//! from `installed_plugins.json` `installPath`. This module is the live scan.
-//!
-//! Skills stay on-demand (`skill` tool / `/skills`), including Claude
-//! `commands/*.md` and a plugin-root `SKILL.md`. MCP still needs `/mcp
-//! trust` or `--yolo`. Plugin hooks are not run. GRAFF_NO_PLUGINS=1 disables.
+//! Never walk `plugins/cache/`. Claude/Cursor cache comes from
+//! `installed_plugins.json`; Codex from `config.toml` → PluginStore.
+//! Skills stay on-demand. MCP needs `/mcp trust` or `--yolo`.
const std = @import("std");
const Io = std.Io;
@@ -15,8 +11,7 @@ const Allocator = std.mem.Allocator;
const layout = @import("plugin_layout.zig");
const plugin_cap = 32;
-/// Immediate children plus one more for Cursor `local/<name>/`. Never
-/// `cache/` — that tree is hashed and is what made a scan take a second.
+/// Depth 2 for Cursor `local/<name>/`. Never `cache/` (hashed, slow).
const walk_depth: u8 = 2;
const visit_cap = 256;
const file_cap: std.Io.Limit = .limited(1 << 20);
@@ -133,6 +128,12 @@ fn takeInstalled(io: Io, arena: Allocator, list: *std.ArrayList(Plugin), json_pa
}
}
+fn takeCodex(io: Io, arena: Allocator, list: *std.ArrayList(Plugin), home: []const u8, personal: bool) void {
+ for (@import("plugin_codex.zig").load(io, arena, home)) |e| {
+ adopt(io, arena, list, e.path, "codex", personal, e.name);
+ }
+}
+
const Spec = struct { rel: []const u8, origin: []const u8 };
const user_roots = [_]Spec{
@@ -179,7 +180,7 @@ pub fn discoverFresh(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Di
}
takeInstalled(io, arena, &list, join(arena, h, ".claude/plugins/installed_plugins.json"), "claude", true, cwd);
takeInstalled(io, arena, &list, join(arena, h, ".cursor/plugins/installed_plugins.json"), "cursor", true, cwd);
- takeInstalled(io, arena, &list, join(arena, h, ".codex/plugins/installed_plugins.json"), "codex", true, cwd);
+ takeCodex(io, arena, &list, join(arena, h, ".codex"), true);
};
if (cwd.len > 0) {
for (project_roots) |spec| {
@@ -187,7 +188,7 @@ pub fn discoverFresh(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Di
}
takeInstalled(io, arena, &list, join(arena, cwd, ".claude/plugins/installed_plugins.json"), "claude", false, cwd);
takeInstalled(io, arena, &list, join(arena, cwd, ".cursor/plugins/installed_plugins.json"), "cursor", false, cwd);
- takeInstalled(io, arena, &list, join(arena, cwd, ".codex/plugins/installed_plugins.json"), "codex", false, cwd);
+ takeCodex(io, arena, &list, join(arena, cwd, ".codex"), false);
}
last_visits = visits;
return list.items;
@@ -221,7 +222,7 @@ pub fn agentDirs(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Dir, p
}
fn pathEq(a: []const u8, b: []const u8) bool {
- return std.mem.eql(u8, std.mem.trimEnd(u8, a, "/"), std.mem.trimEnd(u8, b, "/"));
+ return std.mem.eql(u8, std.mem.trimEnd(u8, a, "/\\"), std.mem.trimEnd(u8, b, "/\\"));
}
fn putServers(arena: Allocator, servers: *std.json.ObjectMap, found: *bool, v: ?Value) void {
@@ -427,7 +428,7 @@ test "discover: installed_plugins.json names a cache installPath; cache/ is not
try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, nested, "agents/reviewer.md"), .data = "---\nname: pack-reviewer\n---\nbe careful\n" });
try testing.expectEqual(@as(usize, 0), discover(io, arena, home, tmp.dir).len);
- const json = try std.fmt.allocPrint(arena, "{{\"plugins\":{{\"pack@official\":[{{\"installPath\":\"{s}\"}}]}}}}", .{nested});
+ const json = try std.fmt.allocPrint(arena, "{{\"plugins\":{{\"pack@official\":[{{\"installPath\":{s}}}]}}}}", .{@import("plugin_index.zig").quote(arena, nested)});
try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, home, ".claude/plugins/installed_plugins.json"), .data = json });
const list = discover(io, arena, home, tmp.dir);
try testing.expectEqual(@as(usize, 1), list.len);
@@ -476,9 +477,9 @@ test "mergeMcp: ~/.claude.json project-scoped servers match this cwd" {
const base = try tmpBase(io, &tmp, arena);
const home = join(arena, base, "home");
try Io.Dir.cwd().createDirPath(io, home);
- const head = "{\"mcpServers\":{\"root\":{\"command\":\"r\"}},\"projects\":{\"";
- const tail = "\":{\"mcpServers\":{\"here\":{\"command\":\"h\"}}},\"/other\":{\"mcpServers\":{\"nope\":{\"command\":\"x\"}}}}}";
- const payload = try std.fmt.allocPrint(arena, "{s}{s}{s}", .{ head, base, tail });
+ const head = "{\"mcpServers\":{\"root\":{\"command\":\"r\"}},\"projects\":{";
+ const tail = ":{\"mcpServers\":{\"here\":{\"command\":\"h\"}}},\"/other\":{\"mcpServers\":{\"nope\":{\"command\":\"x\"}}}}}";
+ const payload = try std.fmt.allocPrint(arena, "{s}{s}{s}", .{ head, @import("plugin_index.zig").quote(arena, base), tail });
try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, home, ".claude.json"), .data = payload });
var servers: std.json.ObjectMap = .empty;
@@ -552,7 +553,7 @@ test "discover: Cursor cache uses .cursor-plugin + mcp.json; name from manifest"
.sub_path = join(arena, plug, "mcp.json"),
.data = "{\"mcpServers\":{\"gmail\":{\"url\":\"https://gmailmcp.googleapis.com/mcp/v1\"}}}",
});
- const idx = try std.fmt.allocPrint(arena, "{{\"plugins\":{{\"gmail@cursor-public\":[{{\"installPath\":\"{s}\"}}]}}}}", .{plug});
+ const idx = try std.fmt.allocPrint(arena, "{{\"plugins\":{{\"gmail@cursor-public\":[{{\"installPath\":{s}}}]}}}}", .{@import("plugin_index.zig").quote(arena, plug)});
try Io.Dir.cwd().writeFile(io, .{ .sub_path = join(arena, home, ".cursor/plugins/installed_plugins.json"), .data = idx });
const list = discover(io, arena, home, tmp.dir);
diff --git a/src/skill_docs.zig b/src/skill_docs.zig
index 785539bd..a5a822e2 100644
--- a/src/skill_docs.zig
+++ b/src/skill_docs.zig
@@ -441,6 +441,7 @@ test "promptCatalog: names + descriptions only, never bodies" {
try std.testing.expect(std.mem.indexOf(u8, text, "SECRET-BODY-TEXT") == null);
try std.testing.expect(std.mem.indexOf(u8, text, "`skill`") != null);
try std.testing.expect(std.mem.indexOf(u8, text, "/") == null); // no file paths — they move and bust the cache prefix
+ try std.testing.expect(std.mem.indexOf(u8, text, "file:") == null); // Codex prints these; we do not
try std.testing.expectEqualStrings("", promptCatalog(arena, &.{}));
const shuffled = [_]Skill{
diff --git a/src/test_hooks.zig b/src/test_hooks.zig
index 791fa27e..1c32c2a2 100644
--- a/src/test_hooks.zig
+++ b/src/test_hooks.zig
@@ -131,6 +131,7 @@ const plugins = @import("plugins.zig"); // ADR 0007 in-place plugin / foreign MC
const plugin_layout = @import("plugin_layout.zig"); // Claude commands/ + inline MCP + ${CLAUDE_PLUGIN_ROOT}
const plugin_scan = @import("plugin_scan.zig"); // timed discover + production cache
const plugin_index = @import("plugin_index.zig"); // Claude/Cursor installed_plugins.json
+const plugin_codex = @import("plugin_codex.zig"); // Codex config.toml → PluginStore
// #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