workspai 0.45.0 → 0.47.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 (177) hide show
  1. package/README.md +307 -532
  2. package/contracts/agent-customization-pack.v1.json +6 -1
  3. package/contracts/bootstrap-compliance.v1.json +14 -0
  4. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +8 -0
  5. package/contracts/extension-cli-compatibility.v1.json +9 -2
  6. package/contracts/mirror-ops.v1.json +16 -0
  7. package/contracts/published-contract-catalog.v1.json +38 -1
  8. package/contracts/runtime-command-surface.v1.json +190 -7
  9. package/contracts/transparency-evidence.v1.json +13 -0
  10. package/contracts/workspace-archive-capabilities.v1.json +17 -6
  11. package/contracts/workspace-contract.v1.json +78 -0
  12. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +4 -0
  13. package/contracts/workspace-intelligence/workspace-context.v1.json +20 -0
  14. package/contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json +72 -0
  15. package/contracts/workspace-intelligence/workspace-intelligence-run.v1.json +212 -0
  16. package/contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json +200 -0
  17. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +260 -0
  18. package/contracts/workspace-intelligence/workspace-knowledge-search.v1.json +60 -0
  19. package/contracts/workspace-intelligence-architecture.v1.json +7 -4
  20. package/contracts/workspace-intelligence-chain.v1.json +51 -4
  21. package/contracts/workspace-share-bundle.v1.json +16 -0
  22. package/dist/analyze-UVXPRGYZ.js +1 -0
  23. package/dist/artifact-remediation-plan-EPALZ2LC.js +3 -0
  24. package/dist/autopilot-release-5BQ6F5L2.js +1 -0
  25. package/dist/chunk-22NJ2ZMG.js +2 -0
  26. package/dist/{chunk-XIVFLY6G.js → chunk-2GHUZDYA.js} +1 -1
  27. package/dist/chunk-2TEDAKP6.js +2 -0
  28. package/dist/chunk-52PBRX7F.js +1 -0
  29. package/dist/chunk-6SWRNA47.js +4 -0
  30. package/dist/chunk-76YOPAOT.js +1 -0
  31. package/dist/chunk-7VLCK5JW.js +1 -0
  32. package/dist/{chunk-DXPU4DDV.js → chunk-BSRVO52Y.js} +92 -78
  33. package/dist/chunk-COARSXRC.js +1 -0
  34. package/dist/chunk-CV5HKU4P.js +1 -0
  35. package/dist/chunk-CW7PGBIQ.js +13 -0
  36. package/dist/{chunk-KU4S7RCM.js → chunk-DV6GJD4K.js} +1 -1
  37. package/dist/chunk-EYJ2CQSK.js +1 -0
  38. package/dist/chunk-FB7SCXAZ.js +1 -0
  39. package/dist/chunk-FPJNWPKU.js +1 -0
  40. package/dist/{chunk-JP25YL3J.js → chunk-FTY7GGXJ.js} +2 -2
  41. package/dist/chunk-FXQJX34Z.js +1 -0
  42. package/dist/{chunk-J4AICQFB.js → chunk-HSGFUKCN.js} +1 -1
  43. package/dist/{chunk-OOOPYUL2.js → chunk-ITCAMC2E.js} +1 -1
  44. package/dist/chunk-KB44JP4M.js +2 -0
  45. package/dist/{chunk-WANW4QA4.js → chunk-KZZ36CK5.js} +1 -1
  46. package/dist/chunk-LNRAB7UY.js +1 -0
  47. package/dist/chunk-MEMHNE7Y.js +80 -0
  48. package/dist/chunk-MER6ZBN2.js +13 -0
  49. package/dist/chunk-NOFM7MNA.js +2 -0
  50. package/dist/chunk-NRYS4CLR.js +2 -0
  51. package/dist/chunk-OA537ZQ5.js +1 -0
  52. package/dist/chunk-PBHP6JNY.js +8 -0
  53. package/dist/chunk-QDWYIRHR.js +8 -0
  54. package/dist/chunk-RWRLFSKW.js +2 -0
  55. package/dist/chunk-SK6XRKGG.js +1 -0
  56. package/dist/chunk-THIOE2PB.js +2 -0
  57. package/dist/chunk-TNQI5VCW.js +36 -0
  58. package/dist/chunk-TWNFECMN.js +2 -0
  59. package/dist/{chunk-2QOWRBQD.js → chunk-U5EZHZBX.js} +1 -1
  60. package/dist/{chunk-K63BSU56.js → chunk-VBSQ7MF6.js} +62 -51
  61. package/dist/chunk-WDKNMTJQ.js +1 -0
  62. package/dist/chunk-YCL3I2JO.js +2 -0
  63. package/dist/chunk-ZDN7RHXJ.js +1 -0
  64. package/dist/chunk-ZM5NQ5Z2.js +1 -0
  65. package/dist/{create-KFR6FLRT.js → create-7JKJDAQV.js} +1 -1
  66. package/dist/doctor-PGPNIS76.js +1 -0
  67. package/dist/{dotnet-webapi-clean-BYUUHX5Y.js → dotnet-webapi-clean-6TVFBTVI.js} +20 -20
  68. package/dist/{gofiber-standard-B6UK5GR7.js → gofiber-standard-2BL7GWZB.js} +1 -1
  69. package/dist/{gogin-standard-BXU44VEM.js → gogin-standard-XGP3KBXA.js} +1 -1
  70. package/dist/index.d.ts +112 -16
  71. package/dist/index.js +198 -195
  72. package/dist/pipeline-IB6ILJSV.js +5 -0
  73. package/dist/{platform-capabilities-YICBF4FA.js → platform-capabilities-2B4QMZXE.js} +1 -1
  74. package/dist/{pythonRapidkitExec-UJYIB6FL.js → pythonRapidkitExec-CVCIK225.js} +1 -1
  75. package/dist/{springboot-standard-PEHDKH2L.js → springboot-standard-JJNUID6M.js} +6 -6
  76. package/dist/workspace-H3QXBFGB.js +1 -0
  77. package/dist/{workspace-agent-sync-G5YVI3BJ.js → workspace-agent-sync-C7SG2Z5W.js} +1 -1
  78. package/dist/workspace-archive-P76EDIUG.js +10 -0
  79. package/dist/{workspace-context-E3UFWL5X.js → workspace-context-BKQBKA4C.js} +1 -1
  80. package/dist/workspace-contract-RPQQBQXR.js +1 -0
  81. package/dist/workspace-dependency-graph-23BI2HG7.js +1 -0
  82. package/dist/workspace-explain-WVN7JH3U.js +1 -0
  83. package/dist/workspace-explain-contract-SEFTVF6J.js +1 -0
  84. package/dist/{workspace-feedback-YY6WQPWQ.js → workspace-feedback-WAID3IOE.js} +1 -1
  85. package/dist/{workspace-foundation-3C2DLCVI.js → workspace-foundation-5OOJEO2D.js} +1 -1
  86. package/dist/workspace-graph-token-efficiency-CFGFCJ5V.js +1 -0
  87. package/dist/{workspace-history-VF3CHDYQ.js → workspace-history-C6OP3IAQ.js} +1 -1
  88. package/dist/workspace-intelligence-VKDL3H2J.js +1 -0
  89. package/dist/workspace-intelligence-runner-LVALAZY7.js +1 -0
  90. package/dist/workspace-knowledge-graph-FE2NTZKV.js +1 -0
  91. package/dist/workspace-knowledge-graph-change-overlay-XG6FC4IX.js +1 -0
  92. package/dist/workspace-knowledge-graph-query-VOSPPH4W.js +1 -0
  93. package/dist/workspace-mcp-serve-KT2I676Z.js +3 -0
  94. package/dist/workspace-model-S33CIB2R.js +1 -0
  95. package/dist/workspace-model-hash-MHXK5MEI.js +1 -0
  96. package/dist/workspace-python-engine-state-2MLKJYQG.js +2 -0
  97. package/dist/workspace-registry-summary-A3YDL63D.js +1 -0
  98. package/dist/workspace-run-M4LNJILC.js +1 -0
  99. package/dist/{workspace-verify-ZNT6JX7D.js → workspace-verify-ZGH3NXAH.js} +1 -1
  100. package/dist/workspace-watch-EVBJTMV7.js +1 -0
  101. package/docs/AI_DYNAMIC_INTEGRATION.md +73 -432
  102. package/docs/AI_EXAMPLES.md +37 -395
  103. package/docs/AI_FEATURES.md +76 -465
  104. package/docs/AI_QUICKSTART.md +49 -209
  105. package/docs/DEVELOPMENT.md +5 -5
  106. package/docs/From Code to Shared Understanding.png +0 -0
  107. package/docs/GLOSSARY.md +60 -0
  108. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +91 -9
  109. package/docs/OPTIMIZATION_GUIDE.md +19 -51
  110. package/docs/PACKAGE_MANAGER_POLICY.md +4 -1
  111. package/docs/README.md +91 -42
  112. package/docs/SECURITY.md +13 -6
  113. package/docs/SETUP.md +6 -3
  114. package/docs/UTILITIES.md +8 -20
  115. package/docs/WORKSPACE_MARKER_SPEC.md +27 -20
  116. package/docs/ci-workflows.md +19 -5
  117. package/docs/commands-reference.md +88 -13
  118. package/docs/config-file-guide.md +67 -246
  119. package/docs/contracts/ARTIFACT_CATALOG.md +78 -36
  120. package/docs/contracts/CLI_LOG_EVENT_STREAM.md +1 -1
  121. package/docs/contracts/README.md +48 -9
  122. package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +4 -4
  123. package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +14 -10
  124. package/docs/creating-workspaces-and-projects.md +649 -0
  125. package/docs/doctor-command.md +5 -4
  126. package/docs/examples/ci-agent-grounding.yml +16 -10
  127. package/docs/from-code-to-shared-understanding.md +69 -38
  128. package/docs/graph-benchmark-methodology.md +121 -0
  129. package/docs/workspace-intelligence-runner.md +186 -0
  130. package/docs/workspace-knowledge-graph.md +295 -0
  131. package/docs/workspace-operations.md +78 -11
  132. package/docs/workspace-run.md +4 -1
  133. package/package.json +10 -8
  134. package/rapidkit.config.example.cjs +5 -5
  135. package/scripts/enforce-package-manager.cjs +1 -1
  136. package/scripts/prepack-enterprise.mjs +4 -0
  137. package/workspai.config.example.cjs +12 -47
  138. package/dist/analyze-YLV7NVLF.js +0 -1
  139. package/dist/artifact-remediation-plan-WLZGROUU.js +0 -3
  140. package/dist/autopilot-release-YBN3SWAA.js +0 -1
  141. package/dist/chunk-2K3GYCPS.js +0 -1
  142. package/dist/chunk-42G2OK64.js +0 -1
  143. package/dist/chunk-5AKYMAIL.js +0 -1
  144. package/dist/chunk-5GNT4RJI.js +0 -8
  145. package/dist/chunk-5PVEQ6CZ.js +0 -13
  146. package/dist/chunk-6AA3WWQZ.js +0 -2
  147. package/dist/chunk-6ZENXBMG.js +0 -33
  148. package/dist/chunk-7RIWU5TZ.js +0 -1
  149. package/dist/chunk-7UZVOYF5.js +0 -2
  150. package/dist/chunk-BJLE5CH7.js +0 -4
  151. package/dist/chunk-G3H5R3RR.js +0 -1
  152. package/dist/chunk-HYJK7W3B.js +0 -1
  153. package/dist/chunk-IMUU5Q2V.js +0 -13
  154. package/dist/chunk-KPPGZCUW.js +0 -78
  155. package/dist/chunk-LCRROMRR.js +0 -2
  156. package/dist/chunk-LG6RFLPZ.js +0 -1
  157. package/dist/chunk-P424XYHP.js +0 -1
  158. package/dist/chunk-P7SCWJFG.js +0 -8
  159. package/dist/chunk-QWU2CZBG.js +0 -2
  160. package/dist/chunk-V2H2KRMZ.js +0 -1
  161. package/dist/chunk-XZGVNGRB.js +0 -1
  162. package/dist/chunk-ZWO6K24C.js +0 -2
  163. package/dist/doctor-YJDM5XBH.js +0 -1
  164. package/dist/imported-projects-registry-FOIE27WT.js +0 -1
  165. package/dist/pipeline-FEDYO3IA.js +0 -5
  166. package/dist/workspace-PLXOO6ST.js +0 -1
  167. package/dist/workspace-archive-EEGLHZDW.js +0 -10
  168. package/dist/workspace-contract-LQJDZV36.js +0 -1
  169. package/dist/workspace-explain-G74ZIF23.js +0 -1
  170. package/dist/workspace-explain-contract-KT757JGQ.js +0 -1
  171. package/dist/workspace-intelligence-3GG7GEDQ.js +0 -1
  172. package/dist/workspace-mcp-serve-MJMUV4RY.js +0 -3
  173. package/dist/workspace-model-NG45SRM5.js +0 -1
  174. package/dist/workspace-python-engine-state-MTWIIZPY.js +0 -2
  175. package/dist/workspace-registry-summary-JM2XY52C.js +0 -1
  176. package/dist/workspace-run-WEQYIERE.js +0 -1
  177. package/dist/workspace-watch-W47T4RX2.js +0 -1
@@ -10,6 +10,7 @@ name: Workspai Agent Grounding
10
10
  on:
11
11
  pull_request:
12
12
  paths:
13
+ - '.workspai/**'
13
14
  - '.rapidkit/**'
14
15
  - 'AGENTS.md'
15
16
  - 'CLAUDE.md'
@@ -34,17 +35,21 @@ jobs:
34
35
  - name: Install Workspai CLI
35
36
  run: npm install --no-save workspai
36
37
 
37
- - name: Run governance pipeline
38
- run: npx workspai pipeline --json --strict
38
+ - name: Run canonical Workspace Intelligence chain
39
+ # Exit 1 = hard execution failure; exit 2 = completed but evidence-blocked.
40
+ # Continue here only so the durable run report and blocker evidence can
41
+ # always be uploaded; the final step below still fails either outcome.
42
+ run: npx workspai workspace intelligence run --for-agent codex --strict --json
43
+ continue-on-error: true
44
+ id: intelligence
45
+
46
+ - name: Run separate governance pipeline
47
+ run: npx workspai pipeline --json --strict --no-agent-sync
39
48
  continue-on-error: true
40
49
  id: pipeline
41
50
 
42
- - name: Sync and verify agent grounding
43
- run: |
44
- npx workspai workspace agent-sync --write --refresh-context --strict --json --preset enterprise
45
- node ./node_modules/workspai/scripts/check-agent-customization-drift.mjs --workspace .
46
- env:
47
- RAPIDKIT_NO_AGENT_SYNC: '0'
51
+ - name: Verify agent grounding drift
52
+ run: node ./node_modules/workspai/scripts/check-agent-customization-drift.mjs --workspace .
48
53
 
49
54
  - name: Upload agent grounding artifacts
50
55
  if: always()
@@ -54,12 +59,13 @@ jobs:
54
59
  path: |
55
60
  .workspai/reports/INDEX.json
56
61
  .workspai/reports/workspace-context-agent.json
62
+ .workspai/reports/workspace-intelligence-run-last-run.json
57
63
  .workspai/reports/agent-customization-pack.json
58
64
  .workspai/reports/workspai-mcp-design.json
59
65
  .workspai/reports/pipeline-last-run.json
60
66
  AGENTS.md
61
67
  if-no-files-found: ignore
62
68
 
63
- - name: Fail if pipeline blocked
64
- if: steps.pipeline.outcome == 'failure'
69
+ - name: Fail if canonical chain or pipeline blocked
70
+ if: steps.intelligence.outcome == 'failure' || steps.pipeline.outcome == 'failure'
65
71
  run: exit 1
@@ -1,45 +1,76 @@
1
1
  # From Code to Shared Understanding
2
2
 
3
- How Workspai transforms projects and repositories into workspace intelligence for developers, CI, and AI agents.
4
-
5
- This Mermaid diagram is kept in the internal documentation because GitHub renders it correctly. The main npm README uses a PNG version of the same diagram so it remains visible on npm package pages.
3
+ Workspai gives everyone the same understanding of your software, without asking
4
+ you to replace your frameworks or move existing source code.
6
5
 
7
6
  ```mermaid
8
7
  flowchart TB
8
+ Code["Your projects and repositories"]
9
+
10
+ Routes["Create a project<br/>Adopt it in place<br/>or Import a repository"]
11
+
12
+ Workspace["Workspai builds one model of<br/>projects, dependencies, rules, and commands"]
13
+
14
+ Change["What changed?<br/>What is affected?<br/>Is the evidence ready?"]
15
+
16
+ Outputs["Context, impact, verification,<br/>explanations, and release evidence"]
17
+
18
+ Code --> Routes
19
+ Routes --> Workspace
20
+ Workspace --> Change
21
+ Change --> Outputs
22
+
23
+ Outputs --> Developers["Developers"]
24
+ Outputs --> CI["CI and releases"]
25
+ Outputs --> IDEs["IDEs"]
26
+ Outputs --> Agents["AI agents"]
27
+ Outputs --> MCP["MCP clients"]
28
+ ```
29
+
30
+ ## What This Means
31
+
32
+ 1. **Connect your software.** Create something new, adopt an existing project
33
+ without moving it, or import a repository.
34
+ 2. **Understand the workspace.** Workspai builds one model of the projects and
35
+ how they relate.
36
+ 3. **Understand change and verify it.** Workspai shows affected areas and checks
37
+ the evidence needed for a safe decision.
38
+ 4. **Share the result.** Developers, CI, IDEs, AI agents, and MCP clients consume
39
+ the same workspace truth instead of building separate assumptions. The
40
+ current CLI exposes a read-mostly `workspace mcp serve` bridge; a dedicated
41
+ `packages/mcp` boundary is planned.
9
42
 
10
- Code["Code & Repositories"]
11
- Projects["Projects"]
12
- Workspace["Workspace"]
13
-
14
- Code --> Projects
15
- Projects --> Workspace
16
-
17
- subgraph Intelligence["Workspace Intelligence"]
18
- Model["Workspace Model"]
19
- Context["Agent Context"]
20
- Impact["Impact Analysis"]
21
- Verify["Verification"]
22
- Evidence["Evidence & Gates"]
23
- end
24
-
25
- Workspace --> Model
26
- Workspace --> Context
27
- Workspace --> Impact
28
- Workspace --> Verify
29
- Workspace --> Evidence
30
-
31
- Model --> Dev["Developers"]
32
- Model --> CI["CI"]
33
- Model --> Agents["AI Agents"]
34
-
35
- Context --> Agents
36
-
37
- Impact --> Dev
38
- Impact --> CI
39
-
40
- Verify --> CI
41
- Verify --> Agents
42
- Evidence --> Dev
43
- Evidence --> CI
44
- Evidence --> Agents
43
+ This is the user-facing view. The implementation uses a versioned chain of
44
+ model, change, evidence, verification, context, grounding, and explanation
45
+ steps. Contributors and integrations can inspect the complete contracts:
46
+
47
+ - [`workspace-intelligence-chain.v1.json`](../contracts/workspace-intelligence-chain.v1.json)
48
+ - [`workspace-intelligence-architecture.v1.json`](../contracts/workspace-intelligence-architecture.v1.json)
49
+
50
+ The unified runner also has a deterministic execution envelope: `sync` runs
51
+ before Model and baseline resolution runs after Model/before Diff. These appear
52
+ as two `preflight` entries, not as extra chain stages. The 11 canonical stages,
53
+ baseline lifecycle, exit codes, and failure propagation are specified in
54
+ [Unified Workspace Intelligence Runner](./workspace-intelligence-runner.md).
55
+
56
+ The npm README uses a PNG rendering because npm package pages do not reliably
57
+ render Mermaid. When this source changes, regenerate
58
+ `From Code to Shared Understanding.png` before publishing.
59
+
60
+ ## Execute the Contract
61
+
62
+ Run the complete canonical chain in its versioned order:
63
+
64
+ ```bash
65
+ npx workspai workspace intelligence run --for-agent codex --json
45
66
  ```
67
+
68
+ For enterprise CI and release enforcement, add `--strict`. A warning or
69
+ needs-attention verdict then produces a blocked report and exit code `2`:
70
+
71
+ ```bash
72
+ npx workspai workspace intelligence run --for-agent codex --strict --json
73
+ ```
74
+
75
+ `pipeline` is the broader governance/release orchestrator. It does not replace
76
+ or reorder the canonical Workspace Intelligence chain.
@@ -0,0 +1,121 @@
1
+ # Graph Retrieval Benchmark Methodology
2
+
3
+ This document defines what Workspai measures when it reports graph retrieval
4
+ payload reduction, how to reproduce a result, and what the result does—and does
5
+ not—prove.
6
+
7
+ ## The question being measured
8
+
9
+ For one query, how much smaller is the bounded, proof-carrying graph response
10
+ than the readable source corpus that supplied the graph's proofs?
11
+
12
+ This is useful because AI agents do not need every indexed file for every
13
+ question. It is deliberately narrower than “How many tokens will this model
14
+ bill?” or “Will the model produce an equally good answer?”
15
+
16
+ ## Run it
17
+
18
+ From a Workspai workspace:
19
+
20
+ ```bash
21
+ npx workspai workspace model --write --json
22
+ npx workspai workspace graph benchmark "authentication endpoint" --limit 12 --json
23
+ ```
24
+
25
+ The result conforms to
26
+ [`workspace-graph-token-efficiency.v1.json`](../contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json).
27
+ It records:
28
+
29
+ - the query and result limit;
30
+ - the graph schema, entity/relation/proof counts, source artifact, and source
31
+ model SHA-256;
32
+ - the number and size of readable, deduplicated proof-source artifacts;
33
+ - the bounded retrieval size and match count;
34
+ - unreadable artifacts rather than silently excluding them;
35
+ - the estimate formula, reduction ratio, percentage, and claim boundary.
36
+
37
+ ## Baseline and formula
38
+
39
+ The current methodology is `indexed-corpus-vs-bounded-retrieval.v1`.
40
+
41
+ ```text
42
+ corpus characters = sum(unique readable proof-source files)
43
+ retrieval characters = compact JSON length of bounded search response
44
+ estimated tokens = ceil(characters / 4)
45
+ reduction ratio = corpus estimated tokens / retrieval estimated tokens
46
+ reduction percent = (corpus - retrieval) / corpus × 100
47
+ ```
48
+
49
+ `characters / 4` is intentionally labelled as an estimate. It is portable and
50
+ reproducible without downloading a tokenizer, but it is not exact for every
51
+ language, model, or tokenizer.
52
+
53
+ ## Current fixture observation
54
+
55
+ The 16-project development workspace produced the following result on
56
+ 2026-07-21 for `api endpoint --limit 8`:
57
+
58
+ | Measure | Observed value |
59
+ | ------------------------------- | -------------: |
60
+ | Graph entities | 1,738 |
61
+ | Graph relations | 2,244 |
62
+ | Graph proofs | 2,106 |
63
+ | Readable proof-source artifacts | 392 |
64
+ | Corpus estimated tokens | 134,105 |
65
+ | Retrieval estimated tokens | 2,812 |
66
+ | Returned entities | 8 |
67
+ | Retrieval ratio | 47.69× |
68
+ | Payload reduction | 97.9% |
69
+
70
+ Source-model SHA-256:
71
+ `2b8abd415420cc421707c726e6f6c96641554594e84440bf2e539f04ba5836e8`.
72
+
73
+ This row demonstrates that measurement is possible. It is not a representative
74
+ cross-project benchmark and must not be marketed as a universal Workspai result.
75
+
76
+ ## What can be claimed today
77
+
78
+ Safe wording:
79
+
80
+ > Workspai can return bounded, proof-carrying workspace context instead of the
81
+ > complete indexed corpus. On the current 16-project development fixture, one
82
+ > `api endpoint` query reduced the estimated retrieval payload by 97.9%; results
83
+ > vary by workspace and query.
84
+
85
+ Unsafe wording:
86
+
87
+ - “Workspai always reduces model tokens by 97.9%.”
88
+ - “Agents are 47.69× cheaper with no quality loss.”
89
+ - “Workspai beats another product” without a shared corpus and evaluation
90
+ harness.
91
+
92
+ ## Gate for a public headline benchmark
93
+
94
+ Before publishing a general token-efficiency number, the benchmark suite must:
95
+
96
+ 1. pin public repositories and exact commit SHAs;
97
+ 2. publish fixed question sets and graph configuration;
98
+ 3. compare at least three baselines:
99
+ - entire readable corpus;
100
+ - a realistic grep/top-file retrieval strategy;
101
+ - bounded Workspai graph retrieval;
102
+ 4. count with at least one real, named tokenizer in addition to the portable
103
+ character estimate;
104
+ 5. measure answer relevance or task completion so smaller context is not treated
105
+ as automatically better context;
106
+ 6. repeat runs and publish variance, failures, unreadable files, hardware, and
107
+ software versions;
108
+ 7. publish raw machine-readable results and a one-command reproduction path;
109
+ 8. report median and range—not only the best repository.
110
+
111
+ ## Performance is a separate benchmark
112
+
113
+ Payload size and graph speed answer different questions. Build time, incremental
114
+ update time, peak memory, artifact size, and p50/p95 query latency must be
115
+ measured separately. Do not infer runtime performance from the token-efficiency
116
+ report.
117
+
118
+ For normal interactive use, prefer `workspace graph search` or the MCP
119
+ `searchWorkspaceGraph` tool. Use the complete graph artifact for interchange,
120
+ offline analysis, audits, and consumers that explicitly require the entire
121
+ workspace representation.
@@ -0,0 +1,186 @@
1
+ # Unified Workspace Intelligence Runner
2
+
3
+ `workspace intelligence run` is the canonical contract-backed entrypoint for
4
+ refreshing Workspace Intelligence evidence in one deterministic execution. Use
5
+ it from a Workspai workspace root:
6
+
7
+ ```bash
8
+ npx workspai workspace intelligence run --for-agent codex --strict --json
9
+ ```
10
+
11
+ The authoritative result is written atomically to
12
+ `.workspai/reports/workspace-intelligence-run-last-run.json` with schema
13
+ `workspace-intelligence-run.v1`. JSON stdout returns the same report payload.
14
+ Consumers should read the persisted report when they need durable evidence and
15
+ use the process exit code for the immediate automation verdict.
16
+
17
+ ## Execution envelope and canonical chain
18
+
19
+ The runner separates prerequisite operations from the versioned intelligence
20
+ chain. `sync` and baseline handling are reported in `preflight`; they are not
21
+ additional chain stages.
22
+
23
+ ```text
24
+ Execution order
25
+
26
+ sync
27
+ -> model
28
+ -> baseline resolution
29
+ -> diff
30
+ -> impact
31
+ -> doctor-evidence
32
+ -> contract-evidence
33
+ -> analyze-evidence
34
+ -> readiness-evidence
35
+ -> verify
36
+ -> context
37
+ -> agent-sync
38
+ -> explain
39
+ ```
40
+
41
+ The report always contains exactly two ordered `preflight` entries:
42
+
43
+ | ID | Execution point | Successful result | Purpose |
44
+ | ---------- | ---------------------------- | --------------------- | -------------------------------------------------- |
45
+ | `sync` | Before `model` | `synchronized` | Reconcile workspace inventory and contract inputs. |
46
+ | `baseline` | After `model`, before `diff` | `created` or `reused` | Ensure Diff has an explicit structural baseline. |
47
+
48
+ The report always contains exactly these 11 ordered `stages`:
49
+
50
+ | Order | Stage | Contract role |
51
+ | ----: | -------------------- | ------------------------------------------------------- |
52
+ | 1 | `model` | Build and persist the current workspace model. |
53
+ | 2 | `diff` | Compare the current model with the selected baseline. |
54
+ | 3 | `impact` | Calculate affected projects and transitive consequence. |
55
+ | 4 | `doctor-evidence` | Refresh workspace and project health evidence. |
56
+ | 5 | `contract-evidence` | Verify the workspace contract. |
57
+ | 6 | `analyze-evidence` | Refresh structural and operational analysis. |
58
+ | 7 | `readiness-evidence` | Refresh pre-verify release-readiness evidence. |
59
+ | 8 | `verify` | Produce the definitive evidence-backed gate. |
60
+ | 9 | `context` | Build agent context from the same current evidence. |
61
+ | 10 | `agent-sync` | Project canonical context into agent and IDE surfaces. |
62
+ | 11 | `explain` | Explain the resulting release posture and blockers. |
63
+
64
+ The machine-readable authority is
65
+ [`workspace-intelligence-chain.v1.json`](../contracts/workspace-intelligence-chain.v1.json).
66
+ Commands, websites, IDEs, CI jobs, and agent instructions must not define a
67
+ different order or insert `sync` or `snapshot-baseline` into `stages`.
68
+
69
+ ## Baseline semantics
70
+
71
+ On the first run, the runner creates
72
+ `.workspai/reports/workspace-model-snapshot.json` and reports:
73
+
74
+ ```json
75
+ {
76
+ "id": "baseline",
77
+ "status": "passed",
78
+ "result": "created"
79
+ }
80
+ ```
81
+
82
+ On later runs, it reuses the existing snapshot and reports `result: "reused"`.
83
+ `baselineCreated` is `true` only when that run created the baseline.
84
+
85
+ The runner does not silently replace an existing baseline immediately before
86
+ Diff. Doing so would erase the change boundary and incorrectly report no
87
+ changes. Refresh or replace a baseline only through the explicit
88
+ `workspace snapshot` workflow after the intended structural state has been
89
+ accepted.
90
+
91
+ ## Status and exit semantics
92
+
93
+ | Report status | Exit code | Meaning |
94
+ | ------------- | --------: | ---------------------------------------------------------------------------------------------- |
95
+ | `passed` | `0` | Every operation executed and no gate blocked the run. |
96
+ | `failed` | `1` | A required operation threw or could not complete. Downstream stages are recorded as `skipped`. |
97
+ | `blocked` | `2` | Execution completed, but one or more evidence or verification gates rejected readiness. |
98
+
99
+ The canonical mapping is `passed` → `0`, `failed` → `1`, and `blocked` → `2`.
100
+
101
+ A `blocked` evidence stage does not stop the chain. Context, grounding, and
102
+ Explain must still be refreshed so humans and agents receive the current
103
+ blocker evidence. A hard `failed` stage stops execution work and every
104
+ downstream canonical stage is recorded with `status: "skipped"`, `exitCode: 0`,
105
+ and `durationMs: 0`.
106
+
107
+ Stage invariants:
108
+
109
+ - `passed` requires `exitCode: 0`;
110
+ - `blocked` requires a non-zero stage exit code;
111
+ - `failed` requires `exitCode: 1`;
112
+ - `skipped` requires `exitCode: 0` and `durationMs: 0`;
113
+ - report status and exit code are derived from all preflight and stage results;
114
+ - every stage artifact list must exactly match the runtime registry.
115
+
116
+ `--strict` promotes warning-grade readiness states such as Analyze
117
+ `needs-attention` and Readiness `warn` into blocked stage verdicts. It does not
118
+ turn evidence blockers into execution failures: the aggregate exit remains `2`,
119
+ not `1`.
120
+
121
+ ## Report contract
122
+
123
+ The durable report contains:
124
+
125
+ ```json
126
+ {
127
+ "schemaVersion": "workspace-intelligence-run.v1",
128
+ "chainSchemaVersion": "workspai-workspace-intelligence-chain-v1",
129
+ "generatedAt": "2026-07-18T00:00:00.000Z",
130
+ "workspacePath": "/absolute/machine-local/path",
131
+ "baselineCreated": false,
132
+ "preflight": [],
133
+ "status": "blocked",
134
+ "exitCode": 2,
135
+ "stages": [],
136
+ "artifactPath": ".workspai/reports/workspace-intelligence-run-last-run.json"
137
+ }
138
+ ```
139
+
140
+ The abbreviated arrays above illustrate the envelope only; conforming reports
141
+ must contain exactly two preflight entries and 11 stages. The complete JSON
142
+ Schema is
143
+ [`workspace-intelligence-run.v1.json`](../contracts/workspace-intelligence/workspace-intelligence-run.v1.json).
144
+ Structural schema validation is necessary but not sufficient. Workspai also
145
+ enforces stage order, registered artifacts, baseline coherence, failure
146
+ propagation, and aggregate verdict semantics before writing the report.
147
+
148
+ `workspacePath` and some underlying evidence can contain machine-local absolute
149
+ paths. Do not treat the run report as a portable workspace identity contract or
150
+ publish it without applying the relevant redaction policy.
151
+
152
+ ## CI consumption
153
+
154
+ The simplest hard gate is:
155
+
156
+ ```bash
157
+ npx workspai workspace intelligence run --for-agent codex --strict --json
158
+ ```
159
+
160
+ Both exit `1` and exit `2` fail a normal CI step. If artifacts must be uploaded
161
+ after a blocked run, allow the runner step to continue, upload with `if: always()`,
162
+ then fail the job from the recorded step outcome. See
163
+ [`examples/ci-agent-grounding.yml`](./examples/ci-agent-grounding.yml).
164
+
165
+ Automation must distinguish:
166
+
167
+ - exit `1`: repair execution, environment, permissions, corruption, or another
168
+ hard runtime failure;
169
+ - exit `2`: inspect Analyze, Readiness, Verify, and Explain evidence and resolve
170
+ the reported blockers;
171
+ - exit `0`: consume the newly refreshed artifacts.
172
+
173
+ Do not parse terminal prose. Read `status`, `exitCode`, `preflight`, `stages`,
174
+ and their registered artifacts from the JSON report.
175
+
176
+ ## Relationship to other commands
177
+
178
+ `workspace intelligence run` is the canonical Workspace Intelligence chain.
179
+ `pipeline` is a broader governance/release orchestrator and `autopilot release`
180
+ is a separate release surface. Neither command may replace, reorder, extend, or
181
+ silently partially execute the canonical intelligence chain.
182
+
183
+ Individual commands such as `workspace model`, `workspace diff`, and
184
+ `workspace verify` remain useful for inspection and targeted renewal. A partial
185
+ manual sequence must not be documented or treated as an equivalent replacement
186
+ for the unified runner.