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
@@ -1,440 +1,81 @@
1
- # 🔄 Dynamic AI Integration with Python Core
1
+ # AI Recommender Architecture
2
2
 
3
- > **Date:** January 1, 2026
4
- > **Implementation:** Dynamic module catalog fetching from Python Core
3
+ This document describes the optional module recommender implementation for
4
+ contributors. It does not define the canonical Workspace Intelligence chain.
5
5
 
6
- ---
6
+ ## Runtime flow
7
7
 
8
- ## 🎯 Summary
9
-
10
- AI system uses a **dynamic runtime catalog** and fetches module metadata from **RapidKit Python Core** instead of relying only on hardcoded entries.
11
-
12
- ### Before (Static):
13
-
14
- ```typescript
15
- // ❌ Hardcoded fixed subset
16
- export const MODULE_CATALOG = [
17
- { id: 'authentication-core', ... },
18
- // ... 10 more
19
- ]
20
- ```
21
-
22
- ### After (Dynamic):
23
-
24
- ```typescript
25
- // ✅ Fetches from Python Core
26
- export async function getModuleCatalog() {
27
- const result = await exec('rapidkit modules list --json');
28
- return parseModules(result);
29
- }
30
- ```
31
-
32
- ---
33
-
34
- ## 📊 Architecture
35
-
36
- ### Data Flow
37
-
38
- ```
39
- User Query
40
-
41
- AI Recommender
8
+ ```text
9
+ ai recommend
42
10
 
43
- getModuleCatalog()
11
+ load user configuration and provider mode
44
12
 
45
- ├─ Try: rapidkit modules list --json
46
- │ └─ Success: Return Python modules (runtime count)
47
- │ └─ Fail: Return fallback catalog (baseline subset)
13
+ load module catalog + compatible embeddings
48
14
 
49
- Generate Embeddings
15
+ embed the query
50
16
 
51
- Cosine Similarity
17
+ rank by cosine similarity
52
18
 
53
- Return Top Recommendations
54
- ```
55
-
56
- ---
57
-
58
- ## 🔧 Implementation Details
59
-
60
- ### 1. Dynamic Module Fetching (`src/ai/module-catalog.ts`)
61
-
62
- **Features:**
63
-
64
- - Calls `rapidkit modules list --json`
65
- - 5-minute cache (reduces Python calls)
66
- - Fallback to hardcoded catalog if Python not available
67
- - Automatic retry and error handling
68
- - Category and framework mapping
69
-
70
- **Code:**
71
-
72
- ```typescript
73
- export async function getModuleCatalog(): Promise<ModuleMetadata[]> {
74
- // Check cache
75
- if (cachedModules && Date.now() - lastFetchTime < CACHE_TTL) {
76
- return cachedModules;
77
- }
78
-
79
- // Fetch from Python Core
80
- try {
81
- const { stdout } = await execAsync('rapidkit modules list --json');
82
- const modules = parseModules(stdout);
83
- cachedModules = modules;
84
- return modules;
85
- } catch (error) {
86
- console.warn('⚠️ Using fallback catalog');
87
- return FALLBACK_MODULE_CATALOG;
88
- }
89
- }
90
- ```
91
-
92
- ---
93
-
94
- ### 2. Module Parsing
95
-
96
- **Handles different Python CLI output formats:**
97
-
98
- ```typescript
99
- // Format 1: Array
100
- ["module1", "module2"]
101
-
102
- // Format 2: Object with modules key
103
- { "modules": [...] }
104
-
105
- // Format 3: Object with data key
106
- { "data": [...] }
107
- ```
108
-
109
- **Category Mapping:**
110
-
111
- ```typescript
112
- Python Category → TypeScript Type
113
- ├─ "auth" → "auth"
114
- ├─ "authentication" "auth"
115
- ├─ "database" "database"
116
- ├─ "payment" → "payment"
117
- ├─ "billing" → "payment"
118
- └─ etc.
119
- ```
120
-
121
- ---
122
-
123
- ### 3. Cache Strategy
124
-
125
- **TTL: 5 minutes**
126
-
127
- ```
128
- First call:
129
- ├─ Fetch from Python (10s)
130
- ├─ Cache result
131
- └─ Return
132
-
133
- Subsequent calls (within 5 min):
134
- ├─ Return cached
135
- └─ Instant response
136
-
137
- After 5 min:
138
- ├─ Re-fetch from Python
139
- └─ Update cache
140
- ```
141
-
142
- **Benefits:**
143
-
144
- - ✅ Fast responses (cached)
145
- - ✅ Always up-to-date (5min refresh)
146
- - ✅ Reduces Python CLI calls
147
-
148
- ---
149
-
150
- ### 4. Fallback Mechanism
151
-
152
- **Graceful degradation:**
153
-
154
- ```
155
- Try Python Core:
156
- ├─ Success → Use runtime module catalog ✅
157
- ├─ Python not in PATH → Use fallback subset ⚠️
158
- ├─ Command timeout → Use fallback subset ⚠️
159
- └─ Parse error → Use fallback subset ⚠️
160
- ```
161
-
162
- **Fallback catalog:**
163
-
164
- - Baseline core modules (hardcoded subset)
165
- - Authentication, database, payment, etc.
166
- - Enough for basic recommendations
167
-
168
- ---
169
-
170
- ### 5. Embedding Generation
171
-
172
- **Now dynamic:**
173
-
174
- ```bash
175
- # Old: Generated from fixed hardcoded subset
176
- npx tsx src/ai/generate-embeddings.ts
177
-
178
- # New: Fetches from Python Core first
179
- # → Gets runtime module catalog
180
- # → Generates embeddings for all discovered modules
181
- # → Saves to data/modules-embeddings.json
182
- ```
183
-
184
- **Output:**
185
-
186
- ```json
187
- {
188
- "model": "text-embedding-3-small",
189
- "dimension": 1536,
190
- "generated_at": "2026-01-01T...",
191
- "modules": [
192
- {
193
- "id": "authentication-core",
194
- "name": "Authentication Core",
195
- "embedding": [0.123, -0.456, ...]
196
- }
197
- // ... runtime modules (from Python)
198
- ]
199
- }
200
- ```
201
-
202
- ---
203
-
204
- ## 🚀 Usage Examples
205
-
206
- ### Example 1: With Python Core Available
207
-
208
- ```bash
209
- $ workspai ai recommend "I need user authentication"
210
-
211
- # Behind the scenes:
212
- # 1. Calls: rapidkit modules list --json
213
- # 2. Gets runtime module catalog from Python Core
214
- # 3. Generates query embedding
215
- # 4. Compares with catalog embeddings
216
- # 5. Returns top 5 recommendations
217
-
218
- 📦 Recommended Modules:
219
- 1. authentication-core ⭐ (98% match)
220
- 2. users-core ⭐ (92% match)
221
- 3. session-management (88% match)
222
- ...
223
- ```
224
-
225
- ---
226
-
227
- ### Example 2: Without Python Core (Fallback)
228
-
229
- ```bash
230
- $ workspai ai recommend "payment processing"
231
-
232
- # Console output:
233
- ⚠️ RapidKit Python Core not found in PATH
234
- Using fallback module catalog (baseline subset)
235
-
236
- # Still works! Uses hardcoded fallback subset
237
- 📦 Recommended Modules:
238
- 1. stripe-payment ⭐ (95% match)
239
- ...
240
- ```
241
-
242
- ---
243
-
244
- ### Example 3: No Matching Modules
245
-
246
- ```bash
247
- $ workspai ai recommend "blockchain integration"
248
-
249
- # Output:
250
- ⚠️ No matching modules found in RapidKit Core registry.
251
-
252
- 💡 Options:
253
-
254
- 1. Create custom module:
255
- rapidkit modules scaffold blockchain-integration --category integrations
256
-
257
- 2. Search with different keywords
258
- Try more general terms (e.g., "storage" instead of "blockchain")
259
-
260
- 3. Request feature:
261
- https://github.com/rapidkitlabs/workspai/issues
262
- ```
263
-
264
- ---
265
-
266
- ## 📋 Benefits
267
-
268
- ### ✅ Always Up-to-Date
269
-
270
- ```
271
- When Python Core adds new modules:
272
- ├─ AI automatically picks them up
273
- ├─ No code changes needed in npm
274
- ├─ Just regenerate embeddings
275
- └─ Users get latest recommendations
276
- ```
277
-
278
- ### ✅ Single Source of Truth
279
-
280
- ```
281
- Module Registry:
282
- ├─ Python Core: runtime catalog (source of truth)
283
- ├─ npm AI: Reads from Python (always synced)
284
- └─ No duplicate data
285
- ```
286
-
287
- ### ✅ Graceful Fallback
288
-
289
- ```
290
- If Python unavailable:
291
- ├─ Still works (fallback subset)
292
- ├─ User informed (console warning)
293
- ├─ No crashes or errors
294
- └─ Can upgrade to Python later
295
- ```
296
-
297
- ### ✅ Performance
298
-
299
- ```
300
- Cache Strategy:
301
- ├─ First call: 10s (Python fetch)
302
- ├─ Cached calls: <100ms (instant)
303
- ├─ Cache refresh: Every 5 minutes
304
- └─ Optimal balance
305
- ```
306
-
307
- ---
308
-
309
- ## 🔧 Configuration
310
-
311
- ### Environment Variables
312
-
313
- ```bash
314
- # Optional: Force fallback mode (testing)
315
- export RAPIDKIT_AI_FALLBACK=true
316
-
317
- # Optional: Cache TTL (default: 5 minutes)
318
- export RAPIDKIT_CACHE_TTL=600000 # milliseconds
319
-
320
- # Optional: Python command/interpreter override (if python3/python is not the right one)
321
- export RAPIDKIT_PYTHON_CMD=/path/to/python
322
- ```
323
-
324
- ---
325
-
326
- ## 🧪 Testing
327
-
328
- ### Test 1: With Python Core
329
-
330
- ```bash
331
- # Ensure Python Core in PATH
332
- which rapidkit # Should return path
333
-
334
- # Test recommendation
335
- workspai ai recommend "authentication"
336
-
337
- # Should show: using runtime catalog from Python Core
338
- ```
339
-
340
- ### Test 2: Without Python Core
341
-
342
- ```bash
343
- # Temporarily hide Python
344
- export PATH=/tmp:$PATH
345
-
346
- # Test recommendation
347
- workspai ai recommend "authentication"
348
-
349
- # Should show: ⚠️ Using fallback catalog (baseline subset)
350
- ```
351
-
352
- ### Test 3: Cache Behavior
353
-
354
- ```bash
355
- # First call (cold cache)
356
- time workspai ai recommend "auth" # ~10 seconds
357
-
358
- # Second call (warm cache)
359
- time workspai ai recommend "database" # <1 second
360
-
361
- # Wait 6 minutes, try again
362
- sleep 360
363
- time workspai ai recommend "payment" # ~10 seconds (cache expired)
364
- ```
365
-
366
- ---
367
-
368
- ## 📊 Comparison
369
-
370
- | Feature | Before (Static) | After (Dynamic) |
371
- | ------------------- | ------------------ | ------------------ |
372
- | **Module Count** | Fixed subset | Runtime catalog |
373
- | **Updates** | Manual code change | Automatic |
374
- | **Sync** | Manual | Automatic |
375
- | **Fallback** | ❌ None | ✅ Baseline subset |
376
- | **Cache** | ❌ None | ✅ 5-minute TTL |
377
- | **Python Required** | ❌ No | ⚠️ Recommended |
378
- | **Performance** | Fast (hardcoded) | Fast (cached) |
379
-
380
- ---
381
-
382
- ## 🚀 Next Steps
383
-
384
- ### Current Stage: ✅ Dynamic Fetching
385
-
386
- - ✅ Fetch from Python Core
387
- - ✅ Cache with TTL
388
- - ✅ Fallback to hardcoded
389
- - ✅ Error handling
390
-
391
- ### Next Stage: Module Installation
392
-
393
- ```bash
394
- workspai ai recommend "authentication"
395
- # → Shows recommendations
396
- # → [Install] button
397
- # → Calls: rapidkit add module authentication-core
398
- # → Python Core installs module
399
- ```
400
-
401
- ### Future Stage: Real-time Sync
402
-
403
- ```bash
404
- # Watch Python modules directory
405
- # Auto-regenerate embeddings when modules change
406
- # Push updates to users
407
- ```
408
-
409
- ---
410
-
411
- ## 🎯 Summary
412
-
413
- **What Changed:**
414
-
415
- - ✅ AI now reads from Python Core dynamically
416
- - ✅ Runtime catalog instead of a fixed hardcoded subset
417
- - ✅ Always up-to-date
418
- - ✅ Fallback if Python not available
419
- - ✅ 5-minute cache for performance
420
-
421
- **What Stayed Same:**
422
-
423
- - ✅ Same API (getModuleCatalog)
424
- - ✅ Same recommendation algorithm
425
- - ✅ Same embedding model
426
- - ✅ Same CLI commands
427
- - ✅ Backward compatible
428
-
429
- **Result:**
430
-
431
- - 🎉 Runtime-driven catalog
432
- - 🎉 Single source of truth
433
- - 🎉 Production-ready
434
- - 🎉 Zero breaking changes
435
-
436
- ---
437
-
438
- **Built by the Workspai Team**
439
-
440
- _Dynamic AI that grows with your framework._
19
+ return human or JSON recommendations
20
+ ↓ optional, interactive
21
+ validate project `add` capability → Core bridge module install
22
+ ```
23
+
24
+ ## Source ownership
25
+
26
+ | Concern | Source area |
27
+ | -------------------------------- | ------------------------------------------- |
28
+ | Command and error behavior | `src/commands/ai.ts` |
29
+ | Provider/mock embedding client | `src/ai/openai-client.ts` |
30
+ | Module catalog and Core fallback | `src/ai/module-catalog.ts` |
31
+ | Ranking | `src/ai/recommender.ts` |
32
+ | Catalog generation/update | `src/ai/embeddings-manager.ts` |
33
+ | User configuration | `src/config/user-config.ts` |
34
+ | Core process boundary | `src/core-bridge/pythonRapidkitExec.ts` |
35
+ | Project command capability | `src/utils/project-command-capabilities.ts` |
36
+
37
+ ## Catalog resolution
38
+
39
+ The recommender prefers compatible bundled catalog data. Development refreshes
40
+ can request module metadata through the validated Core bridge. If Core is not
41
+ available, a bounded fallback catalog permits basic discovery.
42
+
43
+ Catalog records must preserve their embedding model and dimension metadata.
44
+ Never combine vectors produced by incompatible models. Catalog caches are
45
+ in-process optimizations, not durable sources of truth.
46
+
47
+ ## Failure behavior
48
+
49
+ - Missing provider key selects mock mode for `recommend`.
50
+ - Missing catalog in provider mode returns a structured remediation pointing to
51
+ `ai generate-embeddings`.
52
+ - Provider authentication, rate-limit, and network failures return non-zero.
53
+ - Invalid or unavailable project `add` capability blocks installation without
54
+ weakening the recommendation response.
55
+ - Human and JSON output must preserve the same underlying result semantics.
56
+
57
+ ## Security boundaries
58
+
59
+ - Provider secrets come from user configuration or environment, never workspace
60
+ evidence.
61
+ - Logs and JSON responses must not emit provider keys.
62
+ - Core commands execute through the shared bridge rather than ad-hoc process
63
+ spawning.
64
+ - Module recommendation is advisory; installation remains capability-gated and
65
+ verification remains the responsibility of project/Workspace Intelligence
66
+ commands.
67
+
68
+ ## Testing expectations
69
+
70
+ Changes to this area require coverage for:
71
+
72
+ - provider and mock modes;
73
+ - missing/invalid configuration;
74
+ - catalog present, missing, and incompatible cases;
75
+ - deterministic ranking fixtures;
76
+ - JSON error contracts and non-zero exits;
77
+ - supported and unsupported Core installation capabilities;
78
+ - secret redaction.
79
+
80
+ Use [AI_QUICKSTART.md](./AI_QUICKSTART.md) for user setup and
81
+ [AI_FEATURES.md](./AI_FEATURES.md) for the public behavioral contract.