knowzcode 0.4.0 → 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.
Files changed (79) hide show
  1. package/.claude-plugin/marketplace.json +61 -61
  2. package/.claude-plugin/plugin.json +8 -8
  3. package/LICENSE +121 -121
  4. package/README.md +379 -354
  5. package/agents/analyst.md +114 -114
  6. package/agents/architect.md +200 -200
  7. package/agents/builder.md +104 -104
  8. package/agents/closer.md +177 -177
  9. package/agents/context-scout.md +54 -54
  10. package/agents/knowledge-migrator.md +349 -349
  11. package/agents/knowz-scout.md +83 -83
  12. package/agents/knowz-scribe.md +180 -180
  13. package/agents/microfix-specialist.md +135 -135
  14. package/agents/project-advisor.md +111 -111
  15. package/agents/reviewer.md +172 -172
  16. package/agents/security-officer.md +194 -194
  17. package/agents/test-advisor.md +162 -162
  18. package/agents/update-coordinator.md +394 -394
  19. package/bin/knowzcode.mjs +1457 -1199
  20. package/commands/audit.md +328 -328
  21. package/commands/connect-mcp.md +574 -549
  22. package/commands/fix.md +107 -107
  23. package/commands/init.md +616 -500
  24. package/commands/learn.md +332 -332
  25. package/commands/plan.md +272 -272
  26. package/commands/register.md +757 -733
  27. package/commands/status.md +338 -309
  28. package/commands/telemetry-setup.md +368 -368
  29. package/commands/telemetry.md +188 -188
  30. package/commands/work.md +1204 -1204
  31. package/knowzcode/automation_manifest.md +59 -59
  32. package/knowzcode/claude_code_execution.md +431 -431
  33. package/knowzcode/copilot_execution.md +231 -231
  34. package/knowzcode/enterprise/compliance_manifest.md +137 -137
  35. package/knowzcode/enterprise/compliance_status.md +30 -30
  36. package/knowzcode/enterprise/guidelines/code-quality.md +67 -67
  37. package/knowzcode/enterprise/guidelines/security.md +355 -355
  38. package/knowzcode/enterprise/templates/guideline-template.md +55 -55
  39. package/knowzcode/gitignore.template +13 -13
  40. package/knowzcode/knowzcode_architecture.md +51 -51
  41. package/knowzcode/knowzcode_log.md +142 -142
  42. package/knowzcode/knowzcode_loop.md +601 -596
  43. package/knowzcode/knowzcode_orchestration.md +66 -66
  44. package/knowzcode/knowzcode_project.md +48 -48
  45. package/knowzcode/knowzcode_tracker.md +40 -40
  46. package/knowzcode/knowzcode_vaults.md +257 -257
  47. package/knowzcode/mcp_config.md +196 -191
  48. package/knowzcode/planning/Readme.md +6 -6
  49. package/knowzcode/platform_adapters.md +2577 -1260
  50. package/knowzcode/prompts/Execute_Micro_Fix.md +57 -57
  51. package/knowzcode/prompts/Investigate_Codebase.md +227 -227
  52. package/knowzcode/prompts/Migrate_Knowledge.md +301 -301
  53. package/knowzcode/prompts/Refactor_Node.md +72 -72
  54. package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -59
  55. package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -52
  56. package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -75
  57. package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -55
  58. package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -72
  59. package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -67
  60. package/knowzcode/specs/Readme.md +10 -10
  61. package/knowzcode/telemetry_config.md +89 -89
  62. package/knowzcode/user_preferences.md +120 -120
  63. package/package.json +53 -53
  64. package/skills/alias-resolver.json +15 -15
  65. package/skills/architecture-diff.json +12 -12
  66. package/skills/check-installation-status.json +14 -14
  67. package/skills/continue.md +126 -126
  68. package/skills/environment-guard.json +12 -12
  69. package/skills/generate-workgroup-id.json +25 -25
  70. package/skills/install-knowzcode.json +21 -21
  71. package/skills/load-core-context.json +18 -18
  72. package/skills/log-entry-builder.json +15 -15
  73. package/skills/spec-quality-check.json +14 -14
  74. package/skills/spec-template.json +15 -15
  75. package/skills/spec-validator.json +25 -25
  76. package/skills/start-work.md +224 -224
  77. package/skills/tracker-scan.json +12 -12
  78. package/skills/tracker-update.json +28 -28
  79. package/skills/validate-installation.json +14 -14
@@ -1,1260 +1,2577 @@
1
- # KnowzCode Platform Adapters
2
-
3
- This file contains adapter templates for integrating KnowzCode with different AI coding platforms. Each adapter teaches the platform's AI how to follow the KnowzCode methodology with full phase walkthroughs, quality gates, and TDD enforcement.
4
-
5
- Generated by `/kc:init`. Adapters should be placed in the project root (or platform-specific location).
6
-
7
- ---
8
-
9
- ## Claude Code (CLAUDE.md section)
10
-
11
- Append to or create `CLAUDE.md` in project root:
12
-
13
- ```markdown
14
- # KnowzCode Integration
15
-
16
- This project uses KnowzCode for structured TDD development with multi-agent orchestration.
17
-
18
- ## Required Reading
19
- - `knowzcode/knowzcode_loop.md` — Development methodology (TDD, quality gates, phases)
20
- - `knowzcode/knowzcode_project.md` — Project context and tech stack
21
- - `knowzcode/knowzcode_tracker.md` — Current WorkGroup status
22
- - `knowzcode/knowzcode_architecture.md` — Architecture documentation
23
-
24
- ## Workflow Phases
25
- Follow the phases in `knowzcode_loop.md` for all feature work:
26
- 1. **Phase 1A: Impact Analysis** — Identify affected components, propose Change Set. PAUSE for user approval.
27
- 2. **Phase 1B: Specification** — Draft specs for all NodeIDs. PAUSE for user approval. Commit specs.
28
- 3. **Phase 2A: Implementation** — Strict TDD (Red-Green-Refactor). No production code without a failing test.
29
- 4. **Phase 2B: Completeness Audit** — Independent READ-ONLY audit. PAUSE for user decision on gaps.
30
- 5. **Phase 3: Finalization** — Update specs to as-built, update tracker, log entry, final commit.
31
-
32
- ## Quality Gates
33
- Never skip phases. PAUSE for user approval at each gate:
34
- - After Change Set proposal (1A)
35
- - After spec drafts (1B)
36
- - After implementation (2A — awaiting audit)
37
- - After audit results (2B — user decides on gaps)
38
-
39
- ## TDD Enforcement
40
- TDD is mandatory — no production code without a failing test first.
41
- Red-Green-Refactor cycle for every feature/criterion in the spec.
42
-
43
- ## Agents
44
- Specialized agents handle each phase when using Agent Teams or subagent execution:
45
- - `analyst` (1A), `architect` (1B), `builder` (2A), `reviewer` (2B), `closer` (3)
46
- - Agent Teams is the preferred execution model when enabled (experimental, requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` env var)
47
- - Subagent fallback for environments without Agent Teams
48
-
49
- ## Commands
50
- - `/kc:work "goal"` — Start feature workflow
51
- - `/kc:plan "topic"` — Research before implementing
52
- - `/kc:audit [type]` — Run quality audits (spec, architecture, security, integration)
53
- - `/kc:fix "target" "summary"` — Quick targeted fix
54
- - `/kc:learn "insight"` — Capture learning to vault
55
- - `/kc:status` — Check MCP connection and vault status
56
-
57
- ## MCP Integration
58
- If configured, agents use `search_knowledge`, `ask_question`, and `create_knowledge` for enhanced context.
59
- All commands work without MCP — it enhances but never blocks.
60
-
61
- ### Knowledge Capture (CRITICAL — DO NOT SKIP)
62
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds, convention changes —
63
- **must** be captured. Knowledge lives in two places:
64
-
65
- - **MCP vaults** (when connected): `knowzcode/knowzcode_vaults.md` defines vault IDs, routing rules,
66
- and write conditions. Always pass `vaultId` when calling `create_knowledge` — omitting it saves
67
- to the tenant default vault, NOT the project vault.
68
- - **Local files** (always available): specs, workgroup files, log entries, architecture docs, and
69
- `knowzcode/pending_captures.md` (scribe fallback queue when MCP is unavailable).
70
-
71
- If MCP is not connected, knowledge still gets captured locally. Never let insights die in the conversation.
72
-
73
- **Vault content detail**: Vault entries are retrieved via semantic search, not read directly like local files. Write detailed, self-contained entries with full reasoning, specific technology names, code examples, and file paths. Terse entries produce poor search results. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
74
-
75
- ### Knowz-Scribe Delegation
76
- When knowz-scribe is active (Agent Teams mode), it owns all vault writes — do NOT call `create_knowledge` directly. Send knowledge to the scribe instead:
77
-
78
- - **Phase captures**: Handled automatically at quality gates via task-tracked DMs
79
- - **Explicit**: `"Log: {description}"` — scribe MUST write it; it decides routing (which vault or local file)
80
- - **Soft**: `"Consider: {description}"` — scribe evaluates whether to capture and where; may skip if not insight-worthy or duplicative
81
-
82
- Any agent can send ad-hoc knowledge to the scribe at any time. The scribe handles routing, dedup, and formatting. If MCP is unavailable, the scribe queues captures to `knowzcode/pending_captures.md` for later sync. When no scribe is active, use `/kc:learn "insight"` for automatic routing.
83
-
84
- ## WorkGroup Files
85
- - Created in `knowzcode/workgroups/` (gitignored)
86
- - Every todo must start with `KnowzCode:` prefix
87
- - Track phase history, Change Set, and outstanding work
88
- ```
89
-
90
- ---
91
-
92
- ## OpenAI Codex (AGENTS.md)
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.
95
-
96
- ```markdown
97
- # KnowzCode Development Methodology
98
-
99
- This project uses KnowzCode for structured TDD development.
100
- Read `knowzcode/knowzcode_loop.md` before starting any feature work.
101
-
102
- ## Phase Walkthrough
103
-
104
- ### Before Starting
105
- 1. Read `knowzcode/knowzcode_tracker.md` — check for active WorkGroups
106
- 2. Read `knowzcode/knowzcode_project.md` — understand project context
107
- 3. Read `knowzcode/knowzcode_architecture.md` — understand current architecture
108
-
109
- ### Phase 1A: Impact Analysis
110
- - Analyze what needs to change for the given goal
111
- - Create NodeIDs for NEW capabilities only (not per-file)
112
- - Check `knowzcode/specs/` for existing specs in the same domain
113
- - Propose a Change Set with NodeIDs, affected files, and risk assessment
114
- - **STOP**: Present Change Set for user approval before continuing
115
-
116
- ### Phase 1B: Specification
117
- - Draft specs for each NodeID using the 4-section format:
118
- - Rules & Decisions, Interfaces, Verification Criteria, Debt & Gaps
119
- - Minimum: 1+ Rules, 1+ Interface, 2+ VERIFY statements per spec
120
- - Save to `knowzcode/specs/{NodeID}.md`
121
- - **STOP**: Present specs for user approval
122
- - After approval: `git commit` the specs as a checkpoint
123
-
124
- ### Phase 2A: Implementation (TDD MANDATORY)
125
- - For EACH feature/criterion in the spec:
126
- 1. RED: Write a failing test first
127
- 2. GREEN: Write minimal code to make the test pass
128
- 3. REFACTOR: Clean up while keeping tests green
129
- - Run full test suite + static analysis + build after all features
130
- - Maximum 10 verification iterations before pausing
131
- - **STOP**: Report implementation results
132
-
133
- ### Phase 2B: Completeness Audit
134
- - READ-ONLY audit — do NOT modify source files
135
- - Compare implementation against all VERIFY statements in specs
136
- - Calculate completion percentage
137
- - Report gaps, security concerns, integration issues
138
- - **STOP**: Present audit results for user decision
139
-
140
- ### Phase 3: Finalization
141
- - Update specs to "As-Built" status
142
- - Check architecture doc for drift
143
- - Prepend log entry to `knowzcode/knowzcode_log.md`
144
- - Update tracker statuses to `[VERIFIED]`
145
- - Create final commit with all changes
146
-
147
- ## Key Rules
148
- - Always propose a Change Set before implementing
149
- - Get user approval at every quality gate (STOP points above)
150
- - TDD is mandatory — no production code without failing tests
151
- - Log all completions in `knowzcode/knowzcode_log.md`
152
- - Track work in `knowzcode/knowzcode_tracker.md`
153
- - Every WorkGroup todo must start with `KnowzCode:` prefix
154
- - Target <20 specs per project — consolidate when domains overlap
155
-
156
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
157
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
158
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
159
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
160
- Use `/kc:learn "insight"` for automatic routing.
161
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
162
-
163
- ## Quick Fix (Micro-Fix)
164
- For single-file, <50 line, no-ripple-effect changes:
165
- 1. Implement the fix
166
- 2. Run targeted tests
167
- 3. Log a MicroFix entry
168
- 4. Commit with `fix:` prefix
169
-
170
- ## Key Files
171
- - `knowzcode/knowzcode_loop.md` — Complete methodology
172
- - `knowzcode/knowzcode_project.md` — Project context
173
- - `knowzcode/knowzcode_architecture.md` — Architecture docs
174
- - `knowzcode/knowzcode_tracker.md` — WorkGroup tracking
175
- - `knowzcode/specs/` — Component specifications
176
- - `knowzcode/workgroups/` — Active session data (gitignored)
177
- ```
178
-
179
- ### Codex Skill Files (`.codex/skills/kc/`)
180
-
181
- Codex (2026) supports `SKILL.md` files for discoverable skills. Place in `.codex/skills/kc/` for automatic `/kc:` command namespacing in the Codex UI.
182
-
183
- #### .codex/skills/kc/work.md
184
-
185
- ```markdown
186
- <!-- Generated by KnowzCode vX.Y.Z -->
187
-
188
- # /kc:work Start KnowzCode Workflow
189
-
190
- Start a structured KnowzCode development workflow for the given goal.
191
-
192
- ## Instructions
193
-
194
- Read these files for methodology and project context:
195
- - `knowzcode/knowzcode_loop.md` — Complete methodology
196
- - `knowzcode/knowzcode_project.md` — Project context
197
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
198
- - `knowzcode/knowzcode_architecture.md` Architecture docs
199
-
200
- ### Step 1: Classify Tier
201
- - **Micro** (single file, <50 lines): Use `/kc:fix` instead
202
- - **Light** (≤3 files): Streamlined 2-phase path
203
- - **Full** (>3 files or complex): Complete 5-phase workflow
204
-
205
- ### Step 2: Create WorkGroup
206
- Generate WorkGroupID: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
207
- Create `knowzcode/workgroups/{WorkGroupID}.md`
208
-
209
- ### Step 3: Phase 1A — Impact Analysis
210
- 1. Identify affected components
211
- 2. Create NodeIDs for new capabilities (PascalCase)
212
- 3. Check `knowzcode/specs/` for existing domain overlap
213
- 4. Propose Change Set with NodeIDs, affected files, risk assessment
214
-
215
- **STOP** Present Change Set for user approval before continuing.
216
-
217
- After approval, continue through Phase 1B (Specification) → Phase 2A (TDD Implementation) → Phase 2B (Audit) → Phase 3 (Finalization), stopping at each quality gate.
218
- ```
219
-
220
- #### .codex/skills/kc/plan.md
221
-
222
- ```markdown
223
- <!-- Generated by KnowzCode vX.Y.Z -->
224
-
225
- # /kc:plan — Research Before Implementing
226
-
227
- Investigate a topic in the codebase before implementing changes.
228
-
229
- ## Instructions
230
-
231
- Read these files for context:
232
- - `knowzcode/knowzcode_loop.md` — Methodology
233
- - `knowzcode/knowzcode_project.md`Project context
234
- - `knowzcode/knowzcode_architecture.md` — Architecture docs
235
-
236
- 1. Explore the codebase for relevant files, patterns, and implementations
237
- 2. Check `knowzcode/specs/` for related component specs
238
- 3. Scan `knowzcode/workgroups/` for past WorkGroups in similar areas
239
- 4. Review `knowzcode/knowzcode_architecture.md` for structural context
240
- 5. Present findings with current state, patterns, options, and recommended approach
241
-
242
- **STOP** — Present research findings. To implement, use `/kc:work` with the chosen approach.
243
- ```
244
-
245
- #### .codex/skills/kc/fix.md
246
-
247
- ```markdown
248
- <!-- Generated by KnowzCode vX.Y.Z -->
249
-
250
- # /kc:fix Quick Targeted Fix
251
-
252
- Apply a targeted fix using the micro-fix protocol.
253
-
254
- ## Scope Guard
255
-
256
- This workflow is for changes that are:
257
- - Single file (or minimal multi-file with no ripple effects)
258
- - <50 lines changed
259
- - No architectural impact
260
-
261
- If the fix exceeds this scope, suggest `/kc:work` instead.
262
-
263
- ## Instructions
264
-
265
- Read `knowzcode/knowzcode_loop.md` section on Micro-Fix.
266
-
267
- 1. Implement the fix
268
- 2. Run targeted tests for the affected code
269
- 3. Prepend a MicroFix entry to `knowzcode/knowzcode_log.md`
270
- 4. Commit with `fix: {description}` message
271
- ```
272
-
273
- #### .codex/skills/kc/audit.md
274
-
275
- ```markdown
276
- <!-- Generated by KnowzCode vX.Y.Z -->
277
-
278
- # /kc:audit — Quality Audit
279
-
280
- Perform a READ-ONLY audit comparing implementation against specs.
281
-
282
- ## Instructions
283
-
284
- Read these files:
285
- - `knowzcode/knowzcode_loop.md` — Phase 2B methodology
286
- - `knowzcode/knowzcode_tracker.md` — Find active WorkGroups
287
-
288
- **CRITICAL: This is a READ-ONLY audit. Do NOT modify source files.**
289
-
290
- 1. Compare implementation against all VERIFY statements in specs from `knowzcode/specs/`
291
- 2. Calculate completion percentage per NodeID and overall
292
- 3. Identify gaps: missing features, incomplete criteria, untested paths
293
- 4. Check for security concerns
294
- 5. Assess risk for any gaps found
295
-
296
- ### Standalone Audit Types
297
- - **spec**: Audit spec quality and VERIFY statement coverage
298
- - **architecture**: Compare architecture doc against codebase
299
- - **security**: OWASP top 10, input validation, auth flows
300
- - **integration**: API contracts, dependency health
301
-
302
- **STOP**Present audit results with completion percentage and gap list.
303
- ```
304
-
305
- #### .codex/skills/kc/learn.md
306
-
307
- ```markdown
308
- <!-- Generated by KnowzCode vX.Y.Z -->
309
-
310
- # /kc:learn Capture Learning
311
-
312
- Capture a learning, decision, or pattern to the KnowzCode knowledge vault.
313
-
314
- ## Instructions
315
-
316
- Read `knowzcode/knowzcode_vaults.md` for vault configuration and routing rules.
317
-
318
- 1. Analyze the learning provided
319
- 2. Categorize: Pattern, Workaround, Decision, Convention, Security, Integration, Performance, Completion
320
- 3. Route to the appropriate vault:
321
- - Pattern/Workaround/Performance → `code` vault
322
- - Decision/Convention/Security/Integration → `ecosystem` vault
323
- - Completion → `finalizations` vault
324
- 4. If MCP is connected: call `create_knowledge` with appropriate `vaultId`
325
- 5. If MCP is unavailable: append to `knowzcode/pending_captures.md`
326
-
327
- Write detailed, self-contained entries — vault entries are retrieved via semantic search.
328
- ```
329
-
330
- #### .codex/skills/kc/continue.md
331
-
332
- ```markdown
333
- <!-- Generated by KnowzCode vX.Y.Z -->
334
-
335
- # /kc:continue — Resume Workflow
336
-
337
- Resume an interrupted KnowzCode workflow or advance to the next phase.
338
-
339
- ## Instructions
340
-
341
- Read `knowzcode/knowzcode_tracker.md` to find active `[WIP]` WorkGroups.
342
-
343
- ### Step 1: Find Active WorkGroup
344
- - One active: use it
345
- - Multiple active: ask user which to resume
346
- - None active: suggest `/kc:work`
347
-
348
- ### Step 2: Determine Current Phase
349
- Read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
350
- Check the Phase History table to determine current state.
351
-
352
- ### Step 3: Resume
353
-
354
- | State | Action |
355
- |-------|--------|
356
- | 1A in progress | Complete impact analysis |
357
- | 1A approved, specs not started | Begin Phase 1B |
358
- | 1B approved, not implemented | Begin Phase 2A |
359
- | 2A complete | Run Phase 2B audit |
360
- | 2B complete, gaps found | Present fix/accept options |
361
- | 2B complete, no gaps | Begin Phase 3 |
362
-
363
- Resume from the appropriate phase following `knowzcode/knowzcode_loop.md`.
364
- ```
365
-
366
- ---
367
-
368
- ## Google Gemini CLI (GEMINI.md)
369
-
370
- 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`.
371
-
372
- ### Native Commands (`.gemini/commands/kc/*.toml`)
373
-
374
- Gemini CLI (2026) supports native custom commands via TOML files in `.gemini/commands/`. Subdirectory namespacing gives the `/kc:` prefix automatically:
375
-
376
- ```toml
377
- # .gemini/commands/kc/work.toml
378
- description = "Start a new KnowzCode development workflow"
379
- prompt = """Read knowzcode/knowzcode_loop.md. Follow Phase 1A→3 workflow for:
380
- <ARGS/>
381
- Read knowzcode/knowzcode_project.md for project context.
382
- Read knowzcode/knowzcode_tracker.md for active work."""
383
- ```
384
-
385
- ```toml
386
- # .gemini/commands/kc/plan.toml
387
- description = "Research before implementing"
388
- prompt = """Read knowzcode/knowzcode_loop.md and knowzcode/knowzcode_project.md.
389
- Investigate the codebase for: <ARGS/>
390
- Present findings with options. Say 'implement' to transition to /kc:work."""
391
- ```
392
-
393
- ```toml
394
- # .gemini/commands/kc/fix.toml
395
- description = "Quick targeted fix (micro-fix workflow)"
396
- prompt = """Read knowzcode/knowzcode_loop.md section on Micro-Fix.
397
- Apply a targeted fix for: <ARGS/>
398
- Run tests, log a MicroFix entry, commit with fix: prefix."""
399
- ```
400
-
401
- ```toml
402
- # .gemini/commands/kc/audit.toml
403
- description = "Run quality audit against specs"
404
- prompt = """Read knowzcode/knowzcode_loop.md Phase 2B.
405
- Perform a READ-ONLY audit comparing implementation against specs in knowzcode/specs/.
406
- Report completion percentage, gaps, and security concerns for: <ARGS/>"""
407
- ```
408
-
409
- ```toml
410
- # .gemini/commands/kc/learn.toml
411
- description = "Capture a learning to KnowzCode vault"
412
- prompt = """Read knowzcode/knowzcode_loop.md section on Knowledge Capture.
413
- Capture the following learning: <ARGS/>
414
- Route to the appropriate vault per knowzcode/knowzcode_vaults.md.
415
- If MCP is unavailable, save to knowzcode/pending_captures.md."""
416
- ```
417
-
418
- ```toml
419
- # .gemini/commands/kc/status.toml
420
- description = "Check KnowzCode MCP connection and vault status"
421
- prompt = """Check the MCP connection status by calling list_vaults.
422
- Report which vaults are configured in knowzcode/knowzcode_vaults.md.
423
- Show active WorkGroups from knowzcode/knowzcode_tracker.md."""
424
- ```
425
-
426
- ```toml
427
- # .gemini/commands/kc/continue.toml
428
- description = "Resume interrupted KnowzCode workflow"
429
- prompt = """Read knowzcode/knowzcode_tracker.md to find active [WIP] WorkGroups.
430
- Read the most recent WorkGroup file from knowzcode/workgroups/.
431
- Determine the current phase from the Phase History table.
432
- Resume from where the workflow left off, following knowzcode/knowzcode_loop.md."""
433
- ```
434
-
435
- Gemini also supports extensions (`gemini-extension.json`) for tool integration and `@file.md` imports for including methodology files directly in prompts.
436
-
437
- ```markdown
438
- # KnowzCode Development Methodology
439
-
440
- This project uses KnowzCode for structured TDD development.
441
-
442
- ## Required Reading
443
- Read these files before starting any feature work (use @import syntax for direct inclusion):
444
- - `knowzcode/knowzcode_loop.md` — Complete workflow methodology
445
- - `knowzcode/knowzcode_project.md` — Project context and tech stack
446
- - `knowzcode/knowzcode_architecture.md` — Architecture documentation
447
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
448
-
449
- ## Phase Walkthrough
450
-
451
- ### Phase 1A: Impact Analysis
452
- - Identify components affected by the goal
453
- - Create NodeIDs for new capabilities (PascalCase domain concepts)
454
- - Check existing specs for domain overlap before creating new ones
455
- - Present Change Set for user approval STOP until approved
456
-
457
- ### Phase 1B: Specification
458
- - Draft specs using 4-section format (Rules, Interfaces, Verification Criteria, Debt)
459
- - Each spec needs 2+ VERIFY statements
460
- - Present for approval — STOP until approved
461
- - Commit specs as a pre-implementation checkpoint
462
-
463
- ### Phase 2A: Implementation (TDD Required)
464
- - Follow Red-Green-Refactor for every feature
465
- - Write failing test FIRST, then minimal code to pass, then refactor
466
- - Run full test suite + linter + build when all features done
467
- - STOP and report results
468
-
469
- ### Phase 2B: Completeness Audit
470
- - READ-ONLY comparison of implementation vs specs
471
- - Calculate completion percentage
472
- - Report gaps and security concerns
473
- - STOP for user decision
474
-
475
- ### Phase 3: Finalization
476
- - Update specs to As-Built, update tracker, write log entry
477
- - Check architecture doc for drift
478
- - Final commit
479
-
480
- ## Rules
481
- - Follow quality gates strictly STOP at each gate for user approval
482
- - TDD is mandatory for all feature work
483
- - Propose Change Sets before implementing
484
- - Update specs and tracker after implementation
485
- - Log completions in `knowzcode/knowzcode_log.md`
486
- - Target <20 specs — consolidate when domains overlap >50%
487
-
488
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
489
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
490
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
491
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
492
- Use `/kc:learn "insight"` for automatic routing.
493
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
494
-
495
- ## Micro-Fix (for small changes)
496
- Single file, <50 lines, no ripple effects:
497
- 1. Implement fix 2. Run tests 3. Log MicroFix → 4. Commit with `fix:`
498
- ```
499
-
500
- ---
501
-
502
- ## Cursor (`.cursor/rules/knowzcode.mdc`)
503
-
504
- Create `.cursor/rules/knowzcode.mdc` with YAML frontmatter. Notes: Modern Cursor uses `.cursor/rules/*.mdc` files instead of the deprecated `.cursorrules`. Scoped rules can target specific file patterns using the `globs` frontmatter field. Cursor 1.6+ (2026) also supports `.cursor/commands/*.md` for custom slash commands (beta) and reads `AGENTS.md` for agent instructions.
505
-
506
- ```markdown
507
- ---
508
- description: KnowzCode TDD development methodology
509
- alwaysApply: true
510
- ---
511
-
512
- # KnowzCode Rules
513
-
514
- This project uses KnowzCode for structured TDD development.
515
-
516
- ## Required Reading
517
- Before any feature work, read:
518
- - `knowzcode/knowzcode_loop.md` — Complete methodology
519
- - `knowzcode/knowzcode_project.md` — Project context
520
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
521
- - `knowzcode/knowzcode_architecture.md` — Architecture docs
522
-
523
- ## Phase Rules
524
-
525
- ### Phase 1A: Impact Analysis
526
- - Identify affected components and propose a Change Set
527
- - NodeIDs are domain concepts (PascalCase), not tasks
528
- - Check `knowzcode/specs/` before creating new specs
529
- - PAUSE for user approval before proceeding
530
-
531
- ### Phase 1B: Specification
532
- - Use 4-section format: Rules & Decisions, Interfaces, Verification Criteria, Debt & Gaps
533
- - Minimum: 2+ VERIFY statements per spec
534
- - PAUSE for user approval, then commit specs
535
-
536
- ### Phase 2A: Implementation
537
- - TDD is mandatory: write failing test FIRST, then minimal code, then refactor
538
- - Use Composer for multi-file edits when implementing across components
539
- - Run full test suite before reporting complete
540
- - PAUSE after implementation
541
-
542
- ### Phase 2B: Audit
543
- - READ-ONLY — do not modify source files
544
- - Compare implementation vs spec VERIFY statements
545
- - Report completion percentage and gaps
546
- - PAUSE for user decision
547
-
548
- ### Phase 3: Finalization
549
- - Update specs to As-Built status
550
- - Update tracker and log
551
- - Check architecture for drift
552
- - Final commit
553
-
554
- ## Enforcement
555
- - Never skip phases or quality gates
556
- - TDD is mandatory no production code without a failing test
557
- - Every WorkGroup todo starts with `KnowzCode:` prefix
558
- - Consolidate specs when domains overlap >50%
559
- - Target <20 specs per project
560
- - Read `knowzcode/knowzcode_tracker.md` for active work
561
- - Log completions in `knowzcode/knowzcode_log.md`
562
-
563
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
564
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
565
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
566
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
567
- Use `/kc:learn "insight"` for automatic routing.
568
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
569
- ```
570
-
571
- ---
572
-
573
- ## GitHub Copilot (.github/copilot-instructions.md + .github/prompts/*.prompt.md)
574
-
575
- GitHub Copilot (2026) supports three instruction mechanisms used by KnowzCode:
576
-
577
- 1. **`.github/copilot-instructions.md`** — Repository-level instructions, always active
578
- 2. **`.github/prompts/*.prompt.md`** — Custom prompts invocable via `#prompt:name` in VS Code
579
- 3. **MCP server tools** (`.vscode/mcp.json`) — Tool access for vault queries
580
-
581
- Copilot operates as a **single-agent, sequential** platform no multi-agent orchestration. Users manually transition between phases using prompt files. See `knowzcode/copilot_execution.md` for the full execution model.
582
-
583
- ### A. copilot-instructions.md
584
-
585
- Create `.github/copilot-instructions.md`:
586
-
587
- ```markdown
588
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
589
-
590
- # KnowzCode Development Methodology
591
-
592
- This repository uses KnowzCode for structured TDD development with quality gates.
593
-
594
- ## Required Reading
595
- - `knowzcode/knowzcode_loop.md` Complete methodology (read first)
596
- - `knowzcode/knowzcode_project.md` Project context and tech stack
597
- - `knowzcode/knowzcode_architecture.md` Architecture documentation
598
- - `knowzcode/knowzcode_tracker.md` WorkGroup status tracking
599
-
600
- ## Workflow Overview
601
-
602
- KnowzCode follows a 5-phase development loop with quality gates between each phase.
603
- Use the prompt files in `.github/prompts/` to invoke each phase:
604
-
605
- | Phase | Prompt | Description |
606
- |-------|--------|-------------|
607
- | Full workflow | `#prompt:kc-work` | Start a new feature — creates WorkGroup, classifies tier, runs Phase 1A |
608
- | 1A: Analysis | `#prompt:kc-analyze` | Re-run impact analysis on existing WorkGroup |
609
- | 1B: Specification | `#prompt:kc-specify` | Draft specs from approved Change Set |
610
- | 2A: Implementation | `#prompt:kc-implement` | TDD implementation with verification loop |
611
- | 2B: Audit | `#prompt:kc-audit` | READ-ONLY audit against specs |
612
- | 3: Finalization | `#prompt:kc-finalize` | Update specs, tracker, log, commit |
613
- | Quick fix | `#prompt:kc-fix` | Micro-fix for small, scoped changes |
614
- | Research | `#prompt:kc-plan` | Investigate before implementing |
615
- | Resume | `#prompt:kc-continue` | Resume or advance to next phase |
616
-
617
- ### Typical Flow
618
-
619
- 1. `#prompt:kc-work "Build JWT authentication"` → Creates WorkGroup, proposes Change Set, **STOPs**
620
- 2. Approve Change Set
621
- 3. `#prompt:kc-specify` → Drafts specs, **STOPs**
622
- 4. Approve specs
623
- 5. `#prompt:kc-implement` → TDD Red-Green-Refactor, **STOPs**
624
- 6. `#prompt:kc-audit` READ-ONLY audit, reports gaps, **STOPs**
625
- 7. `#prompt:kc-finalize` Updates docs, commits
626
-
627
- Use `#prompt:kc-continue` at any point to resume where you left off.
628
-
629
- ## Quality Gates
630
-
631
- STOP and await user approval at each gate:
632
- - After Change Set proposal (1A)
633
- - After spec drafts (1B)
634
- - After implementation complete (2A awaiting audit)
635
- - After audit results (2B user decides on gaps)
636
-
637
- ## TDD Enforcement
638
-
639
- TDD is mandatory — no production code without a failing test first.
640
- Follow Red-Green-Refactor for every feature/criterion in the spec.
641
-
642
- ## Key Rules
643
- - NodeIDs are domain concepts (PascalCase), not tasks
644
- - Consolidate specs when domains overlap >50%
645
- - Every WorkGroup todo starts with `KnowzCode:` prefix
646
- - Target <20 specs per project
647
- - Log completions in `knowzcode/knowzcode_log.md`
648
-
649
- ## Key Files
650
- - `knowzcode/knowzcode_loop.md` — Methodology
651
- - `knowzcode/knowzcode_project.md` — Project context
652
- - `knowzcode/knowzcode_architecture.md` — Architecture docs
653
- - `knowzcode/knowzcode_tracker.md` WorkGroup tracking
654
- - `knowzcode/specs/` Component specifications
655
- - `knowzcode/workgroups/` Active session data (gitignored)
656
-
657
- ## MCP Integration
658
-
659
- If configured in `.vscode/mcp.json`, use `search_knowledge` and `ask_question` tools
660
- for enhanced context from knowledge vaults. All prompts work without MCP.
661
-
662
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
663
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
664
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
665
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
666
- Use `/kc:learn "insight"` for automatic routing.
667
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
668
-
669
- ## Copilot Coding Agent
670
-
671
- When the Copilot Coding Agent works on GitHub issues for this repository:
672
- - Read `knowzcode/knowzcode_loop.md` and this file for methodology
673
- - Follow Phase 1A→3 workflow for any non-trivial change
674
- - Include the Change Set in the PR description
675
- - Use TDD — failing test before implementation code
676
- - Self-audit against spec VERIFY statements before marking PR ready
677
- - Quality gates are deferred to PR review (no interactive approval in async mode)
678
-
679
- ## Model Selection
680
- - Complex phases (1A analysis, 1B spec drafting, 2B audit): Use Claude Opus or GPT-4o
681
- - Implementation (2A): Any capable model with good code generation
682
- - Quick fixes: Any model
683
- ```
684
-
685
- ### B. Prompt File Templates (.github/prompts/)
686
-
687
- Each prompt file is invocable via `#prompt:kc-*` in VS Code Copilot Chat. All use `agent: "agent"` for file editing capability.
688
-
689
- #### kc-work.prompt.md
690
-
691
- ```markdown
692
- ---
693
- agent: "agent"
694
- description: "Start a new KnowzCode development workflow"
695
- argument-hint: "Describe the feature or goal to build"
696
- ---
697
-
698
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
699
-
700
- # KnowzCode: Start Workflow
701
-
702
- You are starting a new KnowzCode development workflow. Follow the methodology precisely.
703
-
704
- ## Context
705
-
706
- Read these files for methodology and project context:
707
- - #file:knowzcode/knowzcode_loop.md
708
- - #file:knowzcode/knowzcode_project.md
709
- - #file:knowzcode/knowzcode_tracker.md
710
- - #file:knowzcode/knowzcode_architecture.md
711
-
712
- ## Instructions
713
-
714
- The user's goal is provided in the chat message.
715
-
716
- ### Step 1: Classify Tier
717
-
718
- Based on the goal, classify complexity:
719
- - **Micro** (single file, <50 lines, no ripple): Redirect to `#prompt:kc-fix`
720
- - **Light** (≤3 files, straightforward): Streamlined 2-phase path
721
- - **Full** (>3 files or complex): Complete 5-phase workflow
722
-
723
- ### Step 2: Create Draft WorkGroup
724
-
725
- Generate a WorkGroupID: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
726
- Create a draft WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` to store the analysis output.
727
-
728
- ### Step 3: Phase 1A — Impact Analysis
729
-
730
- Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
731
- 1. Identify the Change Set — all components affected by this change
732
- 2. Create NodeIDs for NEW capabilities only (domain concepts, PascalCase)
733
- 3. Check `knowzcode/specs/` for existing specs with domain overlap
734
- 4. Scan `knowzcode/workgroups/` for completed WorkGroups with relevant context
735
- 5. Propose the Change Set with NodeIDs, affected files, and risk assessment
736
-
737
- ## STOP
738
-
739
- Present the Change Set for user approval. Do NOT proceed until approved.
740
-
741
- **After approval:** Update `knowzcode/knowzcode_tracker.md` with new NodeIDs as `[WIP]`, then tell the user to invoke `#prompt:kc-specify` to draft specifications.
742
- ```
743
-
744
- #### kc-analyze.prompt.md
745
-
746
- ```markdown
747
- ---
748
- agent: "agent"
749
- description: "Re-run Phase 1A impact analysis on existing WorkGroup"
750
- ---
751
-
752
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
753
-
754
- # KnowzCode: Phase 1A — Impact Analysis
755
-
756
- You are re-running impact analysis on an existing WorkGroup.
757
-
758
- ## Context
759
-
760
- - #file:knowzcode/knowzcode_loop.md
761
- - #file:knowzcode/knowzcode_tracker.md
762
-
763
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
764
- Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
765
-
766
- ## Instructions
767
-
768
- Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
769
- 1. Re-analyze the goal from the WorkGroup file
770
- 2. Identify all affected components check for changes since last analysis
771
- 3. Update NodeIDs if scope has changed
772
- 4. Check `knowzcode/specs/` for existing specs with domain overlap
773
- 5. Update the Change Set in the WorkGroup file
774
-
775
- ## STOP
776
-
777
- Present the updated Change Set for user approval.
778
-
779
- **Next step after approval:** `#prompt:kc-specify`
780
- ```
781
-
782
- #### kc-specify.prompt.md
783
-
784
- ```markdown
785
- ---
786
- agent: "agent"
787
- description: "Draft specifications from approved Change Set (Phase 1B)"
788
- ---
789
-
790
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
791
-
792
- # KnowzCode: Phase 1B — Specification
793
-
794
- You are drafting specifications for the approved Change Set.
795
-
796
- ## Context
797
-
798
- - #file:knowzcode/knowzcode_loop.md
799
- - #file:knowzcode/knowzcode_tracker.md
800
-
801
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
802
- If no `[WIP]` entries found, scan `knowzcode/workgroups/` for the most recent draft WorkGroup file.
803
- Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` for the approved Change Set.
804
-
805
- ## Instructions
806
-
807
- Follow Phase 1B from `knowzcode/knowzcode_loop.md`:
808
-
809
- For each NodeID in the approved Change Set:
810
- 1. Draft `knowzcode/specs/{NodeID}.md` using the 4-section format:
811
- - **Rules & Decisions** Key architectural decisions, business rules, constraints
812
- - **Interfaces** Public contracts: inputs, outputs, API signatures, dependencies
813
- - **Verification Criteria** Testable `VERIFY:` assertions (minimum 2 per spec)
814
- - **Debt & Gaps** — Known limitations and future work
815
- 2. Minimum valid spec: 1+ Rules, 1+ Interface, 2+ VERIFY statements
816
- 3. Check existing specs — if >50% domain overlap, UPDATE existing spec instead
817
- 4. Update the WorkGroup file with spec status
818
-
819
- ## STOP
820
-
821
- Present all drafted specs for user approval. Do NOT proceed until approved.
822
-
823
- **After approval:** Commit the specs as a pre-implementation checkpoint: `git commit -m "specs: draft specs for {WorkGroupID}"`
824
-
825
- **Next step:** `#prompt:kc-implement`
826
- ```
827
-
828
- #### kc-implement.prompt.md
829
-
830
- ```markdown
831
- ---
832
- agent: "agent"
833
- description: "TDD implementation with verification loop (Phase 2A)"
834
- ---
835
-
836
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
837
-
838
- # KnowzCode: Phase 2A — Implementation
839
-
840
- You are implementing the approved specifications using strict TDD.
841
-
842
- ## Context
843
-
844
- - #file:knowzcode/knowzcode_loop.md
845
- - #file:knowzcode/knowzcode_tracker.md
846
-
847
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
848
- Then read:
849
- - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
850
- - All spec files listed in the Change Set from `knowzcode/specs/`
851
-
852
- ## Instructions
853
-
854
- Follow Phase 2A from `knowzcode/knowzcode_loop.md`:
855
-
856
- For EACH feature/criterion in the specs:
857
- 1. **RED**: Write a failing test that defines expected behavior. Run test → confirm FAIL
858
- 2. **GREEN**: Write MINIMAL code to make the test pass. Run test → confirm PASS
859
- 3. **REFACTOR**: Clean up while keeping all tests green
860
-
861
- ### Verification Loop (must pass before reporting complete)
862
-
863
- 1. Run all tests → if FAIL: fix and restart
864
- 2. Run static analysis if issues: fix and restart
865
- 3. Run build → if FAIL: fix and restart
866
- 4. Verify all VERIFY: criteria from specs → if unmet: implement and restart
867
- 5. All checks pass → report complete
868
-
869
- Maximum 10 iterations. If exceeded, report blocker.
870
-
871
- ### Spec Issues
872
-
873
- If you discover a spec is incorrect during implementation:
874
- - Tag `[SPEC_ISSUE]` in the WorkGroup file with details
875
- - Continue with best judgment
876
- - Report in completion summary
877
-
878
- ## STOP
879
-
880
- Report implementation results: test counts, verification iterations, criteria status.
881
-
882
- **Next step:** `#prompt:kc-audit`
883
- ```
884
-
885
- #### kc-audit.prompt.md
886
-
887
- ```markdown
888
- ---
889
- agent: "agent"
890
- description: "READ-ONLY completeness audit against specs (Phase 2B)"
891
- ---
892
-
893
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
894
-
895
- # KnowzCode: Phase 2B — Completeness Audit
896
-
897
- You are performing an independent, READ-ONLY audit of the implementation.
898
-
899
- ## Context
900
-
901
- - #file:knowzcode/knowzcode_loop.md
902
- - #file:knowzcode/knowzcode_tracker.md
903
-
904
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
905
- Then read:
906
- - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
907
- - All spec files listed in the Change Set from `knowzcode/specs/`
908
- - The implementation files listed in the Change Set
909
-
910
- ## Instructions
911
-
912
- Follow Phase 2B from `knowzcode/knowzcode_loop.md`:
913
-
914
- **CRITICAL: This is a READ-ONLY audit. Do NOT modify any source files.**
915
-
916
- 1. For each NodeID, compare implementation against every VERIFY statement in its spec
917
- 2. Calculate objective completion percentage per NodeID and overall
918
- 3. Identify gaps: missing features, incomplete criteria, untested paths
919
- 4. Check for security concerns: input validation, authentication, data exposure
920
- 5. Check for orphan code: implementation not covered by any spec
921
- 6. Assess risk for any gaps found
922
-
923
- ### Standalone Audit Types
924
-
925
- If the user specifies an audit type instead of a WorkGroup audit:
926
- - **spec**: Audit spec quality — completeness, VERIFY statement coverage, format compliance
927
- - **architecture**: Compare architecture doc against actual codebase structure
928
- - **security**: Focused security review — OWASP top 10, input validation, auth flows
929
- - **integration**: Check integration points, API contracts, dependency health
930
-
931
- ## STOP
932
-
933
- Present audit results with completion percentage, gap list, and risk assessment.
934
-
935
- **User decides:**
936
- - Return to `#prompt:kc-implement` to fix gaps
937
- - Accept and proceed to `#prompt:kc-finalize`
938
- - Modify specs to match implementation
939
- - Cancel the WorkGroup
940
- ```
941
-
942
- #### kc-finalize.prompt.md
943
-
944
- ```markdown
945
- ---
946
- agent: "agent"
947
- description: "Finalize WorkGroup update specs, tracker, log, commit (Phase 3)"
948
- ---
949
-
950
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
951
-
952
- # KnowzCode: Phase 3 — Finalization
953
-
954
- You are finalizing the WorkGroup after approved implementation and audit.
955
-
956
- ## Context
957
-
958
- - #file:knowzcode/knowzcode_loop.md
959
- - #file:knowzcode/knowzcode_tracker.md
960
- - #file:knowzcode/knowzcode_architecture.md
961
-
962
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
963
- Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
964
-
965
- ## Instructions
966
-
967
- Follow Phase 3 from `knowzcode/knowzcode_loop.md`:
968
-
969
- 1. **Finalize Specs**: Update each `knowzcode/specs/{NodeID}.md` to as-built state (Status: As-Built)
970
- 2. **Architecture Check**: Compare `knowzcode/knowzcode_architecture.md` against the Change Set. Fix simple discrepancies directly; document complex ones for user review
971
- 3. **Log Entry**: Prepend an `ARC-Completion` entry to `knowzcode/knowzcode_log.md` with WorkGroupID, NodeIDs, verification summary, architectural learnings, and ripple effects
972
- 4. **Update Tracker**: Change NodeID statuses from `[WIP]` to `[VERIFIED]` in `knowzcode/knowzcode_tracker.md`. Create `REFACTOR_` tasks for significant tech debt
973
- 5. **Final Commit**: Stage and commit all changes (source + knowzcode files)
974
- 6. **Close WorkGroup**: Mark the WorkGroup file as closed
975
-
976
- ## Output
977
-
978
- Report completion with summary of what was delivered and any `REFACTOR_` tasks created.
979
- ```
980
-
981
- #### kc-fix.prompt.md
982
-
983
- ```markdown
984
- ---
985
- agent: "agent"
986
- description: "Quick targeted fix using micro-fix protocol"
987
- argument-hint: "Describe the bug or issue to fix"
988
- ---
989
-
990
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
991
-
992
- # KnowzCode: Micro-Fix
993
-
994
- You are performing a quick, targeted fix using the micro-fix protocol.
995
-
996
- ## Context
997
-
998
- - #file:knowzcode/knowzcode_loop.md
999
-
1000
- ## Scope Guard
1001
-
1002
- This workflow is for changes that are:
1003
- - **Single file** (or minimal multi-file with no ripple effects)
1004
- - **<50 lines** changed
1005
- - **No architectural impact**
1006
-
1007
- If the fix exceeds this scope, inform the user and suggest `#prompt:kc-work` instead.
1008
-
1009
- ## Instructions
1010
-
1011
- Follow the Micro-Fix Protocol from `knowzcode/knowzcode_loop.md` Section 4:
1012
-
1013
- 1. **Implement** the fix
1014
- 2. **Test** run targeted tests for the affected code
1015
- 3. **Log** prepend a `MicroFix` entry to `knowzcode/knowzcode_log.md`:
1016
- - Type: MicroFix
1017
- - File/NodeID affected
1018
- - User request, action taken, verification outcome
1019
- 4. **Commit** with `fix: {description}` message
1020
- ```
1021
-
1022
- #### kc-plan.prompt.md
1023
-
1024
- ```markdown
1025
- ---
1026
- agent: "agent"
1027
- description: "Research and investigate before implementing"
1028
- argument-hint: "Describe the topic to research"
1029
- ---
1030
-
1031
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
1032
-
1033
- # KnowzCode: Plan / Investigate
1034
-
1035
- You are researching a topic before implementation. This is an investigation workflow, not a build workflow.
1036
-
1037
- ## Context
1038
-
1039
- - #file:knowzcode/knowzcode_loop.md
1040
- - #file:knowzcode/knowzcode_project.md
1041
- - #file:knowzcode/knowzcode_architecture.md
1042
-
1043
- ## Instructions
1044
-
1045
- The user's research topic is provided in the chat message.
1046
-
1047
- 1. **Explore the codebase** search for relevant files, patterns, and existing implementations
1048
- 2. **Read existing specs** check `knowzcode/specs/` for related components
1049
- 3. **Check history** — scan `knowzcode/workgroups/` for past WorkGroups that touched similar areas
1050
- 4. **Analyze architecture** review `knowzcode/knowzcode_architecture.md` for structural context
1051
- 5. **Present findings** with:
1052
- - Current state of the relevant code
1053
- - Existing patterns and conventions
1054
- - Options for implementation (with trade-offs)
1055
- - Recommended approach
1056
-
1057
- ## STOP
1058
-
1059
- Present research findings and recommendations.
1060
-
1061
- **To implement:** Tell the user to invoke `#prompt:kc-work` with their chosen approach.
1062
- ```
1063
-
1064
- #### kc-continue.prompt.md
1065
-
1066
- ```markdown
1067
- ---
1068
- agent: "agent"
1069
- description: "Resume interrupted work or advance to next phase"
1070
- ---
1071
-
1072
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
1073
-
1074
- # KnowzCode: Continue / Resume
1075
-
1076
- You are resuming an interrupted KnowzCode workflow or advancing to the next phase.
1077
-
1078
- ## Context
1079
-
1080
- - #file:knowzcode/knowzcode_loop.md
1081
- - #file:knowzcode/knowzcode_tracker.md
1082
-
1083
- ## Instructions
1084
-
1085
- ### Step 1: Find Active WorkGroup
1086
-
1087
- Read `knowzcode/knowzcode_tracker.md` and find entries with `[WIP]` status.
1088
-
1089
- - **One active WorkGroup**: Use it
1090
- - **Multiple active**: Present the list and ask the user which to resume
1091
- - **None active**: Inform the user and suggest `#prompt:kc-work`
1092
-
1093
- ### Step 2: Determine Current Phase
1094
-
1095
- Read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
1096
- Check the Phase History table to determine the current state.
1097
-
1098
- ### Step 3: Resume or Advance
1099
-
1100
- | WorkGroup State | Action |
1101
- |----------------|--------|
1102
- | Phase 1A in progress | Complete the impact analysis, present Change Set |
1103
- | Phase 1A complete, awaiting approval | Present Change Set for approval |
1104
- | Phase 1A approved, specs not started | Begin Phase 1B — draft specs |
1105
- | Phase 1B in progress | Complete spec drafting |
1106
- | Phase 1B complete, awaiting approval | Present specs for approval |
1107
- | Phase 1B approved, implementation not started | Begin Phase 2A — TDD implementation |
1108
- | Phase 2A in progress | Resume implementation from outstanding todos |
1109
- | Phase 2A complete | Advise: `#prompt:kc-audit` |
1110
- | Phase 2B complete, gaps found | Present options: fix gaps or accept |
1111
- | Phase 2B complete, no gaps | Begin Phase 3 — finalization |
1112
- | Phase 3 in progress | Complete finalization |
1113
-
1114
- ### Step 4: Present Status
1115
-
1116
- ```
1117
- ## Resuming WorkGroup: {WorkGroupID}
1118
-
1119
- **Goal**: {primary goal}
1120
- **Phase**: {current phase}
1121
- **NodeIDs**: {list}
1122
-
1123
- **Outstanding Work**:
1124
- {list from WorkGroup file}
1125
-
1126
- Continuing from where we left off...
1127
- ```
1128
-
1129
- Then proceed with the appropriate phase instructions from `knowzcode/knowzcode_loop.md`.
1130
- ```
1131
-
1132
- ### C. .vscode/mcp.json Template
1133
-
1134
- Optionally generated by `/kc:init` when Copilot is detected and MCP is configured:
1135
-
1136
- ```json
1137
- {
1138
- "servers": {
1139
- "knowz": {
1140
- "type": "http",
1141
- "url": "${input:knowz_mcp_url}",
1142
- "headers": {
1143
- "x-api-key": "${input:knowz_api_key}"
1144
- }
1145
- }
1146
- },
1147
- "inputs": [
1148
- {
1149
- "id": "knowz_mcp_url",
1150
- "description": "KnowzCode MCP server URL",
1151
- "type": "promptString"
1152
- },
1153
- {
1154
- "id": "knowz_api_key",
1155
- "description": "KnowzCode API key",
1156
- "type": "promptString",
1157
- "password": true
1158
- }
1159
- ]
1160
- }
1161
- ```
1162
-
1163
- ### D. Copilot-Specific Notes
1164
-
1165
- **VS Code usage:**
1166
- - Invoke prompts via `#prompt:kc-work`, `#prompt:kc-specify`, etc. in Copilot Chat
1167
- - Add extra files to context with `#file:path/to/file` in the chat message
1168
- - All prompt files use `agent: "agent"` frontmatter for file editing and terminal access
1169
- - Model can be selected per session prefer stronger models for analysis/audit phases
1170
-
1171
- **Copilot CLI fallback:**
1172
- - CLI does not support `#prompt:` syntax
1173
- - Check current CLI documentation for file reference syntax — it may differ from VS Code
1174
- - Alternatively, reference the methodology directly or paste prompt content into the CLI
1175
-
1176
- **Copilot Coding Agent:**
1177
- - Follows `.github/copilot-instructions.md` automatically when processing GitHub issues
1178
- - Runs all phases autonomously — quality gates deferred to PR review
1179
- - Does not use prompt files (uses repository instructions only)
1180
-
1181
- **Execution model:**
1182
- - See `knowzcode/copilot_execution.md` for the full execution guide
1183
- - Single-agent, sequential execution user manually transitions between phases
1184
- - No multi-agent orchestration (no Parallel Teams, no agent spawning)
1185
- - WorkGroup files carry state between prompt invocations
1186
-
1187
- ---
1188
-
1189
- ## Windsurf (`.windsurf/rules/knowzcode.md`)
1190
-
1191
- Create `.windsurf/rules/knowzcode.md`. Notes: Modern Windsurf uses the `.windsurf/rules/` directory instead of the deprecated `.windsurfrules` file. Cascade multi-file editing works well with KnowzCode's cross-component implementation phases. Windsurf also supports `.windsurf/workflows/*.md` for custom commands invoked as `/workflow-name` — KnowzCode workflows can be defined as individual workflow files for each phase.
1192
-
1193
- ```markdown
1194
- # KnowzCode Development Methodology
1195
-
1196
- This project uses KnowzCode for structured TDD development.
1197
- Follow `knowzcode/knowzcode_loop.md` for all feature development.
1198
-
1199
- ## Required Reading
1200
- - `knowzcode/knowzcode_loop.md` Complete methodology
1201
- - `knowzcode/knowzcode_project.md` Project context
1202
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
1203
- - `knowzcode/knowzcode_architecture.md` Architecture docs
1204
-
1205
- ## Phase Walkthrough
1206
-
1207
- ### Phase 1A: Impact Analysis
1208
- - Identify affected components, propose Change Set with NodeIDs
1209
- - Check existing specs before creating new ones
1210
- - PAUSE for user approval
1211
-
1212
- ### Phase 1B: Specification
1213
- - Draft specs with 4-section format and 2+ VERIFY statements
1214
- - PAUSE for approval, then commit specs
1215
-
1216
- ### Phase 2A: Implementation (TDD Mandatory)
1217
- - Write failing test FIRST, then minimal code, then refactor
1218
- - Use Cascade for multi-file edits across components
1219
- - Run full verification loop (tests + linter + build)
1220
- - PAUSE after implementation
1221
-
1222
- ### Phase 2B: Audit
1223
- - READ-ONLY audit against spec VERIFY statements
1224
- - Report completion %, gaps, security concerns
1225
- - PAUSE for user decision
1226
-
1227
- ### Phase 3: Finalization
1228
- - Update specs to As-Built, tracker, log, architecture
1229
- - Final commit
1230
-
1231
- ## Enforcement Rules
1232
- - TDD is mandatory — write failing tests before implementation code
1233
- - Respect quality gates between phases — PAUSE at each gate
1234
- - Update `knowzcode/knowzcode_tracker.md` when completing work
1235
- - Log completions in `knowzcode/knowzcode_log.md`
1236
- - Consolidate specs when domains overlap >50%
1237
- - Target <20 specs per project
1238
- - Every WorkGroup todo starts with `KnowzCode:` prefix
1239
-
1240
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
1241
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
1242
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
1243
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
1244
- Use `/kc:learn "insight"` for automatic routing.
1245
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
1246
-
1247
- ## Micro-Fix (for small changes)
1248
- Single file, <50 lines, no ripple effects:
1249
- Implement → Test → Log MicroFix → Commit with `fix:` prefix
1250
- ```
1251
-
1252
- ---
1253
-
1254
- ## OpenAI Codex Agents SDK (Python)
1255
-
1256
- For teams building custom orchestration with the OpenAI Agents SDK,
1257
- map KnowzCode's 5 phase agents to SDK Agent definitions. The AGENTS.md
1258
- file above provides all instructions each agent needs. See the
1259
- [Agents SDK documentation](https://openai.github.io/openai-agents-python/)
1260
- for implementation details.
1
+ # KnowzCode Platform Adapters
2
+
3
+ This file contains adapter templates for integrating KnowzCode with different AI coding platforms. Each adapter teaches the platform's AI how to follow the KnowzCode methodology with full phase walkthroughs, quality gates, and TDD enforcement.
4
+
5
+ Generated by `/kc:init`. Adapters should be placed in the project root (or platform-specific location).
6
+
7
+ ---
8
+
9
+ ## Claude Code (CLAUDE.md section)
10
+
11
+ Append to or create `CLAUDE.md` in project root:
12
+
13
+ ```markdown
14
+ # KnowzCode Integration
15
+
16
+ This project uses KnowzCode for structured TDD development with multi-agent orchestration.
17
+
18
+ ## Required Reading
19
+ - `knowzcode/knowzcode_loop.md` — Development methodology (TDD, quality gates, phases)
20
+ - `knowzcode/knowzcode_project.md` — Project context and tech stack
21
+ - `knowzcode/knowzcode_tracker.md` — Current WorkGroup status
22
+ - `knowzcode/knowzcode_architecture.md` — Architecture documentation
23
+
24
+ ## Workflow Phases
25
+ Follow the phases in `knowzcode_loop.md` for all feature work:
26
+ 1. **Phase 1A: Impact Analysis** — Identify affected components, propose Change Set. PAUSE for user approval.
27
+ 2. **Phase 1B: Specification** — Draft specs for all NodeIDs. PAUSE for user approval. Commit specs.
28
+ 3. **Phase 2A: Implementation** — Strict TDD (Red-Green-Refactor). No production code without a failing test.
29
+ 4. **Phase 2B: Completeness Audit** — Independent READ-ONLY audit. PAUSE for user decision on gaps.
30
+ 5. **Phase 3: Finalization** — Update specs to as-built, update tracker, log entry, final commit.
31
+
32
+ ## Quality Gates
33
+ Never skip phases. PAUSE for user approval at each gate:
34
+ - After Change Set proposal (1A)
35
+ - After spec drafts (1B)
36
+ - After implementation (2A — awaiting audit)
37
+ - After audit results (2B — user decides on gaps)
38
+
39
+ ## TDD Enforcement
40
+ TDD is mandatory — no production code without a failing test first.
41
+ Red-Green-Refactor cycle for every feature/criterion in the spec.
42
+
43
+ ## Agents
44
+ Specialized agents handle each phase when using Agent Teams or subagent execution:
45
+ - `analyst` (1A), `architect` (1B), `builder` (2A), `reviewer` (2B), `closer` (3)
46
+ - Agent Teams is the preferred execution model when enabled (experimental, requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` env var)
47
+ - Subagent fallback for environments without Agent Teams
48
+
49
+ ## Commands
50
+ - `/kc:work "goal"` — Start feature workflow
51
+ - `/kc:plan "topic"` — Research before implementing
52
+ - `/kc:audit [type]` — Run quality audits (spec, architecture, security, integration)
53
+ - `/kc:fix "target" "summary"` — Quick targeted fix
54
+ - `/kc:learn "insight"` — Capture learning to vault
55
+ - `/kc:status` — Check MCP connection and vault status
56
+
57
+ ## MCP Integration
58
+ If configured, agents use `search_knowledge`, `ask_question`, and `create_knowledge` for enhanced context.
59
+ All commands work without MCP — it enhances but never blocks.
60
+
61
+ ### Knowledge Capture (CRITICAL — DO NOT SKIP)
62
+ Every piece of durable knowledge — decisions, patterns, gotchas, workarounds, convention changes —
63
+ **must** be captured. Knowledge lives in two places:
64
+
65
+ - **MCP vaults** (when connected): `knowzcode/knowzcode_vaults.md` defines vault IDs, routing rules,
66
+ and write conditions. Always pass `vaultId` when calling `create_knowledge` — omitting it saves
67
+ to the tenant default vault, NOT the project vault.
68
+ - **Local files** (always available): specs, workgroup files, log entries, architecture docs, and
69
+ `knowzcode/pending_captures.md` (scribe fallback queue when MCP is unavailable).
70
+
71
+ If MCP is not connected, knowledge still gets captured locally. Never let insights die in the conversation.
72
+
73
+ **Vault content detail**: Vault entries are retrieved via semantic search, not read directly like local files. Write detailed, self-contained entries with full reasoning, specific technology names, code examples, and file paths. Terse entries produce poor search results. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
74
+
75
+ ### Knowz-Scribe Delegation
76
+ When knowz-scribe is active (Agent Teams mode), it owns all vault writes — do NOT call `create_knowledge` directly. Send knowledge to the scribe instead:
77
+
78
+ - **Phase captures**: Handled automatically at quality gates via task-tracked DMs
79
+ - **Explicit**: `"Log: {description}"` — scribe MUST write it; it decides routing (which vault or local file)
80
+ - **Soft**: `"Consider: {description}"` — scribe evaluates whether to capture and where; may skip if not insight-worthy or duplicative
81
+
82
+ Any agent can send ad-hoc knowledge to the scribe at any time. The scribe handles routing, dedup, and formatting. If MCP is unavailable, the scribe queues captures to `knowzcode/pending_captures.md` for later sync. When no scribe is active, use `/kc:learn "insight"` for automatic routing.
83
+
84
+ ## WorkGroup Files
85
+ - Created in `knowzcode/workgroups/` (gitignored)
86
+ - Every todo must start with `KnowzCode:` prefix
87
+ - Track phase history, Change Set, and outstanding work
88
+ ```
89
+
90
+ ---
91
+
92
+ ## OpenAI Codex (AGENTS.md)
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 — 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
+
96
+ ```markdown
97
+ # KnowzCode Development Methodology
98
+
99
+ This project uses KnowzCode for structured TDD development.
100
+ Read `knowzcode/knowzcode_loop.md` before starting any feature work.
101
+
102
+ ## Phase Walkthrough
103
+
104
+ ### Before Starting
105
+ 1. Read `knowzcode/knowzcode_tracker.md` — check for active WorkGroups
106
+ 2. Read `knowzcode/knowzcode_project.md` — understand project context
107
+ 3. Read `knowzcode/knowzcode_architecture.md` — understand current architecture
108
+
109
+ ### Phase 1A: Impact Analysis
110
+ - Analyze what needs to change for the given goal
111
+ - Create NodeIDs for NEW capabilities only (not per-file)
112
+ - Check `knowzcode/specs/` for existing specs in the same domain
113
+ - Propose a Change Set with NodeIDs, affected files, and risk assessment
114
+ - **STOP**: Present Change Set for user approval before continuing
115
+
116
+ ### Phase 1B: Specification
117
+ - Draft specs for each NodeID using the 4-section format:
118
+ - Rules & Decisions, Interfaces, Verification Criteria, Debt & Gaps
119
+ - Minimum: 1+ Rules, 1+ Interface, 2+ VERIFY statements per spec
120
+ - Save to `knowzcode/specs/{NodeID}.md`
121
+ - **STOP**: Present specs for user approval
122
+ - After approval: `git commit` the specs as a checkpoint
123
+
124
+ ### Phase 2A: Implementation (TDD MANDATORY)
125
+ - For EACH feature/criterion in the spec:
126
+ 1. RED: Write a failing test first
127
+ 2. GREEN: Write minimal code to make the test pass
128
+ 3. REFACTOR: Clean up while keeping tests green
129
+ - Run full test suite + static analysis + build after all features
130
+ - Maximum 10 verification iterations before pausing
131
+ - **STOP**: Report implementation results
132
+
133
+ ### Phase 2B: Completeness Audit
134
+ - READ-ONLY audit — do NOT modify source files
135
+ - Compare implementation against all VERIFY statements in specs
136
+ - Calculate completion percentage
137
+ - Report gaps, security concerns, integration issues
138
+ - **STOP**: Present audit results for user decision
139
+
140
+ ### Phase 3: Finalization
141
+ - Update specs to "As-Built" status
142
+ - Check architecture doc for drift
143
+ - Prepend log entry to `knowzcode/knowzcode_log.md`
144
+ - Update tracker statuses to `[VERIFIED]`
145
+ - Create final commit with all changes
146
+
147
+ ## Key Rules
148
+ - Always propose a Change Set before implementing
149
+ - Get user approval at every quality gate (STOP points above)
150
+ - TDD is mandatory — no production code without failing tests
151
+ - Log all completions in `knowzcode/knowzcode_log.md`
152
+ - Track work in `knowzcode/knowzcode_tracker.md`
153
+ - Every WorkGroup todo must start with `KnowzCode:` prefix
154
+ - Target <20 specs per project — consolidate when domains overlap
155
+
156
+ ## Knowledge Capture (CRITICAL — DO NOT SKIP)
157
+ Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
158
+ When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
159
+ When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
160
+ Use `/kc:learn "insight"` for automatic routing.
161
+ Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
162
+
163
+ ## Quick Fix (Micro-Fix)
164
+ For single-file, <50 line, no-ripple-effect changes:
165
+ 1. Implement the fix
166
+ 2. Run targeted tests
167
+ 3. Log a MicroFix entry
168
+ 4. Commit with `fix:` prefix
169
+
170
+ ## Key Files
171
+ - `knowzcode/knowzcode_loop.md` — Complete methodology
172
+ - `knowzcode/knowzcode_project.md` — Project context
173
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
174
+ - `knowzcode/knowzcode_tracker.md` — WorkGroup tracking
175
+ - `knowzcode/specs/` — Component specifications
176
+ - `knowzcode/workgroups/` — Active session data (gitignored)
177
+ ```
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:planResearch 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-mcpConfigure 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.
1261
+ ---
1262
+ <!-- Generated by KnowzCode vX.Y.Z -->
1263
+
1264
+ # /kc:telemetry — Investigate Telemetry
1265
+
1266
+ Investigate production telemetry to diagnose errors, trace issues, and identify root causes.
1267
+
1268
+ ## Instructions
1269
+
1270
+ Usage: `/kc:telemetry "<natural language description>"`
1271
+
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`.
1279
+ ```
1280
+
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.
1307
+ ```
1308
+
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.
1351
+ ```
1352
+
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.
1389
+ ```
1390
+
1391
+ #### .gemini/agents/kc-builder.md
1392
+
1393
+ ```markdown
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
+ ---
1407
+
1408
+ # KnowzCode Builder
1409
+
1410
+ You are the **TDD Builder** for the KnowzCode development workflow.
1411
+
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.
1414
+
1415
+ ## Instructions
1416
+
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
+ ```
1429
+
1430
+ #### .gemini/agents/kc-reviewer.md
1431
+
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
+ ---
1445
+
1446
+ # KnowzCode Reviewer
1447
+
1448
+ You are the **Quality Reviewer** for the KnowzCode development workflow.
1449
+
1450
+ ## Role
1451
+ Perform Phase 2B: Completeness Audit. Conduct a READ-ONLY audit comparing implementation against specs. Do NOT modify source files.
1452
+
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
1800
+ ```
1801
+
1802
+ ---
1803
+
1804
+ ## Cursor (`.cursor/rules/knowzcode.mdc`)
1805
+
1806
+ Create `.cursor/rules/knowzcode.mdc` with YAML frontmatter. Notes: Modern Cursor uses `.cursor/rules/*.mdc` files instead of the deprecated `.cursorrules`. Scoped rules can target specific file patterns using the `globs` frontmatter field. Cursor 1.6+ (2026) also supports `.cursor/commands/*.md` for custom slash commands (beta) and reads `AGENTS.md` for agent instructions.
1807
+
1808
+ ```markdown
1809
+ ---
1810
+ description: KnowzCode TDD development methodology
1811
+ alwaysApply: true
1812
+ ---
1813
+
1814
+ # KnowzCode Rules
1815
+
1816
+ This project uses KnowzCode for structured TDD development.
1817
+
1818
+ ## Required Reading
1819
+ Before any feature work, read:
1820
+ - `knowzcode/knowzcode_loop.md` — Complete methodology
1821
+ - `knowzcode/knowzcode_project.md` — Project context
1822
+ - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
1823
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
1824
+
1825
+ ## Phase Rules
1826
+
1827
+ ### Phase 1A: Impact Analysis
1828
+ - Identify affected components and propose a Change Set
1829
+ - NodeIDs are domain concepts (PascalCase), not tasks
1830
+ - Check `knowzcode/specs/` before creating new specs
1831
+ - PAUSE for user approval before proceeding
1832
+
1833
+ ### Phase 1B: Specification
1834
+ - Use 4-section format: Rules & Decisions, Interfaces, Verification Criteria, Debt & Gaps
1835
+ - Minimum: 2+ VERIFY statements per spec
1836
+ - PAUSE for user approval, then commit specs
1837
+
1838
+ ### Phase 2A: Implementation
1839
+ - TDD is mandatory: write failing test FIRST, then minimal code, then refactor
1840
+ - Use Composer for multi-file edits when implementing across components
1841
+ - Run full test suite before reporting complete
1842
+ - PAUSE after implementation
1843
+
1844
+ ### Phase 2B: Audit
1845
+ - READ-ONLY — do not modify source files
1846
+ - Compare implementation vs spec VERIFY statements
1847
+ - Report completion percentage and gaps
1848
+ - PAUSE for user decision
1849
+
1850
+ ### Phase 3: Finalization
1851
+ - Update specs to As-Built status
1852
+ - Update tracker and log
1853
+ - Check architecture for drift
1854
+ - Final commit
1855
+
1856
+ ## Enforcement
1857
+ - Never skip phases or quality gates
1858
+ - TDD is mandatory — no production code without a failing test
1859
+ - Every WorkGroup todo starts with `KnowzCode:` prefix
1860
+ - Consolidate specs when domains overlap >50%
1861
+ - Target <20 specs per project
1862
+ - Read `knowzcode/knowzcode_tracker.md` for active work
1863
+ - Log completions in `knowzcode/knowzcode_log.md`
1864
+
1865
+ ## Knowledge Capture (CRITICAL — DO NOT SKIP)
1866
+ Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
1867
+ When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
1868
+ When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
1869
+ Use `/kc:learn "insight"` for automatic routing.
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.
1876
+ ```
1877
+
1878
+ ---
1879
+
1880
+ ## GitHub Copilot (.github/copilot-instructions.md + .github/prompts/*.prompt.md)
1881
+
1882
+ GitHub Copilot (2026) supports three instruction mechanisms used by KnowzCode:
1883
+
1884
+ 1. **`.github/copilot-instructions.md`** — Repository-level instructions, always active
1885
+ 2. **`.github/prompts/*.prompt.md`** — Custom prompts invocable via `#prompt:name` in VS Code
1886
+ 3. **MCP server tools** (`.vscode/mcp.json`) — Tool access for vault queries
1887
+
1888
+ Copilot operates as a **single-agent, sequential** platform — no multi-agent orchestration. Users manually transition between phases using prompt files. See `knowzcode/copilot_execution.md` for the full execution model.
1889
+
1890
+ ### A. copilot-instructions.md
1891
+
1892
+ Create `.github/copilot-instructions.md`:
1893
+
1894
+ ```markdown
1895
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
1896
+
1897
+ # KnowzCode Development Methodology
1898
+
1899
+ This repository uses KnowzCode for structured TDD development with quality gates.
1900
+
1901
+ ## Required Reading
1902
+ - `knowzcode/knowzcode_loop.md` — Complete methodology (read first)
1903
+ - `knowzcode/knowzcode_project.md` — Project context and tech stack
1904
+ - `knowzcode/knowzcode_architecture.md` — Architecture documentation
1905
+ - `knowzcode/knowzcode_tracker.md` — WorkGroup status tracking
1906
+
1907
+ ## Workflow Overview
1908
+
1909
+ KnowzCode follows a 5-phase development loop with quality gates between each phase.
1910
+ Use the prompt files in `.github/prompts/` to invoke each phase:
1911
+
1912
+ | Phase | Prompt | Description |
1913
+ |-------|--------|-------------|
1914
+ | Full workflow | `#prompt:kc-work` | Start a new feature — creates WorkGroup, classifies tier, runs Phase 1A |
1915
+ | 1A: Analysis | `#prompt:kc-analyze` | Re-run impact analysis on existing WorkGroup |
1916
+ | 1B: Specification | `#prompt:kc-specify` | Draft specs from approved Change Set |
1917
+ | 2A: Implementation | `#prompt:kc-implement` | TDD implementation with verification loop |
1918
+ | 2B: Audit | `#prompt:kc-audit` | READ-ONLY audit against specs |
1919
+ | 3: Finalization | `#prompt:kc-finalize` | Update specs, tracker, log, commit |
1920
+ | Quick fix | `#prompt:kc-fix` | Micro-fix for small, scoped changes |
1921
+ | Research | `#prompt:kc-plan` | Investigate before implementing |
1922
+ | Resume | `#prompt:kc-continue` | Resume or advance to next phase |
1923
+
1924
+ ### Typical Flow
1925
+
1926
+ 1. `#prompt:kc-work "Build JWT authentication"` → Creates WorkGroup, proposes Change Set, **STOPs**
1927
+ 2. Approve Change Set
1928
+ 3. `#prompt:kc-specify` → Drafts specs, **STOPs**
1929
+ 4. Approve specs
1930
+ 5. `#prompt:kc-implement` → TDD Red-Green-Refactor, **STOPs**
1931
+ 6. `#prompt:kc-audit` → READ-ONLY audit, reports gaps, **STOPs**
1932
+ 7. `#prompt:kc-finalize` → Updates docs, commits
1933
+
1934
+ Use `#prompt:kc-continue` at any point to resume where you left off.
1935
+
1936
+ ## Quality Gates
1937
+
1938
+ STOP and await user approval at each gate:
1939
+ - After Change Set proposal (1A)
1940
+ - After spec drafts (1B)
1941
+ - After implementation complete (2A — awaiting audit)
1942
+ - After audit results (2B — user decides on gaps)
1943
+
1944
+ ## TDD Enforcement
1945
+
1946
+ TDD is mandatory — no production code without a failing test first.
1947
+ Follow Red-Green-Refactor for every feature/criterion in the spec.
1948
+
1949
+ ## Key Rules
1950
+ - NodeIDs are domain concepts (PascalCase), not tasks
1951
+ - Consolidate specs when domains overlap >50%
1952
+ - Every WorkGroup todo starts with `KnowzCode:` prefix
1953
+ - Target <20 specs per project
1954
+ - Log completions in `knowzcode/knowzcode_log.md`
1955
+
1956
+ ## Key Files
1957
+ - `knowzcode/knowzcode_loop.md` — Methodology
1958
+ - `knowzcode/knowzcode_project.md` — Project context
1959
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
1960
+ - `knowzcode/knowzcode_tracker.md` — WorkGroup tracking
1961
+ - `knowzcode/specs/` — Component specifications
1962
+ - `knowzcode/workgroups/` — Active session data (gitignored)
1963
+
1964
+ ## MCP Integration
1965
+
1966
+ If configured in `.vscode/mcp.json`, use `search_knowledge` and `ask_question` tools
1967
+ for enhanced context from knowledge vaults. All prompts work without MCP.
1968
+
1969
+ ## Knowledge Capture (CRITICAL — DO NOT SKIP)
1970
+ Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
1971
+ When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
1972
+ When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
1973
+ Use `/kc:learn "insight"` for automatic routing.
1974
+ Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
1975
+
1976
+ ## Copilot Coding Agent
1977
+
1978
+ When the Copilot Coding Agent works on GitHub issues for this repository:
1979
+ - Read `knowzcode/knowzcode_loop.md` and this file for methodology
1980
+ - Follow Phase 1A→3 workflow for any non-trivial change
1981
+ - Include the Change Set in the PR description
1982
+ - Use TDD — failing test before implementation code
1983
+ - Self-audit against spec VERIFY statements before marking PR ready
1984
+ - Quality gates are deferred to PR review (no interactive approval in async mode)
1985
+
1986
+ ## Model Selection
1987
+ - Complex phases (1A analysis, 1B spec drafting, 2B audit): Use Claude Opus or GPT-4o
1988
+ - Implementation (2A): Any capable model with good code generation
1989
+ - Quick fixes: Any model
1990
+ ```
1991
+
1992
+ ### B. Prompt File Templates (.github/prompts/)
1993
+
1994
+ Each prompt file is invocable via `#prompt:kc-*` in VS Code Copilot Chat. All use `agent: "agent"` for file editing capability.
1995
+
1996
+ #### kc-work.prompt.md
1997
+
1998
+ ```markdown
1999
+ ---
2000
+ agent: "agent"
2001
+ description: "Start a new KnowzCode development workflow"
2002
+ argument-hint: "Describe the feature or goal to build"
2003
+ ---
2004
+
2005
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2006
+
2007
+ # KnowzCode: Start Workflow
2008
+
2009
+ You are starting a new KnowzCode development workflow. Follow the methodology precisely.
2010
+
2011
+ ## Context
2012
+
2013
+ Read these files for methodology and project context:
2014
+ - #file:knowzcode/knowzcode_loop.md
2015
+ - #file:knowzcode/knowzcode_project.md
2016
+ - #file:knowzcode/knowzcode_tracker.md
2017
+ - #file:knowzcode/knowzcode_architecture.md
2018
+
2019
+ ## Instructions
2020
+
2021
+ The user's goal is provided in the chat message.
2022
+
2023
+ ### Step 1: Classify Tier
2024
+
2025
+ Based on the goal, classify complexity:
2026
+ - **Micro** (single file, <50 lines, no ripple): Redirect to `#prompt:kc-fix`
2027
+ - **Light** (≤3 files, straightforward): Streamlined 2-phase path
2028
+ - **Full** (>3 files or complex): Complete 5-phase workflow
2029
+
2030
+ ### Step 2: Create Draft WorkGroup
2031
+
2032
+ Generate a WorkGroupID: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
2033
+ Create a draft WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` to store the analysis output.
2034
+
2035
+ ### Step 3: Phase 1A — Impact Analysis
2036
+
2037
+ Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
2038
+ 1. Identify the Change Set — all components affected by this change
2039
+ 2. Create NodeIDs for NEW capabilities only (domain concepts, PascalCase)
2040
+ 3. Check `knowzcode/specs/` for existing specs with domain overlap
2041
+ 4. Scan `knowzcode/workgroups/` for completed WorkGroups with relevant context
2042
+ 5. Propose the Change Set with NodeIDs, affected files, and risk assessment
2043
+
2044
+ ## STOP
2045
+
2046
+ Present the Change Set for user approval. Do NOT proceed until approved.
2047
+
2048
+ **After approval:** Update `knowzcode/knowzcode_tracker.md` with new NodeIDs as `[WIP]`, then tell the user to invoke `#prompt:kc-specify` to draft specifications.
2049
+ ```
2050
+
2051
+ #### kc-analyze.prompt.md
2052
+
2053
+ ```markdown
2054
+ ---
2055
+ agent: "agent"
2056
+ description: "Re-run Phase 1A impact analysis on existing WorkGroup"
2057
+ ---
2058
+
2059
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2060
+
2061
+ # KnowzCode: Phase 1A — Impact Analysis
2062
+
2063
+ You are re-running impact analysis on an existing WorkGroup.
2064
+
2065
+ ## Context
2066
+
2067
+ - #file:knowzcode/knowzcode_loop.md
2068
+ - #file:knowzcode/knowzcode_tracker.md
2069
+
2070
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
2071
+ Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
2072
+
2073
+ ## Instructions
2074
+
2075
+ Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
2076
+ 1. Re-analyze the goal from the WorkGroup file
2077
+ 2. Identify all affected components — check for changes since last analysis
2078
+ 3. Update NodeIDs if scope has changed
2079
+ 4. Check `knowzcode/specs/` for existing specs with domain overlap
2080
+ 5. Update the Change Set in the WorkGroup file
2081
+
2082
+ ## STOP
2083
+
2084
+ Present the updated Change Set for user approval.
2085
+
2086
+ **Next step after approval:** `#prompt:kc-specify`
2087
+ ```
2088
+
2089
+ #### kc-specify.prompt.md
2090
+
2091
+ ```markdown
2092
+ ---
2093
+ agent: "agent"
2094
+ description: "Draft specifications from approved Change Set (Phase 1B)"
2095
+ ---
2096
+
2097
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2098
+
2099
+ # KnowzCode: Phase 1B — Specification
2100
+
2101
+ You are drafting specifications for the approved Change Set.
2102
+
2103
+ ## Context
2104
+
2105
+ - #file:knowzcode/knowzcode_loop.md
2106
+ - #file:knowzcode/knowzcode_tracker.md
2107
+
2108
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
2109
+ If no `[WIP]` entries found, scan `knowzcode/workgroups/` for the most recent draft WorkGroup file.
2110
+ Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` for the approved Change Set.
2111
+
2112
+ ## Instructions
2113
+
2114
+ Follow Phase 1B from `knowzcode/knowzcode_loop.md`:
2115
+
2116
+ For each NodeID in the approved Change Set:
2117
+ 1. Draft `knowzcode/specs/{NodeID}.md` using the 4-section format:
2118
+ - **Rules & Decisions** — Key architectural decisions, business rules, constraints
2119
+ - **Interfaces** — Public contracts: inputs, outputs, API signatures, dependencies
2120
+ - **Verification Criteria** — Testable `VERIFY:` assertions (minimum 2 per spec)
2121
+ - **Debt & Gaps** — Known limitations and future work
2122
+ 2. Minimum valid spec: 1+ Rules, 1+ Interface, 2+ VERIFY statements
2123
+ 3. Check existing specs — if >50% domain overlap, UPDATE existing spec instead
2124
+ 4. Update the WorkGroup file with spec status
2125
+
2126
+ ## STOP
2127
+
2128
+ Present all drafted specs for user approval. Do NOT proceed until approved.
2129
+
2130
+ **After approval:** Commit the specs as a pre-implementation checkpoint: `git commit -m "specs: draft specs for {WorkGroupID}"`
2131
+
2132
+ **Next step:** `#prompt:kc-implement`
2133
+ ```
2134
+
2135
+ #### kc-implement.prompt.md
2136
+
2137
+ ```markdown
2138
+ ---
2139
+ agent: "agent"
2140
+ description: "TDD implementation with verification loop (Phase 2A)"
2141
+ ---
2142
+
2143
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2144
+
2145
+ # KnowzCode: Phase 2A — Implementation
2146
+
2147
+ You are implementing the approved specifications using strict TDD.
2148
+
2149
+ ## Context
2150
+
2151
+ - #file:knowzcode/knowzcode_loop.md
2152
+ - #file:knowzcode/knowzcode_tracker.md
2153
+
2154
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
2155
+ Then read:
2156
+ - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
2157
+ - All spec files listed in the Change Set from `knowzcode/specs/`
2158
+
2159
+ ## Instructions
2160
+
2161
+ Follow Phase 2A from `knowzcode/knowzcode_loop.md`:
2162
+
2163
+ For EACH feature/criterion in the specs:
2164
+ 1. **RED**: Write a failing test that defines expected behavior. Run test → confirm FAIL
2165
+ 2. **GREEN**: Write MINIMAL code to make the test pass. Run test → confirm PASS
2166
+ 3. **REFACTOR**: Clean up while keeping all tests green
2167
+
2168
+ ### Verification Loop (must pass before reporting complete)
2169
+
2170
+ 1. Run all tests → if FAIL: fix and restart
2171
+ 2. Run static analysis → if issues: fix and restart
2172
+ 3. Run build → if FAIL: fix and restart
2173
+ 4. Verify all VERIFY: criteria from specs → if unmet: implement and restart
2174
+ 5. All checks pass → report complete
2175
+
2176
+ Maximum 10 iterations. If exceeded, report blocker.
2177
+
2178
+ ### Spec Issues
2179
+
2180
+ If you discover a spec is incorrect during implementation:
2181
+ - Tag `[SPEC_ISSUE]` in the WorkGroup file with details
2182
+ - Continue with best judgment
2183
+ - Report in completion summary
2184
+
2185
+ ## STOP
2186
+
2187
+ Report implementation results: test counts, verification iterations, criteria status.
2188
+
2189
+ **Next step:** `#prompt:kc-audit`
2190
+ ```
2191
+
2192
+ #### kc-audit.prompt.md
2193
+
2194
+ ```markdown
2195
+ ---
2196
+ agent: "agent"
2197
+ description: "READ-ONLY completeness audit against specs (Phase 2B)"
2198
+ ---
2199
+
2200
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2201
+
2202
+ # KnowzCode: Phase 2B — Completeness Audit
2203
+
2204
+ You are performing an independent, READ-ONLY audit of the implementation.
2205
+
2206
+ ## Context
2207
+
2208
+ - #file:knowzcode/knowzcode_loop.md
2209
+ - #file:knowzcode/knowzcode_tracker.md
2210
+
2211
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
2212
+ Then read:
2213
+ - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
2214
+ - All spec files listed in the Change Set from `knowzcode/specs/`
2215
+ - The implementation files listed in the Change Set
2216
+
2217
+ ## Instructions
2218
+
2219
+ Follow Phase 2B from `knowzcode/knowzcode_loop.md`:
2220
+
2221
+ **CRITICAL: This is a READ-ONLY audit. Do NOT modify any source files.**
2222
+
2223
+ 1. For each NodeID, compare implementation against every VERIFY statement in its spec
2224
+ 2. Calculate objective completion percentage per NodeID and overall
2225
+ 3. Identify gaps: missing features, incomplete criteria, untested paths
2226
+ 4. Check for security concerns: input validation, authentication, data exposure
2227
+ 5. Check for orphan code: implementation not covered by any spec
2228
+ 6. Assess risk for any gaps found
2229
+
2230
+ ### Standalone Audit Types
2231
+
2232
+ If the user specifies an audit type instead of a WorkGroup audit:
2233
+ - **spec**: Audit spec quality — completeness, VERIFY statement coverage, format compliance
2234
+ - **architecture**: Compare architecture doc against actual codebase structure
2235
+ - **security**: Focused security review — OWASP top 10, input validation, auth flows
2236
+ - **integration**: Check integration points, API contracts, dependency health
2237
+
2238
+ ## STOP
2239
+
2240
+ Present audit results with completion percentage, gap list, and risk assessment.
2241
+
2242
+ **User decides:**
2243
+ - Return to `#prompt:kc-implement` to fix gaps
2244
+ - Accept and proceed to `#prompt:kc-finalize`
2245
+ - Modify specs to match implementation
2246
+ - Cancel the WorkGroup
2247
+ ```
2248
+
2249
+ #### kc-finalize.prompt.md
2250
+
2251
+ ```markdown
2252
+ ---
2253
+ agent: "agent"
2254
+ description: "Finalize WorkGroup — update specs, tracker, log, commit (Phase 3)"
2255
+ ---
2256
+
2257
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2258
+
2259
+ # KnowzCode: Phase 3 — Finalization
2260
+
2261
+ You are finalizing the WorkGroup after approved implementation and audit.
2262
+
2263
+ ## Context
2264
+
2265
+ - #file:knowzcode/knowzcode_loop.md
2266
+ - #file:knowzcode/knowzcode_tracker.md
2267
+ - #file:knowzcode/knowzcode_architecture.md
2268
+
2269
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
2270
+ Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
2271
+
2272
+ ## Instructions
2273
+
2274
+ Follow Phase 3 from `knowzcode/knowzcode_loop.md`:
2275
+
2276
+ 1. **Finalize Specs**: Update each `knowzcode/specs/{NodeID}.md` to as-built state (Status: As-Built)
2277
+ 2. **Architecture Check**: Compare `knowzcode/knowzcode_architecture.md` against the Change Set. Fix simple discrepancies directly; document complex ones for user review
2278
+ 3. **Log Entry**: Prepend an `ARC-Completion` entry to `knowzcode/knowzcode_log.md` with WorkGroupID, NodeIDs, verification summary, architectural learnings, and ripple effects
2279
+ 4. **Update Tracker**: Change NodeID statuses from `[WIP]` to `[VERIFIED]` in `knowzcode/knowzcode_tracker.md`. Create `REFACTOR_` tasks for significant tech debt
2280
+ 5. **Final Commit**: Stage and commit all changes (source + knowzcode files)
2281
+ 6. **Close WorkGroup**: Mark the WorkGroup file as closed
2282
+
2283
+ ## Output
2284
+
2285
+ Report completion with summary of what was delivered and any `REFACTOR_` tasks created.
2286
+ ```
2287
+
2288
+ #### kc-fix.prompt.md
2289
+
2290
+ ```markdown
2291
+ ---
2292
+ agent: "agent"
2293
+ description: "Quick targeted fix using micro-fix protocol"
2294
+ argument-hint: "Describe the bug or issue to fix"
2295
+ ---
2296
+
2297
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2298
+
2299
+ # KnowzCode: Micro-Fix
2300
+
2301
+ You are performing a quick, targeted fix using the micro-fix protocol.
2302
+
2303
+ ## Context
2304
+
2305
+ - #file:knowzcode/knowzcode_loop.md
2306
+
2307
+ ## Scope Guard
2308
+
2309
+ This workflow is for changes that are:
2310
+ - **Single file** (or minimal multi-file with no ripple effects)
2311
+ - **<50 lines** changed
2312
+ - **No architectural impact**
2313
+
2314
+ If the fix exceeds this scope, inform the user and suggest `#prompt:kc-work` instead.
2315
+
2316
+ ## Instructions
2317
+
2318
+ Follow the Micro-Fix Protocol from `knowzcode/knowzcode_loop.md` Section 4:
2319
+
2320
+ 1. **Implement** the fix
2321
+ 2. **Test** — run targeted tests for the affected code
2322
+ 3. **Log** — prepend a `MicroFix` entry to `knowzcode/knowzcode_log.md`:
2323
+ - Type: MicroFix
2324
+ - File/NodeID affected
2325
+ - User request, action taken, verification outcome
2326
+ 4. **Commit** with `fix: {description}` message
2327
+ ```
2328
+
2329
+ #### kc-plan.prompt.md
2330
+
2331
+ ```markdown
2332
+ ---
2333
+ agent: "agent"
2334
+ description: "Research and investigate before implementing"
2335
+ argument-hint: "Describe the topic to research"
2336
+ ---
2337
+
2338
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2339
+
2340
+ # KnowzCode: Plan / Investigate
2341
+
2342
+ You are researching a topic before implementation. This is an investigation workflow, not a build workflow.
2343
+
2344
+ ## Context
2345
+
2346
+ - #file:knowzcode/knowzcode_loop.md
2347
+ - #file:knowzcode/knowzcode_project.md
2348
+ - #file:knowzcode/knowzcode_architecture.md
2349
+
2350
+ ## Instructions
2351
+
2352
+ The user's research topic is provided in the chat message.
2353
+
2354
+ 1. **Explore the codebase** — search for relevant files, patterns, and existing implementations
2355
+ 2. **Read existing specs** — check `knowzcode/specs/` for related components
2356
+ 3. **Check history** — scan `knowzcode/workgroups/` for past WorkGroups that touched similar areas
2357
+ 4. **Analyze architecture** — review `knowzcode/knowzcode_architecture.md` for structural context
2358
+ 5. **Present findings** with:
2359
+ - Current state of the relevant code
2360
+ - Existing patterns and conventions
2361
+ - Options for implementation (with trade-offs)
2362
+ - Recommended approach
2363
+
2364
+ ## STOP
2365
+
2366
+ Present research findings and recommendations.
2367
+
2368
+ **To implement:** Tell the user to invoke `#prompt:kc-work` with their chosen approach.
2369
+ ```
2370
+
2371
+ #### kc-continue.prompt.md
2372
+
2373
+ ```markdown
2374
+ ---
2375
+ agent: "agent"
2376
+ description: "Resume interrupted work or advance to next phase"
2377
+ ---
2378
+
2379
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
2380
+
2381
+ # KnowzCode: Continue / Resume
2382
+
2383
+ You are resuming an interrupted KnowzCode workflow or advancing to the next phase.
2384
+
2385
+ ## Context
2386
+
2387
+ - #file:knowzcode/knowzcode_loop.md
2388
+ - #file:knowzcode/knowzcode_tracker.md
2389
+
2390
+ ## Instructions
2391
+
2392
+ ### Step 1: Find Active WorkGroup
2393
+
2394
+ Read `knowzcode/knowzcode_tracker.md` and find entries with `[WIP]` status.
2395
+
2396
+ - **One active WorkGroup**: Use it
2397
+ - **Multiple active**: Present the list and ask the user which to resume
2398
+ - **None active**: Inform the user and suggest `#prompt:kc-work`
2399
+
2400
+ ### Step 2: Determine Current Phase
2401
+
2402
+ Read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
2403
+ Check the Phase History table to determine the current state.
2404
+
2405
+ ### Step 3: Resume or Advance
2406
+
2407
+ | WorkGroup State | Action |
2408
+ |----------------|--------|
2409
+ | Phase 1A in progress | Complete the impact analysis, present Change Set |
2410
+ | Phase 1A complete, awaiting approval | Present Change Set for approval |
2411
+ | Phase 1A approved, specs not started | Begin Phase 1B — draft specs |
2412
+ | Phase 1B in progress | Complete spec drafting |
2413
+ | Phase 1B complete, awaiting approval | Present specs for approval |
2414
+ | Phase 1B approved, implementation not started | Begin Phase 2A — TDD implementation |
2415
+ | Phase 2A in progress | Resume implementation from outstanding todos |
2416
+ | Phase 2A complete | Advise: `#prompt:kc-audit` |
2417
+ | Phase 2B complete, gaps found | Present options: fix gaps or accept |
2418
+ | Phase 2B complete, no gaps | Begin Phase 3 — finalization |
2419
+ | Phase 3 in progress | Complete finalization |
2420
+
2421
+ ### Step 4: Present Status
2422
+
2423
+ ```
2424
+ ## Resuming WorkGroup: {WorkGroupID}
2425
+
2426
+ **Goal**: {primary goal}
2427
+ **Phase**: {current phase}
2428
+ **NodeIDs**: {list}
2429
+
2430
+ **Outstanding Work**:
2431
+ {list from WorkGroup file}
2432
+
2433
+ Continuing from where we left off...
2434
+ ```
2435
+
2436
+ Then proceed with the appropriate phase instructions from `knowzcode/knowzcode_loop.md`.
2437
+ ```
2438
+
2439
+ ### C. .vscode/mcp.json Template
2440
+
2441
+ Optionally generated by `/kc:init` when Copilot is detected and MCP is configured:
2442
+
2443
+ ```json
2444
+ {
2445
+ "servers": {
2446
+ "knowz": {
2447
+ "type": "http",
2448
+ "url": "${input:knowz_mcp_url}",
2449
+ "headers": {
2450
+ "x-api-key": "${input:knowz_api_key}"
2451
+ }
2452
+ }
2453
+ },
2454
+ "inputs": [
2455
+ {
2456
+ "id": "knowz_mcp_url",
2457
+ "description": "KnowzCode MCP server URL",
2458
+ "type": "promptString"
2459
+ },
2460
+ {
2461
+ "id": "knowz_api_key",
2462
+ "description": "KnowzCode API key",
2463
+ "type": "promptString",
2464
+ "password": true
2465
+ }
2466
+ ]
2467
+ }
2468
+ ```
2469
+
2470
+ ### D. Copilot-Specific Notes
2471
+
2472
+ **VS Code usage:**
2473
+ - Invoke prompts via `#prompt:kc-work`, `#prompt:kc-specify`, etc. in Copilot Chat
2474
+ - Add extra files to context with `#file:path/to/file` in the chat message
2475
+ - All prompt files use `agent: "agent"` frontmatter for file editing and terminal access
2476
+ - Model can be selected per session — prefer stronger models for analysis/audit phases
2477
+
2478
+ **Copilot CLI fallback:**
2479
+ - CLI does not support `#prompt:` syntax
2480
+ - Check current CLI documentation for file reference syntax — it may differ from VS Code
2481
+ - Alternatively, reference the methodology directly or paste prompt content into the CLI
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
+
2488
+ **Copilot Coding Agent:**
2489
+ - Follows `.github/copilot-instructions.md` automatically when processing GitHub issues
2490
+ - Runs all phases autonomously — quality gates deferred to PR review
2491
+ - Does not use prompt files (uses repository instructions only)
2492
+
2493
+ **Execution model:**
2494
+ - See `knowzcode/copilot_execution.md` for the full execution guide
2495
+ - Single-agent, sequential execution — user manually transitions between phases
2496
+ - No multi-agent orchestration (no Parallel Teams, no agent spawning)
2497
+ - WorkGroup files carry state between prompt invocations
2498
+
2499
+ ---
2500
+
2501
+ ## Windsurf (`.windsurf/rules/knowzcode.md`)
2502
+
2503
+ Create `.windsurf/rules/knowzcode.md`. Notes: Modern Windsurf uses the `.windsurf/rules/` directory instead of the deprecated `.windsurfrules` file. Cascade multi-file editing works well with KnowzCode's cross-component implementation phases. Windsurf also supports `.windsurf/workflows/*.md` for custom commands invoked as `/workflow-name` — KnowzCode workflows can be defined as individual workflow files for each phase.
2504
+
2505
+ ```markdown
2506
+ # KnowzCode Development Methodology
2507
+
2508
+ This project uses KnowzCode for structured TDD development.
2509
+ Follow `knowzcode/knowzcode_loop.md` for all feature development.
2510
+
2511
+ ## Required Reading
2512
+ - `knowzcode/knowzcode_loop.md` — Complete methodology
2513
+ - `knowzcode/knowzcode_project.md` — Project context
2514
+ - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
2515
+ - `knowzcode/knowzcode_architecture.md` — Architecture docs
2516
+
2517
+ ## Phase Walkthrough
2518
+
2519
+ ### Phase 1A: Impact Analysis
2520
+ - Identify affected components, propose Change Set with NodeIDs
2521
+ - Check existing specs before creating new ones
2522
+ - PAUSE for user approval
2523
+
2524
+ ### Phase 1B: Specification
2525
+ - Draft specs with 4-section format and 2+ VERIFY statements
2526
+ - PAUSE for approval, then commit specs
2527
+
2528
+ ### Phase 2A: Implementation (TDD Mandatory)
2529
+ - Write failing test FIRST, then minimal code, then refactor
2530
+ - Use Cascade for multi-file edits across components
2531
+ - Run full verification loop (tests + linter + build)
2532
+ - PAUSE after implementation
2533
+
2534
+ ### Phase 2B: Audit
2535
+ - READ-ONLY audit against spec VERIFY statements
2536
+ - Report completion %, gaps, security concerns
2537
+ - PAUSE for user decision
2538
+
2539
+ ### Phase 3: Finalization
2540
+ - Update specs to As-Built, tracker, log, architecture
2541
+ - Final commit
2542
+
2543
+ ## Enforcement Rules
2544
+ - TDD is mandatory — write failing tests before implementation code
2545
+ - Respect quality gates between phases — PAUSE at each gate
2546
+ - Update `knowzcode/knowzcode_tracker.md` when completing work
2547
+ - Log completions in `knowzcode/knowzcode_log.md`
2548
+ - Consolidate specs when domains overlap >50%
2549
+ - Target <20 specs per project
2550
+ - Every WorkGroup todo starts with `KnowzCode:` prefix
2551
+
2552
+ ## Knowledge Capture (CRITICAL — DO NOT SKIP)
2553
+ Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
2554
+ When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
2555
+ When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
2556
+ Use `/kc:learn "insight"` for automatic routing.
2557
+ Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
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
+
2564
+ ## Micro-Fix (for small changes)
2565
+ Single file, <50 lines, no ripple effects:
2566
+ Implement → Test → Log MicroFix → Commit with `fix:` prefix
2567
+ ```
2568
+
2569
+ ---
2570
+
2571
+ ## OpenAI Codex Agents SDK (Python)
2572
+
2573
+ For teams building custom orchestration with the OpenAI Agents SDK,
2574
+ map KnowzCode's 5 phase agents to SDK Agent definitions. The AGENTS.md
2575
+ file above provides all instructions each agent needs. See the
2576
+ [Agents SDK documentation](https://openai.github.io/openai-agents-python/)
2577
+ for implementation details.