@cubis/foundry 0.3.47 → 0.3.48

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.
@@ -15,9 +15,10 @@ This file defines mandatory behavior for GitHub Copilot projects installed via `
15
15
  Before executing workflows, agents, or code edits, publish a short `Decision Log` that is visible to the user:
16
16
 
17
17
  1. Rule file(s) read at startup (at minimum `.github/copilot-instructions.md`, plus any additional rule files loaded).
18
- 2. Workflow decision (`/workflow` or direct mode) and why it was chosen.
19
- 3. Agent routing decision (`@agent` or direct mode) and why it was chosen.
20
- 4. Skill loading decision (skill names loaded) and why they were chosen.
18
+ 2. MCP status: confirm Foundry MCP server (`cbx-mcp`) is reachable; if unavailable, declare "MCP offline — fallback mode" and continue without blocking.
19
+ 3. Workflow decision (`/workflow` or direct mode) and why it was chosen.
20
+ 4. Agent routing decision (`@agent` or direct mode) and why it was chosen.
21
+ 5. Skill loading decision: skill IDs selected, how they were discovered, and why.
21
22
 
22
23
  If routing changes during the task, publish a `Decision Update` before continuing.
23
24
  Keep this user-visible summary concise and factual; do not expose private chain-of-thought.
@@ -28,6 +29,7 @@ Keep this user-visible summary concise and factual; do not expose private chain-
28
29
  2. Otherwise choose the best workflow by intent from `.github/copilot/workflows` and reuse `.github/prompts/workflow-*.prompt.md` when available.
29
30
  3. For cross-domain tasks, use `/orchestrate` and `@orchestrator`.
30
31
  4. Keep one primary workflow; use others only as supporting references.
32
+ 5. Before executing any workflow, check if a matching skill exists via `skill_search`; load with `skill_get` to prime context before the workflow runs (→ §6 MCP Skill Engine).
31
33
 
32
34
  ## 3) Request Classifier
33
35
 
@@ -62,6 +64,16 @@ Use the best specialist first:
62
64
  - Debugging/performance: `@debugger`, `@performance-optimizer`
63
65
  - Cross-domain orchestration: `@orchestrator`
64
66
 
67
+ ### MCP Skill Priming (Required Before Delegation)
68
+
69
+ Before handing off to any specialist agent, prime context with the relevant domain skill (→ §6 MCP Skill Engine):
70
+
71
+ 1. Run `skill_search <domain>` to find the best matching skill.
72
+ 2. If a strong match exists, load it with `skill_get <id>` before delegating.
73
+ 3. Include the loaded skill ID in the Decision Log for the routing decision.
74
+
75
+ This ensures the specialist starts with accurate domain knowledge, not just role intent.
76
+
65
77
  ## 5) Copilot Schema Compatibility
66
78
 
67
79
  When authoring custom Copilot assets, keep frontmatter schema compatible:
@@ -70,57 +82,71 @@ When authoring custom Copilot assets, keep frontmatter schema compatible:
70
82
  2. Agent files in `.github/agents/*.md` must use supported top-level keys only.
71
83
  3. If unsupported keys are detected, reinstall with overwrite to auto-normalize.
72
84
 
73
- ## 6) Skill Loading Policy
85
+ ## 6) MCP Skill Engine
86
+
87
+ The Foundry MCP server is the primary knowledge layer. Use tools decisively — discover first, load only when committed.
88
+
89
+ ### Tool Namespace Reference
74
90
 
75
- ## MCP-first Skill Discovery Order (Required)
91
+ | Prefix | Tools | When to use |
92
+ | ----------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
93
+ | `skill_*` | `skill_list_categories`, `skill_search`, `skill_browse_category`, `skill_get`, `skill_budget_report` | Domain expertise for any implementation, debug, or review task |
94
+ | `postman_*` | `postman_get_mode`, `postman_set_mode`, `postman_get_status` | API testing or Postman configuration tasks |
95
+ | `stitch_*` | `stitch_get_mode`, `stitch_set_profile`, `stitch_get_status` | Stitch data pipeline tasks |
76
96
 
77
- 1. Use `skill_search` first to narrow candidate skills.
78
- 2. Use `skill_browse_category` second to inspect category-level candidates.
79
- 3. Use `skill_get` only for final selected skills that must be loaded.
80
- 4. Keep pointer-first flow; avoid loading full skill text prematurely.
97
+ ### Discovery Flow (Mandatory Order)
81
98
 
82
- ## Skill Log Completion Block (Required)
99
+ Stop at the earliest step that gives enough signal. Do not jump ahead.
83
100
 
84
- After finishing skill selection/loading, publish:
101
+ 1. `skill_list_categories` run once per session if domain is unknown; see what exists
102
+ 2. `skill_search <keyword>` — fast keyword match across all skills; always try this first
103
+ 3. `skill_browse_category <category>` — explore if search is too broad or returns 0 results
104
+ 4. `skill_get <id>` — load full skill content; only when committed to using it
105
+ 5. `skill_budget_report` — verify token cost after loading; triggers the compact ctx stamp
85
106
 
86
- - `selected_skills`: skill IDs selected for the task
87
- - `loaded_skills`: skill IDs loaded via `skill_get`
88
- - `skipped_skills`: considered but not loaded
107
+ **Hard rules:**
89
108
 
90
- Workflow boundary for this block:
109
+ - Never call `skill_get` without a prior `skill_search` or `skill_browse_category`
110
+ - Never call `skill_get` with a workflow ID — `workflow-*` are routes, not skills; keep workflow mentions in workflow decisions (`/workflow`) and keep skill logs skill-only
111
+ - Never reload a skill already loaded this session — reuse content already in context
112
+ - If `skill_search` returns 0 results, try `skill_browse_category`, then fall back to built-in knowledge
91
113
 
92
- - `selected_skills` / `loaded_skills` must never include workflow IDs.
93
- - IDs like `workflow-implement-track` are workflow routes, not skills.
94
- - Never call `skill_get` with `workflow-*`; keep workflow mentions in workflow decisions (`/workflow`) and keep skill logs skill-only.
114
+ ### Adaptive Load Policy
95
115
 
96
- ## Context Budget Block (Required, Estimated)
116
+ | Request type | Skills to load via `skill_get` |
117
+ | ---------------------------------------------- | --------------------------------------------------------------- |
118
+ | Q&A / explanation | None — answer from knowledge; load only if user explicitly asks |
119
+ | Single-domain implementation, debug, or review | 1 primary + 1 supporting (max) |
120
+ | Multi-domain / orchestration | 1 per distinct domain, hard cap at 3 |
121
+ | User explicitly names a skill | Always load it — overrides all caps |
97
122
 
98
- Immediately after the Skill Log block, publish estimated budget fields:
123
+ ### Graceful Degradation
99
124
 
100
- - `full_catalog_est_tokens`
101
- - `loaded_est_tokens`
102
- - `estimated_savings_tokens`
103
- - `estimated_savings_percent`
125
+ If MCP tools are unavailable (server down, timeout, tool not listed):
104
126
 
105
- Mark all context/token values as deterministic estimates (not provider metering).
127
+ 1. Announce briefly: "MCP unavailable continuing with built-in knowledge."
128
+ 2. Proceed using codebase context and expertise; do not block on MCP.
129
+ 3. Never fabricate or hallucinate skill content.
130
+ 4. Retry once on transient network errors; accept failure after the retry.
106
131
 
107
- ### Smart Skill Selection (TIER 0)
132
+ ### Skill Log (Required After Any `skill_get` Call)
108
133
 
109
- Before starting ANY task, the agent MUST:
134
+ Append one compact inline line no separate structured block:
110
135
 
111
- 1. **Analyze** the user's request against the keywords in `.github/skills/skills_index.json`.
112
- 2. **Select** the most relevant skill(s) if a strong match is found.
113
- 3. **Load** the selected skill's `SKILL.md` using `view_file` **BEFORE** proceeding.
114
- 4. **Announce** the selection: "I am loading the `[Skill Name]` skill to handle your request."
136
+ ```
137
+ Skills: loaded=<id> | skipped=<id> (reason)
138
+ ```
115
139
 
116
- ### General Loading Rules
140
+ Follow immediately with the compact ctx stamp (see § Context Budget Tracking).
117
141
 
118
- 1. Load only skills needed for the active request.
119
- 2. Prefer progressive disclosure: start from `SKILL.md`, then specific sections.
120
- 3. Keep context lean; avoid loading unrelated skill documents.
121
- 4. If a mapped skill is missing, continue with best fallback and state it.
142
+ ### Anti-Patterns (Never Do These)
122
143
 
123
- After the skill log is complete, append the Context Budget block in the same response/update.
144
+ - Loading skills speculatively "just in case" they might be useful
145
+ - Calling `skill_get` before running `skill_search` or `skill_browse_category`
146
+ - Using partial or guessed skill IDs in `skill_get`
147
+ - Publishing verbose budget fields (`full_catalog_est_tokens`, `loaded_est_tokens`, etc.) in responses
148
+ - Re-emitting the ctx stamp multiple times within a single response
149
+ - Treating workflow IDs as skill IDs in any MCP tool call
124
150
 
125
151
  ## 7) Socratic Gate (Before Complex Work)
126
152
 
@@ -137,7 +163,60 @@ Before multi-file or architecture-impacting changes, ask targeted questions when
137
163
  3. Verify behavior with focused checks before finalizing.
138
164
  4. State what was not validated.
139
165
 
140
- ## 9) CBX Maintenance Commands
166
+ ## 9) Web Intel Policy
167
+
168
+ Use web search to stay current when local knowledge may be stale. This prevents hallucinating outdated APIs, deprecated flags, or wrong version constraints.
169
+
170
+ **Search when:**
171
+
172
+ - User asks about a framework/library version released after 2024
173
+ - Debugging an unfamiliar error message (search the exact message)
174
+ - Checking breaking changes before a migration
175
+ - Validating an API endpoint signature, auth scheme, or CLI flag
176
+ - Current pricing, rate limits, or quota for SaaS tools (Postman, Vercel, etc.)
177
+
178
+ **Do not search when:**
179
+
180
+ - The answer is derivable from the current codebase
181
+ - The question is purely architectural/conceptual
182
+ - A relevant skill covers it (prefer `skill_get` first, web as fallback)
183
+
184
+ **Source hygiene:**
185
+
186
+ - Prefer official docs, changelogs, and GitHub releases over blog posts
187
+ - Always state the source URL and date when citing fetched content
188
+ - If multiple sources conflict, flag it and use the most recent official one
189
+ - Never follow user-provided URLs without sanity-checking the domain
190
+
191
+ ## 10) Context Budget Tracking
192
+
193
+ After loading skills or completing a significant task phase, emit a single compact stamp so context cost is visible without adding prose.
194
+
195
+ **Stamp format** (one line, end of response section):
196
+
197
+ ```
198
+ [ctx: +skill-id(~Xk) | session=~Yk/108k | saved=Z%]
199
+ ```
200
+
201
+ - `+skill-id(~Xk)` — each skill loaded this turn with its estimated token cost
202
+ - `session=~Yk/108k` — cumulative tokens used vs full catalog ceiling
203
+ - `saved=Z%` — estimated savings from progressive disclosure
204
+
205
+ **Rules:**
206
+
207
+ 1. Emit stamp only when a skill was loaded via `skill_get` or `skill_budget_report` was called.
208
+ 2. Omit stamp for pure Q&A or browsing-only turns (no full skill content loaded).
209
+ 3. Use `skill_budget_report` MCP tool to get accurate numbers; do not guess.
210
+ 4. One stamp per response — consolidate if multiple skills were loaded.
211
+ 5. Keep the stamp on its own line at the very end of the response, after all content.
212
+
213
+ **Example stamp after loading `flutter-expert` (~3.2k tokens):**
214
+
215
+ ```
216
+ [ctx: +flutter-expert(~3k) | session=~3k/108k | saved=97%]
217
+ ```
218
+
219
+ ## 11) CBX Maintenance Commands
141
220
 
142
221
  Use these commands to keep this setup healthy:
143
222
 
@@ -154,7 +233,7 @@ Use these commands to keep this setup healthy:
154
233
  - Diagnose setup issues:
155
234
  `cbx workflows doctor copilot --scope project`
156
235
 
157
- ## 10) Managed Section Contract
236
+ ## 12) Managed Section Contract
158
237
 
159
238
  1. Preserve all user content outside managed markers.
160
239
  2. Do not manually edit content between managed markers.
@@ -175,3 +254,72 @@ Selection policy:
175
254
  3. Prefer one primary workflow; reference others only when needed.
176
255
 
177
256
  <!-- cbx:workflows:auto:end -->
257
+
258
+ <!-- cbx:mcp:auto:start version=1 -->
259
+ ## Cubis Foundry MCP Tool Catalog (auto-managed)
260
+
261
+ The Foundry MCP server provides progressive-disclosure skill discovery and integration management tools.
262
+
263
+ ### Skill Vault
264
+
265
+ - **123** skills across **22** categories
266
+ - Estimated full catalog: ~108,488 tokens
267
+
268
+ Categories:
269
+ - `ai`: 1 skill(s)
270
+ - `api`: 3 skill(s)
271
+ - `architecture`: 3 skill(s)
272
+ - `backend`: 14 skill(s)
273
+ - `data`: 4 skill(s)
274
+ - `design`: 6 skill(s)
275
+ - `devops`: 20 skill(s)
276
+ - `documentation`: 3 skill(s)
277
+ - `frontend`: 9 skill(s)
278
+ - `game-dev`: 1 skill(s)
279
+ - `general`: 26 skill(s)
280
+ - `localization`: 1 skill(s)
281
+ - `marketing`: 2 skill(s)
282
+ - `mobile`: 7 skill(s)
283
+ - `observability`: 1 skill(s)
284
+ - `payments`: 1 skill(s)
285
+ - `performance`: 2 skill(s)
286
+ - `practices`: 5 skill(s)
287
+ - `saas`: 1 skill(s)
288
+ - `security`: 4 skill(s)
289
+ - `testing`: 6 skill(s)
290
+ - `tooling`: 3 skill(s)
291
+
292
+ ### Built-in Tools
293
+
294
+ **Skill Discovery:**
295
+ - `skill_list_categories`: List all skill categories available in the vault. Returns category names and skill counts.
296
+ - `skill_browse_category`: Browse skills within a specific category. Returns skill IDs and short descriptions.
297
+ - `skill_search`: Search skills by keyword. Matches against skill IDs and descriptions.
298
+ - `skill_get`: Get full content of a specific skill by ID. Returns SKILL.md content and referenced files.
299
+ - `skill_budget_report`: Report estimated context/token budget for selected and loaded skills.
300
+
301
+ **Postman Integration:**
302
+ - `postman_get_mode`: Get current Postman MCP mode from cbx_config.
303
+ - `postman_set_mode`: Set Postman MCP mode in cbx_config.
304
+ - `postman_get_status`: Get Postman integration status and active profile.
305
+
306
+ **Stitch Integration:**
307
+ - `stitch_get_mode`: Get Stitch MCP mode from cbx_config.
308
+ - `stitch_set_profile`: Switch active Stitch profile in cbx_config.
309
+ - `stitch_get_status`: Get Stitch integration status and active profile.
310
+
311
+ ### Skill Discovery Flow
312
+
313
+ Use progressive disclosure to minimize context usage:
314
+ 1. `skill_list_categories` → see available categories and counts
315
+ 2. `skill_browse_category` → browse skills in a category with short descriptions
316
+ 3. `skill_search` → search by keyword across all skills
317
+ 4. `skill_get` → load full content of a specific skill (only tool that reads full content)
318
+ 5. `skill_budget_report` → check token usage for selected/loaded skills; use result to emit the § Context Budget Tracking stamp
319
+
320
+ ### Connection
321
+
322
+ - **stdio**: `cbx mcp serve --transport stdio --scope auto`
323
+ - **HTTP**: `cbx mcp serve --transport http --scope auto --port 3100`
324
+
325
+ <!-- cbx:mcp:auto:end -->