@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.
@@ -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,58 +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
- Workflow boundary for this block:
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
- - `selected_skills` / `loaded_skills` must never include workflow IDs.
85
- - IDs like `workflow-implement-track` are workflow routes, not skills.
86
- - Never call `skill_get` with `workflow-*`; keep workflow mentions in the workflow decision log using raw $workflow-* wrappers.
108
+ ### Adaptive Load Policy
87
109
 
88
- ## Context Budget Block (Required, Estimated)
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 |
89
116
 
90
- Immediately after the Skill Log block, publish estimated budget fields:
117
+ ### Graceful Degradation
91
118
 
92
- - `full_catalog_est_tokens`
93
- - `loaded_est_tokens`
94
- - `estimated_savings_tokens`
95
- - `estimated_savings_percent`
119
+ If MCP tools are unavailable (server down, timeout, tool not listed):
96
120
 
97
- Mark all context/token values as deterministic estimates (not provider metering).
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.
98
125
 
99
- ### Smart Skill Selection (Adaptive)
126
+ ### Skill Log (Required After Any `skill_get` Call)
100
127
 
101
- Use an adaptive load policy to control context size:
128
+ Append one compact inline line no separate structured block:
102
129
 
103
- 1. Q&A/explanations: do not load skills unless the user explicitly asks for one.
104
- 2. Implementation/debug/review: load at most 1 primary skill and 1 supporting skill.
105
- 3. Cross-domain orchestration: use additional skills only when domains clearly differ.
106
- 4. Explicit skill mention by user always takes precedence.
130
+ ```
131
+ Skills: loaded=<id> | skipped=<id> (reason)
132
+ ```
107
133
 
108
- ### General Loading Rules
134
+ Follow immediately with the compact ctx stamp (see § Context Budget Tracking).
109
135
 
110
- 1. Load only skills needed for the active request.
111
- 2. Prefer progressive disclosure: start from `SKILL.md`, then specific sections.
112
- 3. Keep context lean; avoid loading unrelated skill documents.
113
- 4. If a mapped skill is missing, continue with best fallback and state it.
114
- 5. Keep user-visible decision logs concise: selected skill(s) and one-line rationale.
136
+ ### Anti-Patterns (Never Do These)
115
137
 
116
- After the skill log is complete, append the Context Budget block in the same response/update.
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
117
144
 
118
145
  ## 6) Socratic Gate (Before Complex Work)
119
146
 
@@ -130,7 +157,60 @@ Before multi-file or architecture-impacting changes, ask targeted questions when
130
157
  3. Verify behavior with focused checks before finalizing.
131
158
  4. State what was not validated.
132
159
 
133
- ## 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
134
214
 
135
215
  Use these commands to keep this setup healthy:
136
216
 
@@ -147,7 +227,7 @@ Use these commands to keep this setup healthy:
147
227
  - Diagnose setup issues:
148
228
  `cbx workflows doctor codex --scope project`
149
229
 
150
- ## 9) Managed Section Contract
230
+ ## 11) Managed Section Contract
151
231
 
152
232
  1. Preserve all user content outside managed markers.
153
233
  2. Do not manually edit content between managed markers.
@@ -168,3 +248,72 @@ Selection policy:
168
248
  3. Prefer one primary workflow; reference others only when needed.
169
249
 
170
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,58 +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 (Adaptive)
132
+ ### Skill Log (Required After Any `skill_get` Call)
108
133
 
109
- Use an adaptive load policy to control context size:
134
+ Append one compact inline line no separate structured block:
110
135
 
111
- 1. Q&A/explanations: do not load skills unless the user explicitly asks for one.
112
- 2. Implementation/debug/review: load at most 1 primary skill and 1 supporting skill.
113
- 3. Cross-domain orchestration: use additional skills only when domains clearly differ.
114
- 4. Explicit skill mention by user always takes precedence.
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.
122
- 5. Keep user-visible decision logs concise: selected skill(s) and one-line rationale.
142
+ ### Anti-Patterns (Never Do These)
123
143
 
124
- 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
125
150
 
126
151
  ## 7) Socratic Gate (Before Complex Work)
127
152
 
@@ -138,7 +163,60 @@ Before multi-file or architecture-impacting changes, ask targeted questions when
138
163
  3. Verify behavior with focused checks before finalizing.
139
164
  4. State what was not validated.
140
165
 
141
- ## 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
142
220
 
143
221
  Use these commands to keep this setup healthy:
144
222
 
@@ -155,7 +233,7 @@ Use these commands to keep this setup healthy:
155
233
  - Diagnose setup issues:
156
234
  `cbx workflows doctor copilot --scope project`
157
235
 
158
- ## 10) Managed Section Contract
236
+ ## 12) Managed Section Contract
159
237
 
160
238
  1. Preserve all user content outside managed markers.
161
239
  2. Do not manually edit content between managed markers.
@@ -176,3 +254,72 @@ Selection policy:
176
254
  3. Prefer one primary workflow; reference others only when needed.
177
255
 
178
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 -->