knowzcode 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +354 -320
  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 -95
  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 +1199 -956
  20. package/commands/audit.md +328 -328
  21. package/commands/connect-mcp.md +549 -549
  22. package/commands/fix.md +107 -107
  23. package/commands/init.md +500 -439
  24. package/commands/learn.md +332 -332
  25. package/commands/plan.md +272 -272
  26. package/commands/register.md +733 -733
  27. package/commands/status.md +309 -309
  28. package/commands/telemetry-setup.md +368 -368
  29. package/commands/telemetry.md +188 -188
  30. package/commands/work.md +1204 -1170
  31. package/knowzcode/automation_manifest.md +59 -59
  32. package/knowzcode/claude_code_execution.md +431 -420
  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 +596 -593
  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 +191 -191
  48. package/knowzcode/planning/Readme.md +6 -6
  49. package/knowzcode/platform_adapters.md +1260 -1047
  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,1047 +1,1260 @@
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
- ---
180
-
181
- ## Google Gemini CLI (GEMINI.md)
182
-
183
- Create `GEMINI.md` in project root. Notes: Gemini CLI supports `@file.md` imports for pulling in methodology files (e.g., `@knowzcode/knowzcode_loop.md`). User-global preferences can be placed in `~/.gemini/GEMINI.md`.
184
-
185
- ### Native Commands (`.gemini/commands/kc/*.toml`)
186
-
187
- Gemini CLI (2026) supports native custom commands via TOML files in `.gemini/commands/`. Subdirectory namespacing gives the `/kc:` prefix automatically:
188
-
189
- ```toml
190
- # .gemini/commands/kc/work.toml
191
- description = "Start a new KnowzCode development workflow"
192
- prompt = """Read knowzcode/knowzcode_loop.md. Follow Phase 1A→3 workflow for:
193
- <ARGS/>
194
- Read knowzcode/knowzcode_project.md for project context.
195
- Read knowzcode/knowzcode_tracker.md for active work."""
196
- ```
197
-
198
- ```toml
199
- # .gemini/commands/kc/plan.toml
200
- description = "Research before implementing"
201
- prompt = """Read knowzcode/knowzcode_loop.md and knowzcode/knowzcode_project.md.
202
- Investigate the codebase for: <ARGS/>
203
- Present findings with options. Say 'implement' to transition to /kc:work."""
204
- ```
205
-
206
- ```toml
207
- # .gemini/commands/kc/fix.toml
208
- description = "Quick targeted fix (micro-fix workflow)"
209
- prompt = """Read knowzcode/knowzcode_loop.md section on Micro-Fix.
210
- Apply a targeted fix for: <ARGS/>
211
- Run tests, log a MicroFix entry, commit with fix: prefix."""
212
- ```
213
-
214
- ```toml
215
- # .gemini/commands/kc/audit.toml
216
- description = "Run quality audit against specs"
217
- prompt = """Read knowzcode/knowzcode_loop.md Phase 2B.
218
- Perform a READ-ONLY audit comparing implementation against specs in knowzcode/specs/.
219
- Report completion percentage, gaps, and security concerns for: <ARGS/>"""
220
- ```
221
-
222
- Gemini also supports extensions (`gemini-extension.json`) for tool integration and `@file.md` imports for including methodology files directly in prompts.
223
-
224
- ```markdown
225
- # KnowzCode Development Methodology
226
-
227
- This project uses KnowzCode for structured TDD development.
228
-
229
- ## Required Reading
230
- Read these files before starting any feature work (use @import syntax for direct inclusion):
231
- - `knowzcode/knowzcode_loop.md` Complete workflow methodology
232
- - `knowzcode/knowzcode_project.md` — Project context and tech stack
233
- - `knowzcode/knowzcode_architecture.md` — Architecture documentation
234
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
235
-
236
- ## Phase Walkthrough
237
-
238
- ### Phase 1A: Impact Analysis
239
- - Identify components affected by the goal
240
- - Create NodeIDs for new capabilities (PascalCase domain concepts)
241
- - Check existing specs for domain overlap before creating new ones
242
- - Present Change Set for user approval STOP until approved
243
-
244
- ### Phase 1B: Specification
245
- - Draft specs using 4-section format (Rules, Interfaces, Verification Criteria, Debt)
246
- - Each spec needs 2+ VERIFY statements
247
- - Present for approval — STOP until approved
248
- - Commit specs as a pre-implementation checkpoint
249
-
250
- ### Phase 2A: Implementation (TDD Required)
251
- - Follow Red-Green-Refactor for every feature
252
- - Write failing test FIRST, then minimal code to pass, then refactor
253
- - Run full test suite + linter + build when all features done
254
- - STOP and report results
255
-
256
- ### Phase 2B: Completeness Audit
257
- - READ-ONLY comparison of implementation vs specs
258
- - Calculate completion percentage
259
- - Report gaps and security concerns
260
- - STOP for user decision
261
-
262
- ### Phase 3: Finalization
263
- - Update specs to As-Built, update tracker, write log entry
264
- - Check architecture doc for drift
265
- - Final commit
266
-
267
- ## Rules
268
- - Follow quality gates strictly STOP at each gate for user approval
269
- - TDD is mandatory for all feature work
270
- - Propose Change Sets before implementing
271
- - Update specs and tracker after implementation
272
- - Log completions in `knowzcode/knowzcode_log.md`
273
- - Target <20 specs — consolidate when domains overlap >50%
274
-
275
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
276
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
277
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
278
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
279
- Use `/kc:learn "insight"` for automatic routing.
280
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
281
-
282
- ## Micro-Fix (for small changes)
283
- Single file, <50 lines, no ripple effects:
284
- 1. Implement fix → 2. Run tests → 3. Log MicroFix → 4. Commit with `fix:`
285
- ```
286
-
287
- ---
288
-
289
- ## Cursor (`.cursor/rules/knowzcode.mdc`)
290
-
291
- 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.
292
-
293
- ```markdown
294
- ---
295
- description: KnowzCode TDD development methodology
296
- alwaysApply: true
297
- ---
298
-
299
- # KnowzCode Rules
300
-
301
- This project uses KnowzCode for structured TDD development.
302
-
303
- ## Required Reading
304
- Before any feature work, read:
305
- - `knowzcode/knowzcode_loop.md` — Complete methodology
306
- - `knowzcode/knowzcode_project.md` — Project context
307
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
308
- - `knowzcode/knowzcode_architecture.md` Architecture docs
309
-
310
- ## Phase Rules
311
-
312
- ### Phase 1A: Impact Analysis
313
- - Identify affected components and propose a Change Set
314
- - NodeIDs are domain concepts (PascalCase), not tasks
315
- - Check `knowzcode/specs/` before creating new specs
316
- - PAUSE for user approval before proceeding
317
-
318
- ### Phase 1B: Specification
319
- - Use 4-section format: Rules & Decisions, Interfaces, Verification Criteria, Debt & Gaps
320
- - Minimum: 2+ VERIFY statements per spec
321
- - PAUSE for user approval, then commit specs
322
-
323
- ### Phase 2A: Implementation
324
- - TDD is mandatory: write failing test FIRST, then minimal code, then refactor
325
- - Use Composer for multi-file edits when implementing across components
326
- - Run full test suite before reporting complete
327
- - PAUSE after implementation
328
-
329
- ### Phase 2B: Audit
330
- - READ-ONLY — do not modify source files
331
- - Compare implementation vs spec VERIFY statements
332
- - Report completion percentage and gaps
333
- - PAUSE for user decision
334
-
335
- ### Phase 3: Finalization
336
- - Update specs to As-Built status
337
- - Update tracker and log
338
- - Check architecture for drift
339
- - Final commit
340
-
341
- ## Enforcement
342
- - Never skip phases or quality gates
343
- - TDD is mandatory no production code without a failing test
344
- - Every WorkGroup todo starts with `KnowzCode:` prefix
345
- - Consolidate specs when domains overlap >50%
346
- - Target <20 specs per project
347
- - Read `knowzcode/knowzcode_tracker.md` for active work
348
- - Log completions in `knowzcode/knowzcode_log.md`
349
-
350
- ## Knowledge Capture (CRITICAL DO NOT SKIP)
351
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
352
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
353
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
354
- Use `/kc:learn "insight"` for automatic routing.
355
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
356
- ```
357
-
358
- ---
359
-
360
- ## GitHub Copilot (.github/copilot-instructions.md + .github/prompts/*.prompt.md)
361
-
362
- GitHub Copilot (2026) supports three instruction mechanisms used by KnowzCode:
363
-
364
- 1. **`.github/copilot-instructions.md`** — Repository-level instructions, always active
365
- 2. **`.github/prompts/*.prompt.md`** — Custom prompts invocable via `#prompt:name` in VS Code
366
- 3. **MCP server tools** (`.vscode/mcp.json`) — Tool access for vault queries
367
-
368
- 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.
369
-
370
- ### A. copilot-instructions.md
371
-
372
- Create `.github/copilot-instructions.md`:
373
-
374
- ```markdown
375
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
376
-
377
- # KnowzCode Development Methodology
378
-
379
- This repository uses KnowzCode for structured TDD development with quality gates.
380
-
381
- ## Required Reading
382
- - `knowzcode/knowzcode_loop.md` Complete methodology (read first)
383
- - `knowzcode/knowzcode_project.md` — Project context and tech stack
384
- - `knowzcode/knowzcode_architecture.md` — Architecture documentation
385
- - `knowzcode/knowzcode_tracker.md` — WorkGroup status tracking
386
-
387
- ## Workflow Overview
388
-
389
- KnowzCode follows a 5-phase development loop with quality gates between each phase.
390
- Use the prompt files in `.github/prompts/` to invoke each phase:
391
-
392
- | Phase | Prompt | Description |
393
- |-------|--------|-------------|
394
- | Full workflow | `#prompt:kc-work` | Start a new feature — creates WorkGroup, classifies tier, runs Phase 1A |
395
- | 1A: Analysis | `#prompt:kc-analyze` | Re-run impact analysis on existing WorkGroup |
396
- | 1B: Specification | `#prompt:kc-specify` | Draft specs from approved Change Set |
397
- | 2A: Implementation | `#prompt:kc-implement` | TDD implementation with verification loop |
398
- | 2B: Audit | `#prompt:kc-audit` | READ-ONLY audit against specs |
399
- | 3: Finalization | `#prompt:kc-finalize` | Update specs, tracker, log, commit |
400
- | Quick fix | `#prompt:kc-fix` | Micro-fix for small, scoped changes |
401
- | Research | `#prompt:kc-plan` | Investigate before implementing |
402
- | Resume | `#prompt:kc-continue` | Resume or advance to next phase |
403
-
404
- ### Typical Flow
405
-
406
- 1. `#prompt:kc-work "Build JWT authentication"` Creates WorkGroup, proposes Change Set, **STOPs**
407
- 2. Approve Change Set
408
- 3. `#prompt:kc-specify` → Drafts specs, **STOPs**
409
- 4. Approve specs
410
- 5. `#prompt:kc-implement` → TDD Red-Green-Refactor, **STOPs**
411
- 6. `#prompt:kc-audit` READ-ONLY audit, reports gaps, **STOPs**
412
- 7. `#prompt:kc-finalize` Updates docs, commits
413
-
414
- Use `#prompt:kc-continue` at any point to resume where you left off.
415
-
416
- ## Quality Gates
417
-
418
- STOP and await user approval at each gate:
419
- - After Change Set proposal (1A)
420
- - After spec drafts (1B)
421
- - After implementation complete (2A awaiting audit)
422
- - After audit results (2B user decides on gaps)
423
-
424
- ## TDD Enforcement
425
-
426
- TDD is mandatory — no production code without a failing test first.
427
- Follow Red-Green-Refactor for every feature/criterion in the spec.
428
-
429
- ## Key Rules
430
- - NodeIDs are domain concepts (PascalCase), not tasks
431
- - Consolidate specs when domains overlap >50%
432
- - Every WorkGroup todo starts with `KnowzCode:` prefix
433
- - Target <20 specs per project
434
- - Log completions in `knowzcode/knowzcode_log.md`
435
-
436
- ## Key Files
437
- - `knowzcode/knowzcode_loop.md` — Methodology
438
- - `knowzcode/knowzcode_project.md` Project context
439
- - `knowzcode/knowzcode_architecture.md` — Architecture docs
440
- - `knowzcode/knowzcode_tracker.md` WorkGroup tracking
441
- - `knowzcode/specs/` — Component specifications
442
- - `knowzcode/workgroups/` — Active session data (gitignored)
443
-
444
- ## MCP Integration
445
-
446
- If configured in `.vscode/mcp.json`, use `search_knowledge` and `ask_question` tools
447
- for enhanced context from knowledge vaults. All prompts work without MCP.
448
-
449
- ## Knowledge Capture (CRITICAL — DO NOT SKIP)
450
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
451
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
452
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
453
- Use `/kc:learn "insight"` for automatic routing.
454
- Vault entries are retrieved via semantic search write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
455
-
456
- ## Copilot Coding Agent
457
-
458
- When the Copilot Coding Agent works on GitHub issues for this repository:
459
- - Read `knowzcode/knowzcode_loop.md` and this file for methodology
460
- - Follow Phase 1A→3 workflow for any non-trivial change
461
- - Include the Change Set in the PR description
462
- - Use TDD — failing test before implementation code
463
- - Self-audit against spec VERIFY statements before marking PR ready
464
- - Quality gates are deferred to PR review (no interactive approval in async mode)
465
-
466
- ## Model Selection
467
- - Complex phases (1A analysis, 1B spec drafting, 2B audit): Use Claude Opus or GPT-4o
468
- - Implementation (2A): Any capable model with good code generation
469
- - Quick fixes: Any model
470
- ```
471
-
472
- ### B. Prompt File Templates (.github/prompts/)
473
-
474
- Each prompt file is invocable via `#prompt:kc-*` in VS Code Copilot Chat. All use `agent: "agent"` for file editing capability.
475
-
476
- #### kc-work.prompt.md
477
-
478
- ```markdown
479
- ---
480
- agent: "agent"
481
- description: "Start a new KnowzCode development workflow"
482
- argument-hint: "Describe the feature or goal to build"
483
- ---
484
-
485
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
486
-
487
- # KnowzCode: Start Workflow
488
-
489
- You are starting a new KnowzCode development workflow. Follow the methodology precisely.
490
-
491
- ## Context
492
-
493
- Read these files for methodology and project context:
494
- - #file:knowzcode/knowzcode_loop.md
495
- - #file:knowzcode/knowzcode_project.md
496
- - #file:knowzcode/knowzcode_tracker.md
497
- - #file:knowzcode/knowzcode_architecture.md
498
-
499
- ## Instructions
500
-
501
- The user's goal is provided in the chat message.
502
-
503
- ### Step 1: Classify Tier
504
-
505
- Based on the goal, classify complexity:
506
- - **Micro** (single file, <50 lines, no ripple): Redirect to `#prompt:kc-fix`
507
- - **Light** (≤3 files, straightforward): Streamlined 2-phase path
508
- - **Full** (>3 files or complex): Complete 5-phase workflow
509
-
510
- ### Step 2: Create Draft WorkGroup
511
-
512
- Generate a WorkGroupID: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
513
- Create a draft WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` to store the analysis output.
514
-
515
- ### Step 3: Phase 1A — Impact Analysis
516
-
517
- Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
518
- 1. Identify the Change Set all components affected by this change
519
- 2. Create NodeIDs for NEW capabilities only (domain concepts, PascalCase)
520
- 3. Check `knowzcode/specs/` for existing specs with domain overlap
521
- 4. Scan `knowzcode/workgroups/` for completed WorkGroups with relevant context
522
- 5. Propose the Change Set with NodeIDs, affected files, and risk assessment
523
-
524
- ## STOP
525
-
526
- Present the Change Set for user approval. Do NOT proceed until approved.
527
-
528
- **After approval:** Update `knowzcode/knowzcode_tracker.md` with new NodeIDs as `[WIP]`, then tell the user to invoke `#prompt:kc-specify` to draft specifications.
529
- ```
530
-
531
- #### kc-analyze.prompt.md
532
-
533
- ```markdown
534
- ---
535
- agent: "agent"
536
- description: "Re-run Phase 1A impact analysis on existing WorkGroup"
537
- ---
538
-
539
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
540
-
541
- # KnowzCode: Phase 1A — Impact Analysis
542
-
543
- You are re-running impact analysis on an existing WorkGroup.
544
-
545
- ## Context
546
-
547
- - #file:knowzcode/knowzcode_loop.md
548
- - #file:knowzcode/knowzcode_tracker.md
549
-
550
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
551
- Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
552
-
553
- ## Instructions
554
-
555
- Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
556
- 1. Re-analyze the goal from the WorkGroup file
557
- 2. Identify all affected components check for changes since last analysis
558
- 3. Update NodeIDs if scope has changed
559
- 4. Check `knowzcode/specs/` for existing specs with domain overlap
560
- 5. Update the Change Set in the WorkGroup file
561
-
562
- ## STOP
563
-
564
- Present the updated Change Set for user approval.
565
-
566
- **Next step after approval:** `#prompt:kc-specify`
567
- ```
568
-
569
- #### kc-specify.prompt.md
570
-
571
- ```markdown
572
- ---
573
- agent: "agent"
574
- description: "Draft specifications from approved Change Set (Phase 1B)"
575
- ---
576
-
577
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
578
-
579
- # KnowzCode: Phase 1BSpecification
580
-
581
- You are drafting specifications for the approved Change Set.
582
-
583
- ## Context
584
-
585
- - #file:knowzcode/knowzcode_loop.md
586
- - #file:knowzcode/knowzcode_tracker.md
587
-
588
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
589
- If no `[WIP]` entries found, scan `knowzcode/workgroups/` for the most recent draft WorkGroup file.
590
- Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` for the approved Change Set.
591
-
592
- ## Instructions
593
-
594
- Follow Phase 1B from `knowzcode/knowzcode_loop.md`:
595
-
596
- For each NodeID in the approved Change Set:
597
- 1. Draft `knowzcode/specs/{NodeID}.md` using the 4-section format:
598
- - **Rules & Decisions** Key architectural decisions, business rules, constraints
599
- - **Interfaces** — Public contracts: inputs, outputs, API signatures, dependencies
600
- - **Verification Criteria** — Testable `VERIFY:` assertions (minimum 2 per spec)
601
- - **Debt & Gaps** — Known limitations and future work
602
- 2. Minimum valid spec: 1+ Rules, 1+ Interface, 2+ VERIFY statements
603
- 3. Check existing specs if >50% domain overlap, UPDATE existing spec instead
604
- 4. Update the WorkGroup file with spec status
605
-
606
- ## STOP
607
-
608
- Present all drafted specs for user approval. Do NOT proceed until approved.
609
-
610
- **After approval:** Commit the specs as a pre-implementation checkpoint: `git commit -m "specs: draft specs for {WorkGroupID}"`
611
-
612
- **Next step:** `#prompt:kc-implement`
613
- ```
614
-
615
- #### kc-implement.prompt.md
616
-
617
- ```markdown
618
- ---
619
- agent: "agent"
620
- description: "TDD implementation with verification loop (Phase 2A)"
621
- ---
622
-
623
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
624
-
625
- # KnowzCode: Phase 2A Implementation
626
-
627
- You are implementing the approved specifications using strict TDD.
628
-
629
- ## Context
630
-
631
- - #file:knowzcode/knowzcode_loop.md
632
- - #file:knowzcode/knowzcode_tracker.md
633
-
634
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
635
- Then read:
636
- - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
637
- - All spec files listed in the Change Set from `knowzcode/specs/`
638
-
639
- ## Instructions
640
-
641
- Follow Phase 2A from `knowzcode/knowzcode_loop.md`:
642
-
643
- For EACH feature/criterion in the specs:
644
- 1. **RED**: Write a failing test that defines expected behavior. Run test → confirm FAIL
645
- 2. **GREEN**: Write MINIMAL code to make the test pass. Run test → confirm PASS
646
- 3. **REFACTOR**: Clean up while keeping all tests green
647
-
648
- ### Verification Loop (must pass before reporting complete)
649
-
650
- 1. Run all tests → if FAIL: fix and restart
651
- 2. Run static analysis → if issues: fix and restart
652
- 3. Run build → if FAIL: fix and restart
653
- 4. Verify all VERIFY: criteria from specs → if unmet: implement and restart
654
- 5. All checks pass → report complete
655
-
656
- Maximum 10 iterations. If exceeded, report blocker.
657
-
658
- ### Spec Issues
659
-
660
- If you discover a spec is incorrect during implementation:
661
- - Tag `[SPEC_ISSUE]` in the WorkGroup file with details
662
- - Continue with best judgment
663
- - Report in completion summary
664
-
665
- ## STOP
666
-
667
- Report implementation results: test counts, verification iterations, criteria status.
668
-
669
- **Next step:** `#prompt:kc-audit`
670
- ```
671
-
672
- #### kc-audit.prompt.md
673
-
674
- ```markdown
675
- ---
676
- agent: "agent"
677
- description: "READ-ONLY completeness audit against specs (Phase 2B)"
678
- ---
679
-
680
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
681
-
682
- # KnowzCode: Phase 2B — Completeness Audit
683
-
684
- You are performing an independent, READ-ONLY audit of the implementation.
685
-
686
- ## Context
687
-
688
- - #file:knowzcode/knowzcode_loop.md
689
- - #file:knowzcode/knowzcode_tracker.md
690
-
691
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
692
- Then read:
693
- - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
694
- - All spec files listed in the Change Set from `knowzcode/specs/`
695
- - The implementation files listed in the Change Set
696
-
697
- ## Instructions
698
-
699
- Follow Phase 2B from `knowzcode/knowzcode_loop.md`:
700
-
701
- **CRITICAL: This is a READ-ONLY audit. Do NOT modify any source files.**
702
-
703
- 1. For each NodeID, compare implementation against every VERIFY statement in its spec
704
- 2. Calculate objective completion percentage per NodeID and overall
705
- 3. Identify gaps: missing features, incomplete criteria, untested paths
706
- 4. Check for security concerns: input validation, authentication, data exposure
707
- 5. Check for orphan code: implementation not covered by any spec
708
- 6. Assess risk for any gaps found
709
-
710
- ### Standalone Audit Types
711
-
712
- If the user specifies an audit type instead of a WorkGroup audit:
713
- - **spec**: Audit spec quality — completeness, VERIFY statement coverage, format compliance
714
- - **architecture**: Compare architecture doc against actual codebase structure
715
- - **security**: Focused security review — OWASP top 10, input validation, auth flows
716
- - **integration**: Check integration points, API contracts, dependency health
717
-
718
- ## STOP
719
-
720
- Present audit results with completion percentage, gap list, and risk assessment.
721
-
722
- **User decides:**
723
- - Return to `#prompt:kc-implement` to fix gaps
724
- - Accept and proceed to `#prompt:kc-finalize`
725
- - Modify specs to match implementation
726
- - Cancel the WorkGroup
727
- ```
728
-
729
- #### kc-finalize.prompt.md
730
-
731
- ```markdown
732
- ---
733
- agent: "agent"
734
- description: "Finalize WorkGroup update specs, tracker, log, commit (Phase 3)"
735
- ---
736
-
737
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
738
-
739
- # KnowzCode: Phase 3 Finalization
740
-
741
- You are finalizing the WorkGroup after approved implementation and audit.
742
-
743
- ## Context
744
-
745
- - #file:knowzcode/knowzcode_loop.md
746
- - #file:knowzcode/knowzcode_tracker.md
747
- - #file:knowzcode/knowzcode_architecture.md
748
-
749
- Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
750
- Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
751
-
752
- ## Instructions
753
-
754
- Follow Phase 3 from `knowzcode/knowzcode_loop.md`:
755
-
756
- 1. **Finalize Specs**: Update each `knowzcode/specs/{NodeID}.md` to as-built state (Status: As-Built)
757
- 2. **Architecture Check**: Compare `knowzcode/knowzcode_architecture.md` against the Change Set. Fix simple discrepancies directly; document complex ones for user review
758
- 3. **Log Entry**: Prepend an `ARC-Completion` entry to `knowzcode/knowzcode_log.md` with WorkGroupID, NodeIDs, verification summary, architectural learnings, and ripple effects
759
- 4. **Update Tracker**: Change NodeID statuses from `[WIP]` to `[VERIFIED]` in `knowzcode/knowzcode_tracker.md`. Create `REFACTOR_` tasks for significant tech debt
760
- 5. **Final Commit**: Stage and commit all changes (source + knowzcode files)
761
- 6. **Close WorkGroup**: Mark the WorkGroup file as closed
762
-
763
- ## Output
764
-
765
- Report completion with summary of what was delivered and any `REFACTOR_` tasks created.
766
- ```
767
-
768
- #### kc-fix.prompt.md
769
-
770
- ```markdown
771
- ---
772
- agent: "agent"
773
- description: "Quick targeted fix using micro-fix protocol"
774
- argument-hint: "Describe the bug or issue to fix"
775
- ---
776
-
777
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
778
-
779
- # KnowzCode: Micro-Fix
780
-
781
- You are performing a quick, targeted fix using the micro-fix protocol.
782
-
783
- ## Context
784
-
785
- - #file:knowzcode/knowzcode_loop.md
786
-
787
- ## Scope Guard
788
-
789
- This workflow is for changes that are:
790
- - **Single file** (or minimal multi-file with no ripple effects)
791
- - **<50 lines** changed
792
- - **No architectural impact**
793
-
794
- If the fix exceeds this scope, inform the user and suggest `#prompt:kc-work` instead.
795
-
796
- ## Instructions
797
-
798
- Follow the Micro-Fix Protocol from `knowzcode/knowzcode_loop.md` Section 4:
799
-
800
- 1. **Implement** the fix
801
- 2. **Test** run targeted tests for the affected code
802
- 3. **Log** — prepend a `MicroFix` entry to `knowzcode/knowzcode_log.md`:
803
- - Type: MicroFix
804
- - File/NodeID affected
805
- - User request, action taken, verification outcome
806
- 4. **Commit** with `fix: {description}` message
807
- ```
808
-
809
- #### kc-plan.prompt.md
810
-
811
- ```markdown
812
- ---
813
- agent: "agent"
814
- description: "Research and investigate before implementing"
815
- argument-hint: "Describe the topic to research"
816
- ---
817
-
818
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
819
-
820
- # KnowzCode: Plan / Investigate
821
-
822
- You are researching a topic before implementation. This is an investigation workflow, not a build workflow.
823
-
824
- ## Context
825
-
826
- - #file:knowzcode/knowzcode_loop.md
827
- - #file:knowzcode/knowzcode_project.md
828
- - #file:knowzcode/knowzcode_architecture.md
829
-
830
- ## Instructions
831
-
832
- The user's research topic is provided in the chat message.
833
-
834
- 1. **Explore the codebase** — search for relevant files, patterns, and existing implementations
835
- 2. **Read existing specs** — check `knowzcode/specs/` for related components
836
- 3. **Check history** scan `knowzcode/workgroups/` for past WorkGroups that touched similar areas
837
- 4. **Analyze architecture** — review `knowzcode/knowzcode_architecture.md` for structural context
838
- 5. **Present findings** with:
839
- - Current state of the relevant code
840
- - Existing patterns and conventions
841
- - Options for implementation (with trade-offs)
842
- - Recommended approach
843
-
844
- ## STOP
845
-
846
- Present research findings and recommendations.
847
-
848
- **To implement:** Tell the user to invoke `#prompt:kc-work` with their chosen approach.
849
- ```
850
-
851
- #### kc-continue.prompt.md
852
-
853
- ```markdown
854
- ---
855
- agent: "agent"
856
- description: "Resume interrupted work or advance to next phase"
857
- ---
858
-
859
- <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
860
-
861
- # KnowzCode: Continue / Resume
862
-
863
- You are resuming an interrupted KnowzCode workflow or advancing to the next phase.
864
-
865
- ## Context
866
-
867
- - #file:knowzcode/knowzcode_loop.md
868
- - #file:knowzcode/knowzcode_tracker.md
869
-
870
- ## Instructions
871
-
872
- ### Step 1: Find Active WorkGroup
873
-
874
- Read `knowzcode/knowzcode_tracker.md` and find entries with `[WIP]` status.
875
-
876
- - **One active WorkGroup**: Use it
877
- - **Multiple active**: Present the list and ask the user which to resume
878
- - **None active**: Inform the user and suggest `#prompt:kc-work`
879
-
880
- ### Step 2: Determine Current Phase
881
-
882
- Read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
883
- Check the Phase History table to determine the current state.
884
-
885
- ### Step 3: Resume or Advance
886
-
887
- | WorkGroup State | Action |
888
- |----------------|--------|
889
- | Phase 1A in progress | Complete the impact analysis, present Change Set |
890
- | Phase 1A complete, awaiting approval | Present Change Set for approval |
891
- | Phase 1A approved, specs not started | Begin Phase 1B — draft specs |
892
- | Phase 1B in progress | Complete spec drafting |
893
- | Phase 1B complete, awaiting approval | Present specs for approval |
894
- | Phase 1B approved, implementation not started | Begin Phase 2A — TDD implementation |
895
- | Phase 2A in progress | Resume implementation from outstanding todos |
896
- | Phase 2A complete | Advise: `#prompt:kc-audit` |
897
- | Phase 2B complete, gaps found | Present options: fix gaps or accept |
898
- | Phase 2B complete, no gaps | Begin Phase 3 — finalization |
899
- | Phase 3 in progress | Complete finalization |
900
-
901
- ### Step 4: Present Status
902
-
903
- ```
904
- ## Resuming WorkGroup: {WorkGroupID}
905
-
906
- **Goal**: {primary goal}
907
- **Phase**: {current phase}
908
- **NodeIDs**: {list}
909
-
910
- **Outstanding Work**:
911
- {list from WorkGroup file}
912
-
913
- Continuing from where we left off...
914
- ```
915
-
916
- Then proceed with the appropriate phase instructions from `knowzcode/knowzcode_loop.md`.
917
- ```
918
-
919
- ### C. .vscode/mcp.json Template
920
-
921
- Optionally generated by `/kc:init` when Copilot is detected and MCP is configured:
922
-
923
- ```json
924
- {
925
- "servers": {
926
- "knowz": {
927
- "type": "http",
928
- "url": "${input:knowz_mcp_url}",
929
- "headers": {
930
- "x-api-key": "${input:knowz_api_key}"
931
- }
932
- }
933
- },
934
- "inputs": [
935
- {
936
- "id": "knowz_mcp_url",
937
- "description": "KnowzCode MCP server URL",
938
- "type": "promptString"
939
- },
940
- {
941
- "id": "knowz_api_key",
942
- "description": "KnowzCode API key",
943
- "type": "promptString",
944
- "password": true
945
- }
946
- ]
947
- }
948
- ```
949
-
950
- ### D. Copilot-Specific Notes
951
-
952
- **VS Code usage:**
953
- - Invoke prompts via `#prompt:kc-work`, `#prompt:kc-specify`, etc. in Copilot Chat
954
- - Add extra files to context with `#file:path/to/file` in the chat message
955
- - All prompt files use `agent: "agent"` frontmatter for file editing and terminal access
956
- - Model can be selected per session — prefer stronger models for analysis/audit phases
957
-
958
- **Copilot CLI fallback:**
959
- - CLI does not support `#prompt:` syntax
960
- - Check current CLI documentation for file reference syntax — it may differ from VS Code
961
- - Alternatively, reference the methodology directly or paste prompt content into the CLI
962
-
963
- **Copilot Coding Agent:**
964
- - Follows `.github/copilot-instructions.md` automatically when processing GitHub issues
965
- - Runs all phases autonomously — quality gates deferred to PR review
966
- - Does not use prompt files (uses repository instructions only)
967
-
968
- **Execution model:**
969
- - See `knowzcode/copilot_execution.md` for the full execution guide
970
- - Single-agent, sequential execution user manually transitions between phases
971
- - No multi-agent orchestration (no Parallel Teams, no agent spawning)
972
- - WorkGroup files carry state between prompt invocations
973
-
974
- ---
975
-
976
- ## Windsurf (`.windsurf/rules/knowzcode.md`)
977
-
978
- 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.
979
-
980
- ```markdown
981
- # KnowzCode Development Methodology
982
-
983
- This project uses KnowzCode for structured TDD development.
984
- Follow `knowzcode/knowzcode_loop.md` for all feature development.
985
-
986
- ## Required Reading
987
- - `knowzcode/knowzcode_loop.md` Complete methodology
988
- - `knowzcode/knowzcode_project.md` — Project context
989
- - `knowzcode/knowzcode_tracker.md` — Active WorkGroups
990
- - `knowzcode/knowzcode_architecture.md` Architecture docs
991
-
992
- ## Phase Walkthrough
993
-
994
- ### Phase 1A: Impact Analysis
995
- - Identify affected components, propose Change Set with NodeIDs
996
- - Check existing specs before creating new ones
997
- - PAUSE for user approval
998
-
999
- ### Phase 1B: Specification
1000
- - Draft specs with 4-section format and 2+ VERIFY statements
1001
- - PAUSE for approval, then commit specs
1002
-
1003
- ### Phase 2A: Implementation (TDD Mandatory)
1004
- - Write failing test FIRST, then minimal code, then refactor
1005
- - Use Cascade for multi-file edits across components
1006
- - Run full verification loop (tests + linter + build)
1007
- - PAUSE after implementation
1008
-
1009
- ### Phase 2B: Audit
1010
- - READ-ONLY audit against spec VERIFY statements
1011
- - Report completion %, gaps, security concerns
1012
- - PAUSE for user decision
1013
-
1014
- ### Phase 3: Finalization
1015
- - Update specs to As-Built, tracker, log, architecture
1016
- - Final commit
1017
-
1018
- ## Enforcement Rules
1019
- - TDD is mandatory write failing tests before implementation code
1020
- - Respect quality gates between phases — PAUSE at each gate
1021
- - Update `knowzcode/knowzcode_tracker.md` when completing work
1022
- - Log completions in `knowzcode/knowzcode_log.md`
1023
- - Consolidate specs when domains overlap >50%
1024
- - Target <20 specs per project
1025
- - Every WorkGroup todo starts with `KnowzCode:` prefix
1026
-
1027
- ## Knowledge Capture (CRITICAL DO NOT SKIP)
1028
- Every piece of durable knowledge — decisions, patterns, gotchas, workarounds — **must** be captured.
1029
- When MCP is connected, write to vaults per `knowzcode/knowzcode_vaults.md` — always pass `vaultId` with `create_knowledge`.
1030
- When MCP is unavailable, capture locally in specs, log entries, or docs. Never let insights die in the conversation.
1031
- Use `/kc:learn "insight"` for automatic routing.
1032
- Vault entries are retrieved via semantic search — write detailed, self-contained content. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
1033
-
1034
- ## Micro-Fix (for small changes)
1035
- Single file, <50 lines, no ripple effects:
1036
- Implement → Test → Log MicroFix → Commit with `fix:` prefix
1037
- ```
1038
-
1039
- ---
1040
-
1041
- ## OpenAI Codex Agents SDK (Python)
1042
-
1043
- For teams building custom orchestration with the OpenAI Agents SDK,
1044
- map KnowzCode's 5 phase agents to SDK Agent definitions. The AGENTS.md
1045
- file above provides all instructions each agent needs. See the
1046
- [Agents SDK documentation](https://openai.github.io/openai-agents-python/)
1047
- 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 — 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.