@stigmer/coding-agent-plugin 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -17
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/README.md +6 -3
- package/plugin/hooks/cursor-guard.mjs +23 -0
- package/plugin/hooks/cursor-hooks.json +6 -1
- package/plugin/hooks/decide.mjs +45 -7
package/README.md
CHANGED
|
@@ -54,15 +54,26 @@ one is for the coding agent on a person's laptop.
|
|
|
54
54
|
first, a service account's key saved to a file and never shown.
|
|
55
55
|
- `plugin/.mcp.json`: the bundled `stigmer mcp-server`, for making, running and
|
|
56
56
|
reading agents once setup is done.
|
|
57
|
-
- `plugin/hooks/`: the guard.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
`
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
- `plugin/hooks/`: the guard. It asks the person before a destructive tool,
|
|
58
|
+
before answering a run's approval with allow, and before a `stigmer` command
|
|
59
|
+
forced past its own question, even after they allowed the plugin's tools.
|
|
60
|
+
`decide.mjs` holds the one decision (`reasonFor`) and each tool's side:
|
|
61
|
+
- `hooks.json` is Claude Code's: a `PreToolUse` hook (`guard.mjs`, through
|
|
62
|
+
`decide`);
|
|
63
|
+
- `cursor-hooks.json` is Cursor's: `beforeShellExecution` alone
|
|
64
|
+
(`cursor-guard.mjs`, through `decideCursor`), the one event on which Cursor
|
|
65
|
+
turns an `ask` into a prompt. Its MCP executor acts on a
|
|
66
|
+
`beforeMCPExecution` answer only when it is `deny`, and any MCP hook makes it
|
|
67
|
+
refuse every server's call that carries a file path, so the plugin hooks no
|
|
68
|
+
MCP call there and Cursor's own tool approval asks before the tool server's
|
|
69
|
+
tools. Both entries fail open. A Cursor run that allows every command
|
|
70
|
+
(`agent -p --force`) passes over an ask, as the person chose;
|
|
71
|
+
- Codex's hooks cannot ask, so `codex-hooks.json` is empty and Codex asks
|
|
72
|
+
before the tools from their marks (`mcp-server/src/domains/toolmarks.ts`).
|
|
73
|
+
|
|
74
|
+
Each tool would load `hooks/hooks.json` when its manifest names no hooks
|
|
75
|
+
file, and would run Claude Code's hook wrongly, so Codex's and Cursor's
|
|
76
|
+
manifests each name their own file.
|
|
66
77
|
- The manifests and marketplace files of each tool, one plugin named `stigmer`
|
|
67
78
|
at the folder's root: `.claude-plugin/` (Claude Code), `.cursor-plugin/`
|
|
68
79
|
(Cursor), `.codex-plugin/plugin.json` and `.agents/plugins/marketplace.json`
|
|
@@ -143,12 +154,11 @@ the person's words, and `graders/`:
|
|
|
143
154
|
opposite, denies it or warns against it does not do it:", then names the
|
|
144
155
|
wrong claim exactly. A line that is a judgement ("runs Claude Managed
|
|
145
156
|
Agents down", "a price other than these") says in its point what does not
|
|
146
|
-
count ("saying plainly what it lacks", "leaving a price out").
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
given answer word for word;
|
|
157
|
+
count ("saying plainly what it lacks", "leaving a price out"). The question
|
|
158
|
+
was probed once (misgraded answers and a wrong answer for each line,
|
|
159
|
+
through `claude plugin eval` on a scratch plugin whose case repeats a given
|
|
160
|
+
answer word for word); every job then moved to it, each line re-read
|
|
161
|
+
against the docs and the job scored by the bank;
|
|
152
162
|
- `cites-the-page.md`: the answer links a page that answers it, as published
|
|
153
163
|
(`stigmer\.ai/docs/<page>`, or several as `stigmer\.ai/docs/(<page>|<page>)`;
|
|
154
164
|
a link to the docs' source on GitHub doesn't count). The list names every
|
|
@@ -165,7 +175,10 @@ the person's words, and `graders/`:
|
|
|
165
175
|
when the agent asks the person first.
|
|
166
176
|
|
|
167
177
|
`make bank-coding-agent` (`test/install/coding-agent-bank.mjs`) runs the bank
|
|
168
|
-
in Claude Code, with the plugin and without it,
|
|
178
|
+
in Claude Code, with the plugin and without it, on the plugin as a release
|
|
179
|
+
publishes it (the CLI's pack carries the package, and the plugin is copied
|
|
180
|
+
from the stage's own `node_modules/@stigmer/coding-agent-plugin/plugin/`,
|
|
181
|
+
stamped with the pack's version), against a hermetic local
|
|
169
182
|
Stigmer seeded with `evals/_fixture/` (an agent with a finished run, one whose
|
|
170
183
|
runs fail, a skill), its runner on the fake model, and prints the score per
|
|
171
184
|
job. An acting try starts in a set-up person's project: the fixture agents'
|
|
@@ -176,7 +189,17 @@ and the command exits non-zero, so such a run is never taken as a score. It
|
|
|
176
189
|
calls a real
|
|
177
190
|
model on your own Claude Code sign-in, so it is by hand, in no lane;
|
|
178
191
|
`BANK_ARGS` narrows it (`--tag=<job>`, `--case=<glob>`, `--runs=<n>`) and
|
|
179
|
-
bounds it (`--max-cost-usd`, default $60 API-equivalent).
|
|
192
|
+
bounds it (`--max-cost-usd`, default $60 API-equivalent). When passing a
|
|
193
|
+
`{a,b}` glob through `make`, quote it or call the script directly: the shell
|
|
194
|
+
expands an unquoted brace into separate `--case` arguments and only the last
|
|
195
|
+
is kept.
|
|
196
|
+
|
|
197
|
+
The bank is proven in one coding agent, Claude Code. Codex and Cursor read the
|
|
198
|
+
same skills, tool server and docs, so an answer proven there carries over; what
|
|
199
|
+
differs between the tools is how each loads the plugin (its manifest, its hooks
|
|
200
|
+
file), and that is held by this package's unit tests, not by a bank run in each
|
|
201
|
+
tool. A problem a person reports in Codex or Cursor is fixed when it is
|
|
202
|
+
reported.
|
|
180
203
|
|
|
181
204
|
To add a case: write the question in the person's own words under its job's
|
|
182
205
|
folder, read the docs page that answers it, and write the rubric from that
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/coding-agent-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Stigmer's plugin for coding agents (Claude Code, Codex, Cursor): a skill that answers questions about Stigmer from its live docs, the guide that sets Stigmer up for a project, the bundled stigmer mcp-server and a guard that asks before what can't be undone, published at the CLI's own version so `stigmer coding-agent` prints the guide its CLI follows",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stigmer",
|
|
3
3
|
"displayName": "Stigmer",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"description": "Stigmer in your coding agent: answers any question about Stigmer from its live docs, citing the page; sets Stigmer up for your project; designs, runs and fixes agents and reads their results; puts them in your own product; and runs your own server and organization. It asks you before anything that can't be undone.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Stigmer",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stigmer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Stigmer in your coding agent: answers any question about Stigmer from its live docs, citing the page; sets Stigmer up for your project; designs, runs and fixes agents and reads their results; puts them in your own product; and runs your own server and organization. It asks you before anything that can't be undone.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Stigmer",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stigmer",
|
|
3
3
|
"displayName": "Stigmer",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"description": "Stigmer in your coding agent: answers any question about Stigmer from its live docs, citing the page; sets Stigmer up for your project; designs, runs and fixes agents and reads their results; puts them in your own product; and runs your own server and organization. It asks you before anything that can't be undone.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Stigmer"
|
package/plugin/README.md
CHANGED
|
@@ -56,9 +56,12 @@ hosted server instead: https://stigmer.ai/docs/guides/editors/connect-mcp
|
|
|
56
56
|
(`*.stigmer.ai`), your own server at its own address, or `stigmer up` on your
|
|
57
57
|
machine. They use that sign-in; the plugin holds no credential.
|
|
58
58
|
- **stigmer.ai**, for the docs it reads and cites.
|
|
59
|
-
- **A Node script**
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
- **A Node script** that reads the call your coding agent is about to make and, for
|
|
60
|
+
the acts above, asks you first: `hooks/guard.mjs` in Claude Code, for the tool
|
|
61
|
+
server's tools and `stigmer` commands; `hooks/cursor-guard.mjs` in Cursor, for
|
|
62
|
+
`stigmer` commands, where Cursor's own tool approval covers the tool server's
|
|
63
|
+
tools. It reads nothing else, writes nothing and reaches no network. Codex asks
|
|
64
|
+
from the tools' own marks.
|
|
62
65
|
- **Skills**: Markdown instructions your coding agent reads.
|
|
63
66
|
|
|
64
67
|
Nothing else. The manifest's `network.hosts` names stigmer.ai; your own server's
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Cursor's beforeShellExecution hook for Stigmer's plugin: reads the shell
|
|
2
|
+
// line from stdin and prints decideCursor()'s answer
|
|
3
|
+
// (decide.mjs). It fails open: on any error of its own it prints `{}`, which
|
|
4
|
+
// leaves the call to Cursor's own permissions, and exits 0. `failClosed`
|
|
5
|
+
// stays off in cursor-hooks.json for the same reason: a fault in the guard
|
|
6
|
+
// must not stop every `stigmer` command.
|
|
7
|
+
import { decideCursor } from "./decide.mjs";
|
|
8
|
+
|
|
9
|
+
/* v8 ignore start -- @preserve: Cursor's entry, which __tests__/guard.test.ts runs in a child process that this suite's coverage can't see */
|
|
10
|
+
let input = "";
|
|
11
|
+
process.stdin.setEncoding("utf8");
|
|
12
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
13
|
+
process.stdin.on("end", () => {
|
|
14
|
+
let answer = {};
|
|
15
|
+
try {
|
|
16
|
+
answer = decideCursor(JSON.parse(input));
|
|
17
|
+
} catch {
|
|
18
|
+
// Fail open: Cursor's own permissions still decide.
|
|
19
|
+
}
|
|
20
|
+
process.stdout.write(`${JSON.stringify(answer)}\n`);
|
|
21
|
+
process.exitCode = 0;
|
|
22
|
+
});
|
|
23
|
+
/* v8 ignore stop */
|
package/plugin/hooks/decide.mjs
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
// What the plugin's
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// What the plugin's guard decides about one call: ask the person first, or
|
|
2
|
+
// say nothing and let the coding agent's own permissions decide. The
|
|
3
|
+
// decision is the tool's own (reasonFor); each coding agent's side reads its
|
|
4
|
+
// hook input and writes its answer: decide() for Claude Code's PreToolUse
|
|
5
|
+
// hook (guard.mjs), decideCursor() for Cursor's beforeShellExecution hook
|
|
6
|
+
// (cursor-guard.mjs). Cursor turns a shell hook's `ask` into a prompt, but
|
|
7
|
+
// acts on a beforeMCPExecution answer only when it is `deny`, and any MCP
|
|
8
|
+
// hook makes it refuse every server's tool call that carries a file path
|
|
9
|
+
// (read in cursor-agent 2026.11.19's bundled executor), so the plugin hooks
|
|
10
|
+
// no MCP call there: Cursor's own tool approval asks before the tool
|
|
11
|
+
// server's tools. Codex's hooks cannot ask, so Codex asks from the tool
|
|
12
|
+
// server's own marks.
|
|
4
13
|
//
|
|
5
14
|
// It asks before an act that can't be undone, or that is the person's to
|
|
6
15
|
// give, even when they once chose "always allow" for the plugin's tools:
|
|
@@ -58,8 +67,20 @@ const VALUE_GLOBALS = new Set(["--org", "--api-key"]);
|
|
|
58
67
|
const AGENT_LINE = "If the person hasn't approved exactly this in the conversation, stop and ask them first.";
|
|
59
68
|
|
|
60
69
|
/**
|
|
61
|
-
*
|
|
62
|
-
* `
|
|
70
|
+
* Why to ask before one call, whichever coding agent makes it, or null:
|
|
71
|
+
* `{ kind: "tool", name, args }` for a tool of this plugin's server (`name`
|
|
72
|
+
* bare, as the server names it), `{ kind: "shell", command }` for a shell
|
|
73
|
+
* line. Throws only on hostile input; each side catches.
|
|
74
|
+
*/
|
|
75
|
+
export function reasonFor(call) {
|
|
76
|
+
if (call.kind === "shell") return shellReason(call.command);
|
|
77
|
+
if (call.kind === "tool") return toolReason(call.name, call.args);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Claude Code's side: the answer to one PreToolUse input, an `ask` with its
|
|
83
|
+
* reason, or `null` to say nothing. Never throws.
|
|
63
84
|
*/
|
|
64
85
|
export function decide(input) {
|
|
65
86
|
try {
|
|
@@ -68,17 +89,34 @@ export function decide(input) {
|
|
|
68
89
|
const args = input.tool_input !== null && typeof input.tool_input === "object" ? input.tool_input : {};
|
|
69
90
|
if (tool === "Bash") {
|
|
70
91
|
const command = typeof args.command === "string" ? args.command : "";
|
|
71
|
-
const reason =
|
|
92
|
+
const reason = reasonFor({ kind: "shell", command });
|
|
72
93
|
return reason === null ? null : ask(reason);
|
|
73
94
|
}
|
|
74
95
|
if (!tool.startsWith(TOOL_PREFIX)) return null;
|
|
75
|
-
const reason =
|
|
96
|
+
const reason = reasonFor({ kind: "tool", name: tool.slice(TOOL_PREFIX.length), args });
|
|
76
97
|
return reason === null ? null : ask(reason);
|
|
77
98
|
} catch {
|
|
78
99
|
return null;
|
|
79
100
|
}
|
|
80
101
|
}
|
|
81
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Cursor's side: the answer to one beforeShellExecution input, `{
|
|
105
|
+
* permission: "ask", user_message, agent_message }`, or `{}` to say
|
|
106
|
+
* nothing. Any other event says nothing. Never throws. Cursor asks the
|
|
107
|
+
* person in its window; a run that allows every command (`--force`) passes
|
|
108
|
+
* over an ask, which is the person's own choice.
|
|
109
|
+
*/
|
|
110
|
+
export function decideCursor(input) {
|
|
111
|
+
try {
|
|
112
|
+
if (input === null || typeof input !== "object" || input.hook_event_name !== "beforeShellExecution") return {};
|
|
113
|
+
const reason = reasonFor({ kind: "shell", command: typeof input.command === "string" ? input.command : "" });
|
|
114
|
+
return reason === null ? {} : { permission: "ask", user_message: reason, agent_message: `${reason} ${AGENT_LINE}` };
|
|
115
|
+
} catch {
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
82
120
|
function ask(reason) {
|
|
83
121
|
return {
|
|
84
122
|
hookSpecificOutput: {
|