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
package/README.md CHANGED
@@ -1,22 +1,24 @@
1
- # xray — MCP-Centric AI Governance OS
1
+ # xray — exo for coding agents
2
2
 
3
- **v3.5.5** — 42 agents · 45 skills · 7 MCP servers · 68 codex terms · 3,226 tests
3
+ **v4.0.0** — a suit that survives the context window. Constitution always on. Temperament scales ceremony. Four host floors. Repertoire is the muscle for handoffs.
4
+
5
+ Not a catalog of agents. The product is the **skeleton you wear**.
4
6
 
5
7
  ## Your AI Power Suit
6
8
 
7
9
  **Your AI Power ⚡️ Suit 🦾** — an exoskeleton that blocks AI slop from becoming real damage.
8
10
 
9
- - learns with **Repertoire** 🧠
10
- - has a **Solar Ban Hammer** ☀️🔨 (Dynamo governance)
11
- - can also **Confer** 🗣️ (3-agent internal deliberation)
12
-
13
- The core AI Governance OS stack is **complete and open source**. A commercial version is next — powers up the suit further.
11
+ - **Bone** — three-subsystem OS: Inference · External Governance (Dynamo / Codex) · Autonomous Engine (thinDispatch)
12
+ - **Always on** — Codex 11 / 29 / 69, destructive shell, no new MCP/skill/handler surface
13
+ - **Temperament** — `frontier` | `guided` | `strict` | `auto` — how loud the engine is, not whether governance exists
14
+ - **Wear** — Grok, OpenCode, Hermes, OpenClaw. One SSOT gate
15
+ - **Muscle** — Repertoire: auto-enables when the module resolves; session-start writes a one-line resume so the next station is not born amnesiac
14
16
 
15
17
  ```bash
16
- npm install 0xray@latest
18
+ npm install 0xray
17
19
  ```
18
20
 
19
- xray is the pure v2 three-subsystem AI orchestration framework — **MCP-centric**, governed by Dynamo, and autonomous via thinDispatch. Consumer `npm install 0xray` auto-wires all four platform bridges and seven MCP servers with zero manual config.
21
+ Consumer `npm install 0xray` auto-wires four platform bridges and seven MCP servers. Repertoire **0.2** is the factory memory organ (vendored): seed primitives, in-process routing, extra host MCP `repertoire`. Not an eighth `xray-*` server. Opt out with `"enabled": false, "provider": "repertoire"`.
20
22
 
21
23
  ## Quick Start
22
24
 
@@ -46,6 +48,7 @@ Docs: [guides/autonomy-command](docs-site/docs/guides/autonomy-command.md) · Sk
46
48
 
47
49
  | Version | Highlights |
48
50
  |---------|------------|
51
+ | **4.0.0** | Exo + temperament. Constitution always on; ceremony by host. Repertoire enable-when-resolves + session resume. Survive the context window — still in development, not on npm yet. [vision](docs-site/docs/architecture/v4-vision.md) · [now](docs-site/docs/architecture/v4-now.md) |
49
52
  | **3.4.1** | Unified `install-bridges.cjs` on postinstall — OpenCode, Grok, Hermes, OpenClaw in one pass. All 7 MCPs servers via `npx -y 0xray mcp <cmd>` (no `dist/` paths). Canonical `release.mjs` pipeline. |
50
53
  | **3.3.1** | Orchestrator confidence gate wired into execution planning. |
51
54
  | **3.3.0** | Pluggable **Memory Routing** (`features.json` → `memory_routing`). Repertoire is the default provider in the framework repo. |
@@ -165,7 +168,7 @@ Pluggable `memory_routing` block in `features.json` (validated by `features.sche
165
168
 
166
169
  **External hosts** (Hermes/Grok): add `repertoire-mcp` to `.mcp.json` — see Repertoire docs.
167
170
 
168
- Consumers without Repertoire: `"memory_routing": { "enabled": false, "provider": "null" }`.
171
+ Opt out: `"memory_routing": { "enabled": false, "provider": "repertoire" }`.
169
172
 
170
173
  Docs: [memory routing](docs-site/docs/guides/memory-routing.md) · [Repertoire](docs-site/docs/guides/repertoire.md) · [features.json](docs-site/docs/guides/features-json.md) · [all features since 3.1](docs-site/docs/guides/features-since-3.1.md)
171
174
 
package/SKILLS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 0xray Skills
2
2
 
3
- **v3.5.5** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
3
+ **v4.0.0** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
4
4
 
5
5
  xray ships 45 knowledge skills (`src/skills/<name>/SKILL.md`) across the full software lifecycle. Lead-dev operating model lives in **`orchestrator`** skill + `multi_agent_orchestration.lead_dev_mode` in features.json. Skills load on demand via the **xray-skills** MCP server (`npx -y 0xray mcp skills`), agent `@mentions`, or platform skill directories after postinstall.
6
6
 
package/dist/AGENTS.md CHANGED
@@ -1,15 +1,23 @@
1
1
  # xray Agents
2
2
 
3
- Quick reference for the xray AI orchestration framework (**v3.5.5**).
3
+ Quick reference for the xray AI orchestration framework (**v4.0.0**).
4
4
 
5
- **42 agents** · **45 skills** · **7 consumer MCP servers** · **68 codex terms** · **3,226 tests**
5
+ **v4.0.0** — a suit that survives the context window.
6
+
7
+ **Exo, not catalog.** Three-subsystem OS (Inference · External Governance · Autonomous Engine) · constitution always on · temperament by host · 4 floors · Repertoire when it resolves.
8
+
9
+ **Temperament:** ceremony (analyze-complexity before spawn, confer) is **guided** by default so free-model OpenCode/Hermes stay in check. Frontier hosts (Grok 4.6 class) with `suit_temperament.profile: auto` **warn** on spawn-without-plan; Codex 11/29/69 still **deny**. Missing `suit_temperament` stays guided. See `docs-site/docs/architecture/v3-from-v2.md`.
10
+
11
+ ## Hot-swap
12
+
13
+ Before other work, Read `.xray/state/STATION.md`. Compaction and host change are the same cut. Continue the card. Do not restart the job. Grok does not inject the card (OpenCode does) — this Read is the Grok contract. Do not thicken the Grok exo.
6
14
 
7
15
  ## What is xray?
8
16
 
9
17
  xray provides intelligent multi-agent orchestration with automatic delegation and Codex compliance validation under the pure v2 three-subsystem model:
10
18
 
11
19
  - **Inference** — proposals, reflection, memory routing (optional)
12
- - **External Governance** — Dynamo Solar SSOT, 68-term Codex
20
+ - **External Governance** — Dynamo Solar SSOT, 69-term Codex
13
21
  - **Autonomous Engine** — thinDispatch 7-flow, AsideContext, confidence gate
14
22
 
15
23
  Agents are declared in `src/opencode/agents/*.yml` — the YML SSOT. Skills live in `src/skills/*/SKILL.md` — see [SKILLS.md](SKILLS.md). Consumer projects receive slimmed copies via postinstall (`AGENTS-consumer.md` → `AGENTS.md`, skills synced to platform dirs).
package/dist/CHANGELOG.md CHANGED
@@ -4,6 +4,71 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Conventional Commits](https://www.conventionalcommits.org/).
6
6
 
7
+ ## [4.0.0] - 2026-08-28
8
+
9
+ First ship of the **temperament** line on the **v2 three-subsystem OS** (Inference · External Governance · Autonomous Engine). npm is still `3.5.5`; this line is **4.0.0** on `feat/v4-temperament` — **still in development, not published**.
10
+
11
+ ### ✨ Features
12
+ - **Factory memory organ** — `@0xray/repertoire@0.2.0` vendored as a runtime dependency. Shipped `memory_routing` is **on** (8 factory primitives). Extra host MCP stays `repertoire`, not an 8th `xray-*` server. Compact ingest writes `.xray/state/repertoire/`. Explicit opt-out: `enabled: false` + `provider: "repertoire"`.
13
+ - **Four-floor compact + memory** — station heat matches Repertoire on every host (not only Grok). Compact on Grok Pre/PostCompact, Hermes session-start, OpenCode plugin boot, OpenClaw PreToolUse keeps intent, Working signals, and `Repertoire: on`.
14
+ - **Suit temperament** — `frontier` | `guided` | `strict` | `auto`. Constitution (Codex 11/29/69, destructive shell) always on. Ceremony (spawn-plan deny, confer, synthesis) scales by host.
15
+ - **Grok 4.6 / Grok Build** — `auto` → frontier: spawn missing/stale/todo-mismatch **warns**; confer off unless opted in.
16
+ - **OpenCode / Hermes** (including free models) — stay **guided**: full v2 engine ceremony.
17
+ - **Upgrade safety** — consumers without `suit_temperament` stay **guided**; postinstall merge will not frontier existing Grok installs.
18
+ - **Codex 69** — in `codex.json` (blocking). PreToolUse already denied new MCP/skill/handler files.
19
+ - **OpenClaw host PreToolUse** — `evaluateOpenClawHostPreTool` SSOT + `~/.openclaw/hooks/xray-pre-tool.mjs` on `0xray openclaw install`. Platform still has no native abort API; this is the host adapter.
20
+ - **Repertoire harness** — leftover `memory_routing` default-off auto-enables when sibling `@0xray/repertoire` or `node_modules/@0xray/repertoire` resolves (install **and** runtime provider load). Explicit `enabled: false` + `provider: repertoire` is opt-out. Consumers without the module stay off. Not an 8th 0xRay MCP.
21
+ - **Repertoire working state** — station heat writes `.xray/state/repertoire-working.json` and a `Working:` line on the card. Compact may ingest non-Bedrock matches. Registry primitives are routing; the working file is session memory.
22
+ - **Session resume** — Grok session-start writes `repertoireResume` (one line, signal count) into `session-boot.json` so the next station survives compaction.
23
+ - **Hot-swap station card** — `.xray/state/STATION.md` is the projection of `session-boot.json` (intent, git, **live** plan, last host, Repertoire). PreCompact/PostCompact persist it. AGENTS.md tells the model to Read it (Grok does not inject). Host change sets `hotSwap`. Same-host compact **keeps** the last swap stamp. OpenClaw first PreToolUse heats the card. Intent strips `<user_query>` wrappers. Works without Repertoire.
24
+ - **Framework dogfood wear** — `installAllBridges` on the 0xRay package still patches `<project>/.grok/hooks/0xray.json` and enable-when-resolves. Does not deploy consumer copies over the package.
25
+ - **Repertoire MCP names** — unprefixed server tools; Grok TUI namespaces them as `repertoire__*`. Grok install resolves sibling *or* `node_modules/@0xray/repertoire`.
26
+ - **Configurable archive marker** — `plan_archive_marker_hours` (default 24) in `features.json`
27
+ - **grok_postprocessor_light** — PostToolUse write-tool marker + activity.log
28
+ - **P2 session capture** — git post-commit → `captureSessionInference` when `inference_session_capture.min_commits` met
29
+ - **Docs** — [4.0 vision](docs-site/docs/architecture/v4-vision.md), [v3 from v2](docs-site/docs/architecture/v3-from-v2.md), [temperament](docs-site/docs/guides/v3-temperament.md), [trim list](docs-site/docs/architecture/v3-museum.md).
30
+
31
+ ### 🔄 Changes
32
+ - Product version **4.0.0** throughout (`package.json`, `features.json`, plugin, banners). 3.x entries below are historical (npm `3.0.0`–`3.5.5`).
33
+ - `evaluatePreToolGate` is constitution-first (Grok, Hermes, OpenCode). Grok PreToolUse no longer re-runs 11/29/69/surface/destructive after the SSOT.
34
+ - Codex 69 denies **new** surface only (existing MCP/skill files may be rewired). `paths[]` / `target_notebook` / `prompt` content are in the SSOT collector.
35
+ - **strict** locks `no_new_surface` on (cannot opt out).
36
+ - Dual-host session-boot: Hermes / OpenCode / OpenClaw write `host` + `suit_profile`. A Hermes host ignores leftover Grok boot (and vice versa). Kernel/`generic` uses last boot.
37
+ - Frontier `auto_consult` follows confer opt-in (`confer.enabled` / `confer_on_synthesis`).
38
+ - Session-boot refreshes leftover host/workspace from another machine.
39
+ - Post-commit log maintenance prefers consumer `node_modules/0xray/dist` and ESM `pathToFileURL`.
40
+
41
+ ### 🐛 Fixes
42
+ - OpenClaw plugin ships in the npm tarball; install resolves `dist` then `src`.
43
+ - Bare `node scripts/node/release.mjs` no longer defaults to patch (that path applied npm `3.5.5` → `3.5.6` over the 4.0 plant). Bump type is required. CJS/MJS loadability syntax-checks version/release/reflection/prepare/setup/CI-report scripts instead of executing them.
44
+ - Postinstall wears OpenClaw PreToolUse (stdin hook + plugin link), not only `0xray openclaw install`.
45
+ - Ephemeral e2e consumers no longer overwrite machine Hermes/OpenClaw `xray-consumer-root.txt`.
46
+ - Hermes postinstall copies hook runtimes; plugin enable prefers `xray-hermes`.
47
+ - OpenClaw install writes `opencode-cli` backend when `opencode` is on PATH (CLI pickle, not Zen HTTP).
48
+ - `0xray grok install` always runs `patchGrokHooks` (command strings, PreCompact/PostCompact) even when the plugin already exists. Stale `args[]` / smoke / blaze paths no longer leave compact cold. Patched JSON is also copied to `<project>/.grok/hooks/0xray.json` — the path Grok TUI actually loads.
49
+ - `buildLeadDevPlan` / `buildSynthesisCheckpointPlan` resolve temperament from `projectRoot`, not `process.cwd()` session-boot. A Grok frontier checkout no longer empties guided confer todos in tmp asides and release-gate verify scripts.
50
+ - Stop committing machine-local `.grok/` (absolute hook paths). Template stays `src/integrations/grok/plugin/0xray`.
51
+ - Grok hook `command` strings quote `XRAY_AI_PATH` and the script path so installs with spaces still start PreToolUse (Grok fail-opens on crash).
52
+ - OpenClaw `maybeHeatHostStation` skips only when both sides have a concrete matching session id. An install card with no session no longer swallows first PreToolUse.
53
+ - `postinstall.cjs` always calls `installAllBridges` (framework dogfood wear is no longer gated out of the production caller).
54
+ - `loadFeatures` forwards `grok_postprocessor_light`; PostToolUse can run the advertised write-tool marker path.
55
+ - `0xray grok install` writes `[mcp_servers.repertoire]` to `<project>/.grok/config.toml` and resolves the sibling from the consumer root.
56
+ - OpenClaw 2026.8.2 handshake uses client id `gateway-client` (not `openclaw-tui`). Control-UI id requires device identity; TUI id is rejected on loopback.
57
+ - OpenClaw e2e falls back to `openclaw agent` when token-only WS lacks `operator.write`. Grok e2e asserts `evaluatePreToolGate` SSOT instead of inlined gate names.
58
+
59
+ ### ✅ Tests
60
+ - `suit-temperament.test.ts`; leftover-plan warn; confer frontier opt-in; install-bridges guided pin; Codex 69 rewrite vs create; strict lock; `paths[]`; dual-host boot.
61
+ - `spawn-plan-stale` after archival in `verify-delegation-gate-core` (6/6); OpenCode host in `release-gate`.
62
+ - OpenClaw PreToolUse unit coverage; live temperament probe across Grok, Hermes, OpenCode, OpenClaw.
63
+ - Wear-layout: plugin/hook resolve, ephemeral marker skip, opencode-cli backend write.
64
+ - `grok-hooks-json`: stale `args[]` smoke hooks gain compact events; station compact keeps `hotSwap`.
65
+ - `autonomy-kernel`: plan consults follow `projectRoot` profile; confer/synthesis verify scripts pass tmp, not cwd Grok boot.
66
+ - Repertoire enable-when-resolves + session-start `repertoireResume` unit coverage.
67
+ - Quoted Grok hook commands; postinstall dogfood wear; OpenClaw install-then-first-tool heat; `grok_postprocessor_light` loadFeatures; project Repertoire `config.toml`.
68
+ - Four-floor compact survival attests Codex 11 / 69 / destructive shell plus temperament after the cut. `XRAY_LIVE_SUCCESSOR=1` asks each host CLI to quote the station card.
69
+
70
+ ---
71
+
7
72
  ## [3.5.5] - 2026-06-20
8
73
 
9
74
  ### ✨ Features
@@ -47,17 +112,6 @@ The format is based on [Conventional Commits](https://www.conventionalcommits.or
47
112
 
48
113
  ---
49
114
 
50
- ## [Unreleased]
51
-
52
- ### Planned (iterate before next release)
53
- - **Configurable archive marker** — `plan_archive_marker_hours` controls `spawn-plan-stale` persistence after archival
54
- - **Verifier coverage** — `spawn-plan-stale` in `verify-delegation-gate-core` (5/5); wired into `release-gate`
55
- - **Post-commit log maintenance** — consumer path fix (`node_modules/0xray/dist`)
56
- - **grok_postprocessor_light** — opt-in marker + activity.log on Grok write tools (full PP subset deferred)
57
- - **P2 session capture** — git post-commit → `captureSessionInference` when threshold met
58
-
59
- ---
60
-
61
115
  ## [3.5.3] - 2026-06-19
62
116
 
63
117
  ### 🔄 Changes
package/dist/README.md CHANGED
@@ -1,22 +1,24 @@
1
- # xray — MCP-Centric AI Governance OS
1
+ # xray — exo for coding agents
2
2
 
3
- **v3.5.5** — 42 agents · 45 skills · 7 MCP servers · 68 codex terms · 3,226 tests
3
+ **v4.0.0** — a suit that survives the context window. Constitution always on. Temperament scales ceremony. Four host floors. Repertoire is the muscle for handoffs.
4
+
5
+ Not a catalog of agents. The product is the **skeleton you wear**.
4
6
 
5
7
  ## Your AI Power Suit
6
8
 
7
9
  **Your AI Power ⚡️ Suit 🦾** — an exoskeleton that blocks AI slop from becoming real damage.
8
10
 
9
- - learns with **Repertoire** 🧠
10
- - has a **Solar Ban Hammer** ☀️🔨 (Dynamo governance)
11
- - can also **Confer** 🗣️ (3-agent internal deliberation)
12
-
13
- The core AI Governance OS stack is **complete and open source**. A commercial version is next — powers up the suit further.
11
+ - **Bone** — three-subsystem OS: Inference · External Governance (Dynamo / Codex) · Autonomous Engine (thinDispatch)
12
+ - **Always on** — Codex 11 / 29 / 69, destructive shell, no new MCP/skill/handler surface
13
+ - **Temperament** — `frontier` | `guided` | `strict` | `auto` — how loud the engine is, not whether governance exists
14
+ - **Wear** — Grok, OpenCode, Hermes, OpenClaw. One SSOT gate
15
+ - **Muscle** — Repertoire: auto-enables when the module resolves; session-start writes a one-line resume so the next station is not born amnesiac
14
16
 
15
17
  ```bash
16
- npm install 0xray@latest
18
+ npm install 0xray
17
19
  ```
18
20
 
19
- xray is the pure v2 three-subsystem AI orchestration framework — **MCP-centric**, governed by Dynamo, and autonomous via thinDispatch. Consumer `npm install 0xray` auto-wires all four platform bridges and seven MCP servers with zero manual config.
21
+ Consumer `npm install 0xray` auto-wires four platform bridges and seven MCP servers. Repertoire **0.2** is the factory memory organ (vendored): seed primitives, in-process routing, extra host MCP `repertoire`. Not an eighth `xray-*` server. Opt out with `"enabled": false, "provider": "repertoire"`.
20
22
 
21
23
  ## Quick Start
22
24
 
@@ -46,6 +48,7 @@ Docs: [guides/autonomy-command](docs-site/docs/guides/autonomy-command.md) · Sk
46
48
 
47
49
  | Version | Highlights |
48
50
  |---------|------------|
51
+ | **4.0.0** | Exo + temperament. Constitution always on; ceremony by host. Repertoire enable-when-resolves + session resume. Survive the context window — still in development, not on npm yet. [vision](docs-site/docs/architecture/v4-vision.md) · [now](docs-site/docs/architecture/v4-now.md) |
49
52
  | **3.4.1** | Unified `install-bridges.cjs` on postinstall — OpenCode, Grok, Hermes, OpenClaw in one pass. All 7 MCPs servers via `npx -y 0xray mcp <cmd>` (no `dist/` paths). Canonical `release.mjs` pipeline. |
50
53
  | **3.3.1** | Orchestrator confidence gate wired into execution planning. |
51
54
  | **3.3.0** | Pluggable **Memory Routing** (`features.json` → `memory_routing`). Repertoire is the default provider in the framework repo. |
@@ -165,7 +168,7 @@ Pluggable `memory_routing` block in `features.json` (validated by `features.sche
165
168
 
166
169
  **External hosts** (Hermes/Grok): add `repertoire-mcp` to `.mcp.json` — see Repertoire docs.
167
170
 
168
- Consumers without Repertoire: `"memory_routing": { "enabled": false, "provider": "null" }`.
171
+ Opt out: `"memory_routing": { "enabled": false, "provider": "repertoire" }`.
169
172
 
170
173
  Docs: [memory routing](docs-site/docs/guides/memory-routing.md) · [Repertoire](docs-site/docs/guides/repertoire.md) · [features.json](docs-site/docs/guides/features-json.md) · [all features since 3.1](docs-site/docs/guides/features-since-3.1.md)
171
174
 
package/dist/SKILLS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 0xray Skills
2
2
 
3
- **v3.5.5** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
3
+ **v4.0.0** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
4
4
 
5
5
  xray ships 45 knowledge skills (`src/skills/<name>/SKILL.md`) across the full software lifecycle. Lead-dev operating model lives in **`orchestrator`** skill + `multi_agent_orchestration.lead_dev_mode` in features.json. Skills load on demand via the **xray-skills** MCP server (`npx -y 0xray mcp skills`), agent `@mentions`, or platform skill directories after postinstall.
6
6
 
@@ -64,6 +64,9 @@ async function installForHermes(options = {}) {
64
64
  frameworkLogger.log('hermes-integration', 'skills-synced', 'info', { count: skillsCopied });
65
65
  }
66
66
  wiring.copyHermesFindProjectRootHelper(packageRoot, targetPluginDir);
67
+ if (wiring.copyHermesHookRuntimes(packageRoot)) {
68
+ frameworkLogger.log('hermes-integration', 'hooks-copied', 'info', {});
69
+ }
67
70
  const wired = wiring.wireHermesBridge(targetDir);
68
71
  console.log(`\x1b[32m✓ Wired Hermes mcp_servers (${wired.count} servers)\x1b[0m`);
69
72
  console.log(`\x1b[32m✓ Consumer root → ${targetDir}\x1b[0m`);
@@ -5,6 +5,7 @@ import { createRequire } from 'module';
5
5
  import { frameworkLogger } from '../../core/framework-logger.js';
6
6
  import { syncBuiltinSkills } from './skill-install.js';
7
7
  import { OpenClawConfigLoader } from '../../integrations/openclaw/config.js';
8
+ import { writeSuitSessionBoot } from '../../nucleus/suit-temperament.js';
8
9
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
9
10
  const require = createRequire(import.meta.url);
10
11
  const wiring = require(path.join(__dirname, '..', '..', '..', 'scripts', 'node', 'bridge-mcp-wiring.cjs'));
@@ -47,6 +48,19 @@ async function installForOpenClaw(options = {}) {
47
48
  const wired = wiring.wireOpenClawBridge(targetDir);
48
49
  console.log(`\x1b[32m✓ Wired OpenClaw MCP servers (${wired.count} via ${wired.method}) → ${wired.path}\x1b[0m`);
49
50
  console.log(`\x1b[32m✓ Consumer root → ${targetDir}\x1b[0m`);
51
+ try {
52
+ writeSuitSessionBoot(targetDir, 'openclaw', { source: '0xray/openclaw-install' });
53
+ }
54
+ catch {
55
+ /* session-boot is best-effort */
56
+ }
57
+ const packageRoot = path.resolve(__dirname, '..', '..', '..');
58
+ const hookInstalled = wiring.installOpenClawHostWear(packageRoot);
59
+ const cliBackend = wiring.maybeWriteOpenClawCliBackend();
60
+ frameworkLogger.log('openclaw-integration', 'cli-backend', 'info', { written: cliBackend });
61
+ if (hookInstalled) {
62
+ console.log(`\x1b[32m✓ OpenClaw PreToolUse hook → ${hookInstalled}\x1b[0m`);
63
+ }
50
64
  console.log('\n✅ 0xRay OpenClaw integration configured!');
51
65
  console.log('Run `openclaw mcp list` to verify MCP servers.');
52
66
  console.log('Edit `.xray/config/openclaw.json` for gateway URL, auth token, and device ID.');
@@ -7,6 +7,7 @@
7
7
  * @since 2026-01-25
8
8
  */
9
9
  import type { MemoryRoutingConfig } from "../memory-routing/types.js";
10
+ import type { SuitHost, SuitProfile, SuitTemperamentConfig } from "../nucleus/suit-temperament.js";
10
11
  export type { MemoryRoutingConfig };
11
12
  export interface TokenOptimizationConfig {
12
13
  enabled: boolean;
@@ -63,7 +64,7 @@ export interface MultiAgentOrchestrationConfig {
63
64
  auto_consult_major_work?: boolean;
64
65
  /** Codex 69 — block new MCP/skill/handler files via PreToolUse (default true) */
65
66
  no_new_surface?: boolean;
66
- /** 3.5.0 — PreToolUse gate after delegate-deferred (default true when lead_dev_mode) */
67
+ /** PreToolUse gate after delegate-deferred (default true when lead_dev_mode) */
67
68
  auto_chain_delegations?: boolean;
68
69
  /** Hours before unstarted lead-dev plan is archived (default 8) */
69
70
  plan_stale_hours?: number;
@@ -81,13 +82,15 @@ export interface MultiAgentOrchestrationConfig {
81
82
  on_synthesis?: boolean;
82
83
  };
83
84
  }
85
+ /** 0xRay 4.0 — nucleus SSOT. See docs-site/docs/guides/v3-temperament.md */
86
+ export type { SuitHost, SuitProfile, SuitTemperamentConfig };
84
87
  /** Reflection triggers merged from legacy auto_reflection when synthesis is configured */
85
88
  export interface SynthesisReflectionConfig {
86
89
  mode?: AutoReflectionConfig['mode'];
87
90
  triggers?: AutoReflectionConfig['triggers'];
88
91
  thresholds?: AutoReflectionConfig['thresholds'];
89
92
  }
90
- /** 3.6.0 — periodic reflect & realign checkpoint (Synthesis PR1) */
93
+ /** Periodic reflect & realign checkpoint (Synthesis) */
91
94
  export interface SynthesisConfig {
92
95
  enabled: boolean;
93
96
  every_n_gates: number;
@@ -399,10 +402,20 @@ export interface FeaturesConfig {
399
402
  auto_reflection?: AutoReflectionConfig;
400
403
  inference?: InferenceConfig;
401
404
  memory_routing?: MemoryRoutingConfig;
405
+ /** P2.2 — lightweight Grok write-tool postprocessor marker */
406
+ grok_postprocessor_light?: boolean;
407
+ /** P2 — git post-commit session inference capture */
408
+ inference_session_capture?: {
409
+ enabled?: boolean;
410
+ min_commits?: number;
411
+ lookback_commits?: number;
412
+ };
402
413
  synthesis: SynthesisConfig;
403
414
  kernel?: KernelConfig;
404
415
  processors?: ProcessorsConfig;
405
416
  enforcement?: EnforcementConfig;
417
+ /** v3 temperament — missing key means guided (existing consumers unchanged) */
418
+ suit_temperament?: SuitTemperamentConfig;
406
419
  }
407
420
  export type TaskType = "file_read" | "grep_search" | "simple_edit" | "bulk_refactor" | "architecture_review" | "security_audit" | "git_operations" | "documentation" | "code_generation" | "debugging" | "unknown";
408
421
  /**
@@ -50,8 +50,8 @@ export declare const AWSLoadBalancerConfigSchema: z.ZodObject<{
50
50
  name: z.ZodString;
51
51
  priority: z.ZodNumber;
52
52
  action: z.ZodEnum<{
53
- allow: "allow";
54
53
  deny: "deny";
54
+ allow: "allow";
55
55
  count: "count";
56
56
  }>;
57
57
  conditions: z.ZodArray<z.ZodObject<{
@@ -19,7 +19,10 @@ export interface GrokInstallOptions {
19
19
  dryRun?: boolean;
20
20
  }
21
21
  export declare function installForGrokCLI(options?: GrokInstallOptions): Promise<void>;
22
+ /** Grok TUI reads <project>/.grok/config.toml, not the package copy. */
23
+ export declare function writeProjectRepertoireMcp(projectRoot: string): string | null;
22
24
  declare const _default: {
23
25
  installForGrokCLI: typeof installForGrokCLI;
26
+ writeProjectRepertoireMcp: typeof writeProjectRepertoireMcp;
24
27
  };
25
28
  export default _default;
@@ -24,8 +24,8 @@ import { syncBuiltinSkills } from '../../cli/commands/skill-install.js';
24
24
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
25
25
  const packageRoot = path.resolve(__dirname, '..', '..', '..');
26
26
  const requireCjs = createRequire(import.meta.url);
27
- const { resolveConsumerTargetDir } = requireCjs(path.join(packageRoot, 'scripts/node/install-bridges.cjs'));
28
- const { XRAY_MCP_SERVERS } = requireCjs(path.join(packageRoot, 'scripts/node/bridge-mcp-wiring.cjs'));
27
+ const { resolveConsumerTargetDir, patchGrokHooks } = requireCjs(path.join(packageRoot, 'scripts/node/install-bridges.cjs'));
28
+ const { XRAY_MCP_SERVERS, resolveRepertoireMcp } = requireCjs(path.join(packageRoot, 'scripts/node/bridge-mcp-wiring.cjs'));
29
29
  function registerGrokMcpServers(targetDir) {
30
30
  try {
31
31
  execSync('which grok', { stdio: 'ignore' });
@@ -90,6 +90,17 @@ export async function installForGrokCLI(options = {}) {
90
90
  if (globalCopied > 0) {
91
91
  console.log(`\x1b[32m✓ Synced ${globalCopied} builtin skills to ~/.grok/skills/\x1b[0m`);
92
92
  }
93
+ pinGrokPluginToInstalledDist(targetPluginDir, packageRoot, targetDir);
94
+ wearGrokHookCommands(targetPluginDir, packageRoot, targetDir);
95
+ const projectPluginDir = path.join(targetDir, '.grok', 'plugins', '0xray');
96
+ if (projectPluginDir !== targetPluginDir) {
97
+ if (!fs.existsSync(projectPluginDir) || options.force) {
98
+ fs.cpSync(sourceDir, projectPluginDir, { recursive: true, force: true });
99
+ }
100
+ pinGrokPluginToInstalledDist(projectPluginDir, packageRoot, targetDir);
101
+ wearGrokHookCommands(projectPluginDir, packageRoot, targetDir);
102
+ }
103
+ writeProjectRepertoireMcp(targetDir);
93
104
  // Attempt auto-trust (best effort)
94
105
  try {
95
106
  execSync(`grok plugins trust "${targetPluginDir}"`, { stdio: 'ignore' });
@@ -106,11 +117,88 @@ export async function installForGrokCLI(options = {}) {
106
117
  console.log('Restart Grok or run `grok` to load the new hooks and MCP servers.');
107
118
  }
108
119
  catch (err) {
109
- frameworkLogger.log('grok-integration', 'install-error', 'error', { error: err.message });
110
- console.error('Failed to install Grok plugin:', err.message);
120
+ const message = err instanceof Error ? err.message : String(err);
121
+ frameworkLogger.log('grok-integration', 'install-error', 'error', { error: message });
122
+ console.error('Failed to install Grok plugin:', message);
111
123
  }
112
124
  frameworkLogger.log('grok-integration', 'install-complete', 'info', {});
113
125
  }
126
+ function wearGrokHookCommands(pluginDir, xrayRoot, targetDir) {
127
+ patchGrokHooks(pluginDir, xrayRoot, targetDir, (label, action, status, details) => {
128
+ const level = status === 'success' ||
129
+ status === 'error' ||
130
+ status === 'info' ||
131
+ status === 'debug' ||
132
+ status === 'warning'
133
+ ? status
134
+ : 'info';
135
+ frameworkLogger.log(label, action, level, details ?? {});
136
+ }, 'grok-install');
137
+ }
138
+ function pinGrokPluginToInstalledDist(pluginDir, xrayRoot, targetDir) {
139
+ const hookJs = path.join(xrayRoot, 'dist/integrations/grok/hooks/pre-tool-use.js');
140
+ const cliJs = path.join(xrayRoot, 'dist/cli/index.js');
141
+ if (!fs.existsSync(hookJs))
142
+ return;
143
+ const hooksPath = path.join(pluginDir, 'hooks', 'hooks.json');
144
+ if (fs.existsSync(hooksPath)) {
145
+ const text = fs.readFileSync(hooksPath, 'utf8');
146
+ fs.writeFileSync(hooksPath, text.split('${XRAY_AI_PATH:-node_modules/0xray}').join(xrayRoot));
147
+ }
148
+ const mcpPath = path.join(pluginDir, '.mcp.json');
149
+ if (fs.existsSync(mcpPath) && fs.existsSync(cliJs)) {
150
+ const mcp = JSON.parse(fs.readFileSync(mcpPath, 'utf8'));
151
+ for (const server of Object.values(mcp.mcpServers ?? {})) {
152
+ if (server.command === 'npx' && Array.isArray(server.args) && server.args.includes('mcp')) {
153
+ const mcpIdx = server.args.indexOf('mcp');
154
+ const mcpCmd = server.args[mcpIdx + 1] ?? 'governance';
155
+ server.command = 'node';
156
+ server.args = [cliJs, 'mcp', mcpCmd];
157
+ }
158
+ }
159
+ const repertoireMcp = resolveRepertoireMcp(targetDir);
160
+ if (mcp.mcpServers) {
161
+ if (repertoireMcp) {
162
+ mcp.mcpServers.repertoire = {
163
+ command: 'node',
164
+ args: [repertoireMcp],
165
+ };
166
+ }
167
+ else {
168
+ delete mcp.mcpServers.repertoire;
169
+ }
170
+ }
171
+ fs.writeFileSync(mcpPath, `${JSON.stringify(mcp, null, 2)}\n`);
172
+ }
173
+ }
174
+ /** Grok TUI reads <project>/.grok/config.toml, not the package copy. */
175
+ export function writeProjectRepertoireMcp(projectRoot) {
176
+ const repertoireMcp = resolveRepertoireMcp(projectRoot);
177
+ if (!repertoireMcp)
178
+ return null;
179
+ const grokDir = path.join(projectRoot, '.grok');
180
+ fs.mkdirSync(grokDir, { recursive: true });
181
+ const tomlPath = path.join(grokDir, 'config.toml');
182
+ const block = `[mcp_servers.repertoire]
183
+ command = "node"
184
+ args = [${JSON.stringify(repertoireMcp)}]
185
+ enabled = true
186
+ `;
187
+ let existing = '';
188
+ if (fs.existsSync(tomlPath)) {
189
+ existing = fs.readFileSync(tomlPath, 'utf8');
190
+ }
191
+ if (/\[mcp_servers\.repertoire\]/.test(existing)) {
192
+ existing = existing.replace(/\[mcp_servers\.repertoire\][\s\S]*?(?=\n\[|$)/, block.trim());
193
+ fs.writeFileSync(tomlPath, existing.endsWith('\n') ? existing : `${existing}\n`);
194
+ }
195
+ else {
196
+ const prefix = existing.trim() ? `${existing.trim()}\n\n` : '';
197
+ fs.writeFileSync(tomlPath, `${prefix}${block}`);
198
+ }
199
+ return tomlPath;
200
+ }
114
201
  export default {
115
202
  installForGrokCLI,
203
+ writeProjectRepertoireMcp,
116
204
  };
@@ -17,9 +17,16 @@ import {
17
17
  getActivePendingDelegations,
18
18
  validateSpawnMatchesTodo,
19
19
  updatePlanTodoStatusInPlace,
20
+ loadDelegationGateFeatures,
20
21
  } from '../../hooks/delegation-gate-runtime.mjs';
21
22
  import { isConferPendingForSession } from '../../hooks/confer-hook-runtime.mjs';
22
23
  import { getActiveUserAsideBoot } from '../../hooks/user-aside-hook-runtime.mjs';
24
+ import {
25
+ applyStationHeat,
26
+ buildRepertoireResume as stationRepertoireResume,
27
+ readExistingBoot,
28
+ writeStationMarkdown,
29
+ } from '../../hooks/station-hook-runtime.mjs';
23
30
 
24
31
  export {
25
32
  checkPendingDelegationGate,
@@ -131,9 +138,20 @@ export function resolveSiblingWorkspaceRoots(root = workspaceRoot()) {
131
138
  }
132
139
  }
133
140
 
141
+ export function buildRepertoireResume(root = workspaceRoot()) {
142
+ return stationRepertoireResume(root);
143
+ }
144
+
134
145
  export function loadFeatures(root = workspaceRoot()) {
135
146
  const featuresPath = resolveFeaturesPath(root);
136
- if (!featuresPath) return { lead_dev_mode: true, no_new_surface: true, per_suite_triage: true };
147
+ if (!featuresPath) {
148
+ return {
149
+ lead_dev_mode: true,
150
+ no_new_surface: true,
151
+ per_suite_triage: true,
152
+ grok_postprocessor_light: false,
153
+ };
154
+ }
137
155
  try {
138
156
  const data = JSON.parse(fs.readFileSync(featuresPath, 'utf8'));
139
157
  const orch = data.multi_agent_orchestration ?? {};
@@ -142,6 +160,7 @@ export function loadFeatures(root = workspaceRoot()) {
142
160
  no_new_surface: orch.no_new_surface !== false,
143
161
  per_suite_test_triage: orch.per_suite_test_triage !== false,
144
162
  auto_chain_delegations: orch.auto_chain_delegations !== false,
163
+ grok_postprocessor_light: data.grok_postprocessor_light === true,
145
164
  sibling_repos: resolveSiblingWorkspaceRoots(root),
146
165
  };
147
166
  } catch {
@@ -150,6 +169,7 @@ export function loadFeatures(root = workspaceRoot()) {
150
169
  no_new_surface: true,
151
170
  per_suite_triage: true,
152
171
  auto_chain_delegations: true,
172
+ grok_postprocessor_light: false,
153
173
  sibling_repos: [],
154
174
  };
155
175
  }
@@ -188,9 +208,11 @@ export function extractToolContext(event) {
188
208
  return { toolName, toolInput, paths, content, cmd: String(toolInput.command || '') };
189
209
  }
190
210
 
191
- export function checkCodexPatterns(content) {
211
+ export function checkCodexPatterns(content, options = {}) {
192
212
  if (!content) return null;
193
- for (const { message, pattern } of CODEX_BLOCK_PATTERNS) {
213
+ const only = Array.isArray(options.terms) ? options.terms : null;
214
+ for (const { message, pattern, terms } of CODEX_BLOCK_PATTERNS) {
215
+ if (only && !terms.some((n) => only.includes(n))) continue;
194
216
  if (pattern.test(content)) return message;
195
217
  pattern.lastIndex = 0;
196
218
  }
@@ -259,16 +281,27 @@ export function buildSessionBootPayload(root, source = '0xray/grok-session-start
259
281
  extra.sessionId || process.env.GROK_SESSION_ID || process.env.GROK_SESSION || null;
260
282
  const conferPending = loadConferPending(root, sessionId);
261
283
  const userAsideBoot = getActiveUserAsideBoot(root, sessionId);
284
+ const gateFeatures = loadDelegationGateFeatures(root, 'grok');
285
+ const frontier = gateFeatures.ceremony === 'lite';
286
+ const existing = readExistingBoot(root);
287
+ const heat = applyStationHeat(root, extra.host || 'grok', extra, existing);
262
288
  return {
263
289
  hook: source,
264
290
  lead_dev_mode: features.lead_dev_mode,
265
291
  no_new_surface: features.no_new_surface,
292
+ host: extra.host || 'grok',
293
+ suit_profile: gateFeatures.suit_profile ?? 'guided',
294
+ ceremony: gateFeatures.ceremony ?? 'full',
295
+ spawn_plan_mode: gateFeatures.spawn_plan_mode ?? 'deny',
266
296
  codexBlockingTermCount: blockingTerms.length,
267
297
  codexTerms: [59, 67, 68, 69],
268
298
  rules: features.lead_dev_mode ? LEAD_DEV_RULES : [],
269
- mcpIntake: 'xray-orchestrator → analyze-complexity (required before spawn_subagent)',
270
- enforcement: 'PreToolUse hook — codex patterns + surface area + spawn gate',
299
+ mcpIntake: frontier
300
+ ? 'xray-orchestrator analyze-complexity optional on frontier (spawn warns, does not deny)'
301
+ : 'xray-orchestrator → analyze-complexity (required before spawn_subagent)',
302
+ enforcement: 'PreToolUse hook — Codex constitution always on; ceremony scales by suit_temperament',
271
303
  workspaceRoot: root,
304
+ ...heat,
272
305
  ...(siblingRoots.length > 0 ? { siblingWorkspaceRoots: siblingRoots } : {}),
273
306
  ...(conferPending ? { conferPending: true, conferTrigger: 'analyze-complexity at synthesis checkpoint' } : {}),
274
307
  ...(userAsideBoot ?? {}),
@@ -276,6 +309,7 @@ export function buildSessionBootPayload(root, source = '0xray/grok-session-start
276
309
  timestamp: new Date().toISOString(),
277
310
  source,
278
311
  ...extra,
312
+ ...heat,
279
313
  };
280
314
  }
281
315
 
@@ -284,19 +318,31 @@ export function writeSessionBoot(root, payload) {
284
318
  const stateDir = path.join(root, '.xray', 'state');
285
319
  fs.mkdirSync(stateDir, { recursive: true });
286
320
  fs.writeFileSync(sessionBootPath(root), JSON.stringify(payload, null, 2));
321
+ writeStationMarkdown(root, payload);
287
322
  return sessionBootPath(root);
288
323
  } catch {
289
324
  return null;
290
325
  }
291
326
  }
292
327
 
293
- /** Boot on SessionStart, UserPromptSubmit, or first PreToolUse if missing. */
328
+ export function sessionBootNeedsRefresh(existing, root) {
329
+ if (!existing || typeof existing !== 'object') return true;
330
+ if (existing.lead_dev_mode === undefined) return true;
331
+ if (existing.host !== 'grok') return true;
332
+ if (!existing.suit_profile) return true;
333
+ if (existing.workspaceRoot && existing.workspaceRoot !== root) return true;
334
+ if (!existing.repertoireResume) return true;
335
+ if (!existing.stationLine) return true;
336
+ return false;
337
+ }
338
+
339
+ /** Boot on SessionStart, UserPromptSubmit, or first PreToolUse if missing/stale. */
294
340
  export function ensureSessionBoot(root = workspaceRoot(), source = '0xray/grok-boot') {
295
341
  const bootPath = sessionBootPath(root);
296
342
  if (fs.existsSync(bootPath)) {
297
343
  try {
298
344
  const existing = JSON.parse(fs.readFileSync(bootPath, 'utf8'));
299
- if (existing.lead_dev_mode !== undefined) return bootPath;
345
+ if (!sessionBootNeedsRefresh(existing, root)) return bootPath;
300
346
  } catch {
301
347
  /* rewrite corrupt boot */
302
348
  }