gm-skill 2.0.1217 → 2.0.1218
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 +1 -1
- package/gm-plugkit/plugkit-wasm-wrapper.js +48 -9
- package/gm.json +1 -1
- package/lib/skill-bootstrap.js +74 -11
- package/package.json +2 -2
- package/prompts/prompt-submit.txt +4 -0
- package/skills/gm-skill/SKILL.md +2 -0
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ An earlier generation fanned out fifteen per-platform downstream repos (gm-cc, g
|
|
|
35
35
|
|
|
36
36
|
## Version
|
|
37
37
|
|
|
38
|
-
`2.0.
|
|
38
|
+
`2.0.1218` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
|
|
39
39
|
|
|
40
40
|
## Source of truth
|
|
41
41
|
|
|
@@ -70,6 +70,32 @@ function isSpoolPollCommand(command) {
|
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
function isBrowserRunningFileLocal(rel) {
|
|
74
|
+
if (!rel) return false;
|
|
75
|
+
const norm = String(rel).replace(/\\\\/g, '/');
|
|
76
|
+
if (/\\.(html?|tsx|jsx|vue|svelte)$/i.test(norm)) return true;
|
|
77
|
+
if (/\\.(mjs|cjs|js|ts|css|scss|sass)$/i.test(norm) && /^(src|public|site|app|pages|components|client|web)\\//i.test(norm)) return true;
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function recordBrowserEditLocal(cwd, filePath) {
|
|
82
|
+
try {
|
|
83
|
+
const fs = require('fs');
|
|
84
|
+
const path = require('path');
|
|
85
|
+
let rel = filePath;
|
|
86
|
+
try { rel = path.relative(cwd, filePath); } catch (_) {}
|
|
87
|
+
if (!isBrowserRunningFileLocal(rel)) return false;
|
|
88
|
+
const editsFile = path.join(cwd, '.gm', 'exec-spool', '.turn-browser-edits.json');
|
|
89
|
+
fs.mkdirSync(path.dirname(editsFile), { recursive: true });
|
|
90
|
+
let list = [];
|
|
91
|
+
try { list = JSON.parse(fs.readFileSync(editsFile, 'utf8')); if (!Array.isArray(list)) list = []; } catch (_) {}
|
|
92
|
+
const entry = { file: rel.replace(/\\\\/g, '/'), ts: Date.now() };
|
|
93
|
+
if (!list.some(e => e && e.file === entry.file)) list.push(entry);
|
|
94
|
+
fs.writeFileSync(editsFile, JSON.stringify(list));
|
|
95
|
+
return true;
|
|
96
|
+
} catch (_) { return false; }
|
|
97
|
+
}
|
|
98
|
+
|
|
73
99
|
let raw = '';
|
|
74
100
|
process.stdin.setEncoding('utf8');
|
|
75
101
|
process.stdin.on('data', (chunk) => { raw += chunk; });
|
|
@@ -78,6 +104,17 @@ process.stdin.on('end', () => {
|
|
|
78
104
|
try { event = JSON.parse(raw || '{}'); } catch (_) { event = {}; }
|
|
79
105
|
const tool = event.tool_name || event.tool || '';
|
|
80
106
|
const input = event.tool_input || event.input || {};
|
|
107
|
+
const cwd = event.cwd || process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
108
|
+
|
|
109
|
+
if (tool === 'Write' || tool === 'Edit' || tool === 'MultiEdit') {
|
|
110
|
+
const fp = input.file_path || input.filePath || input.path || '';
|
|
111
|
+
if (fp) {
|
|
112
|
+
try { recordBrowserEditLocal(cwd, fp); } catch (_) {}
|
|
113
|
+
}
|
|
114
|
+
process.stdout.write(JSON.stringify({ continue: true }));
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
|
|
81
118
|
if (tool !== 'Bash') {
|
|
82
119
|
process.stdout.write(JSON.stringify({ continue: true }));
|
|
83
120
|
process.exit(0);
|
|
@@ -165,15 +202,17 @@ function ensureSpoolPollGate(cwd) {
|
|
|
165
202
|
if (!settings.hooks || typeof settings.hooks !== 'object') settings.hooks = {};
|
|
166
203
|
if (!Array.isArray(settings.hooks.PreToolUse)) settings.hooks.PreToolUse = [];
|
|
167
204
|
const wantCommand = `node "\${CLAUDE_PROJECT_DIR}/.gm/hooks/spool-poll-gate.js"`;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
205
|
+
for (const matcher of ['Bash', 'Write', 'Edit', 'MultiEdit']) {
|
|
206
|
+
let entry = settings.hooks.PreToolUse.find(e => e && e.matcher === matcher);
|
|
207
|
+
if (!entry) {
|
|
208
|
+
entry = { matcher, hooks: [] };
|
|
209
|
+
settings.hooks.PreToolUse.push(entry);
|
|
210
|
+
}
|
|
211
|
+
if (!Array.isArray(entry.hooks)) entry.hooks = [];
|
|
212
|
+
const already = entry.hooks.some(h => h && typeof h.command === 'string' && h.command.includes('spool-poll-gate.js'));
|
|
213
|
+
if (!already) {
|
|
214
|
+
entry.hooks.push({ type: 'command', command: wantCommand });
|
|
215
|
+
}
|
|
177
216
|
}
|
|
178
217
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
179
218
|
} catch (_) {}
|
package/gm.json
CHANGED
package/lib/skill-bootstrap.js
CHANGED
|
@@ -363,6 +363,32 @@ function isSpoolPollCommand(command) {
|
|
|
363
363
|
return null;
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
+
function isBrowserRunningFileLocal(rel) {
|
|
367
|
+
if (!rel) return false;
|
|
368
|
+
const norm = String(rel).replace(/\\\\/g, '/');
|
|
369
|
+
if (/\\.(html?|tsx|jsx|vue|svelte)$/i.test(norm)) return true;
|
|
370
|
+
if (/\\.(mjs|cjs|js|ts|css|scss|sass)$/i.test(norm) && /^(src|public|site|app|pages|components|client|web)\\//i.test(norm)) return true;
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function recordBrowserEditLocal(cwd, filePath) {
|
|
375
|
+
try {
|
|
376
|
+
const fs = require('fs');
|
|
377
|
+
const path = require('path');
|
|
378
|
+
let rel = filePath;
|
|
379
|
+
try { rel = path.relative(cwd, filePath); } catch (_) {}
|
|
380
|
+
if (!isBrowserRunningFileLocal(rel)) return false;
|
|
381
|
+
const editsFile = path.join(cwd, '.gm', 'exec-spool', '.turn-browser-edits.json');
|
|
382
|
+
fs.mkdirSync(path.dirname(editsFile), { recursive: true });
|
|
383
|
+
let list = [];
|
|
384
|
+
try { list = JSON.parse(fs.readFileSync(editsFile, 'utf8')); if (!Array.isArray(list)) list = []; } catch (_) {}
|
|
385
|
+
const entry = { file: rel.replace(/\\\\/g, '/'), ts: Date.now() };
|
|
386
|
+
if (!list.some(e => e && e.file === entry.file)) list.push(entry);
|
|
387
|
+
fs.writeFileSync(editsFile, JSON.stringify(list));
|
|
388
|
+
return true;
|
|
389
|
+
} catch (_) { return false; }
|
|
390
|
+
}
|
|
391
|
+
|
|
366
392
|
let raw = '';
|
|
367
393
|
process.stdin.setEncoding('utf8');
|
|
368
394
|
process.stdin.on('data', (chunk) => { raw += chunk; });
|
|
@@ -371,6 +397,17 @@ process.stdin.on('end', () => {
|
|
|
371
397
|
try { event = JSON.parse(raw || '{}'); } catch (_) { event = {}; }
|
|
372
398
|
const tool = event.tool_name || event.tool || '';
|
|
373
399
|
const input = event.tool_input || event.input || {};
|
|
400
|
+
const cwd = event.cwd || process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
401
|
+
|
|
402
|
+
if (tool === 'Write' || tool === 'Edit' || tool === 'MultiEdit') {
|
|
403
|
+
const fp = input.file_path || input.filePath || input.path || '';
|
|
404
|
+
if (fp) {
|
|
405
|
+
try { recordBrowserEditLocal(cwd, fp); } catch (_) {}
|
|
406
|
+
}
|
|
407
|
+
process.stdout.write(JSON.stringify({ continue: true }));
|
|
408
|
+
process.exit(0);
|
|
409
|
+
}
|
|
410
|
+
|
|
374
411
|
if (tool !== 'Bash') {
|
|
375
412
|
process.stdout.write(JSON.stringify({ continue: true }));
|
|
376
413
|
process.exit(0);
|
|
@@ -417,11 +454,33 @@ function ensureSpoolPollGate(cwd) {
|
|
|
417
454
|
const gateScript = path.join(gmHooks, 'spool-poll-gate.js');
|
|
418
455
|
const want = spoolPollGateScript();
|
|
419
456
|
let need = true;
|
|
457
|
+
let oldSha = '';
|
|
458
|
+
let existed = false;
|
|
420
459
|
try {
|
|
421
460
|
const existing = fs.readFileSync(gateScript, 'utf8');
|
|
461
|
+
existed = true;
|
|
422
462
|
if (existing === want) need = false;
|
|
463
|
+
else {
|
|
464
|
+
try {
|
|
465
|
+
const _crypto = require('crypto');
|
|
466
|
+
oldSha = _crypto.createHash('sha256').update(existing).digest('hex').slice(0, 12);
|
|
467
|
+
} catch (_) {}
|
|
468
|
+
}
|
|
423
469
|
} catch (_) {}
|
|
424
|
-
if (need)
|
|
470
|
+
if (need) {
|
|
471
|
+
fs.writeFileSync(gateScript, want);
|
|
472
|
+
try {
|
|
473
|
+
const _crypto = require('crypto');
|
|
474
|
+
const newSha = _crypto.createHash('sha256').update(want).digest('hex').slice(0, 12);
|
|
475
|
+
emitBootstrapEvent('info', existed ? 'gate.refreshed' : 'gate.installed', {
|
|
476
|
+
cwd,
|
|
477
|
+
path: gateScript,
|
|
478
|
+
old_sha: oldSha || null,
|
|
479
|
+
new_sha: newSha,
|
|
480
|
+
bytes: Buffer.byteLength(want, 'utf8'),
|
|
481
|
+
});
|
|
482
|
+
} catch (_) {}
|
|
483
|
+
}
|
|
425
484
|
|
|
426
485
|
const claudeDir = path.join(cwd, '.claude');
|
|
427
486
|
fs.mkdirSync(claudeDir, { recursive: true });
|
|
@@ -434,18 +493,22 @@ function ensureSpoolPollGate(cwd) {
|
|
|
434
493
|
if (!settings.hooks || typeof settings.hooks !== 'object') settings.hooks = {};
|
|
435
494
|
if (!Array.isArray(settings.hooks.PreToolUse)) settings.hooks.PreToolUse = [];
|
|
436
495
|
const wantCommand = `node "\${CLAUDE_PROJECT_DIR}/.gm/hooks/spool-poll-gate.js"`;
|
|
437
|
-
let
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
496
|
+
let anyAlready = true;
|
|
497
|
+
for (const matcher of ['Bash', 'Write', 'Edit', 'MultiEdit']) {
|
|
498
|
+
let entry = settings.hooks.PreToolUse.find(e => e && e.matcher === matcher);
|
|
499
|
+
if (!entry) {
|
|
500
|
+
entry = { matcher, hooks: [] };
|
|
501
|
+
settings.hooks.PreToolUse.push(entry);
|
|
502
|
+
}
|
|
503
|
+
if (!Array.isArray(entry.hooks)) entry.hooks = [];
|
|
504
|
+
const already = entry.hooks.some(h => h && typeof h.command === 'string' && h.command.includes('spool-poll-gate.js'));
|
|
505
|
+
if (!already) {
|
|
506
|
+
entry.hooks.push({ type: 'command', command: wantCommand });
|
|
507
|
+
anyAlready = false;
|
|
508
|
+
}
|
|
446
509
|
}
|
|
447
510
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
448
|
-
emitBootstrapEvent('info', 'Spool-poll gate ensured', { gateScript, settingsPath, hookAlreadyPresent:
|
|
511
|
+
emitBootstrapEvent('info', 'Spool-poll gate ensured', { gateScript, settingsPath, hookAlreadyPresent: anyAlready });
|
|
449
512
|
} catch (e) {
|
|
450
513
|
emitBootstrapEvent('warn', 'ensureSpoolPollGate failed', { error: e.message });
|
|
451
514
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-skill",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1218",
|
|
4
4
|
"description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"gm.json"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"gm-plugkit": "^2.0.
|
|
42
|
+
"gm-plugkit": "^2.0.1218"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=16.0.0"
|
|
@@ -66,6 +66,10 @@ Asking is permitted only as last resort — destructive-irreversible action with
|
|
|
66
66
|
|
|
67
67
|
The size of the task, the cost of context, the duration of CI, and the number of repos involved are never grounds to ask. Neither is "this change touches files the user reads" — your job is to land the change correctly, not to defer to a review you imagine the user wants. Audit findings, prose rewrites, configuration edits, and refactors all ship inside the same turn as the analysis that produced them. Stopping mid-loop to ask "should I apply these?" is itself the deviation pattern: it routes the doubt back to the user instead of executing.
|
|
68
68
|
|
|
69
|
+
=== AUTO-RECALL ON TURN ENTRY ===
|
|
70
|
+
|
|
71
|
+
On every first `instruction` dispatch after a >30s idle gap (or at session-start), plugkit derives a 2–6 word recall query from `.gm/last-prompt.txt` / `.gm/turn-state.json` and attaches the resulting hits to the `instruction` response under the top-level field `auto_recall: {query, hits, fired_at, turn_entry: true}`. This is in addition to the existing `recall_hits` field (which is the phase+PRD-subject pack). Plugkit attaches the auto-recall pack to your instruction response on turn entry — YOU read it the same way you read `recall_hits`. Subsequent `instruction` dispatches in the same turn do not re-fire auto-recall; if you need a different query mid-turn, dispatch the `auto-recall` verb explicitly with your prompt as the body.
|
|
72
|
+
|
|
69
73
|
=== NO WAITING FOR PLUGKIT — HARD RULE ===
|
|
70
74
|
|
|
71
75
|
Plugkit is synchronous from your perspective. You write the request file; the spool watcher processes it; you read the response file. There is no background work happening "while you wait." If you find yourself running `sleep 2; ls .gm/exec-spool/out/`, `Start-Sleep -Milliseconds 2500; Test-Path ...`, or any other poll-wait on the spool, you have misread the architecture. Read the response file directly with the Read tool — if it does not exist yet, the watcher is either dead (check `.gm/exec-spool/.status.json` mtime) or the verb is genuinely slow (check `.gm/exec-spool/.watcher.log` for the dispatch trace). Polling is forbidden. Wait-narration ("the orchestrator is processing, while waiting let me…") is a tell that you have lost the loop.
|
package/skills/gm-skill/SKILL.md
CHANGED
|
@@ -21,3 +21,5 @@ bun x gm-plugkit@latest spool > /dev/null 2>&1 &
|
|
|
21
21
|
(`npx -y gm-plugkit@latest spool > /dev/null 2>&1 &` if `bun` missing.) Heartbeat fresh → YOU dispatch `instruction` — first turn body `{"prompt":"<user request>"}` so orient_nouns and recall_hits derive from the request; subsequent turns may use empty body. Read the response file directly with the Read tool. Never poll the spool dir with `sleep && ls` or `Start-Sleep && Test-Path` — plugkit is synchronous from your view; if the response is not there, the watcher is dead (check `.status.json` mtime) or the verb is slow (check `.watcher.log`), not "still processing."
|
|
22
22
|
|
|
23
23
|
Response body is not a mutation surface. Memory writes route through `memorize-fire` only — another verb YOU dispatch.
|
|
24
|
+
|
|
25
|
+
On turn entry (first `instruction` dispatch after a >30s idle gap or session-start), plugkit attaches an `auto_recall` pack to your `instruction` response: `{query, hits, fired_at, turn_entry: true}`. The query is derived from `.gm/last-prompt.txt` / `.gm/turn-state.json`; hits are the top recall results plugkit pulled before serving your instruction. Read `auto_recall.hits` alongside the existing `recall_hits` (which is the phase+PRD-subject pack) — both surface prior memory, but `auto_recall` is the per-turn user-prompt pack and only fires on turn entry. Subsequent `instruction` dispatches in the same turn carry no `auto_recall` field (or carry the same pack from the turn-start fire); do not re-trigger it manually.
|