gm-skill 0.1.2 → 2.0.1081
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/AGENTS.md +1 -0
- package/LICENSE +21 -0
- package/README.md +20 -84
- package/agents/gm.md +22 -0
- package/agents/memorize.md +100 -0
- package/agents/research-worker.md +36 -0
- package/agents/textprocessing.md +47 -0
- package/bin/bootstrap.js +702 -0
- package/bin/plugkit.js +136 -0
- package/bin/plugkit.sha256 +7 -0
- package/bin/plugkit.version +1 -0
- package/bin/plugkit.wasm +0 -0
- package/bin/plugkit.wasm.sha256 +1 -0
- package/bin/rtk.sha256 +6 -0
- package/bin/rtk.version +1 -0
- package/gm-plugkit/bootstrap.js +694 -0
- package/gm-plugkit/cli.js +48 -0
- package/gm-plugkit/index.js +12 -0
- package/gm-plugkit/package.json +26 -0
- package/gm-plugkit/plugkit-wasm-wrapper.js +190 -0
- package/gm-plugkit/plugkit.sha256 +6 -0
- package/gm-plugkit/plugkit.version +1 -0
- package/gm.json +27 -0
- package/lang/browser.js +45 -0
- package/lang/ssh.js +166 -0
- package/lib/browser-spool-handler.js +130 -0
- package/lib/browser.js +131 -0
- package/lib/codeinsight.js +109 -0
- package/lib/daemon-bootstrap.js +253 -132
- package/lib/git.js +0 -1
- package/lib/learning.js +169 -0
- package/lib/skill-bootstrap.js +406 -0
- package/lib/spool-dispatch.js +100 -0
- package/lib/spool.js +87 -49
- package/lib/wasm-host.js +241 -0
- package/package.json +38 -20
- package/prompts/bash-deny.txt +22 -0
- package/prompts/pre-compact.txt +21 -0
- package/prompts/prompt-submit.txt +83 -0
- package/prompts/session-start.txt +15 -0
- package/scripts/run-hook.sh +7 -0
- package/scripts/watch-cascade.js +166 -0
- package/skills/browser/SKILL.md +80 -0
- package/skills/code-search/SKILL.md +48 -0
- package/skills/create-lang-plugin/SKILL.md +121 -0
- package/skills/gm/SKILL.md +10 -49
- package/skills/gm-complete/SKILL.md +16 -87
- package/skills/gm-emit/SKILL.md +17 -50
- package/skills/gm-execute/SKILL.md +18 -69
- package/skills/gm-skill/SKILL.md +43 -0
- package/skills/gm-skill/index.js +21 -0
- package/skills/governance/SKILL.md +97 -0
- package/skills/pages/SKILL.md +208 -0
- package/skills/planning/SKILL.md +21 -97
- package/skills/research/SKILL.md +43 -0
- package/skills/ssh/SKILL.md +71 -0
- package/skills/textprocessing/SKILL.md +40 -0
- package/skills/update-docs/SKILL.md +24 -43
- package/gm-complete.SKILL.md +0 -106
- package/gm-emit.SKILL.md +0 -70
- package/gm-execute.SKILL.md +0 -88
- package/gm.SKILL.md +0 -63
- package/index.js +0 -1
- package/lib/index.js +0 -37
- package/lib/loader.js +0 -66
- package/lib/manifest.js +0 -99
- package/lib/prepare.js +0 -14
- package/planning.SKILL.md +0 -118
- package/skills/gm/index.js +0 -113
- package/skills/gm-complete/index.js +0 -118
- package/skills/gm-complete.SKILL.md +0 -106
- package/skills/gm-emit/index.js +0 -90
- package/skills/gm-emit.SKILL.md +0 -70
- package/skills/gm-execute/index.js +0 -91
- package/skills/gm-execute.SKILL.md +0 -88
- package/skills/gm.SKILL.md +0 -63
- package/skills/planning/index.js +0 -107
- package/skills/planning.SKILL.md +0 -118
- package/skills/update-docs/index.js +0 -108
- package/skills/update-docs.SKILL.md +0 -66
- package/test-build.js +0 -29
- package/test-e2e.js +0 -117
- package/test-unified.js +0 -24
- package/test.js +0 -89
- package/update-docs.SKILL.md +0 -66
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const yaml = require('yaml');
|
|
4
|
-
const git = require('../../lib/git.js');
|
|
5
|
-
|
|
6
|
-
async function completeSkill(input, parentContext) {
|
|
7
|
-
const context = parentContext || {
|
|
8
|
-
request: input.request || '',
|
|
9
|
-
taskId: input.taskId || require('crypto').randomUUID(),
|
|
10
|
-
sessionId: process.env.SESSION_ID || require('crypto').randomUUID(),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const gmDir = path.join(process.cwd(), '.gm');
|
|
14
|
-
const prdPath = path.join(gmDir, 'prd.yml');
|
|
15
|
-
const mutablesPath = path.join(gmDir, 'mutables.yml');
|
|
16
|
-
|
|
17
|
-
console.error(`[gm-complete] COMPLETE phase starting`);
|
|
18
|
-
|
|
19
|
-
let prd = [];
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
if (fs.existsSync(prdPath)) {
|
|
23
|
-
const prdContent = fs.readFileSync(prdPath, 'utf8');
|
|
24
|
-
prd = yaml.parse(prdContent) || [];
|
|
25
|
-
}
|
|
26
|
-
} catch (err) {
|
|
27
|
-
console.error(`[gm-complete] ERROR reading prd.yml:`, err.message);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const verifications = {
|
|
31
|
-
gitClean: false,
|
|
32
|
-
gitPushed: false,
|
|
33
|
-
testsPassed: false,
|
|
34
|
-
prdEmpty: false,
|
|
35
|
-
mutablesResolved: false,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
console.error(`[gm-complete] Running verifications...`);
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const statusResult = await git.status(context.sessionId);
|
|
42
|
-
verifications.gitClean = statusResult.ok && !statusResult.isDirty;
|
|
43
|
-
console.error(`[gm-complete] git clean: ${verifications.gitClean}`);
|
|
44
|
-
} catch (err) {
|
|
45
|
-
console.error(`[gm-complete] git status check failed:`, err.message);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
const logResult = await git.log(context.sessionId, 100);
|
|
50
|
-
verifications.gitPushed = logResult.ok && logResult.commits.length >= 0;
|
|
51
|
-
console.error(`[gm-complete] git log retrieved: ${verifications.gitPushed ? 'success' : 'failed'}`);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
console.error(`[gm-complete] git log check failed:`, err.message);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (fs.existsSync('test.js')) {
|
|
57
|
-
try {
|
|
58
|
-
execSync('node test.js', { stdio: 'pipe', timeout: 30000 });
|
|
59
|
-
verifications.testsPassed = true;
|
|
60
|
-
console.error(`[gm-complete] tests passed: true`);
|
|
61
|
-
} catch (err) {
|
|
62
|
-
console.error(`[gm-complete] tests failed:`, err.message);
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
verifications.testsPassed = true;
|
|
66
|
-
console.error(`[gm-complete] no test.js found, skipping tests`);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
verifications.prdEmpty = !fs.existsSync(prdPath) || prd.length === 0;
|
|
70
|
-
console.error(`[gm-complete] prd empty: ${verifications.prdEmpty}`);
|
|
71
|
-
|
|
72
|
-
verifications.mutablesResolved = !fs.existsSync(mutablesPath);
|
|
73
|
-
console.error(`[gm-complete] mutables resolved: ${verifications.mutablesResolved}`);
|
|
74
|
-
|
|
75
|
-
const allVerified = Object.values(verifications).every(v => v);
|
|
76
|
-
|
|
77
|
-
if (!allVerified) {
|
|
78
|
-
console.error(`[gm-complete] Verifications failed, checking for incomplete work...`);
|
|
79
|
-
if (prd.length > 0) {
|
|
80
|
-
console.error(`[gm-complete] PRD still has items, returning to EXECUTE`);
|
|
81
|
-
return {
|
|
82
|
-
nextSkill: 'gm-execute',
|
|
83
|
-
context: { ...context, verifications },
|
|
84
|
-
phase: 'COMPLETE',
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.error(`[gm-complete] All verifications passed`);
|
|
90
|
-
|
|
91
|
-
const completeState = {
|
|
92
|
-
timestamp: new Date().toISOString(),
|
|
93
|
-
verifications,
|
|
94
|
-
ready: allVerified,
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
fs.writeFileSync(path.join(gmDir, 'complete-state.json'), JSON.stringify(completeState, null, 2), 'utf8');
|
|
98
|
-
|
|
99
|
-
context.verifications = verifications;
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
nextSkill: allVerified ? 'update-docs' : null,
|
|
103
|
-
context,
|
|
104
|
-
phase: 'COMPLETE',
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (require.main === module) {
|
|
109
|
-
const input = { request: process.argv[2] || 'default task' };
|
|
110
|
-
completeSkill(input).then(result => {
|
|
111
|
-
console.log(JSON.stringify(result, null, 2));
|
|
112
|
-
}).catch(err => {
|
|
113
|
-
console.error('Fatal error:', err);
|
|
114
|
-
process.exit(1);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
module.exports = completeSkill;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gm-complete
|
|
3
|
-
description: VERIFY and COMPLETE phase. End-to-end system verification and git enforcement. Any new unknown triggers immediate snake back to planning — restart chain.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# GM COMPLETE — Verify, then close
|
|
7
|
-
|
|
8
|
-
Entry: EMIT gates clear, from `gm-emit`. Exit: `.prd` deleted + test.js green + pushed + CI green → `update-docs`.
|
|
9
|
-
|
|
10
|
-
Cross-cutting dispositions live in `gm` SKILL.md.
|
|
11
|
-
|
|
12
|
-
## Transitions
|
|
13
|
-
|
|
14
|
-
- `.prd` items remain → `gm-execute`
|
|
15
|
-
- `.prd` empty AND test.js green AND pushed AND CI green → `update-docs`
|
|
16
|
-
- Broken file output → `gm-emit`
|
|
17
|
-
- Wrong logic → `gm-execute`
|
|
18
|
-
- New unknown or wrong requirements → `planning`
|
|
19
|
-
|
|
20
|
-
Failure triage: broken output to EMIT, wrong logic to EXECUTE, new unknown to PLAN. Never patch around surprises.
|
|
21
|
-
|
|
22
|
-
## Mutables that must resolve before COMPLETE
|
|
23
|
-
|
|
24
|
-
- `witnessed_e2e` — real end-to-end run with witnessed output
|
|
25
|
-
- `browser_validated` — for any change touching client / UI / browser-facing code, see gate below. test.js + node-side imports DO NOT satisfy this gate.
|
|
26
|
-
- `git_clean` — `git status --porcelain` returns empty
|
|
27
|
-
- `git_pushed` — `git log origin/main..HEAD --oneline` returns empty
|
|
28
|
-
- `ci_passed` — every GitHub Actions run reaches `conclusion: success`
|
|
29
|
-
- `mutables_resolved` — `.gm/mutables.yml` deleted OR every entry `status: witnessed`. Stop hook hard-blocks turn-stop while any entry is `status: unknown`.
|
|
30
|
-
- `prd_empty` — `.gm/prd.yml` deleted AFTER residual scan: enumerate every in-spirit reachable residual surfaced this session; any hit re-enters `planning`, appends PRD items, executes. Empty PRD is necessary, not sufficient — done = empty PRD AND zero reachable in-spirit residuals. Out-of-spirit-or-unreachable residuals are named in the response and skipped; everything else is this turn's work.
|
|
31
|
-
- `stress_suite_clear` — change walked through M1–D1 (governance), none flunked
|
|
32
|
-
- `hidden_decision_posture` — open → down_weighted → closed only when CI is green AND stress suite is clear
|
|
33
|
-
|
|
34
|
-
## End-to-end verification
|
|
35
|
-
|
|
36
|
-
Real system, real data, witness actual output. Doc updates, "saying done", and screenshots alone are not verification. Write the e2e probe to the spool (`.gm/exec-spool/in/nodejs/<N>.js`):
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
const { fn } = await import('/abs/path/to/module.js');
|
|
40
|
-
console.log(await fn(realInput));
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
After every success, enumerate what remains — never stop at first green.
|
|
44
|
-
|
|
45
|
-
## Browser validation gate
|
|
46
|
-
|
|
47
|
-
Required when this session changed any code that runs in a browser: anything under `client/`, UI components, shaders, page-loaded JS, served HTML, gh-pages assets, dev-server endpoints, or any module imported into the page bundle.
|
|
48
|
-
|
|
49
|
-
Trigger detection (any one): `git diff --name-only origin/main..HEAD` includes paths under `client/`, `apps/*/index.js` with client export, `docs/`, `*.html`, shader files, or any file imported by a browser entry; new/changed export consumed by `window.*` or rendered in DOM/canvas/WebGL; visual, layout, animation, input, network-on-page, or shader behavior altered.
|
|
50
|
-
|
|
51
|
-
Protocol: boot the real server (or open the static page) on a known URL — witness HTTP 200. `exec:browser` → `page.goto(url)` → wait for app init by polling for the global the change affects (`window.__app.<system>`). Probe via `page.evaluate(() => …)` asserting the specific invariant the change was supposed to establish — instance counts, scene meshes, DOM nodes, render stats, network frames. Capture witnessed numbers in the response — "looks fine" is not a witness. Failures route to `gm-execute` (logic) or `gm-emit` (output) — never paper over.
|
|
52
|
-
|
|
53
|
-
Long-running probes split into navigate-call → `exec:wait N` → probe-call to stay under the per-call budget. Do not stack multi-second `setTimeout` inside one `exec:browser` invocation.
|
|
54
|
-
|
|
55
|
-
Exempt only when: change is server-only with zero browser-facing surface, OR the repository has no browser surface at all (pure CLI / library). Exemption requires explicit tag in the response: `BROWSER EXEMPT: <reason — must reference diff paths showing zero browser-facing surface>`. Default posture is NOT exempt — burden is on the agent to prove exemption with diff evidence.
|
|
56
|
-
|
|
57
|
-
Pre-flight: run `git diff --name-only origin/main..HEAD` directly via Bash, then dispatch a nodejs spool file that reads the diff list and filters lines matching `client/|docs/|\.html$|\.glsl$|\.frag$|\.vert$`. Any hit AND no `exec:browser` block in this session → mandatory regression to `gm-execute`.
|
|
58
|
-
|
|
59
|
-
## Integration test gate
|
|
60
|
-
|
|
61
|
-
Write to `.gm/exec-spool/in/nodejs/<N>.js`:
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
const { execSync } = require('child_process');
|
|
65
|
-
try { execSync('node test.js', { stdio: 'inherit', timeout: 30000 }); console.log('PASS'); }
|
|
66
|
-
catch (e) { console.error('FAIL'); process.exit(1); }
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Failure → `gm-execute`. No test.js in a repo with testable surface → `gm-execute` to create it.
|
|
70
|
-
|
|
71
|
-
## Git enforcement
|
|
72
|
-
|
|
73
|
-
Run directly via Bash:
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
git status --porcelain
|
|
77
|
-
git log origin/main..HEAD --oneline
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Both must return empty. Local commit without push is not complete.
|
|
81
|
-
|
|
82
|
-
## CI is automated
|
|
83
|
-
|
|
84
|
-
The Stop hook watches Actions for the pushed HEAD. Do not call `gh run list` manually. All-green → Stop approves with CI summary in next-turn context. Failure → Stop blocks with run names + IDs; investigate via `gh run view <id> --log-failed`, fix, push, hook re-watches. Deadline 180s (override `GM_CI_WATCH_SECS`); slow jobs get a "still in progress" approve.
|
|
85
|
-
|
|
86
|
-
## Hygiene sweep
|
|
87
|
-
|
|
88
|
-
1. Files >200 lines → split
|
|
89
|
-
2. Comments in code → remove
|
|
90
|
-
3. Scattered test files (`.test.js`, `.spec.js`, `__tests__/`, `fixtures/`, `mocks/`) → delete, consolidate into root `test.js`
|
|
91
|
-
4. Mock / stub / simulation files → delete
|
|
92
|
-
5. Unnecessary doc files (not CHANGELOG, CLAUDE, README, TODO.md) → delete
|
|
93
|
-
6. Duplicate concern → regress to `planning` with restructuring instructions
|
|
94
|
-
7. Hardcoded values → derive from ground truth
|
|
95
|
-
8. Fallback / demo modes → remove, fail loud
|
|
96
|
-
9. TODO.md → empty or deleted
|
|
97
|
-
10. CHANGELOG.md → entries for this session
|
|
98
|
-
11. Observability gaps → server subsystems expose `/debug/<subsystem>`; client modules register in `window.__debug`
|
|
99
|
-
12. Memorize → every fact from verification handed off via background `Agent(memorize)` at moment of resolution
|
|
100
|
-
13. Deploy / publish → if deployable, deploy; if npm package, publish
|
|
101
|
-
14. GitHub Pages → check `.github/workflows/pages.yml` + `docs/index.html` exist; invoke `pages` skill if absent
|
|
102
|
-
15. Governance stress-suite → walk change through M1, F1, C1, H1, S1, B1, A1, D1; any flunk regresses to the owning phase
|
|
103
|
-
|
|
104
|
-
## Completion
|
|
105
|
-
|
|
106
|
-
All true at once: witnessed e2e | browser_validated when client work touched | failure paths exercised | test.js passes | `.prd` deleted | git clean and pushed | CI green | hygiene sweep clean | TODO.md gone | CHANGELOG.md updated.
|
package/skills/gm-emit/index.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const yaml = require('yaml');
|
|
4
|
-
|
|
5
|
-
async function emitSkill(input, parentContext) {
|
|
6
|
-
const context = parentContext || {
|
|
7
|
-
request: input.request || '',
|
|
8
|
-
taskId: input.taskId || require('crypto').randomUUID(),
|
|
9
|
-
sessionId: process.env.SESSION_ID || require('crypto').randomUUID(),
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const gmDir = path.join(process.cwd(), '.gm');
|
|
13
|
-
const prdPath = path.join(gmDir, 'prd.yml');
|
|
14
|
-
|
|
15
|
-
console.error(`[gm-emit] EMIT phase starting`);
|
|
16
|
-
|
|
17
|
-
let prd = [];
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
if (fs.existsSync(prdPath)) {
|
|
21
|
-
const prdContent = fs.readFileSync(prdPath, 'utf8');
|
|
22
|
-
prd = yaml.parse(prdContent) || [];
|
|
23
|
-
}
|
|
24
|
-
} catch (err) {
|
|
25
|
-
console.error(`[gm-emit] ERROR reading prd.yml:`, err.message);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
console.error(`[gm-emit] PRD has ${prd.length} items`);
|
|
29
|
-
|
|
30
|
-
const incompleteItems = prd.filter(item => item.status !== 'completed');
|
|
31
|
-
if (incompleteItems.length > 0) {
|
|
32
|
-
console.error(`[gm-emit] Found ${incompleteItems.length} incomplete items, returning to EXECUTE`);
|
|
33
|
-
return {
|
|
34
|
-
nextSkill: 'gm-execute',
|
|
35
|
-
context,
|
|
36
|
-
phase: 'EMIT',
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
console.error(`[gm-emit] All PRD items completed, proceeding with EMIT`);
|
|
41
|
-
|
|
42
|
-
const emittedFiles = [];
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
if (!fs.existsSync(gmDir)) {
|
|
46
|
-
fs.mkdirSync(gmDir, { recursive: true });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const stateFile = path.join(gmDir, 'emit-state.json');
|
|
50
|
-
const emitState = {
|
|
51
|
-
timestamp: new Date().toISOString(),
|
|
52
|
-
filesWritten: emittedFiles,
|
|
53
|
-
prdCount: prd.length,
|
|
54
|
-
allCompleted: true,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
fs.writeFileSync(stateFile, JSON.stringify(emitState, null, 2), 'utf8');
|
|
58
|
-
emittedFiles.push(stateFile);
|
|
59
|
-
|
|
60
|
-
console.error(`[gm-emit] Wrote ${emittedFiles.length} files`);
|
|
61
|
-
} catch (err) {
|
|
62
|
-
console.error(`[gm-emit] ERROR during emit:`, err.message);
|
|
63
|
-
return {
|
|
64
|
-
nextSkill: null,
|
|
65
|
-
context,
|
|
66
|
-
phase: 'ERROR',
|
|
67
|
-
error: `EMIT failed: ${err.message}`,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
context.prd = prd;
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
nextSkill: 'gm-complete',
|
|
75
|
-
context,
|
|
76
|
-
phase: 'EMIT',
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (require.main === module) {
|
|
81
|
-
const input = { request: process.argv[2] || 'default task' };
|
|
82
|
-
emitSkill(input).then(result => {
|
|
83
|
-
console.log(JSON.stringify(result, null, 2));
|
|
84
|
-
}).catch(err => {
|
|
85
|
-
console.error('Fatal error:', err);
|
|
86
|
-
process.exit(1);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
module.exports = emitSkill;
|
package/skills/gm-emit.SKILL.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gm-emit
|
|
3
|
-
description: EMIT phase. Pre-emit debug, write files, post-emit verify from disk. Any new unknown triggers immediate snake back to planning — restart chain.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# GM EMIT — Write and verify from disk
|
|
7
|
-
|
|
8
|
-
Entry: every mutable KNOWN, from `gm-execute` or re-entered from VERIFY. Exit: gates clear → `gm-complete`.
|
|
9
|
-
|
|
10
|
-
Cross-cutting dispositions live in `gm` SKILL.md.
|
|
11
|
-
|
|
12
|
-
## Transitions
|
|
13
|
-
|
|
14
|
-
- All gates clear → `gm-complete`
|
|
15
|
-
- Post-emit variance with known cause → fix in-band, re-verify, stay in EMIT
|
|
16
|
-
- Pre-emit reveals known logic error → `gm-execute`
|
|
17
|
-
- Pre-emit reveals new unknown OR post-emit variance with unknown cause OR scope changed → `planning`
|
|
18
|
-
|
|
19
|
-
## Legitimacy gate (before pre-emit run)
|
|
20
|
-
|
|
21
|
-
For every claim landing in a file, answer five questions:
|
|
22
|
-
|
|
23
|
-
1. Earned specificity — does it trace to `authorization=witnessed`, or is it inflated from a weak prior?
|
|
24
|
-
2. Repair legality — is a local patch dressed as structural repair? Downgrade scope or regress to PLAN.
|
|
25
|
-
3. Lawful downgrade — can a weaker, true statement replace it? Prefer the downgrade.
|
|
26
|
-
4. Alternative-route suppression — is a live competing route being silenced? Preserve it.
|
|
27
|
-
5. Strongest objection — what would the sharpest reviewer pushback be? Articulate it. Cannot articulate = have not understood the alternatives → `gm-execute`.
|
|
28
|
-
|
|
29
|
-
Any failure regresses to `gm-execute` to witness what was missing, or `planning` if the gap is structural.
|
|
30
|
-
|
|
31
|
-
## Pre-emit run
|
|
32
|
-
|
|
33
|
-
Mandatory before writing any file. Write the probe to the spool (`.gm/exec-spool/in/nodejs/<N>.js`):
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
const { fn } = await import('/abs/path/to/module.js');
|
|
37
|
-
console.log(await fn(realInput));
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Import the actual module from disk to witness current behavior as the baseline. Run the proposed logic in isolation without writing — witness with real inputs and with real error inputs. Match expected → write. Unexpected → new unknown → `planning`.
|
|
41
|
-
|
|
42
|
-
## Writing
|
|
43
|
-
|
|
44
|
-
Use the Write tool, or a nodejs spool file with `require('fs')`. Write only when every gate mutable resolves simultaneously.
|
|
45
|
-
|
|
46
|
-
## Post-emit verification
|
|
47
|
-
|
|
48
|
-
Re-import from disk — in-memory state is stale and inadmissible. Run identical inputs as pre-emit; output must match the baseline exactly. Known variance → fix and re-verify (self-loop). Unknown variance → `planning`.
|
|
49
|
-
|
|
50
|
-
## Mutables gate
|
|
51
|
-
|
|
52
|
-
Before pre-emit run, read `.gm/mutables.yml`. Any entry with `status: unknown` → regress to `gm-execute`. The pre-tool-use hook hard-blocks Write/Edit/NotebookEdit while unresolved entries exist; trying to emit anyway returns deny. Zero unresolved is the precondition for every legitimacy question below.
|
|
53
|
-
|
|
54
|
-
## Gate (all true at once)
|
|
55
|
-
|
|
56
|
-
- `.gm/mutables.yml` empty/absent OR every entry `status: witnessed` with filled `witness_evidence`
|
|
57
|
-
- Legitimacy gate passed; no refused collapse
|
|
58
|
-
- Pre-emit passed with real inputs and real error inputs
|
|
59
|
-
- Post-emit matches pre-emit exactly
|
|
60
|
-
- Hot-reloadable; errors throw with context (no `|| default`, no `catch { return null }`, no fallbacks)
|
|
61
|
-
- No mocks, fakes, stubs, or scattered test files (delete on discovery)
|
|
62
|
-
- Any behavior change has a corresponding assertion in `test.js` — a change no test catches is a change you cannot prove
|
|
63
|
-
- Browser-facing change → post-emit verify includes a live `exec:browser` witness (boot server → `page.goto` → `page.evaluate` asserting the invariant the change established). Node-side import + test.js does not satisfy this — the final gate runs again in `gm-complete`.
|
|
64
|
-
- Files ≤ 200 lines
|
|
65
|
-
- No duplicate concern (run `exec:codesearch` for the primary concern after writing; overlap → `planning`)
|
|
66
|
-
- No comments, no hardcoded values, no adjectives in identifiers, no unnecessary files
|
|
67
|
-
- Observability: new server subsystems expose `/debug/<subsystem>`; new client modules register in `window.__debug`
|
|
68
|
-
- Structure: no if/else where dispatch suffices; no one-liners that obscure; no reinvented APIs
|
|
69
|
-
- Every fact resolved this phase memorized via background `Agent(memorize)`
|
|
70
|
-
- CHANGELOG.md updated; TODO.md cleared or deleted
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const yaml = require('yaml');
|
|
4
|
-
|
|
5
|
-
async function executeSkill(input, parentContext) {
|
|
6
|
-
const context = parentContext || {
|
|
7
|
-
request: input.request || '',
|
|
8
|
-
taskId: input.taskId || require('crypto').randomUUID(),
|
|
9
|
-
sessionId: process.env.SESSION_ID || require('crypto').randomUUID(),
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const gmDir = path.join(process.cwd(), '.gm');
|
|
13
|
-
const prdPath = path.join(gmDir, 'prd.yml');
|
|
14
|
-
const mutablesPath = path.join(gmDir, 'mutables.yml');
|
|
15
|
-
|
|
16
|
-
console.error(`[gm-execute] EXECUTE phase starting`);
|
|
17
|
-
|
|
18
|
-
let prd = [];
|
|
19
|
-
let mutables = [];
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
if (fs.existsSync(prdPath)) {
|
|
23
|
-
const prdContent = fs.readFileSync(prdPath, 'utf8');
|
|
24
|
-
prd = yaml.parse(prdContent) || [];
|
|
25
|
-
}
|
|
26
|
-
} catch (err) {
|
|
27
|
-
console.error(`[gm-execute] ERROR reading prd.yml:`, err.message);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
console.error(`[gm-execute] PRD has ${prd.length} items`);
|
|
31
|
-
|
|
32
|
-
const pendingItems = prd.filter(item => item.status === 'pending');
|
|
33
|
-
console.error(`[gm-execute] Processing ${pendingItems.length} pending items`);
|
|
34
|
-
|
|
35
|
-
for (const item of pendingItems) {
|
|
36
|
-
console.error(`[gm-execute] Processing: ${item.id}`);
|
|
37
|
-
|
|
38
|
-
item.status = 'in_progress';
|
|
39
|
-
fs.writeFileSync(prdPath, yaml.stringify(prd, { indent: 2 }), 'utf8');
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
const startTime = Date.now();
|
|
43
|
-
const timeout = 30 * 1000;
|
|
44
|
-
|
|
45
|
-
item.status = 'completed';
|
|
46
|
-
item.completedAt = new Date().toISOString();
|
|
47
|
-
item.durationMs = Date.now() - startTime;
|
|
48
|
-
|
|
49
|
-
console.error(`[gm-execute] Completed: ${item.id} in ${item.durationMs}ms`);
|
|
50
|
-
} catch (err) {
|
|
51
|
-
console.error(`[gm-execute] ERROR processing ${item.id}:`, err.message);
|
|
52
|
-
item.status = 'pending';
|
|
53
|
-
item.error = err.message;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
fs.writeFileSync(prdPath, yaml.stringify(prd, { indent: 2 }), 'utf8');
|
|
58
|
-
|
|
59
|
-
context.prd = prd;
|
|
60
|
-
|
|
61
|
-
const allCompleted = prd.every(item => item.status === 'completed');
|
|
62
|
-
|
|
63
|
-
if (!allCompleted) {
|
|
64
|
-
console.error(`[gm-execute] Items still pending, re-running EXECUTE`);
|
|
65
|
-
return {
|
|
66
|
-
nextSkill: 'gm-execute',
|
|
67
|
-
context,
|
|
68
|
-
phase: 'EXECUTE',
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
console.error(`[gm-execute] All items completed, moving to EMIT`);
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
nextSkill: 'gm-emit',
|
|
76
|
-
context,
|
|
77
|
-
phase: 'EXECUTE',
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (require.main === module) {
|
|
82
|
-
const input = { request: process.argv[2] || 'default task' };
|
|
83
|
-
executeSkill(input).then(result => {
|
|
84
|
-
console.log(JSON.stringify(result, null, 2));
|
|
85
|
-
}).catch(err => {
|
|
86
|
-
console.error('Fatal error:', err);
|
|
87
|
-
process.exit(1);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
module.exports = executeSkill;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gm-execute
|
|
3
|
-
description: EXECUTE phase AND the foundational execution contract for every skill. Every exec:<lang> run, every witnessed check, every code search, in every phase, follows this skill's discipline. Resolve all mutables via witnessed execution. Any new unknown triggers immediate snake back to planning — restart chain from PLAN.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# GM EXECUTE — Resolve every unknown by witness
|
|
7
|
-
|
|
8
|
-
Entry: `.prd` with named unknowns. Exit: every mutable KNOWN → invoke `gm-emit`.
|
|
9
|
-
|
|
10
|
-
A `@<discipline>` sigil propagates from PLAN through every recall, codesearch, and memorize call; reads without one fan across default plus enabled disciplines, writes without one go to default only.
|
|
11
|
-
|
|
12
|
-
This skill is the execution contract for ALL phases — pre-emit witnesses, post-emit verifies, e2e checks all run on this discipline. Cross-cutting dispositions live in `gm` SKILL.md.
|
|
13
|
-
|
|
14
|
-
## Transitions
|
|
15
|
-
|
|
16
|
-
- All mutables KNOWN → `gm-emit`
|
|
17
|
-
- Still UNKNOWN → re-run from a different angle (max 2 passes)
|
|
18
|
-
- New unknown OR unresolvable after 2 passes → `planning`
|
|
19
|
-
|
|
20
|
-
## Mutable discipline
|
|
21
|
-
|
|
22
|
-
Each mutable carries: name, expected, current, resolution method.
|
|
23
|
-
|
|
24
|
-
Resolves to KNOWN only when all four pass:
|
|
25
|
-
|
|
26
|
-
- **ΔS = 0** — witnessed output equals expected
|
|
27
|
-
- **λ ≥ 2** — two independent paths agree
|
|
28
|
-
- **ε intact** — adjacent invariants hold
|
|
29
|
-
- **Coverage ≥ 0.70** — enough corpus inspected to rule out contradiction
|
|
30
|
-
|
|
31
|
-
Unresolved after 2 passes regresses to `planning`. Never narrate past an unresolved mutable.
|
|
32
|
-
|
|
33
|
-
Every witness that resolves a mutable writes back to `.gm/mutables.yml` the same step: set `status: witnessed` and fill `witness_evidence` with concrete proof (file:line, codesearch hit, exec output snippet). No write-back = the mutable stays unknown and the EMIT-gate stays closed. The hook reads this file; the agent's memory of "I resolved it" does not unblock anything.
|
|
34
|
-
|
|
35
|
-
Route candidates from PLAN are `weak_prior` only. Plausibility is the right to test, not the right to believe. A claim with no witness in the current session is a hypothesis — say so when stating it, and say what would settle it. The next reader (you, next turn) needs to know which lines were earned and which were carried forward.
|
|
36
|
-
|
|
37
|
-
## Verification budget
|
|
38
|
-
|
|
39
|
-
Spend on `.prd` items in descending order of consequence-if-wrong × distance-from-witnessed. Items whose failure would collapse the headline finding must reach witnessed status before EMIT; sub-argument-level items need at minimum a stated fallback path.
|
|
40
|
-
|
|
41
|
-
## Code execution
|
|
42
|
-
|
|
43
|
-
Code AND utility verbs both run through the file-spool. Write a file to `.gm/exec-spool/in/<lang-or-verb>/<N>.<ext>` — language stems (`in/nodejs/42.js`, `in/python/43.py`, `in/bash/44.sh`, plus typescript, go, rust, c, cpp, java, deno) or verb stems (`in/codesearch/45.txt`, `in/recall/46.txt`, `in/memorize/47.md`, plus wait, sleep, status, close, browser, runner, type, kill-port, forget, feedback, learn-status, learn-debug, learn-build, discipline, pause, health). The spool watcher executes and streams stdout to `out/<N>.out`, stderr to `out/<N>.err`, then writes `out/<N>.json` metadata sidecar at completion (taskId, lang, ok, exitCode, durationMs, timedOut, startedAt, endedAt). Both streams return as systemMessage with `--- stdout ---` / `--- stderr ---` separators. File I/O via a nodejs spool file + `require('fs')`. Only `git` and `gh` run directly in Bash. Never `Bash(node/npm/npx/bun)`, never `Bash(exec:<anything>)`.
|
|
44
|
-
|
|
45
|
-
Pack runs: `Promise.allSettled`, each idea own try/catch, under 12s per call. Runner: write `in/runner/<N>.txt` with body `start` | `stop` | `status`.
|
|
46
|
-
|
|
47
|
-
Every exec daemonizes. The hook tails the task logfile up to 30s wall-clock and returns whatever is there — short tasks complete inside the window and look synchronous; long tasks return a task_id with partial output. Continue with `exec:tail` (drain, bounded), `exec:watch` (resume blocking until match or timeout), or `exec:close` (terminate). Never re-spawn a long task to check on it — that orphans the first one. `exec:wait` is a pure timer; `exec:sleep` blocks on a specific task's output; `exec:watch` is the match-or-timeout primitive. Every execution-platform RPC returns the live list of running tasks for this session — close stragglers via `exec:close\n<id>` so the list stays scannable. Session-end (clear/logout/prompt_input_exit) kills the session's tasks; compaction/handoff preserves them.
|
|
48
|
-
|
|
49
|
-
Every utility verb dispatches via `in/<verb>/<N>.txt`; the body of the file is the verb's argument. There is no inline form and no Bash-prefix form — both are denied by the hook.
|
|
50
|
-
|
|
51
|
-
## Codebase search
|
|
52
|
-
|
|
53
|
-
`exec:codesearch` only. Grep, Glob, Find, Explore, raw grep/rg/find inside `exec:bash` are all hook-blocked.
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
exec:codesearch
|
|
57
|
-
<two-word query>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Start two words, change/add one per pass, minimum four attempts before concluding absent. Known absolute path → `Read`. Known directory → `exec:nodejs` + `fs.readdirSync`.
|
|
61
|
-
|
|
62
|
-
## Utility verb failure handling
|
|
63
|
-
|
|
64
|
-
**Utility verb failures must surface**: exec:memorize, exec:recall, exec:codesearch, and other utility verbs may fail (socket unavailable, timeout, network error). Failures do not block witness completion but must be reported to the user with error context. Fallback mechanisms (AGENTS.md for memorize) ensure memory preservation even when rs-learn is temporarily unavailable.
|
|
65
|
-
|
|
66
|
-
## Import-based execution
|
|
67
|
-
|
|
68
|
-
Hypotheses become real by importing actual modules from disk. Reimplemented behavior is UNKNOWN. Write the import probe to the spool:
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
# write .gm/exec-spool/in/nodejs/42.js
|
|
72
|
-
const { fn } = await import('/abs/path/to/module.js');
|
|
73
|
-
console.log(await fn(realInput));
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Differential diagnosis: smallest reproduction → compare actual vs expected → name the delta — that delta is the mutable.
|
|
77
|
-
|
|
78
|
-
## Edits depend on witnesses
|
|
79
|
-
|
|
80
|
-
Hypothesis → run → witness → edit. An edit before a witness is a guess. Scan via `exec:codesearch` before creating or modifying — duplicate concern regresses to `planning`. Code-quality preference: native → library → structure → write.
|
|
81
|
-
|
|
82
|
-
## Parallel subagents
|
|
83
|
-
|
|
84
|
-
Up to 3 `gm:gm` subagents for independent items in one message. Browser escalation: `exec:browser` → `browser` skill → screenshot only as last resort.
|
|
85
|
-
|
|
86
|
-
## CI is automated
|
|
87
|
-
|
|
88
|
-
`git push` triggers the Stop hook to watch Actions for the pushed HEAD on the same repo (downstream cascades are not auto-watched). Green → Stop approves with summary; failure → run names + IDs surfaced, investigate via `gh run view <id> --log-failed`. Deadline 180s (override `GM_CI_WATCH_SECS`).
|
package/skills/gm.SKILL.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gm
|
|
3
|
-
description: Orchestrator dispatching PLAN→EXECUTE→EMIT→VERIFY→UPDATE-DOCS skill chain; spool-driven task execution with session isolation
|
|
4
|
-
allowed-tools: Skill
|
|
5
|
-
compatible-platforms:
|
|
6
|
-
- gm-cc
|
|
7
|
-
- gm-gc
|
|
8
|
-
- gm-oc
|
|
9
|
-
- gm-kilo
|
|
10
|
-
- gm-codex
|
|
11
|
-
- gm-copilot-cli
|
|
12
|
-
- gm-vscode
|
|
13
|
-
- gm-cursor
|
|
14
|
-
- gm-zed
|
|
15
|
-
- gm-jetbrains
|
|
16
|
-
end-to-end: true
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# GM — Orchestrator
|
|
20
|
-
|
|
21
|
-
Invoke `planning` immediately. Phases cascade: PLAN → EXECUTE → EMIT → VERIFY → UPDATE-DOCS.
|
|
22
|
-
|
|
23
|
-
The user's request is authorization. When scope is unclear, pick the maximum reachable shape and declare it — the user can interrupt. Doubts resolve via witnessed probe or recall, never by asking back except for destructive-irreversible actions uncovered by the PRD.
|
|
24
|
-
|
|
25
|
-
**What ships runs**: no stubs, mocks, placeholder returns, fixture-only paths, or demo-mode short-circuits. Real input through real code into real output. A shim is allowed only when delegating to real upstream behavior.
|
|
26
|
-
|
|
27
|
-
**CI is the build**: for Rust crates and the gm publish chain, push triggers CI auto-watch. Green signals authority. Local cargo build is not a witness.
|
|
28
|
-
|
|
29
|
-
**Every issue surfaces this turn**: pre-existing breaks, lint failures, drift, broken deps, stale generated files — all become PRD items and finish before COMPLETE.
|
|
30
|
-
|
|
31
|
-
**LLM provider**: acptoapi (127.0.0.1:4800) is the preferred provider when available. rs-plugkit session_start spawns acptoapi daemon and auto-detects ACP agents (opencode, kilo-code, codex, gemini-cli, qwen-code). All downstream platforms (rs-learn, freddie, gm-skill daemon mode) read OPENAI_BASE_URL environment variable and default to 127.0.0.1:4800. Anthropic SDK is fallback only when acptoapi socket is unavailable (CI, headless mode).
|
|
32
|
-
|
|
33
|
-
**rs-learn failure contract**: exec:memorize, exec:recall, and exec:codesearch failures must be reported explicitly with error details to the user. Fallback to AGENTS.md for memory preservation when socket/network unavailable. Never silently absorb errors because memory preservation requires explicit fallback. This rule applies across all phases (PLAN through UPDATE-DOCS).
|
|
34
|
-
|
|
35
|
-
**Spool dispatch chain**: write to `.gm/exec-spool/in/<lang>/<N>.<ext>` or `in/<verb>/<N>.txt`. Watcher executes and streams `out/<N>.out` + `out/<N>.err` + `out/<N>.json` metadata. Languages: nodejs, python, bash, typescript, go, rust, c, cpp, java, deno. Verbs: codesearch, recall, memorize, wait, sleep, status, close, browser, runner, type, kill-port, forget, feedback, learn-status, learn-debug, learn-build, discipline, pause, health.
|
|
36
|
-
|
|
37
|
-
**Session isolation**: SESSION_ID environment variable (or uuid fallback) threads through task dispatch for cleanup scope. rs-exec RPC handlers verify session_id match on all task-scoped operations.
|
|
38
|
-
|
|
39
|
-
**Code does mechanics; meaning routes through textprocessing skill**: summarize, classify, extract intent, rewrite, translate, semantic dedup, rank, label — all via `Agent(subagent_type='gm:textprocessing', ...)`.
|
|
40
|
-
|
|
41
|
-
**Recall before fresh execution**: before witnessing unknown via execution, recall first. Hits arrive as weak_prior; empty results confirm fresh unknown.
|
|
42
|
-
|
|
43
|
-
**Memorize is the back-half of witness**: resolution incomplete until fact lives outside this context window. Fire `Agent(subagent_type='gm:memorize', model='haiku', run_in_background=true, prompt='## CONTEXT TO MEMORIZE\n<fact>')` alongside witness, in parallel, never blocking.
|
|
44
|
-
|
|
45
|
-
**Parallel independent items**: up to 3 `gm:gm` subagents per message for independent PRD items. Serial for dependent items — no re-asking between them.
|
|
46
|
-
|
|
47
|
-
**Terse response**: fragments OK. `[thing] [action] [reason]. [next step].` Code, commits, PRs use normal prose.
|
|
48
|
-
|
|
49
|
-
## End-to-End Phase Chaining (Skills-Based Platforms)
|
|
50
|
-
|
|
51
|
-
When `end-to-end: true` is present in SKILL.md frontmatter, skill output includes structured JSON on stdout (final line):
|
|
52
|
-
|
|
53
|
-
```json
|
|
54
|
-
{"nextSkill": "gm-execute" | "gm-emit" | "gm-complete" | "update-docs" | null, "context": {PRD and state dict}, "phase": "PLAN" | "EXECUTE" | "EMIT" | "COMPLETE"}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Platform adapters (vscode, cursor, zed, jetbrains) that support `end-to-end: true` detection:
|
|
58
|
-
1. Invoke `Skill(skill="gm:gm")`
|
|
59
|
-
2. Parse stdout for trailing JSON blob
|
|
60
|
-
3. If `nextSkill` is non-null, invoke `Skill(skill="gm:<nextSkill>")` with context dict auto-passed
|
|
61
|
-
4. Repeat until `nextSkill` is null
|
|
62
|
-
|
|
63
|
-
This collapses 5 manual skill invocations into 1 user invocation + 4 transparent auto-dispatches, achieving perceived single-flow parity with gm-cc's subagent orchestration.
|