knowzcode 0.2.1 → 0.3.3

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 (36) hide show
  1. package/.claude-plugin/marketplace.json +6 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +43 -5
  4. package/agents/analyst.md +31 -0
  5. package/agents/architect.md +93 -5
  6. package/agents/context-scout.md +1 -1
  7. package/agents/project-advisor.md +110 -0
  8. package/agents/security-officer.md +194 -0
  9. package/agents/test-advisor.md +162 -0
  10. package/commands/audit.md +101 -12
  11. package/commands/connect-mcp.md +24 -0
  12. package/commands/init.md +116 -1
  13. package/commands/plan.md +23 -10
  14. package/commands/work.md +363 -58
  15. package/knowzcode/claude_code_execution.md +91 -10
  16. package/knowzcode/copilot_execution.md +231 -0
  17. package/knowzcode/enterprise/compliance_manifest.md +3 -0
  18. package/knowzcode/knowzcode_loop.md +3 -1
  19. package/knowzcode/knowzcode_orchestration.md +66 -0
  20. package/knowzcode/platform_adapters.md +621 -27
  21. package/package.json +1 -1
  22. package/skills/alias-resolver.json +1 -1
  23. package/skills/architecture-diff.json +1 -1
  24. package/skills/check-installation-status.json +1 -1
  25. package/skills/continue.md +2 -1
  26. package/skills/environment-guard.json +1 -1
  27. package/skills/generate-workgroup-id.json +1 -1
  28. package/skills/install-knowzcode.json +1 -1
  29. package/skills/load-core-context.json +1 -1
  30. package/skills/log-entry-builder.json +1 -1
  31. package/skills/spec-quality-check.json +1 -1
  32. package/skills/spec-template.json +1 -1
  33. package/skills/spec-validator.json +1 -1
  34. package/skills/tracker-scan.json +1 -1
  35. package/skills/tracker-update.json +1 -1
  36. package/skills/validate-installation.json +1 -1
@@ -54,10 +54,22 @@ Specialized agents handle each phase when using Agent Teams or subagent executio
54
54
  - `/kc:learn "insight"` — Capture learning to vault
55
55
  - `/kc:status` — Check MCP connection and vault status
56
56
 
57
- ## MCP Integration (Optional)
57
+ ## MCP Integration
58
58
  If configured, agents use `search_knowledge`, `ask_question`, and `create_knowledge` for enhanced context.
59
59
  All commands work without MCP — it enhances but never blocks.
60
60
 
61
+ ### Vault Targeting (MANDATORY when MCP is connected)
62
+ **When calling `create_knowledge` or `update_knowledge`, ALWAYS pass `vaultId`.**
63
+ Omitting `vaultId` saves to the tenant default vault (often Personal) — NOT the project vault.
64
+
65
+ Before any MCP write:
66
+ 1. Check if vault IDs are already in context from a previous read or CLAUDE.md
67
+ 2. If not, read `knowzcode/knowzcode_vaults.md` for vault IDs and routing rules
68
+ 3. Match your content type to the correct vault using the routing table
69
+ 4. Pass `vaultId` explicitly in every call
70
+
71
+ For ad-hoc learning capture, prefer `/kc:learn "insight"` — it handles routing automatically.
72
+
61
73
  ## WorkGroup Files
62
74
  - Created in `knowzcode/workgroups/` (gitignored)
63
75
  - Every todo must start with `KnowzCode:` prefix
@@ -130,6 +142,10 @@ Read `knowzcode/knowzcode_loop.md` before starting any feature work.
130
142
  - Every WorkGroup todo must start with `KnowzCode:` prefix
131
143
  - Target <20 specs per project — consolidate when domains overlap
132
144
 
145
+ ## Vault Targeting
146
+ When calling `create_knowledge`, always pass `vaultId` from `knowzcode/knowzcode_vaults.md`.
147
+ Omitting it saves to the wrong vault. Use `/kc:learn` for automatic routing.
148
+
133
149
  ## Quick Fix (Micro-Fix)
134
150
  For single-file, <50 line, no-ripple-effect changes:
135
151
  1. Implement the fix
@@ -242,6 +258,10 @@ Read these files before starting any feature work (use @import syntax for direct
242
258
  - Log completions in `knowzcode/knowzcode_log.md`
243
259
  - Target <20 specs — consolidate when domains overlap >50%
244
260
 
261
+ ## Vault Targeting
262
+ When calling `create_knowledge`, always pass `vaultId` from `knowzcode/knowzcode_vaults.md`.
263
+ Omitting it saves to the wrong vault. Use `/kc:learn` for automatic routing.
264
+
245
265
  ## Micro-Fix (for small changes)
246
266
  Single file, <50 lines, no ripple effects:
247
267
  1. Implement fix → 2. Run tests → 3. Log MicroFix → 4. Commit with `fix:`
@@ -309,55 +329,625 @@ Before any feature work, read:
309
329
  - Target <20 specs per project
310
330
  - Read `knowzcode/knowzcode_tracker.md` for active work
311
331
  - Log completions in `knowzcode/knowzcode_log.md`
332
+
333
+ ## Vault Targeting
334
+ When calling `create_knowledge`, always pass `vaultId` from `knowzcode/knowzcode_vaults.md`.
335
+ Omitting it saves to the wrong vault. Use `/kc:learn` for automatic routing.
312
336
  ```
313
337
 
314
338
  ---
315
339
 
316
- ## GitHub Copilot (.github/copilot-instructions.md)
340
+ ## GitHub Copilot (.github/copilot-instructions.md + .github/prompts/*.prompt.md)
341
+
342
+ GitHub Copilot (2026) supports three instruction mechanisms used by KnowzCode:
343
+
344
+ 1. **`.github/copilot-instructions.md`** — Repository-level instructions, always active
345
+ 2. **`.github/prompts/*.prompt.md`** — Custom prompts invocable via `#prompt:name` in VS Code
346
+ 3. **MCP server tools** (`.vscode/mcp.json`) — Tool access for vault queries
317
347
 
318
- Create `.github/copilot-instructions.md` for repository-level instructions. Notes: GitHub Copilot also supports scoped instructions via `*.instructions.md` files with `applyTo` YAML frontmatter (e.g., `knowzcode.instructions.md` with `applyTo: "knowzcode/**"` to scope KnowzCode methodology to the framework directory). Copilot (2026) now supports `.github/agents/*.agent.md` files with YAML frontmatter including `tools`, `handoffs`, `agents` (subagents), and `model` fields. KnowzCode phases map well to handoff chains between agent definitions.
348
+ 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.
349
+
350
+ ### A. copilot-instructions.md
351
+
352
+ Create `.github/copilot-instructions.md`:
319
353
 
320
354
  ```markdown
355
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
356
+
321
357
  # KnowzCode Development Methodology
322
358
 
323
- This repository uses KnowzCode for structured TDD development.
359
+ This repository uses KnowzCode for structured TDD development with quality gates.
360
+
361
+ ## Required Reading
362
+ - `knowzcode/knowzcode_loop.md` — Complete methodology (read first)
363
+ - `knowzcode/knowzcode_project.md` — Project context and tech stack
364
+ - `knowzcode/knowzcode_architecture.md` — Architecture documentation
365
+ - `knowzcode/knowzcode_tracker.md` — WorkGroup status tracking
366
+
367
+ ## Workflow Overview
368
+
369
+ KnowzCode follows a 5-phase development loop with quality gates between each phase.
370
+ Use the prompt files in `.github/prompts/` to invoke each phase:
324
371
 
325
- ## Key Constraint: TDD is Mandatory
326
- - Write failing tests BEFORE implementation code
327
- - Follow Red-Green-Refactor cycle for every feature
328
- - No production code without corresponding test coverage
372
+ | Phase | Prompt | Description |
373
+ |-------|--------|-------------|
374
+ | Full workflow | `#prompt:kc-work` | Start a new feature — creates WorkGroup, classifies tier, runs Phase 1A |
375
+ | 1A: Analysis | `#prompt:kc-analyze` | Re-run impact analysis on existing WorkGroup |
376
+ | 1B: Specification | `#prompt:kc-specify` | Draft specs from approved Change Set |
377
+ | 2A: Implementation | `#prompt:kc-implement` | TDD implementation with verification loop |
378
+ | 2B: Audit | `#prompt:kc-audit` | READ-ONLY audit against specs |
379
+ | 3: Finalization | `#prompt:kc-finalize` | Update specs, tracker, log, commit |
380
+ | Quick fix | `#prompt:kc-fix` | Micro-fix for small, scoped changes |
381
+ | Research | `#prompt:kc-plan` | Investigate before implementing |
382
+ | Resume | `#prompt:kc-continue` | Resume or advance to next phase |
329
383
 
330
- ## Workflow
331
- Reference `knowzcode/knowzcode_loop.md` for the complete development workflow.
332
- Follow these phases for all feature work:
384
+ ### Typical Flow
333
385
 
334
- 1. **Impact Analysis** Propose a Change Set, get user approval
335
- 2. **Specification** Draft specs with VERIFY statements, get user approval
336
- 3. **Implementation** Strict TDD, verification loop
337
- 4. **Audit** — READ-ONLY comparison against specs
338
- 5. **Finalization** Update docs, tracker, log, commit
386
+ 1. `#prompt:kc-work "Build JWT authentication"` Creates WorkGroup, proposes Change Set, **STOPs**
387
+ 2. Approve Change Set
388
+ 3. `#prompt:kc-specify` Drafts specs, **STOPs**
389
+ 4. Approve specs
390
+ 5. `#prompt:kc-implement` TDD Red-Green-Refactor, **STOPs**
391
+ 6. `#prompt:kc-audit` → READ-ONLY audit, reports gaps, **STOPs**
392
+ 7. `#prompt:kc-finalize` → Updates docs, commits
393
+
394
+ Use `#prompt:kc-continue` at any point to resume where you left off.
339
395
 
340
396
  ## Quality Gates
341
- STOP and get user approval:
342
- - After Change Set proposal
343
- - After spec drafts
344
- - After implementation (awaiting audit)
345
- - After audit results (user decides on gaps)
397
+
398
+ STOP and await user approval at each gate:
399
+ - After Change Set proposal (1A)
400
+ - After spec drafts (1B)
401
+ - After implementation complete (2A awaiting audit)
402
+ - After audit results (2B — user decides on gaps)
403
+
404
+ ## TDD Enforcement
405
+
406
+ TDD is mandatory — no production code without a failing test first.
407
+ Follow Red-Green-Refactor for every feature/criterion in the spec.
408
+
409
+ ## Key Rules
410
+ - NodeIDs are domain concepts (PascalCase), not tasks
411
+ - Consolidate specs when domains overlap >50%
412
+ - Every WorkGroup todo starts with `KnowzCode:` prefix
413
+ - Target <20 specs per project
414
+ - Log completions in `knowzcode/knowzcode_log.md`
346
415
 
347
416
  ## Key Files
348
- - `knowzcode/knowzcode_loop.md` — Methodology (read first)
417
+ - `knowzcode/knowzcode_loop.md` — Methodology
349
418
  - `knowzcode/knowzcode_project.md` — Project context
350
419
  - `knowzcode/knowzcode_architecture.md` — Architecture docs
351
420
  - `knowzcode/knowzcode_tracker.md` — WorkGroup tracking
352
421
  - `knowzcode/specs/` — Component specifications
422
+ - `knowzcode/workgroups/` — Active session data (gitignored)
353
423
 
354
- ## Rules
355
- - NodeIDs are domain concepts (PascalCase), not tasks
356
- - Consolidate specs when domains overlap >50%
357
- - Every WorkGroup todo starts with `KnowzCode:` prefix
358
- - Log completions in `knowzcode/knowzcode_log.md`
424
+ ## MCP Integration
425
+
426
+ If configured in `.vscode/mcp.json`, use `search_knowledge` and `ask_question` tools
427
+ for enhanced context from knowledge vaults. All prompts work without MCP.
428
+
429
+ ### Vault Targeting
430
+ When calling `create_knowledge`, always pass `vaultId` from `knowzcode/knowzcode_vaults.md`.
431
+ Omitting it saves to the wrong vault. Use `/kc:learn` for automatic routing.
432
+
433
+ ## Copilot Coding Agent
434
+
435
+ When the Copilot Coding Agent works on GitHub issues for this repository:
436
+ - Read `knowzcode/knowzcode_loop.md` and this file for methodology
437
+ - Follow Phase 1A→3 workflow for any non-trivial change
438
+ - Include the Change Set in the PR description
439
+ - Use TDD — failing test before implementation code
440
+ - Self-audit against spec VERIFY statements before marking PR ready
441
+ - Quality gates are deferred to PR review (no interactive approval in async mode)
442
+
443
+ ## Model Selection
444
+ - Complex phases (1A analysis, 1B spec drafting, 2B audit): Use Claude Opus or GPT-4o
445
+ - Implementation (2A): Any capable model with good code generation
446
+ - Quick fixes: Any model
447
+ ```
448
+
449
+ ### B. Prompt File Templates (.github/prompts/)
450
+
451
+ Each prompt file is invocable via `#prompt:kc-*` in VS Code Copilot Chat. All use `agent: "agent"` for file editing capability.
452
+
453
+ #### kc-work.prompt.md
454
+
455
+ ```markdown
456
+ ---
457
+ agent: "agent"
458
+ description: "Start a new KnowzCode development workflow"
459
+ argument-hint: "Describe the feature or goal to build"
460
+ ---
461
+
462
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
463
+
464
+ # KnowzCode: Start Workflow
465
+
466
+ You are starting a new KnowzCode development workflow. Follow the methodology precisely.
467
+
468
+ ## Context
469
+
470
+ Read these files for methodology and project context:
471
+ - #file:knowzcode/knowzcode_loop.md
472
+ - #file:knowzcode/knowzcode_project.md
473
+ - #file:knowzcode/knowzcode_tracker.md
474
+ - #file:knowzcode/knowzcode_architecture.md
475
+
476
+ ## Instructions
477
+
478
+ The user's goal is provided in the chat message.
479
+
480
+ ### Step 1: Classify Tier
481
+
482
+ Based on the goal, classify complexity:
483
+ - **Micro** (single file, <50 lines, no ripple): Redirect to `#prompt:kc-fix`
484
+ - **Light** (≤3 files, straightforward): Streamlined 2-phase path
485
+ - **Full** (>3 files or complex): Complete 5-phase workflow
486
+
487
+ ### Step 2: Create Draft WorkGroup
488
+
489
+ Generate a WorkGroupID: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
490
+ Create a draft WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` to store the analysis output.
491
+
492
+ ### Step 3: Phase 1A — Impact Analysis
493
+
494
+ Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
495
+ 1. Identify the Change Set — all components affected by this change
496
+ 2. Create NodeIDs for NEW capabilities only (domain concepts, PascalCase)
497
+ 3. Check `knowzcode/specs/` for existing specs with domain overlap
498
+ 4. Scan `knowzcode/workgroups/` for completed WorkGroups with relevant context
499
+ 5. Propose the Change Set with NodeIDs, affected files, and risk assessment
500
+
501
+ ## STOP
502
+
503
+ Present the Change Set for user approval. Do NOT proceed until approved.
504
+
505
+ **After approval:** Update `knowzcode/knowzcode_tracker.md` with new NodeIDs as `[WIP]`, then tell the user to invoke `#prompt:kc-specify` to draft specifications.
506
+ ```
507
+
508
+ #### kc-analyze.prompt.md
509
+
510
+ ```markdown
511
+ ---
512
+ agent: "agent"
513
+ description: "Re-run Phase 1A impact analysis on existing WorkGroup"
514
+ ---
515
+
516
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
517
+
518
+ # KnowzCode: Phase 1A — Impact Analysis
519
+
520
+ You are re-running impact analysis on an existing WorkGroup.
521
+
522
+ ## Context
523
+
524
+ - #file:knowzcode/knowzcode_loop.md
525
+ - #file:knowzcode/knowzcode_tracker.md
526
+
527
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
528
+ Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
529
+
530
+ ## Instructions
531
+
532
+ Follow Phase 1A from `knowzcode/knowzcode_loop.md`:
533
+ 1. Re-analyze the goal from the WorkGroup file
534
+ 2. Identify all affected components — check for changes since last analysis
535
+ 3. Update NodeIDs if scope has changed
536
+ 4. Check `knowzcode/specs/` for existing specs with domain overlap
537
+ 5. Update the Change Set in the WorkGroup file
538
+
539
+ ## STOP
540
+
541
+ Present the updated Change Set for user approval.
542
+
543
+ **Next step after approval:** `#prompt:kc-specify`
544
+ ```
545
+
546
+ #### kc-specify.prompt.md
547
+
548
+ ```markdown
549
+ ---
550
+ agent: "agent"
551
+ description: "Draft specifications from approved Change Set (Phase 1B)"
552
+ ---
553
+
554
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
555
+
556
+ # KnowzCode: Phase 1B — Specification
557
+
558
+ You are drafting specifications for the approved Change Set.
559
+
560
+ ## Context
561
+
562
+ - #file:knowzcode/knowzcode_loop.md
563
+ - #file:knowzcode/knowzcode_tracker.md
564
+
565
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
566
+ If no `[WIP]` entries found, scan `knowzcode/workgroups/` for the most recent draft WorkGroup file.
567
+ Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md` for the approved Change Set.
568
+
569
+ ## Instructions
570
+
571
+ Follow Phase 1B from `knowzcode/knowzcode_loop.md`:
572
+
573
+ For each NodeID in the approved Change Set:
574
+ 1. Draft `knowzcode/specs/{NodeID}.md` using the 4-section format:
575
+ - **Rules & Decisions** — Key architectural decisions, business rules, constraints
576
+ - **Interfaces** — Public contracts: inputs, outputs, API signatures, dependencies
577
+ - **Verification Criteria** — Testable `VERIFY:` assertions (minimum 2 per spec)
578
+ - **Debt & Gaps** — Known limitations and future work
579
+ 2. Minimum valid spec: 1+ Rules, 1+ Interface, 2+ VERIFY statements
580
+ 3. Check existing specs — if >50% domain overlap, UPDATE existing spec instead
581
+ 4. Update the WorkGroup file with spec status
582
+
583
+ ## STOP
584
+
585
+ Present all drafted specs for user approval. Do NOT proceed until approved.
586
+
587
+ **After approval:** Commit the specs as a pre-implementation checkpoint: `git commit -m "specs: draft specs for {WorkGroupID}"`
588
+
589
+ **Next step:** `#prompt:kc-implement`
590
+ ```
591
+
592
+ #### kc-implement.prompt.md
593
+
594
+ ```markdown
595
+ ---
596
+ agent: "agent"
597
+ description: "TDD implementation with verification loop (Phase 2A)"
598
+ ---
599
+
600
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
601
+
602
+ # KnowzCode: Phase 2A — Implementation
603
+
604
+ You are implementing the approved specifications using strict TDD.
605
+
606
+ ## Context
607
+
608
+ - #file:knowzcode/knowzcode_loop.md
609
+ - #file:knowzcode/knowzcode_tracker.md
610
+
611
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
612
+ Then read:
613
+ - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
614
+ - All spec files listed in the Change Set from `knowzcode/specs/`
615
+
616
+ ## Instructions
617
+
618
+ Follow Phase 2A from `knowzcode/knowzcode_loop.md`:
619
+
620
+ For EACH feature/criterion in the specs:
621
+ 1. **RED**: Write a failing test that defines expected behavior. Run test → confirm FAIL
622
+ 2. **GREEN**: Write MINIMAL code to make the test pass. Run test → confirm PASS
623
+ 3. **REFACTOR**: Clean up while keeping all tests green
624
+
625
+ ### Verification Loop (must pass before reporting complete)
626
+
627
+ 1. Run all tests → if FAIL: fix and restart
628
+ 2. Run static analysis → if issues: fix and restart
629
+ 3. Run build → if FAIL: fix and restart
630
+ 4. Verify all VERIFY: criteria from specs → if unmet: implement and restart
631
+ 5. All checks pass → report complete
632
+
633
+ Maximum 10 iterations. If exceeded, report blocker.
634
+
635
+ ### Spec Issues
636
+
637
+ If you discover a spec is incorrect during implementation:
638
+ - Tag `[SPEC_ISSUE]` in the WorkGroup file with details
639
+ - Continue with best judgment
640
+ - Report in completion summary
641
+
642
+ ## STOP
643
+
644
+ Report implementation results: test counts, verification iterations, criteria status.
645
+
646
+ **Next step:** `#prompt:kc-audit`
359
647
  ```
360
648
 
649
+ #### kc-audit.prompt.md
650
+
651
+ ```markdown
652
+ ---
653
+ agent: "agent"
654
+ description: "READ-ONLY completeness audit against specs (Phase 2B)"
655
+ ---
656
+
657
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
658
+
659
+ # KnowzCode: Phase 2B — Completeness Audit
660
+
661
+ You are performing an independent, READ-ONLY audit of the implementation.
662
+
663
+ ## Context
664
+
665
+ - #file:knowzcode/knowzcode_loop.md
666
+ - #file:knowzcode/knowzcode_tracker.md
667
+
668
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
669
+ Then read:
670
+ - The WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`
671
+ - All spec files listed in the Change Set from `knowzcode/specs/`
672
+ - The implementation files listed in the Change Set
673
+
674
+ ## Instructions
675
+
676
+ Follow Phase 2B from `knowzcode/knowzcode_loop.md`:
677
+
678
+ **CRITICAL: This is a READ-ONLY audit. Do NOT modify any source files.**
679
+
680
+ 1. For each NodeID, compare implementation against every VERIFY statement in its spec
681
+ 2. Calculate objective completion percentage per NodeID and overall
682
+ 3. Identify gaps: missing features, incomplete criteria, untested paths
683
+ 4. Check for security concerns: input validation, authentication, data exposure
684
+ 5. Check for orphan code: implementation not covered by any spec
685
+ 6. Assess risk for any gaps found
686
+
687
+ ### Standalone Audit Types
688
+
689
+ If the user specifies an audit type instead of a WorkGroup audit:
690
+ - **spec**: Audit spec quality — completeness, VERIFY statement coverage, format compliance
691
+ - **architecture**: Compare architecture doc against actual codebase structure
692
+ - **security**: Focused security review — OWASP top 10, input validation, auth flows
693
+ - **integration**: Check integration points, API contracts, dependency health
694
+
695
+ ## STOP
696
+
697
+ Present audit results with completion percentage, gap list, and risk assessment.
698
+
699
+ **User decides:**
700
+ - Return to `#prompt:kc-implement` to fix gaps
701
+ - Accept and proceed to `#prompt:kc-finalize`
702
+ - Modify specs to match implementation
703
+ - Cancel the WorkGroup
704
+ ```
705
+
706
+ #### kc-finalize.prompt.md
707
+
708
+ ```markdown
709
+ ---
710
+ agent: "agent"
711
+ description: "Finalize WorkGroup — update specs, tracker, log, commit (Phase 3)"
712
+ ---
713
+
714
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
715
+
716
+ # KnowzCode: Phase 3 — Finalization
717
+
718
+ You are finalizing the WorkGroup after approved implementation and audit.
719
+
720
+ ## Context
721
+
722
+ - #file:knowzcode/knowzcode_loop.md
723
+ - #file:knowzcode/knowzcode_tracker.md
724
+ - #file:knowzcode/knowzcode_architecture.md
725
+
726
+ Read `knowzcode/knowzcode_tracker.md` to find the active `[WIP]` WorkGroup.
727
+ Then read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
728
+
729
+ ## Instructions
730
+
731
+ Follow Phase 3 from `knowzcode/knowzcode_loop.md`:
732
+
733
+ 1. **Finalize Specs**: Update each `knowzcode/specs/{NodeID}.md` to as-built state (Status: As-Built)
734
+ 2. **Architecture Check**: Compare `knowzcode/knowzcode_architecture.md` against the Change Set. Fix simple discrepancies directly; document complex ones for user review
735
+ 3. **Log Entry**: Prepend an `ARC-Completion` entry to `knowzcode/knowzcode_log.md` with WorkGroupID, NodeIDs, verification summary, architectural learnings, and ripple effects
736
+ 4. **Update Tracker**: Change NodeID statuses from `[WIP]` to `[VERIFIED]` in `knowzcode/knowzcode_tracker.md`. Create `REFACTOR_` tasks for significant tech debt
737
+ 5. **Final Commit**: Stage and commit all changes (source + knowzcode files)
738
+ 6. **Close WorkGroup**: Mark the WorkGroup file as closed
739
+
740
+ ## Output
741
+
742
+ Report completion with summary of what was delivered and any `REFACTOR_` tasks created.
743
+ ```
744
+
745
+ #### kc-fix.prompt.md
746
+
747
+ ```markdown
748
+ ---
749
+ agent: "agent"
750
+ description: "Quick targeted fix using micro-fix protocol"
751
+ argument-hint: "Describe the bug or issue to fix"
752
+ ---
753
+
754
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
755
+
756
+ # KnowzCode: Micro-Fix
757
+
758
+ You are performing a quick, targeted fix using the micro-fix protocol.
759
+
760
+ ## Context
761
+
762
+ - #file:knowzcode/knowzcode_loop.md
763
+
764
+ ## Scope Guard
765
+
766
+ This workflow is for changes that are:
767
+ - **Single file** (or minimal multi-file with no ripple effects)
768
+ - **<50 lines** changed
769
+ - **No architectural impact**
770
+
771
+ If the fix exceeds this scope, inform the user and suggest `#prompt:kc-work` instead.
772
+
773
+ ## Instructions
774
+
775
+ Follow the Micro-Fix Protocol from `knowzcode/knowzcode_loop.md` Section 4:
776
+
777
+ 1. **Implement** the fix
778
+ 2. **Test** — run targeted tests for the affected code
779
+ 3. **Log** — prepend a `MicroFix` entry to `knowzcode/knowzcode_log.md`:
780
+ - Type: MicroFix
781
+ - File/NodeID affected
782
+ - User request, action taken, verification outcome
783
+ 4. **Commit** with `fix: {description}` message
784
+ ```
785
+
786
+ #### kc-plan.prompt.md
787
+
788
+ ```markdown
789
+ ---
790
+ agent: "agent"
791
+ description: "Research and investigate before implementing"
792
+ argument-hint: "Describe the topic to research"
793
+ ---
794
+
795
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
796
+
797
+ # KnowzCode: Plan / Investigate
798
+
799
+ You are researching a topic before implementation. This is an investigation workflow, not a build workflow.
800
+
801
+ ## Context
802
+
803
+ - #file:knowzcode/knowzcode_loop.md
804
+ - #file:knowzcode/knowzcode_project.md
805
+ - #file:knowzcode/knowzcode_architecture.md
806
+
807
+ ## Instructions
808
+
809
+ The user's research topic is provided in the chat message.
810
+
811
+ 1. **Explore the codebase** — search for relevant files, patterns, and existing implementations
812
+ 2. **Read existing specs** — check `knowzcode/specs/` for related components
813
+ 3. **Check history** — scan `knowzcode/workgroups/` for past WorkGroups that touched similar areas
814
+ 4. **Analyze architecture** — review `knowzcode/knowzcode_architecture.md` for structural context
815
+ 5. **Present findings** with:
816
+ - Current state of the relevant code
817
+ - Existing patterns and conventions
818
+ - Options for implementation (with trade-offs)
819
+ - Recommended approach
820
+
821
+ ## STOP
822
+
823
+ Present research findings and recommendations.
824
+
825
+ **To implement:** Tell the user to invoke `#prompt:kc-work` with their chosen approach.
826
+ ```
827
+
828
+ #### kc-continue.prompt.md
829
+
830
+ ```markdown
831
+ ---
832
+ agent: "agent"
833
+ description: "Resume interrupted work or advance to next phase"
834
+ ---
835
+
836
+ <!-- Generated by KnowzCode vX.Y.Z /kc:init -->
837
+
838
+ # KnowzCode: Continue / Resume
839
+
840
+ You are resuming an interrupted KnowzCode workflow or advancing to the next phase.
841
+
842
+ ## Context
843
+
844
+ - #file:knowzcode/knowzcode_loop.md
845
+ - #file:knowzcode/knowzcode_tracker.md
846
+
847
+ ## Instructions
848
+
849
+ ### Step 1: Find Active WorkGroup
850
+
851
+ Read `knowzcode/knowzcode_tracker.md` and find entries with `[WIP]` status.
852
+
853
+ - **One active WorkGroup**: Use it
854
+ - **Multiple active**: Present the list and ask the user which to resume
855
+ - **None active**: Inform the user and suggest `#prompt:kc-work`
856
+
857
+ ### Step 2: Determine Current Phase
858
+
859
+ Read the WorkGroup file at `knowzcode/workgroups/{WorkGroupID}.md`.
860
+ Check the Phase History table to determine the current state.
861
+
862
+ ### Step 3: Resume or Advance
863
+
864
+ | WorkGroup State | Action |
865
+ |----------------|--------|
866
+ | Phase 1A in progress | Complete the impact analysis, present Change Set |
867
+ | Phase 1A complete, awaiting approval | Present Change Set for approval |
868
+ | Phase 1A approved, specs not started | Begin Phase 1B — draft specs |
869
+ | Phase 1B in progress | Complete spec drafting |
870
+ | Phase 1B complete, awaiting approval | Present specs for approval |
871
+ | Phase 1B approved, implementation not started | Begin Phase 2A — TDD implementation |
872
+ | Phase 2A in progress | Resume implementation from outstanding todos |
873
+ | Phase 2A complete | Advise: `#prompt:kc-audit` |
874
+ | Phase 2B complete, gaps found | Present options: fix gaps or accept |
875
+ | Phase 2B complete, no gaps | Begin Phase 3 — finalization |
876
+ | Phase 3 in progress | Complete finalization |
877
+
878
+ ### Step 4: Present Status
879
+
880
+ ```
881
+ ## Resuming WorkGroup: {WorkGroupID}
882
+
883
+ **Goal**: {primary goal}
884
+ **Phase**: {current phase}
885
+ **NodeIDs**: {list}
886
+
887
+ **Outstanding Work**:
888
+ {list from WorkGroup file}
889
+
890
+ Continuing from where we left off...
891
+ ```
892
+
893
+ Then proceed with the appropriate phase instructions from `knowzcode/knowzcode_loop.md`.
894
+ ```
895
+
896
+ ### C. .vscode/mcp.json Template
897
+
898
+ Optionally generated by `/kc:init` when Copilot is detected and MCP is configured:
899
+
900
+ ```json
901
+ {
902
+ "servers": {
903
+ "knowzcode": {
904
+ "type": "http",
905
+ "url": "${input:knowzcode_mcp_url}",
906
+ "headers": {
907
+ "x-api-key": "${input:knowzcode_api_key}"
908
+ }
909
+ }
910
+ },
911
+ "inputs": [
912
+ {
913
+ "id": "knowzcode_mcp_url",
914
+ "description": "KnowzCode MCP server URL",
915
+ "type": "promptString"
916
+ },
917
+ {
918
+ "id": "knowzcode_api_key",
919
+ "description": "KnowzCode API key",
920
+ "type": "promptString",
921
+ "password": true
922
+ }
923
+ ]
924
+ }
925
+ ```
926
+
927
+ ### D. Copilot-Specific Notes
928
+
929
+ **VS Code usage:**
930
+ - Invoke prompts via `#prompt:kc-work`, `#prompt:kc-specify`, etc. in Copilot Chat
931
+ - Add extra files to context with `#file:path/to/file` in the chat message
932
+ - All prompt files use `agent: "agent"` frontmatter for file editing and terminal access
933
+ - Model can be selected per session — prefer stronger models for analysis/audit phases
934
+
935
+ **Copilot CLI fallback:**
936
+ - CLI does not support `#prompt:` syntax
937
+ - Check current CLI documentation for file reference syntax — it may differ from VS Code
938
+ - Alternatively, reference the methodology directly or paste prompt content into the CLI
939
+
940
+ **Copilot Coding Agent:**
941
+ - Follows `.github/copilot-instructions.md` automatically when processing GitHub issues
942
+ - Runs all phases autonomously — quality gates deferred to PR review
943
+ - Does not use prompt files (uses repository instructions only)
944
+
945
+ **Execution model:**
946
+ - See `knowzcode/copilot_execution.md` for the full execution guide
947
+ - Single-agent, sequential execution — user manually transitions between phases
948
+ - No multi-agent orchestration (no Parallel Teams, no agent spawning)
949
+ - WorkGroup files carry state between prompt invocations
950
+
361
951
  ---
362
952
 
363
953
  ## Windsurf (`.windsurf/rules/knowzcode.md`)
@@ -411,6 +1001,10 @@ Follow `knowzcode/knowzcode_loop.md` for all feature development.
411
1001
  - Target <20 specs per project
412
1002
  - Every WorkGroup todo starts with `KnowzCode:` prefix
413
1003
 
1004
+ ## Vault Targeting
1005
+ When calling `create_knowledge`, always pass `vaultId` from `knowzcode/knowzcode_vaults.md`.
1006
+ Omitting it saves to the wrong vault. Use `/kc:learn` for automatic routing.
1007
+
414
1008
  ## Micro-Fix (for small changes)
415
1009
  Single file, <50 lines, no ripple effects:
416
1010
  Implement → Test → Log MicroFix → Commit with `fix:` prefix