@veewo/gitnexus 1.5.0 → 1.5.1

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 (137) hide show
  1. package/dist/benchmark/agent-context/runner.js +3 -0
  2. package/dist/benchmark/agent-context/runner.test.js +22 -0
  3. package/dist/benchmark/agent-context/tool-runner.d.ts +7 -6
  4. package/dist/benchmark/agent-safe-query-context/io.d.ts +2 -0
  5. package/dist/benchmark/agent-safe-query-context/io.js +86 -0
  6. package/dist/benchmark/agent-safe-query-context/io.test.d.ts +1 -0
  7. package/dist/benchmark/agent-safe-query-context/io.test.js +13 -0
  8. package/dist/benchmark/agent-safe-query-context/report.d.ts +57 -0
  9. package/dist/benchmark/agent-safe-query-context/report.js +159 -0
  10. package/dist/benchmark/agent-safe-query-context/report.test.d.ts +1 -0
  11. package/dist/benchmark/agent-safe-query-context/report.test.js +362 -0
  12. package/dist/benchmark/agent-safe-query-context/runner.d.ts +44 -0
  13. package/dist/benchmark/agent-safe-query-context/runner.js +406 -0
  14. package/dist/benchmark/agent-safe-query-context/runner.test.d.ts +1 -0
  15. package/dist/benchmark/agent-safe-query-context/runner.test.js +290 -0
  16. package/dist/benchmark/agent-safe-query-context/semantic-tuple.d.ts +20 -0
  17. package/dist/benchmark/agent-safe-query-context/semantic-tuple.js +225 -0
  18. package/dist/benchmark/agent-safe-query-context/semantic-tuple.test.d.ts +1 -0
  19. package/dist/benchmark/agent-safe-query-context/semantic-tuple.test.js +122 -0
  20. package/dist/benchmark/agent-safe-query-context/subagent-live.d.ts +47 -0
  21. package/dist/benchmark/agent-safe-query-context/subagent-live.js +128 -0
  22. package/dist/benchmark/agent-safe-query-context/subagent-live.test.d.ts +1 -0
  23. package/dist/benchmark/agent-safe-query-context/subagent-live.test.js +155 -0
  24. package/dist/benchmark/agent-safe-query-context/telemetry-tool.d.ts +9 -0
  25. package/dist/benchmark/agent-safe-query-context/telemetry-tool.js +77 -0
  26. package/dist/benchmark/agent-safe-query-context/types.d.ts +61 -0
  27. package/dist/benchmark/agent-safe-query-context/types.js +8 -0
  28. package/dist/benchmark/runtime-poc/provenance-artifact.d.ts +47 -0
  29. package/dist/benchmark/runtime-poc/provenance-artifact.js +89 -0
  30. package/dist/benchmark/runtime-poc/runner.d.ts +31 -0
  31. package/dist/benchmark/runtime-poc/runner.js +163 -0
  32. package/dist/benchmark/u2-e2e/hydration-policy-repeatability-runner.d.ts +8 -0
  33. package/dist/benchmark/u2-e2e/hydration-policy-repeatability-runner.js +21 -0
  34. package/dist/benchmark/u2-e2e/phase2-runtime-claim-acceptance-runner.d.ts +0 -1
  35. package/dist/benchmark/u2-e2e/phase2-runtime-claim-acceptance-runner.js +53 -51
  36. package/dist/benchmark/u2-e2e/phase2-runtime-claim-acceptance-runner.test.js +0 -1
  37. package/dist/benchmark/u2-e2e/phase5-rule-lab-acceptance-runner.d.ts +1 -1
  38. package/dist/benchmark/u2-e2e/phase5-rule-lab-acceptance-runner.js +82 -18
  39. package/dist/benchmark/u2-e2e/phase5-rule-lab-acceptance-runner.test.js +1 -2
  40. package/dist/benchmark/u2-e2e/retrieval-runner.js +15 -7
  41. package/dist/benchmark/u2-e2e/retrieval-runner.test.js +46 -0
  42. package/dist/cli/ai-context.js +2 -12
  43. package/dist/cli/ai-context.test.js +8 -0
  44. package/dist/cli/analyze-runtime-summary.js +1 -0
  45. package/dist/cli/analyze-runtime-summary.test.js +2 -0
  46. package/dist/cli/analyze-summary.d.ts +2 -0
  47. package/dist/cli/analyze-summary.js +24 -0
  48. package/dist/cli/analyze-summary.test.js +65 -1
  49. package/dist/cli/analyze.js +5 -1
  50. package/dist/cli/benchmark-agent-safe-query-context.d.ts +20 -0
  51. package/dist/cli/benchmark-agent-safe-query-context.js +39 -0
  52. package/dist/cli/benchmark-agent-safe-query-context.test.d.ts +1 -0
  53. package/dist/cli/benchmark-agent-safe-query-context.test.js +271 -0
  54. package/dist/cli/benchmark.d.ts +29 -0
  55. package/dist/cli/benchmark.js +55 -0
  56. package/dist/cli/index.js +23 -0
  57. package/dist/cli/rule-lab.d.ts +3 -7
  58. package/dist/cli/rule-lab.js +13 -22
  59. package/dist/cli/rule-lab.test.js +23 -3
  60. package/dist/cli/tool.d.ts +2 -0
  61. package/dist/cli/tool.js +2 -0
  62. package/dist/core/config/unity-config.d.ts +0 -1
  63. package/dist/core/config/unity-config.js +0 -1
  64. package/dist/core/ingestion/pipeline.js +35 -6
  65. package/dist/core/ingestion/unity-lifecycle-synthetic-calls.test.js +18 -20
  66. package/dist/core/ingestion/unity-parity-seed.d.ts +2 -1
  67. package/dist/core/ingestion/unity-parity-seed.js +8 -0
  68. package/dist/core/ingestion/unity-resource-processor.d.ts +11 -0
  69. package/dist/core/ingestion/unity-resource-processor.js +102 -0
  70. package/dist/core/ingestion/unity-resource-processor.test.js +449 -0
  71. package/dist/core/ingestion/unity-runtime-binding-rules.d.ts +15 -0
  72. package/dist/core/ingestion/unity-runtime-binding-rules.js +178 -30
  73. package/dist/core/lbug/csv-generator.test.js +2 -2
  74. package/dist/core/unity/doc-contract.test.d.ts +1 -0
  75. package/dist/core/unity/doc-contract.test.js +30 -0
  76. package/dist/core/unity/prefab-source-scan.d.ts +25 -0
  77. package/dist/core/unity/prefab-source-scan.js +152 -0
  78. package/dist/core/unity/prefab-source-scan.test.d.ts +1 -0
  79. package/dist/core/unity/prefab-source-scan.test.js +70 -0
  80. package/dist/core/unity/scan-context.d.ts +12 -0
  81. package/dist/core/unity/scan-context.js +50 -2
  82. package/dist/core/unity/scan-context.test.js +74 -0
  83. package/dist/mcp/local/agent-safe-response.d.ts +10 -0
  84. package/dist/mcp/local/agent-safe-response.js +639 -0
  85. package/dist/mcp/local/derived-process-reader.js +1 -1
  86. package/dist/mcp/local/local-backend.d.ts +18 -1
  87. package/dist/mcp/local/local-backend.js +319 -125
  88. package/dist/mcp/local/process-confidence.d.ts +1 -2
  89. package/dist/mcp/local/process-confidence.js +0 -3
  90. package/dist/mcp/local/process-confidence.test.js +4 -2
  91. package/dist/mcp/local/process-evidence.d.ts +1 -8
  92. package/dist/mcp/local/process-evidence.js +1 -23
  93. package/dist/mcp/local/process-evidence.test.js +2 -16
  94. package/dist/mcp/local/process-ref.d.ts +1 -1
  95. package/dist/mcp/local/runtime-chain-closure-evaluator.d.ts +33 -0
  96. package/dist/mcp/local/runtime-chain-closure-evaluator.js +273 -0
  97. package/dist/mcp/local/runtime-chain-graph-candidates.d.ts +23 -0
  98. package/dist/mcp/local/runtime-chain-graph-candidates.js +131 -0
  99. package/dist/mcp/local/runtime-chain-verify.d.ts +1 -1
  100. package/dist/mcp/local/runtime-chain-verify.js +149 -138
  101. package/dist/mcp/local/runtime-chain-verify.test.js +126 -68
  102. package/dist/mcp/local/runtime-claim-rule-registry.d.ts +4 -0
  103. package/dist/mcp/local/runtime-claim-rule-registry.js +4 -0
  104. package/dist/mcp/local/runtime-claim-rule-registry.test.js +37 -4
  105. package/dist/mcp/local/runtime-claim.d.ts +11 -0
  106. package/dist/mcp/local/runtime-claim.js +28 -0
  107. package/dist/mcp/local/unity-evidence-view.d.ts +1 -1
  108. package/dist/mcp/local/unity-evidence-view.js +1 -1
  109. package/dist/mcp/local/unity-evidence-view.test.js +22 -0
  110. package/dist/mcp/tools.js +51 -21
  111. package/dist/rule-lab/analyze.d.ts +2 -1
  112. package/dist/rule-lab/analyze.js +94 -59
  113. package/dist/rule-lab/analyze.test.js +238 -20
  114. package/dist/rule-lab/curate.d.ts +2 -1
  115. package/dist/rule-lab/curate.js +24 -3
  116. package/dist/rule-lab/curate.test.js +65 -0
  117. package/dist/rule-lab/curation-input-builder.d.ts +45 -0
  118. package/dist/rule-lab/curation-input-builder.js +133 -0
  119. package/dist/rule-lab/promote.js +80 -7
  120. package/dist/rule-lab/promote.test.js +150 -0
  121. package/dist/rule-lab/review-pack.d.ts +3 -0
  122. package/dist/rule-lab/review-pack.js +41 -1
  123. package/dist/rule-lab/review-pack.test.js +67 -0
  124. package/dist/rule-lab/types.d.ts +29 -0
  125. package/dist/types/pipeline.d.ts +3 -0
  126. package/package.json +3 -2
  127. package/scripts/run-node-tests.mjs +61 -0
  128. package/skills/_shared/unity-rule-authoring-contract.md +64 -0
  129. package/skills/_shared/unity-runtime-process-contract.md +16 -0
  130. package/skills/gitnexus-cli.md +8 -0
  131. package/skills/gitnexus-debugging.md +9 -0
  132. package/skills/gitnexus-exploring.md +66 -18
  133. package/skills/gitnexus-guide.md +42 -3
  134. package/skills/gitnexus-impact-analysis.md +8 -0
  135. package/skills/gitnexus-pr-review.md +8 -0
  136. package/skills/gitnexus-refactoring.md +8 -0
  137. package/skills/gitnexus-unity-rule-gen.md +66 -312
@@ -0,0 +1,64 @@
1
+ # Unity Rule Authoring Contract
2
+
3
+ ## Scope
4
+
5
+ This contract defines the stable public authoring workflow for
6
+ `gitnexus-unity-rule-gen`.
7
+
8
+ The only public path is direct rule authoring and validation:
9
+
10
+ `approved/*.yaml -> rule-lab compile -> analyze -> CLI validation`
11
+
12
+ ## Workflow Position
13
+
14
+ 1. `gap-lab` is historical context only and not part of the active workflow.
15
+ 2. Default authoring path is reduced `rule-lab` for sparse irregular gaps.
16
+ 3. Query-time runtime closure remains graph-only.
17
+
18
+ ## Input Schema
19
+
20
+ Each authoring item must be an exact source/target pair (or explicit pair set):
21
+
22
+ - `source_class`
23
+ - `source_method`
24
+ - `target_class`
25
+ - `target_method`
26
+ - `expected_missing_hop` (short text)
27
+
28
+ If multiple anchors match, user must select the intended anchor explicitly.
29
+ Auto-guessing ambiguous anchors is forbidden.
30
+
31
+ ## Mandatory Guards
32
+
33
+ 1. Duplicate-prevention:
34
+ - Block proposals already covered by `.gitnexus/rules/approved/*.yaml`.
35
+ 2. Fail-closed binding resolution:
36
+ - Unresolved bindings block progress.
37
+ - `UnknownClass` / `UnknownMethod` placeholders are forbidden.
38
+ 3. Non-empty evidence before promote:
39
+ - `confirmed_chain.steps` (or equivalent) must be non-empty.
40
+
41
+ ## Artifact Expectations
42
+
43
+ Primary artifacts are under `.gitnexus/rules/lab/runs/<run_id>/...`.
44
+
45
+ Run/slice identifiers are internal artifact locators. Public operator guidance must
46
+ not require run orchestration as the primary flow.
47
+
48
+ ## Event/Delegate Boundary
49
+
50
+ Event/delegate system-wide coverage is analyzer-native scope:
51
+
52
+ - capture `assignment_expression` (`+=`, `-=`)
53
+ - index delegate/action field symbols
54
+ - capture generic event-type metadata (`Raise<T>` / `Listen<T>`)
55
+
56
+ Rule authoring is only for sparse, explicitly scoped residual gaps.
57
+
58
+ ## Verification Contract
59
+
60
+ 1. Promote only after mandatory guards pass.
61
+ 2. Compile approved rules before analyze.
62
+ 3. Verify in a fresh CLI process (`gitnexus cypher` / `gitnexus query`).
63
+ 4. Under `hydration_policy=strict` with `fallbackToCompact=true`, parity rerun
64
+ is required before final closure conclusion.
@@ -13,11 +13,16 @@ Load this contract when any of the following is true:
13
13
 
14
14
  ## Required Workflow
15
15
 
16
+ Use this order: `discovery -> seed narrowing -> closure verification`.
17
+
16
18
  1. Run `query/context` with `unity_resources: "on"` and `unity_hydration_mode: "compact"` first.
19
+ - For `response_profile=slim`, read semantic tiers in order: `facts -> closure -> clues`.
20
+ - In strict-anchor mode, never let `clues` become the first-screen default when `facts` has high/medium leads.
17
21
  2. If `hydrationMeta.needsParityRetry === true`, rerun with `unity_hydration_mode: "parity"` before conclusions.
18
22
  3. Do not conclude "no runtime chain" from empty `processes` alone.
19
23
  4. If Unity evidence exists, continue stitching:
20
24
  - `processes`
25
+ - `resource_chains` for graph-backed `UNITY_ASSET_GUID_REF -> UNITY_GRAPH_NODE_SCRIPT_REF` bridges
21
26
  - `resourceBindings`
22
27
  - asset/meta mapping anchors
23
28
  - runtime candidate symbols
@@ -26,6 +31,8 @@ Load this contract when any of the following is true:
26
31
  - `target`
27
32
  - `next_command`
28
33
  6. Semantic closure requires hop anchors/evidence anchors for each stitched step.
34
+ 7. Treat `clues` as narrowing evidence (`clue`) and never as standalone closure proof.
35
+ 8. Strong graph hops can coexist with failed closure; report as partial bridge evidence until verifier-core reaches `verified_full`.
29
36
 
30
37
  ## Optional Strong Verification
31
38
 
@@ -33,6 +40,15 @@ For Reload-focused confirmation, request on-demand verification:
33
40
 
34
41
  - pass `runtime_chain_verify: "on-demand"` in MCP tools, or
35
42
  - use CLI `--runtime-chain-verify on-demand`.
43
+ - `queryText` is not a verifier matching signal in graph-only mode; use structured anchors/resource evidence for closure.
36
44
 
37
45
  When on-demand verification is used, report `runtime_chain.status`, `evidence_level`, `hops`, and `gaps` before final risk/closure statements.
38
46
 
47
+
48
+ ## Runtime-Chain Closure Guard
49
+
50
+ - Treat runtime-chain outputs as two layers:
51
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
52
+ - `policy-adjusted`: user-visible result after hydration policy is applied
53
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
54
+ - In that downgraded state, rerun with parity before final conclusions.
@@ -189,3 +189,11 @@ $GN unity-ui-trace "Assets/NEON/VeewoUI/Uxml/BarScreen/Patch/PatchItemPreview.ux
189
189
  - **"Not inside a git repository"**: Run from a directory inside a git repo
190
190
  - **Index is stale after re-analyzing**: Restart Claude Code to reload the MCP server
191
191
  - **Embeddings slow**: Omit `--embeddings` (it's off by default) or set `OPENAI_API_KEY` for faster API-based embedding
192
+
193
+ ## Runtime-Chain Closure Guard
194
+
195
+ - Treat runtime-chain outputs as two layers:
196
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
197
+ - `policy-adjusted`: user-visible result after hydration policy is applied
198
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
199
+ - In that downgraded state, rerun with parity before final conclusions.
@@ -107,3 +107,12 @@ RETURN [n IN nodes(path) | n.name] AS chain
107
107
 
108
108
  4. Root cause: fetchRates calls external API without proper timeout
109
109
  ```
110
+
111
+ ## Runtime-Chain Closure Guard
112
+
113
+ - Query-time runtime closure is **graph-only** and does not require `verification_rules` / `trigger_tokens` matching.
114
+ - Treat runtime-chain outputs as two layers:
115
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
116
+ - `policy-adjusted`: user-visible result after hydration policy is applied
117
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
118
+ - In that downgraded state, rerun with parity before final conclusions.
@@ -16,30 +16,45 @@ description: "Use when the user asks how code works, wants to understand archite
16
16
  ## Workflow
17
17
 
18
18
  ```
19
- 1. READ gitnexus://repos → Discover indexed repos
20
- 2. READ gitnexus://repo/{name}/context → Codebase overview, check staleness
21
- 3. gitnexus_query({query: "<what you want to understand>"}) → Find related execution flows
22
- 4. gitnexus_context({name: "<symbol>"}) → Deep dive on specific symbol
23
- 5. (Unity symbols) rerun context/query with unity params when needed
24
- 6. READ gitnexus://repo/{name}/process/{name} → Trace full execution flow
19
+ 1. (Repo unknown / multi-repo only) READ gitnexus://repos → Discover indexed repos
20
+ 2. READ gitnexus://repo/{name}/context → Codebase overview, check staleness
21
+ 3. gitnexus_query({query: "<what you want to understand>"}) → Find related execution flows
22
+ 4. Narrow with slim hints first → `decision.recommended_follow_up`, `missing_proof_targets`, `suggested_context_targets`
23
+ 5. gitnexus_context({name|uid: "<symbol>"}) Deep dive on specific symbol
24
+ 6. (Unity symbols) rerun context/query with unity params when needed
25
+ 7. READ gitnexus://repo/{name}/process/{name} or use cypher → Trace full execution flow or prove a structure
25
26
  ```
26
27
 
27
- > If step 2 says "Index is stale" → run `gitnexus analyze` when local CLI exists; otherwise resolve the pinned npx package spec from `~/.gitnexus/config.json` and run `npx -y <resolved-cli-spec> analyze`.
28
+ Runtime retrieval mnemonic: `discovery -> seed narrowing -> closure verification`.
29
+
30
+ Unity runtime retrieval rule of thumb:
31
+
32
+ - natural-language `query` is discovery-only;
33
+ - do not treat it as the primary retrieval anchor;
34
+ - once you have a symbol or resource seed, switch to `uid` / `resource_path_prefix` narrowing immediately.
35
+
36
+ > If step 2 says "Index is stale" → run `gitnexus analyze` when local CLI exists; otherwise resolve the pinned npx package spec from `~/.gitnexus/config.json` (`cliPackageSpec` first, then `cliVersion`) and run `npx -y <resolved-spec> analyze` (it reuses previous analyze scope/options by default; add `--no-reuse-options` to reset). If the user declines, explicitly warn that retrieval may not reflect the current codebase.
28
37
 
29
38
  ## Checklist
30
39
 
31
40
  ```
32
41
  - [ ] READ gitnexus://repo/{name}/context
42
+ - [ ] Only use `gitnexus://repos` / `list_repos` when the target repo is unknown or multiple repos are indexed
33
43
  - [ ] gitnexus_query for the concept you want to understand
34
- - [ ] Review returned processes (execution flows)
44
+ - [ ] Review slim query fields first: `summary`, `candidates`, `process_hints`, `resource_hints`, `resource_chains`, `decision`, `missing_proof_targets`, `suggested_context_targets`, `upgrade_hints`, `runtime_preview`
45
+ - [ ] Prefer narrowing with `decision.recommended_follow_up` and exact `uid`-based context before expanding payload size
35
46
  - [ ] gitnexus_context on key symbols for callers/callees
47
+ - [ ] Review slim context fields first: `summary`, `symbol`, `incoming`, `outgoing`, `processes`, `resource_hints`, `resource_chains`, `verification_hint`, `missing_proof_targets`, `suggested_context_targets`, `upgrade_hints`, `runtime_preview`
48
+ - [ ] If you need legacy heavy fields (`processes`, `process_symbols`, `definitions`, `resourceBindings`, `serializedFields`, `next_hops`), rerun with `response_profile: "full"`
36
49
  - [ ] For Unity evidence, call context/query with `unity_resources: "on"` and `unity_hydration_mode: "compact"`
37
- - [ ] If `hydrationMeta.needsParityRetry === true`, rerun with `unity_hydration_mode: "parity"`
50
+ - [ ] If you need `hydrationMeta.needsParityRetry` or strict fallback diagnostics, rerun with `response_profile: "full"` first
51
+ - [ ] If `hydrationMeta.needsParityRetry === true` or `hydrationMeta.fallbackToCompact === true`, rerun with `unity_hydration_mode: "parity"` before closure claims
38
52
  - [ ] READ process resource for full execution traces
53
+ - [ ] Use `cypher` when you need a graph-level proof instead of another exploratory hint
39
54
  - [ ] Read source files for implementation details
40
55
  ```
41
56
 
42
- ## Unity Runtime Process Trigger
57
+ ## Unity Runtime Process Contract
43
58
 
44
59
  When exploration touches Unity runtime process semantics (runtime chain closure, lifecycle/loader stitching, confidence-based closure), load and follow:
45
60
 
@@ -60,30 +75,50 @@ When exploration touches Unity runtime process semantics (runtime chain closure,
60
75
 
61
76
  ```
62
77
  gitnexus_query({query: "payment processing"})
63
- Processes: CheckoutFlow, RefundFlow, WebhookHandler
64
- Symbols grouped by flow with file locations
78
+ Slim response: summary + candidates + process_hints + resource_hints + resource_chains + decision + missing_proof_targets + suggested_context_targets + upgrade_hints + runtime_preview
79
+ Use `decision.recommended_follow_up` first; if `suggested_context_targets[]` includes `uid`, prefer the matching `context --uid` upgrade hint
80
+ → Rerun with response_profile: "full" only if you need grouped process rows (`processes`, `process_symbols`, `definitions`, `next_hops`) or full `runtime_claim`
65
81
  ```
66
82
 
67
83
  **gitnexus_context** — 360-degree view of a symbol:
68
84
 
69
85
  ```
70
86
  gitnexus_context({name: "validateUser"})
71
- Incoming calls: loginHandler, apiMiddleware
72
- Outgoing calls: checkToken, getUserById
73
- Processes: LoginFlow (step 2/5), TokenRefresh (step 1/3)
87
+ Slim response: symbol + incoming/outgoing refs + processes + resource_hints + resource_chains + verification_hint + missing_proof_targets + suggested_context_targets + upgrade_hints + runtime_preview
88
+ Use structured `suggested_context_targets[]` and `uid` disambiguation before rerunning full
89
+ Rerun with response_profile: "full" for Unity hydration diagnostics, `next_hops`, `runtime_claim`, or larger categorized ref payloads
74
90
  ```
75
91
 
76
- **Unity-focused context/query** — use compact first, parity only when needed:
92
+ **Unity-focused context/query** — use compact first, inspect slim hints, then parity/full only when needed:
77
93
 
78
94
  ```
79
- gitnexus_context({
80
- name: "DoorObj",
95
+ gitnexus_query({
96
+ query: "ReloadBase",
97
+ resource_path_prefix: "Assets/NEON/Graphs/PlayerGun/Gungraph_use/1_weapon_orb_key.asset",
81
98
  unity_resources: "on",
82
99
  unity_hydration_mode: "compact"
83
100
  })
101
+ → Use symbol/resource anchors for Unity runtime retrieval; do not rely on broad natural-language phrasing
102
+ → Slim output gives resource/process narrowing hints first
103
+ → If you need hydration diagnostics, rerun with response_profile: "full"
84
104
  → hydrationMeta.needsParityRetry ? rerun with unity_hydration_mode: "parity" : continue
85
105
  ```
86
106
 
107
+ Unity runtime example:
108
+
109
+ ```
110
+ 1. READ gitnexus://repo/neonspark-core/context
111
+ 2. gitnexus_query({
112
+ query: "ReloadBase",
113
+ resource_path_prefix: "Assets/NEON/Graphs/PlayerGun/Gungraph_use/1_weapon_orb_key.asset",
114
+ unity_resources: "on",
115
+ unity_hydration_mode: "compact"
116
+ })
117
+ 3. Follow `decision.recommended_follow_up` immediately
118
+ 4. gitnexus_context({uid: "<exact uid>", unity_resources: "on", runtime_chain_verify: "on-demand"})
119
+ 5. READ process resource or use cypher if you need graph proof
120
+ ```
121
+
87
122
  ## Example: "How does payment processing work?"
88
123
 
89
124
  ```
@@ -96,3 +131,16 @@ gitnexus_context({
96
131
  → Outgoing: validateCard, chargeStripe, saveTransaction
97
132
  4. Read src/payments/processor.ts for implementation details
98
133
  ```
134
+
135
+ ## Runtime-Chain Closure Guard
136
+
137
+ - Query-time runtime closure is **graph-only** and does not require `verification_rules` / `trigger_tokens` matching.
138
+ - For Unity runtime retrieval, prefer symbol/resource anchors over business-description phrasing; use natural-language `query` only to discover the first anchor.
139
+ - `response_profile=slim` is sufficient for normal workflows; use `runtime_preview` as the default status summary.
140
+ - `response_profile=full` is for debugging and deep evidence inspection (`runtime_claim.hops`, `runtime_claim.gaps`, hydration diagnostics).
141
+ - Strong graph hops can coexist with failed closure when verifier-core still reports `failed`; this is partial bridge evidence, not contradiction.
142
+ - Treat runtime-chain outputs as two layers:
143
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
144
+ - `policy-adjusted`: user-visible result after hydration policy is applied
145
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
146
+ - In that downgraded state, rerun with parity before final conclusions.
@@ -44,6 +44,19 @@ For any task involving code understanding, debugging, impact analysis, or refact
44
44
 
45
45
  ### Unity Retrieval Contract (query/context)
46
46
 
47
+ Default `query/context` responses are now slim for agent use:
48
+
49
+ - `query`: `summary`, `candidates`, `process_hints`, `resource_hints`, `resource_chains`, `decision`, `missing_proof_targets`, `suggested_context_targets`, `upgrade_hints`, `runtime_preview`
50
+ - `context`: `summary`, `symbol`, `incoming`, `outgoing`, `processes`, `resource_hints`, `resource_chains`, `verification_hint`, `missing_proof_targets`, `suggested_context_targets`, `upgrade_hints`, `runtime_preview`
51
+ - `suggested_context_targets[]` now returns structured objects: `{ name, uid?, filePath?, why }`
52
+ - `upgrade_hints[]` may include exact `gitnexus context --uid <uid>` commands for same-name disambiguation
53
+ - `resource_chains[]` returns graph-backed Unity seed chains such as `sourceResourcePath -> intermediateResourcePath -> targetSymbol` when a resource seed can be bridged through `UNITY_ASSET_GUID_REF -> UNITY_GRAPH_NODE_SCRIPT_REF`.
54
+
55
+ When you need the legacy heavy payloads (`processes`, `process_symbols`, `definitions`, `resourceBindings`, `serializedFields`, `next_hops`), pass:
56
+
57
+ - `response_profile: "full"` in MCP calls
58
+ - `--response-profile full` in CLI calls
59
+
47
60
  When you need Unity resource evidence, pass:
48
61
 
49
62
  - `unity_resources: "on"` (or `"auto"` when you want adaptive behavior)
@@ -51,11 +64,29 @@ When you need Unity resource evidence, pass:
51
64
 
52
65
  Recommended default workflow:
53
66
 
54
- 1. Call `context/query` with `unity_hydration_mode: "compact"` for speed.
55
- 2. Inspect `hydrationMeta` in the response:
67
+ 1. Follow `discovery -> seed narrowing -> closure verification`.
68
+ 2. Call `context/query` with `unity_hydration_mode: "compact"` for speed.
69
+ 3. Inspect `hydrationMeta` in the response:
56
70
  - `needsParityRetry: true` → rerun same call with `unity_hydration_mode: "parity"`
57
71
  - `isComplete: true` → keep compact result
58
- 3. Treat parity as the completeness path for advanced verification.
72
+ 4. Treat parity as the completeness path for advanced verification.
73
+
74
+ Agent-safe upgrade path:
75
+
76
+ - inspect `resource_chains[]` first for graph-backed Unity resource bridges, then `resource_hints[]` / `process_hints[]` and narrow with `resource_path_prefix=` or symbol-targeted context
77
+ - use `decision.recommended_follow_up` as the default narrow-first next step
78
+ - inspect `missing_proof_targets[]` and structured `suggested_context_targets[]` before considering payload expansion
79
+ - when `suggested_context_targets[]` includes `uid`, prefer the matching `upgrade_hints[]` `context --uid` command over same-name `context(name=...)`
80
+ - `response_profile=slim` is the default and sufficient for normal workflows
81
+ - use `response_profile: "full"` only for debugging/deep evidence inspection when narrowing cannot close the proof gap
82
+
83
+ Runtime claim closure reminder:
84
+
85
+ - Query-time runtime closure is **graph-only** and does not require `verification_rules` / `trigger_tokens` matching.
86
+ - `verification_rules` remains an offline governance/report artifact family.
87
+ - Strong graph hops can coexist with failed closure when verifier-core stays `failed`; report as partial bridge evidence.
88
+ - `gitnexus-unity-rule-gen` public flow is `approved -> compile -> analyze -> CLI validation`; this does not change query-time graph-only closure semantics.
89
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, rerun parity before closure claims.
59
90
 
60
91
  When task scope includes Unity runtime process semantics, load and follow:
61
92
 
@@ -106,3 +137,11 @@ Lightweight reads (~100-500 tokens) for navigation:
106
137
  MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "myFunc"})
107
138
  RETURN caller.name, caller.filePath
108
139
  ```
140
+
141
+ ## Runtime-Chain Closure Guard
142
+
143
+ - Treat runtime-chain outputs as two layers:
144
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
145
+ - `policy-adjusted`: user-visible result after hydration policy is applied
146
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
147
+ - In that downgraded state, rerun with parity before final conclusions.
@@ -103,3 +103,11 @@ gitnexus_detect_changes({scope: "staged"})
103
103
 
104
104
  3. Risk: 2 direct callers, 2 processes = MEDIUM
105
105
  ```
106
+
107
+ ## Runtime-Chain Closure Guard
108
+
109
+ - Treat runtime-chain outputs as two layers:
110
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
111
+ - `policy-adjusted`: user-visible result after hydration policy is applied
112
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
113
+ - In that downgraded state, rerun with parity before final conclusions.
@@ -166,3 +166,11 @@ Structure your review as:
166
166
  ### Recommendation
167
167
  APPROVE / REQUEST CHANGES / NEEDS DISCUSSION
168
168
  ```
169
+
170
+ ## Runtime-Chain Closure Guard
171
+
172
+ - Treat runtime-chain outputs as two layers:
173
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
174
+ - `policy-adjusted`: user-visible result after hydration policy is applied
175
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
176
+ - In that downgraded state, rerun with parity before final conclusions.
@@ -127,3 +127,11 @@ RETURN caller.name, caller.filePath ORDER BY caller.filePath
127
127
  → Affected: LoginFlow, TokenRefresh
128
128
  → Risk: MEDIUM — run tests for these flows
129
129
  ```
130
+
131
+ ## Runtime-Chain Closure Guard
132
+
133
+ - Treat runtime-chain outputs as two layers:
134
+ - `verifier-core`: binary verifier result (`verified_full` | `failed`)
135
+ - `policy-adjusted`: user-visible result after hydration policy is applied
136
+ - If `hydration_policy=strict` and `hydrationMeta.fallbackToCompact=true`, the result is downgraded policy-adjusted output and is not closure.
137
+ - In that downgraded state, rerun with parity before final conclusions.