0xray 4.0.20 → 4.0.22

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 (74) hide show
  1. package/.grok-plugin/plugin.json +1 -1
  2. package/.opencode/skills/hermes-agent/SKILL.md +1 -1
  3. package/.opencode/skills/orchestrator/SKILL.md +23 -1
  4. package/.xray/features.json +1 -1
  5. package/AGENTS-consumer.md +15 -15
  6. package/AGENTS.md +12 -12
  7. package/README.md +40 -40
  8. package/SKILLS.md +4 -4
  9. package/dist/AGENTS.md +12 -12
  10. package/dist/CHANGELOG.md +91 -8
  11. package/dist/README.md +40 -40
  12. package/dist/SKILLS.md +4 -4
  13. package/dist/cli/commands/validate.d.ts +1 -1
  14. package/dist/cli/commands/validate.js +7 -1
  15. package/dist/governance/governance-core.d.ts +2 -1
  16. package/dist/governance/governance-core.js +20 -11
  17. package/dist/governance/governance-service.js +9 -7
  18. package/dist/inference/inference-cycle.js +22 -5
  19. package/dist/integrations/cursor/README.md +7 -6
  20. package/dist/integrations/cursor/hooks/after-file-edit.sh +3 -0
  21. package/dist/integrations/cursor/hooks/before-read-file.sh +3 -0
  22. package/dist/integrations/cursor/hooks/before-shell-execution.sh +3 -0
  23. package/dist/integrations/cursor/hooks/cursor-hook-utils.js +112 -12
  24. package/dist/integrations/cursor/hooks/cursor-usage-receipt.js +3 -0
  25. package/dist/integrations/cursor/hooks/hooks.json +13 -3
  26. package/dist/integrations/cursor/hooks/pre-compact.js +9 -0
  27. package/dist/integrations/cursor/hooks/pre-compact.sh +3 -0
  28. package/dist/integrations/cursor/hooks/pre-tool-use.js +17 -12
  29. package/dist/integrations/cursor/hooks/pre-tool-use.sh +3 -0
  30. package/dist/integrations/cursor/hooks/xray-cloud-hook.sh +63 -0
  31. package/dist/integrations/grok/hooks/grok-hook-utils.js +3 -2
  32. package/dist/integrations/hooks/station-hook-runtime.cjs +310 -98
  33. package/dist/integrations/hooks/station-hook-runtime.mjs +10 -0
  34. package/dist/integrations/hooks/station-memory-ingest.mjs +4 -3
  35. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  36. package/dist/memory-routing/provider-loader.d.ts +3 -1
  37. package/dist/memory-routing/provider-loader.js +3 -1
  38. package/dist/nucleus/suit-temperament.d.ts +0 -5
  39. package/dist/nucleus/suit-temperament.js +13 -1
  40. package/dist/nucleus/thin-dispatch.js +11 -2
  41. package/dist/processors/implementations/agents-md-validation-processor.js +1 -1
  42. package/dist/skills/hermes-agent/SKILL.md +1 -1
  43. package/dist/skills/orchestrator/SKILL.md +23 -1
  44. package/llms.txt +1 -1
  45. package/package.json +3 -3
  46. package/scripts/foundry/CHANGELOG.md +2 -0
  47. package/scripts/foundry/README.md +4 -4
  48. package/scripts/foundry/assert-packed-dist-cli.mjs +4 -0
  49. package/scripts/foundry/cli.mjs +1 -1
  50. package/scripts/foundry/inspect.mjs +160 -5
  51. package/scripts/foundry/plant/skills/inspect/SKILL.md +2 -0
  52. package/scripts/foundry/plant/skills/mill/SKILL.md +1 -1
  53. package/scripts/foundry/validate-release-docs.mjs +48 -0
  54. package/scripts/foundry/version-manager.mjs +127 -7
  55. package/scripts/mjs/test-consumer-readiness.mjs +10 -3
  56. package/scripts/node/install-bridges.cjs +256 -10
  57. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  58. package/src/skills/hermes-agent/SKILL.md +1 -1
  59. package/src/skills/orchestrator/SKILL.md +23 -1
  60. package/vendor/@0xray/repertoire/data/stack-overlay.json +154 -1
  61. package/vendor/@0xray/repertoire/dist/RepertoireService.js +7 -6
  62. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.js +10 -11
  63. package/vendor/@0xray/repertoire/dist/paths.js +66 -4
  64. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js +54 -14
  65. package/xray/agents_template.md +10 -5
  66. package/xray/features.json +1 -1
  67. package/dist/mcps/shared/prompt-security-validator.d.ts +0 -44
  68. package/dist/mcps/shared/prompt-security-validator.js +0 -148
  69. package/dist/mcps/shared/security-scanner.d.ts +0 -119
  70. package/dist/mcps/shared/security-scanner.js +0 -429
  71. package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
  72. package/dist/scripts/activate-kernel-pipeline.js +0 -101
  73. package/src/mcps/shared/prompt-security-validator.ts +0 -199
  74. package/src/mcps/shared/security-scanner.ts +0 -599
@@ -59,7 +59,9 @@ function defaultPathForProvider(provider, cwd) {
59
59
  export function isExplicitMemoryRoutingOptOut(config) {
60
60
  return config.enabled === false && config.provider === 'repertoire';
61
61
  }
62
- /** Leftover shipped default: enabled false + provider null. Not an explicit opt-out. */
62
+ /** Leftover shipped default: enabled false + provider null. Not an explicit opt-out.
63
+ * resolveLeftoverEnabledConfig migrates old tarballs when the organ is on disk.
64
+ * Explicit opt-out is enabled: false + provider: repertoire. */
63
65
  export function isLeftoverMemoryRoutingOff(config) {
64
66
  if (config.enabled === true)
65
67
  return false;
@@ -27,11 +27,6 @@ export declare function resolveSuitProfile(raw: SuitTemperamentConfig | undefine
27
27
  * A Hermes/OpenCode host ignores a leftover Grok boot (and vice versa).
28
28
  */
29
29
  export declare function resolveRuntimeSuitProfile(projectRoot: string, host?: SuitHost): SuitProfile;
30
- /**
31
- * Write station heat when this host/session has no live card yet.
32
- * OpenClaw has no SessionStart — PreToolUse is the session boundary.
33
- * Install/init cards without a session id are not a live session.
34
- */
35
30
  export declare function maybeHeatHostStation(projectRoot: string, host: SuitHost, extra?: Record<string, unknown>): string | null;
36
31
  /** Merge temperament fields into session-boot.json for the host that just started. */
37
32
  export declare function writeSuitSessionBoot(projectRoot: string, host: SuitHost, extra?: Record<string, unknown>): string;
@@ -95,7 +95,13 @@ function concreteSessionId(value) {
95
95
  * OpenClaw has no SessionStart — PreToolUse is the session boundary.
96
96
  * Install/init cards without a session id are not a live session.
97
97
  */
98
+ function isCursorWorkspaceWrapper(projectRoot) {
99
+ return (fs.existsSync(path.join(projectRoot, 'repos', 'xray')) ||
100
+ fs.existsSync(path.join(projectRoot, 'repos', 'repertoire')));
101
+ }
98
102
  export function maybeHeatHostStation(projectRoot, host, extra = {}) {
103
+ if (isCursorWorkspaceWrapper(projectRoot))
104
+ return null;
99
105
  const bootPath = path.join(projectRoot, '.xray', 'state', 'session-boot.json');
100
106
  const cardPath = path.join(projectRoot, '.xray', 'state', 'STATION.md');
101
107
  let existing = {};
@@ -124,8 +130,14 @@ export function maybeHeatHostStation(projectRoot, host, extra = {}) {
124
130
  export function writeSuitSessionBoot(projectRoot, host, extra = {}) {
125
131
  const profile = resolveSuitProfile(loadSuitTemperamentRaw(projectRoot), host);
126
132
  const stateDir = path.join(projectRoot, '.xray', 'state');
127
- fs.mkdirSync(stateDir, { recursive: true });
128
133
  const bootPath = path.join(stateDir, 'session-boot.json');
134
+ try {
135
+ fs.mkdirSync(stateDir, { recursive: true });
136
+ }
137
+ catch {
138
+ /* Cloud workspace wrapper is often unwritable — fail open */
139
+ return bootPath;
140
+ }
129
141
  let existing = {};
130
142
  if (fs.existsSync(bootPath)) {
131
143
  try {
@@ -7,7 +7,7 @@
7
7
  * Import from here or from delegation/index.ts (which re-exports these).
8
8
  */
9
9
  import { frameworkLogger } from "../core/framework-logger.js";
10
- import { getLevelFromScore, getAgentForTier, levelToTier, } from "../delegation/complexity-core.js";
10
+ import { getLevelFromScore, getAgentForTier, getAgentCountForLevel, getStrategyForLevel, levelToTier, } from "../delegation/complexity-core.js";
11
11
  import { ComplexityAnalyzer } from "../delegation/complexity-analyzer.js";
12
12
  import { getMemoryRoutingProviderSync, initializeMemoryRouting, } from "../memory-routing/index.js";
13
13
  initializeMemoryRouting();
@@ -18,6 +18,9 @@ export const NUCLEUS_THIN_DISPATCH_VERSION = "0.1.0";
18
18
  */
19
19
  export function scoreComplexity(operation, context, thresholds) {
20
20
  const analyzer = new ComplexityAnalyzer();
21
+ if (thresholds) {
22
+ analyzer.setThresholds(thresholds);
23
+ }
21
24
  const metrics = analyzer.analyzeComplexity(operation, context);
22
25
  const score = analyzer.calculateComplexityScore(metrics);
23
26
  frameworkLogger.log("nucleus-thin-dispatch", "score-complexity", "info", {
@@ -76,7 +79,13 @@ export function scoreAndRoute(operation, context, thresholds) {
76
79
  signals: resolved.context.matchedSignals,
77
80
  });
78
81
  return {
79
- score: { ...score, score: resolved.adjustedScore, level: adjustedLevel },
82
+ score: {
83
+ ...score,
84
+ score: resolved.adjustedScore,
85
+ level: adjustedLevel,
86
+ recommendedStrategy: getStrategyForLevel(adjustedLevel),
87
+ estimatedAgents: getAgentCountForLevel(adjustedLevel),
88
+ },
80
89
  agent,
81
90
  memoryRouting,
82
91
  };
@@ -224,7 +224,7 @@ export class AgentsMdValidationProcessor {
224
224
  "",
225
225
  "## Codex",
226
226
  "",
227
- `0xRay enforces Universal Development Codex (60 terms) for systematic error prevention.`,
227
+ `0xRay enforces Universal Development Codex (69 terms) for systematic error prevention.`,
228
228
  "",
229
229
  ].join("\n"),
230
230
  "## CLI Commands": [
@@ -64,7 +64,7 @@ Returns: pass/fail with per-file results and violations.
64
64
 
65
65
  ### xray_codex_check
66
66
 
67
- Validate code against the 60-term Universal Development Codex. Checks error-handling, type-safety, performance, security, architecture.
67
+ Validate code against the 69-term Universal Development Codex. Checks error-handling, type-safety, performance, security, architecture.
68
68
 
69
69
  ```
70
70
  xray_codex_check(code="const x: any = foo()", operation="create")
@@ -64,6 +64,10 @@ Config: `features.json` → `multi_agent_orchestration.lead_dev_mode`
64
64
 
65
65
  The seven rules are the engine. The cadence is the time signature. Disk SSOT: `grok-bot/ops/LEAD-CADENCE.md`.
66
66
 
67
+ Jargon is not the job. Review and cadence ask whether the change works. Do not spend the loop reciting dest names, mill liturgy, or host mantras.
68
+
69
+ - **Feat rebase:** when the mandated work turns into mantra, or the job has split across planes that no longer share one present, stop. Go up a level and answer the original message again from this seat. Do not continue the side thread and call that the job.
70
+
67
71
  - **Peer test:** another instance with only worn 0xRay continues the ticket. No command stream.
68
72
  - **Wear first:** Read `.xray/state/STATION.md`. Same cloud. Same critic (resume only). Dummy Reads Station.
69
73
  - **Dummy tests `SKILLS.md`:** a suited dummy proves the worn catalog. Same-sess bodies keep context and hold a Station card.
@@ -73,8 +77,26 @@ The seven rules are the engine. The cadence is the time signature. Disk SSOT: `g
73
77
  - **Live tick, not pacer:** `/loop` runs work now. Keep workstreams moving. Do not idle-wait 12 minutes. **Clean ticks every cycle** — unsubscribe then resubscribe so the prompt matches metal. Name-dedupe does not rewrite. A stale prompt (waiting URL after live, Hold after strip) is dirty: rewrite, do not act. **If the card and WAVEBOARD are idle, unsubscribe and do not resubscribe.**
74
78
  - **Board clock:** PR events + resume the same critic. Not two idle pacers. Merge after PASS+CI (gate A). Publish only after mill-gate D + `foundry gate`.
75
79
  - **Dispatch:** ticket + PR URLs + “Wear, then review.” The critic Reads `SEATS.md` Reviewer. Do not paste a command novel. When a law is spoken twice, encode it this wake.
80
+ - **Cascade:** Chat is not the brain. A cascade that must survive compaction is a named repertoire signal on the stack overlay, hydrated onto the project law list. NOTES holds the same cascade for the second Read. Station stays the ticket. A reflection is not this capture. Capture priority: a law is an invariant you would otherwise re-read the source to relearn. One law per subsystem bone. Heat touches last_seen and does not append a confidence sample, so more hits do not raise conviction. Heat touches last_seen only when the diary contains that signal's name; two definition words are not a hit; a weak session score is not lifted to 0.55 and a sample below 0.55 is not recorded. Constructing the organ does not append workspace samples. Hero names: `heat-is-not-conviction`, `inference-cycle-invariant`, `governance-vote-invariant`, `thin-dispatch-invariant`. Repertoire mergeStackOverlay refreshes a changed stack definition and keeps observation stats.
81
+ - **Cold brief:** a new critic or any new subagent that does not already have this thread gets the latest commit SHA on the branch under review (fetch it; do not reuse an earlier SHA from a previous pass) and the Station card (`.xray/state/STATION.md`: intent, plan, git). If the card is missing, give branch + HEAD + what just changed. If the branch moves after you brief them, send the new SHA before they verdict.
82
+ - **Control:** The lead keeps control. Do not assume the subagent has the context. Give the duty, the latest SHA, the Station card, and the laws that apply. The subagent wears the applicable 0xRay suit before it works: the tree under review, built and installed. An older published package is not that suit. The lead checks the result.
83
+
84
+ ### Engine cadence
85
+
86
+ This suite is the engine that builds the engine. When a seat sees OP-PROC, write it onto these existing surfaces in the same wake. Do not open a new skill.
87
+
88
+ 1. Change the engine with precision.
89
+ 2. Ship it local: build and install the tree. A live npm version stays live. Once a version is live, the stamper strips every present-tense patch pin from shipped guides and shipped OP-PROC, or reconcile advances the next cut. The stamper does not edit Station, NOTES, dest, or node_modules. It does not publish.
90
+ 3. Test the change.
91
+ 4. Run another deep review of the diff you just made.
92
+ 5. Monitor long-term memory (dest name count and whether observations are the only growth) and short-term memory (Station: intent, plan, git).
93
+ 6. Ship the PR.
94
+
95
+ ### Planes
96
+
97
+ Operating planes: code, OP-PROC, model, suit, mill, host, and test/ship. Test/ship is the critical OP-PROC plane. Test then ship is the hero. Ship without that proof is the catastrophe. Long-term memory is the project law list. Each wake refreshes a changed stack definition and keeps observation stats. Heat writes the matched names onto Station, the short-term card that survives compaction. Reactive decisions move out of TypeScript into OP-PROC as the model improves. That move is why the mill and the suit exist. It is not fully proved. Once a version is live, the stamper strips every present-tense patch pin from shipped guides and shipped OP-PROC, or reconcile advances the next cut. The stamper does not edit Station, NOTES, dest, or node_modules. It does not publish. Do not freeze the live cut.
76
98
  - **Close:** loop until Station is done. Compact: Station survives the cut. Overlay dest names are OP-PROC — reload `repertoire-working.json` `opProcNames`, not Station.
77
99
  - **Board:** critic Strict comments; forge implements; lead stays main thread.
78
100
  - **Codex 69:** rewire this skill and existing ops. Do not add a new `SKILL.md` to hold the cadence.
79
- - **Ship matrix:** `LEAD-CADENCE.md` Decision matrix — A PR+CI · B pack · C `release:docs-check` · D `foundry release --i-mean-it`. Green CI is not ship. Spend / credentials stay Ask-first.
101
+ - **Ship matrix:** `LEAD-CADENCE.md` Decision matrix — A PR+CI · B pack · C `release:docs-check` (`reconcile --check`; no patch stamps on guides) · D `foundry release --i-mean-it`. Green CI is not ship. Spend / credentials stay Ask-first. Patch number lives in `package.json` + CHANGELOG.
80
102
  - **Metamorphosis:** LLM → OP-PROC is in-context worn seats (same critic, same dummy, resume only). Not more bots.
package/llms.txt CHANGED
@@ -35,7 +35,7 @@ Registered in `.mcp.json` as `npx -y 0xray mcp <cmd>`:
35
35
  | `xray-code-review` | Proposal quality |
36
36
  | `xray-architect-tools` | System design |
37
37
 
38
- Not an 8th `xray-*` server. Repertoire is a vendored organ (`npx @0xray/repertoire mcp`), enable-when-resolves. Survive compact is **Station** (Read `.xray/state/STATION.md`), not Repertoire 0.1.8.
38
+ Not an 8th `xray-*` server. **Repertoire is preferred** — vendored 0.2.5 ships on (`npx @0xray/repertoire mcp`). Dest is named laws, not hangar `repo-*` or git slugs. Survive compact is **Station** (Read `.xray/state/STATION.md`). Station is the ticket, not a substitute for Repertoire. Do not pin 0.1.8.
39
39
 
40
40
  ## Codex 69 (always on)
41
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0xray",
3
- "version": "4.0.20",
3
+ "version": "4.0.22",
4
4
  "description": "Multi-agent orchestration and Codex governance for OpenCode, Hermes, Grok Build, and OpenClaw",
5
5
  "readme": "README.md",
6
6
  "license": "MIT",
@@ -106,7 +106,7 @@
106
106
  "debug:inference:force": "XRAY_FORCE_MCP_GOVERNANCE=true XRAY_DEV_PATH=dist node dist/cli/index.js inference:run --force",
107
107
  "validate:full": "npm run validate",
108
108
  "test:unified": "node scripts/test/test-unified-framework.mjs",
109
- "test:consumer": "node scripts/test/test-consumer-readiness.cjs",
109
+ "test:consumer": "node scripts/mjs/test-consumer-readiness.mjs",
110
110
  "config:setup": "node scripts/config/utils.js setup-dev",
111
111
  "monitoring:start": "node scripts/monitoring/daemon.js start",
112
112
  "monitoring:stop": "node scripts/monitoring/daemon.js stop",
@@ -124,7 +124,7 @@
124
124
  "consumer:smoke": "node scripts/node/consumer-install-smoke.mjs",
125
125
  "pack:tmp-proof": "node scripts/node/pack-tmp-suit-proof.mjs",
126
126
  "release:gate": "node scripts/foundry/release-gate.mjs",
127
- "release:docs-check": "node scripts/foundry/validate-release-docs.mjs",
127
+ "release:docs-check": "node scripts/foundry/reconcile-version.mjs --check && node scripts/foundry/validate-release-docs.mjs",
128
128
  "pre-publish-guard": "node scripts/node/pre-publish-guard.js",
129
129
  "safe-publish": "npm run prepare-consumer && npm run build",
130
130
  "release:npm": "node scripts/foundry/release.mjs --publish-only",
@@ -4,6 +4,8 @@
4
4
 
5
5
  Shim `sound-voice.cjs` → `@0xray/blip/sound-voice`. Depend on published `@0xray/blip@^0.1.2`. Foundry stamp stays 0.1.12. Do not vendor mill drawers.
6
6
 
7
+ Inspect `--go` emits a shop-style forge GO receipt (harness profile: bare / suited / partial). Observational by default: Cursor/Grok `hooks.json` bound, Repertoire fastened (`node_modules` or `.xray/state/repertoire`), Station present. `--require-harness=` gates dual-cloud A/B. Vendor Repertoire source and `memory_routing` declaration are not fasten. Not an 8th MCP. Not PPE. Not 5.0.
8
+
7
9
  ## [0.1.12] - 2026-09-18
8
10
 
9
11
  Fasten is foundry-plant/0: mill packages declare plants in package.json (`mill.protocol`, prefix selection when skills/agents are omitted) and foundry copies organs from that package. Builtin catalog is mill+inspect only; foundry does not catalog mill organs. `foundry.json` `"plant": "blip"|"sound"` are package aliases for `@0xray/blip`, not skill lists. Unknown mill packages fail closed (`npm i`). Inventory records `millPackage` and `millProtocol` when a mill package was used.
@@ -23,7 +23,7 @@ npx @0xray/foundry release [patch|minor|major] --i-mean-it
23
23
  npx @0xray/foundry release --publish-only --dry-run
24
24
  npx @0xray/foundry release --publish-only --i-mean-it
25
25
  npx @0xray/foundry mint
26
- npx @0xray/foundry inspect [--skip-live]
26
+ npx @0xray/foundry inspect [--skip-live] [--go] [--go-out PATH] [--require-harness=bare|suited|partial]
27
27
  npx @0xray/foundry sound render [--brief TEXT] [--genre ambient|techno|jazz]
28
28
  npx @0xray/foundry sound inspect
29
29
  npx @0xray/foundry sound mix
@@ -39,7 +39,7 @@ npx @0xray/foundry hooks
39
39
 
40
40
  `FOUNDRY_ROOT` overrides cwd (the repo being milled).
41
41
 
42
- `gate` is build + test + docs-check. `docs-build` runs Docusaurus on the 0xray exo (`docs-site/`); stranger mills skip. `inspect` runs the six mill checks (diff, plant vs worn, receipt, CI, live tarball GET, isolated HOME). Mint fails on a costume dump. Isolated HOME skips machine `~/.grok`. Shared HOME last-mile dest is project `.grok/plugins/0xray` (no last-wins machine plugin). `ci` reports GitHub Actions (no auto-push). `hooks` installs git pre/post hooks. GitHub `0xRay CI/CD` is the mill gate on `main`. `Deploy Docs` is the mill Pages put.
42
+ `gate` is build + test + docs-check. `docs-build` runs Docusaurus on the 0xray exo (`docs-site/`); stranger mills skip. `inspect` runs the six mill checks (diff, plant vs worn, receipt, CI, live tarball GET, isolated HOME) plus observational harness (Cursor/Grok hooks bound, Repertoire fastened, Station present). `--go` emits a shop-style forge GO receipt; `--require-harness=bare|suited|partial` turns that observation into a gate. Mint fails on a costume dump. Isolated HOME skips machine `~/.grok`. Shared HOME last-mile dest is project `.grok/plugins/0xray` (no last-wins machine plugin). `ci` reports GitHub Actions (no auto-push). `hooks` installs git pre/post hooks. GitHub `0xRay CI/CD` is the mill gate on `main`. `Deploy Docs` is the mill Pages put.
43
43
 
44
44
  `docs-check` and `gate` run **full** 0xRay corpus only when the milled `package.json` name is `0xray` and `docs-site/` exists. Otherwise **light**: `package.json` + CHANGELOG.
45
45
 
@@ -60,7 +60,7 @@ After mill plant is fastened, overlay their plant (defaults; remap in `foundry.j
60
60
 
61
61
  **Mill-fill is law:** their keys/files win; mill names they did not plant stay unless they overlay the same name. JSON facets always merge. Skill overlay is project dirs on every TUI floor (OpenCode, Grok, Hermes, OpenClaw). YML agents stay OpenCode. CLI re-wear calls mint **once** after mill copies. Isolated HOME is passwd home, not `os.homedir()`. CI report is `.xray/foundry-ci-report.json` (`.opencode/logs` shim).
62
62
 
63
- **Default mill plant:** `mill` + `inspect` (inspect AI work). Fasten is **foundry-plant/0**: builtin plant is mill+inspect only (files from this package `plant/`). Fastens a suit, not an empty one. Not 45/42 costume. `foundry.json` `"costume": true` copies that dump. Factory Repertoire still enable-when-resolves. PPE stays worn.
63
+ **Default mill plant:** `mill` + `inspect` (inspect AI work). Fasten is **foundry-plant/0**: builtin plant is mill+inspect only (files from this package `plant/`). Fastens a suit, not an empty one. Not 45/42 costume. `foundry.json` `"costume": true` copies that dump. **Repertoire is preferred** (vendored, dest = laws). PPE stays worn.
64
64
 
65
65
  **foundry-plant/0:** `foundry.json` `"plant": "@0xray/blip"` (aliases `"plant": "blip"` / `"plant": "sound"`) fastens whatever that mill package declares and ships in its own `plant/`. Organs (looker, vibe, mixer) live in the mill. Adding an organ is a mill publish, not a foundry catalog PR. CLI shims `foundry blip|sound` still exist on foundry 0.1.11+; fasten is the new cut. Foundry **0.1.12**.
66
66
 
@@ -76,7 +76,7 @@ A friend would hear: Blips should look like Rippel living motions with sound, no
76
76
 
77
77
  **Shop plant:** `shop-extract`, `shop-witness`, `shop-pin` are first-class with mill plant. Inspect does not treat those worn names as a costume dump. `foundry.json` `"shopPlant"` names more shops (array), a plant dir (string), or `{ "skills": [...], "dir": "..." }`. This is not `"costume": true` and does not copy 45/42.
78
78
 
79
- **4.0.9 mill target (0xray postinstall, not this mill package):** `install-bridges.cjs` does not mill npm global prefix or npx `_npx` as a consumer. Isolated HOME skips machine `~/.grok`. Shared HOME Grok last-mile is project `.grok/plugins/0xray` (two seats do not clobber machine plugin). Nested mill **0.1.12** (foundry-plant/0; blip/sound drawers in `@0xray/blip`; inspect dest matches `resolveGrokPluginDests`).
79
+ **Mill target (0xray postinstall, not this mill package):** `install-bridges.cjs` does not mill npm global prefix or npx `_npx` as a consumer. Isolated HOME skips machine `~/.grok`. Shared HOME Grok last-mile is project `.grok/plugins/0xray` (two seats do not clobber machine plugin). Nested mill ships in the 0xray tarball (foundry-plant/0; blip/sound drawers in `@0xray/blip`; inspect dest matches `resolveGrokPluginDests`).
80
80
 
81
81
  ## Publish this mill
82
82
 
@@ -24,6 +24,10 @@ export const REQUIRED_PACK_PATHS = [
24
24
  "dist/integrations/cursor/hooks/after-file-edit.js",
25
25
  "dist/integrations/cursor/hooks/cursor-hook-utils.js",
26
26
  "dist/integrations/cursor/hooks/cursor-usage-receipt.js",
27
+ "dist/integrations/cursor/hooks/xray-cloud-hook.sh",
28
+ "dist/integrations/cursor/hooks/pre-tool-use.sh",
29
+ "dist/integrations/cursor/hooks/pre-compact.sh",
30
+ "dist/integrations/cursor/hooks/after-file-edit.sh",
27
31
  ];
28
32
 
29
33
  export function packedFilePaths(files) {
@@ -29,7 +29,7 @@ const HELP =
29
29
  "Mill, not exo. FOUNDRY_ROOT overrides cwd (the repo being milled).\n" +
30
30
  "release bumps/commits/pushes/publishes the milled cwd — pass --dry-run or --i-mean-it (or FOUNDRY_RELEASE=1).\n" +
31
31
  "Mint fastens the requested factory plant (default mill; foundry.json plant: sound|blip turns mill off), then inspect.\n" +
32
- "inspect runs mill checks plus, on a sound seat, last bed receipt PASS/FAIL; on a blip seat, last blip receipt.\n" +
32
+ "inspect runs mill checks plus, on a sound seat, last bed receipt PASS/FAIL; on a blip seat, last blip receipt. Observational harness (hooks / Repertoire / Station). --go emits a forge GO receipt. Not an 8th MCP.\n" +
33
33
  "sound render|inspect|mix is the factory-sound plant (brief → seed → genre → wav → metrics; mix levels every variation). Sibling to mill, not a mill copy.\n" +
34
34
  "blip render|inspect|vibe|look is the factory-blip plant (brief → seed → still|motion:<id> → 4.44s mp4; vibe is stamp density, look is the friend hitting replay, ship bar 8). Sibling to mill + sound.\n" +
35
35
  "gate is build+test. docs-build is Docusaurus on the 0xray exo. ci reports GitHub Actions (no auto-push). hooks installs git pre/post hooks.\n";
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Mill inspect organ. Runs the six checks. Not an 8th MCP. Not PPE.
3
+ * Mill inspect organ. Runs the six plant checks plus observational harness.
4
+ * Not an 8th MCP. Not PPE. Does not fasten hooks or Repertoire.
4
5
  *
5
- * npx @0xray/foundry inspect [--skip-live]
6
+ * npx @0xray/foundry inspect [--skip-live] [--go] [--go-out PATH]
7
+ * [--require-harness=bare|suited|partial] [--goal TEXT]
6
8
  */
7
9
 
8
10
  import { spawnSync } from "node:child_process";
@@ -63,6 +65,140 @@ function readJson(file) {
63
65
  }
64
66
  }
65
67
 
68
+ const HARNESS_PROFILES = new Set(["bare", "suited", "partial"]);
69
+
70
+ export function parseInspectArgs(argv = process.argv.slice(2)) {
71
+ const out = {
72
+ skipLive: false,
73
+ go: false,
74
+ goOut: null,
75
+ requireHarness: null,
76
+ goal: null,
77
+ };
78
+ for (let i = 0; i < argv.length; i += 1) {
79
+ const arg = argv[i];
80
+ if (arg === "--skip-live") out.skipLive = true;
81
+ else if (arg === "--go") out.go = true;
82
+ else if (arg === "--go-out") out.goOut = argv[++i] || null;
83
+ else if (arg.startsWith("--go-out=")) out.goOut = arg.slice("--go-out=".length);
84
+ else if (arg === "--require-harness") out.requireHarness = argv[++i] || null;
85
+ else if (arg.startsWith("--require-harness=")) {
86
+ out.requireHarness = arg.slice("--require-harness=".length);
87
+ } else if (arg === "--goal") out.goal = argv[++i] || null;
88
+ else if (arg.startsWith("--goal=")) out.goal = arg.slice("--goal=".length);
89
+ }
90
+ if (out.goOut) out.go = true;
91
+ return out;
92
+ }
93
+
94
+ function hooksFileBound(file) {
95
+ if (!fs.existsSync(file)) return false;
96
+ const json = readJson(file);
97
+ const hooks = json?.hooks;
98
+ if (!hooks || typeof hooks !== "object") return false;
99
+ return Object.values(hooks).some(
100
+ (list) =>
101
+ Array.isArray(list) &&
102
+ list.some((entry) => typeof entry?.command === "string" && entry.command.trim()),
103
+ );
104
+ }
105
+
106
+ export function classifyHarnessProfile({ hooksBound, repertoireFastened, stationPresent }) {
107
+ if (!hooksBound && !repertoireFastened && !stationPresent) return "bare";
108
+ if (hooksBound && repertoireFastened) return "suited";
109
+ return "partial";
110
+ }
111
+
112
+ export function probeHarness(root) {
113
+ const cursorHooks = path.join(root, ".cursor", "hooks.json");
114
+ const grokHooks = path.join(root, ".grok", "plugins", "0xray", "hooks", "hooks.json");
115
+ const grokPluginHooks = path.join(root, ".grok-plugin", "hooks", "hooks.json");
116
+ const hooks = {
117
+ cursor: hooksFileBound(cursorHooks),
118
+ grok: hooksFileBound(grokHooks) || hooksFileBound(grokPluginHooks),
119
+ };
120
+ hooks.bound = Boolean(hooks.cursor || hooks.grok);
121
+
122
+ const repertoire = {
123
+ nodeModules: fs.existsSync(path.join(root, "node_modules", "@0xray", "repertoire")),
124
+ state: fs.existsSync(path.join(root, ".xray", "state", "repertoire")),
125
+ vendorSource: fs.existsSync(path.join(root, "vendor", "@0xray", "repertoire")),
126
+ };
127
+ repertoire.fastened = Boolean(repertoire.nodeModules || repertoire.state);
128
+
129
+ const features =
130
+ readJson(path.join(root, ".xray", "features.json")) ||
131
+ readJson(path.join(root, "xray", "features.json"));
132
+ repertoire.memoryRoutingDeclared = features?.memory_routing?.provider === "repertoire";
133
+
134
+ const stationPresent = fs.existsSync(path.join(root, ".xray", "state", "STATION.md"));
135
+ const profile = classifyHarnessProfile({
136
+ hooksBound: hooks.bound,
137
+ repertoireFastened: repertoire.fastened,
138
+ stationPresent,
139
+ });
140
+
141
+ return {
142
+ id: "harness",
143
+ hooks,
144
+ repertoire,
145
+ station: { present: stationPresent },
146
+ profile,
147
+ };
148
+ }
149
+
150
+ export function checkHarness(root, requireHarness = null) {
151
+ const probe = probeHarness(root);
152
+ if (requireHarness && !HARNESS_PROFILES.has(requireHarness)) {
153
+ return {
154
+ ...probe,
155
+ ok: false,
156
+ require: requireHarness,
157
+ detail: `unknown --require-harness=${requireHarness} (bare|suited|partial)`,
158
+ };
159
+ }
160
+ if (requireHarness && probe.profile !== requireHarness) {
161
+ return {
162
+ ...probe,
163
+ ok: false,
164
+ require: requireHarness,
165
+ detail: `harness profile ${probe.profile} != required ${requireHarness}`,
166
+ };
167
+ }
168
+ return {
169
+ ...probe,
170
+ ok: true,
171
+ require: requireHarness,
172
+ skipped: !requireHarness,
173
+ detail: requireHarness ? null : "observational — pass --require-harness to gate",
174
+ };
175
+ }
176
+
177
+ function gitRemote(root) {
178
+ const remote = spawnSync("git", ["config", "--get", "remote.origin.url"], {
179
+ cwd: root,
180
+ encoding: "utf8",
181
+ });
182
+ if (remote.error || remote.status !== 0) return null;
183
+ return (remote.stdout || "").trim() || null;
184
+ }
185
+
186
+ export function buildForgeGo(root, harness, opts = {}) {
187
+ return {
188
+ kind: "forge-go",
189
+ mill: "inspect",
190
+ profile: harness.profile,
191
+ hooksBound: Boolean(harness.hooks?.bound),
192
+ repertoireFastened: Boolean(harness.repertoire?.fastened),
193
+ stationPresent: Boolean(harness.station?.present),
194
+ require: harness.require || null,
195
+ ok: harness.ok !== false,
196
+ goal: opts.goal || process.env.FOUNDRY_GO_GOAL || null,
197
+ repo: gitRemote(root),
198
+ generatedAt: new Date().toISOString(),
199
+ };
200
+ }
201
+
66
202
  function checkDiff(root) {
67
203
  const status = spawnSync("git", ["status", "-sb"], { cwd: root, encoding: "utf8" });
68
204
  if (status.error || status.status === 128) {
@@ -412,6 +548,9 @@ export async function inspectSuit(root, opts = {}) {
412
548
  const skipLive = Boolean(opts.skipLive);
413
549
  const env = opts.env || process.env;
414
550
  const machineHome = opts.machineHome || mint.machineHome();
551
+ const requireHarness = opts.requireHarness || null;
552
+ const go = Boolean(opts.go);
553
+ const goal = opts.goal || null;
415
554
 
416
555
  const checks = [];
417
556
  checks.push(checkDiff(root));
@@ -445,22 +584,38 @@ export async function inspectSuit(root, opts = {}) {
445
584
  }
446
585
 
447
586
  checks.push(checkIsolatedHome(root, env, machineHome));
587
+ checks.push(checkHarness(root, requireHarness));
448
588
 
449
589
  const failed = checks.filter((c) => c.ok === false);
450
590
  const receipt = checks.find((c) => c.id === "receipt") || {};
451
- return {
591
+ const harness = checks.find((c) => c.id === "harness") || {};
592
+ const report = {
452
593
  ok: failed.length === 0,
453
594
  failed: failed.map((c) => c.id),
454
595
  checks,
455
596
  dna: receipt.dna || null,
456
597
  pack: "0xray-suit",
457
598
  };
599
+ if (go) {
600
+ report.go = buildForgeGo(root, harness, { goal });
601
+ }
602
+ return report;
458
603
  }
459
604
 
460
605
  async function main() {
461
- const skipLive = process.argv.includes("--skip-live");
606
+ const args = parseInspectArgs(process.argv.slice(2));
462
607
  const root = resolveMillRoot();
463
- const report = await inspectSuit(root, { skipLive });
608
+ const report = await inspectSuit(root, {
609
+ skipLive: args.skipLive,
610
+ requireHarness: args.requireHarness,
611
+ go: args.go,
612
+ goal: args.goal,
613
+ });
614
+ if (args.goOut) {
615
+ const dest = path.isAbsolute(args.goOut) ? args.goOut : path.join(root, args.goOut);
616
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
617
+ fs.writeFileSync(dest, `${JSON.stringify(report.go || report, null, 2)}\n`);
618
+ }
464
619
  process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
465
620
  process.exit(report.ok ? 0 : 1);
466
621
  }
@@ -17,6 +17,7 @@ Mill **does** these checks (`npx @0xray/foundry inspect`). Mint fails on a costu
17
17
  4. **CI.** GitHub mill CI report (`.opencode/logs/ci-cd-monitor-report.json`), not a green check in chat. No token is a skip, not a pass invented.
18
18
  5. **Live PUT.** HTTP 200 on the npm `.tgz`. Metadata without a tarball is not shipped.
19
19
  6. **Isolated HOME.** Last-mile dest is project `.grok/plugins/0xray`. Isolated HOME may wear `$HOME/.grok/plugins/0xray` and must not write machine `~/.grok/plugins/0xray`. Shared HOME (passwd `$HOME`) does not last-wins clobber the machine plugin. Mill compares `$HOME` to the passwd home (`os.userInfo().homedir`), not `os.homedir()` (which follows `$HOME`).
20
+ 7. **Harness (observational).** Bound Cursor/Grok hooks, fastened Repertoire organ, Station card. Profiles: `bare` / `suited` / `partial`. Does **not** fasten. `--go` prints a forge GO receipt so cloud return is mill, not chat. `--require-harness=bare|suited|partial` fails when the live plant disagrees.
20
21
 
21
22
  ## How to work
22
23
 
@@ -28,6 +29,7 @@ Mill **does** these checks (`npx @0xray/foundry inspect`). Mint fails on a costu
28
29
  ```bash
29
30
  npx @0xray/foundry mint
30
31
  npx @0xray/foundry inspect
32
+ npx @0xray/foundry inspect --skip-live --go --require-harness=bare
31
33
  npx @0xray/foundry ci --report
32
34
  ```
33
35
 
@@ -11,7 +11,7 @@ The mill **fastens** a suit. Default mill plant is **inspect** (inspecting AI wo
11
11
 
12
12
  **Mill-fill:** their keys/files win. Mill plant names they did not overlay stay. JSON always merges.
13
13
 
14
- **Factory:** Repertoire enable-when-resolves. Seven generated MCP. Constitution (PPE) stays worn. Not a fifth MCP. Not 5.0.
14
+ **Factory:** **Repertoire is preferred** (vendored 0.2.5 ships on; dest = named laws). Seven generated MCP. Constitution (PPE) stays worn. Not a fifth MCP. Not 5.0.
15
15
 
16
16
  **Costume:** `foundry.json` `"costume": true` copies the 45/42 mill costume.
17
17
 
@@ -18,6 +18,7 @@ import {
18
18
  DOCS_SITE_HEADER_FILES,
19
19
  getFrameworkCounts,
20
20
  getReleaseArtifactPaths,
21
+ patchRefStripRelPaths,
21
22
  } from './version-manager.mjs';
22
23
  import { isXrayExoRepo, resolveMillRoot } from './mill-root.mjs';
23
24
 
@@ -29,6 +30,23 @@ function kernelLineHasPatchStamp(content) {
29
30
  return /^\*\*v?\d+\.\d+\.\d+\*\*/m.test(content);
30
31
  }
31
32
 
33
+ /**
34
+ * Present-tense cut pins. Keep: package.json, CHANGELOG, stamped JSON,
35
+ * features-since headings. The check set is the stamper set: shipped guides
36
+ * and shipped OP-PROC, including the mill-gate skill. Seat memory is not in it.
37
+ */
38
+ const PRESENT_TENSE_PATCH_RE =
39
+ /This cut is|Do not republish \d+\.\d+\.\d+|0xray@\d+\.\d+\.\d+|npm is \*\*\d+\.\d+\.\d+\*\*|Product \*\*\d+\.\d+\.\d+\*\* is on npm/;
40
+
41
+ const NO_PRESENT_TENSE_PATCH = patchRefStripRelPaths();
42
+
43
+ function presentTensePatchPinErrors(content) {
44
+ if (PRESENT_TENSE_PATCH_RE.test(content)) {
45
+ return ['present-tense patch pin — keep versions in package.json + CHANGELOG + stamped JSON only'];
46
+ }
47
+ return [];
48
+ }
49
+
32
50
  /** Guides that must exist and reference the current release (body or header). */
33
51
  const REQUIRED_GUIDES = [
34
52
  'docs-site/docs/guides/features-since-3.1.md',
@@ -36,6 +54,7 @@ const REQUIRED_GUIDES = [
36
54
  'docs-site/docs/guides/memory-routing.md',
37
55
  'docs-site/docs/guides/aside-context.md',
38
56
  'docs-site/docs/guides/repertoire.md',
57
+ 'docs-site/docs/guides/station-vs-repertoire.md',
39
58
  'docs-site/docs/guides/integrations.md',
40
59
  'docs-site/docs/guides/consumer-migration.md',
41
60
  'docs-site/docs/mcp/README.md',
@@ -53,6 +72,18 @@ function millLawLagErrors(content) {
53
72
  return errors;
54
73
  }
55
74
 
75
+ /** Opt-out is features.json, not package-absence. */
76
+ function repertoireOptOutErrors(content) {
77
+ const errors = [];
78
+ if (/\(no @0xray\/repertoire\)/.test(content)) {
79
+ errors.push('opt-out must not teach package-absence (no @0xray/repertoire)');
80
+ }
81
+ if (/memory_routing stays off/.test(content)) {
82
+ errors.push('opt-out must not teach memory_routing stays off on npm install');
83
+ }
84
+ return errors;
85
+ }
86
+
56
87
  function millPlantMentionErrors(content) {
57
88
  if (!content.includes('mill') || !content.includes('inspect')) {
58
89
  return ['missing mill+inspect plant'];
@@ -310,7 +341,24 @@ export function validateReleaseDocs(rootDir = resolveMillRoot()) {
310
341
  if (content.trim().length < 200) {
311
342
  errors.push(`${rel}: guide too short — likely stub`);
312
343
  }
344
+ }
345
+
346
+ for (const rel of NO_PRESENT_TENSE_PATCH) {
347
+ const content = readFile(rootDir, rel);
348
+ if (!content) {
349
+ errors.push(`${rel}: file missing`);
350
+ continue;
351
+ }
352
+ for (const e of presentTensePatchPinErrors(content)) {
353
+ errors.push(`${rel}: ${e}`);
354
+ }
355
+ }
313
356
 
357
+ const stationVs = readFile(rootDir, 'docs-site/docs/guides/station-vs-repertoire.md');
358
+ if (stationVs) {
359
+ for (const e of repertoireOptOutErrors(stationVs)) {
360
+ errors.push(`docs-site/docs/guides/station-vs-repertoire.md: ${e}`);
361
+ }
314
362
  }
315
363
 
316
364
  const docusaurus = readFile(rootDir, 'docs-site/docusaurus.config.ts');