promptgraph-mcp 2.4.5 → 2.4.7
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/github-import.js +28 -0
- package/index.js +47 -14
- package/indexer.js +14 -7
- package/package.json +1 -1
- package/parser.js +21 -115
- package/registry/training/bad/accepts-HISTORY.md +250 -0
- package/registry/training/bad/argparse-CHANGELOG.md +185 -0
- package/registry/training/bad/balanced-match-LICENSE.md +23 -0
- package/registry/training/bad/better-sqlite3-README.md +99 -0
- package/registry/training/bad/bindings-LICENSE.md +22 -0
- package/registry/training/bad/bl-LICENSE.md +13 -0
- package/registry/training/bad/body-parser-README.md +494 -0
- package/registry/training/bad/bytes-HISTORY.md +97 -0
- package/registry/training/bad/camelcase-README.md +135 -0
- package/registry/training/bad/chai-README.md +162 -0
- package/registry/training/bad/cli-progress-LICENSE.md +24 -0
- package/registry/training/bad/content-type-HISTORY.md +29 -0
- package/registry/training/bad/cookie-SECURITY.md +25 -0
- package/registry/training/bad/cookie-signature-HISTORY.md +70 -0
- package/registry/training/bad/cors-README.md +277 -0
- package/registry/training/bad/cross-spawn-README.md +89 -0
- package/registry/training/bad/deep-extend-CHANGELOG.md +46 -0
- package/registry/training/bad/depd-HISTORY.md +103 -0
- package/registry/training/bad/esprima-README.md +46 -0
- package/registry/training/bad/etag-HISTORY.md +83 -0
- package/registry/training/bad/expect-type-SECURITY.md +14 -0
- package/registry/training/bad/finalhandler-HISTORY.md +239 -0
- package/registry/training/bad/fresh-HISTORY.md +80 -0
- package/registry/training/bad/glob-LICENSE.md +63 -0
- package/registry/training/bad/hono-README.md +85 -0
- package/registry/training/bad/http-errors-HISTORY.md +186 -0
- package/registry/training/bad/jose-LICENSE.md +21 -0
- package/registry/training/bad/jose-README.md +153 -0
- package/registry/training/bad/js-yaml-README.md +299 -0
- package/registry/training/bad/json-schema-typed-LICENSE.md +57 -0
- package/registry/training/bad/json-stringify-safe-CHANGELOG.md +14 -0
- package/registry/training/bad/lru-cache-LICENSE.md +55 -0
- package/registry/training/bad/media-typer-HISTORY.md +50 -0
- package/registry/training/bad/minimatch-LICENSE.md +55 -0
- package/registry/training/bad/minimist-CHANGELOG.md +298 -0
- package/registry/training/bad/minimist-README.md +121 -0
- package/registry/training/bad/ms-LICENSE.md +21 -0
- package/registry/training/bad/negotiator-HISTORY.md +114 -0
- package/registry/training/bad/on-finished-HISTORY.md +98 -0
- package/registry/training/bad/pkce-challenge-CHANGELOG.md +114 -0
- package/registry/training/bad/postcss-README.md +28 -0
- package/registry/training/bad/prebuild-install-CHANGELOG.md +131 -0
- package/registry/training/bad/proxy-addr-HISTORY.md +161 -0
- package/registry/training/bad/qs-CHANGELOG.md +822 -0
- package/registry/training/bad/rc-README.md +227 -0
- package/registry/training/bad/readable-stream-CONTRIBUTING.md +38 -0
- package/registry/training/bad/router-HISTORY.md +228 -0
- package/registry/training/bad/semver-README.md +680 -0
- package/registry/training/bad/send-README.md +317 -0
- package/registry/training/bad/serve-static-README.md +253 -0
- package/registry/training/bad/statuses-HISTORY.md +87 -0
- package/registry/training/bad/type-is-HISTORY.md +292 -0
- package/registry/training/bad/vary-HISTORY.md +39 -0
- package/registry/training/bad/vite-LICENSE.md +2230 -0
- package/registry/training/bad/which-CHANGELOG.md +166 -0
- package/registry/training/bad/zod-README.md +191 -0
- package/registry/training/good/skills-store-autopilot.md +85 -0
- package/registry/training/good/skills-store-bot-builder.md +70 -0
- package/registry/training/good/skills-store-chain.md +136 -0
- package/registry/training/good/skills-store-evolve.md +100 -0
- package/registry/training/good/skills-store-game.md +27 -0
- package/registry/training/good/skills-store-hunt.md +102 -0
- package/registry/training/good/skills-store-intel.md +56 -0
- package/registry/training/good/skills-store-memory-gc.md +58 -0
- package/registry/training/good/skills-store-pcsort.md +207 -0
- package/registry/training/good/skills-store-pickup.md +60 -0
- package/registry/training/good/skills-store-recon.md +141 -0
- package/registry/training/good/skills-store-remember.md +64 -0
- package/registry/training/good/skills-store-report.md +117 -0
- package/registry/training/good/skills-store-router.md +225 -0
- package/registry/training/good/skills-store-search.md +168 -0
- package/registry/training/good/skills-store-surface.md +53 -0
- package/registry/training/good/skills-store-token-scan.md +141 -0
- package/registry/training/good/skills-store-triage.md +97 -0
- package/registry/training/good/skills-store-unity.md +733 -0
- package/registry/training/good/skills-store-validate.md +135 -0
- package/registry/training/good/skills-store-web3-audit.md +217 -0
- package/src/filter/classifier.js +88 -0
- package/src/filter/cluster.js +52 -0
- package/src/filter/dedup.js +36 -0
- package/src/filter/hard-filter.js +57 -0
- package/src/filter/train.js +64 -0
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
# Next-Gen Unity Cognitive Orchestrator (NGUCO)
|
|
2
|
+
|
|
3
|
+
Central intelligence for **any** Unity 6 project. Claude is the sole reasoning core.
|
|
4
|
+
OpenCode agents are execution workers — they do not plan, reason globally, or own state.
|
|
5
|
+
|
|
6
|
+
Invoke: `/unity <topic>`
|
|
7
|
+
|
|
8
|
+
## System Rules (always enforced)
|
|
9
|
+
|
|
10
|
+
**OpenCode for large tasks:** Any task with `complexity: high` OR more than 3 parallel nodes MUST be dispatched through OpenCode agents, not handled by Claude directly. Claude reasons and plans — OpenCode executes.
|
|
11
|
+
|
|
12
|
+
**One OpenCode CLI:** Always use `--attach http://localhost:4100` to connect to the single running server. NEVER start multiple `opencode-cli serve` processes. All parallelism happens inside OpenCode via Task subagents — one CLI, unlimited agents.
|
|
13
|
+
|
|
14
|
+
**MCP Unity:** This project has MCP Unity available. Prefer MCP Unity tools for Editor operations (creating objects, running menu items, reading hierarchy, compiling) over writing YAML scene files manually. MCP tools are faster and don't require scene file parsing.
|
|
15
|
+
|
|
16
|
+
**Free models — use in order of task type:**
|
|
17
|
+
| Task | Model |
|
|
18
|
+
|---|---|
|
|
19
|
+
| Orchestration, simulation, planning dispatch | `opencode/big-pickle` |
|
|
20
|
+
| Research, web search, validation, asset work | `opencode/qwen3.6-plus-free` |
|
|
21
|
+
| C# code generation, repair, logic | `opencode/deepseek-v4-flash-free` |
|
|
22
|
+
| Fast checks, world state, build | `opencode/qwen3.6-plus-free` |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Maturity Levels
|
|
27
|
+
|
|
28
|
+
Every request targets a maturity level. Default: **Level 4 (Production-Ready)**.
|
|
29
|
+
|
|
30
|
+
| Level | Name | What it means |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| 0 | Snippet | Throwaway function, no context |
|
|
33
|
+
| 1 | Example | Tutorial code, hardcoded values |
|
|
34
|
+
| 2 | Prototype | Functional but fragile, no abstraction |
|
|
35
|
+
| 3 | MVP | Working feature, basic tests, minimal error handling |
|
|
36
|
+
| 4 | Production-Ready | Abstracted, tested, documented, error-handled |
|
|
37
|
+
| 5 | Scalable | DI, full test suite, performance budgeted, CI/CD |
|
|
38
|
+
| 6 | Enterprise | Versioned APIs, backward compat, audit trail |
|
|
39
|
+
|
|
40
|
+
**Enforcement per level:**
|
|
41
|
+
- Level ≤ 2: No gates. Quick execution.
|
|
42
|
+
- Level 3: production-critic only.
|
|
43
|
+
- Level ≥ 4: Full pipeline — maturity-classifier → depth-expander → system-designer → interface-generator → coder → testing-enforcer → production-critic.
|
|
44
|
+
- Level ≥ 5: Add multi-pass-planner before execution.
|
|
45
|
+
|
|
46
|
+
## Anti-Demo Rules (ABSOLUTE — never override)
|
|
47
|
+
|
|
48
|
+
These rules exist because LLMs default to tutorial/demo quality. They must never be bypassed.
|
|
49
|
+
|
|
50
|
+
**NEVER:**
|
|
51
|
+
- Create a MonoBehaviour that owns more than one game system
|
|
52
|
+
- Write hardcoded string/object references (`Find("Player")`, `FindObjectOfType`)
|
|
53
|
+
- Skip interface definitions for any public system contract
|
|
54
|
+
- Write `TODO`, `FIXME`, or `NotImplementedException` in implementation code
|
|
55
|
+
- Create "placeholder" logic that isn't real logic
|
|
56
|
+
- Simplify core systems to make them "easier to understand"
|
|
57
|
+
- Skip serialization for any runtime state that should persist
|
|
58
|
+
- Skip error handling in any public method
|
|
59
|
+
- Use `Resources.Load` at runtime
|
|
60
|
+
- Create a script without a namespace
|
|
61
|
+
|
|
62
|
+
**ALWAYS:**
|
|
63
|
+
- Design systems, not scripts
|
|
64
|
+
- Define interfaces before implementation
|
|
65
|
+
- Write tests alongside implementation
|
|
66
|
+
- Handle failure paths explicitly
|
|
67
|
+
- Document public APIs with XML comments
|
|
68
|
+
- Put persistence design in the SDD before any code
|
|
69
|
+
- Think about extensibility (can another developer add a feature without touching this class?)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## PHASE 0 — Bootstrap
|
|
74
|
+
|
|
75
|
+
### 0.1 Confirm Unity project
|
|
76
|
+
```bash
|
|
77
|
+
ls Assets/ 2>/dev/null && echo "UNITY_PROJECT" || echo "NOT_UNITY"
|
|
78
|
+
```
|
|
79
|
+
If NOT_UNITY → stop. Tell user: "Open Claude Code from the Unity project folder (the one containing Assets/)."
|
|
80
|
+
|
|
81
|
+
### 0.2 Get project name
|
|
82
|
+
```bash
|
|
83
|
+
basename "$(pwd)"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 0.3 Check world state
|
|
87
|
+
```bash
|
|
88
|
+
ls .project-state/WORLD_STATE.json 2>/dev/null && echo "INITIALIZED" || echo "FIRST_RUN"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If FIRST_RUN → run **First-Run Setup** below, then continue.
|
|
92
|
+
|
|
93
|
+
### 0.4 Check OpenCode server
|
|
94
|
+
```bash
|
|
95
|
+
curl -s http://localhost:4100/health 2>&1 | head -1
|
|
96
|
+
```
|
|
97
|
+
If not responding → tell user:
|
|
98
|
+
> OpenCode server not running. Open this project in VSCode (it auto-starts), or run: `opencode-cli serve --port 4100`
|
|
99
|
+
Then stop.
|
|
100
|
+
|
|
101
|
+
### 0.5 Check MCP Unity
|
|
102
|
+
Check if the Unity MCP server is reachable:
|
|
103
|
+
```powershell
|
|
104
|
+
try { (Invoke-WebRequest -Uri "http://localhost:27112/mcp" -UseBasicParsing -TimeoutSec 2).StatusCode } catch { $_.Exception.Response.StatusCode }
|
|
105
|
+
```
|
|
106
|
+
- Response `200` or `406` → MCP Unity **CONNECTED** — set `MCP_UNITY=true`
|
|
107
|
+
- Timeout / connection refused → MCP Unity **UNAVAILABLE**
|
|
108
|
+
|
|
109
|
+
If UNAVAILABLE → try starting the server:
|
|
110
|
+
```powershell
|
|
111
|
+
$exe = Get-ChildItem ".\Library\mcp-server\win-x64\unity-mcp-server.exe" -ErrorAction SilentlyContinue
|
|
112
|
+
if ($exe) { Start-Process $exe.FullName -WorkingDirectory $exe.DirectoryName -WindowStyle Hidden; Start-Sleep 3 }
|
|
113
|
+
```
|
|
114
|
+
Re-check. If still unavailable → continue without MCP (OpenCode scene-tool fallback).
|
|
115
|
+
|
|
116
|
+
Note MCP Unity status in session: `MCP Unity: CONNECTED | UNAVAILABLE`
|
|
117
|
+
|
|
118
|
+
### 0.6 If world state exists but LAST_INDEXED is NOT_GENERATED_YET → index now
|
|
119
|
+
```bash
|
|
120
|
+
opencode-cli run --attach http://localhost:4100 --agent world-state-manager \
|
|
121
|
+
"Index this Unity project. Scan all .cs files in Assets/, extract: class names, public/serialized fields, MonoBehaviour types, ScriptableObject types, event declarations, Addressable references, scene names from Assets/Scenes/. Scan Packages/manifest.json for installed packages. Write complete WORLD_STATE.json to .project-state/WORLD_STATE.json. Set LAST_INDEXED to current ISO timestamp."
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## First-Run Setup
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
mkdir -p .project-state/RESULTS .project-state/MEMORY
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Create `.project-state/WORLD_STATE.json`:
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"project": { "name": "PLACEHOLDER", "phase": "PROTOTYPE", "lastUpdated": "", "lastIndexed": "NOT_GENERATED_YET" },
|
|
136
|
+
"sceneGraph": { "hierarchy": [], "transforms": {}, "components": {} },
|
|
137
|
+
"gameplayGraph": { "systems": [], "triggers": [], "aiStates": {} },
|
|
138
|
+
"physicsGraph": { "colliders": [], "navmesh": { "baked": false, "agents": [] } },
|
|
139
|
+
"renderingGraph": { "pipeline": "URP", "materials": [], "lights": [], "postProcessing": {} },
|
|
140
|
+
"assetManifest": { "prefabs": [], "textures": [], "audio": [], "addressableGroups": [] },
|
|
141
|
+
"dependencyGraph": { "scripts": {}, "packages": [] },
|
|
142
|
+
"performanceMetrics": { "drawCalls": 0, "triangleCount": 0, "memoryMB": 0, "targetFPS": 60 },
|
|
143
|
+
"codeQualityMetrics": {
|
|
144
|
+
"avgClassLines": 0,
|
|
145
|
+
"maxClassLines": 0,
|
|
146
|
+
"interfaceCoverageRatio": 0,
|
|
147
|
+
"namespaceCoverageRatio": 0,
|
|
148
|
+
"xmlDocCoverageRatio": 0,
|
|
149
|
+
"testRatio": 0,
|
|
150
|
+
"todoCount": 0,
|
|
151
|
+
"hardcodedStringCount": 0,
|
|
152
|
+
"avgMethodLines": 0
|
|
153
|
+
},
|
|
154
|
+
"architectureMemory": { "systems": [], "decisions": [], "constraints": [], "patterns": [] },
|
|
155
|
+
"designGoals": { "primaryGoal": "", "secondaryGoals": [], "nonGoals": [], "maturityTarget": 4 },
|
|
156
|
+
"technicalConstraints": { "platforms": [], "maxDrawCalls": 0, "maxMemoryMB": 0, "targetFPS": 60, "bannedPatterns": [] },
|
|
157
|
+
"systemContracts": [],
|
|
158
|
+
"passHistory": [],
|
|
159
|
+
"openIssues": [],
|
|
160
|
+
"lastSimulation": null,
|
|
161
|
+
"lastValidation": null
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
Replace `PLACEHOLDER` with the actual project name.
|
|
165
|
+
|
|
166
|
+
Create `.project-state/TASK_GRAPH.json`:
|
|
167
|
+
```json
|
|
168
|
+
{ "session": "", "intent": {}, "nodes": [], "status": "idle" }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Create `.project-state/VALIDATION_RESULTS.json`:
|
|
172
|
+
```json
|
|
173
|
+
{ "timestamp": "", "overall": "NONE", "categories": {} }
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Create `.project-state/SIMULATION_RESULTS.json`:
|
|
177
|
+
```json
|
|
178
|
+
{ "timestamp": "", "verdict": "NONE", "risks": [], "predictions": {} }
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Create `.project-state/MEMORY/semantic.md`:
|
|
182
|
+
```
|
|
183
|
+
# Semantic Memory
|
|
184
|
+
_Concepts, patterns, reusable logic discovered in this project._
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Create `.project-state/MEMORY/episodic.md`:
|
|
188
|
+
```
|
|
189
|
+
# Episodic Memory
|
|
190
|
+
_Session history: what was built, what failed, what was repaired._
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Create `.project-state/MEMORY/procedural.md`:
|
|
194
|
+
```
|
|
195
|
+
# Procedural Memory
|
|
196
|
+
_Reusable workflows discovered during execution._
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Create `opencode.json` (if missing):
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"$schema": "https://opencode.ai/config.json",
|
|
203
|
+
"model": "opencode/qwen3.6-plus-free",
|
|
204
|
+
"instructions": [".opencode/rules.md"]
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
Note: `opencode/big-pickle`, `opencode/qwen3.6-plus-free`, `opencode/deepseek-v4-flash-free` are all free OpenCode models. Agents can override with `model:` in their frontmatter. Do NOT add plugins — they slow down every startup.
|
|
208
|
+
|
|
209
|
+
Create `.mcp.json` (if missing):
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"mcpServers": {
|
|
213
|
+
"ai-game-developer": {
|
|
214
|
+
"type": "http",
|
|
215
|
+
"url": "http://localhost:8080"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Copy agent definitions:
|
|
222
|
+
```bash
|
|
223
|
+
mkdir -p .opencode/agents
|
|
224
|
+
cp "C:/Users/Sasha/.claude/plugins/unity-dev/templates/agents/"* .opencode/agents/
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Copy VSCode config:
|
|
228
|
+
```bash
|
|
229
|
+
mkdir -p .vscode
|
|
230
|
+
cp "C:/Users/Sasha/.claude/plugins/unity-dev/templates/.vscode/settings.json" .vscode/settings.json
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Create `.vscode/tasks.json`:
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"version": "2.0.0",
|
|
237
|
+
"tasks": [
|
|
238
|
+
{
|
|
239
|
+
"label": "Unity MCP: Start Server",
|
|
240
|
+
"type": "shell",
|
|
241
|
+
"command": "${workspaceFolder}/Library/mcp-server/win-x64/unity-mcp-server.exe",
|
|
242
|
+
"options": { "cwd": "${workspaceFolder}/Library/mcp-server/win-x64" },
|
|
243
|
+
"runOptions": { "runOn": "folderOpen" },
|
|
244
|
+
"isBackground": true,
|
|
245
|
+
"presentation": { "reveal": "silent", "panel": "dedicated", "tab": "Unity MCP" },
|
|
246
|
+
"problemMatcher": { "pattern": { "regexp": "^$" }, "background": { "activeOnStart": true, "beginsPattern": ".", "endsPattern": "Start listening" } }
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"label": "OpenCode: Start Server",
|
|
250
|
+
"type": "shell",
|
|
251
|
+
"command": "C:\\Users\\Sasha\\AppData\\Local\\OpenCode\\opencode-cli.exe serve --port 4100",
|
|
252
|
+
"options": { "cwd": "${workspaceFolder}" },
|
|
253
|
+
"runOptions": { "runOn": "folderOpen" },
|
|
254
|
+
"isBackground": true,
|
|
255
|
+
"presentation": { "reveal": "silent", "panel": "dedicated", "tab": "OpenCode" },
|
|
256
|
+
"problemMatcher": {
|
|
257
|
+
"pattern": { "regexp": "^$" },
|
|
258
|
+
"background": { "activeOnStart": true, "beginsPattern": ".", "endsPattern": "Listening" }
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Tell user: "First-run setup complete. Reload VSCode (Ctrl+Shift+P → Reload Window). Then run `/unity <topic>` again."
|
|
266
|
+
Stop here.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## PHASE 1 — Intent Interpreter
|
|
271
|
+
|
|
272
|
+
**Claude does this reasoning directly. No agent call.**
|
|
273
|
+
|
|
274
|
+
Parse `$ARGUMENTS` into structured intent. Output:
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"topic": "<original text>",
|
|
278
|
+
"domain": "<environment|gameplay|systems|visual|audio|build|fix|optimize>",
|
|
279
|
+
"actions": ["create|fix|optimize|refactor|delete"],
|
|
280
|
+
"requiredSystems": ["navmesh|inventory|spawner|ai|physics|audio|ui|..."],
|
|
281
|
+
"visualRequirements": ["fog|rain|neon|lighting|shadows|postfx|..."],
|
|
282
|
+
"aiRequirements": ["patrol|traffic|crowd|combat|perception|..."],
|
|
283
|
+
"constraints": {
|
|
284
|
+
"targetPlatform": "PC|Mobile|Console|WebGL",
|
|
285
|
+
"perfBudget": { "drawCallsMax": 300, "memoryMaxMB": 1024, "targetFPS": 60 }
|
|
286
|
+
},
|
|
287
|
+
"complexity": "low|medium|high",
|
|
288
|
+
"riskLevel": "low|medium|high"
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Rules for complexity/risk:
|
|
293
|
+
- `low`: single system, no new dependencies, < 5 files
|
|
294
|
+
- `medium`: 2-4 systems, moderate dependencies
|
|
295
|
+
- `high`: 5+ systems, new architecture, cross-system dependencies
|
|
296
|
+
|
|
297
|
+
Print the parsed intent before continuing.
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## PHASE 1B — Maturity Classification
|
|
302
|
+
|
|
303
|
+
**Claude dispatches immediately after Phase 1.**
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
opencode-cli run --attach http://localhost:4100 --agent maturity-classifier \
|
|
307
|
+
"<topic from $ARGUMENTS>. Classify target maturity and return Development Intent JSON. Do NOT use the Task tool."
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Claude reads the Development Intent JSON. Stores `target_maturity` and `enforcement_gates` for this session.
|
|
311
|
+
|
|
312
|
+
**If target_maturity ≤ 2:** Skip Phases 1C, 1D, 3B, 7B. Go directly to Phase 3 (Task Graph).
|
|
313
|
+
**If target_maturity = 3:** Skip 1C, 1D, 3B. Run production-critic in Phase 7B only.
|
|
314
|
+
**If target_maturity ≥ 4:** Run full pipeline including 1C, 1D, 3B, 7B.
|
|
315
|
+
|
|
316
|
+
## PHASE 1C — Depth Expansion (maturity ≥ 4 only)
|
|
317
|
+
|
|
318
|
+
**Claude dispatches depth-expander to reveal full system scope.**
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
opencode-cli run --attach http://localhost:4100 --agent depth-expander \
|
|
322
|
+
"<topic>. Read WORLD_STATE.json. Expand to full subsystem map, interfaces, events, dependencies, persistence, testing. Do NOT use the Task tool."
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Claude reads the expansion JSON. This drives the Task Graph in Phase 3 — every subsystem in the expansion becomes a node.
|
|
326
|
+
|
|
327
|
+
**Scope guard:** If depth-expander reveals > 15 subsystems, Claude checks with user: "This system has N subsystems. Should I implement all in this session, or prioritize a subset?"
|
|
328
|
+
|
|
329
|
+
## PHASE 1D — Architecture Gate (maturity ≥ 4 only)
|
|
330
|
+
|
|
331
|
+
**Claude dispatches architecture-enforcer to check if architecture exists.**
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
opencode-cli run --attach http://localhost:4100 --agent architecture-enforcer \
|
|
335
|
+
"<topic>. Read depth-expander output and WORLD_STATE.json systemContracts. Produce SDD or verify existing one. Do NOT use the Task tool."
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
If architecture-enforcer returns PRODUCING ARCHITECTURE → Claude dispatches system-designer:
|
|
339
|
+
```bash
|
|
340
|
+
opencode-cli run --attach http://localhost:4100 --agent system-designer \
|
|
341
|
+
"<topic>. Read depth-expander output. Write complete SDD to .project-state/DESIGNS/<feature>-SDD.md. Do NOT use the Task tool."
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Then interface-generator:
|
|
345
|
+
```bash
|
|
346
|
+
opencode-cli run --attach http://localhost:4100 --agent interface-generator \
|
|
347
|
+
"Read .project-state/DESIGNS/<feature>-SDD.md. Write all interface .cs files to Assets/Scripts/<System>/Interfaces/. Do NOT use the Task tool."
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Architecture gate is hard:** Claude does NOT proceed to implementation until architecture-enforcer returns APPROVED.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## PHASE 2 — World State Load
|
|
355
|
+
|
|
356
|
+
**Claude reads directly.**
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
cat .project-state/WORLD_STATE.json
|
|
360
|
+
cat .project-state/MEMORY/episodic.md
|
|
361
|
+
cat .project-state/MEMORY/semantic.md
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
From these, Claude determines:
|
|
365
|
+
- What systems already exist (avoid rebuilding)
|
|
366
|
+
- Current performance baseline (drawCalls, memoryMB)
|
|
367
|
+
- Past failures in this area (from episodic memory)
|
|
368
|
+
- Known patterns for this domain (from semantic memory)
|
|
369
|
+
- Any open issues that intersect this task
|
|
370
|
+
|
|
371
|
+
Print a 3-5 line **World State Summary** before continuing.
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## PHASE 3 — Task Graph Construction
|
|
376
|
+
|
|
377
|
+
**Claude builds the DAG directly. No agent call.**
|
|
378
|
+
|
|
379
|
+
Build `TASK_GRAPH.json` based on intent + world state. Rules:
|
|
380
|
+
- Only include tasks for things that don't already exist in world state
|
|
381
|
+
- Assign correct agent per task type (see routing table below)
|
|
382
|
+
- Dependencies must be explicit — no implicit ordering
|
|
383
|
+
- Parallel nodes (same dep depth) will be dispatched simultaneously
|
|
384
|
+
|
|
385
|
+
Agent routing table:
|
|
386
|
+
| Task type | Agent | Model |
|
|
387
|
+
|---|---|---|
|
|
388
|
+
| Scene hierarchy, placement, terrain, navmesh, lighting | `scene-tool` | `opencode/big-pickle` |
|
|
389
|
+
| C# scripts, systems, gameplay logic, shaders | `coder` | `opencode/deepseek-v4-flash-free` |
|
|
390
|
+
| Asset import, optimize, LOD, atlas | `asset-tool` | `opencode/qwen3.6-plus-free` |
|
|
391
|
+
| Build, CI/CD, platform pipeline | `build-tool` | `opencode/qwen3.6-plus-free` |
|
|
392
|
+
| Performance profiling, metrics collection | `analytics-tool` | `opencode/qwen3.6-plus-free` |
|
|
393
|
+
| Constraint check | `constraint-validator` | `opencode/qwen3.6-plus-free` |
|
|
394
|
+
| Simulation | `simulation-engine` | `opencode/big-pickle` |
|
|
395
|
+
| World state read/write | `world-state-manager` | `opencode/qwen3.6-plus-free` |
|
|
396
|
+
| Repair | `repair-engine` | `opencode/deepseek-v4-flash-free` |
|
|
397
|
+
|
|
398
|
+
**MCP Unity first:** Before any `scene-tool` node runs, check if MCP Unity is connected. If yes — `scene-tool` uses MCP Unity tools (create objects, modify transforms, add components, run Editor menu items) instead of writing YAML. This is the preferred path.
|
|
399
|
+
|
|
400
|
+
**Large task rule:** If `complexity: high` OR node count > 5 → wrap all execution dispatch in `unity-orchestrator` so it fans out as Task subagents. Claude never directly calls 5+ sequential `opencode-cli run` commands.
|
|
401
|
+
|
|
402
|
+
Write the task graph:
|
|
403
|
+
```bash
|
|
404
|
+
# Claude writes this file with actual node content based on intent
|
|
405
|
+
cat > .project-state/TASK_GRAPH.json << 'EOF'
|
|
406
|
+
{
|
|
407
|
+
"session": "<ISO timestamp>",
|
|
408
|
+
"intent": <parsed intent JSON>,
|
|
409
|
+
"nodes": [
|
|
410
|
+
{ "id": "<id>", "agent": "<agent>", "task": "<specific instruction>", "deps": [], "status": "pending" }
|
|
411
|
+
],
|
|
412
|
+
"status": "planning"
|
|
413
|
+
}
|
|
414
|
+
EOF
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Print the DAG structure (node ids and dep relationships) before continuing.
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## PHASE 3B — Multi-Pass Planning (maturity ≥ 5 OR complexity: high)
|
|
422
|
+
|
|
423
|
+
When `target_maturity ≥ 5` or `complexity: high` — dispatch multi-pass-planner before execution:
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
opencode-cli run --attach http://localhost:4100 --agent multi-pass-planner \
|
|
427
|
+
"<topic>. Read depth-expander output and SDD. Generate 7-pass plan. Write to .project-state/DESIGNS/<feature>-PASSES.md. Do NOT use the Task tool."
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Claude reads the pass plan. The Task Graph in Phase 3 is built from Pass 4 (implementation) nodes. Passes 1-3 are already complete (done in Phases 1C-1D). Passes 5-7 are appended after execution.
|
|
431
|
+
|
|
432
|
+
For maturity ≤ 4, skip 3B — single-pass execution is sufficient.
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## PHASE 4 — Pre-Execution Constraint Validation
|
|
437
|
+
|
|
438
|
+
Before touching any project files, validate the plan.
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
opencode-cli run --attach http://localhost:4100 --agent constraint-validator \
|
|
442
|
+
"Pre-execution validation. Read .project-state/TASK_GRAPH.json and .project-state/WORLD_STATE.json. Check: (1) Scene constraints — will any planned objects cause collider overlaps? (2) Performance constraints — will planned asset additions exceed drawCallsMax or memoryMaxMB in performanceMetrics.perfBudget? (3) Dependency constraints — do all planned scripts reference systems that exist or will exist in this task graph? (4) Navmesh prerequisite — any AI spawner task requires a navmesh task as dependency. Write .project-state/VALIDATION_RESULTS.json with overall: PASS|WARN|FAIL and per-category details."
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Read `.project-state/VALIDATION_RESULTS.json`.
|
|
446
|
+
|
|
447
|
+
Decision:
|
|
448
|
+
- `PASS` → continue to Phase 5
|
|
449
|
+
- `WARN` → log warnings in world state open issues, continue with caution
|
|
450
|
+
- `FAIL` → revise TASK_GRAPH.json to fix violations, re-run Phase 4 (max 2 retries), then continue
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## PHASE 5 — Simulation
|
|
455
|
+
|
|
456
|
+
Predict consequences before execution.
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
opencode-cli run --attach http://localhost:4100 --agent simulation-engine \
|
|
460
|
+
"Simulate execution of .project-state/TASK_GRAPH.json against .project-state/WORLD_STATE.json. Predict: (1) Performance impact — estimate draw call delta and memory delta from planned asset additions and new systems. (2) Conflict detection — detect any two planned objects that would occupy overlapping transforms. (3) AI reachability — verify all planned AI spawners will have navmesh coverage after navmesh tasks complete. (4) Physics validity — check planned collider configurations for validity. Write .project-state/SIMULATION_RESULTS.json with verdict SAFE|RISKY|BLOCKED, risk notes per category, and predictions object."
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Read `.project-state/SIMULATION_RESULTS.json`.
|
|
464
|
+
|
|
465
|
+
Decision:
|
|
466
|
+
- `SAFE` → proceed to Phase 6
|
|
467
|
+
- `RISKY` → append risks to WORLD_STATE.json openIssues, proceed with caution, flag risks in final report
|
|
468
|
+
- `BLOCKED` → **HARD STOP**. Report blocker to user with full diagnosis from SIMULATION_RESULTS.json. Do not proceed.
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## PHASE 6 — Execution Dispatch
|
|
473
|
+
|
|
474
|
+
Execute the Task Graph level-by-level. A "level" is all nodes whose dependencies are already COMPLETE.
|
|
475
|
+
|
|
476
|
+
**For each level:**
|
|
477
|
+
|
|
478
|
+
1. Identify all nodes at this level (deps all COMPLETE or level 0)
|
|
479
|
+
2. If single node → dispatch directly:
|
|
480
|
+
```bash
|
|
481
|
+
opencode-cli run --attach http://localhost:4100 --agent <agent> \
|
|
482
|
+
"<task instruction from node>. Read .project-state/WORLD_STATE.json for project context. Write result to .project-state/RESULTS/<node-id>-<timestamp>.md with STATUS: PASS|FAIL|BLOCKED at the top."
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
3. If multiple parallel nodes → dispatch via unity-orchestrator:
|
|
486
|
+
```bash
|
|
487
|
+
opencode-cli run --attach http://localhost:4100 --agent unity-orchestrator \
|
|
488
|
+
"Dispatch these parallel nodes as independent Task subagents. Each reads WORLD_STATE.json, executes its job, writes result to .project-state/RESULTS/<node-id>-<timestamp>.md with STATUS: PASS|FAIL|BLOCKED. Nodes: <JSON array of nodes at this level>"
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
4. After level completes — Claude reads ALL result files for this level:
|
|
492
|
+
```bash
|
|
493
|
+
ls .project-state/RESULTS/ | tail -<N> # N = nodes in this level
|
|
494
|
+
cat .project-state/RESULTS/<result-file>
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
5. Update world state via world-state-manager:
|
|
498
|
+
```bash
|
|
499
|
+
opencode-cli run --attach http://localhost:4100 --agent world-state-manager \
|
|
500
|
+
"Merge results from these files into WORLD_STATE.json: <list of result files>. Update sceneGraph, assetManifest, dependencyGraph, performanceMetrics as indicated in each result. Mark these task graph nodes as COMPLETE in TASK_GRAPH.json: <node ids>"
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
6. If any node STATUS: FAIL → add to repair list, continue with remaining levels
|
|
504
|
+
7. If any node STATUS: BLOCKED → stop level, report blocker, ask user for input
|
|
505
|
+
|
|
506
|
+
**RISK: HIGH rule:** If `riskLevel` is HIGH in intent, Claude reads every result file's full diff section personally before reporting progress.
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
## PHASE 7 — Post-Execution Verification
|
|
511
|
+
|
|
512
|
+
After all levels complete, run full verification pass.
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
opencode-cli run --attach http://localhost:4100 --agent constraint-validator \
|
|
516
|
+
"Full post-execution verification pass. Read .project-state/WORLD_STATE.json. Check all constraint categories: (1) Compile validity — scan Assets/Scripts/ for missing using directives, unresolved type references, broken [SerializeField] types. (2) Scene validity — no broken prefab references, no missing MonoBehaviour scripts on GameObjects, no overlapping colliders. (3) Gameplay validity — all AI spawner components have navmesh coverage, all trigger zones have registered handlers, no unreachable game states. (4) Performance validity — current metrics within perfBudget thresholds. Write .project-state/VALIDATION_RESULTS.json with full detail per failure."
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
Read `.project-state/VALIDATION_RESULTS.json`.
|
|
520
|
+
|
|
521
|
+
Collect all `FAIL` items → build repair list.
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
## PHASE 7B — Production Critic (maturity ≥ 3)
|
|
526
|
+
|
|
527
|
+
After verification, run production-critic regardless of constraint-validator result:
|
|
528
|
+
|
|
529
|
+
```bash
|
|
530
|
+
opencode-cli run --attach http://localhost:4100 --agent production-critic \
|
|
531
|
+
"Review all files changed in this session. Check for: god classes, missing interfaces, hardcoded references, missing tests, missing namespaces, missing error handling. Read WORLD_STATE.json for context. Do NOT use the Task tool."
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
Claude reads verdict:
|
|
535
|
+
- `APPROVE` → proceed to Phase 8 (Reflection/Repair for technical issues only)
|
|
536
|
+
- `REJECT` → add all BLOCKER items to repair list with type `architecture`, then run repair-engine before Phase 8
|
|
537
|
+
|
|
538
|
+
Architecture repair via repair-engine:
|
|
539
|
+
```bash
|
|
540
|
+
opencode-cli run --attach http://localhost:4100 --agent repair-engine \
|
|
541
|
+
"Repair architecture failure: <blocker description>. Type: architecture. Read WORLD_STATE.json. Apply fix: extract interface, remove hardcoded reference, add namespace, add error handling. Do NOT use the Task tool."
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
After architecture repairs → re-run production-critic. If still REJECT after 2 iterations → surface to user with diagnosis.
|
|
545
|
+
|
|
546
|
+
**Testing pass (maturity ≥ 4 only):**
|
|
547
|
+
```bash
|
|
548
|
+
opencode-cli run --attach http://localhost:4100 --agent testing-enforcer \
|
|
549
|
+
"Generate tests for all systems implemented in this session. Read SDD from .project-state/DESIGNS/. Target coverage: <from Development Intent>. Do NOT use the Task tool."
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
## PHASE 8 — Reflection / Repair Loop
|
|
555
|
+
|
|
556
|
+
For each item in repair list, dispatch repair-engine. Max **3 repair iterations total**.
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
opencode-cli run --attach http://localhost:4100 --agent repair-engine \
|
|
560
|
+
"Repair this failure: <failure description from VALIDATION_RESULTS>. Failure type: <compile|scene|dependency|performance|gameplay>. Read .project-state/WORLD_STATE.json for full project context. Apply targeted fix only — do not touch unrelated systems. Write result to .project-state/RESULTS/repair-<id>-<timestamp>.md with STATUS: REPAIRED|NEEDS_HUMAN and root cause analysis."
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
After each repair batch → re-run constraint-validator for affected subsystem only:
|
|
564
|
+
```bash
|
|
565
|
+
opencode-cli run --attach http://localhost:4100 --agent constraint-validator \
|
|
566
|
+
"Partial re-validation for subsystem: <subsystem>. Read WORLD_STATE.json. Check only: <category that failed>. Overwrite corresponding category in .project-state/VALIDATION_RESULTS.json."
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
Update world state after repairs:
|
|
570
|
+
```bash
|
|
571
|
+
opencode-cli run --attach http://localhost:4100 --agent world-state-manager \
|
|
572
|
+
"Merge repair results into WORLD_STATE.json. Resolve fixed openIssues. Update TASK_GRAPH nodes for repaired items."
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
If any item reaches 3 repair attempts and STATUS: NEEDS_HUMAN → surface to user:
|
|
576
|
+
```
|
|
577
|
+
REPAIR LIMIT REACHED — <failure>
|
|
578
|
+
Root cause: <from last repair result>
|
|
579
|
+
Suggested action: <from repair-engine>
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## PHASE 9 — State Commit
|
|
585
|
+
|
|
586
|
+
Finalize world state and memory.
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
opencode-cli run --attach http://localhost:4100 --agent world-state-manager \
|
|
590
|
+
"Final state commit. (1) Merge all remaining RESULTS/*.md from this session into WORLD_STATE.json — update all graphs, manifests, and metrics. (2) Set project.lastUpdated to current ISO timestamp. (3) Mark all TASK_GRAPH nodes as COMPLETE. Set TASK_GRAPH status to done. (4) Append session summary to .project-state/MEMORY/episodic.md: date, topic, what was built, what failed, what was repaired, final validation status. (5) If a new reusable workflow was discovered this session, append it to .project-state/MEMORY/procedural.md. (6) If a new system pattern was used, append it to .project-state/MEMORY/semantic.md."
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
Read final WORLD_STATE.json performanceMetrics and VALIDATION_RESULTS.json overall.
|
|
594
|
+
|
|
595
|
+
Print final report:
|
|
596
|
+
```
|
|
597
|
+
╔══════════════════════════════════════════╗
|
|
598
|
+
║ NGUCO Session Complete
|
|
599
|
+
╠══════════════════════════════════════════╣
|
|
600
|
+
Topic: <topic>
|
|
601
|
+
Built: <N nodes PASS>
|
|
602
|
+
Repaired: <N items fixed>
|
|
603
|
+
Warnings: <N open issues>
|
|
604
|
+
Validation: <PASS|WARN|FAIL>
|
|
605
|
+
Draw Calls: <before> → <after>
|
|
606
|
+
Memory: <before>MB → <after>MB
|
|
607
|
+
╚══════════════════════════════════════════╝
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
If any NEEDS_HUMAN items remain → list them with root cause.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
## MCP Unity — Direct Editor Control
|
|
615
|
+
|
|
616
|
+
When `MCP_UNITY=true`, Claude calls these tools **directly** (not via OpenCode agents).
|
|
617
|
+
MCP server: `ai-game-developer` at `http://localhost:27112`.
|
|
618
|
+
|
|
619
|
+
### When to use MCP vs OpenCode
|
|
620
|
+
|
|
621
|
+
| Operation | Use MCP | Use OpenCode |
|
|
622
|
+
|---|---|---|
|
|
623
|
+
| Create/delete/move GameObject | ✅ MCP | — |
|
|
624
|
+
| Add/remove/read component | ✅ MCP | — |
|
|
625
|
+
| Set transform / field values | ✅ MCP | — |
|
|
626
|
+
| Run Editor menu item | ✅ MCP | — |
|
|
627
|
+
| Trigger compile / refresh assets | ✅ MCP | — |
|
|
628
|
+
| Read scene hierarchy | ✅ MCP | — |
|
|
629
|
+
| Write C# script files | — | ✅ coder agent |
|
|
630
|
+
| Complex multi-step scene setup | ✅ MCP tools in sequence | — |
|
|
631
|
+
| Read/write .json/.md state files | — | ✅ world-state-manager |
|
|
632
|
+
|
|
633
|
+
### Key MCP tools (ai-game-developer)
|
|
634
|
+
|
|
635
|
+
**GameObjects**
|
|
636
|
+
- `GameObject_Find` — find by name or path in scene
|
|
637
|
+
- `GameObject_Create` — create new empty or from prefab
|
|
638
|
+
- `GameObject_Destroy` — remove from scene
|
|
639
|
+
- `GameObject_SetActive` — show/hide
|
|
640
|
+
- `GameObject_GetHierarchy` — read full scene hierarchy as JSON
|
|
641
|
+
|
|
642
|
+
**Components**
|
|
643
|
+
- `Component_Add` — add component by type name (e.g. `"Rigidbody"`)
|
|
644
|
+
- `Component_Remove` — remove component
|
|
645
|
+
- `Component_Get` — read all serialized fields of a component
|
|
646
|
+
- `Component_Set` — set serialized field values (supports nested paths)
|
|
647
|
+
|
|
648
|
+
**Transform**
|
|
649
|
+
- `Transform_SetPosition` — world or local position
|
|
650
|
+
- `Transform_SetRotation` — euler or quaternion
|
|
651
|
+
- `Transform_SetScale`
|
|
652
|
+
- `Transform_SetParent` — reparent in hierarchy
|
|
653
|
+
|
|
654
|
+
**Assets & Scene**
|
|
655
|
+
- `AssetDatabase_Refresh` — equivalent of Ctrl+R, picks up new .cs files
|
|
656
|
+
- `Scene_Save` — save open scene
|
|
657
|
+
- `Scene_Open` — open scene by path
|
|
658
|
+
- `EditorApplication_ExecuteMenuItem` — run any menu command (e.g. `"Edit/Play"`, `"Assets/Create/..."`)
|
|
659
|
+
|
|
660
|
+
**Code**
|
|
661
|
+
- `Script_Find` — find script by class name, returns path
|
|
662
|
+
- `Compiler_GetErrors` — read current compile errors without switching to Unity
|
|
663
|
+
|
|
664
|
+
### MCP usage pattern
|
|
665
|
+
|
|
666
|
+
For any task that touches the scene or Editor state:
|
|
667
|
+
1. Use `GameObject_GetHierarchy` to read current state
|
|
668
|
+
2. Make targeted changes with specific tools
|
|
669
|
+
3. Call `AssetDatabase_Refresh` if new scripts were written
|
|
670
|
+
4. Call `Compiler_GetErrors` to verify no compile errors
|
|
671
|
+
5. Call `Scene_Save` at the end
|
|
672
|
+
|
|
673
|
+
**Never write .unity YAML files manually when MCP is connected.**
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
677
|
+
## Core Rules (never violate)
|
|
678
|
+
|
|
679
|
+
1. **Workers execute. Claude reasons.** No worker decides what to build.
|
|
680
|
+
2. **Single source of truth.** Only world-state-manager writes WORLD_STATE.json.
|
|
681
|
+
3. **Simulation before commit.** BLOCKED verdict = hard stop.
|
|
682
|
+
4. **Repair cap.** 3 iterations max per failure. Escalate after.
|
|
683
|
+
5. **Level gate.** Never start next DAG level if previous has unresolved FAIL (unless user approves).
|
|
684
|
+
6. **Memory always updated.** Every session writes to episodic.md and architectureMemory.
|
|
685
|
+
7. **Deterministic execution.** Every action is logged to RESULTS/ for replay.
|
|
686
|
+
8. **One CLI.** All OpenCode work runs through `--attach http://localhost:4100`. Never start a second server. Parallelism = Task subagents, not processes.
|
|
687
|
+
9. **OpenCode for complexity.** `complexity: high` tasks never run inline in Claude. Always dispatched via OpenCode agents.
|
|
688
|
+
10. **Project-agnostic.** No agent, rule, or path may reference a specific project name. All paths are relative to current working directory.
|
|
689
|
+
11. **MCP Unity preferred.** When `MCP_UNITY=true`: use `GameObject_*`, `Component_*`, `Transform_*`, `AssetDatabase_Refresh`, `Compiler_GetErrors`, `Scene_Save` directly. Never write .unity YAML. Never ask OpenCode to do what MCP can do in one call.
|
|
690
|
+
12. **Architecture before implementation.** For maturity ≥ 4: SDD must exist before any coder node runs. No exceptions.
|
|
691
|
+
13. **Interfaces before classes.** interface-generator runs before coder. coder reads interface files, never designs API itself.
|
|
692
|
+
14. **Tests are not optional.** For maturity ≥ 4: testing-enforcer runs after implementation. Session is incomplete without test files.
|
|
693
|
+
15. **Production critic is mandatory.** For maturity ≥ 3: production-critic runs after verification. REJECT verdict blocks State Commit.
|
|
694
|
+
16. **No demo code.** Anti-demo rules are absolute. There are no "quick demo" exceptions. If user explicitly requests prototype maturity, set level ≤ 2 explicitly.
|
|
695
|
+
17. **Depth expansion is non-negotiable.** For maturity ≥ 4: depth-expander runs. "Inventory system" always expands to full subsystem map — never accepted as just a List<Item>.
|
|
696
|
+
|
|
697
|
+
## Token Rules
|
|
698
|
+
|
|
699
|
+
| Action | Who |
|
|
700
|
+
|---|---|
|
|
701
|
+
| Read WORLD_STATE.json | Claude (directly) |
|
|
702
|
+
| Read RESULTS files (RISK: HIGH) | Claude (directly) |
|
|
703
|
+
| Read RESULTS files (RISK: LOW/MED) | Summarized by world-state-manager |
|
|
704
|
+
| Write WORLD_STATE.json | world-state-manager only |
|
|
705
|
+
| Write C# code | coder only |
|
|
706
|
+
| Scene construction | scene-tool only |
|
|
707
|
+
| Constraint checking | constraint-validator only |
|
|
708
|
+
| Simulation | simulation-engine only |
|
|
709
|
+
| Repair | repair-engine only |
|
|
710
|
+
| Read source files | agents only (never Claude directly) |
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
## Unity 6 API Reference (from Research)
|
|
715
|
+
|
|
716
|
+
Key facts from 20-agent research session. Agents must follow these:
|
|
717
|
+
|
|
718
|
+
**NavMesh:** `NavMeshSurface.BuildNavMesh()` (sync) or `UpdateNavMesh(data)` (async). Package `com.unity.ai.navigation` v2.0.12. Bake window deprecated. `NavMeshLink` replaces `OffMeshLink`.
|
|
719
|
+
|
|
720
|
+
**Scene creation:** `ObjectFactory.CreateGameObject(name)` — Undo-aware. `EditorApplication.SaveScene` REMOVED → use `EditorSceneManager.SaveScene()`. YAML editing is fragile — use MCP or Editor scripting.
|
|
721
|
+
|
|
722
|
+
**Build pipeline:** `BuildPipeline.BuildPlayer(options)` or new `BuildPlayerWithProfileOptions` (Unity 6 Build Profiles). `-build` CLI flag (no `-executeMethod` needed). Platform switching does NOT work in batch mode — pass `-buildTarget` as CLI arg.
|
|
723
|
+
|
|
724
|
+
**Shader Graph:** No public C# API. Unity 6.5+: `UNITY_EXPORT_REFLECTION` in HLSL = auto-register as node. Do not use `GraphData` reflection.
|
|
725
|
+
|
|
726
|
+
**DOTS ECS:** `ISystem` + `IJobEntity` + `SystemAPI.Query`. `IAspect` deprecated. `Entities.ForEach` deprecated. Default to MonoBehaviour — use DOTS only for >1000 entities.
|
|
727
|
+
|
|
728
|
+
**Addressables 2.x:** `LoadAssetAsync<T>()`, `LoadAssetsAsync<T>()`. Reference counting: every `Load` must have matching `Release`. `AddressableAssetSettings.BuildPlayerContent()` before build.
|
|
729
|
+
|
|
730
|
+
**GPU Resident Drawer (Unity 6):** Forward+/Deferred+ required. ~99% draw call reduction. ~100MB memory overhead. Automatic for compatible objects.
|
|
731
|
+
|
|
732
|
+
**OpenCode Task safety:** No built-in depth guard. Always add `"Do NOT use the Task tool"` to subagent prompts. Only unity-orchestrator may use Task tool.
|
|
733
|
+
|