workspai 0.47.0 → 0.48.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 (90) hide show
  1. package/README.md +214 -119
  2. package/contracts/agent-customization-pack.v1.json +5 -0
  3. package/contracts/extension-cli-compatibility.v1.json +7 -2
  4. package/contracts/published-contract-catalog.v1.json +28 -1
  5. package/contracts/runtime-command-surface.v1.json +145 -1
  6. package/contracts/workspace-intelligence/model-usage-event.v1.json +82 -0
  7. package/contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json +53 -0
  8. package/contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json +120 -0
  9. package/contracts/workspace-intelligence-architecture.v1.json +31 -2
  10. package/contracts/workspace-intelligence-chain.v1.json +44 -3
  11. package/dist/analyze-EEEU3MIF.js +1 -0
  12. package/dist/{artifact-remediation-plan-EPALZ2LC.js → artifact-remediation-plan-SPOUHMK5.js} +1 -1
  13. package/dist/autopilot-release-XGVXPOZI.js +1 -0
  14. package/dist/{chunk-2TEDAKP6.js → chunk-32OJDBIG.js} +1 -1
  15. package/dist/{chunk-ZDN7RHXJ.js → chunk-37CVKXBD.js} +1 -1
  16. package/dist/{chunk-YCL3I2JO.js → chunk-3NU32T4A.js} +1 -1
  17. package/dist/chunk-3VFA7D5T.js +1 -0
  18. package/dist/{chunk-CW7PGBIQ.js → chunk-4HDYADHT.js} +1 -1
  19. package/dist/{chunk-PBHP6JNY.js → chunk-54EP5CEV.js} +1 -1
  20. package/dist/{chunk-QDWYIRHR.js → chunk-5S3DJQEP.js} +1 -1
  21. package/dist/{chunk-NOFM7MNA.js → chunk-AFL3ACCR.js} +1 -1
  22. package/dist/{chunk-MEMHNE7Y.js → chunk-BFLJ2R4D.js} +1 -1
  23. package/dist/{chunk-6SWRNA47.js → chunk-BGPXQQNY.js} +1 -1
  24. package/dist/chunk-BMWFQXGW.js +1 -0
  25. package/dist/{chunk-2GHUZDYA.js → chunk-CRHYBQI3.js} +1 -1
  26. package/dist/{chunk-76YOPAOT.js → chunk-ESLPI3XZ.js} +1 -1
  27. package/dist/{chunk-DV6GJD4K.js → chunk-HDXNIN4N.js} +1 -1
  28. package/dist/{chunk-TNQI5VCW.js → chunk-HZDXO65G.js} +14 -14
  29. package/dist/{chunk-BSRVO52Y.js → chunk-I46XEIPL.js} +1 -1
  30. package/dist/{chunk-COARSXRC.js → chunk-J5ENLXDF.js} +1 -1
  31. package/dist/chunk-LHOZXC2M.js +2 -0
  32. package/dist/{chunk-RWRLFSKW.js → chunk-NAJCUQ4X.js} +1 -1
  33. package/dist/{chunk-ZM5NQ5Z2.js → chunk-OW42TZFB.js} +1 -1
  34. package/dist/{chunk-SK6XRKGG.js → chunk-P3D5YQB2.js} +1 -1
  35. package/dist/{chunk-TWNFECMN.js → chunk-PHXQR6PX.js} +1 -1
  36. package/dist/{chunk-ITCAMC2E.js → chunk-PRTR2DQ2.js} +1 -1
  37. package/dist/{chunk-KZZ36CK5.js → chunk-QNONOO4F.js} +1 -1
  38. package/dist/{chunk-7VLCK5JW.js → chunk-RHQW3DTP.js} +1 -1
  39. package/dist/{chunk-22NJ2ZMG.js → chunk-T4YR4RAI.js} +1 -1
  40. package/dist/{chunk-HSGFUKCN.js → chunk-VU7NZHPM.js} +1 -1
  41. package/dist/{chunk-VBSQ7MF6.js → chunk-Y5UJLPS4.js} +19 -19
  42. package/dist/{chunk-U5EZHZBX.js → chunk-YJZOMRAS.js} +1 -1
  43. package/dist/{create-7JKJDAQV.js → create-DBQNAMKP.js} +1 -1
  44. package/dist/{doctor-PGPNIS76.js → doctor-4NNUDNGZ.js} +1 -1
  45. package/dist/{dotnet-webapi-clean-6TVFBTVI.js → dotnet-webapi-clean-A6MVDYXX.js} +4 -4
  46. package/dist/{gofiber-standard-2BL7GWZB.js → gofiber-standard-I5YPQG5V.js} +1 -1
  47. package/dist/{gogin-standard-XGP3KBXA.js → gogin-standard-VY2L4QT5.js} +1 -1
  48. package/dist/index.d.ts +32 -11
  49. package/dist/index.js +127 -125
  50. package/dist/{pipeline-IB6ILJSV.js → pipeline-TQM43A3K.js} +1 -1
  51. package/dist/{springboot-standard-JJNUID6M.js → springboot-standard-55XKCBIZ.js} +4 -4
  52. package/dist/{workspace-H3QXBFGB.js → workspace-NCWRINEF.js} +1 -1
  53. package/dist/{workspace-agent-sync-C7SG2Z5W.js → workspace-agent-sync-662QHXGF.js} +1 -1
  54. package/dist/{workspace-context-BKQBKA4C.js → workspace-context-23YYCUCP.js} +1 -1
  55. package/dist/{workspace-contract-RPQQBQXR.js → workspace-contract-TU2I7GC2.js} +1 -1
  56. package/dist/{workspace-dependency-graph-23BI2HG7.js → workspace-dependency-graph-BP4EXYQ5.js} +1 -1
  57. package/dist/workspace-explain-MWUEN643.js +1 -0
  58. package/dist/workspace-explain-contract-ZPI3JXJU.js +1 -0
  59. package/dist/{workspace-feedback-WAID3IOE.js → workspace-feedback-SUVH2LUJ.js} +1 -1
  60. package/dist/{workspace-foundation-5OOJEO2D.js → workspace-foundation-WXJ6I7ES.js} +1 -1
  61. package/dist/{workspace-history-C6OP3IAQ.js → workspace-history-BANOJRQ2.js} +1 -1
  62. package/dist/{workspace-intelligence-VKDL3H2J.js → workspace-intelligence-MFJE7W67.js} +1 -1
  63. package/dist/workspace-intelligence-evaluation-IPH7M3WV.js +1 -0
  64. package/dist/{workspace-intelligence-runner-LVALAZY7.js → workspace-intelligence-runner-THYLHHMF.js} +1 -1
  65. package/dist/{workspace-knowledge-graph-FE2NTZKV.js → workspace-knowledge-graph-ARDC6HHG.js} +1 -1
  66. package/dist/workspace-knowledge-graph-export-UYAYFTWX.js +10 -0
  67. package/dist/workspace-mcp-serve-EZR6O76D.js +3 -0
  68. package/dist/{workspace-model-S33CIB2R.js → workspace-model-7OU2M3LE.js} +1 -1
  69. package/dist/{workspace-registry-summary-A3YDL63D.js → workspace-registry-summary-ORDK7A36.js} +1 -1
  70. package/dist/workspace-run-RLIYSOTN.js +1 -0
  71. package/dist/{workspace-verify-ZGH3NXAH.js → workspace-verify-EBVL7FWT.js} +1 -1
  72. package/dist/{workspace-watch-EVBJTMV7.js → workspace-watch-3BPGLFLB.js} +1 -1
  73. package/docs/GLOSSARY.md +28 -24
  74. package/docs/README.md +17 -10
  75. package/docs/README_CONTENT_CONTRACT.md +154 -0
  76. package/docs/commands-reference.md +14 -1
  77. package/docs/contracts/ARTIFACT_CATALOG.md +28 -19
  78. package/docs/contracts/README.md +3 -0
  79. package/docs/graph-benchmark-methodology.md +2 -2
  80. package/docs/workspace-intelligence-evaluation.md +147 -0
  81. package/docs/workspace-knowledge-graph.md +31 -10
  82. package/package.json +1 -1
  83. package/dist/analyze-UVXPRGYZ.js +0 -1
  84. package/dist/autopilot-release-5BQ6F5L2.js +0 -1
  85. package/dist/chunk-LNRAB7UY.js +0 -1
  86. package/dist/chunk-NRYS4CLR.js +0 -2
  87. package/dist/workspace-explain-WVN7JH3U.js +0 -1
  88. package/dist/workspace-explain-contract-SEFTVF6J.js +0 -1
  89. package/dist/workspace-mcp-serve-KT2I676Z.js +0 -3
  90. package/dist/workspace-run-M4LNJILC.js +0 -1
@@ -65,7 +65,8 @@ npx workspai workspace snapshot [--workspace <path>] [--json] [--include-paths]
65
65
  npx workspai workspace diff --from <snapshot-or-report|git[:ref]> [--workspace <path>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>] [--strict]
66
66
  npx workspai workspace impact --from <workspace-diff-report> [--workspace <path>] [--scope project:<name>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>] [--strict]
67
67
  npx workspai workspace verify [--from-impact <file>] [--workspace <path>] [--scope project:<name>] [--strict] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
68
- npx workspai workspace graph [emit|explain|search|benchmark|entities|evidence|path|overlay|dot|mermaid] [key] [value] [--from <graph.json>] [--limit <1..100>] [--workspace <path>] [--scope project:<name>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
68
+ npx workspai workspace graph [emit|explain|search|benchmark|entities|evidence|path|overlay|dot|mermaid|jsonld|graphml|gexf] [key] [value] [--from <graph.json>] [--output <file>] [--limit <1..100>] [--workspace <path>] [--scope project:<name>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
69
+ npx workspai workspace eval [init <task> [strategy]|record|status|report|compare --from <report>] [--workspace <path>] [--output <file>] [--json]
69
70
  npx workspai workspace watch [--workspace <path>] [--json] [--once] [--scan-depth <count>]
70
71
  npx workspai workspace explain|why <target> [--workspace <path>] [--json] [--write]
71
72
  npx workspai workspace trace --from <workspace-diff-report> [--workspace <path>] [--json] [--write]
@@ -144,6 +145,18 @@ that retrieval payload with the readable proof-indexed corpus using a labelled
144
145
  `characters / 4` estimate. It measures payload reduction only; it does not
145
146
  assert equivalent answer quality or model-specific billing savings.
146
147
 
148
+ `workspace graph jsonld|graphml|gexf` exports the current derived,
149
+ evidence-backed Knowledge Graph for semantic, graph-analysis, and interactive
150
+ 2D/3D consumers.
151
+ Use `--output <file>` for a durable export; Mermaid and DOT remain the compact
152
+ documentation-oriented renderings.
153
+
154
+ `workspace eval` records provider/tokenizer/estimate provenance, tool activity,
155
+ cost, latency, and verified task outcome. `eval record` accepts a
156
+ `model-usage-event.v1` JSON document on stdin. The live and finalized artifacts
157
+ are suitable for IDE dashboards and conform to
158
+ `workspace-intelligence-evaluation.v1`.
159
+
147
160
  `workspace model --write` also materializes the derived, contract-validated
148
161
  knowledge graph at `.workspai/reports/workspace-knowledge-graph.json`. The
149
162
  unified intelligence runner treats that artifact as a required output of the
@@ -76,25 +76,27 @@ Bare artifact names in this table are relative to `.workspai/reports/`.
76
76
  Entries beginning with `reports/` are relative to `.workspai/`; paths such as
77
77
  `AGENTS.md` are relative to the workspace root.
78
78
 
79
- | Command | Artifact | Schema | Contract file |
80
- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | -------------------------------------------------------------------------- |
81
- | `workspace model --write` | `workspace-model.json` | `workspace-model.v1` | `contracts/workspace-intelligence/workspace-model.v1.json` |
82
- | `workspace model --write` | `workspace-knowledge-graph.json` | `workspace-knowledge-graph.v1` | `contracts/workspace-intelligence/workspace-knowledge-graph.v1.json` |
83
- | `workspace snapshot` | `workspace-model-snapshot.json` | `workspace-model-snapshot.v1` | `contracts/workspace-intelligence/workspace-model-snapshot.v1.json` |
84
- | `workspace diff` | `workspace-model-diff-last-run.json` | `workspace-model-diff.v1` | `contracts/workspace-intelligence/workspace-model-diff.v1.json` |
85
- | `workspace impact --from <diff>` | `workspace-impact-last-run.json` | `workspace-impact.v1` | `contracts/workspace-intelligence/workspace-impact.v1.json` |
86
- | `analyze --json` | `analyze-last-run.json` | `rapidkit-analyze-v1` | `contracts/analyze-last-run.v1.json` |
87
- | `workspace verify` | `workspace-verify-last-run.json` | `workspace-verify.v1` | `contracts/workspace-intelligence/workspace-verify.v1.json` |
88
- | `workspace context --write` | `workspace-context-agent.json` | `workspace-context.v1` | `contracts/workspace-intelligence/workspace-context.v1.json` |
89
- | `workspace agent-sync --write` | `reports/agent-customization-pack.json` | `rapidkit-agent-customization-pack.v1` | `contracts/workspace-intelligence/agent-customization-pack-report.v1.json` |
90
- | `workspace agent-sync --write` | `reports/INDEX.json` | `rapidkit-agent-reports-index.v1` | `contracts/workspace-intelligence/agent-reports-index.v1.json` |
91
- | `workspace agent-sync --write` | `reports/workspace-skills-index.json` | `workspace-skills-index.v1` | `contracts/workspace-intelligence/workspace-skills-index.v1.json` |
92
- | `workspace agent-sync --write` | `reports/workspai-mcp-design.json`, `.workspai/skills/*.md`, `.workspai/AGENT-GROUNDING.md`, `AGENTS.md`, IDE agent surfaces | Mixed generated surfaces | See customization pack output inventory |
93
- | `workspace explain --write` | `workspace-explain-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
94
- | `workspace why --write` | `workspace-why-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
95
- | `workspace trace --write` | `workspace-trace-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
96
- | `workspace intelligence run` | `workspace-intelligence-run-last-run.json` | `workspace-intelligence-run.v1` | `contracts/workspace-intelligence/workspace-intelligence-run.v1.json` |
97
- | `workspace feedback record` / `doctor * --fix` | `workspace-intelligence-history.json` (`kind: agent-action`, `doctor-fix`) | `workspace-intelligence-history.v1` | `contracts/workspace-intelligence/workspace-intelligence-history.v1.json` |
79
+ | Command | Artifact | Schema | Contract file |
80
+ | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ---------------------------------------------------------------------------- |
81
+ | `workspace model --write` | `workspace-model.json` | `workspace-model.v1` | `contracts/workspace-intelligence/workspace-model.v1.json` |
82
+ | `workspace model --write` | `workspace-knowledge-graph.json` | `workspace-knowledge-graph.v1` | `contracts/workspace-intelligence/workspace-knowledge-graph.v1.json` |
83
+ | `workspace snapshot` | `workspace-model-snapshot.json` | `workspace-model-snapshot.v1` | `contracts/workspace-intelligence/workspace-model-snapshot.v1.json` |
84
+ | `workspace diff` | `workspace-model-diff-last-run.json` | `workspace-model-diff.v1` | `contracts/workspace-intelligence/workspace-model-diff.v1.json` |
85
+ | `workspace impact --from <diff>` | `workspace-impact-last-run.json` | `workspace-impact.v1` | `contracts/workspace-intelligence/workspace-impact.v1.json` |
86
+ | `analyze --json` | `analyze-last-run.json` | `rapidkit-analyze-v1` | `contracts/analyze-last-run.v1.json` |
87
+ | `workspace verify` | `workspace-verify-last-run.json` | `workspace-verify.v1` | `contracts/workspace-intelligence/workspace-verify.v1.json` |
88
+ | `workspace context --write` | `workspace-context-agent.json` | `workspace-context.v1` | `contracts/workspace-intelligence/workspace-context.v1.json` |
89
+ | `workspace agent-sync --write` | `reports/agent-customization-pack.json` | `rapidkit-agent-customization-pack.v1` | `contracts/workspace-intelligence/agent-customization-pack-report.v1.json` |
90
+ | `workspace agent-sync --write` | `reports/INDEX.json` | `rapidkit-agent-reports-index.v1` | `contracts/workspace-intelligence/agent-reports-index.v1.json` |
91
+ | `workspace agent-sync --write` | `reports/workspace-skills-index.json` | `workspace-skills-index.v1` | `contracts/workspace-intelligence/workspace-skills-index.v1.json` |
92
+ | `workspace agent-sync --write` | `reports/workspai-mcp-design.json`, `.workspai/skills/*.md`, `.workspai/AGENT-GROUNDING.md`, `AGENTS.md`, IDE agent surfaces | Mixed generated surfaces | See customization pack output inventory |
93
+ | `workspace explain --write` | `workspace-explain-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
94
+ | `workspace why --write` | `workspace-why-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
95
+ | `workspace trace --write` | `workspace-trace-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
96
+ | `workspace intelligence run` | `workspace-intelligence-run-last-run.json` | `workspace-intelligence-run.v1` | `contracts/workspace-intelligence/workspace-intelligence-run.v1.json` |
97
+ | `workspace feedback record` / `doctor * --fix` | `workspace-intelligence-history.json` (`kind: agent-action`, `doctor-fix`) | `workspace-intelligence-history.v1` | `contracts/workspace-intelligence/workspace-intelligence-history.v1.json` |
98
+ | `workspace eval init` / `workspace eval record` | `workspace-intelligence-evaluation-live.json` | `workspace-intelligence-evaluation.v1` | `contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json` |
99
+ | `workspace eval report` | `workspace-intelligence-evaluation-last-run.json` | `workspace-intelligence-evaluation.v1` | `contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json` |
98
100
 
99
101
  The unified runner report separates its execution envelope from the canonical
100
102
  intelligence chain. `preflight` always contains exactly `sync` and `baseline`;
@@ -111,6 +113,13 @@ recoverable artifact transaction. The graph carries a SHA-256 `source` binding
111
113
  to the canonical model, so consumers must reject a graph whose source hash does
112
114
  not equal the current structural model hash.
113
115
 
116
+ `workspace graph jsonld|graphml|gexf --output <path>` creates explicit interchange
117
+ projections from that bound graph. These files are portable exports, not competing
118
+ canonical or `last-run` artifacts: JSON-LD preserves semantic identifiers,
119
+ GraphML targets general graph tooling, and GEXF targets exploration and
120
+ visualization tools. Mermaid and DOT remain bounded text projections for docs
121
+ and diagrams.
122
+
114
123
  **CLI semantics:** `workspace diff --from` expects a **model or snapshot** baseline. `workspace impact --from` expects a **diff report**.
115
124
  Persisted artifacts retain their artifact schema. JSON command projections that add operation metadata
116
125
  such as `outputPath`, `status`, or structured errors use
@@ -81,6 +81,9 @@ Workspace intelligence (`../../contracts/workspace-intelligence/`):
81
81
  - `workspace-knowledge-graph-change-overlay.v1.json` — proposed/change-set facts and relations without mutating the base graph
82
82
  - `workspace-knowledge-search.v1.json` — bounded ranked retrieval for CLI, MCP, IDE, and agent consumers
83
83
  - `workspace-graph-token-efficiency.v1.json` — reproducible corpus-versus-retrieval payload measurement
84
+ - `model-usage-event.v1.json` — privacy-bounded model, tool, milestone, and verified-outcome events with explicit measurement provenance
85
+ - `workspace-intelligence-evaluation.v1.json` — live/final token, cost, latency, activity, and verified-outcome evaluation
86
+ - `workspace-intelligence-evaluation-comparison.v1.json` — task-aligned comparison of two completed evaluation strategies
84
87
  - `workspace-model-snapshot.v1.json`
85
88
  - `workspace-model-diff.v1.json`
86
89
  - `workspace-impact.v1.json`
@@ -52,8 +52,8 @@ language, model, or tokenizer.
52
52
 
53
53
  ## Current fixture observation
54
54
 
55
- The 16-project development workspace produced the following result on
56
- 2026-07-21 for `api endpoint --limit 8`:
55
+ The 16-project development workspace reproduced the following result on
56
+ 2026-07-22 for `api endpoint --limit 8`:
57
57
 
58
58
  | Measure | Observed value |
59
59
  | ------------------------------- | -------------: |
@@ -0,0 +1,147 @@
1
+ # Measure Workspace Intelligence Usage
2
+
3
+ Workspai can record model usage, tool activity, cost provenance, and the final
4
+ verified outcome of an agent task. The resulting artifact is designed for CLI,
5
+ IDE, CI, and dashboard consumers.
6
+
7
+ It does not store prompt or response bodies. Optional SHA-256 hashes let a
8
+ consumer correlate calls without copying private content into the report.
9
+
10
+ ## Start a measured task
11
+
12
+ ```bash
13
+ npx workspai workspace eval init repair-readiness workspace-intelligence --json
14
+ ```
15
+
16
+ The optional strategy is one of `full-corpus`, `grep`, `vector`, `graph`,
17
+ `workspace-intelligence`, or `custom`.
18
+
19
+ The live source of truth is:
20
+
21
+ ```text
22
+ .workspai/reports/workspace-intelligence-evaluation-live.json
23
+ ```
24
+
25
+ ## Record events
26
+
27
+ Providers and IDE integrations append privacy-bounded events through stdin:
28
+
29
+ ```bash
30
+ printf '%s\n' '{
31
+ "kind": "model-call",
32
+ "stage": "context",
33
+ "modelCall": {
34
+ "provider": "vscode-lm",
35
+ "model": "selected-model",
36
+ "source": "provider-reported",
37
+ "inputTokens": 18420,
38
+ "outputTokens": 2150,
39
+ "cachedInputTokens": 6200,
40
+ "reasoningTokens": null,
41
+ "latencyMs": 4820
42
+ }
43
+ }' | npx workspai workspace eval record --json
44
+ ```
45
+
46
+ `source` is mandatory:
47
+
48
+ | Source | Meaning |
49
+ | ------------------- | -------------------------------------------------------------- |
50
+ | `provider-reported` | The provider returned the count |
51
+ | `tokenizer-counted` | A named tokenizer counted the exact serialized input or output |
52
+ | `estimated` | A documented estimate; never presented as provider billing |
53
+ | `unavailable` | The provider exposed no usable count |
54
+
55
+ Tool events record progress and repeated work without storing command output:
56
+
57
+ ```json
58
+ {
59
+ "kind": "tool-call",
60
+ "stage": "verify",
61
+ "toolCall": {
62
+ "tool": "workspace verify",
63
+ "result": "passed",
64
+ "changedSource": false,
65
+ "durationMs": 814,
66
+ "artifact": ".workspai/reports/workspace-verify-last-run.json"
67
+ }
68
+ }
69
+ ```
70
+
71
+ Finish with a verified outcome event. Tokens per successful outcome remain
72
+ `null` until `status` is `passed` and `verified` is `true`.
73
+
74
+ ```json
75
+ {
76
+ "kind": "outcome",
77
+ "stage": "verify",
78
+ "outcome": {
79
+ "status": "passed",
80
+ "verified": true,
81
+ "blockersResolved": 1,
82
+ "summary": "Readiness passed after dependency remediation."
83
+ }
84
+ }
85
+ ```
86
+
87
+ Event bodies conform to
88
+ [`model-usage-event.v1.json`](../contracts/workspace-intelligence/model-usage-event.v1.json).
89
+
90
+ ## Inspect and finalize
91
+
92
+ ```bash
93
+ npx workspai workspace eval status --json
94
+ npx workspai workspace eval report --json
95
+ ```
96
+
97
+ Finalization writes:
98
+
99
+ ```text
100
+ .workspai/reports/workspace-intelligence-evaluation-last-run.json
101
+ ```
102
+
103
+ Both live and final reports conform to
104
+ [`workspace-intelligence-evaluation.v1.json`](../contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json).
105
+
106
+ ## Compare strategies
107
+
108
+ Save a completed baseline, run the same fixed task using another strategy, then
109
+ compare:
110
+
111
+ ```bash
112
+ npx workspai workspace eval compare --from .workspai/reports/baselines/full-corpus.json --json
113
+ ```
114
+
115
+ The comparison reports token, model-call, tool-call, latency, and verified
116
+ outcome differences. A smaller prompt is not treated as a better result unless
117
+ the outcomes are task-aligned and independently verified.
118
+
119
+ Comparison JSON conforms to
120
+ [`workspace-intelligence-evaluation-comparison.v1.json`](../contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json),
121
+ so CI, IDE, and dashboard consumers do not need to infer its shape.
122
+
123
+ ## Extension and dashboard contract
124
+
125
+ The VS Code extension should watch the live artifact and display its values; it
126
+ must not independently estimate or relabel them. At minimum the UI should show:
127
+
128
+ - run and session identity;
129
+ - live/final status and update time;
130
+ - input, output, cached-input, and reasoning token components;
131
+ - provider-reported, tokenizer-counted, estimated, and unavailable call counts;
132
+ - cost grouped by currency and source;
133
+ - tool calls, repeated artifact reads, and no-progress decisions;
134
+ - verified outcome and blockers resolved.
135
+
136
+ This makes the CLI artifact the source of truth for terminal, extension, CI,
137
+ and future hosted dashboards. MCP clients can read the same artifact through
138
+ `getWorkspaceEvaluation`; agent-sync also includes the finalized report in the
139
+ governed evidence index when it exists.
140
+
141
+ ## Relationship to the graph benchmark
142
+
143
+ `workspace graph benchmark` measures **retrieval payload size** using a portable
144
+ character estimate. `workspace eval` measures **observed agent execution** and
145
+ requires outcome evidence. Keep both: the first is deterministic and
146
+ provider-independent; the second is the basis for real token, cost, and task
147
+ efficiency claims.
@@ -93,16 +93,17 @@ be traced through `proofIds`.
93
93
 
94
94
  ## Pick the command by question
95
95
 
96
- | You want to know… | Use |
97
- | ---------------------------------------------------- | ------------------------------------------------------ |
98
- | What is relevant to a natural-language question? | `workspace graph search <query> --limit <n> --json` |
99
- | Which entities of one type exist? | `workspace graph entities <kind> --json` |
100
- | Why does Workspai believe an item exists? | `workspace graph evidence <entity-or-relation> --json` |
101
- | How are two things connected? | `workspace graph path <from> <to> --json` |
102
- | What changed between graph revisions? | `workspace graph overlay --from <graph.json> --json` |
103
- | What is the full portable graph? | `workspace graph emit --json` |
104
- | How much retrieval payload did one query avoid? | `workspace graph benchmark <query> --limit <n> --json` |
105
- | How should an MCP-compatible agent retrieve context? | `workspace mcp serve` `searchWorkspaceGraph` |
96
+ | You want to know… | Use |
97
+ | ---------------------------------------------------- | ------------------------------------------------------- |
98
+ | What is relevant to a natural-language question? | `workspace graph search <query> --limit <n> --json` |
99
+ | Which entities of one type exist? | `workspace graph entities <kind> --json` |
100
+ | Why does Workspai believe an item exists? | `workspace graph evidence <entity-or-relation> --json` |
101
+ | How are two things connected? | `workspace graph path <from> <to> --json` |
102
+ | What changed between graph revisions? | `workspace graph overlay --from <graph.json> --json` |
103
+ | What is the full portable graph? | `workspace graph emit --json` |
104
+ | How do I export to semantic or graph-analysis tools? | `workspace graph jsonld\|graphml\|gexf --output <file>` |
105
+ | How much retrieval payload did one query avoid? | `workspace graph benchmark <query> --limit <n> --json` |
106
+ | How should an MCP-compatible agent retrieve context? | `workspace mcp serve` → `searchWorkspaceGraph` |
106
107
 
107
108
  ## What it models
108
109
 
@@ -186,6 +187,26 @@ The complete graph is an interchange artifact, not a prompt. Agents should
186
187
  start with `INDEX.json`, use bounded search, then retrieve evidence or a path
187
188
  for the selected result.
188
189
 
190
+ ### Interchange and visualization
191
+
192
+ The JSON artifact is the canonical interchange form of the derived graph; the
193
+ Workspace Model remains the system source of truth. Other formats are
194
+ deterministic projections of that same graph revision:
195
+
196
+ ```bash
197
+ npx workspai workspace graph mermaid
198
+ npx workspai workspace graph dot
199
+ npx workspai workspace graph jsonld --output workspace-graph.jsonld
200
+ npx workspai workspace graph graphml --output workspace-graph.graphml
201
+ npx workspai workspace graph gexf --output workspace-graph.gexf
202
+ ```
203
+
204
+ - Mermaid and DOT are suited to documentation and architecture diagrams.
205
+ - JSON-LD carries semantic identities, relations, and proof references.
206
+ - GraphML and GEXF work with graph-analysis and interactive visualization tools.
207
+ - The canonical JSON, JSON-LD, GraphML, and GEXF outputs can drive 2D or 3D
208
+ viewers; a 3D view is a presentation layer, not a separate source of truth.
209
+
189
210
  ## AI tool output locations
190
211
 
191
212
  `workspace agent-sync --write --preset enterprise` generates native surfaces
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.47.0",
3
+ "version": "0.48.0",
4
4
  "type": "module",
5
5
  "description": "Open-source workspace intelligence CLI for software systems: create, adopt, govern, verify, and align polyglot workspaces for humans, CI, IDEs, and AI agents.",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-PBHP6JNY.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-QDWYIRHR.js';
@@ -1 +0,0 @@
1
- var o={model:".workspai/reports/workspace-model.json",knowledgeGraph:".workspai/reports/workspace-knowledge-graph.json",snapshot:".workspai/reports/workspace-model-snapshot.json",diff:".workspai/reports/workspace-model-diff-last-run.json",impact:".workspai/reports/workspace-impact-last-run.json",analyze:".workspai/reports/analyze-last-run.json",doctor:".workspai/reports/doctor-last-run.json",contractVerify:".workspai/reports/workspace-contract-verify-last-run.json",readiness:".workspai/reports/release-readiness-last-run.json",verify:".workspai/reports/workspace-verify-last-run.json",history:".workspai/reports/workspace-intelligence-history.json",agentContext:".workspai/reports/workspace-context-agent.json",agentIndex:".workspai/reports/INDEX.json",agentCustomizationPack:".workspai/reports/agent-customization-pack.json",skillsIndex:".workspai/reports/workspace-skills-index.json",agents:"AGENTS.md",explain:".workspai/reports/workspace-explain-last-run.json",intelligenceRun:".workspai/reports/workspace-intelligence-run-last-run.json"},t={model:"workspace-model.v1",knowledgeGraph:"workspace-knowledge-graph.v1",snapshot:"workspace-model-snapshot.v1",diff:"workspace-model-diff.v1",impact:"workspace-impact.v1",analyze:"rapidkit-analyze-v1",doctor:"doctor-workspace-evidence-v1",contractVerify:"workspace-contract-verify.v1",readiness:"release-readiness-v1",verify:"workspace-verify.v1",history:"workspace-intelligence-history.v1",agentContext:"workspace-context.v1",agentIndex:"rapidkit-agent-reports-index.v1",agentCustomizationPack:"rapidkit-agent-customization-pack.v1",skillsIndex:"workspace-skills-index.v1",agents:null,explain:"workspace-explain.v1",intelligenceRun:"workspace-intelligence-run.v1"},r={model:"contracts/workspace-intelligence/workspace-model.v1.json",knowledgeGraph:"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json",snapshot:"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",diff:"contracts/workspace-intelligence/workspace-model-diff.v1.json",impact:"contracts/workspace-intelligence/workspace-impact.v1.json",analyze:"contracts/analyze-last-run.v1.json",doctor:"contracts/doctor-workspace-evidence.v1.json",contractVerify:"contracts/workspace-intelligence/workspace-contract-verify.v1.json",readiness:"contracts/release-readiness.v1.json",verify:"contracts/workspace-intelligence/workspace-verify.v1.json",history:"contracts/workspace-intelligence/workspace-intelligence-history.v1.json",agentContext:"contracts/workspace-intelligence/workspace-context.v1.json",agentIndex:"contracts/workspace-intelligence/agent-reports-index.v1.json",agentCustomizationPack:"contracts/workspace-intelligence/agent-customization-pack-report.v1.json",skillsIndex:"contracts/workspace-intelligence/workspace-skills-index.v1.json",agents:null,explain:"contracts/workspace-intelligence/workspace-explain.v1.json",intelligenceRun:"contracts/workspace-intelligence/workspace-intelligence-run.v1.json"},a={analyze:"analyze",workspace:"workspace <action> [subaction] [key] [value]",doctor:"doctor [scope]",readiness:"readiness"},c=["analyze","readiness","doctor","workspace"],i=["model","diff","impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify","context","agent-sync","explain"],p=["sync","baseline"],l={sync:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],baseline:[o.snapshot]},e=o,d={model:{command:["workspace","model","--json","--write"],produces:[e.model,e.knowledgeGraph]},diff:{command:["workspace","diff","--from",e.snapshot,"--json"],produces:[e.diff]},impact:{command:["workspace","impact","--from",e.diff,"--json"],produces:[e.impact]},"doctor-evidence":{command:["doctor","workspace","--json"],produces:[e.doctor]},"contract-evidence":{command:["workspace","contract","verify","--strict","--json"],produces:[e.contractVerify]},"analyze-evidence":{command:["analyze","--json"],produces:[e.analyze]},"readiness-evidence":{command:["readiness","--json","--skip-verify"],produces:[e.readiness]},verify:{command:["workspace","verify","--from-impact",e.impact,"--json"],produces:[e.verify,e.history]},context:{command:["workspace","context","--for-agent","--json","--write","--no-agent-sync"],produces:[e.agentContext]},"agent-sync":{command:["workspace","agent-sync","--write","--json","--preset","enterprise"],produces:[e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents]},explain:{command:["workspace","explain","release-blocked","--json","--write"],produces:[e.explain]}};export{o as a,t as b,r as c,a as d,c as e,i as f,p as g,l as h,d as i};
@@ -1,2 +0,0 @@
1
- import {k,b as b$1,c as c$2}from'./chunk-ZDN7RHXJ.js';import {c as c$1}from'./chunk-RWRLFSKW.js';import {a as a$1}from'./chunk-22NJ2ZMG.js';import {e}from'./chunk-2TEDAKP6.js';import {b,a,i,c}from'./chunk-LNRAB7UY.js';import _ from'path';import T from'fs-extra';var D="workspai-workspace-intelligence-chain-v1",V="contracts/workspace-intelligence-chain.v1.json";function P(){let e=a,t=i,s=[{id:"model",ordinal:1,phase:"understand",label:"Model",command:[...t.model.command],consumes:["workspace markers","project metadata","registry","contract","policies"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules","existing-evidence"],consumesArtifacts:[],produces:[...t.model.produces],dependsOn:[],exitPolicy:"stop-on-error",purpose:"Build the canonical current model of the software system."},{id:"diff",ordinal:2,phase:"change",label:"Diff",command:[...t.diff.command],consumes:[e.model,e.snapshot],inputRefs:["changes","model-baseline"],consumesArtifacts:[e.model,e.snapshot],produces:[...t.diff.produces],dependsOn:["model"],exitPolicy:"stop-on-error",purpose:"Describe structural change against the selected baseline."},{id:"impact",ordinal:3,phase:"change",label:"Impact",command:[...t.impact.command],consumes:[e.model,e.diff],inputRefs:[],consumesArtifacts:[e.model,e.diff],produces:[...t.impact.produces],dependsOn:["diff"],exitPolicy:"stop-on-error",purpose:"Calculate transitive blast radius over the workspace graph."},{id:"doctor-evidence",ordinal:4,phase:"evidence",label:"Doctor Evidence",command:[...t["doctor-evidence"].command],consumes:["workspace runtime and project health signals"],inputRefs:["projects-repositories","runtime-dependencies","existing-evidence"],consumesArtifacts:[],produces:[...t["doctor-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh health evidence after the impact artifact exists."},{id:"contract-evidence",ordinal:5,phase:"evidence",label:"Contract Evidence",command:[...t["contract-evidence"].command],consumes:[".workspai/workspace.contract.json"],inputRefs:["workspace-rules"],consumesArtifacts:[],produces:[...t["contract-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh structural contract evidence without hiding failed verdicts."},{id:"analyze-evidence",ordinal:6,phase:"evidence",label:"Analyze Evidence",command:[...t["analyze-evidence"].command],consumes:[e.model,"workspace runtime and dependency signals"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules"],consumesArtifacts:[e.model],produces:[...t["analyze-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh analysis evidence required by the release-readiness gate."},{id:"readiness-evidence",ordinal:7,phase:"evidence",label:"Readiness Evidence",command:[...t["readiness-evidence"].command],consumes:["doctor, analysis, runtime, and release signals"],inputRefs:["runtime-dependencies","existing-evidence"],consumesArtifacts:[e.doctor,e.contractVerify,e.analyze],produces:[...t["readiness-evidence"].produces],dependsOn:["doctor-evidence","contract-evidence","analyze-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh release-readiness evidence before the definitive gate."},{id:"verify",ordinal:8,phase:"gate",label:"Verify",command:[...t.verify.command],consumes:[e.impact,e.doctor,e.contractVerify,e.readiness],inputRefs:[],consumesArtifacts:[e.impact,e.doctor,e.contractVerify,e.readiness],produces:[...t.verify.produces],dependsOn:["impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Emit the definitive evidence-backed workspace gate."},{id:"context",ordinal:9,phase:"ground",label:"Agent Context",command:[...t.context.command],consumes:[e.model,e.impact,e.verify],inputRefs:[],consumesArtifacts:[e.model,e.impact,e.verify],produces:[...t.context.produces],dependsOn:["verify"],exitPolicy:"stop-on-error",purpose:"Build compact agent context from the same verified evidence."},{id:"agent-sync",ordinal:10,phase:"distribute",label:"Agent Grounding",command:[...t["agent-sync"].command],consumerArgs:{vscode:["--target","vscode"]},consumes:[e.agentContext],inputRefs:[],consumesArtifacts:[e.agentContext],produces:[...t["agent-sync"].produces],dependsOn:["context"],exitPolicy:"stop-on-error",purpose:"Distribute one context into portable agent and IDE surfaces."},{id:"explain",ordinal:11,phase:"explain",label:"Explain",command:[...t.explain.command],consumes:[e.verify,e.impact],inputRefs:[],consumesArtifacts:[e.verify,e.impact],produces:[...t.explain.produces],dependsOn:["verify"],exitPolicy:"continue-on-structured-verdict",purpose:"Translate evidence and blockers into a human and agent-readable narrative."}];return {schemaVersion:D,name:"Workspace Intelligence Chain",contractPath:V,invariant:"Every consumer must preserve step identity, dependencies, artifact flow, and verdict semantics; presentation may change, chain meaning may not.",invariants:["Missing or unreadable input is unknown or unavailable; it must not be presented as verified absence.","Freshness and provenance travel with evidence and must not be discarded by projections.","The current graph is a workspace dependency graph, not a complete cross-language symbol or call graph.","Simple and standard presentations summarize the contract; their contractRefs must preserve complete traceability.","Conditional provider outputs must be resolved through their dedicated inventory contract.","Auxiliary capabilities expose or refresh intelligence but are not mandatory execution-chain steps.","Canonical step commands are stage-pure: they must not implicitly execute a downstream chain step or regenerate an upstream artifact.","Canonical JSON artifacts must satisfy their registered schema both when produced and when consumed across CLI, MCP, IDE, and CI trust boundaries.","Schema validity is necessary but not sufficient: hashes, embedded models, summaries, counts, graph statistics, and artifact references must remain semantically coherent.","Persisted impact evidence must be rejected as stale when the current workspace model or Git observation no longer matches its embedded diff.","Canonical artifact replacement must be atomic and workspace-contained; an interrupted or denied write must preserve the last valid artifact.","Concurrent history updates must be serialized without silently dropping entries, and invalid history must never be overwritten as if it were absent.","The canonical global registry is ~/.workspai/workspaces.json; ~/.rapidkit/workspaces.json is a non-authoritative compatibility mirror for legacy consumers and must not diverge after a CLI registry mutation."],semantics:{workspace:"The governed operating boundary that relates one or more projects and repositories to shared metadata, policies, contracts, evidence, and consumers.",repository:"A source-control boundary that may contain one or more projects and may live inside or outside the workspace root.",project:"A discoverable build or runtime unit with its own path, metadata or observable manifests, command capabilities, and evidence.",evidence:"A sourced observation or generated verification result with provenance and freshness; evidence may be consumed by a later run.",artifact:"A durable generated file that another command or consumer can read without parsing terminal prose.",gate:"A structured verdict with reasons and exit semantics derived from current evidence."},workspaceLifecycle:{ingestionRoutes:[{id:"create",label:"Create",commands:["create workspace","create project"],result:"Create a workspace or supported project and write canonical Workspai metadata."},{id:"adopt",label:"Adopt",commands:["adopt"],result:"Register an existing project in place without requiring source relocation."},{id:"import",label:"Import",commands:["import","workspace import"],result:"Attach an existing project or repository path to the workspace inventory."}],durableState:[{id:"workspace-identity",paths:[".workspai-workspace",".workspai/workspace.json"],purpose:"Identify the workspace boundary, profile, and canonical root."},{id:"project-inventory",paths:[".workspai/project.json",".workspai/context.json",".workspai/adopt.json","~/.workspai/workspaces.json","~/.rapidkit/workspaces.json (legacy compatibility mirror)"],purpose:"Record native, adopted, imported, and globally registered project locations while preserving a non-authoritative mirror for legacy extension discovery."},{id:"governance",paths:[".workspai/policies.yml",".workspai/workspace.contract.json"],purpose:"Define workspace policy and explicit structural relationships."},{id:"graph-overrides",paths:[".workspai/workspace-graph.overrides.json"],purpose:"Provide explicit dependency edges that override inferred relationships."}],rule:"Create, adopt, and import are ingestion routes, not intelligence facts. Their durable state becomes observable input to Model."},runtimeRegistry:{authority:"contracts/workspace-intelligence-runtime-registry.ts",artifacts:Object.entries(a).map(([r,a])=>({id:r,path:a,schemaVersion:b[r],schemaContract:c[r]}))},executionEnvelope:{rule:"Sync and baseline resolution are deterministic execution prerequisites, not canonical intelligence stages; every run reports them separately and preserves the exact canonical stage sequence.",operations:[{id:"sync",executionPoint:"before:model",artifacts:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],failurePolicy:"stop-and-report",purpose:"Reconcile portable workspace inventory and contract inputs before modeling."},{id:"baseline",executionPoint:"after:model-before:diff",artifacts:[e.snapshot],failurePolicy:"stop-and-report",purpose:"Create an initial structural baseline when absent or reuse the existing baseline before Diff."}],report:{artifact:e.intelligenceRun,schemaVersion:b.intelligenceRun,invariant:"The report must preserve exact preflight and stage order, registry-owned artifacts, failure propagation, and aggregate status/exit semantics."}},boundaries:{inputs:[{id:"projects-repositories",label:"Projects and repositories",sources:["projects","repositories","services","modules","imported paths"],entersAt:"model"},{id:"runtime-dependencies",label:"Runtime and dependencies",sources:["runtime manifests","lockfiles","scripts","framework markers","package dependencies","supported source imports (currently bounded JavaScript and TypeScript scanning)"],entersAt:"model"},{id:"workspace-rules",label:"Workspace rules",sources:["workspace markers","registry","project metadata","contracts","policies","ownership","graph overrides"],entersAt:"model"},{id:"changes",label:"Changes",sources:["repository state","git state","model baseline","workspace diff"],entersAt:"diff"},{id:"model-baseline",label:"Explicit model baseline",sources:[e.snapshot],entersAt:"diff"},{id:"existing-evidence",label:"Existing evidence",sources:["doctor reports","analysis reports","contract verification","release readiness","pipeline results","tests and runtime evidence","previous intelligence artifacts"],entersAt:"doctor-evidence"}],outputs:[{id:"understanding",label:"System understanding",artifacts:[e.model,e.knowledgeGraph,e.diff,e.impact],producedBy:["model","diff","impact"],inventory:"complete-for-chain"},{id:"governance-evidence",label:"Governance evidence",artifacts:[e.doctor,e.contractVerify,e.analyze,e.readiness,e.verify,e.history],producedBy:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify"],inventory:"complete-for-chain"},{id:"agent-grounding",label:"Agent grounding",artifacts:[e.agentContext,e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents],producedBy:["context","agent-sync"],inventory:"canonical-minimum",inventoryContract:"contracts/agent-customization-pack.v1.json"},{id:"explanations",label:"Explainable decisions",artifacts:[e.explain],producedBy:["explain"],inventory:"complete-for-chain"}],consumers:[{id:"developers",label:"Developers",channels:["CLI","reports","AGENTS.md"]},{id:"ci",label:"CI",channels:["JSON artifacts","exit codes","release gates"]},{id:"ides",label:"IDEs",channels:["synced contracts","extension","agent context"]},{id:"ai-agents",label:"AI agents",channels:["INDEX.json","context","skills","MCP"]}]},deliveryChannels:[{id:"artifacts",carries:["reports","models","context","grounding","skills"],authority:"canonical"},{id:"json-stdout",carries:["structured command results"],authority:"projection"},{id:"human-cli",carries:["summaries","diagnostics","next actions"],authority:"projection"},{id:"exit-codes",carries:["gate and command status"],authority:"projection"},{id:"watch-events",carries:["incremental workspace change events"],authority:"projection"},{id:"mcp",carries:["read-mostly access to current workspace artifacts"],authority:"projection"}],feedback:{from:["developers","ci","ides","ai-agents"],signals:["source commits","dependency updates","policy and contract edits","repairs","test and runtime results","agent action outcomes"],reentersThrough:["projects-repositories","runtime-dependencies","workspace-rules","changes","existing-evidence"],rule:"Consumer actions are not silently treated as truth. They re-enter as observable changes or evidence and must be modeled and verified again."},auxiliaryCapabilities:[{id:"graph",commands:["workspace graph emit","workspace graph explain","workspace graph dot","workspace graph mermaid"],reads:[e.model,e.knowledgeGraph],role:"Query the proof-backed graph derived from the canonical workspace model.",chainStep:false},{id:"watch",commands:["workspace watch"],reads:["workspace inputs",e.model],role:"Refresh the model incrementally and emit deterministic change events.",chainStep:false},{id:"mcp",commands:["workspace mcp serve"],reads:["workspace evidence artifacts"],role:"Expose read-mostly workspace evidence to compatible clients.",chainStep:false}],presentations:{simple:{layers:["inputs","intelligence","outputs","consumers"],nodes:[{id:"input-layer",kind:"inputs",label:"Input Layer",summary:"Projects \xB7 Repositories \xB7 Dependencies \xB7 Changes",contractRefs:["projects-repositories","runtime-dependencies","workspace-rules","changes","model-baseline","existing-evidence"]},{id:"workspace-intelligence",kind:"intelligence",label:"Workspace Intelligence",summary:"Model \xB7 Graph \xB7 Impact \xB7 Verify",contractRefs:s.map(r=>r.id)},{id:"agent-grounding",kind:"outputs",label:"Agent Grounding",summary:"AGENTS.md \xB7 Skills \xB7 Context",contractRefs:["agent-grounding"]},{id:"evidence-and-decisions",kind:"outputs",label:"Evidence Contracts",summary:"Reports \xB7 Artifacts \xB7 Gates",contractRefs:["understanding","governance-evidence","explanations"]},{id:"shared-consumers",kind:"consumers",label:"Shared Consumers",summary:"Developers \xB7 CI \xB7 IDEs \xB7 AI agents",contractRefs:["developers","ci","ides","ai-agents"]}],rule:"Use concrete user-facing language for first-contact explanations. Every input, output, consumer, and chain step must remain traceable through contractRefs even when details are summarized."},standard:{phases:["understand","change","evidence","gate","ground","distribute","explain"],nodes:[{id:"understand",label:"Understand",question:"What exists in the current workspace?",stepRefs:["model"]},{id:"change",label:"Change",question:"What changed, and what can it affect?",stepRefs:["diff","impact"]},{id:"evidence",label:"Evidence",question:"What health, contract, and readiness facts were observed?",stepRefs:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"]},{id:"gate",label:"Gate",question:"Is the current state acceptable and trustworthy?",stepRefs:["verify"]},{id:"ground",label:"Ground",question:"What should an agent know before acting?",stepRefs:["context"]},{id:"distribute",label:"Distribute",question:"Which durable agent and IDE surfaces receive that context?",stepRefs:["agent-sync"]},{id:"explain",label:"Explain",question:"Why did the system reach this result or verdict?",stepRefs:["explain"]}],rule:"Use for architecture education and product surfaces. Every phase must appear once and in order."},advanced:{steps:s.map(r=>r.id),requiredFields:["command","inputRefs","consumesArtifacts","produces","dependsOn","exitPolicy","purpose"],rule:"Use for implementers, adapters, IDEs, and CI. Preserve every step and its artifact and verdict semantics."}},steps:s,diagram:{direction:"TB",nodes:s.map(({id:r,label:a,phase:i})=>({id:r,label:a,phase:i})),edges:s.flatMap(r=>r.dependsOn.map(a=>({from:a,to:r.id,meaning:"required before"})))},consumers:{agents:{canonicalReadOrder:[e.agentIndex,e.agentContext,e.verify,e.impact,e.explain,e.model,e.knowledgeGraph,e.agentCustomizationPack,e.skillsIndex],entrypoints:[e.agents,".workspai/AGENT-GROUNDING.md"],rule:"Agents must cite current artifacts, preserve verified versus inferred status, and re-run the producing step when evidence is missing or stale."},ideAndCi:{requiredArtifacts:[e.model,e.knowledgeGraph,e.impact,e.verify],rule:"IDEs and CI must consume structured artifacts and verdict exit semantics rather than parse human help or terminal prose."},docsAndDiagrams:{rule:"Documentation and diagrams must derive labels, ordering, and edges from this contract and must not invent implemented steps."}}}}var z=b.agentContext,K=a.agentContext;function H(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function O(e){return `npx --yes --package workspai workspai ${e}`.trim()}function u(e){return `npx workspai ${e}`.trim()}function d(e){return {id:e.id,scope:e.scope,display:u(e.args),execute:O(e.args),description:e.description,...e.project?{project:e.project}:{},freshness:b$1({id:`command.${e.id}`,label:`${e.id} command`,scope:"command",value:{display:u(e.args),execute:O(e.args)},...e.project?{project:e.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e.generatedAt,now:e.now,sourceArtifact:a.model,sourcePath:`safeCommands.${e.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function N(e,t){return `workspace run ${t} --scope project:${e.name}`}function B(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function U(e){return [e.name,e.path,_.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function J(e,t,s){let r={generatedAt:e.generatedAt,now:s},a=[d({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...r}),d({id:"workspace.graph.entities",scope:"workspace",args:"workspace graph entities --json",description:"Query proof-backed workspace entities without loading the full graph.",...r}),d({id:"workspace.graph.evidence",scope:"workspace",args:"workspace graph evidence <entity-or-relation> --json",description:"Resolve portable evidence for a graph entity or relation.",...r}),d({id:"workspace.graph.path",scope:"workspace",args:"workspace graph path <from> <to> --json",description:"Find a shortest proof-carrying path between workspace entities.",...r}),d({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...r}),d({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...r}),d({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...r}),d({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...r})],i=t?[t]:e.projects;for(let o of i)o.commands.fleetStages.includes("test")&&a.push(d({id:`project.${o.name}.test`,scope:"project",project:o.name,args:N(o,"test"),description:`Run tests for ${o.name} through workspace orchestration.`,...r})),o.commands.fleetStages.includes("build")&&a.push(d({id:`project.${o.name}.build`,scope:"project",project:o.name,args:N(o,"build"),description:`Build ${o.name} through workspace orchestration.`,...r}));return a}function X(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function Q(e,t){if(!t?.startsWith("project:"))return;let s=B(t);if(s)return e.projects.find(r=>U(r).includes(s))}function Y(e,t,s){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!s&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let a=r.filter(o=>o.severity==="error").length,i=r.filter(o=>o.severity==="warning").length;return {status:a>0?"failed":i>0?"warning":"passed",errors:a,warnings:i,issues:r}}function Z(e){let t=[],s=[];for(let[r,a]of Object.entries(e.evidence))a?.exists?t.push(`${r}: ${a.path}`):s.push(r);return {available:t.sort(),missing:s.sort()}}function ee(e){let t=e.summary.projectCount,s=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${s}, and ${r}.`}function te(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function fe(e){let t=e.model??await k({workspacePath:e.workspacePath,includeEvidence:e.includeEvidence===true,observableScanDepth:e.observableScanDepth,now:e.now}),s=H(e.agent),r=Q(t,e.scope),a$1=Y(t,e.scope,r);if(e.strict===true&&a$1.status!=="passed"){let n=a$1.issues.map(m=>`${m.severity}:${m.code}:${m.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${n}`)}let i=e.now??new Date,o=t.facts??[],G=new Set((r?[r]:t.projects).map(n=>n.name)),v=o.filter(n=>n.project?G.has(n.project):true),M=(r?[r]:t.projects).map(n=>{let m=v.filter(F=>F.project===n.name);return {name:n.name,path:n.path,kind:n.kind,runtime:n.runtime,framework:n.frameworkDisplayName,...n.generator?{generator:n.generator}:{},createCapability:n.createCapability,supportTier:n.supportTier,safeCommands:X(n),importantFiles:n.importantFiles,facts:m}}),g=Z(t),k$1=_.join(e.workspacePath,a.knowledgeGraph),p=await T.pathExists(k$1)?await T.readJson(k$1).catch(()=>null):null,w=false;if(p?.schemaVersion===b.knowledgeGraph)try{c$1(p,t),w=true;}catch{}let b$2=ee(t),C=J(t,r,i),L=C.map(n=>b$1({id:`context.command.${n.id}`,label:`${n.id} safe command`,scope:"command",value:{display:n.display,execute:n.execute,scope:n.scope},...n.project?{project:n.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:i,sourceArtifact:a.agentContext,sourcePath:`safeCommands.${n.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),x=[...v,...L],f=c$2({facts:x,generatedAt:i.toISOString(),now:i}),h=P();return {schemaVersion:z,generatedAt:i.toISOString(),agent:s,workspaceSummary:b$2,modelRef:a.model,knowledgeGraph:{artifact:a.knowledgeGraph,schemaVersion:b.knowledgeGraph,available:w,...typeof p?.quality?.entityCount=="number"?{entityCount:p.quality.entityCount}:{},...typeof p?.quality?.relationCount=="number"?{relationCount:p.quality.relationCount}:{},...typeof p?.quality?.proofCount=="number"?{proofCount:p.quality.proofCount}:{},queryCommands:[u("workspace graph search <query> --limit 12 --json"),u("workspace graph entities [kind] --json"),u("workspace graph evidence <entity-or-relation> --json"),u("workspace graph path <from> <to> --json")]},intelligenceChain:{schemaVersion:h.schemaVersion,contractPath:h.contractPath,currentStep:"context",canonicalReadOrder:[...h.consumers.agents.canonicalReadOrder]},workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e.scope??"workspace",...r?{activeProject:r.name}:{}},projects:M,safeCommands:C,facts:x,factFreshness:f,evidence:g,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:a$1,agentInstructions:[`Read \`${a.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use `workspace graph search <query> --limit 12 --json` for bounded, proof-backed retrieval before loading the full graph.",`Load \`${a.knowledgeGraph}\` only when a complete graph export is explicitly required.`,"Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx workspai workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[...te(t),...f.verifyBeforeUseFacts>0?[`${f.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[b$2,`Evidence available: ${g.available.length}. Missing evidence groups: ${g.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
2
- `)}}async function he(e$1,t){return e(t,K,a$1(e$1))}export{D as a,P as b,z as c,K as d,fe as e,he as f};
@@ -1 +0,0 @@
1
- export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-CW7PGBIQ.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-2GHUZDYA.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-NOFM7MNA.js';
@@ -1 +0,0 @@
1
- export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,e as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget,d as resolveWorkspaceTraceTarget}from'./chunk-HSGFUKCN.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-2GHUZDYA.js';
@@ -1,3 +0,0 @@
1
- import {b}from'./chunk-CW7PGBIQ.js';import {d,c as c$2,f,e as e$1}from'./chunk-WDKNMTJQ.js';import {c as c$1,e}from'./chunk-HSGFUKCN.js';import {c as c$4,b as b$1}from'./chunk-2GHUZDYA.js';import {d as d$2}from'./chunk-NRYS4CLR.js';import {d as d$3}from'./chunk-ZM5NQ5Z2.js';import {h}from'./chunk-ZDN7RHXJ.js';import {c as c$3}from'./chunk-RWRLFSKW.js';import {e as e$2}from'./chunk-22NJ2ZMG.js';import {d as d$1}from'./chunk-2TEDAKP6.js';import {a as a$2}from'./chunk-KB44JP4M.js';import {a as a$1,c}from'./chunk-LNRAB7UY.js';import {r}from'./chunk-5XATWNME.js';import u from'path';import N from'readline';import g from'fs-extra';var q=a$1.agentIndex,L=new Map(Object.keys(a$1).flatMap(e=>{let t=c[e];return t?[[a$1[e],t]]:[]}));function M(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var J=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceKnowledgeGraph",description:"Read the current proof-backed workspace knowledge graph artifact",inputSchema:{type:"object",properties:{}}},{name:"queryWorkspaceEntities",description:"List workspace knowledge entities, optionally filtered by kind",inputSchema:{type:"object",properties:{kind:{type:"string",description:"Optional entity kind"}}}},{name:"searchWorkspaceGraph",description:"Return bounded, proof-carrying workspace context matching a text query",inputSchema:{type:"object",properties:{query:{type:"string",description:"Text, path, symbol, service, or concept to find"},kind:{type:"string",description:"Optional entity kind filter"},limit:{type:"integer",minimum:1,maximum:100,default:12}},required:["query"]}},{name:"getWorkspaceGraphEvidence",description:"Resolve portable evidence for a knowledge graph entity or relation",inputSchema:{type:"object",properties:{query:{type:"string"}},required:["query"]}},{name:"findWorkspaceGraphPath",description:"Find a shortest proof-carrying path between two workspace entities",inputSchema:{type:"object",properties:{from:{type:"string"},to:{type:"string"}},required:["from","to"]}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function H(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!u.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function a(e,t){if(!H(t))throw new Error(`Unsafe artifact path: ${t}`);let r$1=await d$1(e,t)??u.join(e,t);if(!await g.pathExists(r$1))return null;let n=await g.readJson(r$1),o=r(t),c=L.get(o);if(c&&a$2(n,c,`MCP artifact ${o}`),o===a$1.knowledgeGraph){let p=u.join(e,h);if(!await g.pathExists(p))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let l=await g.readJson(p);c$3(n,l);}return n}async function F(e$1){let t=[],r=new Set,o=((await a(e$1,d$3))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$3,reasons:o});for(let i of o)r.add(i);}let c=await a(e$1,c$4);if(e(c)){let i=(c.blockingReasons??[]).filter(s=>typeof s=="string"&&s.trim().length>0);if(i.length>0){t.push({artifact:c$4,reasons:i});for(let s of i)r.add(s);}}let p=await a(e$1,e$2),l=(p?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(l.length>0||String(p?.status??"").toLowerCase()==="failed"){let i=l.length>0?l:["Workspace contract verification failed"];t.push({artifact:e$2,reasons:i});for(let s of i)r.add(s);}return {blockingReasons:[...r],sources:t}}async function I(e$2,t,r){switch(t){case "getWorkspaceModel":return a(e$2,h);case "getWorkspaceKnowledgeGraph":return a(e$2,a$1.knowledgeGraph);case "queryWorkspaceEntities":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=String(r.kind??"").trim();return {schemaVersion:n.schemaVersion,generatedAt:n.generatedAt,entities:e$1(n,o||void 0)}}case "searchWorkspaceGraph":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=typeof r.limit=="number"?r.limit:Number(r.limit??12);return f(n,{query:String(r.query??""),...typeof r.kind=="string"&&r.kind.trim()?{kind:r.kind.trim()}:{},limit:Number.isFinite(o)?o:12})}case "getWorkspaceGraphEvidence":{let n=await a(e$2,a$1.knowledgeGraph);return n?c$2(n,String(r.query??"")):null}case "findWorkspaceGraphPath":{let n=await a(e$2,a$1.knowledgeGraph);return n?d(n,String(r.from??""),String(r.to??"")):null}case "getEvidenceIndex":return a(e$2,q);case "getBlockers":return F(e$2);case "getSafeCommands":return {safeCommands:(await a(e$2,d$2))?.safeCommands??[]};case "getProjectContext":{let n=await a(e$2,d$2);if(!n)return null;let o=String(r.project??"").trim(),c=n.scope?.activeProject??void 0,p=o||c,l=Array.isArray(n.projects)?n.projects:[],i=p&&l.find(s=>typeof s.name=="string"&&s.name.toLowerCase()===p.toLowerCase());return {workspace:n.workspace??null,scope:n.scope??null,validation:n.validation??null,project:i??null,safeCommands:n.safeCommands??[]}}case "getArtifact":{let n=String(r.relativePath??"").trim();return a(e$2,n)}case "listOperationalSkills":return a(e$2,b$1);case "getWorkspaceExplain":{let n=String(r.target??"release-blocked").trim(),o=c$1(n);if(!o)throw new Error(`Invalid explain target: ${n}`);let c=await a(e$2,c$4);return e(c)&&M(c.target,o)?c:b({workspacePath:e$2,target:o})}default:throw new Error(`Unknown tool: ${t}`)}}function R(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
2
- `);}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
3
- `);}async function ce(e){let t=u.resolve(e.workspacePath),r=N.createInterface({input:process.stdin,terminal:false});for await(let n of r){let o=n.trim();if(!o)continue;let c;try{c=JSON.parse(o);}catch{E(null,"Invalid JSON-RPC request");continue}let{id:p,method:l,params:i}=c;try{if(l==="initialize"){R(p,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(l==="notifications/initialized")continue;if(l==="tools/list"){R(p,{tools:J.map(s=>({name:s.name,description:s.description,inputSchema:s.inputSchema}))});continue}if(l==="tools/call"){let s=String(i?.name??""),K=i?.arguments&&typeof i.arguments=="object"?i.arguments:{},S=await I(t,s,K);R(p,{content:[{type:"text",text:JSON.stringify(S,null,2)}],isError:S==null});continue}E(p,`Unsupported method: ${l??"unknown"}`);}catch(s){E(p,s instanceof Error?s.message:String(s));}}}async function pe(e,t,r={}){return I(u.resolve(e),t,r)}export{J as WORKSPACE_MCP_READ_TOOLS,pe as invokeMcpToolForTest,ce as runWorkspaceMcpServe};
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-KZZ36CK5.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-DV6GJD4K.js';