gm-skill 2.0.1148 → 2.0.1150
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/bin/plugkit.version +1 -1
- package/bin/plugkit.wasm +0 -0
- package/bin/plugkit.wasm.sha256 +1 -1
- package/gm-plugkit/plugkit-wasm-wrapper.js +92 -6
- package/gm.json +2 -2
- package/lib/spool-dispatch.js +118 -3
- package/package.json +2 -2
- package/skills/gm-skill/SKILL.md +13 -5
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.1150` — 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
|
|
package/bin/plugkit.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.415
|
package/bin/plugkit.wasm
CHANGED
|
Binary file
|
package/bin/plugkit.wasm.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3af3d80f571bec77e28471184811226f865a150cfcbecef00b6d90e2ed90c140 plugkit.wasm
|
|
@@ -14,6 +14,73 @@ const __dirname = path.dirname(__filename);
|
|
|
14
14
|
const KV_DIR = path.join(os.homedir(), '.claude', 'gm-tools', 'kv');
|
|
15
15
|
fs.mkdirSync(KV_DIR, { recursive: true });
|
|
16
16
|
|
|
17
|
+
const GM_LOG_ROOT = process.env.GM_LOG_DIR || path.join(os.homedir(), '.claude', 'gm-log');
|
|
18
|
+
const ORCHESTRATOR_VERBS = new Set(['instruction', 'transition', 'phase-status', 'prd-add', 'prd-resolve', 'prd-list', 'mutable-add', 'mutable-resolve', 'mutable-list', 'memorize-fire', 'residual-scan', 'auto-recall']);
|
|
19
|
+
|
|
20
|
+
function logEvent(sub, event, fields) {
|
|
21
|
+
if (process.env.GM_LOG_DISABLE) return;
|
|
22
|
+
try {
|
|
23
|
+
const day = new Date().toISOString().slice(0, 10);
|
|
24
|
+
const dir = path.join(GM_LOG_ROOT, day);
|
|
25
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
26
|
+
const line = JSON.stringify({
|
|
27
|
+
ts: new Date().toISOString(),
|
|
28
|
+
sub,
|
|
29
|
+
event,
|
|
30
|
+
pid: process.pid,
|
|
31
|
+
sess: process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '',
|
|
32
|
+
...fields,
|
|
33
|
+
});
|
|
34
|
+
fs.appendFileSync(path.join(dir, `${sub}.jsonl`), line + '\n');
|
|
35
|
+
} catch (_) {}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function emitOrchestratorEvents(verb, taskBase, resultStr) {
|
|
39
|
+
if (!ORCHESTRATOR_VERBS.has(verb)) return;
|
|
40
|
+
let parsed;
|
|
41
|
+
try { parsed = JSON.parse(resultStr); } catch (_) { return; }
|
|
42
|
+
if (!parsed || parsed.ok !== true) {
|
|
43
|
+
logEvent('plugkit', 'orchestrator.error', { verb, task: taskBase, error: parsed && parsed.error ? String(parsed.error) : 'unknown' });
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const data = parsed.data || {};
|
|
47
|
+
switch (verb) {
|
|
48
|
+
case 'transition':
|
|
49
|
+
logEvent('plugkit', 'phase.transitioned', { task: taskBase, phase: data.phase, next_skill: data.nextSkill, recall_count: Array.isArray(data.recall_hits) ? data.recall_hits.length : 0 });
|
|
50
|
+
break;
|
|
51
|
+
case 'instruction':
|
|
52
|
+
logEvent('plugkit', 'instruction.served', { task: taskBase, phase: data.phase, prd_pending: data.prd_pending_count, mutables_pending: Array.isArray(data.mutables_pending) ? data.mutables_pending.length : 0, next_phase_hint: data.next_phase_hint });
|
|
53
|
+
break;
|
|
54
|
+
case 'phase-status':
|
|
55
|
+
logEvent('plugkit', 'phase.status', { task: taskBase, phase: data.phase, last_skill: data.last_skill });
|
|
56
|
+
break;
|
|
57
|
+
case 'prd-add':
|
|
58
|
+
logEvent('plugkit', 'prd.added', { task: taskBase, id: data.added });
|
|
59
|
+
break;
|
|
60
|
+
case 'prd-resolve':
|
|
61
|
+
logEvent('plugkit', 'prd.resolved', { task: taskBase, id: data.resolved });
|
|
62
|
+
break;
|
|
63
|
+
case 'mutable-add':
|
|
64
|
+
logEvent('plugkit', 'mutable.added', { task: taskBase, id: data.added });
|
|
65
|
+
break;
|
|
66
|
+
case 'mutable-resolve':
|
|
67
|
+
logEvent('plugkit', 'mutable.resolved', { task: taskBase, id: data.resolved, memorize_spool: data.memorize_spool });
|
|
68
|
+
break;
|
|
69
|
+
case 'memorize-fire':
|
|
70
|
+
logEvent('plugkit', 'memorize.fired', { task: taskBase, key: data.key, namespace: data.namespace, bytes: data.bytes });
|
|
71
|
+
break;
|
|
72
|
+
case 'residual-scan':
|
|
73
|
+
if (data.scan === 'fired') logEvent('plugkit', 'residual.fired', { task: taskBase, marker: data.marker });
|
|
74
|
+
else logEvent('plugkit', 'residual.skipped', { task: taskBase, reason: data.reason });
|
|
75
|
+
break;
|
|
76
|
+
case 'auto-recall':
|
|
77
|
+
logEvent('plugkit', 'auto_recall.hits', { task: taskBase, count: Array.isArray(data.hits) ? data.hits.length : 0 });
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
17
84
|
const TMP_DIR = os.tmpdir();
|
|
18
85
|
const BROWSER_PORTS_FILE = path.join(TMP_DIR, 'plugkit-browser-ports.json');
|
|
19
86
|
const BROWSER_SESSIONS_FILE = path.join(TMP_DIR, 'plugkit-browser-sessions.json');
|
|
@@ -656,8 +723,10 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
656
723
|
}
|
|
657
724
|
} catch (e) { console.error(`[plugkit-wasm] wrapper self-install failed: ${e.message}`); }
|
|
658
725
|
|
|
659
|
-
|
|
726
|
+
const _bootVersion = resolveVersion(instance);
|
|
727
|
+
console.log(`[plugkit-wasm] plugkit v${_bootVersion} (wasm)`);
|
|
660
728
|
console.log(`[plugkit-wasm] watching ${inDir}`);
|
|
729
|
+
logEvent('plugkit', 'watcher.boot', { version: _bootVersion, in_dir: inDir, out_dir: outDir, spool_dir: spoolDir });
|
|
661
730
|
|
|
662
731
|
const PROCESSED_MAX = 10000;
|
|
663
732
|
const processed = new Map();
|
|
@@ -692,6 +761,7 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
692
761
|
|
|
693
762
|
const t0 = Date.now();
|
|
694
763
|
console.log(`[dispatch] → verb=${verb} task=${taskBase} body=${bodyBytes.length}b`);
|
|
764
|
+
logEvent('plugkit', 'dispatch.start', { verb, task: taskBase, body_bytes: bodyBytes.length, cwd: process.cwd() });
|
|
695
765
|
|
|
696
766
|
const verbPtr = instance.exports.plugkit_alloc(verbBytes.length);
|
|
697
767
|
const bodyPtr = instance.exports.plugkit_alloc(bodyBytes.length);
|
|
@@ -707,7 +777,10 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
707
777
|
|
|
708
778
|
const outName = dir === '.' ? `${taskBase}.json` : `${verb}-${taskBase}.json`;
|
|
709
779
|
fs.writeFileSync(path.join(outDir, outName), resultStr);
|
|
710
|
-
|
|
780
|
+
const dur_ms = Date.now() - t0;
|
|
781
|
+
console.log(`[dispatch] ← verb=${verb} task=${taskBase} ms=${dur_ms} out=${resultStr.length}b`);
|
|
782
|
+
logEvent('plugkit', 'dispatch.end', { verb, task: taskBase, dur_ms, out_bytes: resultStr.length });
|
|
783
|
+
emitOrchestratorEvents(verb, taskBase, resultStr);
|
|
711
784
|
|
|
712
785
|
try { instance.exports.plugkit_free(verbPtr, verbBytes.length); } catch (_) {}
|
|
713
786
|
try { instance.exports.plugkit_free(bodyPtr, bodyBytes.length); } catch (_) {}
|
|
@@ -727,6 +800,7 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
727
800
|
} catch (_) {}
|
|
728
801
|
try { fs.unlinkSync(filePath); } catch (_) {}
|
|
729
802
|
unmarkProcessed(key);
|
|
803
|
+
logEvent('plugkit', 'dispatch.error', { verb, task: taskBase, error: String(e && e.message || e) });
|
|
730
804
|
}
|
|
731
805
|
};
|
|
732
806
|
|
|
@@ -819,8 +893,14 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
819
893
|
if (s.mtimeMs < cutoff) { fs.unlinkSync(fp); swept++; }
|
|
820
894
|
} catch (e) { console.error(`[retention] failed to sweep ${entry}: ${e.message}`); }
|
|
821
895
|
}
|
|
822
|
-
if (swept > 0)
|
|
823
|
-
|
|
896
|
+
if (swept > 0) {
|
|
897
|
+
console.log(`[retention] swept ${swept} out/ files older than 1h`);
|
|
898
|
+
logEvent('plugkit', 'sweep.retention', { swept });
|
|
899
|
+
}
|
|
900
|
+
} catch (e) {
|
|
901
|
+
console.error(`[retention] sweep error: ${e.message}`);
|
|
902
|
+
logEvent('plugkit', 'sweep.retention.error', { error: String(e.message || e) });
|
|
903
|
+
}
|
|
824
904
|
}, 60_000);
|
|
825
905
|
|
|
826
906
|
setInterval(() => {
|
|
@@ -848,8 +928,14 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
848
928
|
}
|
|
849
929
|
};
|
|
850
930
|
walk(inDir);
|
|
851
|
-
if (stale > 0)
|
|
852
|
-
|
|
931
|
+
if (stale > 0) {
|
|
932
|
+
console.log(`[stale-sweep] failed ${stale} orphaned inputs`);
|
|
933
|
+
logEvent('plugkit', 'sweep.stale', { stale });
|
|
934
|
+
}
|
|
935
|
+
} catch (e) {
|
|
936
|
+
console.error(`[stale-sweep] sweep error: ${e.message}`);
|
|
937
|
+
logEvent('plugkit', 'sweep.stale.error', { error: String(e.message || e) });
|
|
938
|
+
}
|
|
853
939
|
}, 300_000);
|
|
854
940
|
|
|
855
941
|
const existing = walkDir(inDir);
|
package/gm.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1150",
|
|
4
4
|
"description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
|
-
"plugkitVersion": "0.1.
|
|
20
|
+
"plugkitVersion": "0.1.415"
|
|
21
21
|
}
|
package/lib/spool-dispatch.js
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
|
+
const { spawnSync } = require('child_process');
|
|
5
|
+
|
|
6
|
+
const GM_LOG_ROOT = process.env.GM_LOG_DIR || path.join(os.homedir(), '.claude', 'gm-log');
|
|
7
|
+
|
|
8
|
+
function logDeviation(event, fields) {
|
|
9
|
+
if (process.env.GM_LOG_DISABLE) return;
|
|
10
|
+
try {
|
|
11
|
+
const day = new Date().toISOString().slice(0, 10);
|
|
12
|
+
const dir = path.join(GM_LOG_ROOT, day);
|
|
13
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
14
|
+
const line = JSON.stringify({
|
|
15
|
+
ts: new Date().toISOString(),
|
|
16
|
+
sub: 'hook',
|
|
17
|
+
event,
|
|
18
|
+
pid: process.pid,
|
|
19
|
+
sess: process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '',
|
|
20
|
+
cwd: process.cwd(),
|
|
21
|
+
...fields,
|
|
22
|
+
});
|
|
23
|
+
fs.appendFileSync(path.join(dir, 'hook.jsonl'), line + '\n');
|
|
24
|
+
} catch (_) {}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isWorktreeDirty(cwd) {
|
|
28
|
+
try {
|
|
29
|
+
const r = spawnSync('git', ['status', '--porcelain'], {
|
|
30
|
+
cwd: cwd || process.cwd(), encoding: 'utf8', timeout: 1500, windowsHide: true
|
|
31
|
+
});
|
|
32
|
+
if (r.status !== 0) return { dirty: false, files: [], available: false };
|
|
33
|
+
const lines = r.stdout.split('\n').filter(l => l.length > 0);
|
|
34
|
+
return { dirty: lines.length > 0, files: lines, available: true };
|
|
35
|
+
} catch (_) {
|
|
36
|
+
return { dirty: false, files: [], available: false };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function hasUnpushedCommits(cwd) {
|
|
41
|
+
try {
|
|
42
|
+
const r = spawnSync('git', ['log', '@{u}..HEAD', '--oneline'], {
|
|
43
|
+
cwd: cwd || process.cwd(), encoding: 'utf8', timeout: 1500, windowsHide: true
|
|
44
|
+
});
|
|
45
|
+
if (r.status !== 0) return { unpushed: false, count: 0, available: false };
|
|
46
|
+
const lines = r.stdout.split('\n').filter(l => l.length > 0);
|
|
47
|
+
return { unpushed: lines.length > 0, count: lines.length, available: true };
|
|
48
|
+
} catch (_) {
|
|
49
|
+
return { unpushed: false, count: 0, available: false };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
4
52
|
|
|
5
53
|
async function dispatchSpool(cmd, lang, body, timeoutMs, sessionId) {
|
|
6
54
|
const taskId = `${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;
|
|
@@ -72,16 +120,82 @@ async function pollForCompletion(jsonFile, timeoutMs, taskId) {
|
|
|
72
120
|
};
|
|
73
121
|
}
|
|
74
122
|
|
|
75
|
-
function
|
|
76
|
-
const
|
|
123
|
+
function sessionMarkerPath(sessionId, kind) {
|
|
124
|
+
const cwd = process.cwd();
|
|
125
|
+
return path.join(cwd, '.gm', 'exec-spool', `.session-${kind}-${sessionId || 'anon'}`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function hasDispatchedInstruction(sessionId) {
|
|
129
|
+
try {
|
|
130
|
+
const outDir = path.join(process.cwd(), '.gm', 'exec-spool', 'out');
|
|
131
|
+
if (!fs.existsSync(outDir)) return false;
|
|
132
|
+
for (const f of fs.readdirSync(outDir)) {
|
|
133
|
+
if (f.startsWith('instruction-')) return true;
|
|
134
|
+
}
|
|
135
|
+
} catch (_) {}
|
|
136
|
+
return fs.existsSync(sessionMarkerPath(sessionId, 'instruction-seen'));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function markInstructionSeen(sessionId) {
|
|
140
|
+
try {
|
|
141
|
+
fs.mkdirSync(path.dirname(sessionMarkerPath(sessionId, 'instruction-seen')), { recursive: true });
|
|
142
|
+
fs.writeFileSync(sessionMarkerPath(sessionId, 'instruction-seen'), String(Date.now()));
|
|
143
|
+
} catch (_) {}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function checkDispatchGates(sessionId, operation, extra) {
|
|
147
|
+
const cwd = process.cwd();
|
|
148
|
+
const gm = path.join(cwd, '.gm');
|
|
77
149
|
const prdPath = path.join(gm, 'prd.yml');
|
|
78
150
|
const mutsPath = path.join(gm, 'mutables.yml');
|
|
79
151
|
const needsGmPath = path.join(gm, 'needs-gm');
|
|
80
152
|
const gmFiredPath = path.join(gm, `gm-fired-${sessionId}`);
|
|
81
153
|
|
|
154
|
+
if (['stop', 'complete'].includes(operation)) {
|
|
155
|
+
const residuals = [];
|
|
156
|
+
if (fs.existsSync(prdPath)) {
|
|
157
|
+
try {
|
|
158
|
+
const content = fs.readFileSync(prdPath, 'utf8');
|
|
159
|
+
if (content.includes('status: pending') || content.includes('status: in_progress')) {
|
|
160
|
+
residuals.push('PRD has open items — resolve or name-and-stop before declaring done');
|
|
161
|
+
}
|
|
162
|
+
} catch (_) {}
|
|
163
|
+
}
|
|
164
|
+
if (fs.existsSync(mutsPath)) {
|
|
165
|
+
try {
|
|
166
|
+
const content = fs.readFileSync(mutsPath, 'utf8');
|
|
167
|
+
if (content.includes('status: unknown')) {
|
|
168
|
+
residuals.push('unresolved mutables present — resolve with witness_evidence before declaring done');
|
|
169
|
+
}
|
|
170
|
+
} catch (_) {}
|
|
171
|
+
}
|
|
172
|
+
const dirty = isWorktreeDirty(cwd);
|
|
173
|
+
if (dirty.available && dirty.dirty) {
|
|
174
|
+
residuals.push(`worktree dirty (${dirty.files.length} file${dirty.files.length === 1 ? '' : 's'}) — commit and push before declaring done`);
|
|
175
|
+
}
|
|
176
|
+
const unpushed = hasUnpushedCommits(cwd);
|
|
177
|
+
if (unpushed.available && unpushed.unpushed) {
|
|
178
|
+
residuals.push(`${unpushed.count} unpushed commit${unpushed.count === 1 ? '' : 's'} — push to remote before declaring done`);
|
|
179
|
+
}
|
|
180
|
+
if (residuals.length > 0) {
|
|
181
|
+
logDeviation('deviation.gate-deny', { operation, reason: 'stop-gate residuals', residuals });
|
|
182
|
+
return { allowed: false, reason: `stop-gate residuals: ${residuals.join('; ')}`, residuals };
|
|
183
|
+
}
|
|
184
|
+
return { allowed: true };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (['write', 'edit'].includes(operation) && !hasDispatchedInstruction(sessionId)) {
|
|
188
|
+
logDeviation('deviation.write-before-instruction', { operation, sessionId });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (operation === 'mutable-resolve' && extra && (!extra.witness_evidence || String(extra.witness_evidence).trim() === '')) {
|
|
192
|
+
logDeviation('deviation.mutable-without-evidence', { mutable_id: extra.id || null });
|
|
193
|
+
}
|
|
194
|
+
|
|
82
195
|
if (!['write', 'edit', 'git'].includes(operation)) return { allowed: true };
|
|
83
196
|
|
|
84
197
|
if (fs.existsSync(prdPath) && fs.existsSync(needsGmPath) && !fs.existsSync(gmFiredPath)) {
|
|
198
|
+
logDeviation('deviation.gate-deny', { operation, reason: 'gm orchestration in progress' });
|
|
85
199
|
return { allowed: false, reason: 'gm orchestration in progress; skills must complete work before tools execute' };
|
|
86
200
|
}
|
|
87
201
|
|
|
@@ -89,6 +203,7 @@ function checkDispatchGates(sessionId, operation) {
|
|
|
89
203
|
try {
|
|
90
204
|
const content = fs.readFileSync(mutsPath, 'utf8');
|
|
91
205
|
if (content.includes('status: unknown')) {
|
|
206
|
+
logDeviation('deviation.gate-deny', { operation, reason: 'unresolved mutables' });
|
|
92
207
|
return { allowed: false, reason: 'unresolved mutables block tool execution; resolve all mutables before proceeding' };
|
|
93
208
|
}
|
|
94
209
|
} catch (_) {}
|
|
@@ -97,4 +212,4 @@ function checkDispatchGates(sessionId, operation) {
|
|
|
97
212
|
return { allowed: true };
|
|
98
213
|
}
|
|
99
214
|
|
|
100
|
-
module.exports = { dispatchSpool, checkDispatchGates };
|
|
215
|
+
module.exports = { dispatchSpool, checkDispatchGates, isWorktreeDirty, hasUnpushedCommits, logDeviation, markInstructionSeen, hasDispatchedInstruction };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-skill",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1150",
|
|
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.1150"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=16.0.0"
|
package/skills/gm-skill/SKILL.md
CHANGED
|
@@ -6,6 +6,14 @@ allowed-tools: Skill, Read, Write, Bash(node *), Bash(bun *)
|
|
|
6
6
|
|
|
7
7
|
# gm — single entry point
|
|
8
8
|
|
|
9
|
+
Every turn begins with `instruction`. Write `.gm/exec-spool/in/instruction/<N>.txt` (empty body) and read the response — its `instruction` field is the active phase prose, its `prd_items` is the live work plan, its `mutables_pending` is what blocks the EMIT gate, its `recall_hits` is the prior memory already loaded for you. Follow that prose imperatively until the phase's exit condition is met, then `transition`. The user's request is the authorization; the PRD is the receipt; the chain runs PLAN → EXECUTE → EMIT → VERIFY → COMPLETE without re-asking between phases.
|
|
10
|
+
|
|
11
|
+
Direct Read/Edit/Bash before the first `instruction` dispatch is the failure mode this skill prevents. If you find yourself reaching for a tool to "just take a quick look", you have already dropped the loop — dispatch `instruction` first, then act on its prose.
|
|
12
|
+
|
|
13
|
+
Fix on Sight. Every unexpected output, broken neighbor, lockfile drift, suppressed error, or stale generated file surfaced during work becomes a PRD item the same turn and is executed before COMPLETE. Surprise is a new mutable, not noise to absorb. Stubs, mocks, placeholder returns, fixture-only paths, and "always succeeds" code paths are forbidden in shipped material; acceptance is real input through real code into real output, witnessed. Edits to code that runs in a browser require a live `browser` verb witness in the same turn — Browser Witness is non-negotiable.
|
|
14
|
+
|
|
15
|
+
Before any apparent stop, dispatch `residual-scan`. If it returns work that fits the spirit of the original ask and is reachable from this session, expand the PRD and execute; only residuals genuinely out-of-spirit or out-of-reach are name-and-stop. A turn that ends with uncommitted changes, an open PRD slice, or unresolved mutables has not actually stopped — it has stalled the chain.
|
|
16
|
+
|
|
9
17
|
The wasm artifact lives at `~/.claude/gm-tools/plugkit.wasm`; the spool watcher runs it. The watcher's own stdout/stderr is appended to `.gm/exec-spool/.watcher.log` — Read it to see plugkit's internal trace, dispatch timings, sweep actions, errors.
|
|
10
18
|
|
|
11
19
|
## Boot the spool watcher (first turn only)
|
|
@@ -84,11 +92,11 @@ The log is rotated at 10MB (older content moves to `.watcher.log.1`).
|
|
|
84
92
|
|
|
85
93
|
## The loop
|
|
86
94
|
|
|
87
|
-
|
|
95
|
+
Add PRD items via `prd-add` (JSON body), resolve via `prd-resolve` (id as body). Add mutables via `mutable-add`, resolve via `mutable-resolve` once `witness_evidence` is filled — narrative resolution is rejected; only file:line, codesearch hit, or exec output snippet counts. Every `mutable-resolve` auto-fires memorize so the witness becomes recall-able next session.
|
|
88
96
|
|
|
89
97
|
Resolve every entry in `mutables_pending` before transitioning. When the phase's exit condition is met, dispatch `transition` with the next phase name (or empty for auto-advance). Each transition response embeds `recall_hits` automatically — relevant prior memos surface without you asking.
|
|
90
98
|
|
|
91
|
-
Stop when `
|
|
99
|
+
Stop only when `phase` is `COMPLETE` AND `residual-scan` returns empty AND the worktree is clean AND CI is green. Any of those false means the chain has not finished.
|
|
92
100
|
|
|
93
101
|
## Orchestrator verbs
|
|
94
102
|
|
|
@@ -104,8 +112,8 @@ Stop when `next_phase_hint` is null or phase is `COMPLETE`.
|
|
|
104
112
|
|
|
105
113
|
### Browser
|
|
106
114
|
|
|
107
|
-
Dispatch `.gm/exec-spool/in/browser/<N>.txt` with raw JavaScript as the body. The
|
|
115
|
+
The `browser` verb is the only sanctioned way to drive a live page. Do not reach for any other browser tool, library, or skill — the host owns the managed session and a parallel surface fragments witness state. Dispatch `.gm/exec-spool/in/browser/<N>.txt` with raw JavaScript as the body. The host runs Chrome under a project-scoped profile at `<cwd>/.gm/browser-profile/` (cookies/login persist per project) and exposes the body to four globals: `page` (the live page handle — `await page.goto(...)`, `await page.evaluate(...)`, etc.), `snapshot` (accessibility-tree snapshot), `screenshotWithAccessibilityLabels` (annotated screenshot helper), and `state` (a per-session object that persists across dispatches within the same session).
|
|
108
116
|
|
|
109
|
-
Special commands (body starts with `session `): `session new`, `session list`, `session close <id>`
|
|
117
|
+
Special commands (body starts with `session `): `session new`, `session list`, `session close <id>` manage session lifecycle.
|
|
110
118
|
|
|
111
|
-
|
|
119
|
+
Required for any edit to code that runs in a browser — Browser Witness is non-negotiable. A `node test.js passes` does not substitute for a live `page.evaluate` asserting the invariant the edit was supposed to change.
|