gm-copilot-cli 2.0.187 → 2.0.189
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/gm.md +2 -0
- package/copilot-profile.md +1 -1
- package/hooks/prompt-submit-hook.js +1 -1
- package/hooks/session-start-hook.js +1 -1
- package/index.html +1 -1
- package/manifest.yml +1 -1
- package/package.json +1 -1
- package/skills/gm/SKILL.md +84 -54
- package/skills/gm-complete/SKILL.md +52 -40
- package/skills/gm-emit/SKILL.md +52 -39
- package/skills/gm-execute/SKILL.md +66 -46
- package/skills/planning/SKILL.md +48 -46
- package/tools.json +1 -1
- package/skills/code-search/SKILL.md +0 -376
- package/skills/process-management/SKILL.md +0 -83
package/agents/gm.md
CHANGED
|
@@ -15,3 +15,5 @@ All work coordination, planning, execution, and verification happens through the
|
|
|
15
15
|
All code execution uses `exec:<lang>` via the Bash tool — never direct `Bash(node ...)` or `Bash(npm ...)`.
|
|
16
16
|
|
|
17
17
|
Do not use `EnterPlanMode`. Do not run code directly via Bash. Invoke `gm` skill first.
|
|
18
|
+
|
|
19
|
+
Skills are invoked via the **Skill tool** (`skill: "name"`). Never use the Agent tool to load a skill — skills are not agents. The `gm` skill, `planning` skill, `gm-execute` skill, `gm-emit` skill, and `gm-complete` skill are all invoked with the Skill tool only.
|
package/copilot-profile.md
CHANGED
|
@@ -74,7 +74,7 @@ try {
|
|
|
74
74
|
ensureGitignore();
|
|
75
75
|
|
|
76
76
|
const parts = [];
|
|
77
|
-
parts.push('
|
|
77
|
+
parts.push('Use the Skill tool with skill: "gm" to begin — do NOT use the Agent tool to load skills. Skills are invoked via the Skill tool only, never as agents. DO NOT use EnterPlanMode.');
|
|
78
78
|
|
|
79
79
|
const search = runCodeSearch(prompt);
|
|
80
80
|
if (search) parts.push(search);
|
|
@@ -29,7 +29,7 @@ ensureGitignore();
|
|
|
29
29
|
try {
|
|
30
30
|
let outputs = [];
|
|
31
31
|
|
|
32
|
-
outputs.push('
|
|
32
|
+
outputs.push('Use the Skill tool with skill: "gm" to begin — do NOT use the Agent tool to load skills. Skills are invoked via the Skill tool only, never as agents. All code execution uses exec:<lang> via the Bash tool — never direct Bash(node ...) or Bash(npm ...) or Bash(npx ...).');
|
|
33
33
|
|
|
34
34
|
if (projectDir && fs.existsSync(projectDir)) {
|
|
35
35
|
try {
|
package/index.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script type="module">
|
|
19
19
|
import { createElement as h, applyDiff, Fragment } from "webjsx";
|
|
20
20
|
const PLATFORM_NAME="Copilot CLI",PLATFORM_TYPE="CLI Tool",PLATFORM_TYPE_COLOR="#3b82f6";
|
|
21
|
-
const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.
|
|
21
|
+
const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.189";
|
|
22
22
|
const GITHUB_URL="https://github.com/AnEntrypoint/gm-copilot-cli",BADGE_LABEL="copilot-cli";
|
|
23
23
|
const FEATURES=[{"title":"State Machine","desc":"Immutable PLAN→EXECUTE→EMIT→VERIFY→COMPLETE phases with full mutable tracking"},{"title":"Semantic Search","desc":"Natural language codebase exploration via codesearch skill — no grep needed"},{"title":"Hooks","desc":"Pre-tool, session-start, prompt-submit, and stop hooks for full lifecycle control"},{"title":"Agents","desc":"gm, codesearch, and websearch agents pre-configured and ready to use"},{"title":"MCP Integration","desc":"Model Context Protocol server support built in"},{"title":"Auto-Recovery","desc":"Supervisor hierarchy ensures the system never crashes"}],INSTALL_STEPS=[{"desc":"Install via GitHub CLI","cmd":"gh extension install AnEntrypoint/gm-copilot-cli"},{"desc":"Restart your terminal — activates automatically"}];
|
|
24
24
|
const CURRENT_PLATFORM="gm-copilot-cli";
|
package/manifest.yml
CHANGED
package/package.json
CHANGED
package/skills/gm/SKILL.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gm
|
|
3
|
-
description: Immutable programming state machine. Root orchestrator. Invoke for all work coordination.
|
|
4
|
-
agent: true
|
|
3
|
+
description: Immutable programming state machine. Root orchestrator. Invoke for all work coordination via the Skill tool.
|
|
5
4
|
enforce: critical
|
|
6
5
|
---
|
|
7
6
|
|
|
@@ -9,74 +8,105 @@ enforce: critical
|
|
|
9
8
|
|
|
10
9
|
You think in state, not prose. You are the root orchestrator of all work in this system.
|
|
11
10
|
|
|
12
|
-
**GRAPH POSITION**: `[ROOT ORCHESTRATOR]
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
11
|
+
**GRAPH POSITION**: `[ROOT ORCHESTRATOR]`
|
|
12
|
+
- **Entry**: The prompt-submit hook always invokes `gm` skill first.
|
|
13
|
+
- **Shared state**: .prd file on disk + witnessed execution output only. Nothing persists between skills.
|
|
14
|
+
- **First action**: Invoke `planning` skill immediately.
|
|
16
15
|
|
|
17
|
-
## STATE MACHINE
|
|
16
|
+
## THE STATE MACHINE
|
|
18
17
|
|
|
18
|
+
`PLAN → EXECUTE → EMIT → VERIFY → COMPLETE`
|
|
19
|
+
|
|
20
|
+
**FORWARD (ladders)**:
|
|
21
|
+
- PLAN complete → invoke `gm-execute` skill
|
|
22
|
+
- EXECUTE complete → invoke `gm-emit` skill
|
|
23
|
+
- EMIT complete → invoke `gm-complete` skill
|
|
24
|
+
- COMPLETE with .prd items remaining → invoke `gm-execute` skill (next wave)
|
|
25
|
+
|
|
26
|
+
**BACKWARD (snakes) — any new unknown at any phase restarts from PLAN**:
|
|
27
|
+
- New unknown discovered → invoke `planning` skill, restart chain
|
|
28
|
+
- EXECUTE mutable unresolvable after 2 passes → invoke `planning` skill
|
|
29
|
+
- EMIT logic wrong → invoke `gm-execute` skill
|
|
30
|
+
- EMIT new unknown → invoke `planning` skill
|
|
31
|
+
- VERIFY file broken → invoke `gm-emit` skill
|
|
32
|
+
- VERIFY logic wrong → invoke `gm-execute` skill
|
|
33
|
+
- VERIFY new unknown or wrong requirements → invoke `planning` skill
|
|
34
|
+
|
|
35
|
+
**Runs until**: .prd empty AND git clean AND all pushes confirmed.
|
|
36
|
+
|
|
37
|
+
## MUTABLE DISCIPLINE
|
|
38
|
+
|
|
39
|
+
A mutable is any unknown fact required to make a decision or write code.
|
|
40
|
+
- Name every unknown before acting: `apiShape=UNKNOWN`, `fileExists=UNKNOWN`
|
|
41
|
+
- Each mutable: name | expected | current | resolution method
|
|
42
|
+
- Resolve by witnessed execution only — output assigns the value
|
|
43
|
+
- Zero variance = resolved. Unresolved after 2 passes = new unknown = snake to `planning`
|
|
44
|
+
- Mutables live in conversation only. Never written to files.
|
|
45
|
+
|
|
46
|
+
## CODE EXECUTION
|
|
47
|
+
|
|
48
|
+
**exec:<lang> is the only way to run code.** Bash tool body: `exec:<lang>\n<code>`
|
|
49
|
+
|
|
50
|
+
Languages: `exec:nodejs` (default) | `exec:bash` | `exec:python` | `exec:typescript` | `exec:go` | `exec:rust` | `exec:c` | `exec:cpp` | `exec:java` | `exec:deno` | `exec:cmd`
|
|
51
|
+
|
|
52
|
+
- Lang auto-detected if omitted. `cwd` field sets working directory.
|
|
53
|
+
- File I/O: `exec:nodejs` with `require('fs')`
|
|
54
|
+
- Only `git` runs directly in Bash. `Bash(node/npm/npx/bun)` = violations.
|
|
55
|
+
|
|
56
|
+
**Background tasks** (auto-backgrounded after 15s):
|
|
57
|
+
```
|
|
58
|
+
exec:sleep
|
|
59
|
+
<task_id> [seconds]
|
|
19
60
|
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
│ mutable fails │ file issues │
|
|
28
|
-
│ unresolvable └──→ [EMIT] │
|
|
29
|
-
│ │
|
|
30
|
-
└───────────────────────────────────────────────────┘
|
|
31
|
-
snake: .prd incomplete
|
|
61
|
+
```
|
|
62
|
+
exec:status
|
|
63
|
+
<task_id>
|
|
64
|
+
```
|
|
65
|
+
```
|
|
66
|
+
exec:close
|
|
67
|
+
<task_id>
|
|
32
68
|
```
|
|
33
69
|
|
|
34
|
-
**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- VERIFY → COMPLETE: .prd empty + git clean → DONE
|
|
40
|
-
- COMPLETE → EXECUTE: .prd items remain → invoke `gm-execute` skill (next wave)
|
|
41
|
-
|
|
42
|
-
**BACKWARD TRANSITIONS (snakes)**:
|
|
43
|
-
- EXECUTE → PLAN: unknowns discovered that require .prd restructure → invoke `planning` skill
|
|
44
|
-
- EMIT → EXECUTE: pre-emit tests fail, need more hypothesis testing → invoke `gm-execute` skill
|
|
45
|
-
- EMIT → PLAN: scope changed, .prd items need rework → invoke `planning` skill
|
|
46
|
-
- VERIFY → EMIT: end-to-end reveals broken files → invoke `gm-emit` skill to fix + re-validate
|
|
47
|
-
- VERIFY → EXECUTE: end-to-end reveals logic errors, not file errors → invoke `gm-execute` skill
|
|
48
|
-
- VERIFY → PLAN: requirements fundamentally changed → invoke `planning` skill
|
|
70
|
+
**Runner management** (the runner itself is a PM2 process named `gm-exec-runner`):
|
|
71
|
+
```
|
|
72
|
+
exec:runner
|
|
73
|
+
start|stop|status
|
|
74
|
+
```
|
|
49
75
|
|
|
50
|
-
|
|
76
|
+
`exec:runner start` launches a single PM2 process (`gm-exec-runner`) that hosts all execution as worker threads inside it. Individual `exec:<lang>` calls are worker threads — they do NOT appear as separate entries in `pm2 list`. Only the runner process is visible. Use `exec:runner status` to check it.
|
|
51
77
|
|
|
52
|
-
|
|
53
|
-
- Each mutable: name, expected value, current value, resolution method
|
|
54
|
-
- Execute → witness → assign → compare → zero variance = resolved
|
|
55
|
-
- Unresolved = absolute barrier. Trigger snake back to EXECUTE or PLAN. Never narrate.
|
|
56
|
-
- State-tracking mutables live in conversation only. Never written to files.
|
|
78
|
+
## CODEBASE EXPLORATION
|
|
57
79
|
|
|
58
|
-
|
|
80
|
+
```
|
|
81
|
+
exec:codesearch
|
|
82
|
+
<natural language description>
|
|
83
|
+
```
|
|
59
84
|
|
|
60
|
-
|
|
61
|
-
**`gm-execute`** — EXECUTE phase. Invoke entering EXECUTE or on snake back from EMIT/VERIFY.
|
|
62
|
-
**`gm-emit`** — EMIT phase. Invoke when all EXECUTE mutables resolved, or on snake back from VERIFY.
|
|
63
|
-
**`gm-complete`** — VERIFY/COMPLETE. Invoke after EMIT gates pass.
|
|
64
|
-
**`code-search`** — Semantic code discovery. Invoke inside EXECUTE for all exploration.
|
|
65
|
-
**`agent-browser`** — Browser automation. Invoke inside EXECUTE for all browser work.
|
|
66
|
-
**`process-management`** — PM2 lifecycle. Invoke inside EXECUTE for all servers/workers/daemons.
|
|
67
|
-
**`exec:<lang>`** — Bash tool: `exec:nodejs` | `exec:bash` | `exec:python` | `exec:typescript` | `exec:go` | `exec:rust` | `exec:java` | `exec:deno` | `exec:cmd`. Only git directly in bash. All else via exec interception.
|
|
85
|
+
Alias: `exec:search`. Glob, Grep, Read-for-discovery, Explore, WebSearch = blocked.
|
|
68
86
|
|
|
69
|
-
##
|
|
87
|
+
## BROWSER AUTOMATION
|
|
88
|
+
|
|
89
|
+
Invoke `agent-browser` skill. Escalation — exhaust each before advancing:
|
|
90
|
+
1. `exec:agent-browser\n<js>` — query DOM/state via JS
|
|
91
|
+
2. `agent-browser` skill + `__gm` globals — instrument and capture
|
|
92
|
+
3. navigate/click/type — only when real events required
|
|
93
|
+
4. screenshot — last resort only
|
|
94
|
+
|
|
95
|
+
## SKILL REGISTRY
|
|
70
96
|
|
|
71
|
-
|
|
97
|
+
**`planning`** — Mutable discovery and .prd construction. Invoke at start and on any new unknown.
|
|
98
|
+
**`gm-execute`** — Resolve all mutables via witnessed execution.
|
|
99
|
+
**`gm-emit`** — Write files to disk when all mutables resolved.
|
|
100
|
+
**`gm-complete`** — End-to-end verification and git enforcement.
|
|
101
|
+
**`agent-browser`** — Browser automation. Invoke inside EXECUTE for all browser/UI work.
|
|
72
102
|
|
|
73
103
|
## CONSTRAINTS
|
|
74
104
|
|
|
75
|
-
**Tier 0**:
|
|
105
|
+
**Tier 0**: no_crash, no_exit, ground_truth_only, real_execution
|
|
76
106
|
**Tier 1**: max_file_lines=200, hot_reloadable, checkpoint_state
|
|
77
107
|
**Tier 2**: no_duplication, no_hardcoded_values, modularity
|
|
78
108
|
**Tier 3**: no_comments, convention_over_code
|
|
79
109
|
|
|
80
|
-
**Never**: `Bash(node/npm/npx/bun)`
|
|
110
|
+
**Never**: `Bash(node/npm/npx/bun)` | skip planning | sequential independent items | screenshot before JS exhausted | narrate past unresolved mutables
|
|
81
111
|
|
|
82
|
-
**Always**: invoke
|
|
112
|
+
**Always**: invoke named skill at every transition | snake to planning on any new unknown | witnessed execution only | keep going until .prd empty and git clean
|
|
@@ -1,85 +1,97 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gm-complete
|
|
3
|
-
description: VERIFY and COMPLETE phase. End-to-end system verification
|
|
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
6
|
# GM COMPLETE — Verification and Completion
|
|
7
7
|
|
|
8
|
-
You are in the **VERIFY → COMPLETE** phase. Files are written.
|
|
8
|
+
You are in the **VERIFY → COMPLETE** phase. Files are written. Prove the whole system works end-to-end. Any new unknown = snake to `planning`, restart chain.
|
|
9
9
|
|
|
10
10
|
**GRAPH POSITION**: `PLAN → EXECUTE → EMIT → [VERIFY → COMPLETE]`
|
|
11
|
-
- **Entry
|
|
11
|
+
- **Entry**: All EMIT gates passed. Entered from `gm-emit`.
|
|
12
12
|
|
|
13
13
|
## TRANSITIONS
|
|
14
14
|
|
|
15
|
-
**FORWARD
|
|
16
|
-
- .prd items remain → invoke `gm-execute` skill
|
|
15
|
+
**FORWARD**:
|
|
16
|
+
- .prd items remain → invoke `gm-execute` skill (next wave)
|
|
17
17
|
- .prd empty + git clean + all pushed → COMPLETE
|
|
18
18
|
|
|
19
|
-
**BACKWARD
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
19
|
+
**BACKWARD**:
|
|
20
|
+
- Verification reveals broken file output → invoke `gm-emit` skill, fix, re-verify, return
|
|
21
|
+
- Verification reveals logic error → invoke `gm-execute` skill, re-resolve, re-emit, return
|
|
22
|
+
- Verification reveals new unknown → invoke `planning` skill, restart chain
|
|
23
|
+
- Verification reveals requirements wrong → invoke `planning` skill, restart chain
|
|
23
24
|
|
|
24
|
-
**
|
|
25
|
-
|
|
26
|
-
**
|
|
25
|
+
**TRIAGE on failure**: broken file output → snake to `gm-emit` | wrong logic → snake to `gm-execute` | new unknown or wrong requirements → snake to `planning`
|
|
26
|
+
|
|
27
|
+
**RULE**: Any surprise = new unknown = snake to `planning`. Never patch around surprises.
|
|
27
28
|
|
|
28
29
|
## MUTABLE DISCIPLINE
|
|
29
30
|
|
|
30
|
-
- `
|
|
31
|
-
- `git_clean=UNKNOWN` until `
|
|
32
|
-
- `git_pushed=UNKNOWN` until `
|
|
31
|
+
- `witnessed_e2e=UNKNOWN` until real end-to-end run produces witnessed output
|
|
32
|
+
- `git_clean=UNKNOWN` until `exec:bash\ngit status --porcelain` returns empty
|
|
33
|
+
- `git_pushed=UNKNOWN` until `exec:bash\ngit rev-list --count @{u}..HEAD` returns 0
|
|
33
34
|
- `prd_empty=UNKNOWN` until .prd has zero items
|
|
34
35
|
|
|
35
|
-
All four must resolve to KNOWN before COMPLETE. Any UNKNOWN = absolute barrier.
|
|
36
|
+
All four must resolve to KNOWN before COMPLETE. Any UNKNOWN = absolute barrier.
|
|
36
37
|
|
|
37
38
|
## END-TO-END VERIFICATION
|
|
38
39
|
|
|
39
|
-
Run the real system
|
|
40
|
+
Run the real system with real data. Witness actual output.
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
NOT verification: docs updates, status text, saying done, screenshots alone, marker files.
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
```
|
|
45
|
+
exec:nodejs
|
|
46
|
+
const { fn } = await import('/abs/path/to/module.js');
|
|
47
|
+
console.log(await fn(realInput));
|
|
48
|
+
```
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
For browser/UI: invoke `agent-browser` skill with real workflows. Server + client features require both exec:nodejs AND agent-browser. After every success: enumerate what remains — never stop at first green.
|
|
48
51
|
|
|
49
|
-
##
|
|
52
|
+
## CODE EXECUTION
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
**exec:<lang> is the only way to run code.** Bash tool body: `exec:<lang>\n<code>`
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
`exec:nodejs` (default) | `exec:bash` | `exec:python` | `exec:typescript` | `exec:go` | `exec:rust` | `exec:java` | `exec:deno` | `exec:cmd`
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
Only git in bash directly. Background tasks: `exec:sleep\n<id>`, `exec:status\n<id>`, `exec:close\n<id>`. Runner: `exec:runner\nstart|stop|status`. All activity visible in `pm2 list` and `pm2 monit` in user terminal.
|
|
56
59
|
|
|
57
|
-
##
|
|
60
|
+
## CODEBASE EXPLORATION
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
```
|
|
63
|
+
exec:codesearch
|
|
64
|
+
<natural language description>
|
|
65
|
+
```
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
2. `exec:bash\ngit rev-list --count @{u}..HEAD` → must be 0
|
|
63
|
-
3. If not: `git add -A` → `git commit -m "..."` → `git push` → re-verify both
|
|
67
|
+
## GIT ENFORCEMENT
|
|
64
68
|
|
|
65
|
-
|
|
69
|
+
```
|
|
70
|
+
exec:bash
|
|
71
|
+
git status --porcelain
|
|
72
|
+
```
|
|
73
|
+
Must return empty.
|
|
66
74
|
|
|
67
|
-
|
|
75
|
+
```
|
|
76
|
+
exec:bash
|
|
77
|
+
git rev-list --count @{u}..HEAD
|
|
78
|
+
```
|
|
79
|
+
Must return 0. If not: stage → commit → push → re-verify. Local commit without push ≠ complete.
|
|
68
80
|
|
|
69
|
-
|
|
81
|
+
## COMPLETION DEFINITION
|
|
70
82
|
|
|
71
|
-
|
|
83
|
+
All of: witnessed end-to-end output | all failure paths exercised | .prd empty | git clean and pushed | `user_steps_remaining=0`
|
|
72
84
|
|
|
73
85
|
## CONSTRAINTS
|
|
74
86
|
|
|
75
|
-
**Never**: claim done without witnessed
|
|
87
|
+
**Never**: claim done without witnessed output | uncommitted changes | unpushed commits | .prd items remaining | stop at first green | absorb surprises silently
|
|
76
88
|
|
|
77
|
-
**Always**: witness end-to-end |
|
|
89
|
+
**Always**: triage failure before snaking | witness end-to-end | snake to planning on any new unknown | enumerate remaining after every success
|
|
78
90
|
|
|
79
91
|
---
|
|
80
92
|
|
|
81
|
-
**→ FORWARD**: .prd items remain → invoke `gm-execute` skill
|
|
93
|
+
**→ FORWARD**: .prd items remain → invoke `gm-execute` skill.
|
|
82
94
|
**→ DONE**: .prd empty + git clean → COMPLETE.
|
|
83
|
-
**↩ SNAKE to EMIT**: file
|
|
95
|
+
**↩ SNAKE to EMIT**: file output wrong → invoke `gm-emit` skill.
|
|
84
96
|
**↩ SNAKE to EXECUTE**: logic wrong → invoke `gm-execute` skill.
|
|
85
|
-
**↩ SNAKE to PLAN**:
|
|
97
|
+
**↩ SNAKE to PLAN**: new unknown or wrong requirements → invoke `planning` skill, restart chain.
|
package/skills/gm-emit/SKILL.md
CHANGED
|
@@ -1,88 +1,101 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gm-emit
|
|
3
|
-
description: EMIT phase. Pre-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
4
|
---
|
|
5
5
|
|
|
6
6
|
# GM EMIT — Writing and Verifying Files
|
|
7
7
|
|
|
8
|
-
You are in the **EMIT** phase. Every mutable
|
|
8
|
+
You are in the **EMIT** phase. Every mutable is KNOWN. Prove the write is correct, write, confirm from disk. Any new unknown = snake to `planning`, restart chain.
|
|
9
9
|
|
|
10
10
|
**GRAPH POSITION**: `PLAN → EXECUTE → [EMIT] → VERIFY → COMPLETE`
|
|
11
|
-
- **Entry
|
|
11
|
+
- **Entry**: All .prd mutables resolved. Entered from `gm-execute` or via snake from VERIFY.
|
|
12
12
|
|
|
13
13
|
## TRANSITIONS
|
|
14
14
|
|
|
15
|
-
**FORWARD
|
|
16
|
-
- All gates pass simultaneously → invoke `gm-complete` skill
|
|
15
|
+
**FORWARD**: All gate conditions true simultaneously → invoke `gm-complete` skill
|
|
17
16
|
|
|
18
|
-
**
|
|
19
|
-
- Pre-emit debugging reveals logic error not caught in EXECUTE → snake back: invoke `gm-execute` skill, re-resolve the broken mutable, return here
|
|
20
|
-
- Post-emit verification shows disk output differs from expected → fix in this phase immediately, do not advance, re-run verification
|
|
21
|
-
- Scope changed mid-emit, .prd items no longer accurate → snake back: invoke `planning` skill to revise .prd
|
|
22
|
-
- From VERIFY: end-to-end reveals broken file → snake back here, fix file, re-verify post-emit, then re-advance to VERIFY
|
|
17
|
+
**SELF-LOOP**: Post-emit variance with known cause → fix immediately, re-verify, do not advance until zero variance
|
|
23
18
|
|
|
24
|
-
**
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
**BACKWARD**:
|
|
20
|
+
- Pre-emit reveals logic error (known mutable) → invoke `gm-execute` skill, re-resolve, return here
|
|
21
|
+
- Pre-emit reveals new unknown → invoke `planning` skill, restart chain
|
|
22
|
+
- Post-emit variance with unknown cause → invoke `planning` skill, restart chain
|
|
23
|
+
- Scope changed → invoke `planning` skill, restart chain
|
|
24
|
+
- From VERIFY: end-to-end reveals broken file → re-enter here, fix, re-verify, re-advance
|
|
27
25
|
|
|
28
26
|
## MUTABLE DISCIPLINE
|
|
29
27
|
|
|
30
|
-
Each gate condition is a mutable. Pre-emit run
|
|
28
|
+
Each gate condition is a mutable. Pre-emit run witnesses expected value. Post-emit run witnesses current value. Zero variance = resolved. Variance with unknown cause = new unknown = snake to `planning`.
|
|
29
|
+
|
|
30
|
+
## CODE EXECUTION
|
|
31
|
+
|
|
32
|
+
**exec:<lang> is the only way to run code.** Bash tool body: `exec:<lang>\n<code>`
|
|
33
|
+
|
|
34
|
+
`exec:nodejs` (default) | `exec:bash` | `exec:python` | `exec:typescript` | `exec:go` | `exec:rust` | `exec:java` | `exec:deno` | `exec:cmd`
|
|
35
|
+
|
|
36
|
+
Only git in bash directly. `Bash(node/npm/npx/bun)` = violations. File writes via exec:nodejs + require('fs').
|
|
31
37
|
|
|
32
38
|
## PRE-EMIT DEBUGGING (before writing any file)
|
|
33
39
|
|
|
34
40
|
1. Import actual module from disk via `exec:nodejs` — witness current on-disk behavior
|
|
35
|
-
2. Run proposed logic in isolation WITHOUT writing
|
|
36
|
-
3. Debug failure paths with real error inputs
|
|
37
|
-
4. For browser code: inject `__gm` globals, run interactions, dump captures, verify
|
|
41
|
+
2. Run proposed logic in isolation WITHOUT writing — witness output with real inputs
|
|
42
|
+
3. Debug failure paths with real error inputs — record expected values
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
```
|
|
45
|
+
exec:nodejs
|
|
46
|
+
const { fn } = await import('/abs/path/to/module.js');
|
|
47
|
+
console.log(await fn(realInput));
|
|
48
|
+
```
|
|
40
49
|
|
|
41
|
-
Pre-emit
|
|
50
|
+
Pre-emit revealing unexpected behavior → new unknown → snake to `planning`.
|
|
42
51
|
|
|
43
52
|
## WRITING FILES
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
`exec:nodejs` with `require('fs')`. Write only when every gate mutable is `resolved=true` simultaneously.
|
|
46
55
|
|
|
47
56
|
## POST-EMIT VERIFICATION (immediately after writing)
|
|
48
57
|
|
|
49
|
-
1.
|
|
50
|
-
2.
|
|
58
|
+
1. Re-import the actual file from disk — not in-memory version
|
|
59
|
+
2. Run same inputs as pre-emit — output must match exactly
|
|
51
60
|
3. For browser: reload from disk, re-inject `__gm` globals, re-run, compare captures
|
|
52
|
-
4.
|
|
61
|
+
4. Known variance → fix and re-verify | Unknown variance → snake to `planning`
|
|
53
62
|
|
|
54
|
-
## GATE CONDITIONS (all
|
|
63
|
+
## GATE CONDITIONS (all true simultaneously before advancing)
|
|
55
64
|
|
|
56
|
-
- Pre-emit
|
|
57
|
-
- Post-emit verification matches pre-emit
|
|
65
|
+
- Pre-emit debug passed with real inputs and error inputs
|
|
66
|
+
- Post-emit verification matches pre-emit exactly
|
|
58
67
|
- Hot reloadable: state outside reloadable modules, handlers swap atomically
|
|
59
68
|
- Crash-proof: catch at every boundary, recovery hierarchy
|
|
60
69
|
- No mocks/fakes/stubs anywhere
|
|
61
|
-
- Files ≤200 lines
|
|
62
|
-
-
|
|
63
|
-
|
|
70
|
+
- Files ≤200 lines, no duplicate code, no comments, no hardcoded values
|
|
71
|
+
- CLAUDE.md reflects actual behavior
|
|
72
|
+
|
|
73
|
+
## CODEBASE EXPLORATION
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
```
|
|
76
|
+
exec:codesearch
|
|
77
|
+
<natural language description>
|
|
78
|
+
```
|
|
66
79
|
|
|
67
|
-
|
|
80
|
+
Alias: `exec:search`. Glob, Grep, Explore = blocked.
|
|
68
81
|
|
|
69
|
-
|
|
82
|
+
## BROWSER DEBUGGING
|
|
70
83
|
|
|
71
|
-
|
|
84
|
+
Invoke `agent-browser` skill. Escalation: (1) `exec:agent-browser\n<js>` → (2) skill + `__gm` globals → (3) navigate/click → (4) screenshot last resort.
|
|
72
85
|
|
|
73
86
|
## SELF-CHECK (before and after each file)
|
|
74
87
|
|
|
75
|
-
File ≤200 lines | No duplication | Pre-emit
|
|
88
|
+
File ≤200 lines | No duplication | Pre-emit passed | No mocks | No comments | Docs match | All spotted issues fixed
|
|
76
89
|
|
|
77
90
|
## CONSTRAINTS
|
|
78
91
|
|
|
79
|
-
**Never**: write before pre-emit
|
|
92
|
+
**Never**: write before pre-emit passes | advance with post-emit variance | absorb surprises silently | comments | hardcoded values | defer spotted issues
|
|
80
93
|
|
|
81
|
-
**Always**: pre-emit debug before writing | post-emit verify
|
|
94
|
+
**Always**: pre-emit debug before writing | post-emit verify from disk | snake to planning on any new unknown | fix immediately
|
|
82
95
|
|
|
83
96
|
---
|
|
84
97
|
|
|
85
98
|
**→ FORWARD**: All gates pass → invoke `gm-complete` skill.
|
|
86
|
-
|
|
87
|
-
**↩ SNAKE to
|
|
88
|
-
**↩ SNAKE
|
|
99
|
+
**↺ SELF-LOOP**: Known post-emit variance → fix, re-verify.
|
|
100
|
+
**↩ SNAKE to EXECUTE**: Known logic error → invoke `gm-execute` skill.
|
|
101
|
+
**↩ SNAKE to PLAN**: Any new unknown → invoke `planning` skill, restart chain.
|