Skip to content

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

Python

feat(plugins): read Cursor plugin cache and skills-cursor in place

Cursor Agent4b29ab638335
diff --git a/README.md b/README.md
index 54cd0722..aa85c764 100644
--- a/README.md
+++ b/README.md
@@ -513,7 +513,7 @@ gateway rollouts appear without a restart.
/agents list agent types: builtin personas + .harness/agents/*.md
/skills [add|remove <name>]
list SKILL.md playbooks + companion tools; add/remove enables or disables one
-/plugins list Claude/Grok/Codex plugin trees graff is reading in place
+/plugins list Cursor/Claude/Grok/Codex plugin trees graff is reading in place
/hooks list lifecycle hooks and the built-in codedb guard
/doctor read-only health check: goal/todo invariants, and why steering will or will not be appended
/btw <question> ask one side question about this conversation: no tools, billed, never added to the session
@@ -576,10 +576,11 @@ accepted findings.
A skill is a markdown playbook graff loads only when a task calls for it. Drop
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, Grok, or
-Codex work as they are: `.claude/skills/`, `~/.grok/skills/`, plugin
-`skills/` trees, and `~/.agents/skills/` are read in place (not copied).
-`/plugins` lists the plugin trees. `GRAFF_NO_PLUGINS=1` skips them.
+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` lists the plugin trees. `GRAFF_NO_PLUGINS=1`
+skips them.
Only the name and description enter the system prompt, so a large skill library
costs one line each. The model calls the `skill` tool to pull a body in when it
@@ -595,7 +596,7 @@ and `/skills add <name>` brings it back. See
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`, `~/.claude.json`,
+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` shows
which plugin trees contributed. Smolify (`https://app.smol.ly/mcp`) is available as a
diff --git a/docs/adr/0007-plugins-are-read-in-place.md b/docs/adr/0007-plugins-are-read-in-place.md
index 378f2c0b..40f026e8 100644
--- a/docs/adr/0007-plugins-are-read-in-place.md
+++ b/docs/adr/0007-plugins-are-read-in-place.md
@@ -15,21 +15,25 @@ config.
## Decision
-- Discover plugin roots in place: `~/.claude/plugins/`, `~/.grok/plugins/`,
- `~/.codex/plugins/`, `~/.codegraff/plugins/`, and the project
- `.claude/.grok/.codex/.harness/plugins/` trees (including Claude's
- `plugins/cache/…` layout). A directory is a plugin if it has
- `.claude-plugin/plugin.json`, `.grok-plugin/plugin.json`, `plugin.json`,
- `.mcp.json`, `skills/`, or `agents/`. Skip `marketplaces/`. Cap 32.
+- Discover plugin roots in place: `~/.cursor/plugins/`, `~/.claude/plugins/`,
+ `~/.grok/plugins/`, `~/.codex/plugins/`, `~/.codegraff/plugins/`, and the
+ project `.cursor/.claude/.grok/.codex/.harness/plugins/` trees (including
+ Cursor/Claude `plugins/cache/…`). A directory is a plugin if it has
+ `.cursor-plugin/plugin.json`, `.claude-plugin/plugin.json`,
+ `.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.
- Skills from those trees (and `~/.agents/skills`, `~/.grok/skills`,
- `~/.codex/skills`) join the existing on-demand `skill` catalog. Bodies still
- load only when the model calls `skill`. Project `.harness/skills` still wins.
+ `~/.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.
- Plugin `agents/` join the fleet after personal `~/.harness/agents` and
before project `.harness/agents`.
-- Plugin `.mcp.json` plus Claude/Cursor/Grok MCP files (`~/.claude.json`,
- `~/.cursor/mcp.json`, `.cursor/mcp.json`, …) fill **missing** server names
- only. graff's `~/.codegraff/mcp.json` and `.mcp.json` still win. Consent is
- unchanged (`/mcp trust` / `--yolo`).
+- Plugin `.mcp.json` / `mcp.json` plus Claude/Cursor/Grok MCP files
+ (`~/.claude.json`, `~/.cursor/mcp.json`, `.cursor/mcp.json`, …) fill
+ **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` lists origin. Do not
vendor grok-build. Do not auto-run plugin hooks.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 8ec5736a..943264bd 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) | Claude/Grok/Codex plugins and MCP are read in place; 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; skills stay on-demand; MCP stays consent-gated. |
## When to write one
diff --git a/docs/skills.md b/docs/skills.md
index 375f0495..6023f373 100644
--- a/docs/skills.md
+++ b/docs/skills.md
@@ -19,8 +19,8 @@ Two kinds of thing are called "skills" in graff, and `/skills` lists both:
| bundled in the binary | every install |
| `~/.claude/skills/` | you, every project (compatibility) |
| `~/.harness/skills/` | you, every project |
-| `~/.grok/skills/`, `~/.codex/skills/`, `~/.agents/skills/` | you, every project (other harnesses, in place) |
-| `~/.claude/plugins/*/skills/` (and Grok/Codex/graff plugin trees) | you, every project (ADR 0007) |
+| `~/.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) |
| `.claude/skills/` | this project (compatibility) |
| `.grok/skills/`, `.codex/skills/` | this project |
| `.claude/plugins/*/skills/` (and project plugin trees) | this project |
diff --git a/src/command_catalog.zig b/src/command_catalog.zig
index 07eb306f..1bdbcdc1 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 Claude/Grok/Codex plugin trees graff is reading in place" },
+ .{ .name = "/plugins", .desc = "list Cursor/Claude/Grok/Codex plugin trees graff is reading in place" },
.{ .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/plugins.zig b/src/plugins.zig
index 4e554ba9..736e223e 100644
--- a/src/plugins.zig
+++ b/src/plugins.zig
@@ -62,14 +62,31 @@ fn existsJoin(io: Io, a: []const u8, b: []const u8) bool {
}
fn isPlugin(io: Io, path: []const u8) bool {
- return existsJoin(io, path, ".claude-plugin/plugin.json") or
+ return existsJoin(io, path, ".cursor-plugin/plugin.json") or
+ existsJoin(io, path, ".claude-plugin/plugin.json") or
existsJoin(io, path, ".grok-plugin/plugin.json") or
existsJoin(io, path, "plugin.json") or
existsJoin(io, path, ".mcp.json") or
+ existsJoin(io, path, "mcp.json") or
existsJoin(io, path, "skills") or
existsJoin(io, path, "agents");
}
+fn hasMcp(io: Io, path: []const u8) bool {
+ return existsJoin(io, path, ".mcp.json") or existsJoin(io, path, "mcp.json");
+}
+
+/// Manifest `name` when present — Cursor cache folders are content hashes.
+fn pluginName(io: Io, arena: Allocator, path: []const u8) []const u8 {
+ const files = [_][]const u8{ ".cursor-plugin/plugin.json", ".claude-plugin/plugin.json", ".grok-plugin/plugin.json", "plugin.json" };
+ for (files) |rel| {
+ const text = Io.Dir.cwd().readFileAlloc(io, join(arena, path, rel), arena, .limited(64 * 1024)) catch continue;
+ const v = std.json.parseFromSliceLeaky(Value, arena, text, .{ .allocate = .alloc_always }) catch continue;
+ if (v == .object) if (v.object.get("name")) |n| if (n == .string and n.string.len > 0) return n.string;
+ }
+ return arena.dupe(u8, std.fs.path.basename(path)) catch std.fs.path.basename(path);
+}
+
fn walk(io: Io, arena: Allocator, list: *std.ArrayList(Plugin), path: []const u8, origin: []const u8, personal: bool, depth: u8, visits: *usize) void {
if (list.items.len >= plugin_cap or visits.* >= visit_cap) return;
var dir = Io.Dir.cwd().openDir(io, path, .{ .iterate = true }) catch return;
@@ -77,15 +94,14 @@ fn walk(io: Io, arena: Allocator, list: *std.ArrayList(Plugin), path: []const u8
if (isPlugin(io, path)) {
const skills_p = join(arena, path, "skills");
const agents_p = join(arena, path, "agents");
- const mcp_p = join(arena, path, ".mcp.json");
list.append(arena, .{
- .name = arena.dupe(u8, std.fs.path.basename(path)) catch return,
+ .name = pluginName(io, arena, path),
.path = path,
.origin = origin,
.personal = personal,
.skills = exists(io, skills_p),
.agents = exists(io, agents_p),
- .mcp = exists(io, mcp_p),
+ .mcp = hasMcp(io, path),
}) catch {};
return; // do not treat a plugin's skills/ as a nested plugin
}
@@ -105,6 +121,7 @@ fn walk(io: Io, arena: Allocator, list: *std.ArrayList(Plugin), path: []const u8
const Spec = struct { rel: []const u8, origin: []const u8 };
const user_roots = [_]Spec{
+ .{ .rel = ".cursor/plugins", .origin = "cursor" },
.{ .rel = ".claude/plugins", .origin = "claude" },
.{ .rel = ".grok/plugins", .origin = "grok" },
.{ .rel = ".codex/plugins", .origin = "codex" },
@@ -113,13 +130,14 @@ const user_roots = [_]Spec{
};
const project_roots = [_]Spec{
+ .{ .rel = ".cursor/plugins", .origin = "cursor" },
.{ .rel = ".claude/plugins", .origin = "claude" },
.{ .rel = ".grok/plugins", .origin = "grok" },
.{ .rel = ".codex/plugins", .origin = "codex" },
.{ .rel = ".harness/plugins", .origin = "harness" },
};
-/// Every plugin tree under the usual Claude/Grok/Codex/graff folders.
+/// Every plugin tree under the usual Cursor/Claude/Grok/Codex/graff folders.
/// `project` is the workspace root (cwd in production, a tmp dir in tests).
pub fn discover(io: Io, arena: Allocator, home: ?[]const u8, project: Io.Dir) []const Plugin {
if (off()) return &.{};
@@ -210,7 +228,10 @@ fn takeRel(io: Io, arena: Allocator, dir: Io.Dir, servers: *std.json.ObjectMap,
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);
+ 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;
@@ -236,13 +257,13 @@ pub fn mergeMcp(io: Io, arena: Allocator, home: []const u8, dir: Io.Dir, servers
pub fn slashCommand(io: Io, arena: Allocator, home: []const u8, line: []const u8, out: *Io.Writer) !bool {
if (!(std.mem.eql(u8, line, "/plugins") or std.mem.startsWith(u8, line, "/plugins "))) return false;
if (off()) {
- try out.writeAll("plugins disabled (GRAFF_NO_PLUGINS). unset it and restart to scan Claude/Grok/Codex trees.\n");
+ try out.writeAll("plugins disabled (GRAFF_NO_PLUGINS). unset it and restart to scan Cursor/Claude/Grok/Codex trees.\n");
try out.flush();
return true;
}
const list = discover(io, arena, if (home.len > 0) home else null, Io.Dir.cwd());
if (list.len == 0) {
- try out.writeAll("no plugins discovered. graff reads 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 Cursor/Claude/Grok/Codex plugin trees in place (skills/, agents/, mcp.json). nothing to copy; GRAFF_NO_PLUGINS=1 disables.\n");
try out.flush();
return true;
}
@@ -312,7 +333,7 @@ test "discover: walks Claude plugins/cache two levels down" {
const list = discover(io, arena, home, tmp.dir);
try testing.expectEqual(@as(usize, 1), list.len);
- try testing.expectEqualStrings("1.0.0", list[0].name);
+ try testing.expectEqualStrings("pack", list[0].name);
try testing.expect(list[0].agents);
const agents = agentDirs(io, arena, home, tmp.dir, true);
try testing.expectEqual(@as(usize, 1), agents.len);
@@ -380,3 +401,38 @@ test "slashCommand: /plugins lists origin and refuses unrelated lines" {
try testing.expect(try slashCommand(testing.io, arena_state.allocator(), "", "/plugins", &aw.writer));
try testing.expect(std.mem.indexOf(u8, aw.writer.buffered(), "plugin") != null);
}
+
+test "discover: Cursor cache uses .cursor-plugin + mcp.json; name from manifest" {
+ 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 hash = "2a8044425c7bddf429c3bdedf3ab61e791d34d65";
+ const plug = join(arena, home, join(arena, ".cursor/plugins/cache/cursor-public/45893410", hash));
+ try Io.Dir.cwd().createDirPath(io, join(arena, plug, ".cursor-plugin"));
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, plug, ".cursor-plugin/plugin.json"),
+ .data = "{\"name\":\"gmail\",\"mcpServers\":\"./mcp.json\"}",
+ });
+ try Io.Dir.cwd().writeFile(io, .{
+ .sub_path = join(arena, plug, "mcp.json"),
+ .data = "{\"mcpServers\":{\"gmail\":{\"url\":\"https://gmailmcp.googleapis.com/mcp/v1\"}}}",
+ });
+
+ const list = discover(io, arena, home, tmp.dir);
+ try testing.expectEqual(@as(usize, 1), list.len);
+ try testing.expectEqualStrings("gmail", list[0].name);
+ try testing.expectEqualStrings("cursor", list[0].origin);
+ try testing.expect(list[0].mcp);
+ try testing.expect(!list[0].skills);
+
+ var servers: std.json.ObjectMap = .empty;
+ var found = false;
+ mergeMcp(io, arena, home, tmp.dir, &servers, &found);
+ try testing.expect(found);
+ try testing.expectEqualStrings("https://gmailmcp.googleapis.com/mcp/v1", servers.get("gmail").?.object.get("url").?.string);
+}
diff --git a/src/skill_docs.zig b/src/skill_docs.zig
index 3bf8ad60..01061ce8 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/, 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, 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"}}}
;
@@ -162,7 +162,7 @@ fn scan(io: Io, arena: Allocator, home: ?[]const u8) []const Skill {
fn collect(io: Io, arena: Allocator, home: ?[]const u8) std.ArrayList(Skill) {
var list: std.ArrayList(Skill) = .empty;
list.appendSlice(arena, &builtins) catch {};
- if (home) |h| for ([_][]const u8{ compat_dir, ".codegraff/skills", project_dir, ".grok/skills", ".codex/skills", ".agents/skills" }) |dir| {
+ if (home) |h| for ([_][]const u8{ compat_dir, ".codegraff/skills", project_dir, ".grok/skills", ".codex/skills", ".agents/skills", ".cursor/skills-cursor", ".cursor/skills" }) |dir| {
const path = std.fmt.allocPrint(arena, "{s}/{s}", .{ h, dir }) catch continue;
loadDir(io, arena, &list, path, .personal);
};
@@ -170,6 +170,7 @@ fn collect(io: Io, arena: Allocator, home: ?[]const u8) std.ArrayList(Skill) {
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);
loadDir(io, arena, &list, project_dir, .project);
return list;