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