@cubis/foundry 0.3.40 → 0.3.42

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 (29) hide show
  1. package/README.md +67 -3
  2. package/bin/cubis.js +360 -26
  3. package/mcp/README.md +72 -8
  4. package/mcp/config.json +3 -0
  5. package/mcp/dist/index.js +315 -68
  6. package/mcp/src/config/index.test.ts +1 -0
  7. package/mcp/src/config/schema.ts +5 -0
  8. package/mcp/src/index.ts +40 -9
  9. package/mcp/src/server.ts +66 -10
  10. package/mcp/src/telemetry/tokenBudget.ts +114 -0
  11. package/mcp/src/tools/index.ts +7 -0
  12. package/mcp/src/tools/skillBrowseCategory.ts +22 -5
  13. package/mcp/src/tools/skillBudgetReport.ts +128 -0
  14. package/mcp/src/tools/skillGet.ts +18 -0
  15. package/mcp/src/tools/skillListCategories.ts +19 -6
  16. package/mcp/src/tools/skillSearch.ts +22 -5
  17. package/mcp/src/tools/skillTools.test.ts +61 -9
  18. package/mcp/src/vault/manifest.test.ts +19 -1
  19. package/mcp/src/vault/manifest.ts +12 -1
  20. package/mcp/src/vault/scanner.test.ts +1 -0
  21. package/mcp/src/vault/scanner.ts +1 -0
  22. package/mcp/src/vault/types.ts +6 -0
  23. package/package.json +1 -1
  24. package/workflows/workflows/agent-environment-setup/platforms/antigravity/rules/GEMINI.md +28 -0
  25. package/workflows/workflows/agent-environment-setup/platforms/codex/rules/AGENTS.md +31 -2
  26. package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/AGENTS.md +28 -0
  27. package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/copilot-instructions.md +28 -0
  28. package/workflows/workflows/agent-environment-setup/platforms/cursor/rules/.cursorrules +28 -0
  29. package/workflows/workflows/agent-environment-setup/platforms/windsurf/rules/.windsurfrules +28 -0
package/mcp/README.md CHANGED
@@ -24,7 +24,7 @@ This server exposes built-in tools plus dynamic passthrough tools discovered fro
24
24
 
25
25
  | Domain | Tools | Purpose |
26
26
  | ----------- | ----- | ------------------------------------------------------------- |
27
- | **Skills** | 4 | Browse, search, and retrieve skill definitions from the vault |
27
+ | **Skills** | 5 | Browse/search/get + budget reporting for skill definitions |
28
28
  | **Postman config** | 3 | Read/write Postman MCP mode in `cbx_config.json` |
29
29
  | **Stitch config** | 3 | Read/write Stitch active profile in `cbx_config.json` |
30
30
  | **Postman passthrough** | dynamic | `postman.<tool_name>` for all discovered upstream Postman tools |
@@ -68,6 +68,7 @@ mcp/
68
68
  │ │ ├── skillBrowseCategory.ts
69
69
  │ │ ├── skillSearch.ts
70
70
  │ │ ├── skillGet.ts
71
+ │ │ ├── skillBudgetReport.ts
71
72
  │ │ ├── postmanModes.ts # Mode ↔ URL mapping
72
73
  │ │ ├── postmanGetMode.ts
73
74
  │ │ ├── postmanSetMode.ts
@@ -78,9 +79,11 @@ mcp/
78
79
  │ │ └── future/
79
80
  │ │ ├── index.ts
80
81
  │ │ └── README.md
81
- └── utils/
82
+ ├── utils/
82
83
  │ ├── logger.ts # stderr-only logger
83
84
  │ └── errors.ts # MCP error helpers
85
+ │ └── telemetry/
86
+ │ └── tokenBudget.ts # Deterministic token estimator
84
87
  ```
85
88
 
86
89
  ## Prerequisites
@@ -114,6 +117,9 @@ Controls vault roots, transport defaults, and summary truncation:
114
117
  "roots": ["../workflows/skills"],
115
118
  "summaryMaxLength": 200
116
119
  },
120
+ "telemetry": {
121
+ "charsPerToken": 4
122
+ },
117
123
  "transport": {
118
124
  "default": "stdio",
119
125
  "http": { "port": 3100, "host": "127.0.0.1" }
@@ -146,6 +152,12 @@ npm start
146
152
  # Streamable HTTP transport
147
153
  node dist/index.js --transport http
148
154
 
155
+ # Scoped config defaults for built-in config tools
156
+ node dist/index.js --scope global
157
+
158
+ # HTTP host/port override
159
+ node dist/index.js --transport http --host 0.0.0.0 --port 3100
160
+
149
161
  # Scan vault and exit (verify skill discovery)
150
162
  npm run scan
151
163
 
@@ -156,6 +168,14 @@ npm run mcp:inspect
156
168
  node dist/index.js --debug
157
169
  ```
158
170
 
171
+ From the root CLI, the canonical local entrypoint is:
172
+
173
+ ```bash
174
+ cbx mcp serve --transport stdio --scope auto
175
+ cbx mcp serve --transport http --scope auto --host 127.0.0.1 --port 3100
176
+ cbx mcp serve --scan-only
177
+ ```
178
+
159
179
  ### Startup Banner
160
180
 
161
181
  On each startup the server prints fixed token savings metrics:
@@ -177,6 +197,8 @@ Followed by Postman/Stitch config status (or a warning if `cbx_config.json` is m
177
197
 
178
198
  ### Skills Tools
179
199
 
200
+ All skill tools include `structuredContent.metrics` with deterministic estimated token/context budget fields.
201
+
180
202
  #### `skill_list_categories`
181
203
 
182
204
  List all skill categories in the vault.
@@ -258,6 +280,44 @@ Get the full SKILL.md content for a specific skill.
258
280
  ```
259
281
 
260
282
  **Output**: Full markdown content of the skill file (as `type: "text"` content block).
283
+ `structuredContent.metrics` includes `loadedSkillEstimatedTokens` and estimated savings vs full catalog.
284
+
285
+ #### `skill_budget_report`
286
+
287
+ Consolidated Skill Log + Context Budget report for selected/loaded skill IDs.
288
+
289
+ **Input**:
290
+
291
+ ```json
292
+ {
293
+ "selectedSkillIds": ["react-expert"],
294
+ "loadedSkillIds": ["react-expert"]
295
+ }
296
+ ```
297
+
298
+ **Output**:
299
+
300
+ ```json
301
+ {
302
+ "skillLog": {
303
+ "selectedSkills": [{ "id": "react-expert", "category": "frontend", "estimatedTokens": 123 }],
304
+ "loadedSkills": [{ "id": "react-expert", "category": "frontend", "estimatedTokens": 123 }],
305
+ "skippedSkills": ["fastapi-expert"],
306
+ "unknownSelectedSkillIds": [],
307
+ "unknownLoadedSkillIds": []
308
+ },
309
+ "contextBudget": {
310
+ "estimatorVersion": "char-estimator-v1",
311
+ "charsPerToken": 4,
312
+ "fullCatalogEstimatedTokens": 80160,
313
+ "selectedSkillsEstimatedTokens": 123,
314
+ "loadedSkillsEstimatedTokens": 123,
315
+ "estimatedSavingsTokens": 80037,
316
+ "estimatedSavingsPercent": 99.85,
317
+ "estimated": true
318
+ }
319
+ }
320
+ ```
261
321
 
262
322
  ### Postman Tools
263
323
 
@@ -459,6 +519,9 @@ The vault's lazy content model dramatically reduces token usage:
459
519
 
460
520
  **Fixed banner values**: `2004/35/~245/~80,160/99.7%`
461
521
 
522
+ All token values are deterministic estimates, not provider-native metering.
523
+ Estimator formula: `estimated_tokens = ceil(char_count / charsPerToken)` where `charsPerToken` defaults to `4`.
524
+
462
525
  ## MCP Client Configuration
463
526
 
464
527
  ### Codex / Antigravity
@@ -467,9 +530,8 @@ The vault's lazy content model dramatically reduces token usage:
467
530
  {
468
531
  "mcpServers": {
469
532
  "cubis-foundry": {
470
- "command": "node",
471
- "args": ["path/to/cubis-foundry/mcp/dist/index.js"],
472
- "transport": "stdio"
533
+ "command": "cbx",
534
+ "args": ["mcp", "serve", "--transport", "stdio", "--scope", "auto"]
473
535
  }
474
536
  }
475
537
  }
@@ -483,14 +545,16 @@ Add to `.vscode/mcp.json`:
483
545
  {
484
546
  "servers": {
485
547
  "cubis-foundry": {
486
- "command": "node",
487
- "args": ["${workspaceFolder}/mcp/dist/index.js"],
488
- "transport": "stdio"
548
+ "type": "stdio",
549
+ "command": "cbx",
550
+ "args": ["mcp", "serve", "--transport", "stdio", "--scope", "auto"]
489
551
  }
490
552
  }
491
553
  }
492
554
  ```
493
555
 
556
+ Side-by-side topology is supported: keep direct `postman`/`StitchMCP` entries and add `cubis-foundry`.
557
+
494
558
  ### Streamable HTTP (any client)
495
559
 
496
560
  ```json
package/mcp/config.json CHANGED
@@ -8,6 +8,9 @@
8
8
  "roots": ["../workflows/skills"],
9
9
  "summaryMaxLength": 200
10
10
  },
11
+ "telemetry": {
12
+ "charsPerToken": 4
13
+ },
11
14
  "transport": {
12
15
  "default": "stdio",
13
16
  "http": {