gm-cc 2.0.727 → 2.0.1064

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.
Files changed (44) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/agents/gm.md +1 -3
  3. package/agents/memorize.md +22 -2
  4. package/agents/research-worker.md +36 -0
  5. package/agents/textprocessing.md +47 -0
  6. package/bin/bootstrap.js +624 -34
  7. package/bin/plugkit.js +95 -53
  8. package/bin/plugkit.sha256 +6 -6
  9. package/bin/plugkit.version +1 -1
  10. package/bin/rtk.sha256 +6 -0
  11. package/bin/rtk.version +1 -0
  12. package/hooks/hooks.json +2 -46
  13. package/hooks/hooks.spec.json +48 -0
  14. package/package.json +2 -2
  15. package/plugin.json +1 -1
  16. package/skills/browser/SKILL.md +18 -16
  17. package/skills/code-search/SKILL.md +15 -15
  18. package/skills/create-lang-plugin/SKILL.md +22 -26
  19. package/skills/gm/SKILL.md +31 -66
  20. package/skills/gm-cc/SKILL.md +19 -0
  21. package/skills/gm-codex/SKILL.md +19 -0
  22. package/skills/gm-complete/SKILL.md +52 -69
  23. package/skills/gm-copilot-cli/SKILL.md +19 -0
  24. package/skills/gm-cursor/SKILL.md +19 -0
  25. package/skills/gm-emit/SKILL.md +44 -61
  26. package/skills/gm-execute/SKILL.md +42 -84
  27. package/skills/gm-gc/SKILL.md +19 -0
  28. package/skills/gm-jetbrains/SKILL.md +19 -0
  29. package/skills/gm-kilo/SKILL.md +19 -0
  30. package/skills/gm-oc/SKILL.md +19 -0
  31. package/skills/gm-vscode/SKILL.md +19 -0
  32. package/skills/gm-zed/SKILL.md +19 -0
  33. package/skills/governance/SKILL.md +24 -23
  34. package/skills/pages/SKILL.md +42 -92
  35. package/skills/planning/SKILL.md +83 -80
  36. package/skills/research/SKILL.md +43 -0
  37. package/skills/ssh/SKILL.md +15 -9
  38. package/skills/textprocessing/SKILL.md +40 -0
  39. package/skills/update-docs/SKILL.md +27 -21
  40. package/.github/workflows/publish-npm.yml +0 -44
  41. package/hooks/post-tool-use-hook.js +0 -34
  42. package/hooks/pre-tool-use-hook.js +0 -45
  43. package/hooks/prompt-submit-hook.js +0 -19
  44. package/hooks/session-start-hook.js +0 -23
@@ -1,91 +1,56 @@
1
1
  ---
2
2
  name: gm
3
- description: Agent (not skill) - immutable programming state machine. Always invoke for all work coordination.
3
+ description: Orchestrator dispatching PLAN→EXECUTE→EMIT→VERIFY→UPDATE-DOCS skill chain; spool-driven task execution with session isolation
4
+ allowed-tools: Skill
5
+ end-to-end: true
4
6
  ---
5
7
 
6
- # GM — Skill-First Orchestrator
8
+ # GM — Orchestrator
7
9
 
8
- Invoke `planning` skill immediately. Skill tool only never Agent tool for skills.
10
+ Invoke `planning` immediately. Phases cascade: PLAN EXECUTE EMIT VERIFY → UPDATE-DOCS.
9
11
 
10
- ## STATE MACHINE
12
+ 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.
11
13
 
12
- Top of chain. No mutables resolved. Phases: PLAN EXECUTE EMIT VERIFY UPDATE-DOCS.
13
- Each phase loads protocols via Skill invocation only. Reading summary ≠ being in phase.
14
+ **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.
14
15
 
15
- `gm-execute` = execution contract (all phases). `governance` = route/legitimacy reference (load once).
16
+ **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.
16
17
 
17
- ## RECALLHARD RULE
18
+ **Every issue surfaces this turn**: pre-existing breaks, lint failures, drift, broken deps, stale generated files all become PRD items and finish before COMPLETE.
18
19
 
19
- Before resolving any unknown via fresh execution, check past sessions. Memorized facts only help if recalled.
20
+ **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).
20
21
 
21
- ```
22
- exec:recall
23
- <2-6 word query>
24
- ```
25
-
26
- Triggers: unknown feels familiar | sub-task on a known project | about to ask user something likely already discussed | about to design where prior decision exists. Hits = weak_prior; still witness before adopting. ~200 tokens, ~5ms when serve is running.
27
-
28
- ## MEMORIZE — HARD RULE
22
+ **rs-learn failure contract**: memorize, recall, and codesearch spool dispatch 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).
29
23
 
30
- Unknown→known = memorize same turn it resolves. Background, non-blocking.
31
-
32
- Triggers: exec: output answers prior unknown | code read confirms/refutes assumption | CI log reveals root cause | user states preference/constraint | fix worked for non-obvious reason | env quirk observed.
33
-
34
- ```
35
- Agent(subagent_type='gm:memorize', model='haiku', run_in_background=true, prompt='## CONTEXT TO MEMORIZE\n<fact>')
36
- ```
24
+ **Spool watcher restart**: at session start, check `.gm/exec-spool/.watcher.heartbeat`. If older than 30s, the watcher is dead. Write a nodejs spool file to `.gm/exec-spool/in/nodejs/restart-watcher.js` that kills stale plugkit processes and spawns `plugkit runner --watch .gm/exec-spool/in --out .gm/exec-spool/out` detached. Wait 2s for initialization before dispatching any exec commands.
37
25
 
38
- Multiple facts parallel Agent calls in ONE message. End-of-turn: scan for un-memorized resolutions spawn now.
26
+ **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.
39
27
 
40
- **Recall + memorize together = learning loop.** Skipping either breaks it.
28
+ **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.
41
29
 
42
- ## AUTONOMYHARD RULE
30
+ **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', ...)`.
43
31
 
44
- Default = autonomous execution. Emit PRD, run it to completion, push. Do NOT ask the user mid-task.
32
+ **Recall before fresh execution**: before witnessing unknown via execution, recall first. Hits arrive as weak_prior; empty results confirm fresh unknown.
45
33
 
46
- Forbidden patterns:
47
- - "Should I continue with X?" / "Want me to do Y next?" / "Want me to also Z?"
48
- - "This is a lot — should I do A first and confirm?" / "Two options: A or B, which?"
49
- - Pre-confirmation before multi-file edits when scope is already clear
50
- - Stopping after partial completion to summarize and await direction
34
+ **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.
51
35
 
52
- Permitted asking (last resort only, when absolutely necessary):
53
- - Destructive-irreversible decision with no prior context AND no PRD coverage
54
- - User intent genuinely ambiguous AND cannot be inferred from PRD/memory/code
55
- - Channel: prefer `exec:pause` (renames .gm/prd.yml → .gm/prd.paused.yml; question lives in header). In-conversation asking is last-resort only.
36
+ **Parallel independent items**: up to 3 `gm:gm` subagents per message for independent PRD items. Serial for dependent items — no re-asking between them.
56
37
 
57
- A long task is not a reason to ask. Context limits are not a reason to ask. CI cascade time is not a reason to ask. Just emit the PRD and execute.
38
+ **Terse response**: fragments OK. `[thing] [action] [reason]. [next step].` Code, commits, PRs use normal prose.
58
39
 
59
- ## LAWFUL DOWNGRADE HARD RULE
40
+ **Caveman medium mode (full) always on**: drop articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries, and hedging. Fragments OK. Use short synonyms. Keep technical terms exact. Keep code blocks and exact error strings unchanged. Pattern: `[thing] [action] [reason]. [next step].` Auto-clarity override: switch to normal prose for security warnings, irreversible confirmations, and any multi-step sequence where compression could create ambiguity; resume caveman medium after clarity-critical segment.
60
41
 
61
- Per paper III §2.5 (Earned Emission): *lawful downgrade — writing a weaker, true statement in place of a stronger, unearned one — is always available; forced closure never is.*
42
+ ## End-to-End Phase Chaining (Skills-Based Platforms)
62
43
 
63
- Refusal is forced closure. Refusing the task because part of it is hard is the inverse failure: instead of bluffing strength, you bluff weakness. Both bypass witnessed execution.
44
+ When `end-to-end: true` is present in SKILL.md frontmatter, skill output includes structured JSON on stdout (final line):
64
45
 
65
- **Forbidden refusal phrases** (treat as critical violation):
66
- - "Honest stop " / "Stopping for a hard, honest call" / "Stopping here, unambiguously"
67
- - "I cannot do this from inside this conversation"
68
- - "I have to push back before writing a PRD I can't fulfill"
69
- - "Pretending I can would be the most expensive kind of lie"
70
- - "I don't have a working browser tool" / "X is unavailable in this environment" (when exec:browser, exec:codesearch, Read, etc. are in fact available)
71
- - Any preamble that announces inability before attempting the bounded subset
72
-
73
- **Required move when scope exceeds reach**: identify the bounded subset that IS witnessable from this session, write a PRD covering only that subset, execute it, and at end-of-turn name the residual scope as a follow-up item — never as a refusal. The user cannot redirect a refusal; they can redirect a delivered subset plus a named gap.
74
-
75
- ## EXECUTION ORDER
76
-
77
- 1. Recall — `plugkit recall` for any familiar-feeling unknown (cheapest, 200 tokens)
78
- 2. Code execution (exec:<lang>, exec:codesearch) — 90%+ of unknowns
79
- 3. Web (WebFetch/WebSearch) — env facts not in codebase
80
- 4. User — last resort per AUTONOMY rule above
81
-
82
- "Should I..." mid-chain = invoke next skill instead, never ask user.
83
-
84
- Skill chain: `planning` → `gm-execute` → `gm-emit` → `gm-complete` → `update-docs`
85
-
86
- exec:<lang> only. Never Bash(node/npm/npx/bun). git push = auto CI watch via Stop hook.
46
+ ```json
47
+ {"nextSkill": "gm-execute" | "gm-emit" | "gm-complete" | "update-docs" | null, "context": {PRD and state dict}, "phase": "PLAN" | "EXECUTE" | "EMIT" | "COMPLETE"}
48
+ ```
87
49
 
88
- ## RESPONSE POLICY
50
+ Platform adapters (vscode, cursor, zed, jetbrains) that support `end-to-end: true` detection:
51
+ 1. Invoke `Skill(skill="gm:gm")`
52
+ 2. Parse stdout for trailing JSON blob
53
+ 3. If `nextSkill` is non-null, invoke `Skill(skill="gm:<nextSkill>")` with context dict auto-passed
54
+ 4. Repeat until `nextSkill` is null
89
55
 
90
- Terse. Drop filler. Fragments OK. Pattern: `[thing] [action] [reason]. [next step].`
91
- Code/commits/PRs = normal prose. Security/destructive = drop terseness.
56
+ 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.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: gm-cc
3
+ description: AI-native software engineering via skill-driven orchestration on cc; bootstraps plugkit for task execution and session isolation
4
+ allowed-tools: Skill
5
+ ---
6
+
7
+ # GM — cc Platform
8
+
9
+ AI-native software engineering orchestrated via skill chain: PLAN → EXECUTE → EMIT → VERIFY → UPDATE-DOCS.
10
+
11
+ **Bootstrap pattern**: `bun x gm-plugkit@latest --daemon` downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Call once at session start; idempotent on subsequent calls. All execution routes through the file-spool: write to `.gm/exec-spool/in/<lang>/<N>.<ext>` or `in/<verb>/<N>.txt`, poll `out/<N>.json` for results.
12
+
13
+ **Session-ID threading (no session-start hook)**: At skill invoke time, generate or detect SESSION_ID (env var `SESSION_ID` or `uuid()`). Pass `sessionId: "<id>"` in every rs-exec RPC body (spawn, tail, watch, etc.) and every spool-written task body. All task-scoped cleanup (deleteTask, getTask, appendOutput, killSessionTasks) requires matching sessionId. Absence is forbidden — hard reject by rs-exec handler.
14
+
15
+ **Spool dispatch surface**: Write to `.gm/exec-spool/in/<lang>/<N>.<ext>` (languages: nodejs, python, bash, typescript, go, rust, c, cpp, java, deno) or `in/<verb>/<N>.txt` (verbs: codesearch, recall, memorize, wait, sleep, status, close, browser, runner, etc.). Watcher executes and streams `out/<N>.out` (stdout) + `out/<N>.err` (stderr) line-by-line, then `out/<N>.json` metadata (exitCode, durationMs, timedOut, startedAt, endedAt) at completion.
16
+
17
+ **End-to-end skill chaining (skills-based platforms)**: When gm SKILL.md includes `end-to-end: true`, adapter detects signal and parses stdout for trailing JSON: `{"nextSkill": "...", "context": {...}, "phase": "..."}`. If nextSkill is non-null, invoke `Skill(skill="gm:<nextSkill>")` with context dict, repeat until null. This auto-chains 5 invocations into 1 user invocation.
18
+
19
+ Every task returns complete: taskId, exitCode, durationMs, timedOut, stdout, stderr. Background tasks return immediately with task_id; continue with `in/status/<N>.txt` (tail), `in/watch/<N>.txt` (watch), or `in/close/<N>.txt` (close).
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: gm-codex
3
+ description: AI-native software engineering via skill-driven orchestration on codex; bootstraps plugkit for task execution and session isolation
4
+ allowed-tools: Skill
5
+ ---
6
+
7
+ # GM — codex Platform
8
+
9
+ AI-native software engineering orchestrated via skill chain: PLAN → EXECUTE → EMIT → VERIFY → UPDATE-DOCS.
10
+
11
+ **Bootstrap pattern**: `bun x gm-plugkit@latest --daemon` downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Call once at session start; idempotent on subsequent calls. All execution routes through the file-spool: write to `.gm/exec-spool/in/<lang>/<N>.<ext>` or `in/<verb>/<N>.txt`, poll `out/<N>.json` for results.
12
+
13
+ **Session-ID threading (no session-start hook)**: At skill invoke time, generate or detect SESSION_ID (env var `SESSION_ID` or `uuid()`). Pass `sessionId: "<id>"` in every rs-exec RPC body (spawn, tail, watch, etc.) and every spool-written task body. All task-scoped cleanup (deleteTask, getTask, appendOutput, killSessionTasks) requires matching sessionId. Absence is forbidden — hard reject by rs-exec handler.
14
+
15
+ **Spool dispatch surface**: Write to `.gm/exec-spool/in/<lang>/<N>.<ext>` (languages: nodejs, python, bash, typescript, go, rust, c, cpp, java, deno) or `in/<verb>/<N>.txt` (verbs: codesearch, recall, memorize, wait, sleep, status, close, browser, runner, etc.). Watcher executes and streams `out/<N>.out` (stdout) + `out/<N>.err` (stderr) line-by-line, then `out/<N>.json` metadata (exitCode, durationMs, timedOut, startedAt, endedAt) at completion.
16
+
17
+ **End-to-end skill chaining (skills-based platforms)**: When gm SKILL.md includes `end-to-end: true`, adapter detects signal and parses stdout for trailing JSON: `{"nextSkill": "...", "context": {...}, "phase": "..."}`. If nextSkill is non-null, invoke `Skill(skill="gm:<nextSkill>")` with context dict, repeat until null. This auto-chains 5 invocations into 1 user invocation.
18
+
19
+ Every task returns complete: taskId, exitCode, durationMs, timedOut, stdout, stderr. Background tasks return immediately with task_id; continue with `in/status/<N>.txt` (tail), `in/watch/<N>.txt` (watch), or `in/close/<N>.txt` (close).
@@ -3,121 +3,104 @@ name: gm-complete
3
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
4
  ---
5
5
 
6
- # GM COMPLETE — Verify and Complete
6
+ # GM COMPLETE — Verify, then close
7
7
 
8
- GRAPH: `PLAN EXECUTE EMIT [VERIFY] UPDATE-DOCSCOMPLETE`
9
- Entry: all EMIT gates passed. From `gm-emit`.
8
+ Entry: EMIT gates clear, from `gm-emit`. Exit: `.prd` deleted + test.js green + pushed + CI green → `update-docs`.
10
9
 
11
- ## TRANSITIONS
10
+ Cross-cutting dispositions live in `gm` SKILL.md.
12
11
 
13
- **EXIT → EXECUTE**: .prd items remain → invoke `gm-execute` immediately.
14
- **EXIT → COMPLETE**: .prd deleted + test.js passes + pushed + CI green → invoke `update-docs`.
15
- **REGRESS → EMIT**: broken file output.
16
- **REGRESS → EXECUTE**: logic wrong.
17
- **REGRESS → PLAN**: new unknown or wrong requirements.
12
+ ## Transitions
18
13
 
19
- Failure triage: broken outputEMIT | wrong logic → EXECUTE | new unknown → PLAN. Never patch around surprises.
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`
20
19
 
21
- ## MUTABLES ALL MUST RESOLVE BEFORE COMPLETE
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
22
23
 
23
24
  - `witnessed_e2e` — real end-to-end run with witnessed output
24
- - `browser_validated` — MANDATORY for any change touching client/UI/browser-facing code (anything served to a browser, rendered, or whose output is visible to a user). Must invoke `browser` skill, navigate the live page, and witness the change in `window` / DOM / scene state. test.js + node-side imports DO NOT satisfy this gate. See BROWSER VALIDATION GATE below.
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.
25
26
  - `git_clean` — `git status --porcelain` returns empty
26
27
  - `git_pushed` — `git log origin/main..HEAD --oneline` returns empty
27
- - `ci_passed` — all GitHub Actions runs reach `conclusion: success`
28
- - `prd_empty` — `.gm/prd.yml` deleted (file must not exist)
29
- - `stress_suite_clear` — change walked through all applicable governance stress cases (M1-D1), none flunk
30
- - `hidden_decision_posture` — advances open→down_weighted→closed only when CI green + stress suite clear
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
31
33
 
32
- ## END-TO-END VERIFICATION
34
+ ## End-to-end verification
33
35
 
34
- Run real system, real data, witness actual output. NOT verification: docs updates, saying done, screenshots alone.
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`):
35
37
 
36
38
  ```
37
- exec:nodejs
38
39
  const { fn } = await import('/abs/path/to/module.js');
39
40
  console.log(await fn(realInput));
40
41
  ```
41
42
 
42
- Browser/UI: invoke `browser` skill. After every success: enumerate what remains — never stop at first green.
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.
43
48
 
44
- ## BROWSER VALIDATION GATE MANDATORY FOR CLIENT WORK
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.
45
50
 
46
- If this session changed any code that runs in a browseranything under client/, UI components, shaders, page-loaded JS, served HTML, gh-pages assets, dev-server endpoints, or any module imported into the page bundle `browser_validated` MUST resolve before COMPLETE. Skipping it because "node tests pass" or "test.js is green" is a forced-closure refusal of witnessed verification.
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.
47
52
 
48
- Trigger detection (any one suffices):
49
- - `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.
50
- - New/changed export consumed by `window.*` or rendered in DOM/canvas/WebGL.
51
- - Visual, layout, animation, input, network-on-page, or shader behavior altered.
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.
52
54
 
53
- Required protocol:
54
- 1. Boot the real server (or open the static page) on a known URL — witness HTTP 200.
55
- 2. `exec:browser` → `page.goto(url)` → wait for app init (poll for the global the change affects, e.g. `window.__app.<system>`).
56
- 3. Probe via `page.evaluate(() => …)` — assert the specific invariant the change was supposed to establish (instance counts, scene meshes, DOM nodes, render stats, network frames, etc.).
57
- 4. Capture the witnessed numbers in the response. "Looks fine" is not a witness.
58
- 5. Failures → regress to `gm-execute` (logic) or `gm-emit` (output) — never paper over.
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.
59
56
 
60
- 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.
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`.
61
58
 
62
- Exempt only when: change is server-only with zero browser-facing surface, OR repository has no browser surface at all (pure CLI/library). Tag the exemption in the response with the reason; do not silently skip.
59
+ ## Integration test gate
63
60
 
64
- ## INTEGRATION TEST GATE
61
+ Write to `.gm/exec-spool/in/nodejs/<N>.js`:
65
62
 
66
63
  ```
67
- exec:nodejs
68
64
  const { execSync } = require('child_process');
69
65
  try { execSync('node test.js', { stdio: 'inherit', timeout: 30000 }); console.log('PASS'); }
70
66
  catch (e) { console.error('FAIL'); process.exit(1); }
71
67
  ```
72
68
 
73
- Failure → regress to `gm-execute`. No test.js + testable surface → regress to `gm-execute` to create it.
69
+ Failure → `gm-execute`. No test.js in a repo with testable surface → `gm-execute` to create it.
74
70
 
75
- ## GIT ENFORCEMENT
71
+ ## Git enforcement
72
+
73
+ Run directly via Bash:
76
74
 
77
75
  ```
78
- exec:bash
79
76
  git status --porcelain
80
77
  git log origin/main..HEAD --oneline
81
78
  ```
82
79
 
83
- Both must return empty. Local commit without push complete.
80
+ Both must return empty. Local commit without push is not complete.
84
81
 
85
- ## CI AUTOMATED
82
+ ## CI is automated
86
83
 
87
- Stop hook watches all GitHub Actions runs for the pushed HEAD. Do not call `gh run list` manually.
88
- - All-green → Stop approves with CI summary in next turn context
89
- - Failure → Stop blocks with run names+IDs → investigate with `gh run view <id> --log-failed`, fix, push, hook re-watches
90
- - Deadline 180s (override `GM_CI_WATCH_SECS`) → slow jobs get "still in progress" approve
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.
91
85
 
92
- ## HYGIENE SWEEP
86
+ ## Hygiene sweep
93
87
 
94
- Before declaring complete:
95
88
  1. Files >200 lines → split
96
89
  2. Comments in code → remove
97
- 3. Scattered test files (.test.js, .spec.js, __tests__/, fixtures/, mocks/) → delete, consolidate into root test.js
98
- 4. Mock/stub/simulation files → delete
99
- 5. Unnecessary doc files (not CHANGELOG/CLAUDE/README/TODO.md) → delete
100
- 6. Duplicate concern → snake to `planning` with restructuring instructions
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
101
94
  7. Hardcoded values → derive from ground truth
102
- 8. Fallback/demo modes → remove, fail loud
103
- 9. TODO.md → empty/deleted
104
- 10. CHANGELOG.md → has entries for this session
95
+ 8. Fallback / demo modes → remove, fail loud
96
+ 9. TODO.md → empty or deleted
97
+ 10. CHANGELOG.md → entries for this session
105
98
  11. Observability gaps → server subsystems expose `/debug/<subsystem>`; client modules register in `window.__debug`
106
- 12. Memorize → every fact from verification handed off via background Agent(memorize) at moment of resolution
107
- 13. Deploy/publish → if deployable, deploy; if npm package, publish
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
108
101
  14. GitHub Pages → check `.github/workflows/pages.yml` + `docs/index.html` exist; invoke `pages` skill if absent
109
- 15. Governance stress-suite → walk change through M1,F1,C1,H1,S1,B1,A1,D1; any flunk = regress to owning phase
110
-
111
- ## MEMORIZE
112
-
113
- ```
114
- Agent(subagent_type='gm:memorize', model='haiku', run_in_background=true, prompt='## CONTEXT TO MEMORIZE\n<fact>')
115
- ```
116
-
117
- One per fact, parallel, same turn resolved. End-of-turn self-check mandatory.
118
-
119
- ## COMPLETION DEFINITION
102
+ 15. Governance stress-suite → walk change through M1, F1, C1, H1, S1, B1, A1, D1; any flunk regresses to the owning phase
120
103
 
121
- All: witnessed e2e | browser_validated (when client work touched) | failure paths exercised | test.js passes | .prd deleted | git clean+pushed | CI green | hygiene sweep clean | TODO.md gone | CHANGELOG.md updated
104
+ ## Completion
122
105
 
123
- **Never**: claim done without witnessed output | claim done on a client change without browser-validation witness | stop while .prd has items | skip hygiene | skip test.js | uncommitted/unpushed work | stop at first green
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.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: gm-copilot-cli
3
+ description: AI-native software engineering via skill-driven orchestration on copilot-cli; bootstraps plugkit for task execution and session isolation
4
+ allowed-tools: Skill
5
+ ---
6
+
7
+ # GM — copilot-cli Platform
8
+
9
+ AI-native software engineering orchestrated via skill chain: PLAN → EXECUTE → EMIT → VERIFY → UPDATE-DOCS.
10
+
11
+ **Bootstrap pattern**: `bun x gm-plugkit@latest --daemon` downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Call once at session start; idempotent on subsequent calls. All execution routes through the file-spool: write to `.gm/exec-spool/in/<lang>/<N>.<ext>` or `in/<verb>/<N>.txt`, poll `out/<N>.json` for results.
12
+
13
+ **Session-ID threading (no session-start hook)**: At skill invoke time, generate or detect SESSION_ID (env var `SESSION_ID` or `uuid()`). Pass `sessionId: "<id>"` in every rs-exec RPC body (spawn, tail, watch, etc.) and every spool-written task body. All task-scoped cleanup (deleteTask, getTask, appendOutput, killSessionTasks) requires matching sessionId. Absence is forbidden — hard reject by rs-exec handler.
14
+
15
+ **Spool dispatch surface**: Write to `.gm/exec-spool/in/<lang>/<N>.<ext>` (languages: nodejs, python, bash, typescript, go, rust, c, cpp, java, deno) or `in/<verb>/<N>.txt` (verbs: codesearch, recall, memorize, wait, sleep, status, close, browser, runner, etc.). Watcher executes and streams `out/<N>.out` (stdout) + `out/<N>.err` (stderr) line-by-line, then `out/<N>.json` metadata (exitCode, durationMs, timedOut, startedAt, endedAt) at completion.
16
+
17
+ **End-to-end skill chaining (skills-based platforms)**: When gm SKILL.md includes `end-to-end: true`, adapter detects signal and parses stdout for trailing JSON: `{"nextSkill": "...", "context": {...}, "phase": "..."}`. If nextSkill is non-null, invoke `Skill(skill="gm:<nextSkill>")` with context dict, repeat until null. This auto-chains 5 invocations into 1 user invocation.
18
+
19
+ Every task returns complete: taskId, exitCode, durationMs, timedOut, stdout, stderr. Background tasks return immediately with task_id; continue with `in/status/<N>.txt` (tail), `in/watch/<N>.txt` (watch), or `in/close/<N>.txt` (close).
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: gm-cursor
3
+ description: AI-native software engineering via skill-driven orchestration on cursor; bootstraps plugkit for task execution and session isolation
4
+ allowed-tools: Skill
5
+ ---
6
+
7
+ # GM — cursor Platform
8
+
9
+ AI-native software engineering orchestrated via skill chain: PLAN → EXECUTE → EMIT → VERIFY → UPDATE-DOCS.
10
+
11
+ **Bootstrap pattern**: `bun x gm-plugkit@latest --daemon` downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Call once at session start; idempotent on subsequent calls. All execution routes through the file-spool: write to `.gm/exec-spool/in/<lang>/<N>.<ext>` or `in/<verb>/<N>.txt`, poll `out/<N>.json` for results.
12
+
13
+ **Session-ID threading (no session-start hook)**: At skill invoke time, generate or detect SESSION_ID (env var `SESSION_ID` or `uuid()`). Pass `sessionId: "<id>"` in every rs-exec RPC body (spawn, tail, watch, etc.) and every spool-written task body. All task-scoped cleanup (deleteTask, getTask, appendOutput, killSessionTasks) requires matching sessionId. Absence is forbidden — hard reject by rs-exec handler.
14
+
15
+ **Spool dispatch surface**: Write to `.gm/exec-spool/in/<lang>/<N>.<ext>` (languages: nodejs, python, bash, typescript, go, rust, c, cpp, java, deno) or `in/<verb>/<N>.txt` (verbs: codesearch, recall, memorize, wait, sleep, status, close, browser, runner, etc.). Watcher executes and streams `out/<N>.out` (stdout) + `out/<N>.err` (stderr) line-by-line, then `out/<N>.json` metadata (exitCode, durationMs, timedOut, startedAt, endedAt) at completion.
16
+
17
+ **End-to-end skill chaining (skills-based platforms)**: When gm SKILL.md includes `end-to-end: true`, adapter detects signal and parses stdout for trailing JSON: `{"nextSkill": "...", "context": {...}, "phase": "..."}`. If nextSkill is non-null, invoke `Skill(skill="gm:<nextSkill>")` with context dict, repeat until null. This auto-chains 5 invocations into 1 user invocation.
18
+
19
+ Every task returns complete: taskId, exitCode, durationMs, timedOut, stdout, stderr. Background tasks return immediately with task_id; continue with `in/status/<N>.txt` (tail), `in/watch/<N>.txt` (watch), or `in/close/<N>.txt` (close).
@@ -3,85 +3,68 @@ name: gm-emit
3
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
4
  ---
5
5
 
6
- # GM EMIT — Write and Verify
6
+ # GM EMIT — Write and verify from disk
7
7
 
8
- GRAPH: `PLAN EXECUTE [EMIT] VERIFY → COMPLETE`
9
- Entry: all mutables KNOWN. From `gm-execute` or re-entered from VERIFY.
8
+ Entry: every mutable KNOWN, from `gm-execute` or re-entered from VERIFY. Exit: gates clear → `gm-complete`.
10
9
 
11
- ## TRANSITIONS
10
+ Cross-cutting dispositions live in `gm` SKILL.md.
12
11
 
13
- **EXIT → VERIFY**: all gate conditions true → invoke `gm-complete` immediately.
14
- **SELF-LOOP**: post-emit variance with known cause → fix, re-verify, stay in EMIT.
15
- **REGRESS → EXECUTE**: pre-emit reveals known logic error.
16
- **REGRESS → PLAN**: pre-emit reveals new unknown | post-emit variance with unknown cause | scope changed.
12
+ ## Transitions
17
13
 
18
- ## LEGITIMACY GATE (before pre-emit run)
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`
19
18
 
20
- For every claim landing in a file:
21
- 1. **Earned specificity** — traces to `authorization=witnessed`, not inflated from weak prior?
22
- 2. **Repair legality** — local patch dressed as structural repair? Downgrade scope or snake to PLAN.
23
- 3. **Lawful downgrade** — can a weaker, true statement replace it? PREFER the downgrade.
24
- 4. **Alternative-route suppression** — live competing route being silenced? Preserve it.
25
- 5. **Strongest objection** — if a reviewer pushed back on this change, what would the sharpest argument be? Articulate it. Cannot articulate = have not understood the alternatives = regress to `gm-execute`.
19
+ ## Legitimacy gate (before pre-emit run)
26
20
 
27
- Fail any regress to `gm-execute` to witness what was missing, or `planning` if gap is structural.
21
+ For every claim landing in a file, answer five questions:
28
22
 
29
- ## PRE-EMIT RUN (mandatory before writing any file)
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`):
30
34
 
31
35
  ```
32
- exec:nodejs
33
36
  const { fn } = await import('/abs/path/to/module.js');
34
37
  console.log(await fn(realInput));
35
38
  ```
36
39
 
37
- 1. Import actual module from disk witness current behavior as baseline
38
- 2. Run proposed logic in isolation WITHOUT writing — witness with real inputs
39
- 3. Probe failure paths with real error inputs
40
- 4. Compare: matches expected → write. Unexpected → new unknown → `planning`.
41
-
42
- ## WRITING FILES
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`.
43
41
 
44
- `exec:nodejs` with `require('fs')`. Write only when every gate mutable resolved simultaneously.
42
+ ## Writing
45
43
 
46
- ## POST-EMIT VERIFICATION (immediately after writing)
44
+ Use the Write tool, or a nodejs spool file with `require('fs')`. Write only when every gate mutable resolves simultaneously.
47
45
 
48
- 1. Re-import from disk (not in-memory — stale is inadmissible)
49
- 2. Run identical inputs as pre-emit — must match pre-emit baseline exactly
50
- 3. Known variance → fix immediately, re-verify (EMIT self-loop)
51
- 4. Unknown variance → new unknown → invoke `planning`
52
-
53
- ## GATE CONDITIONS (all true simultaneously)
54
-
55
- - Legitimacy gate passed; none of five refused collapses
56
- - Pre-emit passed with real inputs + error inputs
57
- - Post-emit matches pre-emit exactly
58
- - Hot reloadable; errors throw with context (no fallbacks, `|| default`, `catch { return null }`)
59
- - No mocks/fakes/stubs/scattered test files (delete on discovery)
60
- - Behavior change in this emit = a corresponding assertion in test.js (a change no test would catch is a change you cannot prove)
61
- - If this emit changes any browser-facing code (client/, served HTML/JS, shaders, page-bundle imports, gh-pages assets), the post-emit verify MUST include a live browser witness via `exec:browser` (boot server → page.goto → page.evaluate asserting the invariant the change established). Node-side import + test.js does NOT satisfy this — see `gm-complete` BROWSER VALIDATION GATE.
62
- - Files ≤200 lines
63
- - No duplicate concern (run exec:codesearch for primary concern after writing; any overlap → `planning`)
64
- - No comments; no hardcoded values; no adjectives in identifiers; no unnecessary files
65
- - Observability: new server subsystems expose `/debug/<subsystem>`; new client modules in `window.__debug`
66
- - Structure: no if/else where dispatch table suffices; no one-liners that require decoding; no reinvented APIs
67
- - All facts resolved this phase memorized via background Agent(memorize)
68
- - CHANGELOG.md updated; TODO.md cleared/deleted
46
+ ## Post-emit verification
69
47
 
70
- ## CODE EXECUTION
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`.
71
49
 
72
- `exec:<lang>` only. File writes via exec:nodejs + require('fs'). Never Bash(node/npm/npx/bun).
73
- Pack runs: Promise.allSettled, each idea own try/catch, under 12s per call.
50
+ ## Mutables gate
74
51
 
75
- ## CODEBASE SEARCH
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.
76
53
 
77
- `exec:codesearch` only. Grep/Glob/Find/Explore = hook-blocked. Known path → `Read`.
54
+ ## Gate (all true at once)
78
55
 
79
- ## MEMORIZE
80
-
81
- ```
82
- Agent(subagent_type='gm:memorize', model='haiku', run_in_background=true, prompt='## CONTEXT TO MEMORIZE\n<fact>')
83
- ```
84
-
85
- Same turn as resolution. Parallel when multiple. End-of-turn self-check mandatory.
86
-
87
- **Never**: write before pre-emit | advance with post-emit variance | absorb surprises | respond to user mid-phase
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