Before calling any skill in this module: if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via GET /skills/recommend?includeSchema=true) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.
Triggers
- Gathering context before editing
- Understanding unfamiliar scene/project
- Auditing structure without changes
- 编辑前收集上下文、理解陌生场景或项目、在不改动的前提下审查结构
Unity Perception Skills
Use this module for read-only scene and project analysis.
Operating Mode
- Approval / Auto / Bypass: 本模块 18 个 skill 里有 17 个标
Mode = SkillMode.SemiAuto,三档模式下直接执行无需 grant。其中 16 个是纯读(ReadOnly = true):scene_analyze / scene_summarize / scene_health_check / scene_component_stats / scene_find_hotspots / scene_tag_layer_stats / scene_performance_hints / scene_diff / hierarchy_describe / scene_context / scene_spatial_query / scene_materials / scene_contract_validate / project_stack_detect / script_analyze / script_dependency_graph。
scene_dependency_analyze 是第 17 个 SemiAuto,但它不是纯读:传 savePath 会 Directory.CreateDirectory + File.WriteAllText + ImportAsset 落一个新工程资产,所以它标 MutatesAssets = true 而不再标 ReadOnly。仍然无需 grant,但它会进 router 的 diff 捕获,schema/flags 里也会带 mutatesAssets —— 不传 savePath 时才真的什么都不写。
- 特别说明:
scene_export_report 写 markdown 文件到磁盘(Operation = Analyze | Execute,标 MutatesAssets = true),因此不是 SemiAuto——它走默认 SkillMode.FullAuto,Approval 模式下需要 grant 才能执行。
- 本模块不含 Delete / PlayMode / Reload / RiskLevel=high 类 skill —— 没有
IsForbiddenInSemi 拦截。
DO NOT (common hallucinations):
perception_analyze, perception_scan, and perception_describe do not exist
scene_context is not editor_get_context: it exports hierarchy/components/references, while editor context focuses on current editor state
scene_analyze, scene_health_check, scene_contract_validate, scene_component_stats, scene_find_hotspots, and project_stack_detect belong to this module even if the prefix looks like scene_* or project_*
Routing:
- Current selection/play-mode/editor state ->
editor_get_context
- Object search by name/path ->
scene_find_objects or gameobject_find
- Script dependency closure ->
script_dependency_graph
Skills
Scene Health and Summary
| Skill |
Use |
Key parameters |
scene_analyze |
Combined scene + project analysis |
topComponentsLimit?, issueLimit?, deepHierarchyThreshold?, largeChildCountThreshold? |
scene_health_check |
Read-only health report |
issueLimit?, deepHierarchyThreshold?, largeChildCountThreshold? |
scene_summarize |
Structured scene summary |
includeComponentStats?, topComponentsLimit? |
scene_component_stats |
Component and facility stats |
topComponentsLimit? |
scene_find_hotspots |
Deep hierarchy / large group / empty node hotspots |
thresholds + maxResults? |
scene_tag_layer_stats |
Tag/layer usage |
none |
scene_performance_hints |
Prioritized optimization hints |
none |
Scene Snapshots and Exports
| Skill |
Use |
Key parameters |
scene_diff |
Capture or compare lightweight snapshots |
snapshotJson? |
hierarchy_describe |
Return text hierarchy tree |
maxDepth?, includeInactive?, maxItemsPerLevel? |
scene_context |
Export hierarchy, components, references |
maxDepth?, maxObjects?, rootPath?, includeValues?, includeReferences?, includeCodeDeps? |
scene_export_report |
Save markdown scene report |
savePath?, maxDepth?, maxObjects? |
scene_dependency_analyze |
Analyze impact / dependency graph in-scene |
targetPath?, savePath? — writes |
savePath on scene_dependency_analyze is a write, not an output option. Supplying it creates the directory, writes the markdown report and imports it as a project asset, which is why the skill is flagged mutatesAssets rather than ReadOnly. Omit savePath and you get the same analysis in the response (analysis, markdown) with nothing touched on disk — that is the form to use for a pure "what depends on this" question. Only pass savePath when the user actually asked for a file, and expect savedTo in the response naming it.
Project and Script Analysis
| Skill |
Use |
Key parameters |
project_stack_detect |
Detect pipeline, input, UI, packages, tests, folders |
none |
script_analyze |
Analyze one MonoBehaviour / ScriptableObject / user class by class name |
scriptName, includePrivate? |
script_dependency_graph |
N-hop dependency closure for one script class name |
scriptName, maxHops?, includeDetails? |
Spatial and Material Queries
| Skill |
Use |
Key parameters |
scene_spatial_query |
Find objects near a point or object |
x/y/z?, radius?, nearObject?, componentFilter?, maxResults? |
scene_materials |
Summarize scene materials and shaders |
includeProperties? |
scene_contract_validate |
Validate default roots/tags/layers/UI EventSystem conventions |
requiredRootsJson?, requiredTagsJson?, requiredLayersJson?, requireEventSystemForUi? |
High-Frequency Skill Differences
scene_summarize vs scene_analyze vs scene_health_check
| Skill |
Best for |
Typical output focus |
scene_summarize |
Fast overview |
object counts, hierarchy depth, top components |
scene_analyze |
Broad diagnosis |
summary + findings + warnings + recommendations + next-skill hints |
scene_health_check |
Hygiene / red flags |
missing scripts, duplicate names, deep hierarchy, empty nodes, hotspot-style findings |
scene_context vs hierarchy_describe
| Skill |
Best for |
Output style |
hierarchy_describe |
Human-readable tree |
text tree, lightweight |
scene_context |
AI coding context |
structured hierarchy + components + references + optional code dependencies |
scene_dependency_analyze vs script_dependency_graph
| Skill |
Scope |
Use when |
scene_dependency_analyze |
Scene object references |
ask "who depends on this object if I delete or disable it" |
script_dependency_graph |
Script class dependency closure |
ask "which scripts do I have to touch to change this feature" |
Key Return Shapes
scene_summarize
Returns sceneName, stats, and optional topComponents.
scene_analyze
Returns summary, stats, findings, warnings, recommendations, and suggestedNextSkills.
scene_health_check
Returns summary, findings, hotspots, and suggestedNextSkills.
scene_context
Returns a structured export with objects, references, and optional codeDependencies. Use it when another AI step needs full scene context, not just a human summary.
High-frequency options:
rootPath to export only one subtree
includeValues=true when serialized field values matter
includeCodeDeps=true when AI needs a rough scene-to-code dependency picture
scene_export_report
Writes a markdown artifact to disk and returns savedTo, object/script/reference counts, and success state. Prefer this when the user wants a durable report file.
Defaults:
savePath = "Assets/Docs/SceneReport.md"
maxDepth = 10
maxObjects = 500
When to Use Which Skill
| Need |
Best first skill |
| Quick scene overview |
scene_summarize |
| Full diagnosis |
scene_analyze |
| Suspicious hierarchy or clutter |
scene_find_hotspots |
| Safe-to-delete / impact question |
scene_dependency_analyze |
| AI coding context export |
scene_context |
| Script reading order |
script_dependency_graph |
| Render/input/UI stack detection |
project_stack_detect |
Minimal Example
import unity_skills
summary = unity_skills.call_skill("scene_summarize", includeComponentStats=True)
health = unity_skills.call_skill("scene_health_check", issueLimit=50)
context = unity_skills.call_skill("scene_context", maxDepth=6, maxObjects=120)
report = unity_skills.call_skill("scene_export_report", savePath="Assets/Docs/SceneReport.md")
Exact Signatures
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
1---2name: unity-perception3description: Read-only scene, project and script analysis for AI context4---5
6> **Before calling any skill in this module:** if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via `GET /skills/recommend?includeSchema=true`) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.
7
8## Triggers
9- Gathering context before editing
10- Understanding unfamiliar scene/project
11- Auditing structure without changes
12- 编辑前收集上下文、理解陌生场景或项目、在不改动的前提下审查结构
13
14# Unity Perception Skills
15
16Use this module for read-only scene and project analysis.
17
18## Operating Mode
19
20- **Approval / Auto / Bypass**: 本模块 18 个 skill 里有 17 个标 `Mode = SkillMode.SemiAuto`,三档模式下直接执行无需 grant。其中 16 个是**纯读**(`ReadOnly = true`):`scene_analyze` / `scene_summarize` / `scene_health_check` / `scene_component_stats` / `scene_find_hotspots` / `scene_tag_layer_stats` / `scene_performance_hints` / `scene_diff` / `hierarchy_describe` / `scene_context` / `scene_spatial_query` / `scene_materials` / `scene_contract_validate` / `project_stack_detect` / `script_analyze` / `script_dependency_graph`。
21- **`scene_dependency_analyze` 是第 17 个 SemiAuto,但它不是纯读**:传 `savePath` 会 `Directory.CreateDirectory` + `File.WriteAllText` + `ImportAsset` 落一个新工程资产,所以它标 `MutatesAssets = true` 而**不再**标 `ReadOnly`。仍然无需 grant,但它会进 router 的 diff 捕获,schema/flags 里也会带 `mutatesAssets` —— 不传 `savePath` 时才真的什么都不写。
22- **特别说明**:`scene_export_report` 写 markdown 文件到磁盘(`Operation = Analyze | Execute`,标 `MutatesAssets = true`),因此**不是** SemiAuto——它走默认 `SkillMode.FullAuto`,Approval 模式下需要 grant 才能执行。
23- **本模块不含 Delete / PlayMode / Reload / RiskLevel=high 类 skill** —— 没有 `IsForbiddenInSemi` 拦截。
24
25**DO NOT** (common hallucinations):
26- `perception_analyze`, `perception_scan`, and `perception_describe` do not exist
27- `scene_context` is not `editor_get_context`: it exports hierarchy/components/references, while editor context focuses on current editor state
28- `scene_analyze`, `scene_health_check`, `scene_contract_validate`, `scene_component_stats`, `scene_find_hotspots`, and `project_stack_detect` belong to this module even if the prefix looks like `scene_*` or `project_*`
29
30**Routing**:
31- Current selection/play-mode/editor state -> `editor_get_context`
32- Object search by name/path -> `scene_find_objects` or `gameobject_find`
33- Script dependency closure -> `script_dependency_graph`
34
35## Skills
36
37### Scene Health and Summary
38
39| Skill | Use | Key parameters |
40|-------|-----|----------------|
41| `scene_analyze` | Combined scene + project analysis | `topComponentsLimit?`, `issueLimit?`, `deepHierarchyThreshold?`, `largeChildCountThreshold?` |
42| `scene_health_check` | Read-only health report | `issueLimit?`, `deepHierarchyThreshold?`, `largeChildCountThreshold?` |
43| `scene_summarize` | Structured scene summary | `includeComponentStats?`, `topComponentsLimit?` |
44| `scene_component_stats` | Component and facility stats | `topComponentsLimit?` |
45| `scene_find_hotspots` | Deep hierarchy / large group / empty node hotspots | thresholds + `maxResults?` |
46| `scene_tag_layer_stats` | Tag/layer usage | none |
47| `scene_performance_hints` | Prioritized optimization hints | none |
48
49### Scene Snapshots and Exports
50
51| Skill | Use | Key parameters |
52|-------|-----|----------------|
53| `scene_diff` | Capture or compare lightweight snapshots | `snapshotJson?` |
54| `hierarchy_describe` | Return text hierarchy tree | `maxDepth?`, `includeInactive?`, `maxItemsPerLevel?` |
55| `scene_context` | Export hierarchy, components, references | `maxDepth?`, `maxObjects?`, `rootPath?`, `includeValues?`, `includeReferences?`, `includeCodeDeps?` |
56| `scene_export_report` | Save markdown scene report | `savePath?`, `maxDepth?`, `maxObjects?` |
57| `scene_dependency_analyze` | Analyze impact / dependency graph in-scene | `targetPath?`, **`savePath?` — writes** |
58
59> **`savePath` on `scene_dependency_analyze` is a write, not an output option.** Supplying it creates the directory, writes the markdown report and imports it as a project asset, which is why the skill is flagged `mutatesAssets` rather than `ReadOnly`. Omit `savePath` and you get the same analysis in the response (`analysis`, `markdown`) with nothing touched on disk — that is the form to use for a pure "what depends on this" question. Only pass `savePath` when the user actually asked for a file, and expect `savedTo` in the response naming it.
60
61### Project and Script Analysis
62
63| Skill | Use | Key parameters |
64|-------|-----|----------------|
65| `project_stack_detect` | Detect pipeline, input, UI, packages, tests, folders | none |
66| `script_analyze` | Analyze one MonoBehaviour / ScriptableObject / user class by class name | `scriptName`, `includePrivate?` |
67| `script_dependency_graph` | N-hop dependency closure for one script class name | `scriptName`, `maxHops?`, `includeDetails?` |
68
69### Spatial and Material Queries
70
71| Skill | Use | Key parameters |
72|-------|-----|----------------|
73| `scene_spatial_query` | Find objects near a point or object | `x/y/z?`, `radius?`, `nearObject?`, `componentFilter?`, `maxResults?` |
74| `scene_materials` | Summarize scene materials and shaders | `includeProperties?` |
75| `scene_contract_validate` | Validate default roots/tags/layers/UI EventSystem conventions | `requiredRootsJson?`, `requiredTagsJson?`, `requiredLayersJson?`, `requireEventSystemForUi?` |
76
77## High-Frequency Skill Differences
78
79### `scene_summarize` vs `scene_analyze` vs `scene_health_check`
80
81| Skill | Best for | Typical output focus |
82|-------|----------|----------------------|
83| `scene_summarize` | Fast overview | object counts, hierarchy depth, top components |
84| `scene_analyze` | Broad diagnosis | summary + findings + warnings + recommendations + next-skill hints |
85| `scene_health_check` | Hygiene / red flags | missing scripts, duplicate names, deep hierarchy, empty nodes, hotspot-style findings |
86
87### `scene_context` vs `hierarchy_describe`
88
89| Skill | Best for | Output style |
90|-------|----------|-------------|
91| `hierarchy_describe` | Human-readable tree | text tree, lightweight |
92| `scene_context` | AI coding context | structured hierarchy + components + references + optional code dependencies |
93
94### `scene_dependency_analyze` vs `script_dependency_graph`
95
96| Skill | Scope | Use when |
97|-------|-------|----------|
98| `scene_dependency_analyze` | Scene object references | ask "who depends on this object if I delete or disable it" |
99| `script_dependency_graph` | Script class dependency closure | ask "which scripts do I have to touch to change this feature" |
100
101## Key Return Shapes
102
103### `scene_summarize`
104
105Returns `sceneName`, `stats`, and optional `topComponents`.
106
107### `scene_analyze`
108
109Returns `summary`, `stats`, `findings`, `warnings`, `recommendations`, and `suggestedNextSkills`.
110
111### `scene_health_check`
112
113Returns `summary`, `findings`, `hotspots`, and `suggestedNextSkills`.
114
115### `scene_context`
116
117Returns a structured export with `objects`, `references`, and optional `codeDependencies`. Use it when another AI step needs full scene context, not just a human summary.
118
119High-frequency options:
120- `rootPath` to export only one subtree
121- `includeValues=true` when serialized field values matter
122- `includeCodeDeps=true` when AI needs a rough scene-to-code dependency picture
123
124### `scene_export_report`
125
126Writes a markdown artifact to disk and returns `savedTo`, object/script/reference counts, and success state. Prefer this when the user wants a durable report file.
127
128Defaults:
129- `savePath = "Assets/Docs/SceneReport.md"`
130- `maxDepth = 10`
131- `maxObjects = 500`
132
133## When to Use Which Skill
134
135| Need | Best first skill |
136|------|------------------|
137| Quick scene overview | `scene_summarize` |
138| Full diagnosis | `scene_analyze` |
139| Suspicious hierarchy or clutter | `scene_find_hotspots` |
140| Safe-to-delete / impact question | `scene_dependency_analyze` |
141| AI coding context export | `scene_context` |
142| Script reading order | `script_dependency_graph` |
143| Render/input/UI stack detection | `project_stack_detect` |
144
145## Minimal Example
146
147```python
148import unity_skills
149
150summary = unity_skills.call_skill("scene_summarize", includeComponentStats=True)
151health = unity_skills.call_skill("scene_health_check", issueLimit=50)
152context = unity_skills.call_skill("scene_context", maxDepth=6, maxObjects=120)
153report = unity_skills.call_skill("scene_export_report", savePath="Assets/Docs/SceneReport.md")
154```
155
156## Exact Signatures
157
158Exact names, parameters, defaults, and returns are defined by `GET /skills/schema` or `unity_skills.get_skill_schema()`, not by this file.