knowzcode 0.3.7 → 0.5.2

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.
@@ -91,7 +91,7 @@ Any agent can send ad-hoc knowledge to the scribe at any time. The scribe handle
91
91
 
92
92
  ## OpenAI Codex (AGENTS.md)
93
93
 
94
- Create `AGENTS.md` in project root. Notes: `AGENTS.override.md` can be used for user-local overrides. 32KB file size limit. Plain text format (no YAML frontmatter). Codex (2026) also supports `SKILL.md` files for discoverable skills — these appear as available commands in the Codex UI. `AGENTS.md` remains the primary instruction mechanism for KnowzCode methodology.
94
+ Create `AGENTS.md` in project root. Notes: `AGENTS.override.md` can be used for user-local overrides. 32KB file size limit. Plain text format (no YAML frontmatter). Codex (2026) also supports `SKILL.md` files for discoverable skills — each skill is a directory containing `SKILL.md` with YAML frontmatter (`name` and `description`). Skills go in `.agents/skills/` (repo-level) or `~/.agents/skills/` (user-level). `AGENTS.md` remains the primary instruction mechanism for KnowzCode methodology.
95
95
 
96
96
  ```markdown
97
97
  # KnowzCode Development Methodology
@@ -176,112 +176,1627 @@ For single-file, <50 line, no-ripple-effect changes:
176
176
  - `knowzcode/workgroups/` — Active session data (gitignored)
177
177
  ```
178
178
 
179
+ ### Codex Skill Files (`.agents/skills/`)
180
+
181
+ Codex (2026) supports `SKILL.md` files for discoverable skills. Each skill is a directory containing `SKILL.md` with YAML frontmatter (`name` and `description`). Place in `.agents/skills/` (repo-level) or `~/.agents/skills/` (user-level). The `description` field drives implicit invocation — Codex auto-triggers skills based on task matching.
182
+
183
+ #### .agents/skills/kc-work/SKILL.md
184
+
185
+ ```markdown
186
+ ---
187
+ name: kc-work
188
+ description: Start a structured KnowzCode development workflow with TDD, quality gates, and phased implementation. Triggers on feature requests, new functionality, or complex multi-file changes.
189
+ ---
190
+ <!-- Generated by KnowzCode vX.Y.Z -->
191
+
192
+ # /kc:work — Start KnowzCode Workflow
193
+
194
+ Start a structured KnowzCode development workflow for the given goal.
195
+
196
+ ## Instructions
197
+
198
+ Read these files for methodology and project context:
199
+ - `knowzcode/knowzcode_loop.md` — Complete methodology
200
+ - `knowzcode/knowzcode_project.md` — Project context
201
+ - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
202
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
203
+
204
+ ### Step 1: Classify Tier
205
+ - **Micro** (single file, <50 lines): Use `/kc:fix` instead
206
+ - **Light** (≤3 files): Streamlined 2-phase path
207
+ - **Full** (>3 files or complex): Complete 5-phase workflow
208
+
209
+ ### Step 2: Create WorkGroup
210
+ Generate WorkGroupID: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
211
+ Create `knowzcode/workgroups/{WorkGroupID}.md`
212
+
213
+ ### Step 3: Phase 1A — Impact Analysis
214
+ 1. Identify affected components
215
+ 2. Create NodeIDs for new capabilities (PascalCase)
216
+ 3. Check `knowzcode/specs/` for existing domain overlap
217
+ 4. Propose Change Set with NodeIDs, affected files, risk assessment
218
+
219
+ **STOP** — Present Change Set for user approval before continuing.
220
+
221
+ After approval, continue through Phase 1B (Specification) → Phase 2A (TDD Implementation) → Phase 2B (Audit) → Phase 3 (Finalization), stopping at each quality gate.
222
+ ```
223
+
224
+ #### .agents/skills/kc-plan/SKILL.md
225
+
226
+ ```markdown
227
+ ---
228
+ name: kc-plan
229
+ description: Research and investigate a topic in the codebase before implementing changes. Triggers on exploratory questions, architecture review, or pre-implementation research.
230
+ ---
231
+ <!-- Generated by KnowzCode vX.Y.Z -->
232
+
233
+ # /kc:plan — Research Before Implementing
234
+
235
+ Investigate a topic in the codebase before implementing changes.
236
+
237
+ ## Instructions
238
+
239
+ Read these files for context:
240
+ - `knowzcode/knowzcode_loop.md` — Methodology
241
+ - `knowzcode/knowzcode_project.md` — Project context
242
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
243
+
244
+ 1. Explore the codebase for relevant files, patterns, and implementations
245
+ 2. Check `knowzcode/specs/` for related component specs
246
+ 3. Scan `knowzcode/workgroups/` for past WorkGroups in similar areas
247
+ 4. Review `knowzcode/knowzcode_architecture.md` for structural context
248
+ 5. Present findings with current state, patterns, options, and recommended approach
249
+
250
+ **STOP** — Present research findings. To implement, use `/kc:work` with the chosen approach.
251
+ ```
252
+
253
+ #### .agents/skills/kc-fix/SKILL.md
254
+
255
+ ```markdown
256
+ ---
257
+ name: kc-fix
258
+ description: Quick targeted fix for single-file changes using the micro-fix protocol. Triggers on bug fixes, typos, small corrections, and CSS tweaks.
259
+ ---
260
+ <!-- Generated by KnowzCode vX.Y.Z -->
261
+
262
+ # /kc:fix — Quick Targeted Fix
263
+
264
+ Apply a targeted fix using the micro-fix protocol.
265
+
266
+ ## Scope Guard
267
+
268
+ This workflow is for changes that are:
269
+ - Single file (or minimal multi-file with no ripple effects)
270
+ - <50 lines changed
271
+ - No architectural impact
272
+
273
+ If the fix exceeds this scope, suggest `/kc:work` instead.
274
+
275
+ ## Instructions
276
+
277
+ Read `knowzcode/knowzcode_loop.md` section on Micro-Fix.
278
+
279
+ 1. Implement the fix
280
+ 2. Run targeted tests for the affected code
281
+ 3. Prepend a MicroFix entry to `knowzcode/knowzcode_log.md`
282
+ 4. Commit with `fix: {description}` message
283
+ ```
284
+
285
+ #### .agents/skills/kc-audit/SKILL.md
286
+
287
+ ```markdown
288
+ ---
289
+ name: kc-audit
290
+ description: Read-only quality audit comparing implementation against specs. Triggers on audit requests, quality checks, security reviews, and compliance verification.
291
+ ---
292
+ <!-- Generated by KnowzCode vX.Y.Z -->
293
+
294
+ # /kc:audit — Quality Audit
295
+
296
+ Perform a READ-ONLY audit comparing implementation against specs.
297
+
298
+ ## Instructions
299
+
300
+ Read these files:
301
+ - `knowzcode/knowzcode_loop.md` — Phase 2B methodology
302
+ - `knowzcode/knowzcode_tracker.md` — Find active WorkGroups
303
+
304
+ **CRITICAL: This is a READ-ONLY audit. Do NOT modify source files.**
305
+
306
+ 1. Compare implementation against all VERIFY statements in specs from `knowzcode/specs/`
307
+ 2. Calculate completion percentage per NodeID and overall
308
+ 3. Identify gaps: missing features, incomplete criteria, untested paths
309
+ 4. Check for security concerns
310
+ 5. Assess risk for any gaps found
311
+
312
+ ### Standalone Audit Types
313
+ - **spec**: Audit spec quality and VERIFY statement coverage
314
+ - **architecture**: Compare architecture doc against codebase
315
+ - **security**: OWASP top 10, input validation, auth flows
316
+ - **integration**: API contracts, dependency health
317
+
318
+ **STOP** — Present audit results with completion percentage and gap list.
319
+ ```
320
+
321
+ #### .agents/skills/kc-learn/SKILL.md
322
+
323
+ ```markdown
324
+ ---
325
+ name: kc-learn
326
+ description: Capture learnings, decisions, patterns, and conventions to the KnowzCode knowledge vault. Triggers on knowledge capture, documentation of decisions, or pattern recording.
327
+ ---
328
+ <!-- Generated by KnowzCode vX.Y.Z -->
329
+
330
+ # /kc:learn — Capture Learning
331
+
332
+ Capture a learning, decision, or pattern to the KnowzCode knowledge vault.
333
+
334
+ ## Instructions
335
+
336
+ Read `knowzcode/knowzcode_vaults.md` for vault configuration and routing rules.
337
+
338
+ 1. Analyze the learning provided
339
+ 2. Categorize: Pattern, Workaround, Decision, Convention, Security, Integration, Performance, Completion
340
+ 3. Route to the appropriate vault:
341
+ - Pattern/Workaround/Performance → `code` vault
342
+ - Decision/Convention/Security/Integration → `ecosystem` vault
343
+ - Completion → `finalizations` vault
344
+ 4. If MCP is connected: call `create_knowledge` with appropriate `vaultId`
345
+ 5. If MCP is unavailable: append to `knowzcode/pending_captures.md`
346
+
347
+ Write detailed, self-contained entries — vault entries are retrieved via semantic search.
348
+ ```
349
+
350
+ #### .agents/skills/kc-continue/SKILL.md
351
+
352
+ ```markdown
353
+ ---
354
+ name: kc-continue
355
+ description: Resume an interrupted KnowzCode workflow or advance to the next phase. Triggers on continuation requests, workflow resumption, or phase advancement.
356
+ ---
357
+ <!-- Generated by KnowzCode vX.Y.Z -->
358
+
359
+ # /kc:continue — Resume Workflow
360
+
361
+ Resume an interrupted KnowzCode workflow or advance to the next phase.
362
+
363
+ ## Instructions
364
+
365
+ Read `knowzcode/knowzcode_tracker.md` to find active `[WIP]` WorkGroups.
366
+
367
+ ### Step 1: Find Active WorkGroup
368
+ - One active: use it
369
+ - Multiple active: ask user which to resume
370
+ - None active: suggest `/kc:work`
371
+
372
+ ### Step 2: Determine Current Phase
373
+ Read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
374
+ Check the Phase History table to determine current state.
375
+
376
+ ### Step 3: Resume
377
+
378
+ | State | Action |
379
+ |-------|--------|
380
+ | 1A in progress | Complete impact analysis |
381
+ | 1A approved, specs not started | Begin Phase 1B |
382
+ | 1B approved, not implemented | Begin Phase 2A |
383
+ | 2A complete | Run Phase 2B audit |
384
+ | 2B complete, gaps found | Present fix/accept options |
385
+ | 2B complete, no gaps | Begin Phase 3 |
386
+
387
+ Resume from the appropriate phase following `knowzcode/knowzcode_loop.md`.
388
+ ```
389
+
390
+ #### .agents/skills/kc-init/SKILL.md
391
+
392
+ ```markdown
393
+ ---
394
+ name: kc-init
395
+ description: Initialize KnowzCode in a project. Triggers on project setup, framework initialization, or first-time configuration.
396
+ ---
397
+ <!-- Generated by KnowzCode vX.Y.Z -->
398
+
399
+ # /kc:init — Initialize KnowzCode
400
+
401
+ Set up the KnowzCode framework in the current project.
402
+
403
+ ## Instructions
404
+
405
+ 1. Check for existing `knowzcode/` directory
406
+ - If exists: ask user to Abort, Merge, or Overwrite
407
+ 2. Create directory structure: `knowzcode/`, `knowzcode/specs/`, `knowzcode/workgroups/`, `knowzcode/prompts/`
408
+ 3. Generate template files from the KnowzCode framework source
409
+ 4. Detect project stack (language, frameworks, test runners, build tools)
410
+ 5. Select platform adapter(s): Claude Code, Codex, Gemini, Cursor, Copilot, Windsurf
411
+ 6. Generate platform instruction file(s) with detected stack context
412
+ 7. Report generated files and suggest next steps (`/kc:work`, `/kc:register`)
413
+ ```
414
+
415
+ #### .agents/skills/kc-status/SKILL.md
416
+
417
+ ```markdown
418
+ ---
419
+ name: kc-status
420
+ description: Check KnowzCode MCP connection, vault health, and agent status. Triggers on status checks, diagnostics, or troubleshooting.
421
+ ---
422
+ <!-- Generated by KnowzCode vX.Y.Z -->
423
+
424
+ # /kc:status — Check Status
425
+
426
+ Check KnowzCode MCP connection, vault health, and agent status.
427
+
428
+ ## Instructions
429
+
430
+ 1. Check for agent definition files (glob `agents/*.md`)
431
+ 2. Read `knowzcode/knowzcode_vaults.md` for vault configuration
432
+ 2.5. **Cross-Platform Config Discovery**:
433
+ - Check `KNOWZ_API_KEY` env var: Set (ending ...{last4}) | Not set
434
+ - Check `knowzcode/mcp_config.md`: Connected / Not configured
435
+ - Check `.gemini/settings.json` for `mcpServers.knowz`: Configured | Not found
436
+ - Check `.vscode/mcp.json` for `servers.knowz`: Configured | Not found
437
+ - Include all sources in status output
438
+ - If current platform not configured but another is: "Tip: An API key was found in {source}. Run /kc:connect-mcp to configure for this platform."
439
+ 3. Test MCP connectivity by calling `list_vaults`
440
+ 4. Check each configured vault's health and item count
441
+ 5. Read `knowzcode/knowzcode_tracker.md` for active WorkGroups
442
+
443
+ Report connection status, vault health, agent availability, and active WorkGroups.
444
+ ```
445
+
446
+ #### .agents/skills/kc-connect-mcp/SKILL.md
447
+
448
+ ```markdown
449
+ ---
450
+ name: kc-connect-mcp
451
+ description: Configure KnowzCode MCP server for vector search and vault access. Triggers on MCP configuration, API key setup, or vault connection.
452
+ ---
453
+ <!-- Generated by KnowzCode vX.Y.Z -->
454
+
455
+ # /kc:connect-mcp — Configure MCP Server
456
+
457
+ Configure the KnowzCode MCP server for vector-based code search and context retrieval.
458
+
459
+ ## Instructions
460
+
461
+ Requires an API key. If the user doesn't have one, suggest `/kc:register` first.
462
+
463
+ **Default endpoint:** `https://mcp.knowz.io/mcp`
464
+ **Dev endpoint:** `https://mcp.dev.knowz.io/mcp`
465
+
466
+ 1. Accept API key and optional parameters (endpoint, dev mode)
467
+ 1.5. **Smart Config Discovery (if no API key provided)**:
468
+ - Check `KNOWZ_API_KEY` environment variable — if set, use as API key
469
+ - Check `knowzcode/mcp_config.md` — if `Connected: Yes`, pre-populate endpoint
470
+ - Check `knowzcode/knowzcode_vaults.md` — if vaults configured, skip vault prompts
471
+ - Check cross-platform configs (`.gemini/settings.json`, `.vscode/mcp.json`) for existing Bearer token
472
+ - If key found: "Found existing API key (ending ...{last4}) in {source}. Use this key? [Yes/No]"
473
+ 2. Validate the API key against the KnowzCode API
474
+ 3. Write MCP server configuration:
475
+ - Add server `knowz` with HTTP transport to endpoint URL
476
+ - Set `Authorization: Bearer <api-key>` header
477
+ - Set `X-Project-Path` header to current project path
478
+ - Write to the platform's MCP config file (e.g., `.mcp.json` for project-level)
479
+ 4. Test connectivity by calling `list_vaults`
480
+ 5. Configure vault mappings — check `knowzcode/knowzcode_vaults.md` first; if vaults already configured from another platform, skip vault prompts
481
+ 6. Update `knowzcode/mcp_config.md` with connection status and `API Key (last 4)`
482
+
483
+ Report connection status and available vaults.
484
+ ```
485
+
486
+ #### .agents/skills/kc-register/SKILL.md
487
+
488
+ ```markdown
489
+ ---
490
+ name: kc-register
491
+ description: Register for KnowzCode and auto-configure MCP server. Triggers on account creation, registration, or first-time setup.
492
+ ---
493
+ <!-- Generated by KnowzCode vX.Y.Z -->
494
+
495
+ # /kc:register — Register & Configure
496
+
497
+ Register for KnowzCode and automatically configure the MCP server.
498
+
499
+ ## Instructions
500
+
501
+ **Registration API:** `https://api.knowz.io/api/v1/auth/register`
502
+ **Dev API:** `https://api.dev.knowz.io/api/v1/auth/register`
503
+
504
+ 0. **Smart Discovery**: Check `KNOWZ_API_KEY`, `knowzcode/mcp_config.md`, and cross-platform configs (`.gemini/settings.json`, `.vscode/mcp.json`) for existing API key. If found, offer: "Use existing key via /kc:connect-mcp" or "Register new account"
505
+ 1. Prompt user for name, email, and password (one at a time)
506
+ 2. Call the KnowzCode registration API via HTTP POST
507
+ 3. Extract API key and vault ID from response
508
+ 4. Configure MCP server connection:
509
+ - Add server `knowz` with HTTP transport to `https://mcp.knowz.io/mcp`
510
+ - Set `Authorization: Bearer <api-key>` header
511
+ - Set `X-Project-Path` header to current project path
512
+ - Write to the platform's MCP config file (e.g., `.mcp.json` for project-level)
513
+ 5. Update `knowzcode/knowzcode_vaults.md` with returned vault IDs — check first if vaults already configured from another platform
514
+ 6. Update `knowzcode/mcp_config.md` with connection status and `API Key (last 4)`
515
+
516
+ The user will be ready to use MCP-powered features after registration.
517
+ ```
518
+
519
+ #### .agents/skills/kc-telemetry/SKILL.md
520
+
521
+ ```markdown
522
+ ---
523
+ name: kc-telemetry
524
+ description: Investigate production telemetry from Sentry and App Insights. Triggers on error investigation, production debugging, or telemetry queries.
525
+ ---
526
+ <!-- Generated by KnowzCode vX.Y.Z -->
527
+
528
+ # /kc:telemetry — Investigate Telemetry
529
+
530
+ Investigate production telemetry to diagnose errors, trace issues, and identify root causes.
531
+
532
+ ## Instructions
533
+
534
+ Usage: `/kc:telemetry "<natural language description>"`
535
+
536
+ 1. Parse the natural language query for environment, timeframe, and error context
537
+ 2. Read `knowzcode/knowzcode_telemetry.md` for configured sources
538
+ 3. Query configured telemetry sources (Sentry, App Insights) via MCP tools
539
+ 4. Correlate findings across sources
540
+ 5. Present timeline, root cause analysis, and recommended fixes
541
+
542
+ If no telemetry sources are configured, suggest `/kc:telemetry-setup`.
543
+ ```
544
+
545
+ #### .agents/skills/kc-telemetry-setup/SKILL.md
546
+
547
+ ```markdown
548
+ ---
549
+ name: kc-telemetry-setup
550
+ description: Configure telemetry sources (Sentry, App Insights) for /kc:telemetry. Triggers on telemetry configuration or source setup.
551
+ ---
552
+ <!-- Generated by KnowzCode vX.Y.Z -->
553
+
554
+ # /kc:telemetry-setup — Configure Telemetry Sources
555
+
556
+ Configure telemetry sources for `/kc:telemetry` investigations.
557
+
558
+ ## Instructions
559
+
560
+ Usage: `/kc:telemetry-setup [sentry|appinsights|all]`
561
+
562
+ 1. Detect available telemetry MCP tools (Sentry, App Insights)
563
+ 2. For each selected source:
564
+ - Verify MCP tool connectivity
565
+ - Test authentication and permissions
566
+ - Detect available projects/resources
567
+ 3. Write configuration to `knowzcode/knowzcode_telemetry.md`
568
+ 4. Run a test query to verify end-to-end connectivity
569
+
570
+ Report configured sources and their status.
571
+ ```
572
+
573
+ ---
574
+
575
+ ## Google Gemini CLI (GEMINI.md)
576
+
577
+ Create `GEMINI.md` in project root. Notes: Gemini CLI supports `@file.md` imports for pulling in methodology files (e.g., `@knowzcode/knowzcode_loop.md`). User-global preferences can be placed in `~/.gemini/GEMINI.md`.
578
+
579
+ ### Native Commands (`.gemini/commands/kc/*.toml`)
580
+
581
+ Gemini CLI (2026) supports native custom commands via TOML files in `.gemini/commands/`. Subdirectory namespacing gives the `/kc:` prefix automatically:
582
+
583
+ ```toml
584
+ # .gemini/commands/kc/work.toml
585
+ description = "Start a new KnowzCode development workflow"
586
+ prompt = """Read .gemini/skills/kc-work/SKILL.md for full instructions.
587
+ Start a structured KnowzCode development workflow for: <ARGS/>
588
+ Classify tier (Micro/Light/Full), create WorkGroup, run Phase 1A Impact Analysis.
589
+ Read knowzcode/knowzcode_loop.md for methodology, knowzcode/knowzcode_project.md for context.
590
+ STOP at each quality gate for user approval."""
591
+ ```
592
+
593
+ ```toml
594
+ # .gemini/commands/kc/plan.toml
595
+ description = "Research before implementing"
596
+ prompt = """Read .gemini/skills/kc-plan/SKILL.md for full instructions.
597
+ Investigate the codebase for: <ARGS/>
598
+ Explore files, check specs, review architecture, scan workgroup history.
599
+ Present findings with current state, patterns, options, and recommended approach.
600
+ Say 'implement' to transition to /kc:work."""
601
+ ```
602
+
603
+ ```toml
604
+ # .gemini/commands/kc/fix.toml
605
+ description = "Quick targeted fix (micro-fix workflow)"
606
+ prompt = """Read .gemini/skills/kc-fix/SKILL.md for full instructions.
607
+ Apply a targeted fix for: <ARGS/>
608
+ Scope guard: single file, <50 lines, no architectural impact. If larger, suggest /kc:work.
609
+ Run tests, log a MicroFix entry in knowzcode/knowzcode_log.md, commit with fix: prefix."""
610
+ ```
611
+
612
+ ```toml
613
+ # .gemini/commands/kc/audit.toml
614
+ description = "Run quality audit against specs"
615
+ prompt = """Read .gemini/skills/kc-audit/SKILL.md for full instructions.
616
+ Perform a READ-ONLY audit for: <ARGS/>
617
+ Audit types: spec (VERIFY coverage), architecture (doc vs code), security (OWASP), integration (API contracts).
618
+ Compare implementation against specs in knowzcode/specs/. Do NOT modify source files.
619
+ Report completion percentage, gaps, and security concerns."""
620
+ ```
621
+
622
+ ```toml
623
+ # .gemini/commands/kc/learn.toml
624
+ description = "Capture a learning to KnowzCode vault"
625
+ prompt = """Read .gemini/skills/kc-learn/SKILL.md for full instructions.
626
+ Capture the following learning: <ARGS/>
627
+ Route to the appropriate vault per knowzcode/knowzcode_vaults.md routing table.
628
+ Vault types: code (patterns/workarounds), ecosystem (decisions/conventions), finalizations (completions).
629
+ If MCP is unavailable, save to knowzcode/pending_captures.md."""
630
+ ```
631
+
632
+ ```toml
633
+ # .gemini/commands/kc/status.toml
634
+ description = "Check KnowzCode MCP connection and vault status"
635
+ prompt = """Read .gemini/skills/kc-status/SKILL.md for full instructions.
636
+ Check MCP connection: read .gemini/settings.json for mcpServers.knowz entry, run gemini mcp list.
637
+ Report vault config from knowzcode/knowzcode_vaults.md, test connectivity via list_vaults.
638
+ Show active WorkGroups from knowzcode/knowzcode_tracker.md."""
639
+ ```
640
+
641
+ ```toml
642
+ # .gemini/commands/kc/continue.toml
643
+ description = "Resume interrupted KnowzCode workflow"
644
+ prompt = """Read .gemini/skills/kc-continue/SKILL.md for full instructions.
645
+ Read knowzcode/knowzcode_tracker.md to find active [WIP] WorkGroups.
646
+ Read the most recent WorkGroup file from knowzcode/workgroups/.
647
+ Determine the current phase from the Phase History table.
648
+ Resume from where the workflow left off, following knowzcode/knowzcode_loop.md."""
649
+ ```
650
+
651
+ ```toml
652
+ # .gemini/commands/kc/init.toml
653
+ description = "Initialize KnowzCode in this project"
654
+ prompt = """Read .gemini/skills/kc-init/SKILL.md for full instructions.
655
+ Set up the KnowzCode framework in the current project.
656
+ Check for existing knowzcode/ directory. If present, ask: Abort, Merge, or Overwrite.
657
+ Create knowzcode/ with template files. Detect project stack.
658
+ Generate platform adapter(s) as needed. Offer MCP configuration.
659
+ Report generated files and suggest /kc:work as next step.
660
+ <ARGS/>"""
661
+ ```
662
+
663
+ ```toml
664
+ # .gemini/commands/kc/connect-mcp.toml
665
+ description = "Configure KnowzCode MCP server connection for Gemini CLI"
666
+ prompt = """Read .gemini/skills/kc-connect-mcp/SKILL.md for full instructions.
667
+ Configure the KnowzCode MCP server for Gemini CLI.
668
+ Check KNOWZ_API_KEY env var and knowzcode/mcp_config.md before prompting for API key.
669
+ Primary method: gemini mcp add --transport sse -s <scope> -H "Authorization: Bearer <key>" -H "X-Project-Path: $(pwd)" knowz https://mcp.knowz.io/mcp
670
+ Fallback: write .gemini/settings.json with mcpServers.knowz entry (url + headers).
671
+ Scopes: project (default), user. Verify: gemini mcp list. Remove: gemini mcp remove knowz.
672
+ If user has no API key, suggest /kc:register.
673
+ <ARGS/>"""
674
+ ```
675
+
676
+ ```toml
677
+ # .gemini/commands/kc/register.toml
678
+ description = "Register for KnowzCode and configure MCP for Gemini CLI"
679
+ prompt = """Read .gemini/skills/kc-register/SKILL.md for full instructions.
680
+ Register for KnowzCode and auto-configure MCP for Gemini CLI.
681
+ Check for existing API key in KNOWZ_API_KEY, mcp_config.md, or other platform configs before registration.
682
+ Registration API: https://api.knowz.io/api/v1/auth/register
683
+ Prompt for name, email, password. Call API. Extract API key and vault ID.
684
+ Configure MCP via: gemini mcp add --transport sse -H "Authorization: Bearer <key>" -H "X-Project-Path: $(pwd)" knowz https://mcp.knowz.io/mcp
685
+ Fallback: write .gemini/settings.json with mcpServers.knowz entry.
686
+ Update knowzcode/knowzcode_vaults.md with vault IDs.
687
+ <ARGS/>"""
688
+ ```
689
+
690
+ ```toml
691
+ # .gemini/commands/kc/telemetry.toml
692
+ description = "Investigate production telemetry"
693
+ prompt = """Read .gemini/skills/kc-telemetry/SKILL.md for full instructions.
694
+ Investigate production telemetry to diagnose errors and trace issues.
695
+ Parse query for environment, timeframe, error context: <ARGS/>
696
+ Read knowzcode/knowzcode_telemetry.md for configured sources.
697
+ Query Sentry/App Insights via MCP tools. Correlate findings across sources.
698
+ Present timeline, root cause analysis, and recommended fixes.
699
+ If no sources configured, suggest /kc:telemetry-setup."""
700
+ ```
701
+
702
+ ```toml
703
+ # .gemini/commands/kc/telemetry-setup.toml
704
+ description = "Configure telemetry sources for /kc:telemetry"
705
+ prompt = """Read .gemini/skills/kc-telemetry-setup/SKILL.md for full instructions.
706
+ Configure telemetry sources for /kc:telemetry investigations.
707
+ Detect available telemetry MCP tools (Sentry, App Insights).
708
+ For each source: verify connectivity, test auth, detect projects.
709
+ Write config to knowzcode/knowzcode_telemetry.md.
710
+ Run a test query to verify end-to-end connectivity.
711
+ <ARGS/>"""
712
+ ```
713
+
714
+ Gemini also supports extensions (`gemini-extension.json`) for tool integration and `@file.md` imports for including methodology files directly in prompts.
715
+
716
+ ```markdown
717
+ # KnowzCode Development Methodology
718
+
719
+ This project uses KnowzCode for structured TDD development.
720
+
721
+ ## Required Reading
722
+ Read these files before starting any feature work (use @import syntax for direct inclusion):
723
+ - `knowzcode/knowzcode_loop.md` — Complete workflow methodology
724
+ - `knowzcode/knowzcode_project.md` — Project context and tech stack
725
+ - `knowzcode/knowzcode_architecture.md` — Architecture documentation
726
+ - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
727
+
728
+ ## Phase Walkthrough
729
+
730
+ ### Phase 1A: Impact Analysis
731
+ - Identify components affected by the goal
732
+ - Create NodeIDs for new capabilities (PascalCase domain concepts)
733
+ - Check existing specs for domain overlap before creating new ones
734
+ - Present Change Set for user approval — STOP until approved
735
+
736
+ ### Phase 1B: Specification
737
+ - Draft specs using 4-section format (Rules, Interfaces, Verification Criteria, Debt)
738
+ - Each spec needs 2+ VERIFY statements
739
+ - Present for approval — STOP until approved
740
+ - Commit specs as a pre-implementation checkpoint
741
+
742
+ ### Phase 2A: Implementation (TDD Required)
743
+ - Follow Red-Green-Refactor for every feature
744
+ - Write failing test FIRST, then minimal code to pass, then refactor
745
+ - Run full test suite + linter + build when all features done
746
+ - STOP and report results
747
+
748
+ ### Phase 2B: Completeness Audit
749
+ - READ-ONLY comparison of implementation vs specs
750
+ - Calculate completion percentage
751
+ - Report gaps and security concerns
752
+ - STOP for user decision
753
+
754
+ ### Phase 3: Finalization
755
+ - Update specs to As-Built, update tracker, write log entry
756
+ - Check architecture doc for drift
757
+ - Final commit
758
+
759
+ ## Rules
760
+ - Follow quality gates strictly — STOP at each gate for user approval
761
+ - TDD is mandatory for all feature work
762
+ - Propose Change Sets before implementing
763
+ - Update specs and tracker after implementation
764
+ - Log completions in `knowzcode/knowzcode_log.md`
765
+ - Target <20 specs — consolidate when domains overlap >50%
766
+
767
+ ## Knowledge Capture (CRITICAL — DO NOT SKIP)
768
+ Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
769
+ When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
770
+ When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
771
+ Use `/kc:learn "insight"` for automatic routing.
772
+ Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
773
+
774
+ ## MCP Server Configuration (Gemini CLI)
775
+ MCP servers are configured in `.gemini/settings.json` (project) or `~/.gemini/settings.json` (user).
776
+ To connect: `/kc:connect-mcp <api-key>` or `/kc:register`.
777
+ To verify: `gemini mcp list` or `/mcp` in session.
778
+ Manual config: add a `mcpServers.knowz` entry with `url` and `headers` — see `/kc:connect-mcp` skill for format.
779
+
780
+ ## Micro-Fix (for small changes)
781
+ Single file, <50 lines, no ripple effects:
782
+ 1. Implement fix → 2. Run tests → 3. Log MicroFix → 4. Commit with `fix:`
783
+ ```
784
+
785
+ ### Gemini Skill Files (`.gemini/skills/`)
786
+
787
+ Gemini CLI (2026) supports `SKILL.md` files for discoverable skills, identical to the Codex format. Each skill is a directory containing `SKILL.md` with YAML frontmatter (`name` and `description`). Place in `.gemini/skills/` (repo-level) or `~/.gemini/skills/` (user-level). The `description` field drives implicit invocation — Gemini auto-triggers skills based on task matching. Note: `.agents/skills/` also works as an alias path.
788
+
789
+ #### .gemini/skills/kc-work/SKILL.md
790
+
791
+ ```markdown
792
+ ---
793
+ name: kc-work
794
+ description: Start a structured KnowzCode development workflow with TDD, quality gates, and phased implementation. Triggers on feature requests, new functionality, or complex multi-file changes.
795
+ ---
796
+ <!-- Generated by KnowzCode vX.Y.Z -->
797
+
798
+ # /kc:work — Start KnowzCode Workflow
799
+
800
+ Start a structured KnowzCode development workflow for the given goal.
801
+
802
+ ## Instructions
803
+
804
+ Read these files for methodology and project context:
805
+ - `knowzcode/knowzcode_loop.md` — Complete methodology
806
+ - `knowzcode/knowzcode_project.md` — Project context
807
+ - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
808
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
809
+
810
+ ### Step 1: Classify Tier
811
+ - **Micro** (single file, <50 lines): Use `/kc:fix` instead
812
+ - **Light** (≤3 files): Streamlined 2-phase path
813
+ - **Full** (>3 files or complex): Complete 5-phase workflow
814
+
815
+ ### Step 2: Create WorkGroup
816
+ Generate WorkGroupID: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
817
+ Create `knowzcode/workgroups/{WorkGroupID}.md`
818
+
819
+ ### Step 3: Phase 1A — Impact Analysis
820
+ 1. Identify affected components
821
+ 2. Create NodeIDs for new capabilities (PascalCase)
822
+ 3. Check `knowzcode/specs/` for existing domain overlap
823
+ 4. Propose Change Set with NodeIDs, affected files, risk assessment
824
+
825
+ **STOP** — Present Change Set for user approval before continuing.
826
+
827
+ After approval, continue through Phase 1B (Specification) → Phase 2A (TDD Implementation) → Phase 2B (Audit) → Phase 3 (Finalization), stopping at each quality gate.
828
+ ```
829
+
830
+ #### .gemini/skills/kc-plan/SKILL.md
831
+
832
+ ```markdown
833
+ ---
834
+ name: kc-plan
835
+ description: Research and investigate a topic in the codebase before implementing changes. Triggers on exploratory questions, architecture review, or pre-implementation research.
836
+ ---
837
+ <!-- Generated by KnowzCode vX.Y.Z -->
838
+
839
+ # /kc:plan — Research Before Implementing
840
+
841
+ Investigate a topic in the codebase before implementing changes.
842
+
843
+ ## Instructions
844
+
845
+ Read these files for context:
846
+ - `knowzcode/knowzcode_loop.md` — Methodology
847
+ - `knowzcode/knowzcode_project.md` — Project context
848
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
849
+
850
+ 1. Explore the codebase for relevant files, patterns, and implementations
851
+ 2. Check `knowzcode/specs/` for related component specs
852
+ 3. Scan `knowzcode/workgroups/` for past WorkGroups in similar areas
853
+ 4. Review `knowzcode/knowzcode_architecture.md` for structural context
854
+ 5. Present findings with current state, patterns, options, and recommended approach
855
+
856
+ **STOP** — Present research findings. To implement, use `/kc:work` with the chosen approach.
857
+ ```
858
+
859
+ #### .gemini/skills/kc-fix/SKILL.md
860
+
861
+ ```markdown
862
+ ---
863
+ name: kc-fix
864
+ description: Quick targeted fix for single-file changes using the micro-fix protocol. Triggers on bug fixes, typos, small corrections, and CSS tweaks.
865
+ ---
866
+ <!-- Generated by KnowzCode vX.Y.Z -->
867
+
868
+ # /kc:fix — Quick Targeted Fix
869
+
870
+ Apply a targeted fix using the micro-fix protocol.
871
+
872
+ ## Scope Guard
873
+
874
+ This workflow is for changes that are:
875
+ - Single file (or minimal multi-file with no ripple effects)
876
+ - <50 lines changed
877
+ - No architectural impact
878
+
879
+ If the fix exceeds this scope, suggest `/kc:work` instead.
880
+
881
+ ## Instructions
882
+
883
+ Read `knowzcode/knowzcode_loop.md` section on Micro-Fix.
884
+
885
+ 1. Implement the fix
886
+ 2. Run targeted tests for the affected code
887
+ 3. Prepend a MicroFix entry to `knowzcode/knowzcode_log.md`
888
+ 4. Commit with `fix: {description}` message
889
+ ```
890
+
891
+ #### .gemini/skills/kc-audit/SKILL.md
892
+
893
+ ```markdown
894
+ ---
895
+ name: kc-audit
896
+ description: Read-only quality audit comparing implementation against specs. Triggers on audit requests, quality checks, security reviews, and compliance verification.
897
+ ---
898
+ <!-- Generated by KnowzCode vX.Y.Z -->
899
+
900
+ # /kc:audit — Quality Audit
901
+
902
+ Perform a READ-ONLY audit comparing implementation against specs.
903
+
904
+ ## Instructions
905
+
906
+ Read these files:
907
+ - `knowzcode/knowzcode_loop.md` — Phase 2B methodology
908
+ - `knowzcode/knowzcode_tracker.md` — Find active WorkGroups
909
+
910
+ **CRITICAL: This is a READ-ONLY audit. Do NOT modify source files.**
911
+
912
+ 1. Compare implementation against all VERIFY statements in specs from `knowzcode/specs/`
913
+ 2. Calculate completion percentage per NodeID and overall
914
+ 3. Identify gaps: missing features, incomplete criteria, untested paths
915
+ 4. Check for security concerns
916
+ 5. Assess risk for any gaps found
917
+
918
+ ### Standalone Audit Types
919
+ - **spec**: Audit spec quality and VERIFY statement coverage
920
+ - **architecture**: Compare architecture doc against codebase
921
+ - **security**: OWASP top 10, input validation, auth flows
922
+ - **integration**: API contracts, dependency health
923
+
924
+ **STOP** — Present audit results with completion percentage and gap list.
925
+ ```
926
+
927
+ #### .gemini/skills/kc-learn/SKILL.md
928
+
929
+ ```markdown
930
+ ---
931
+ name: kc-learn
932
+ description: Capture learnings, decisions, patterns, and conventions to the KnowzCode knowledge vault. Triggers on knowledge capture, documentation of decisions, or pattern recording.
933
+ ---
934
+ <!-- Generated by KnowzCode vX.Y.Z -->
935
+
936
+ # /kc:learn — Capture Learning
937
+
938
+ Capture a learning, decision, or pattern to the KnowzCode knowledge vault.
939
+
940
+ ## Instructions
941
+
942
+ Read `knowzcode/knowzcode_vaults.md` for vault configuration and routing rules.
943
+
944
+ 1. Analyze the learning provided
945
+ 2. Categorize: Pattern, Workaround, Decision, Convention, Security, Integration, Performance, Completion
946
+ 3. Route to the appropriate vault:
947
+ - Pattern/Workaround/Performance → `code` vault
948
+ - Decision/Convention/Security/Integration → `ecosystem` vault
949
+ - Completion → `finalizations` vault
950
+ 4. If MCP is connected: call `create_knowledge` with appropriate `vaultId`
951
+ 5. If MCP is unavailable: append to `knowzcode/pending_captures.md`
952
+
953
+ Write detailed, self-contained entries — vault entries are retrieved via semantic search.
954
+ ```
955
+
956
+ #### .gemini/skills/kc-continue/SKILL.md
957
+
958
+ ```markdown
959
+ ---
960
+ name: kc-continue
961
+ description: Resume an interrupted KnowzCode workflow or advance to the next phase. Triggers on continuation requests, workflow resumption, or phase advancement.
962
+ ---
963
+ <!-- Generated by KnowzCode vX.Y.Z -->
964
+
965
+ # /kc:continue — Resume Workflow
966
+
967
+ Resume an interrupted KnowzCode workflow or advance to the next phase.
968
+
969
+ ## Instructions
970
+
971
+ Read `knowzcode/knowzcode_tracker.md` to find active `[WIP]` WorkGroups.
972
+
973
+ ### Step 1: Find Active WorkGroup
974
+ - One active: use it
975
+ - Multiple active: ask user which to resume
976
+ - None active: suggest `/kc:work`
977
+
978
+ ### Step 2: Determine Current Phase
979
+ Read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
980
+ Check the Phase History table to determine current state.
981
+
982
+ ### Step 3: Resume
983
+
984
+ | State | Action |
985
+ |-------|--------|
986
+ | 1A in progress | Complete impact analysis |
987
+ | 1A approved, specs not started | Begin Phase 1B |
988
+ | 1B approved, not implemented | Begin Phase 2A |
989
+ | 2A complete | Run Phase 2B audit |
990
+ | 2B complete, gaps found | Present fix/accept options |
991
+ | 2B complete, no gaps | Begin Phase 3 |
992
+
993
+ Resume from the appropriate phase following `knowzcode/knowzcode_loop.md`.
994
+ ```
995
+
996
+ #### .gemini/skills/kc-init/SKILL.md
997
+
998
+ ```markdown
999
+ ---
1000
+ name: kc-init
1001
+ description: Initialize KnowzCode in a project. Triggers on project setup, framework initialization, or first-time configuration.
1002
+ ---
1003
+ <!-- Generated by KnowzCode vX.Y.Z -->
1004
+
1005
+ # /kc:init — Initialize KnowzCode
1006
+
1007
+ Set up the KnowzCode framework in the current project.
1008
+
1009
+ ## Instructions
1010
+
1011
+ 1. Check for existing `knowzcode/` directory
1012
+ - If exists: ask user to Abort, Merge, or Overwrite
1013
+ 2. Create directory structure: `knowzcode/`, `knowzcode/specs/`, `knowzcode/workgroups/`, `knowzcode/prompts/`
1014
+ 3. Generate template files from the KnowzCode framework source
1015
+ 4. Detect project stack (language, frameworks, test runners, build tools)
1016
+ 5. Select platform adapter(s): Claude Code, Codex, Gemini, Cursor, Copilot, Windsurf
1017
+ 6. Generate platform instruction file(s) with detected stack context
1018
+ 7. Report generated files and suggest next steps (`/kc:work`, `/kc:register`)
1019
+ ```
1020
+
1021
+ #### .gemini/skills/kc-status/SKILL.md
1022
+
1023
+ ```markdown
1024
+ ---
1025
+ name: kc-status
1026
+ description: Check KnowzCode MCP connection, vault health, and agent status for Gemini CLI. Triggers on status checks, diagnostics, or troubleshooting.
1027
+ ---
1028
+ <!-- Generated by KnowzCode vX.Y.Z -->
1029
+
1030
+ # /kc:status — Check Status (Gemini CLI)
1031
+
1032
+ Check KnowzCode MCP connection, vault health, and agent status.
1033
+
1034
+ ## Instructions
1035
+
1036
+ 1. Check for agent definition files (glob `.gemini/agents/kc-*.md` or `agents/*.md`)
1037
+ 2. **Check MCP server configuration (Gemini-specific)**:
1038
+ - Read `.gemini/settings.json` (project) for `mcpServers.knowz` entry
1039
+ - If not found, check `~/.gemini/settings.json` (user-level)
1040
+ - Run `gemini mcp list` to verify server status
1041
+ - Use `/mcp` as in-session alternative for verification
1042
+ 2.5. **Cross-Platform Config Discovery**:
1043
+ - Check `KNOWZ_API_KEY` env var: Set (ending ...{last4}) | Not set
1044
+ - Check `knowzcode/mcp_config.md`: Connected / Not configured
1045
+ - Check `.mcp.json` (Codex) for knowz entry: Configured | Not found
1046
+ - Check `.vscode/mcp.json` (Copilot) for knowz entry: Configured | Not found
1047
+ - Include all sources in status output
1048
+ - If Gemini not configured but another platform is: "Tip: An API key was found in {source}. Run /kc:connect-mcp to configure for Gemini."
1049
+ 3. Read `knowzcode/knowzcode_vaults.md` for vault configuration
1050
+ 4. Test MCP connectivity by calling `list_vaults`
1051
+ 5. Check each configured vault's health and item count
1052
+ 6. Read `knowzcode/knowzcode_tracker.md` for active WorkGroups
1053
+
1054
+ Report connection status, vault health, agent availability, and active WorkGroups.
1055
+ If MCP is not configured, suggest `/kc:connect-mcp <api-key>` or `/kc:register`.
1056
+ ```
1057
+
1058
+ #### .gemini/skills/kc-connect-mcp/SKILL.md
1059
+
1060
+ ```markdown
1061
+ ---
1062
+ name: kc-connect-mcp
1063
+ description: Configure KnowzCode MCP server for Gemini CLI. Triggers on MCP configuration, API key setup, or vault connection.
1064
+ ---
1065
+ <!-- Generated by KnowzCode vX.Y.Z -->
1066
+
1067
+ # /kc:connect-mcp — Configure MCP Server (Gemini CLI)
1068
+
1069
+ Configure the KnowzCode MCP server for vector-based code search and context retrieval.
1070
+
1071
+ ## Instructions
1072
+
1073
+ Requires an API key. If the user doesn't have one, suggest `/kc:register` first.
1074
+
1075
+ **Default endpoint:** `https://mcp.knowz.io/mcp`
1076
+ **Dev endpoint:** `https://mcp.dev.knowz.io/mcp`
1077
+
1078
+ ### Step 1: Parse Arguments
1079
+ - Accept API key (optional — may be discovered) and optional parameters:
1080
+ - `--dev` → use dev endpoint
1081
+ - `--scope user` → user-level config (`~/.gemini/settings.json`); default is `project` (`.gemini/settings.json`)
1082
+
1083
+ ### Step 1.5: Smart Config Discovery (if no API key in arguments)
1084
+
1085
+ Before prompting for an API key, check known config sources:
1086
+
1087
+ 1. **Environment variable**: Check `KNOWZ_API_KEY`
1088
+ - If set: use as the API key, display "Using API key from KNOWZ_API_KEY (ending ...{last4})"
1089
+
1090
+ 2. **Project config**: Read `knowzcode/mcp_config.md`
1091
+ - If `Connected: Yes` and endpoint set: pre-populate endpoint
1092
+ - If `API Key (last 4)` set: note for confirmation
1093
+
1094
+ 3. **Vault config**: Read `knowzcode/knowzcode_vaults.md`
1095
+ - If vaults have non-empty IDs: skip vault prompts in Step 5 (unless `--configure-vaults`)
1096
+
1097
+ 4. **Cross-platform config files** (check for API key in other platforms):
1098
+ - `.mcp.json` → knowz entry Authorization header
1099
+ - `.vscode/mcp.json` → `servers.knowz.headers`
1100
+ - If found: extract Bearer token, offer to reuse:
1101
+ "Found existing API key (ending ...{last4}) in {source}. Use this key? [Yes/No]"
1102
+
1103
+ If a key was discovered, skip interactive API key prompt.
1104
+
1105
+ ### Step 2: Check Existing Configuration
1106
+ - Run `gemini mcp list` to check if `knowz` server is already configured
1107
+ - If found, ask user: **Replace** existing config or **Cancel**
1108
+ - To remove existing: `gemini mcp remove knowz`
1109
+
1110
+ ### Step 3: Configure MCP Server
1111
+ **Primary method** — use Gemini CLI:
1112
+ ```bash
1113
+ gemini mcp add --transport sse -s <scope> \
1114
+ -H "Authorization: Bearer <api-key>" \
1115
+ -H "X-Project-Path: $(pwd)" \
1116
+ knowz <endpoint>
1117
+ ```
1118
+ Where `<scope>` is `project` (default) or `user`.
1119
+
1120
+ **Fallback** — if `gemini` CLI is not available, write `.gemini/settings.json` directly:
1121
+ ```json
1122
+ {
1123
+ "mcpServers": {
1124
+ "knowz": {
1125
+ "url": "<endpoint>",
1126
+ "headers": {
1127
+ "Authorization": "Bearer <api-key>",
1128
+ "X-Project-Path": "<project-path>"
1129
+ }
1130
+ }
1131
+ }
1132
+ }
1133
+ ```
1134
+ If the file exists, read it first and merge — preserve existing settings, only add/update the `mcpServers.knowz` entry.
1135
+
1136
+ ### Step 4: Verify Configuration
1137
+ - Run `gemini mcp list` to confirm `knowz` appears
1138
+ - Test connectivity by calling `list_vaults`
1139
+
1140
+ ### Step 5: Configure Vaults (Conditional)
1141
+ - First check `knowzcode/knowzcode_vaults.md` — if vaults already have non-empty IDs from a previous platform setup, skip vault prompts and report "Vaults already configured from previous setup"
1142
+ - Otherwise, if `list_vaults` returns vaults, offer to update `knowzcode/knowzcode_vaults.md`
1143
+ - If vaults have null IDs, offer to create them via `create_vault`
1144
+
1145
+ ### Step 5.5: Update GEMINI.md with Vault Targeting Guidance
1146
+ Ensure agents know to pass `vaultId` by adding a reference section to the project's GEMINI.md:
1147
+ 1. Read the project's `GEMINI.md`
1148
+ 2. Search for an existing `### Vault Targeting` section
1149
+ 3. If found: replace. If not found: append after Knowledge Capture section
1150
+ 4. Insert:
1151
+ ```
1152
+ ### Vault Targeting (MCP Writes)
1153
+ **Always pass `vaultId`** when calling `create_knowledge` or `update_knowledge`.
1154
+ Vault IDs and routing rules: `knowzcode/knowzcode_vaults.md`
1155
+ ```
1156
+
1157
+ ### Step 6: Update Status Files
1158
+ - Update `knowzcode/mcp_config.md` with connection status:
1159
+ - Set `Connected: Yes`, endpoint, timestamp
1160
+ - Set `API Key (last 4): <last 4 characters of the API key>`
1161
+
1162
+ ### Step 7: Report Success
1163
+ Report connection status, available vaults, and remind user:
1164
+ "Restart your Gemini CLI session to activate MCP tools, or run `/mcp` to verify in-session."
1165
+
1166
+ ### Error Handling
1167
+ - If `gemini` CLI not found → use manual `.gemini/settings.json` fallback with JSON snippet
1168
+ - If API key is invalid → report error, suggest checking key at https://knowz.io/api-keys
1169
+ - If network error → suggest checking connectivity and firewall
1170
+ ```
1171
+
1172
+ #### .gemini/skills/kc-register/SKILL.md
1173
+
1174
+ ```markdown
1175
+ ---
1176
+ name: kc-register
1177
+ description: Register for KnowzCode and auto-configure MCP server for Gemini CLI. Triggers on account creation, registration, or first-time setup.
1178
+ ---
1179
+ <!-- Generated by KnowzCode vX.Y.Z -->
1180
+
1181
+ # /kc:register — Register & Configure (Gemini CLI)
1182
+
1183
+ Register for KnowzCode and automatically configure the MCP server.
1184
+
1185
+ ## Instructions
1186
+
1187
+ **Registration API:** `https://api.knowz.io/api/v1/auth/register`
1188
+ **Dev API:** `https://api.dev.knowz.io/api/v1/auth/register`
1189
+
1190
+ ### Step 0: Smart Discovery
1191
+
1192
+ Before starting registration, check if user already has a KnowzCode API key:
1193
+
1194
+ 1. Check `KNOWZ_API_KEY` environment variable
1195
+ 2. Check `knowzcode/mcp_config.md` — if `Connected: Yes`, existing config exists
1196
+ 3. Check cross-platform configs: `.mcp.json`, `.vscode/mcp.json`
1197
+ - Extract Bearer token from Authorization headers if found
1198
+
1199
+ If existing API key found:
1200
+ "You already have a KnowzCode API key configured (ending ...{last4}) from {source}.
1201
+ Options: 1. Use existing key via /kc:connect-mcp 2. Register new account anyway 3. Cancel"
1202
+
1203
+ If user chooses option 1: advise running `/kc:connect-mcp`.
1204
+ If user chooses option 2: proceed with registration (Step 1).
1205
+
1206
+ ### Step 1: Collect User Info
1207
+ Prompt user for name, email, and password (one at a time).
1208
+
1209
+ ### Step 2: Register
1210
+ Call the KnowzCode registration API via HTTP POST. Extract API key and vault ID from response.
1211
+
1212
+ ### Step 3: Check Existing MCP Config
1213
+ - Run `gemini mcp list` to check if `knowz` is already configured
1214
+ - If found, remove with `gemini mcp remove knowz` before reconfiguring
1215
+
1216
+ ### Step 4: Configure MCP Server
1217
+ **Primary method** — use Gemini CLI:
1218
+ ```bash
1219
+ gemini mcp add --transport sse \
1220
+ -H "Authorization: Bearer <api-key>" \
1221
+ -H "X-Project-Path: $(pwd)" \
1222
+ knowz https://mcp.knowz.io/mcp
1223
+ ```
1224
+
1225
+ **Fallback** — if `gemini` CLI not available, write `.gemini/settings.json`:
1226
+ ```json
1227
+ {
1228
+ "mcpServers": {
1229
+ "knowz": {
1230
+ "url": "https://mcp.knowz.io/mcp",
1231
+ "headers": {
1232
+ "Authorization": "Bearer <api-key>",
1233
+ "X-Project-Path": "<project-path>"
1234
+ }
1235
+ }
1236
+ }
1237
+ }
1238
+ ```
1239
+ Merge with existing settings if file exists.
1240
+
1241
+ ### Step 5: Verify
1242
+ - Run `gemini mcp list` to confirm `knowz` appears
1243
+ - Test connectivity by calling `list_vaults`
1244
+
1245
+ ### Step 6: Configure Vaults
1246
+ - Check `knowzcode/knowzcode_vaults.md` first — if vaults already configured from another platform, reuse them
1247
+ - Otherwise, update `knowzcode/knowzcode_vaults.md` with returned vault IDs
1248
+ - Update `knowzcode/mcp_config.md` with connection status and `API Key (last 4)`
1249
+
1250
+ ### Step 7: Report Success
1251
+ The user is ready to use MCP-powered features.
1252
+ Remind: "Restart your Gemini CLI session or run `/mcp` to verify."
1253
+ ```
1254
+
1255
+ #### .gemini/skills/kc-telemetry/SKILL.md
1256
+
1257
+ ```markdown
1258
+ ---
1259
+ name: kc-telemetry
1260
+ description: Investigate production telemetry from Sentry and App Insights. Triggers on error investigation, production debugging, or telemetry queries.
179
1261
  ---
1262
+ <!-- Generated by KnowzCode vX.Y.Z -->
180
1263
 
181
- ## Google Gemini CLI (GEMINI.md)
1264
+ # /kc:telemetry Investigate Telemetry
182
1265
 
183
- Create `GEMINI.md` in project root. Notes: Gemini CLI supports `@file.md` imports for pulling in methodology files (e.g., `@knowzcode/knowzcode_loop.md`). User-global preferences can be placed in `~/.gemini/GEMINI.md`.
1266
+ Investigate production telemetry to diagnose errors, trace issues, and identify root causes.
184
1267
 
185
- ### Native Commands (`.gemini/commands/kc/*.toml`)
1268
+ ## Instructions
186
1269
 
187
- Gemini CLI (2026) supports native custom commands via TOML files in `.gemini/commands/`. Subdirectory namespacing gives the `/kc:` prefix automatically:
1270
+ Usage: `/kc:telemetry "<natural language description>"`
188
1271
 
189
- ```toml
190
- # .gemini/commands/kc/work.toml
191
- description = "Start a new KnowzCode development workflow"
192
- prompt = """Read knowzcode/knowzcode_loop.md. Follow Phase 1A→3 workflow for:
193
- <ARGS/>
194
- Read knowzcode/knowzcode_project.md for project context.
195
- Read knowzcode/knowzcode_tracker.md for active work."""
1272
+ 1. Parse the natural language query for environment, timeframe, and error context
1273
+ 2. Read `knowzcode/knowzcode_telemetry.md` for configured sources
1274
+ 3. Query configured telemetry sources (Sentry, App Insights) via MCP tools
1275
+ 4. Correlate findings across sources
1276
+ 5. Present timeline, root cause analysis, and recommended fixes
1277
+
1278
+ If no telemetry sources are configured, suggest `/kc:telemetry-setup`.
196
1279
  ```
197
1280
 
198
- ```toml
199
- # .gemini/commands/kc/plan.toml
200
- description = "Research before implementing"
201
- prompt = """Read knowzcode/knowzcode_loop.md and knowzcode/knowzcode_project.md.
202
- Investigate the codebase for: <ARGS/>
203
- Present findings with options. Say 'implement' to transition to /kc:work."""
1281
+ #### .gemini/skills/kc-telemetry-setup/SKILL.md
1282
+
1283
+ ```markdown
1284
+ ---
1285
+ name: kc-telemetry-setup
1286
+ description: Configure telemetry sources (Sentry, App Insights) for /kc:telemetry. Triggers on telemetry configuration or source setup.
1287
+ ---
1288
+ <!-- Generated by KnowzCode vX.Y.Z -->
1289
+
1290
+ # /kc:telemetry-setup — Configure Telemetry Sources
1291
+
1292
+ Configure telemetry sources for `/kc:telemetry` investigations.
1293
+
1294
+ ## Instructions
1295
+
1296
+ Usage: `/kc:telemetry-setup [sentry|appinsights|all]`
1297
+
1298
+ 1. Detect available telemetry MCP tools (Sentry, App Insights)
1299
+ 2. For each selected source:
1300
+ - Verify MCP tool connectivity
1301
+ - Test authentication and permissions
1302
+ - Detect available projects/resources
1303
+ 3. Write configuration to `knowzcode/knowzcode_telemetry.md`
1304
+ 4. Run a test query to verify end-to-end connectivity
1305
+
1306
+ Report configured sources and their status.
204
1307
  ```
205
1308
 
206
- ```toml
207
- # .gemini/commands/kc/fix.toml
208
- description = "Quick targeted fix (micro-fix workflow)"
209
- prompt = """Read knowzcode/knowzcode_loop.md section on Micro-Fix.
210
- Apply a targeted fix for: <ARGS/>
211
- Run tests, log a MicroFix entry, commit with fix: prefix."""
1309
+ ### Gemini Subagents (`.gemini/agents/`) — Experimental
1310
+
1311
+ Gemini CLI supports local subagents via `.gemini/agents/*.md` files with YAML frontmatter. Requires `experimental.enableAgents: true` in Gemini `settings.json`. Each agent definition is a concise, platform-neutral description of the agent's role. Refer to `knowzcode/knowzcode_loop.md` for full methodology details.
1312
+
1313
+ #### .gemini/agents/kc-analyst.md
1314
+
1315
+ ```markdown
1316
+ ---
1317
+ name: kc-analyst
1318
+ description: "KnowzCode: Impact analysis and Change Set proposals"
1319
+ kind: local
1320
+ tools:
1321
+ - read_file
1322
+ - grep_search
1323
+ - list_directory
1324
+ - run_shell_command
1325
+ max_turns: 25
1326
+ timeout_mins: 10
1327
+ ---
1328
+
1329
+ # KnowzCode Analyst
1330
+
1331
+ You are the **Impact Analyst** for the KnowzCode development workflow.
1332
+
1333
+ ## Role
1334
+ Perform Phase 1A: Impact Analysis. Identify all components affected by a proposed change, create NodeIDs for new capabilities, and propose a Change Set for user approval.
1335
+
1336
+ ## Instructions
1337
+
1338
+ 1. Read `knowzcode/knowzcode_loop.md` for the complete Phase 1A methodology
1339
+ 2. Read `knowzcode/knowzcode_project.md` for project context and tech stack
1340
+ 3. Read `knowzcode/knowzcode_tracker.md` for active work
1341
+ 4. Scan `knowzcode/specs/` for existing specs that may overlap with the proposed change
1342
+ 5. Search the codebase for files affected by the change goal
1343
+
1344
+ ## Output: Change Set Proposal
1345
+ - **NodeIDs**: PascalCase domain concepts (not tasks) for each new capability
1346
+ - **Affected files**: List of files that will need changes
1347
+ - **Risk assessment**: Impact scope, complexity, potential regressions
1348
+ - **Dependency map**: Which NodeIDs depend on others
1349
+
1350
+ **STOP** after presenting the Change Set — wait for user approval before Phase 1B begins.
212
1351
  ```
213
1352
 
214
- ```toml
215
- # .gemini/commands/kc/audit.toml
216
- description = "Run quality audit against specs"
217
- prompt = """Read knowzcode/knowzcode_loop.md Phase 2B.
218
- Perform a READ-ONLY audit comparing implementation against specs in knowzcode/specs/.
219
- Report completion percentage, gaps, and security concerns for: <ARGS/>"""
1353
+ #### .gemini/agents/kc-architect.md
1354
+
1355
+ ```markdown
1356
+ ---
1357
+ name: kc-architect
1358
+ description: "KnowzCode: Specification drafting, architecture review, and design decisions"
1359
+ kind: local
1360
+ tools:
1361
+ - read_file
1362
+ - write_file
1363
+ - grep_search
1364
+ - list_directory
1365
+ max_turns: 20
1366
+ timeout_mins: 8
1367
+ ---
1368
+
1369
+ # KnowzCode Architect
1370
+
1371
+ You are the **Specification Architect** for the KnowzCode development workflow.
1372
+
1373
+ ## Role
1374
+ Perform Phase 1B: Specification. Draft component specs for all NodeIDs in the approved Change Set. Review architecture for consistency.
1375
+
1376
+ ## Instructions
1377
+
1378
+ 1. Read `knowzcode/knowzcode_loop.md` for the complete Phase 1B methodology
1379
+ 2. Read the approved Change Set from the active WorkGroup file
1380
+ 3. For each NodeID, draft a spec using the 4-section format:
1381
+ - **Rules & Decisions**: Constraints, invariants, design choices
1382
+ - **Interfaces**: Public API, data shapes, contracts
1383
+ - **Verification Criteria**: 2+ VERIFY statements per spec
1384
+ - **Debt & Gaps**: Known limitations, future work
1385
+ 4. Write specs to `knowzcode/specs/{NodeID}.md`
1386
+ 5. Review `knowzcode/knowzcode_architecture.md` for consistency
1387
+
1388
+ **STOP** after presenting specs — wait for user approval before Phase 2A begins. Commit approved specs.
220
1389
  ```
221
1390
 
222
- Gemini also supports extensions (`gemini-extension.json`) for tool integration and `@file.md` imports for including methodology files directly in prompts.
1391
+ #### .gemini/agents/kc-builder.md
223
1392
 
224
1393
  ```markdown
225
- # KnowzCode Development Methodology
1394
+ ---
1395
+ name: kc-builder
1396
+ description: "KnowzCode: TDD implementation, verification loops, and code quality"
1397
+ kind: local
1398
+ tools:
1399
+ - read_file
1400
+ - write_file
1401
+ - grep_search
1402
+ - list_directory
1403
+ - run_shell_command
1404
+ max_turns: 40
1405
+ timeout_mins: 15
1406
+ ---
226
1407
 
227
- This project uses KnowzCode for structured TDD development.
1408
+ # KnowzCode Builder
228
1409
 
229
- ## Required Reading
230
- Read these files before starting any feature work (use @import syntax for direct inclusion):
231
- - `knowzcode/knowzcode_loop.md` — Complete workflow methodology
232
- - `knowzcode/knowzcode_project.md` — Project context and tech stack
233
- - `knowzcode/knowzcode_architecture.md` — Architecture documentation
234
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
1410
+ You are the **TDD Builder** for the KnowzCode development workflow.
235
1411
 
236
- ## Phase Walkthrough
1412
+ ## Role
1413
+ Perform Phase 2A: Implementation. Implement all NodeIDs using strict TDD (Red-Green-Refactor). Every feature must have a failing test before production code is written.
237
1414
 
238
- ### Phase 1A: Impact Analysis
239
- - Identify components affected by the goal
240
- - Create NodeIDs for new capabilities (PascalCase domain concepts)
241
- - Check existing specs for domain overlap before creating new ones
242
- - Present Change Set for user approval — STOP until approved
1415
+ ## Instructions
243
1416
 
244
- ### Phase 1B: Specification
245
- - Draft specs using 4-section format (Rules, Interfaces, Verification Criteria, Debt)
246
- - Each spec needs 2+ VERIFY statements
247
- - Present for approval STOP until approved
248
- - Commit specs as a pre-implementation checkpoint
1417
+ 1. Read `knowzcode/knowzcode_loop.md` for the complete Phase 2A methodology
1418
+ 2. Read approved specs from `knowzcode/specs/` for the assigned NodeIDs
1419
+ 3. For each NodeID:
1420
+ a. **Red**: Write a failing test that verifies spec VERIFY statements
1421
+ b. **Green**: Write minimal production code to make the test pass
1422
+ c. **Refactor**: Clean up while keeping tests green
1423
+ 4. Run the full test suite after all NodeIDs are implemented
1424
+ 5. Run linter and build if configured in `knowzcode/environment_context.md`
1425
+ 6. Maximum 10 verification iterations before pausing
1426
+
1427
+ **STOP** after implementation — report test results, build status, and any issues.
1428
+ ```
249
1429
 
250
- ### Phase 2A: Implementation (TDD Required)
251
- - Follow Red-Green-Refactor for every feature
252
- - Write failing test FIRST, then minimal code to pass, then refactor
253
- - Run full test suite + linter + build when all features done
254
- - STOP and report results
1430
+ #### .gemini/agents/kc-reviewer.md
255
1431
 
256
- ### Phase 2B: Completeness Audit
257
- - READ-ONLY comparison of implementation vs specs
258
- - Calculate completion percentage
259
- - Report gaps and security concerns
260
- - STOP for user decision
1432
+ ```markdown
1433
+ ---
1434
+ name: kc-reviewer
1435
+ description: "KnowzCode: Quality audit, security review, and compliance verification"
1436
+ kind: local
1437
+ tools:
1438
+ - read_file
1439
+ - grep_search
1440
+ - list_directory
1441
+ - run_shell_command
1442
+ max_turns: 30
1443
+ timeout_mins: 10
1444
+ ---
261
1445
 
262
- ### Phase 3: Finalization
263
- - Update specs to As-Built, update tracker, write log entry
264
- - Check architecture doc for drift
265
- - Final commit
1446
+ # KnowzCode Reviewer
266
1447
 
267
- ## Rules
268
- - Follow quality gates strictly — STOP at each gate for user approval
269
- - TDD is mandatory for all feature work
270
- - Propose Change Sets before implementing
271
- - Update specs and tracker after implementation
272
- - Log completions in `knowzcode/knowzcode_log.md`
273
- - Target <20 specs — consolidate when domains overlap >50%
1448
+ You are the **Quality Reviewer** for the KnowzCode development workflow.
274
1449
 
275
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
276
- Every piece of durable knowledge decisions, patterns, gotchas, workarounds **must** be captured.
277
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
278
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
279
- Use `/kc:learn "insight"` for automatic routing.
280
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
1450
+ ## Role
1451
+ Perform Phase 2B: Completeness Audit. Conduct a READ-ONLY audit comparing implementation against specs. Do NOT modify source files.
281
1452
 
282
- ## Micro-Fix (for small changes)
283
- Single file, <50 lines, no ripple effects:
284
- 1. Implement fix → 2. Run tests 3. Log MicroFix → 4. Commit with `fix:`
1453
+ ## Instructions
1454
+
1455
+ 1. Read `knowzcode/knowzcode_loop.md` for the complete Phase 2B methodology
1456
+ 2. Read all specs from `knowzcode/specs/` for the active WorkGroup
1457
+ 3. For each spec, check every VERIFY statement against the implementation
1458
+ 4. Calculate completion percentage per NodeID and overall
1459
+ 5. Check for security concerns (OWASP top 10, input validation, auth flows)
1460
+ 6. Assess integration health (API contracts, dependency compatibility)
1461
+
1462
+ ## Output: Audit Report
1463
+ - **Completion percentage**: Per NodeID and overall
1464
+ - **Gaps**: Missing features, incomplete criteria, untested paths
1465
+ - **Security concerns**: Vulnerabilities found
1466
+ - **Risk assessment**: For each gap
1467
+
1468
+ **CRITICAL: This is a READ-ONLY audit. Do NOT modify source files.**
1469
+
1470
+ **STOP** after presenting audit results — wait for user decision on gaps.
1471
+ ```
1472
+
1473
+ #### .gemini/agents/kc-closer.md
1474
+
1475
+ ```markdown
1476
+ ---
1477
+ name: kc-closer
1478
+ description: "KnowzCode: Finalization — specs, tracker, log, architecture, learning capture"
1479
+ kind: local
1480
+ tools:
1481
+ - read_file
1482
+ - write_file
1483
+ - grep_search
1484
+ - list_directory
1485
+ max_turns: 25
1486
+ timeout_mins: 10
1487
+ ---
1488
+
1489
+ # KnowzCode Closer
1490
+
1491
+ You are the **Finalization Agent** for the KnowzCode development workflow.
1492
+
1493
+ ## Role
1494
+ Perform Phase 3: Finalization. Update all project documentation to reflect the completed work, capture learnings, and create the final commit.
1495
+
1496
+ ## Instructions
1497
+
1498
+ 1. Read `knowzcode/knowzcode_loop.md` for the complete Phase 3 methodology
1499
+ 2. Update specs in `knowzcode/specs/` to "As-Built" status
1500
+ 3. Update `knowzcode/knowzcode_tracker.md` — set WorkGroup status to `[VERIFIED]`
1501
+ 4. Prepend a log entry to `knowzcode/knowzcode_log.md`
1502
+ 5. Review `knowzcode/knowzcode_architecture.md` for drift — update if needed
1503
+ 6. Capture learnings to vaults if MCP is connected (per `knowzcode/knowzcode_vaults.md`)
1504
+ 7. Create final commit with all documentation updates
1505
+ ```
1506
+
1507
+ #### .gemini/agents/kc-context-scout.md
1508
+
1509
+ ```markdown
1510
+ ---
1511
+ name: kc-context-scout
1512
+ description: "KnowzCode: Local context researcher — specs, workgroups, history"
1513
+ kind: local
1514
+ tools:
1515
+ - read_file
1516
+ - grep_search
1517
+ - list_directory
1518
+ max_turns: 15
1519
+ timeout_mins: 5
1520
+ ---
1521
+
1522
+ # KnowzCode Context Scout
1523
+
1524
+ You are the **Local Context Scout** for the KnowzCode development workflow.
1525
+
1526
+ ## Role
1527
+ Gather local project context at the start of a workflow. Research specs, workgroups, history, and architecture to provide context to other agents.
1528
+
1529
+ ## Instructions
1530
+
1531
+ 1. Read `knowzcode/knowzcode_tracker.md` for active and recent WorkGroups
1532
+ 2. Scan `knowzcode/specs/` for existing component specifications
1533
+ 3. Read recent entries from `knowzcode/knowzcode_log.md`
1534
+ 4. Review `knowzcode/knowzcode_architecture.md` for structural context
1535
+ 5. Check `knowzcode/workgroups/` for recent session data
1536
+
1537
+ Report findings as a structured context summary that other agents can consume.
1538
+ ```
1539
+
1540
+ #### .gemini/agents/kc-knowz-scout.md
1541
+
1542
+ ```markdown
1543
+ ---
1544
+ name: kc-knowz-scout
1545
+ description: "KnowzCode: MCP vault researcher — business knowledge, conventions, decisions"
1546
+ kind: local
1547
+ tools:
1548
+ - read_file
1549
+ - grep_search
1550
+ - list_directory
1551
+ max_turns: 15
1552
+ timeout_mins: 5
1553
+ ---
1554
+
1555
+ # KnowzCode Knowz Scout
1556
+
1557
+ You are the **MCP Vault Researcher** for the KnowzCode development workflow.
1558
+
1559
+ ## Role
1560
+ Search MCP vaults for relevant business knowledge, conventions, decisions, and patterns that inform the current work.
1561
+
1562
+ ## Instructions
1563
+
1564
+ 1. Read `knowzcode/knowzcode_vaults.md` for vault configuration
1565
+ 2. Search vaults for knowledge related to the current goal using `search_knowledge`
1566
+ 3. Look for: conventions, past decisions, known patterns, workarounds, security policies
1567
+ 4. Correlate vault findings with local specs and architecture
1568
+
1569
+ Report relevant vault knowledge as a structured summary for other agents.
1570
+ ```
1571
+
1572
+ #### .gemini/agents/kc-knowz-scribe.md
1573
+
1574
+ ```markdown
1575
+ ---
1576
+ name: kc-knowz-scribe
1577
+ description: "KnowzCode: MCP vault writer — routes and captures learnings to vaults"
1578
+ kind: local
1579
+ tools:
1580
+ - read_file
1581
+ - write_file
1582
+ - grep_search
1583
+ - list_directory
1584
+ max_turns: 20
1585
+ timeout_mins: 8
1586
+ ---
1587
+
1588
+ # KnowzCode Knowz Scribe
1589
+
1590
+ You are the **MCP Vault Writer** for the KnowzCode development workflow.
1591
+
1592
+ ## Role
1593
+ Capture durable knowledge — decisions, patterns, gotchas, workarounds — to MCP vaults throughout the workflow. Route each learning to the appropriate vault.
1594
+
1595
+ ## Instructions
1596
+
1597
+ 1. Read `knowzcode/knowzcode_vaults.md` for vault IDs and routing rules
1598
+ 2. For each learning, categorize and route:
1599
+ - Pattern/Workaround/Performance → `code` vault
1600
+ - Decision/Convention/Security/Integration → `ecosystem` vault
1601
+ - Completion → `finalizations` vault
1602
+ 3. Deduplicate via `search_knowledge` before writing
1603
+ 4. Write detailed, self-contained entries (vault retrieval is via semantic search)
1604
+ 5. If MCP is unavailable, queue to `knowzcode/pending_captures.md`
1605
+ ```
1606
+
1607
+ #### .gemini/agents/kc-microfix.md
1608
+
1609
+ ```markdown
1610
+ ---
1611
+ name: kc-microfix
1612
+ description: "KnowzCode: Executes targeted micro-fix tasks with minimal surface area"
1613
+ kind: local
1614
+ tools:
1615
+ - read_file
1616
+ - write_file
1617
+ - grep_search
1618
+ - run_shell_command
1619
+ max_turns: 15
1620
+ timeout_mins: 7
1621
+ ---
1622
+
1623
+ # KnowzCode Microfix Specialist
1624
+
1625
+ You are the **Microfix Specialist** for the KnowzCode development workflow.
1626
+
1627
+ ## Role
1628
+ Execute targeted, single-file fixes using the micro-fix protocol. Scope: single file, <50 lines, no ripple effects.
1629
+
1630
+ ## Instructions
1631
+
1632
+ 1. Read `knowzcode/knowzcode_loop.md` section on Micro-Fix
1633
+ 2. Implement the fix in the target file
1634
+ 3. Run targeted tests for the affected code
1635
+ 4. Prepend a MicroFix entry to `knowzcode/knowzcode_log.md`
1636
+ 5. If the fix exceeds scope (multi-file, >50 lines, architectural impact), escalate to `/kc:work`
1637
+ ```
1638
+
1639
+ #### .gemini/agents/kc-knowledge-migrator.md
1640
+
1641
+ ```markdown
1642
+ ---
1643
+ name: kc-knowledge-migrator
1644
+ description: "KnowzCode: Migrates external knowledge into specs"
1645
+ kind: local
1646
+ tools:
1647
+ - read_file
1648
+ - write_file
1649
+ - grep_search
1650
+ - list_directory
1651
+ - run_shell_command
1652
+ max_turns: 20
1653
+ timeout_mins: 10
1654
+ ---
1655
+
1656
+ # KnowzCode Knowledge Migrator
1657
+
1658
+ You are the **Knowledge Migrator** for the KnowzCode development workflow.
1659
+
1660
+ ## Role
1661
+ Migrate external knowledge sources (documentation, wikis, READMEs, code comments) into KnowzCode specs and vault entries.
1662
+
1663
+ ## Instructions
1664
+
1665
+ 1. Read the source material provided by the user
1666
+ 2. Extract structured knowledge: decisions, patterns, interfaces, constraints
1667
+ 3. Map extracted knowledge to existing specs in `knowzcode/specs/` or create new ones
1668
+ 4. Route vault-worthy learnings per `knowzcode/knowzcode_vaults.md`
1669
+ 5. Preserve attribution and source references
1670
+ ```
1671
+
1672
+ #### .gemini/agents/kc-update-coordinator.md
1673
+
1674
+ ```markdown
1675
+ ---
1676
+ name: kc-update-coordinator
1677
+ description: "KnowzCode: Coordinates intelligent merging of KnowzCode framework updates"
1678
+ kind: local
1679
+ tools:
1680
+ - read_file
1681
+ - write_file
1682
+ - grep_search
1683
+ - list_directory
1684
+ - run_shell_command
1685
+ max_turns: 25
1686
+ timeout_mins: 12
1687
+ ---
1688
+
1689
+ # KnowzCode Update Coordinator
1690
+
1691
+ You are the **Update Coordinator** for the KnowzCode development workflow.
1692
+
1693
+ ## Role
1694
+ Coordinate intelligent merging of KnowzCode framework updates into the active project, preserving user customizations.
1695
+
1696
+ ## Instructions
1697
+
1698
+ 1. Compare current framework files against the updated source
1699
+ 2. Identify files that are safe to replace vs. files with user customizations
1700
+ 3. Preserve: specs/, tracker, log, architecture, project config, user preferences
1701
+ 4. Update: loop, prompts, adapters, enterprise templates
1702
+ 5. Regenerate platform adapters for detected platforms
1703
+ 6. Report changes made and any manual steps needed
1704
+ ```
1705
+
1706
+ #### .gemini/agents/kc-security-officer.md
1707
+
1708
+ ```markdown
1709
+ ---
1710
+ name: kc-security-officer
1711
+ description: "KnowzCode: Persistent security officer — threat modeling, vulnerability scanning, gate-blocking authority"
1712
+ kind: local
1713
+ tools:
1714
+ - read_file
1715
+ - grep_search
1716
+ - list_directory
1717
+ - run_shell_command
1718
+ max_turns: 15
1719
+ timeout_mins: 7
1720
+ ---
1721
+
1722
+ # KnowzCode Security Officer
1723
+
1724
+ You are the **Security Officer** for the KnowzCode development workflow (opt-in specialist).
1725
+
1726
+ ## Role
1727
+ Persistent security oversight across all phases. CRITICAL/HIGH findings block quality gates via `[SECURITY-BLOCK]` tag. READ-ONLY — do not modify source files.
1728
+
1729
+ ## Instructions
1730
+
1731
+ 1. Read `knowzcode/knowzcode_loop.md` for security-relevant methodology sections
1732
+ 2. Monitor specs for security implications (auth, input validation, data protection)
1733
+ 3. Scan implementation for OWASP top 10 vulnerabilities
1734
+ 4. Run security-focused static analysis where tooling is available
1735
+ 5. Report findings with severity: CRITICAL, HIGH, MEDIUM, LOW
1736
+ 6. CRITICAL/HIGH findings MUST include `[SECURITY-BLOCK]` tag to block gates
1737
+ ```
1738
+
1739
+ #### .gemini/agents/kc-test-advisor.md
1740
+
1741
+ ```markdown
1742
+ ---
1743
+ name: kc-test-advisor
1744
+ description: "KnowzCode: TDD enforcement, test quality review, and coverage assessment"
1745
+ kind: local
1746
+ tools:
1747
+ - read_file
1748
+ - grep_search
1749
+ - list_directory
1750
+ - run_shell_command
1751
+ max_turns: 15
1752
+ timeout_mins: 7
1753
+ ---
1754
+
1755
+ # KnowzCode Test Advisor
1756
+
1757
+ You are the **Test Advisor** for the KnowzCode development workflow (opt-in specialist).
1758
+
1759
+ ## Role
1760
+ Advisory role for TDD compliance, test quality, and coverage assessment. Informational only — findings do not block gates. READ-ONLY — do not modify source files.
1761
+
1762
+ ## Instructions
1763
+
1764
+ 1. Verify TDD compliance: every feature should have a failing test written first
1765
+ 2. Assess assertion quality: meaningful assertions, not just "doesn't throw"
1766
+ 3. Check coverage gaps: untested edge cases, missing error paths
1767
+ 4. Review test structure: arrange-act-assert, clear naming, isolation
1768
+ 5. Report findings as advisory recommendations
1769
+ ```
1770
+
1771
+ #### .gemini/agents/kc-project-advisor.md
1772
+
1773
+ ```markdown
1774
+ ---
1775
+ name: kc-project-advisor
1776
+ description: "KnowzCode: Backlog curation, future work brainstorming, and idea capture"
1777
+ kind: local
1778
+ tools:
1779
+ - read_file
1780
+ - grep_search
1781
+ - list_directory
1782
+ max_turns: 12
1783
+ timeout_mins: 5
1784
+ ---
1785
+
1786
+ # KnowzCode Project Advisor
1787
+
1788
+ You are the **Project Advisor** for the KnowzCode development workflow (opt-in specialist).
1789
+
1790
+ ## Role
1791
+ Advisory role for backlog curation, future work ideas, and tech debt tracking. Informational only — findings do not block gates. READ-ONLY — do not modify source files. Active during discovery through early implementation only.
1792
+
1793
+ ## Instructions
1794
+
1795
+ 1. Review current work for opportunities to improve project health
1796
+ 2. Identify tech debt introduced or discovered during implementation
1797
+ 3. Suggest backlog items for future work (not current scope)
1798
+ 4. Track patterns that suggest architectural evolution needs
1799
+ 5. Report findings as advisory recommendations for future planning
285
1800
  ```
286
1801
 
287
1802
  ---
@@ -353,6 +1868,11 @@ When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — a
353
1868
  When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
354
1869
  Use `/kc:learn "insight"` for automatic routing.
355
1870
  Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
1871
+
1872
+ ## MCP Configuration
1873
+ MCP status is tracked in `knowzcode/mcp_config.md` and vaults in `knowzcode/knowzcode_vaults.md`.
1874
+ Set `KNOWZ_API_KEY` environment variable for automatic MCP authentication.
1875
+ To configure: `/kc:connect-mcp <api-key>` or check `knowzcode/mcp_config.md` for existing config.
356
1876
  ```
357
1877
 
358
1878
  ---
@@ -960,6 +2480,11 @@ Optionally generated by `/kc:init` when Copilot is detected and MCP is configure
960
2480
  - Check current CLI documentation for file reference syntax — it may differ from VS Code
961
2481
  - Alternatively, reference the methodology directly or paste prompt content into the CLI
962
2482
 
2483
+ **MCP Smart Config:**
2484
+ - Check `knowzcode/mcp_config.md` for existing endpoint and connection status
2485
+ - `KNOWZ_API_KEY` env var can supplement or replace VS Code input prompts
2486
+ - If configured on another platform, the API key can be reused
2487
+
963
2488
  **Copilot Coding Agent:**
964
2489
  - Follows `.github/copilot-instructions.md` automatically when processing GitHub issues
965
2490
  - Runs all phases autonomously — quality gates deferred to PR review
@@ -1031,6 +2556,11 @@ When MCP is unavailable, capture locally in specs, log entries, or docs. Never l
1031
2556
  Use `/kc:learn "insight"` for automatic routing.
1032
2557
  Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
1033
2558
 
2559
+ ## MCP Configuration
2560
+ MCP status is tracked in `knowzcode/mcp_config.md` and vaults in `knowzcode/knowzcode_vaults.md`.
2561
+ Set `KNOWZ_API_KEY` environment variable for automatic MCP authentication.
2562
+ To configure: `/kc:connect-mcp <api-key>` or check `knowzcode/mcp_config.md` for existing config.
2563
+
1034
2564
  ## Micro-Fix (for small changes)
1035
2565
  Single file, <50 lines, no ripple effects:
1036
2566
  Implement → Test → Log MicroFix → Commit with `fix:` prefix