knowzcode 0.1.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 (73) hide show
  1. package/.claude-plugin/marketplace.json +55 -0
  2. package/.claude-plugin/plugin.json +8 -0
  3. package/LICENSE +121 -0
  4. package/README.md +223 -0
  5. package/agents/analyst.md +121 -0
  6. package/agents/architect.md +121 -0
  7. package/agents/builder.md +155 -0
  8. package/agents/closer.md +148 -0
  9. package/agents/knowledge-migrator.md +349 -0
  10. package/agents/microfix-specialist.md +140 -0
  11. package/agents/reviewer.md +220 -0
  12. package/agents/update-coordinator.md +405 -0
  13. package/bin/knowzcode.mjs +869 -0
  14. package/commands/audit.md +108 -0
  15. package/commands/connect-mcp.md +507 -0
  16. package/commands/fix.md +107 -0
  17. package/commands/init.md +320 -0
  18. package/commands/learn.md +308 -0
  19. package/commands/plan.md +125 -0
  20. package/commands/register.md +724 -0
  21. package/commands/status.md +291 -0
  22. package/commands/telemetry-setup.md +368 -0
  23. package/commands/telemetry.md +188 -0
  24. package/commands/work.md +390 -0
  25. package/knowzcode/automation_manifest.md +59 -0
  26. package/knowzcode/claude_code_execution.md +133 -0
  27. package/knowzcode/enterprise/compliance_manifest.md +132 -0
  28. package/knowzcode/enterprise/compliance_status.md +30 -0
  29. package/knowzcode/enterprise/guidelines/code-quality.md +67 -0
  30. package/knowzcode/enterprise/guidelines/custom/.gitkeep +0 -0
  31. package/knowzcode/enterprise/guidelines/security.md +355 -0
  32. package/knowzcode/enterprise/reports/.gitkeep +0 -0
  33. package/knowzcode/enterprise/templates/guideline-template.md +55 -0
  34. package/knowzcode/gitignore.template +13 -0
  35. package/knowzcode/knowzcode_architecture.md +51 -0
  36. package/knowzcode/knowzcode_log.md +142 -0
  37. package/knowzcode/knowzcode_loop.md +515 -0
  38. package/knowzcode/knowzcode_project.md +233 -0
  39. package/knowzcode/knowzcode_tracker.md +40 -0
  40. package/knowzcode/knowzcode_vaults.md +104 -0
  41. package/knowzcode/mcp_config.md +166 -0
  42. package/knowzcode/planning/Readme.md +6 -0
  43. package/knowzcode/platform_adapters.md +388 -0
  44. package/knowzcode/prompts/Execute_Micro_Fix.md +57 -0
  45. package/knowzcode/prompts/Investigate_Codebase.md +227 -0
  46. package/knowzcode/prompts/Migrate_Knowledge.md +301 -0
  47. package/knowzcode/prompts/Refactor_Node.md +72 -0
  48. package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -0
  49. package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -0
  50. package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -0
  51. package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -0
  52. package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -0
  53. package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -0
  54. package/knowzcode/specs/Readme.md +10 -0
  55. package/knowzcode/telemetry_config.md +89 -0
  56. package/knowzcode/user_preferences.md +120 -0
  57. package/package.json +53 -0
  58. package/skills/alias-resolver.json +15 -0
  59. package/skills/architecture-diff.json +12 -0
  60. package/skills/check-installation-status.json +14 -0
  61. package/skills/continue.md +105 -0
  62. package/skills/environment-guard.json +12 -0
  63. package/skills/generate-workgroup-id.json +25 -0
  64. package/skills/install-knowzcode.json +21 -0
  65. package/skills/load-core-context.json +18 -0
  66. package/skills/log-entry-builder.json +15 -0
  67. package/skills/spec-quality-check.json +14 -0
  68. package/skills/spec-template.json +15 -0
  69. package/skills/spec-validator.json +25 -0
  70. package/skills/start-work.md +224 -0
  71. package/skills/tracker-scan.json +12 -0
  72. package/skills/tracker-update.json +28 -0
  73. package/skills/validate-installation.json +14 -0
@@ -0,0 +1,108 @@
1
+ ---
2
+ description: "Run KnowzCode quality audits (spec, architecture, security, integration, compliance)"
3
+ argument-hint: "[audit_type]"
4
+ ---
5
+
6
+ # Run KnowzCode Audit
7
+
8
+ Run specialized audit workflows.
9
+
10
+ **Usage**: `/kc:audit [audit_type]`
11
+ **Example**: `/kc:audit spec` or `/kc:audit security`
12
+
13
+ **Audit Type**: $ARGUMENTS
14
+
15
+ ---
16
+
17
+ ## Audit Types
18
+
19
+ | Type | Focus |
20
+ |------|-------|
21
+ | **spec** | Specification quality and completeness |
22
+ | **architecture** | Architecture health and drift |
23
+ | **security** | OWASP vulnerability scanning |
24
+ | **integration** | Cross-component consistency |
25
+ | **compliance** | Enterprise guideline compliance (if configured) |
26
+ | *(no argument)* | Full parallel audit of all types |
27
+
28
+ ---
29
+
30
+ ## Step 1: Load Context
31
+
32
+ Read:
33
+ - `knowzcode/knowzcode_tracker.md`
34
+ - `knowzcode/knowzcode_architecture.md`
35
+ - `knowzcode/knowzcode_project.md`
36
+
37
+ ## Step 2: Execute Audit
38
+
39
+ ### Agent Teams Mode (if available)
40
+
41
+ Spawn a `reviewer` teammate:
42
+ > You are the **reviewer** running a {audit_type} audit.
43
+ > Read `agents/reviewer.md` for your role definition.
44
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
45
+ >
46
+ > **Audit scope**: {audit_type or "comprehensive — all types"}
47
+ > **Context files**: knowzcode_tracker.md, knowzcode_architecture.md, knowzcode_project.md
48
+ > **Specs directory**: knowzcode/specs/
49
+ >
50
+ > Deliverable: Audit report with health scores, critical issues, recommendations.
51
+
52
+ Create task and assign. Wait for completion. Shut down teammate.
53
+
54
+ ### Subagent Mode (fallback)
55
+
56
+ Delegate to the **reviewer** agent via `Task()`. Pass the audit type and context file paths.
57
+
58
+ ### Full Audit (no argument — DEFAULT)
59
+
60
+ The reviewer performs a comprehensive quality audit covering:
61
+ - Specification quality (all specs in `knowzcode/specs/`)
62
+ - Architecture health (`knowzcode/knowzcode_architecture.md`)
63
+ - Security vulnerability scan (OWASP Top 10)
64
+ - Integration consistency (cross-component patterns)
65
+ - Enterprise compliance (if `knowzcode/enterprise/` configured)
66
+
67
+ If MCP is configured: `ask_question(research_vault, "standards for {project_type}", researchMode=true)` to check against documented team standards.
68
+
69
+ ### Specific Audit Type
70
+
71
+ The reviewer focuses on the requested type with type-specific depth:
72
+ - **spec**: Validates 4-section format, VERIFY statement count, consolidation opportunities
73
+ - **architecture**: Checks layer violations, drift, pattern consistency
74
+ - **security**: OWASP Top 10 scanning with concrete detection patterns
75
+ - **integration**: API contracts, dependency graph, orphaned code, data flow
76
+ - **compliance**: Enterprise guideline enforcement levels
77
+
78
+ ## Step 3: Present Results
79
+
80
+ ```markdown
81
+ ## KnowzCode Audit Results
82
+
83
+ **Timestamp**: {timestamp}
84
+ **Audit Type**: {type or "Comprehensive"}
85
+
86
+ ### Summary Scores
87
+ | Area | Health Score | Critical Issues |
88
+ |------|-------------|-----------------|
89
+ | Spec Quality | {score}% | {count} |
90
+ | Architecture | {score}% | {count} |
91
+ | Security | {score}% | {count} |
92
+ | Integration | {score}% | {count} |
93
+
94
+ ### Critical Issues
95
+ {sorted by severity}
96
+
97
+ ### Recommendations
98
+ {prioritized action items}
99
+ ```
100
+
101
+ ## Step 4: Log Audit
102
+
103
+ Log to `knowzcode/knowzcode_log.md`:
104
+ ```markdown
105
+ | {timestamp} | AUDIT | {audit_type} | {summary} |
106
+ ```
107
+
108
+ If MCP is configured and enterprise vault exists: push audit results via `create_knowledge` for team audit trail.
@@ -0,0 +1,507 @@
1
+ ---
2
+ description: Configure KnowzCode MCP server for vector-powered code search and context
3
+ ---
4
+
5
+ # KnowzCode MCP Server Connection
6
+
7
+ You are the **KnowzCode MCP Connection Agent**. Your task is to configure the KnowzCode MCP (Model Context Protocol) server to enable advanced AI-powered code search and context retrieval.
8
+
9
+ ## Command Syntax
10
+
11
+ ```bash
12
+ /kc:connect-mcp <api-key> [--endpoint <url>] [--scope <local|project|user>] [--dev] [--configure-vaults]
13
+ ```
14
+
15
+ **Note:** If you don't have an API key yet, run `/kc:register` to create an account and get one automatically.
16
+ Registration also auto-configures your vault - no manual setup needed!
17
+
18
+ **Parameters:**
19
+ - `<api-key>` - Required. Your KnowzCode API key (or omit for interactive prompt)
20
+ - `--endpoint <url>` - Optional. Custom MCP endpoint (overrides environment default)
21
+ - `--scope <scope>` - Optional. Configuration scope: local (default), project, or user
22
+ - `--dev` - Optional. Use development environment instead of production
23
+ - `--configure-vaults` - Optional. Force vault configuration prompts (even if already configured)
24
+
25
+ **Environments:**
26
+ | Environment | Endpoint | When to Use |
27
+ |:------------|:---------|:------------|
28
+ | **Production** (default) | `https://mcp.knowz.io/mcp` | Normal usage |
29
+ | **Development** | `https://mcp.dev.knowz.io/mcp` | Testing new features |
30
+
31
+ **Examples:**
32
+ ```bash
33
+ # Basic usage (production - default)
34
+ /kc:connect-mcp kz_live_abc123...
35
+
36
+ # Interactive mode (production)
37
+ /kc:connect-mcp
38
+
39
+ # Development environment
40
+ /kc:connect-mcp kz_test_abc123... --dev
41
+
42
+ # Self-hosted endpoint
43
+ /kc:connect-mcp kz_live_abc123... --endpoint https://your-domain.com/mcp
44
+
45
+ # Project-wide configuration (production)
46
+ /kc:connect-mcp kz_live_team456... --scope project
47
+
48
+ # Development with project scope
49
+ /kc:connect-mcp kz_test_team456... --dev --scope project
50
+ ```
51
+
52
+ ## What This Enables
53
+
54
+ Once connected, you gain access to powerful vector-based tools:
55
+
56
+ - **`search_knowledge`** - Vector similarity search across vaults (code or research)
57
+ - **`ask_question`** - AI-powered Q&A with optional research mode
58
+ - **`create_knowledge`** - Save learnings to research vault (used by finalization)
59
+ - **`update_knowledge`** - Update existing knowledge items
60
+ - **`find_entities`** - Find people, locations, or events in your knowledge
61
+
62
+ ### Dual Vault Architecture
63
+
64
+ KnowzCode uses two vault types for optimal search:
65
+
66
+ | Vault Type | Purpose | Query Examples |
67
+ |------------|---------|----------------|
68
+ | **Code Vault** | Indexed source code (AST-chunked) | "Find auth middleware", "JWT validation" |
69
+ | **Research Vault** | Architecture, conventions, learnings | "Error handling conventions", "Why Redis?" |
70
+
71
+ These tools integrate seamlessly with all KnowzCode agents, enhancing their capabilities with project-wide context awareness.
72
+
73
+ ## Your Task
74
+
75
+ Configure the KnowzCode MCP server using Claude Code's built-in MCP management.
76
+
77
+ ### Steps to Execute
78
+
79
+ 1. **Parse command arguments**
80
+ - Extract API key from first positional argument (if provided)
81
+ - Parse `--dev` flag to determine environment
82
+ - Parse `--endpoint <url>` flag (overrides environment default if provided)
83
+ - Default endpoint: `https://mcp.knowz.io/mcp` (production)
84
+ - With `--dev` flag: `https://mcp.dev.knowz.io/mcp` (development)
85
+ - Parse `--scope <scope>` flag (default: `local`)
86
+ - Parse `--configure-vaults` flag (forces vault prompts)
87
+ - Store parsed values for use in configuration
88
+
89
+ 2. **Check for existing configuration**
90
+ - Check if MCP server already configured: `claude mcp get knowzcode`
91
+ - If already configured, ask if user wants to reconfigure
92
+ - If yes, run `claude mcp remove knowzcode` first
93
+
94
+ 3. **Prompt for API key (if not provided)**
95
+ - If no API key in arguments, prompt user interactively:
96
+ ```
97
+ Enter your KnowzCode API key
98
+ (Get one at https://knowz.io/api-keys)
99
+ ```
100
+ - Validate format (should start with `kz_live_` or `kz_test_`)
101
+ - Never display the full API key back to user
102
+
103
+ 4. **Confirm scope (if not provided)**
104
+ - If `--scope` not provided, ask user which scope to use:
105
+ - **local** (default): Only this project, private to you
106
+ - **project**: Shared with team via `.mcp.json` (committed to git)
107
+ - **user**: Available across all your projects
108
+
109
+ Present as options to user if not specified in command.
110
+
111
+ 5. **Validate endpoint URL (if custom)**
112
+ - If custom endpoint provided via `--endpoint`, validate it's a valid URL
113
+ - Ensure it starts with `https://` (or `http://` for local dev)
114
+ - Show which endpoint will be used
115
+
116
+ 6. **Configure Vault IDs (Conditional with Discovery)**
117
+
118
+ First, check if vaults are already configured in `knowzcode/knowzcode_vaults.md`:
119
+ - Read the file and check for connected vaults section
120
+
121
+ **If vaults already configured AND `--configure-vaults` NOT set:**
122
+ - Skip vault prompts entirely
123
+ - Display:
124
+ ```
125
+ Vaults already configured (from previous setup or /kc:register):
126
+ {List vaults from knowzcode_vaults.md}
127
+
128
+ To reconfigure vaults, run: /kc:connect-mcp --configure-vaults
129
+ ```
130
+
131
+ **If vaults NOT configured OR `--configure-vaults` IS set:**
132
+
133
+ **Step 6a: Fetch available vaults using list_vaults()**
134
+
135
+ Call the `list_vaults` MCP tool to discover available vaults:
136
+ ```
137
+ list_vaults(includeStats: true)
138
+ ```
139
+
140
+ If successful, display available vaults:
141
+ ```
142
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
143
+ ◆ VAULT DISCOVERY
144
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
145
+
146
+ Fetching your available vaults...
147
+
148
+ Available Vaults:
149
+ ┌────┬──────────────────────┬──────────────────┬───────────┐
150
+ │ # │ Name │ Type │ Documents │
151
+ ├────┼──────────────────────┼──────────────────┼───────────┤
152
+ │ 1 │ KnowzCode │ research │ 42 │
153
+ │ 2 │ my-project-code │ code │ 1,234 │
154
+ │ 3 │ team-wiki │ research │ 89 │
155
+ └────┴──────────────────────┴──────────────────┴───────────┘
156
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
157
+ ```
158
+
159
+ If `list_vaults` fails or returns empty:
160
+ - Fall back to manual vault ID entry (legacy behavior)
161
+ - Prompt:
162
+ ```
163
+ Could not fetch vaults automatically.
164
+
165
+ Enter vault IDs manually:
166
+
167
+ Research Vault ID (required for /kc:learn):
168
+ • Get from: https://knowz.io/vaults
169
+
170
+ Code Vault ID (optional):
171
+ • Leave blank to use grep/glob for code search
172
+ ```
173
+
174
+ **Step 6b: Interactive vault selection**
175
+
176
+ For each discovered vault, ask if user wants to connect it:
177
+
178
+ ```
179
+ Would you like to connect "KnowzCode" (research)?
180
+ ```
181
+ Use AskUserQuestion with options: [Yes] [No]
182
+
183
+ **If "Yes":**
184
+ - Prompt for description:
185
+ ```
186
+ Describe what this vault contains (for intelligent routing):
187
+
188
+ Tips for good descriptions:
189
+ • Be specific about content type
190
+ • Include example queries that should route here
191
+ • Mention key topics covered
192
+
193
+ Examples:
194
+ • "Team learnings, conventions, architectural decisions. Use for 'why did we choose X?' questions."
195
+ • "Source code for the main API. Use for 'where is X defined?' questions."
196
+ ```
197
+
198
+ - Collect description via AskUserQuestion (free text input)
199
+
200
+ **Step 6c: Loop for additional vaults**
201
+
202
+ After each vault selection:
203
+ ```
204
+ Would you like to connect another vault?
205
+ ```
206
+ Options: [Yes] [No]
207
+
208
+ - If "Yes" and more vaults available: Continue selection loop
209
+ - If "No" or no more vaults: Exit loop
210
+
211
+ **Step 6d: Write vault configuration**
212
+
213
+ Write selected vaults to `knowzcode/knowzcode_vaults.md`:
214
+
215
+ ```markdown
216
+ # KnowzCode Vault Configuration
217
+
218
+ Multi-vault routing configuration for intelligent vault selection.
219
+
220
+ ---
221
+
222
+ ## Connected Vaults
223
+
224
+ ### {vault_id_1}
225
+ - **Name**: {vault_name}
226
+ - **ID**: {vault_id}
227
+ - **Type**: {code | research}
228
+ - **Description**: {user_provided_description}
229
+
230
+ ### {vault_id_2}
231
+ - **Name**: {vault_name}
232
+ - **ID**: {vault_id}
233
+ - **Type**: {code | research}
234
+ - **Description**: {user_provided_description}
235
+
236
+ ---
237
+
238
+ ## Vault Routing Rules
239
+
240
+ - **Code questions** (implementations, files, structure) → {first code vault ID}
241
+ - **Convention questions** (patterns, decisions, best practices) → {first research vault ID}
242
+ - **Learning capture** → {default research vault ID}
243
+ ```
244
+
245
+ **Also update `knowzcode/mcp_config.md`** to reflect primary vault (for backwards compatibility):
246
+ - Set Research Vault ID to first research vault selected
247
+ - Set Code Vault ID to first code vault selected (or "not configured")
248
+
249
+ **Step 6e: Show vault configuration summary**
250
+
251
+ ```
252
+ Vault configuration saved to knowzcode/knowzcode_vaults.md
253
+
254
+ Connected Vaults:
255
+ • KnowzCode (research) - "Team learnings and conventions"
256
+ • my-code (code) - "Source code for API project"
257
+
258
+ Routing:
259
+ • Code questions → my-code
260
+ • Convention questions → KnowzCode
261
+ • Learning capture → KnowzCode
262
+
263
+ You can edit knowzcode/knowzcode_vaults.md to update descriptions or routing rules.
264
+ ```
265
+
266
+ 7. **Add MCP server using CLI**
267
+ ```bash
268
+ claude mcp add --transport http \
269
+ --scope <chosen-scope> \
270
+ knowzcode \
271
+ <endpoint-url> \
272
+ --header "Authorization: Bearer <api-key>" \
273
+ --header "X-Project-Path: $(pwd)"
274
+ ```
275
+
276
+ 8. **Verify configuration**
277
+ - Run: `claude mcp get knowzcode`
278
+ - Confirm server appears in the list
279
+ - Check for any error messages
280
+
281
+ 9. **Update mcp_config.md**
282
+ - Update `knowzcode/mcp_config.md` with connection details:
283
+ - Set `Connected: Yes`
284
+ - Set `Endpoint: <endpoint-url>`
285
+ - Set `Last Verified: <timestamp>`
286
+ - Set Research Vault ID and name (if provided or already set)
287
+ - Set Code Vault ID and name (if provided)
288
+ - Set `Auto-configured: No` (to distinguish from /kc:register setup)
289
+
290
+ 10. **Test connection (optional)**
291
+ - If verification succeeds, optionally test with a simple tool call
292
+ - This validates the API key is valid
293
+
294
+ 11. **Report success**
295
+ ```
296
+ ✅ KnowzCode MCP server configured!
297
+
298
+ Scope: <chosen-scope>
299
+ Endpoint: <endpoint-url>
300
+
301
+ Vaults Configured:
302
+ • Code Vault: <vault-name or "Not configured">
303
+ • Research Vault: <vault-name or "Not configured">
304
+
305
+ 🔄 Please restart Claude Code to activate these features:
306
+ • search_knowledge - Vector search across vaults
307
+ • ask_question - AI Q&A with research mode
308
+ • create_knowledge - Save learnings (via finalization)
309
+ • update_knowledge - Update existing items
310
+ • find_entities - Find people/locations/events
311
+
312
+ After restart, these tools will be available to all KnowzCode agents.
313
+
314
+ Check connection status: /kc:status
315
+ ```
316
+
317
+ ## Configuration Details
318
+
319
+ ### Scope Comparison
320
+
321
+ **Local (default)**:
322
+ - ✅ Private to you
323
+ - ✅ Project-specific
324
+ - ❌ Not shared with team
325
+ - **Use when:** Personal API key, working solo
326
+
327
+ **Project**:
328
+ - ✅ Shared with team
329
+ - ✅ Committed to git via `.mcp.json`
330
+ - ⚠️ API key visible to team
331
+ - **Use when:** Team API key, collaborative project
332
+
333
+ **User**:
334
+ - ✅ Available everywhere
335
+ - ✅ Set once, works across projects
336
+ - ❌ Not project-specific
337
+ - **Use when:** Single API key for all your work
338
+
339
+ ### Security Considerations
340
+
341
+ - **Never log API keys** in command output
342
+ - **Mask displayed keys**: Show only first/last 4 chars (e.g., `kz_live_abc...xyz`)
343
+ - **Warn about project scope**: API key will be in git-committed `.mcp.json`
344
+ - **Suggest environment variables**: For team setups, recommend storing in CI/CD secrets
345
+
346
+ ### MCP Server Details
347
+
348
+ The KnowzCode MCP server (default: `https://mcp.knowz.io/mcp`):
349
+ - **Protocol:** HTTP transport with JSON-RPC
350
+ - **Authentication:** Bearer token in `Authorization` header
351
+ - **Project Context:** `X-Project-Path` header identifies project
352
+ - **Rate Limiting:** Standard API rate limits apply
353
+ - **Caching:** Responses cached for performance
354
+
355
+ ### Environment Endpoints
356
+
357
+ **Available Environments:**
358
+
359
+ | Environment | Endpoint | Flag | Use Case |
360
+ |:------------|:---------|:-----|:---------|
361
+ | **Production** (default) | `https://mcp.knowz.io/mcp` | (none) | Normal usage |
362
+ | **Development** | `https://mcp.dev.knowz.io/mcp` | `--dev` | Testing new features |
363
+
364
+ **Switching Environments:**
365
+ ```bash
366
+ # Production (default)
367
+ /kc:connect-mcp kz_live_abc123...
368
+
369
+ # Development
370
+ /kc:connect-mcp kz_test_abc123... --dev
371
+
372
+ # Local development server
373
+ /kc:connect-mcp kz_test_local... --endpoint http://localhost:3000/mcp
374
+
375
+ # Self-hosted enterprise
376
+ /kc:connect-mcp kz_live_abc123... --endpoint https://knowzcode.mycompany.com/mcp
377
+ ```
378
+
379
+ ## Error Handling
380
+
381
+ ### API Key Invalid
382
+ ```
383
+ ❌ Authentication failed
384
+ The API key appears to be invalid or expired.
385
+
386
+ Get a new key at: https://knowz.io/api-keys
387
+ Then run: /kc:connect-mcp <new-key>
388
+ ```
389
+
390
+ ### Already Configured
391
+ ```
392
+ ⚠️ KnowzCode MCP server is already configured
393
+ Current scope: <scope>
394
+
395
+ Do you want to reconfigure?
396
+ ```
397
+
398
+ ### Claude CLI Not Available
399
+ ```
400
+ ❌ Cannot configure MCP server
401
+ The 'claude' CLI command is not available.
402
+
403
+ This is unusual - Claude Code should provide this command.
404
+ Please restart Claude Code or report this issue.
405
+ ```
406
+
407
+ ### Network/Connection Error
408
+ ```
409
+ ❌ Cannot reach KnowzCode API
410
+ Failed to connect to {endpoint}
411
+
412
+ Check your internet connection and try again.
413
+ If using --dev environment, verify the dev server is running.
414
+ ```
415
+
416
+ ## Advanced Usage
417
+
418
+ ### Switching Scopes
419
+ To change from local to project scope:
420
+ ```bash
421
+ # Remove existing (or the command will prompt to reconfigure)
422
+ claude mcp remove knowzcode
423
+
424
+ # Re-add with new scope
425
+ /kc:connect-mcp <api-key> --scope project
426
+ ```
427
+
428
+ ### Switching Endpoints
429
+ To switch between environments or self-hosted:
430
+ ```bash
431
+ # Switch to development
432
+ /kc:connect-mcp <api-key> --dev
433
+
434
+ # Switch back to production (default)
435
+ /kc:connect-mcp <api-key>
436
+
437
+ # Switch to self-hosted
438
+ /kc:connect-mcp <api-key> --endpoint https://knowzcode.mycompany.com/mcp
439
+ ```
440
+
441
+ ## Integration with KnowzCode Agents
442
+
443
+ Once configured, agents automatically detect and use MCP tools with dual vault support:
444
+
445
+ **analyst**:
446
+ - Uses `search_knowledge` with **code vault** to find related code
447
+ - Uses `search_knowledge` with **research vault** to find past decisions
448
+ - Uses `ask_question` with **research vault** for architectural context
449
+
450
+ **architect**:
451
+ - Uses `search_knowledge` with **code vault** for implementation examples
452
+ - Uses `ask_question` with **research vault** for conventions
453
+
454
+ **builder**:
455
+ - Uses `search_knowledge` with **code vault** for similar patterns
456
+ - Uses `search_knowledge` with **research vault** for best practices
457
+
458
+ **reviewer**:
459
+ - Uses `search_knowledge` with **research vault** for standards
460
+ - Uses `search_knowledge` with **code vault** for precedent checks
461
+
462
+ **closer**:
463
+ - Uses `search_knowledge` with **research vault** to check for duplicate learnings
464
+ - Uses `create_knowledge` to save new learnings to **research vault**
465
+
466
+ **All agents**:
467
+ - Automatically leverage MCP tools when available
468
+ - Gracefully degrade if MCP server unavailable
469
+
470
+ ## Next Steps
471
+
472
+ After configuration:
473
+ 1. **Restart Claude Code** (required to activate MCP server)
474
+ 2. **Verify connection**: `/kc:status`
475
+ 3. **Start building**: `/kc:work "your feature"`
476
+ 4. **Watch agents use MCP tools** automatically during workflow
477
+
478
+ ## Tool Control & Filtering
479
+
480
+ Tools are controlled **server-side** at the MCP endpoint:
481
+
482
+ **Server controls which tools to expose based on:**
483
+ - API key tier (free/pro/enterprise)
484
+ - Project type (monorepo, microservices, etc.)
485
+ - Feature flags per user
486
+ - Runtime conditions
487
+
488
+ **Agents automatically discover and use available tools** - no client-side filtering needed.
489
+
490
+ See `docs/MCP_SERVER_IMPLEMENTATION.md` for complete server implementation guide.
491
+
492
+ ## Related Commands
493
+
494
+ - `/kc:register` - Register for KnowzCode and configure MCP automatically
495
+ - `/kc:status` - Check MCP connection status and available tools
496
+ - `/kc:init` - Initialize KnowzCode in project
497
+ - `/kc:work` - Start feature development (uses MCP tools)
498
+
499
+ ## Implementation Notes
500
+
501
+ **For Server Developers:**
502
+ - See `docs/MCP_SERVER_IMPLEMENTATION.md` for complete specification
503
+ - Required methods: `initialize`, `tools/list`, `tools/call`
504
+ - Authentication via `Authorization: Bearer` header
505
+ - Project context via `X-Project-Path` header
506
+
507
+ Execute this configuration now.