0xray 3.5.5 → 4.0.0

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 (229) hide show
  1. package/.mcp.json +51 -7
  2. package/.opencode/skills/api-design/SKILL.md +1 -1
  3. package/.opencode/skills/architect-tools/SKILL.md +1 -1
  4. package/.opencode/skills/architecture-patterns/SKILL.md +1 -1
  5. package/.opencode/skills/auto-format/SKILL.md +1 -1
  6. package/.opencode/skills/boot-orchestrator/SKILL.md +2 -6
  7. package/.opencode/skills/bug-triage/SKILL.md +1 -1
  8. package/.opencode/skills/code-analyzer/SKILL.md +1 -1
  9. package/.opencode/skills/code-review/SKILL.md +1 -1
  10. package/.opencode/skills/enforcer/SKILL.md +1 -1
  11. package/.opencode/skills/framework-compliance-audit/SKILL.md +1 -1
  12. package/.opencode/skills/git-workflow/SKILL.md +1 -1
  13. package/.opencode/skills/hermes-agent/SKILL.md +36 -36
  14. package/.opencode/skills/inference-improve/SKILL.md +1 -1
  15. package/.opencode/skills/lint/SKILL.md +1 -1
  16. package/.opencode/skills/log-monitor/SKILL.md +1 -1
  17. package/.opencode/skills/model-health-check/SKILL.md +1 -1
  18. package/.opencode/skills/multimodal-looker/SKILL.md +1 -1
  19. package/.opencode/skills/orchestrator/SKILL.md +38 -14
  20. package/.opencode/skills/performance-analysis/SKILL.md +1 -1
  21. package/.opencode/skills/performance-optimization/SKILL.md +1 -1
  22. package/.opencode/skills/processor-pipeline/SKILL.md +1 -1
  23. package/.opencode/skills/project-analysis/SKILL.md +1 -1
  24. package/.opencode/skills/refactoring-strategies/SKILL.md +1 -1
  25. package/.opencode/skills/registry.json +65 -0
  26. package/.opencode/skills/researcher/SKILL.md +18 -5
  27. package/.opencode/skills/security-audit/SKILL.md +1 -1
  28. package/.opencode/skills/security-scan/SKILL.md +1 -1
  29. package/.opencode/skills/session-management/SKILL.md +1 -1
  30. package/.opencode/skills/state-manager/SKILL.md +1 -1
  31. package/.opencode/skills/storyteller/SKILL.md +1 -1
  32. package/.opencode/skills/strategist/SKILL.md +12 -0
  33. package/.opencode/skills/testing-best-practices/SKILL.md +37 -0
  34. package/.opencode/skills/testing-strategy/SKILL.md +14 -3
  35. package/.opencode/skills/ui-ux-design/SKILL.md +1 -1
  36. package/.opencode/skills/xray-orchestrator/index.ts +267 -0
  37. package/.xray/codex.json +12 -3
  38. package/.xray/features.json +27 -5
  39. package/.xray/features.schema.json +31 -0
  40. package/AGENTS-consumer.md +16 -6
  41. package/AGENTS.md +11 -3
  42. package/README.md +13 -10
  43. package/SKILLS.md +1 -1
  44. package/dist/AGENTS.md +11 -3
  45. package/dist/CHANGELOG.md +65 -11
  46. package/dist/README.md +13 -10
  47. package/dist/SKILLS.md +1 -1
  48. package/dist/cli/commands/hermes-install.js +3 -0
  49. package/dist/cli/commands/openclaw-install.js +14 -0
  50. package/dist/core/features-config.d.ts +15 -2
  51. package/dist/infrastructure/schemas/cloud-schemas.d.ts +1 -1
  52. package/dist/integrations/grok/grok-cli.d.ts +3 -0
  53. package/dist/integrations/grok/grok-cli.js +92 -4
  54. package/dist/integrations/grok/hooks/grok-hook-utils.js +53 -7
  55. package/dist/integrations/grok/hooks/post-tool-use.js +68 -46
  56. package/dist/integrations/grok/hooks/pre-tool-use.js +14 -31
  57. package/dist/integrations/grok/hooks/session-start.js +86 -4
  58. package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +31 -24
  59. package/dist/integrations/hermes-agent/bridge.mjs +19 -1
  60. package/dist/integrations/hooks/delegation-gate-runtime.mjs +32 -3
  61. package/dist/integrations/hooks/pipeline-hook-runtime.mjs +1 -1
  62. package/dist/integrations/hooks/station-hook-runtime.cjs +421 -0
  63. package/dist/integrations/hooks/station-hook-runtime.mjs +24 -0
  64. package/dist/integrations/hooks/station-memory-ingest.mjs +45 -0
  65. package/dist/integrations/hooks/station-memory-match.mjs +47 -0
  66. package/dist/integrations/openclaw/client.d.ts +5 -1
  67. package/dist/integrations/openclaw/client.js +17 -9
  68. package/dist/integrations/openclaw/config.js +0 -1
  69. package/dist/integrations/openclaw/hooks/pre-tool-gate-runtime.mjs +102 -0
  70. package/dist/integrations/openclaw/index.js +17 -0
  71. package/dist/integrations/openclaw/plugin/xray-pre-tool/index.js +75 -0
  72. package/dist/integrations/openclaw/plugin/xray-pre-tool/openclaw.plugin.json +10 -0
  73. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +10 -0
  74. package/dist/integrations/openclaw/pre-tool-gate.d.ts +19 -0
  75. package/dist/integrations/openclaw/pre-tool-gate.js +39 -0
  76. package/dist/mcps/orchestrator/handlers/complexity-handler.js +2 -2
  77. package/dist/memory-routing/index.d.ts +1 -1
  78. package/dist/memory-routing/index.js +1 -1
  79. package/dist/memory-routing/provider-loader.d.ts +4 -0
  80. package/dist/memory-routing/provider-loader.js +44 -2
  81. package/dist/memory-routing/provider-registry.js +3 -2
  82. package/dist/nucleus/autonomy-kernel.d.ts +2 -2
  83. package/dist/nucleus/autonomy-kernel.js +17 -6
  84. package/dist/nucleus/confer.js +17 -3
  85. package/dist/nucleus/delegation-gate.d.ts +14 -8
  86. package/dist/nucleus/delegation-gate.js +151 -16
  87. package/dist/nucleus/suit-temperament.d.ts +40 -0
  88. package/dist/nucleus/suit-temperament.js +157 -0
  89. package/dist/nucleus/user-aside.js +1 -1
  90. package/dist/plugin/xray-codex-injection.js +14 -3
  91. package/dist/postprocessor/triggers/GitHookTrigger.js +11 -5
  92. package/opencode.json +88 -0
  93. package/package.json +14 -4
  94. package/scripts/hooks/install-hooks.cjs +18 -3
  95. package/scripts/hooks/run-hook.js +67 -3
  96. package/scripts/mjs/run-repertoire-mcp.mjs +39 -0
  97. package/scripts/mjs/verify-confer-core.mjs +1 -1
  98. package/scripts/mjs/verify-delegation-gate-core.mjs +29 -2
  99. package/scripts/mjs/verify-four-floor-compact.mjs +524 -0
  100. package/scripts/mjs/verify-pipeline-facets.mjs +215 -0
  101. package/scripts/mjs/verify-temperament-live.mjs +261 -0
  102. package/scripts/node/bridge-mcp-wiring.cjs +277 -29
  103. package/scripts/node/install-bridges.cjs +195 -33
  104. package/scripts/node/postinstall.cjs +50 -27
  105. package/scripts/node/release-gate.mjs +1 -1
  106. package/scripts/node/release.mjs +2 -2
  107. package/scripts/node/validate-release-docs.mjs +20 -33
  108. package/scripts/node/version-manager.mjs +25 -10
  109. package/src/integrations/grok/plugin/0xray/hooks/hooks.json +31 -24
  110. package/src/integrations/openclaw/README.md +134 -0
  111. package/src/integrations/openclaw/plugin/xray-pre-tool/index.js +75 -0
  112. package/src/integrations/openclaw/plugin/xray-pre-tool/openclaw.plugin.json +10 -0
  113. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +10 -0
  114. package/src/mcps/orchestrator/handlers/complexity-handler.ts +2 -1
  115. package/vendor/@0xray/repertoire/AGENTS.md +163 -0
  116. package/vendor/@0xray/repertoire/LICENSE +21 -0
  117. package/vendor/@0xray/repertoire/README.md +120 -0
  118. package/vendor/@0xray/repertoire/data/curated_signals.json +208 -0
  119. package/vendor/@0xray/repertoire/dist/RepertoireService.d.ts +78 -0
  120. package/vendor/@0xray/repertoire/dist/RepertoireService.d.ts.map +1 -0
  121. package/vendor/@0xray/repertoire/dist/RepertoireService.js +153 -0
  122. package/vendor/@0xray/repertoire/dist/RepertoireService.js.map +1 -0
  123. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.d.ts +39 -0
  124. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.d.ts.map +1 -0
  125. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.js +60 -0
  126. package/vendor/@0xray/repertoire/dist/governance/ontological-trap-enforcer.js.map +1 -0
  127. package/vendor/@0xray/repertoire/dist/index.d.ts +14 -0
  128. package/vendor/@0xray/repertoire/dist/index.d.ts.map +1 -0
  129. package/vendor/@0xray/repertoire/dist/index.js +14 -0
  130. package/vendor/@0xray/repertoire/dist/index.js.map +1 -0
  131. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.d.ts +26 -0
  132. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.d.ts.map +1 -0
  133. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.js +109 -0
  134. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-ingester.js.map +1 -0
  135. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.d.ts +18 -0
  136. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.d.ts.map +1 -0
  137. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.js +94 -0
  138. package/vendor/@0xray/repertoire/dist/ingestion/groover-log-parser.js.map +1 -0
  139. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.d.ts +7 -0
  140. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.d.ts.map +1 -0
  141. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.js +18 -0
  142. package/vendor/@0xray/repertoire/dist/ingestion/orchestrator-feedback-ingester.js.map +1 -0
  143. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.d.ts +31 -0
  144. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.d.ts.map +1 -0
  145. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.js +83 -0
  146. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.js.map +1 -0
  147. package/vendor/@0xray/repertoire/dist/mcp/server.d.ts +6 -0
  148. package/vendor/@0xray/repertoire/dist/mcp/server.d.ts.map +1 -0
  149. package/vendor/@0xray/repertoire/dist/mcp/server.js +173 -0
  150. package/vendor/@0xray/repertoire/dist/mcp/server.js.map +1 -0
  151. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.d.ts +27 -0
  152. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.d.ts.map +1 -0
  153. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.js +107 -0
  154. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.js.map +1 -0
  155. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.d.ts +11 -0
  156. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.d.ts.map +1 -0
  157. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.js +32 -0
  158. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/capability-enhancer.js.map +1 -0
  159. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.d.ts +9 -0
  160. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.d.ts.map +1 -0
  161. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.js +72 -0
  162. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/confidence-gate.js.map +1 -0
  163. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.d.ts +5 -0
  164. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.d.ts.map +1 -0
  165. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.js +18 -0
  166. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-agent-affinity.js.map +1 -0
  167. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.d.ts +31 -0
  168. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.d.ts.map +1 -0
  169. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.js +218 -0
  170. package/vendor/@0xray/repertoire/dist/orchestrator-bridge/signal-injector.js.map +1 -0
  171. package/vendor/@0xray/repertoire/dist/paths.d.ts +24 -0
  172. package/vendor/@0xray/repertoire/dist/paths.d.ts.map +1 -0
  173. package/vendor/@0xray/repertoire/dist/paths.js +74 -0
  174. package/vendor/@0xray/repertoire/dist/paths.js.map +1 -0
  175. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.d.ts +141 -0
  176. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.d.ts.map +1 -0
  177. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.js +210 -0
  178. package/vendor/@0xray/repertoire/dist/provider/memory-routing-provider.js.map +1 -0
  179. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.d.ts +48 -0
  180. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.d.ts.map +1 -0
  181. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js +221 -0
  182. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js.map +1 -0
  183. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.d.ts +11 -0
  184. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.d.ts.map +1 -0
  185. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.js +43 -0
  186. package/vendor/@0xray/repertoire/dist/registry/InferenceStateManager.js.map +1 -0
  187. package/vendor/@0xray/repertoire/dist/registry/signal-prune.d.ts +15 -0
  188. package/vendor/@0xray/repertoire/dist/registry/signal-prune.d.ts.map +1 -0
  189. package/vendor/@0xray/repertoire/dist/registry/signal-prune.js +35 -0
  190. package/vendor/@0xray/repertoire/dist/registry/signal-prune.js.map +1 -0
  191. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.d.ts +3 -0
  192. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.d.ts.map +1 -0
  193. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.js +24 -0
  194. package/vendor/@0xray/repertoire/dist/synthesis/concrete-sections.js.map +1 -0
  195. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.d.ts +24 -0
  196. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.d.ts.map +1 -0
  197. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.js +148 -0
  198. package/vendor/@0xray/repertoire/dist/synthesis/meta-inference-engine.js.map +1 -0
  199. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.d.ts +4 -0
  200. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.d.ts.map +1 -0
  201. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.js +44 -0
  202. package/vendor/@0xray/repertoire/dist/synthesis/primitive-confidence-aggregator.js.map +1 -0
  203. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.d.ts +22 -0
  204. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.d.ts.map +1 -0
  205. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.js +66 -0
  206. package/vendor/@0xray/repertoire/dist/synthesis/synthesis-prompt-builder.js.map +1 -0
  207. package/vendor/@0xray/repertoire/dist/types.d.ts +210 -0
  208. package/vendor/@0xray/repertoire/dist/types.d.ts.map +1 -0
  209. package/vendor/@0xray/repertoire/dist/types.js +2 -0
  210. package/vendor/@0xray/repertoire/dist/types.js.map +1 -0
  211. package/vendor/@0xray/repertoire/docs/MEMORY-ROUTING-PROVIDER.md +54 -0
  212. package/vendor/@0xray/repertoire/hermes-mcp.example.json +20 -0
  213. package/vendor/@0xray/repertoire/mcp-config.example.json +11 -0
  214. package/vendor/@0xray/repertoire/package.json +124 -0
  215. package/vendor/@0xray/repertoire/schemas/curated-signal.schema.json +68 -0
  216. package/vendor/@0xray/repertoire/schemas/inference-log.schema.json +82 -0
  217. package/vendor/@0xray/repertoire/scripts/confirm-suit-all.mjs +253 -0
  218. package/vendor/@0xray/repertoire/scripts/confirm-suit-harness.mjs +220 -0
  219. package/vendor/@0xray/repertoire/scripts/run-live-synthesis-checkpoint.mjs +215 -0
  220. package/vendor/@0xray/repertoire/scripts/suit-bridge-shared.mjs +139 -0
  221. package/vendor/@0xray/repertoire/scripts/verify-grok-suit.mjs +304 -0
  222. package/vendor/@0xray/repertoire/scripts/verify-hermes-suit.mjs +163 -0
  223. package/vendor/@0xray/repertoire/scripts/verify-openclaw-suit.mjs +125 -0
  224. package/vendor/@0xray/repertoire/scripts/verify-opencode-suit.mjs +127 -0
  225. package/vendor/@0xray/repertoire/scripts/verify-synthesis-dogfood.mjs +207 -0
  226. package/vendor/@0xray/repertoire/skills/repertoire-trap-handling/SKILL.md +206 -0
  227. package/xray/codex.json +12 -3
  228. package/xray/features.json +27 -5
  229. package/xray/features.schema.json +31 -0
@@ -2,15 +2,11 @@
2
2
  "hooks": {
3
3
  "PreToolUse": [
4
4
  {
5
- "matcher": ".*",
6
5
  "hooks": [
7
6
  {
8
7
  "type": "command",
9
- "command": "node",
10
- "args": [
11
- "${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/pre-tool-use.js"
12
- ],
13
- "timeout": 30000
8
+ "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/pre-tool-use.js\"",
9
+ "timeout": 30
14
10
  }
15
11
  ]
16
12
  }
@@ -20,11 +16,8 @@
20
16
  "hooks": [
21
17
  {
22
18
  "type": "command",
23
- "command": "node",
24
- "args": [
25
- "${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js"
26
- ],
27
- "timeout": 15000
19
+ "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js\"",
20
+ "timeout": 30
28
21
  }
29
22
  ]
30
23
  }
@@ -34,30 +27,44 @@
34
27
  "hooks": [
35
28
  {
36
29
  "type": "command",
37
- "command": "node",
38
- "args": [
39
- "${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js",
40
- "--hook-event=user_prompt_submit"
41
- ],
42
- "timeout": 15000
30
+ "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js\" --hook-event=user_prompt_submit",
31
+ "timeout": 30
43
32
  }
44
33
  ]
45
34
  }
46
35
  ],
47
36
  "PostToolUse": [
48
37
  {
49
- "matcher": ".*",
50
38
  "hooks": [
51
39
  {
52
40
  "type": "command",
53
- "command": "node",
54
- "args": [
55
- "${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/post-tool-use.js"
56
- ],
57
- "timeout": 15000
41
+ "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/post-tool-use.js\"",
42
+ "timeout": 30
43
+ }
44
+ ]
45
+ }
46
+ ],
47
+ "PreCompact": [
48
+ {
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js\" --hook-event=pre_compact",
53
+ "timeout": 30
54
+ }
55
+ ]
56
+ }
57
+ ],
58
+ "PostCompact": [
59
+ {
60
+ "hooks": [
61
+ {
62
+ "type": "command",
63
+ "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js\" --hook-event=post_compact",
64
+ "timeout": 30
58
65
  }
59
66
  ]
60
67
  }
61
68
  ]
62
69
  }
63
- }
70
+ }
@@ -0,0 +1,134 @@
1
+ # OpenClaw Integration
2
+
3
+ 0xray integration for OpenClaw - a self-hosted AI gateway that connects messaging platforms to AI coding agents.
4
+
5
+ ## Overview
6
+
7
+ This integration allows 0xray to:
8
+ - Connect to OpenClaw Gateway via WebSocket
9
+ - Expose 0xray capabilities through OpenClaw skills
10
+ - Send tool execution events to OpenClaw for real-time tracking
11
+ - Receive commands from OpenClaw channels (WhatsApp, Telegram, Discord, etc.)
12
+
13
+ ## Architecture
14
+
15
+ ```
16
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
17
+ │ User │────▶│ OpenClaw │────▶│ 0xray │
18
+ │ (WhatsApp, │ │ Gateway │ │ Skills │
19
+ │ Discord, │ │ │ │ │
20
+ │ Telegram) │◀────│ │◀────│ │
21
+ └──────────────┘ └──────────────┘ └──────────────┘
22
+ │
23
+ ▼
24
+ ┌──────────────┐
25
+ │ WebSocket │
26
+ │ Client │
27
+ └──────────────┘
28
+ ```
29
+
30
+ ## Installation
31
+
32
+ ### 1. Install Dependencies
33
+
34
+ ```bash
35
+ npm install ws
36
+ ```
37
+
38
+ ### 2. Configure OpenClaw
39
+
40
+ Create `.xray/config/openclaw.json`:
41
+
42
+ ```json
43
+ {
44
+ "gatewayUrl": "ws://127.0.0.1:18789",
45
+ "authToken": "your-auth-token",
46
+ "deviceId": "your-device-id",
47
+ "apiServer": {
48
+ "enabled": true,
49
+ "port": 18431,
50
+ "host": "127.0.0.1",
51
+ "apiKey": "your-api-key"
52
+ },
53
+ "hooks": {
54
+ "enabled": true
55
+ },
56
+ "enabled": true
57
+ }
58
+ ```
59
+
60
+ ### 3. Install OpenClaw Skills
61
+
62
+ Copy skills to your OpenClaw skills directory:
63
+
64
+ ```bash
65
+ cp -r skills/* ~/.openclaw/skills/
66
+ ```
67
+
68
+ ## Usage
69
+
70
+ ### Initialize Integration
71
+
72
+ ```typescript
73
+ import { initializeOpenClawIntegration } from './src/integrations/openclaw/index.js';
74
+
75
+ const integration = await initializeOpenClawIntegration();
76
+
77
+ // Or with custom agent invoker
78
+ const integration = await initializeOpenClawIntegration('/path/to/config.json', myAgentInvoker);
79
+ ```
80
+
81
+ ### Using OpenClaw Commands
82
+
83
+ After installation, use these commands in any OpenClaw channel:
84
+
85
+ - `/xray` - Show status
86
+ - `/xray-analyze <file>` - Analyze code
87
+ - `/xray-code <file>` - Code review
88
+ - `/xray-file <file>` - Read file
89
+ - `/xray-exec <command>` - Execute command
90
+
91
+ ## Configuration
92
+
93
+ | Option | Type | Default | Description |
94
+ |--------|------|---------|-------------|
95
+ | `gatewayUrl` | string | `ws://127.0.0.1:18789` | OpenClaw WebSocket URL |
96
+ | `authToken` | string | - | Authentication token |
97
+ | `deviceId` | string | - | Device ID for pairing |
98
+ | `apiServer.enabled` | boolean | `true` | Enable HTTP API server |
99
+ | `apiServer.port` | number | `18431` | API server port |
100
+ | `apiServer.host` | string | `127.0.0.1` | API server host |
101
+ | `apiServer.apiKey` | string | - | API key for auth |
102
+ | `hooks.enabled` | boolean | `true` | Enable tool hooks |
103
+ | `autoReconnect` | boolean | `true` | Auto reconnect |
104
+ | `enabled` | boolean | `true` | Enable integration |
105
+
106
+ ## API Server
107
+
108
+ The integration exposes a local HTTP API on port 18431:
109
+
110
+ - `GET /health` - Health check
111
+ - `POST /api/agent/invoke` - Invoke agent
112
+ - `GET /api/agent/status` - Agent status
113
+
114
+ ## Skills
115
+
116
+ ### 0xray-orchestrator
117
+
118
+ Main skill providing 0xray commands:
119
+
120
+ ```markdown
121
+ /xray - Show status
122
+ /xray-analyze <file> - Analyze code
123
+ /xray-code <file> - Code review
124
+ /xray-file <file> - Read file
125
+ /xray-exec <command> - Execute command
126
+ ```
127
+
128
+ ## Documentation
129
+
130
+ See `docs/research/openclaw/` for detailed documentation.
131
+
132
+ ## License
133
+
134
+ MIT
@@ -0,0 +1,75 @@
1
+ import { createRequire } from 'node:module';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { definePluginEntry } from 'openclaw/plugin-sdk/plugin-entry';
7
+
8
+ const require = createRequire(import.meta.url);
9
+ const pluginDir = dirname(fileURLToPath(import.meta.url));
10
+
11
+ function hasGate(root) {
12
+ return Boolean(root) && existsSync(join(root, 'dist/nucleus/delegation-gate.js'));
13
+ }
14
+
15
+ function resolveXrayRoot() {
16
+ if (hasGate(process.env.XRAY_AI_PATH || '')) {
17
+ return process.env.XRAY_AI_PATH;
18
+ }
19
+ const marker = join(homedir(), '.openclaw', 'xray-consumer-root.txt');
20
+ const marked = existsSync(marker) ? readFileSync(marker, 'utf8').trim() : '';
21
+ const candidates = [
22
+ marked,
23
+ marked ? join(marked, 'node_modules', '0xray') : '',
24
+ marked ? join(marked, '..', 'xray') : '',
25
+ // Linked plugin lives at src/integrations/openclaw/plugin/xray-pre-tool
26
+ join(pluginDir, '..', '..', '..', '..', '..'),
27
+ ].filter(Boolean);
28
+ for (const candidate of candidates) {
29
+ if (hasGate(candidate)) {
30
+ return candidate;
31
+ }
32
+ }
33
+ return '';
34
+ }
35
+
36
+ export default definePluginEntry({
37
+ id: 'xray-pre-tool',
38
+ name: '0xRay PreToolUse',
39
+ register(api) {
40
+ api.on(
41
+ 'before_tool_call',
42
+ (event, ctx) => {
43
+ try {
44
+ const xrayRoot = resolveXrayRoot();
45
+ if (!xrayRoot) {
46
+ return { block: true, blockReason: '0xRay dist missing — set XRAY_AI_PATH' };
47
+ }
48
+ const gate = require(join(xrayRoot, 'dist/nucleus/delegation-gate.js'));
49
+ const projectRoot =
50
+ process.env.XRAY_ROOT ||
51
+ ctx?.workspaceDir ||
52
+ ctx?.cwd ||
53
+ process.cwd();
54
+ const features = gate.loadDelegationGateFeatures(projectRoot, 'openclaw');
55
+ const outcome = gate.evaluatePreToolGate(event.toolName, event.params || {}, {
56
+ projectRoot,
57
+ sessionId: ctx?.sessionId || ctx?.sessionKey || 'openclaw',
58
+ features,
59
+ host: 'openclaw',
60
+ });
61
+ if (!outcome.allow) {
62
+ return { block: true, blockReason: outcome.reason || '0xRay constitution' };
63
+ }
64
+ return undefined;
65
+ } catch (err) {
66
+ return {
67
+ block: true,
68
+ blockReason: err instanceof Error ? err.message : String(err),
69
+ };
70
+ }
71
+ },
72
+ { priority: 80 },
73
+ );
74
+ },
75
+ });
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "xray-pre-tool",
3
+ "name": "0xRay PreToolUse",
4
+ "description": "Constitution and temperament gate for OpenClaw tool calls (Codex 11/29/69, spawn plan).",
5
+ "configSchema": {
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {}
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "xray-pre-tool",
3
+ "version": "4.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "0xRay constitution + temperament PreToolUse for OpenClaw",
7
+ "openclaw": {
8
+ "extensions": ["./index.js"]
9
+ }
10
+ }
@@ -133,7 +133,7 @@ export class ComplexityHandler {
133
133
 
134
134
  let userAsideReport = '';
135
135
  let leadDevPlan = synthesisCheckpoint
136
- ? buildSynthesisCheckpointPlan(args.synthesisDueReason ?? null)
136
+ ? buildSynthesisCheckpointPlan(args.synthesisDueReason ?? null, projectRoot)
137
137
  : userAsideIntake
138
138
  ? null
139
139
  : isLeadDevModeActive() && (primaryDescription || planTaskInputs.length > 0)
@@ -142,6 +142,7 @@ export class ComplexityHandler {
142
142
  taskTypes.length ? taskTypes : ['implement'],
143
143
  planTaskInputs,
144
144
  analysis.overallComplexity,
145
+ projectRoot,
145
146
  )
146
147
  : null;
147
148
 
@@ -0,0 +1,163 @@
1
+ # 0xRay AI Agents
2
+
3
+ Quick reference for the 0xRay AI orchestration framework (shipped to your project on `npm install 0xray`).
4
+
5
+ **v3.4.5** — 7 MCP servers · 45 skills · 68 codex terms · 4 platform bridges
6
+
7
+ ## Postinstall (automatic)
8
+
9
+ `npm install 0xray` runs `install-bridges.cjs` and:
10
+
11
+ - Copies this file → **`AGENTS.md`** in your project root
12
+ - Ships root **`SKILLS.md`** and syncs **45 skills** to platform skill directories
13
+ - Seeds **`.gitignore`** (from template, if absent)
14
+ - Deploys **`.xray/`** (`codex.json`, `features.json`, `config.json`)
15
+ - Writes **`.mcp.json`** with 7 MCPs servers (`npx -y 0xray mcp …`)
16
+ - Installs bridges: **OpenCode**, **Grok**, **Hermes**, **OpenClaw**
17
+
18
+ Optional extras: `npx 0xray setup`
19
+
20
+ ## Available MCP Servers
21
+
22
+ All seven servers use `npx -y 0xray mcp <cmd>` — configured in your project `.mcp.json`:
23
+
24
+ | Server | Role |
25
+ |--------|------|
26
+ | `xray-governance` | Proposal governance, codex snapshot, quality gates |
27
+ | `xray-skills` | Skill invocation, 45 knowledge skills |
28
+ | `xray-orchestrator` | thinDispatch routing, AsideContext, confidence gate |
29
+ | `xray-enforcer` | Codex compliance enforcement, rule validation |
30
+ | `xray-researcher` | Codebase exploration, memory-routing enrichment |
31
+ | `xray-code-review` | Proposal quality, code review deliberation |
32
+ | `xray-architect-tools` | System design, architecture decisions |
33
+
34
+ Governance deliberation uses **code-review**, **security-audit** (via enforcer/skills), and **researcher** within this 7-server surface.
35
+
36
+ ## CLI Commands
37
+
38
+ | Command | Description |
39
+ |---------|-------------|
40
+ | `npx 0xray setup` | Symlinks, hook extras, Hermes skill sync |
41
+ | `npx 0xray status` | Verify installation |
42
+ | `npx 0xray opencode install` | OpenCode bridge (also runs on postinstall) |
43
+ | `npx 0xray grok install` | Grok plugin + 7 MCPs servers + skill sync |
44
+ | `npx 0xray hermes install` | Hermes plugin bridge |
45
+ | `npx 0xray openclaw install` | OpenClaw config + skills |
46
+ | `npx 0xray skill:install` | Install starter skills |
47
+ | `npx 0xray validate` | Validate codex compliance |
48
+ | `npx 0xray codex check` | Check codex rules |
49
+ | `npx 0xray health` | Framework health check |
50
+ | `npx 0xray mcp <server>` | Start an MCP server (stdio) |
51
+
52
+ ## Governance
53
+
54
+ xray operates under the three-subsystem model: **Inference** + **External Governance** (Dynamo Solar SSOT) + **Autonomous Engine** (thinDispatch 7-flow in MCP orchestrator). All actions are validated against the Universal Development Codex before execution.
55
+
56
+ **Codex**: `.xray/codex.json` — **68 terms** across all agent interactions.
57
+
58
+ ## thinDispatch Routing
59
+
60
+ - Simple (≤15): Single agent
61
+ - Moderate (≤25): Single agent with tools
62
+ - Complex (≤50): Multi-agent coordination
63
+ - Enterprise (>50): Orchestrator-led team
64
+
65
+ ## AsideContext (v3.2+)
66
+
67
+ Bounded orchestrator subcontexts via `xray-orchestrator` MCP — `spawnAside` / `closeAside` on multi-step tasks. Repertoire memory routing (when enabled) flows through `inheritedContext.memoryRouting`.
68
+
69
+ ## Memory Routing + Repertoire (optional, v3.3+)
70
+
71
+ Configure in `.xray/features.json`:
72
+
73
+ ```json
74
+ "memory_routing": {
75
+ "enabled": true,
76
+ "provider": "repertoire",
77
+ "module_path": "../repertoire/dist/provider/memory-routing-provider.js",
78
+ "config": {
79
+ "signalsPath": "../repertoire/data/curated_signals.json"
80
+ }
81
+ }
82
+ ```
83
+
84
+ Without Repertoire: `{ "enabled": false, "provider": "null" }`.
85
+
86
+ **External MCP** (Hermes/Grok): add Repertoire alongside 0xRay servers:
87
+
88
+ ```json
89
+ "repertoire": {
90
+ "command": "npx",
91
+ "args": ["-y", "@0xray/repertoire", "mcp"]
92
+ }
93
+ ```
94
+
95
+ Tools: `repertoire__get_task_confidence`, `repertoire__get_high_confidence_signals`, `repertoire__search_primitives`, `repertoire__ingest_feedback`.
96
+
97
+ ## Codex OS (always on — not optional)
98
+
99
+ The Universal Development Codex (`.xray/codex.json`, **69 terms**) is enforced by **PreToolUse** (blocks) and this section (brain). MCP enforcer is audit — not the gate.
100
+
101
+ | Term | Rule | Enforcement |
102
+ |------|------|-------------|
103
+ | 11 | No `any`, `@ts-ignore`, `@ts-expect-error` | PreToolUse deny on edits |
104
+ | 29 | Security by design — no `eval()` | PreToolUse deny |
105
+ | 59 | Complex work → orchestrator intake | PreToolUse deny `spawn_subagent` without plan |
106
+ | 67–68 | Best subagents + lead dev ownership | `analyze-complexity` + orchestrator skill |
107
+ | **69** | **No new MCP/skill/handler surface** | PreToolUse deny new `*.server.ts`, `SKILL.md` |
108
+
109
+ `features.json` → `multi_agent_orchestration.no_new_surface` (default **true**). Rewire existing hooks/MCPs/skills — do not add parallel APIs.
110
+
111
+ ## Default operating mode: lead dev (rewired — no new MCP)
112
+
113
+ When the suit is worn, **lead dev mode** is ON via existing config + hooks:
114
+
115
+ | Layer | Existing piece | Rewire |
116
+ |-------|----------------|--------|
117
+ | Config | `features.json` → `multi_agent_orchestration.lead_dev_mode` | Extended, not new block |
118
+ | SessionStart + UserPromptSubmit | Grok hooks → `session-start.js` | Writes `.xray/state/session-boot.json` + `logs/framework/activity.log` |
119
+ | **OS gate** | **PreToolUse hook** | Codex patterns, surface area, spawn gate — `{"decision":"deny"}` + activity.log |
120
+ | Intake + plan | `xray-orchestrator` → **`analyze-complexity`** | Persists `.xray/state/lead-dev-plan.json` |
121
+ | Test triage | PreToolUse hook | Per-suite hint on full `npm test` |
122
+ | Playbook | **`orchestrator`** skill | Codex 59, 67–69 rules |
123
+
124
+ **First substantive task:** `analyze-complexity` with `tasks` array — **required before** `spawn_subagent`. You are the **lead developer**. Users speak in goals, not keywords.
125
+
126
+ | # | Rule |
127
+ |---|------|
128
+ | 1 | Phased plan + detailed todos; assign best subagent; monitor output |
129
+ | 2 | Take the helm — loop test fix until complete; no permission pings |
130
+ | 3 | Per-suite test triage after major changes; full suite last |
131
+ | 4 | Lead stays main thread; subagents execute; update todos continuously |
132
+ | 5 | Read all console and test output; triage fix rerun |
133
+ | 6 | Never defer errors as "pre-existing" — add todo and resolve |
134
+ | 7 | Resolve all errors before phase completion |
135
+
136
+ **Major work:** invoke `researcher` + `architect-tools` + `code-review` before planning/refactors — automatically.
137
+
138
+ ## Skills
139
+
140
+ Full catalog in root **`SKILLS.md`** (shipped on postinstall). **`orchestrator`** skill documents lead-dev mode. Invoke via `@orchestrator` or `xray-skills` MCP (`invoke-skill`, `list-skills`).
141
+
142
+ ## File Organization
143
+
144
+ | File Type | Save To |
145
+ |-----------|---------|
146
+ | Reflections | `docs/reflections/` |
147
+ | Logs | `logs/` |
148
+ | Scripts | `scripts/` or `scripts/bash/` |
149
+ | Test Files | `src/__tests__/` |
150
+ | Source Code | `src/` |
151
+ | Config | `config/` or `.xray/` |
152
+
153
+ ## Documentation
154
+
155
+ | Topic | URL |
156
+ |-------|-----|
157
+ | Getting started | https://0xrayai.github.io/xray/docs/guides/getting-started |
158
+ | Platform integrations | https://0xrayai.github.io/xray/docs/guides/integrations |
159
+ | Features since 3.1 | https://0xrayai.github.io/xray/docs/guides/features-since-3.1 |
160
+ | AsideContext | https://0xrayai.github.io/xray/docs/guides/aside-context |
161
+ | Memory routing | https://0xrayai.github.io/xray/docs/guides/memory-routing |
162
+ | Repertoire | https://0xrayai.github.io/xray/docs/guides/repertoire |
163
+ | Autonomy command | https://0xrayai.github.io/xray/docs/guides/autonomy-command |
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 0xRay Framework Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,120 @@
1
+ # @0xray/repertoire
2
+
3
+ Factory memory organ for [0xRay](https://github.com/0xRayAI/xray): seed primitives, in-process memory routing, extra MCP (not an 8th `xray-*` server).
4
+
5
+ **v0.2.0** · 0xRay **4.0** wear. Runtime does **not** depend on `0xray` (optional peer for suit-verify scripts).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @0xray/repertoire
11
+ ```
12
+
13
+ Does not install `0xray`. After 0xray wear, refresh Grok hooks:
14
+
15
+ ```bash
16
+ npx 0xray grok install --force
17
+ ```
18
+
19
+ Restart Grok MCP sessions — hooks do not hot-reload.
20
+
21
+ ## Suit + autonomy (Grok Build)
22
+
23
+ ```bash
24
+ npm run confirm:suit # post-reboot: Layer 1 + 2a + 2b checklist
25
+ ```
26
+
27
+ **Suit verify from any consumer** (project must have `.xray/` + `0xray` installed):
28
+
29
+ ```bash
30
+ npx repertoire-verify-suit # 30-check harness from any consumer project root
31
+ ```
32
+
33
+ Includes 3.5.0 delegation gate + PostToolUse assertions (steps 11–13). Full harness: clone this repo and `npm run confirm:suit`. Quick check: `npx 0xray health`.
34
+
35
+ Default operating model: **`autonomy-command`** — lead dev, phased todos, subagent dispatch, per-suite test triage. See [AGENTS.md](AGENTS.md) and [xray autonomy guide](https://0xrayai.github.io/xray/docs/guides/autonomy-command).
36
+
37
+ ## MCP server (Hermes, Grok, OpenCode)
38
+
39
+ ```json
40
+ "repertoire": {
41
+ "command": "npx",
42
+ "args": ["-y", "@0xray/repertoire", "mcp"]
43
+ }
44
+ ```
45
+
46
+ Bundled `data/curated_signals.json` is used by default. Override with env:
47
+
48
+ | Env | Default |
49
+ |-----|---------|
50
+ | `CURATED_SIGNALS_PATH` | `<package>/data/curated_signals.json` |
51
+ | `REPERTOIRE_DATA_DIR` | `<package>/data` |
52
+ | `REPERTOIRE_LOG_DIR` | `<package>/logs/groover-inference` |
53
+
54
+ ### Tools
55
+
56
+ | Tool | Purpose |
57
+ |------|---------|
58
+ | `repertoire__get_task_confidence` | Trap detection, complexity boost, `recommendedAgent` |
59
+ | `repertoire__search_primitives` | Text search against curated signals |
60
+ | `repertoire__get_high_confidence_signals` | Validated signals above threshold |
61
+ | `repertoire__ingest_feedback` | Record orchestrator outcomes |
62
+
63
+ ## 0xRay memory routing (in-process)
64
+
65
+ In `.xray/features.json` or `xray/features.json`:
66
+
67
+ ```json
68
+ "memory_routing": {
69
+ "enabled": true,
70
+ "provider": "repertoire",
71
+ "module_path": "node_modules/@0xray/repertoire/dist/provider/memory-routing-provider.js"
72
+ }
73
+ ```
74
+
75
+ `config` is optional when using the bundled registry. For a project-local registry:
76
+
77
+ ```json
78
+ "config": {
79
+ "signalsPath": ".xray/curated_signals.json",
80
+ "logDir": "logs/groover-inference"
81
+ }
82
+ ```
83
+
84
+ Paths in `config` resolve relative to the consumer project root.
85
+
86
+ ## Programmatic import
87
+
88
+ ```ts
89
+ import { createMemoryRoutingProvider } from '@0xray/repertoire/provider/memory-routing-provider';
90
+
91
+ const provider = createMemoryRoutingProvider();
92
+ provider.getTaskConfidence?.({
93
+ id: 'task-1',
94
+ description: 'TYPE: ontological-trap attestation-as-map',
95
+ type: 'governance',
96
+ });
97
+ ```
98
+
99
+ ## Field actuation add-ons (optional)
100
+
101
+ Repertoire has **no Moltbook dependency**. It ingests **enriched JSONL** from any producer (`matched_primitives` + `match_confidence`) and closes the memory loop via consult, feedback, and post-tick ingest.
102
+
103
+ Each project activates its own public field surface if it wants one:
104
+
105
+ | Layer | Required? | Example |
106
+ |-------|-----------|---------|
107
+ | Repertoire + 0xRay memory routing | Core suit | `npm install @0xray/repertoire`, `features.json` |
108
+ | Engage pipeline (`consult → govern → log`) | Per producer | `groover/deploy/engage-core.ts` |
109
+ | Moltbook (or other social API) | **Add-on** | Groover's `deploy/moltbook-*.ts` + `MOLTBOOK_API_KEY` |
110
+
111
+ Jelly, ZigZag, or a custom cron worker can wire the same loop without Moltbook — point `logDir` at your JSONL and set `REPERTOIRE_ROOT`.
112
+
113
+ ## Sibling-repo development
114
+
115
+ ```bash
116
+ git clone https://github.com/0xRayAI/repertoire
117
+ cd repertoire && npm install && npm run build && npm test
118
+ ```
119
+
120
+ See [AGENTS.md](./AGENTS.md) for stack integration details.