knowzcode 0.1.0 → 0.3.1

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 (64) hide show
  1. package/.claude-plugin/marketplace.json +9 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +170 -73
  4. package/agents/analyst.md +24 -62
  5. package/agents/architect.md +60 -48
  6. package/agents/builder.md +35 -86
  7. package/agents/closer.md +29 -87
  8. package/agents/context-scout.md +54 -0
  9. package/agents/knowledge-migrator.md +7 -7
  10. package/agents/knowz-scout.md +83 -0
  11. package/agents/knowz-scribe.md +155 -0
  12. package/agents/microfix-specialist.md +1 -6
  13. package/agents/project-advisor.md +110 -0
  14. package/agents/reviewer.md +43 -91
  15. package/agents/security-officer.md +194 -0
  16. package/agents/test-advisor.md +162 -0
  17. package/agents/update-coordinator.md +7 -18
  18. package/bin/knowzcode.mjs +94 -7
  19. package/commands/audit.md +245 -25
  20. package/commands/connect-mcp.md +525 -507
  21. package/commands/fix.md +8 -8
  22. package/commands/init.md +125 -6
  23. package/commands/learn.md +327 -308
  24. package/commands/plan.md +173 -26
  25. package/commands/register.md +21 -12
  26. package/commands/status.md +309 -291
  27. package/commands/telemetry.md +188 -188
  28. package/commands/work.md +764 -114
  29. package/knowzcode/automation_manifest.md +59 -59
  30. package/knowzcode/claude_code_execution.md +291 -22
  31. package/knowzcode/copilot_execution.md +231 -0
  32. package/knowzcode/enterprise/compliance_manifest.md +5 -0
  33. package/knowzcode/knowzcode_loop.md +114 -46
  34. package/knowzcode/knowzcode_orchestration.md +66 -0
  35. package/knowzcode/knowzcode_project.md +48 -233
  36. package/knowzcode/knowzcode_vaults.md +183 -54
  37. package/knowzcode/mcp_config.md +72 -47
  38. package/knowzcode/platform_adapters.md +630 -29
  39. package/knowzcode/prompts/Execute_Micro_Fix.md +57 -57
  40. package/knowzcode/prompts/Investigate_Codebase.md +227 -227
  41. package/knowzcode/prompts/Migrate_Knowledge.md +301 -301
  42. package/knowzcode/prompts/Refactor_Node.md +72 -72
  43. package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -59
  44. package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -52
  45. package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -75
  46. package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -55
  47. package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -72
  48. package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -67
  49. package/package.json +1 -1
  50. package/skills/alias-resolver.json +1 -1
  51. package/skills/architecture-diff.json +1 -1
  52. package/skills/check-installation-status.json +1 -1
  53. package/skills/continue.md +25 -4
  54. package/skills/environment-guard.json +1 -1
  55. package/skills/generate-workgroup-id.json +1 -1
  56. package/skills/install-knowzcode.json +1 -1
  57. package/skills/load-core-context.json +1 -1
  58. package/skills/log-entry-builder.json +1 -1
  59. package/skills/spec-quality-check.json +1 -1
  60. package/skills/spec-template.json +1 -1
  61. package/skills/spec-validator.json +1 -1
  62. package/skills/tracker-scan.json +1 -1
  63. package/skills/tracker-update.json +1 -1
  64. package/skills/validate-installation.json +1 -1
@@ -0,0 +1,231 @@
1
+ # Copilot Execution Model
2
+
3
+ **Purpose:** Defines the execution model for GitHub Copilot users. Copilot operates as a single-agent, sequential platform — users manually transition between phases using prompt files.
4
+
5
+ Agents on other platforms should ignore this file — see `knowzcode/platform_adapters.md` for platform-specific instructions, or `knowzcode/claude_code_execution.md` for Claude Code Agent Teams.
6
+
7
+ ---
8
+
9
+ ## Execution Model Overview
10
+
11
+ Copilot uses a **single-agent, user-driven** execution model:
12
+
13
+ - One AI assistant handles all phases sequentially
14
+ - The user invokes each phase via `#prompt:kc-*` prompt files in VS Code
15
+ - Quality gates are enforced by STOP instructions — the AI pauses and waits for user direction
16
+ - Context carries between phases via WorkGroup files in `knowzcode/workgroups/`
17
+ - No multi-agent orchestration, no inter-agent messaging, no task dependency tracking
18
+
19
+ This is equivalent to the "Sequential Execution Protocol" described in `knowzcode/knowzcode_loop.md` Section 8.
20
+
21
+ ---
22
+
23
+ ## Prompt File Workflow
24
+
25
+ ### Phase Sequence
26
+
27
+ ```
28
+ #prompt:kc-work "goal"
29
+ → Creates WorkGroup, classifies tier, Phase 1A analysis, proposes Change Set
30
+ → STOP — await user approval
31
+
32
+ #prompt:kc-specify
33
+ → Reads WorkGroup, drafts specs for approved Change Set
34
+ → STOP — await user approval, then commits specs
35
+
36
+ #prompt:kc-implement
37
+ → Reads WorkGroup + specs, TDD Red-Green-Refactor
38
+ → STOP — report implementation results
39
+
40
+ #prompt:kc-audit
41
+ → READ-ONLY audit against VERIFY statements
42
+ → STOP — report gaps, await user decision
43
+
44
+ #prompt:kc-finalize
45
+ → Updates specs to as-built, tracker, log, architecture check, commits
46
+ ```
47
+
48
+ ### Shortcut Workflows
49
+
50
+ | Prompt | Use Case |
51
+ |--------|----------|
52
+ | `#prompt:kc-fix "description"` | Single-file, <50 line fixes — skip the full loop |
53
+ | `#prompt:kc-plan "topic"` | Research and investigation before implementing |
54
+ | `#prompt:kc-continue` | Resume interrupted work or advance to next phase |
55
+ | `#prompt:kc-analyze` | Re-run Phase 1A on an existing WorkGroup |
56
+
57
+ ### Prompt File Location
58
+
59
+ All prompt files live in `.github/prompts/` and are generated by `/kc:init` (or `npx knowzcode`). They use YAML frontmatter with `agent: "agent"` for file editing capability.
60
+
61
+ ---
62
+
63
+ ## VS Code Agent Mode
64
+
65
+ Copilot prompt files with `agent: "agent"` in their frontmatter enable agent mode, which allows:
66
+
67
+ - File creation and editing
68
+ - Terminal command execution (tests, builds, linting)
69
+ - Multi-file changes in a single session
70
+
71
+ All KnowzCode prompt files use `agent: "agent"` for TDD implementation, spec writing, and WorkGroup file updates.
72
+
73
+ ### Using Prompt Files
74
+
75
+ In VS Code Copilot Chat:
76
+ 1. Type `#prompt:kc-work` to invoke the workflow prompt
77
+ 2. Add your goal as the chat message: `#prompt:kc-work "Build JWT authentication"`
78
+ 3. Copilot loads the prompt file, pulls in `#file:` referenced context, and executes
79
+
80
+ ### Adding Extra Context
81
+
82
+ You can add files to the prompt context manually:
83
+ - Reference files in chat: `#file:src/auth/login.ts`
84
+ - The prompt files already include `#file:` references for core KnowzCode files
85
+
86
+ ---
87
+
88
+ ## Copilot CLI Usage
89
+
90
+ The Copilot CLI does not support `#prompt:` syntax. Check the current CLI documentation for the exact file reference syntax — it may differ from VS Code's `#file:` references.
91
+
92
+ Alternatively, paste the goal and reference the methodology directly in the CLI prompt. The CLI provides the same AI capabilities but without the `#prompt:` shorthand.
93
+
94
+ ---
95
+
96
+ ## Copilot Coding Agent Integration
97
+
98
+ The GitHub Copilot Coding Agent (cloud-based, triggered from GitHub Issues) follows `copilot-instructions.md` automatically when working on repository issues.
99
+
100
+ ### Behavior
101
+
102
+ When the Coding Agent picks up an issue:
103
+ 1. Reads `.github/copilot-instructions.md` for methodology
104
+ 2. Follows Phase 1A→3 workflow for non-trivial changes
105
+ 3. Includes the Change Set in the PR description
106
+ 4. Uses TDD — failing test before implementation code
107
+ 5. Self-audits against spec VERIFY statements
108
+
109
+ ### Key Differences from Interactive Use
110
+
111
+ | Aspect | Interactive (VS Code) | Coding Agent (GitHub) |
112
+ |--------|----------------------|----------------------|
113
+ | Phase transitions | User invokes each `#prompt:kc-*` | Agent runs all phases autonomously |
114
+ | Quality gates | STOP and wait for user | Deferred to PR review |
115
+ | Prompt files | Used via `#prompt:` | Not used — follows `copilot-instructions.md` |
116
+ | Approval | Interactive at each gate | PR reviewers approve |
117
+
118
+ ### PR Description Format
119
+
120
+ The Coding Agent should structure PR descriptions to reflect the KnowzCode workflow:
121
+
122
+ ```markdown
123
+ ## Change Set
124
+ - NodeID: Description
125
+ - Affected files: list
126
+
127
+ ## Specs
128
+ - Link to spec files created/updated
129
+
130
+ ## Verification
131
+ - Test results summary
132
+ - Self-audit completion percentage
133
+ ```
134
+
135
+ ---
136
+
137
+ ## MCP Configuration for VS Code
138
+
139
+ To enable vault access in Copilot, configure `.vscode/mcp.json`:
140
+
141
+ ```json
142
+ {
143
+ "servers": {
144
+ "knowzcode": {
145
+ "type": "http",
146
+ "url": "${input:knowzcode_mcp_url}",
147
+ "headers": {
148
+ "x-api-key": "${input:knowzcode_api_key}"
149
+ }
150
+ }
151
+ },
152
+ "inputs": [
153
+ {
154
+ "id": "knowzcode_mcp_url",
155
+ "description": "KnowzCode MCP server URL",
156
+ "type": "promptString"
157
+ },
158
+ {
159
+ "id": "knowzcode_api_key",
160
+ "description": "KnowzCode API key",
161
+ "type": "promptString",
162
+ "password": true
163
+ }
164
+ ]
165
+ }
166
+ ```
167
+
168
+ MCP provides `search_knowledge`, `ask_question`, and `create_knowledge` tools for vault access. All prompt files work without MCP — it enhances context but never blocks.
169
+
170
+ ---
171
+
172
+ ## Model Selection Guidance
173
+
174
+ | Phase | Recommended Model | Rationale |
175
+ |-------|------------------|-----------|
176
+ | 1A: Analysis | Claude Opus / GPT-4o | Complex reasoning about impact and scope |
177
+ | 1B: Specification | Claude Opus / GPT-4o | Structured spec drafting requires depth |
178
+ | 2A: Implementation | Any capable model | Code generation — Sonnet/GPT-4o sufficient |
179
+ | 2B: Audit | Claude Opus / GPT-4o | Critical evaluation requires strong reasoning |
180
+ | 3: Finalization | Any capable model | Mostly doc updates and formatting |
181
+ | Quick fix | Any model | Simple, scoped changes |
182
+
183
+ VS Code allows model selection per chat session. For complex features, prefer stronger models for analysis and audit phases.
184
+
185
+ ---
186
+
187
+ ## Limitations and Workarounds
188
+
189
+ | Limitation | Impact | Workaround |
190
+ |-----------|--------|------------|
191
+ | No multi-agent orchestration | Cannot run parallel analysis/implementation | Sequential phase execution via prompt files |
192
+ | No inter-agent messaging | No scout/scribe delegation | Single agent reads all context directly |
193
+ | No task dependency tracking | No automated phase progression | User manually invokes next prompt |
194
+ | No persistent agents | Context reloaded each prompt invocation | WorkGroup files carry state between invocations |
195
+ | No dynamic agent spawning | Cannot create specialized agents at runtime | Prompt files encode all phase specialization |
196
+ | CLI lacks `#prompt:` support | Cannot use prompt shorthand in CLI | Check CLI docs for file reference syntax, or paste prompt content |
197
+
198
+ ### What Works Well
199
+
200
+ - Agent mode provides full file editing and terminal access
201
+ - `#file:` references efficiently pull in methodology and context
202
+ - WorkGroup files maintain state across sessions
203
+ - Copilot Coding Agent follows `copilot-instructions.md` for autonomous issue resolution
204
+ - MCP tools integrate natively via `.vscode/mcp.json`
205
+
206
+ ---
207
+
208
+ ## Continue / Resume Workflow
209
+
210
+ When a user invokes `#prompt:kc-continue`:
211
+
212
+ 1. **Find active WorkGroup**: Read `knowzcode/knowzcode_tracker.md` for `[WIP]` entries
213
+ 2. **Determine current phase**: Read the WorkGroup file's Phase History table
214
+ 3. **Resume or advance**:
215
+ - If mid-phase (incomplete todos): Resume the current phase
216
+ - If at a quality gate (phase complete, awaiting approval): Present results and await decision
217
+ - If between phases (approved, next not started): Begin the next phase
218
+ 4. **Guide user**: Tell the user which `#prompt:kc-*` to invoke next, or proceed directly if the continue prompt can handle it
219
+
220
+ ### Phase Detection Logic
221
+
222
+ | WorkGroup State | Action |
223
+ |----------------|--------|
224
+ | Phase 1A complete, no approval recorded | Present Change Set for approval |
225
+ | Phase 1A approved, no specs drafted | Advise: `#prompt:kc-specify` |
226
+ | Phase 1B complete, no approval recorded | Present specs for approval |
227
+ | Phase 1B approved, no implementation started | Advise: `#prompt:kc-implement` |
228
+ | Phase 2A complete | Advise: `#prompt:kc-audit` |
229
+ | Phase 2B complete, gaps found | Advise: fix gaps then `#prompt:kc-implement`, or `#prompt:kc-finalize` to accept |
230
+ | Phase 2B complete, no gaps | Advise: `#prompt:kc-finalize` |
231
+ | No active WorkGroup | Inform user, suggest `#prompt:kc-work` |
@@ -1,5 +1,7 @@
1
1
  # Enterprise Compliance Manifest
2
2
 
3
+ > **Status: Experimental** — This feature is partially implemented. Security guidelines are functional; code-quality guidelines are templates only. No automated tests exist yet. Use at your own discretion.
4
+
3
5
  **Purpose:** Defines which enterprise guidelines are active and their enforcement level.
4
6
 
5
7
  ---
@@ -110,6 +112,9 @@ When `mcp_compliance_enabled: true`:
110
112
  | analyst | create_knowledge | After 1A approval | Scope decisions, risk assessment |
111
113
  | reviewer | create_knowledge | After 2B audit | Audit findings, security posture |
112
114
  | closer | create_knowledge | After Phase 3 | Completion record, architecture changes |
115
+ | security-officer | search_knowledge | Stage 0, Stage 2 | Organization security standards, past security findings |
116
+ | test-advisor | (read-only) | Stage 2 | Enterprise ARC criteria for test coverage check |
117
+ | project-advisor | (read-only) | Stage 0 | Compliance config gaps for backlog proposals |
113
118
 
114
119
  ---
115
120
 
@@ -24,7 +24,7 @@
24
24
 
25
25
  ## 3. The Main Operational Loop
26
26
 
27
- ### Phase 1A: Impact Analysis
27
+ ### 3.1 Phase 1A: Impact Analysis
28
28
 
29
29
  Receive the goal from the user. Identify the **Change Set** — all components affected by this change.
30
30
 
@@ -68,7 +68,7 @@ NodeIDs must be **domain concepts**, not tasks.
68
68
  **Historical Context:** Before proposing the Change Set, scan `knowzcode/workgroups/` for completed WorkGroups that touched similar components. Reference relevant context in your proposal.
69
69
 
70
70
  #### Quality Gate: Change Set Approval
71
- Present the proposed Change Set to the user. **PAUSE and await user approval.** Do NOT proceed to Phase 1B until the user explicitly approves.
71
+ Present the proposed Change Set to the user. **PAUSE and await user approval.** Do NOT proceed to Phase 1B until the user explicitly approves. In autonomous mode, auto-approve and proceed immediately (see Section 5).
72
72
 
73
73
  Upon approval, generate a unique WorkGroupID and update `knowzcode_tracker.md` for all nodes to `[WIP]`.
74
74
 
@@ -79,7 +79,7 @@ Upon approval, generate a unique WorkGroupID and update `knowzcode_tracker.md` f
79
79
 
80
80
  ---
81
81
 
82
- ### Phase 1B: Specification
82
+ ### 3.2 Phase 1B: Specification
83
83
 
84
84
  Draft or refine `knowzcode/specs/[NodeID].md` for all nodes in the Change Set.
85
85
 
@@ -115,13 +115,13 @@ Known limitations and future work.
115
115
  **Backward compatibility:** Old numbered-section specs remain valid until naturally touched. When finalizing, rewrite in the new format.
116
116
 
117
117
  #### Quality Gate: Spec Approval
118
- Present drafted specs to the user. **PAUSE and await user approval.** Log "SpecApproved" events.
118
+ Present drafted specs to the user. **PAUSE and await user approval.** Log "SpecApproved" events. In autonomous mode, auto-approve and proceed immediately (see Section 5).
119
119
 
120
120
  **Pre-Implementation Commit:** After specs are approved, commit `knowzcode/` to create a checkpoint before implementation begins.
121
121
 
122
122
  ---
123
123
 
124
- ### Phase 2A: Implementation (TDD MANDATORY)
124
+ ### 3.3 Phase 2A: Implementation (TDD MANDATORY)
125
125
 
126
126
  For each NodeID in the approved Change Set:
127
127
 
@@ -160,7 +160,7 @@ Report implementation results including test counts, verification iterations, an
160
160
 
161
161
  ---
162
162
 
163
- ### Phase 2B: Completeness Audit
163
+ ### 3.4 Phase 2B: Completeness Audit
164
164
 
165
165
  An independent, READ-ONLY audit verifying what percentage of specifications were actually implemented.
166
166
 
@@ -177,11 +177,11 @@ An independent, READ-ONLY audit verifying what percentage of specifications were
177
177
  - Cancel the WorkGroup
178
178
 
179
179
  #### Quality Gate: Audit Approval
180
- Present audit results to the user. **PAUSE for decision.** Only proceed to Phase 3 when the user approves.
180
+ Present audit results to the user. **PAUSE for decision.** Only proceed to Phase 3 when the user approves. In autonomous mode, auto-approve and proceed immediately unless safety exceptions apply (see Section 5).
181
181
 
182
182
  ---
183
183
 
184
- ### Phase 3: Atomic Finalization
184
+ ### 3.5 Phase 3: Atomic Finalization
185
185
 
186
186
  Once implementation is verified and approved, execute finalization:
187
187
 
@@ -258,28 +258,66 @@ You **MUST** pause and await explicit user approval at:
258
258
  * If you encounter a critical, unresolvable issue
259
259
  * If an architecture discrepancy is too complex to fix autonomously
260
260
 
261
+ ### Autonomous Mode Override
262
+
263
+ When the user conveys intent for autonomous operation — through natural language (e.g., "approve all", "preapprove", "autonomous mode", "just run through", "I trust your judgement") or the `--autonomous` flag — quality gates above are still **presented** for transparency but **auto-approved** without waiting for user input. The workflow runs from start to finalization uninterrupted.
264
+
265
+ The lead should interpret the **spirit** of the user's instruction, not just exact keyword matches. If the user clearly wants the workflow to proceed without stopping, that constitutes autonomous mode activation.
266
+
267
+ **Safety exceptions** — ALWAYS pause even in autonomous mode:
268
+ * Critical, unresolvable blockers (Section 11)
269
+ * Security vulnerabilities rated HIGH or CRITICAL
270
+ * >3 failures on the same phase
271
+ * Architecture discrepancies too complex to fix autonomously
272
+ * >3 gap-fix iterations per partition without resolution
273
+
274
+ Autonomous mode is per-WorkGroup and does not carry over.
275
+
261
276
  ---
262
277
 
263
278
  ## 6. MCP Integration (Optional but Recommended)
264
279
 
265
280
  If KnowzCode MCP server is configured (`knowzcode/mcp_config.md` or `knowzcode/knowzcode_vaults.md`), agents can leverage vault queries to enhance every phase.
266
281
 
282
+ **Before using MCP, read `knowzcode/knowzcode_vaults.md` to resolve vault IDs by type.** Use the vault's description to confirm the query is appropriate for that vault. If a single vault covers all types, use it for everything. Never hardcode vault names — always resolve from config.
283
+
284
+ ### Vault Types
285
+
286
+ | Type | Purpose | Example Queries |
287
+ |------|---------|-----------------|
288
+ | **code** | Reference implementations, code snippets, API patterns | `"authentication middleware pattern"`, `"error handling in {framework}"` |
289
+ | **ecosystem** | Business rules, conventions, decisions, integrations, platform knowledge | `"checkout flow rules"`, `"pricing constraints"`, `"Stripe webhook setup"` |
290
+ | **finalizations** | WorkGroup completion summaries, outcome records | `"past decisions about {component}"`, `"similar WorkGroups"` |
291
+
292
+ A project may configure one vault covering all types (common for small teams) or multiple specialized vaults. Knowz-scribe (or direct MCP calls) writes to vaults; knowz-scout has read access only. The scribe is the primary capture agent that routes writes to the correct vault based on content type.
293
+
267
294
  ### Phase-Specific Usage
268
295
 
269
296
  | Phase | MCP Tool | Purpose |
270
297
  |-------|----------|---------|
271
- | **1A (Analysis)** | `search_knowledge(research_vault, "past decisions about {domain}")` | Find prior decisions affecting components |
272
- | **1B (Spec)** | `ask_question(research_vault, "conventions for {component_type}?")` | Check team conventions before drafting |
273
- | **2A (Build)** | `search_knowledge(code_vault, "{similar_feature} implementation")` | Find reference implementations |
274
- | **2B (Audit)** | `ask_question(research_vault, "standards for {domain}", researchMode=true)` | Comprehensive standards check |
275
- | **3 (Close)** | `create_knowledge(research_vault, ...)` | Capture patterns, decisions, workarounds |
298
+ | **1A (Analysis)** | `search_knowledge({vault matching "ecosystem" type}, "past decisions about {domain}")` | Find prior decisions affecting components |
299
+ | **1B (Spec)** | `ask_question({vault matching "ecosystem" type}, "conventions for {component_type}?")` | Check team conventions before drafting |
300
+ | **2A (Build)** | `search_knowledge({vault matching "code" type}, "{similar_feature} implementation")` | Find reference implementations |
301
+ | **2B (Audit)** | `ask_question({vault matching "ecosystem" type}, "standards for {domain}", researchMode=true)` | Comprehensive standards check |
302
+ | **3 (Close)** | Delegate to knowz-scribe (or `create_knowledge` directly if no scribe) | Capture patterns, decisions, workarounds |
303
+
304
+ ### Knowz-Scribe (Multi-Agent Platforms)
305
+
306
+ On platforms with multi-agent orchestration (e.g., Claude Code Agent Teams), **knowz-scribe** has full read/write access to MCP vaults, and **knowz-scout** has read access to MCP vaults. Both have read/write access to local knowzcode files:
307
+
308
+ - Both spawned at workflow start (persistent agents, Stage 0 through Phase 3)
309
+ - **Knowz-scribe** is the primary capture agent — receives capture messages from teammates at each quality gate (e.g., `"Capture Phase 1A: {wgid}"`), reads the WorkGroup file, extracts learnings, and writes to the appropriate vault. Handles deduplication, formatting, and routing to the correct vault by type.
310
+ - **Knowz-scout** is the primary research agent — queries vaults for business context, conventions, and past decisions.
311
+ - Both stay alive through the entire workflow, shut down after Phase 3 capture
312
+
313
+ On platforms without multi-agent orchestration, the closer handles vault writes directly (see Section 7).
276
314
 
277
315
  ### Enterprise: Team Standards
278
316
 
279
- At workflow start, if enterprise vault is configured (`knowzcode/enterprise/compliance_manifest.md` has `mcp_compliance_enabled: true`):
317
+ At workflow start, if an enterprise-type vault is configured (read `knowzcode/knowzcode_vaults.md` to find vault matching type "enterprise", then check `knowzcode/enterprise/compliance_manifest.md` for `mcp_compliance_enabled: true`):
280
318
  - Pull team-wide standards and merge into quality gate criteria
281
- - Push audit results to enterprise vault after Phase 2B
282
- - Push completion records to enterprise vault after Phase 3
319
+ - Push audit results to the resolved enterprise vault after Phase 2B
320
+ - Push completion records to the resolved enterprise vault after Phase 3
283
321
 
284
322
  ### Graceful Degradation
285
323
 
@@ -301,45 +339,48 @@ During finalization, scan the WorkGroup for insight-worthy patterns:
301
339
 
302
340
  ### Auto-Capture Triggers
303
341
 
304
- Learning candidates are detected at each quality gate. If MCP is available, write concrete knowledge entries:
342
+ Learning candidates are detected at each quality gate. Capture is delegated to the knowz-scribe agent on multi-agent platforms, or handled directly via MCP tools on single-agent platforms.
305
343
 
306
- **After Phase 1A approval:**
307
- ```
308
- If MCP available:
309
- create_knowledge(research_vault, title="Scope: {goal}",
310
- content="[NodeIDs] {list}\n[Risk] {assessment}\n[Decision] {user feedback}",
311
- tags=["scope", "change-set"])
312
- ```
344
+ **Multi-agent platforms (knowz-scribe active):**
313
345
 
314
- **After Phase 2A completion:**
315
- - Capture implementation patterns and workarounds discovered during TDD cycles
346
+ At each quality gate, send a message to the knowz-scribe with the phase identifier:
347
+ - After Phase 1A approval: `"Capture Phase 1A: {wgid}"`
348
+ - After Phase 2A completion: `"Capture Phase 2A: {wgid}"`
349
+ - After Phase 2B audit: `"Capture Phase 2B: {wgid}"`
350
+ - After Phase 3 finalization: `"Capture Phase 3: {wgid}"`
316
351
 
317
- **After Phase 2B audit:**
318
- ```
319
- If MCP available:
320
- create_knowledge(research_vault, title="Audit: {wgid} - {score}%",
321
- content="[Findings] {gaps}\n[Security] {issues}\n[Decision] {user choice}",
322
- tags=["audit", "quality"])
323
- If MCP available AND enterprise vault configured:
324
- create_knowledge(enterprise_vault, title="Audit: {wgid} - {score}%",
325
- content="[Findings] {gaps}\n[Security] {issues}\n[Decision] {user choice}",
326
- tags=["audit", "enterprise"])
327
- ```
352
+ The knowz-scribe reads the WorkGroup file, extracts relevant data, checks for duplicates, and writes to the appropriate vault. No other agent should call `create_knowledge` when the scribe is active.
353
+
354
+ **Single-agent / no scribe (direct MCP writes):**
328
355
 
329
- **After Phase 3 finalization:**
330
- - Capture architectural learnings and consolidation decisions (handled by closer agent)
356
+ If MCP is available but no knowz-scribe, resolve vault IDs from `knowzcode/knowzcode_vaults.md` before writing:
357
+
358
+ - After Phase 1A: `create_knowledge({ecosystem_vault}, title="Scope: {goal}", content="[NodeIDs] {list}\n[Risk] {assessment}", tags=["scope"])`
359
+ - After Phase 2A: Capture implementation patterns and workarounds discovered during TDD cycles
360
+ - After Phase 2B: `create_knowledge({ecosystem_vault}, title="Audit: {wgid} - {score}%", content="[Findings] {gaps}\n[Security] {issues}", tags=["audit"])`
361
+ - After Phase 2B (enterprise): If enterprise vault configured and compliance enabled, push audit results to enterprise vault
362
+ - After Phase 3: Capture architectural learnings and consolidation decisions (handled by closer agent)
331
363
 
332
364
  ### Capture Protocol
333
365
 
334
- If MCP is available:
335
- 1. Detect learning candidates from WorkGroup file content
336
- 2. Check for duplicates via `search_knowledge` skip if substantially similar exists
337
- 3. Prompt user for approval before saving
338
- 4. Create learning via `create_knowledge` with appropriate title prefix
366
+ **When knowz-scribe is active (multi-agent platforms):**
367
+ 1. Send capture message to knowz-scribe with phase identifier and WorkGroup ID
368
+ 2. The scribe handles: vault ID resolution, duplicate checking, user approval prompting, and writing
369
+ 3. No other agent should call `create_knowledge` directly
370
+
371
+ **When no knowz-scribe (single-agent / sequential):**
372
+ 1. Read `knowzcode/knowzcode_vaults.md` to resolve vault IDs by type
373
+ 2. Detect learning candidates from WorkGroup file content
374
+ 3. Check for duplicates via `search_knowledge` — skip if substantially similar exists
375
+ 4. Prompt user for approval before saving
376
+ 5. Only write if the targeted vault is configured — skip gracefully if not
377
+ 6. Create learning via `create_knowledge` with appropriate title prefix
339
378
 
340
379
  ### Audit Trail (Enterprise)
341
380
 
342
- After Phase 3, if enterprise vault is configured:
381
+ After Phase 3:
382
+ 1. Read `knowzcode/knowzcode_vaults.md` to find vault matching type "enterprise"
383
+ 2. Only push if an enterprise vault is configured
343
384
  - Push WorkGroup completion record with goal, NodeIDs, audit score, and decisions
344
385
  - Push architecture drift findings if any detected during finalization
345
386
 
@@ -378,9 +419,36 @@ When a single AI handles all phases sequentially:
378
419
  - Pause at each gate for user approval
379
420
  - All quality standards apply identically
380
421
 
422
+ ### Parallel Execution (Multi-Agent Platforms)
423
+
424
+ On platforms supporting concurrent agents (Claude Code Agent Teams, future multi-agent runtimes):
425
+
426
+ #### Parallelism Boundaries
427
+ - **Between phases**: Phase 1A must produce Change Set before 1B drafts specs (scope must be approved first)
428
+ - **Within phases**: Independent NodeIDs can be implemented/audited in parallel
429
+ - **Across phases**: Incremental review can start on completed components while other components are still being implemented
430
+ - **Agent persistence**: Agents can stay alive across sub-phases to avoid cold-start overhead (e.g., builder persists through audit gap loop)
431
+
432
+ #### Dependency Map
433
+ The analyst produces a dependency map alongside the Change Set, identifying:
434
+ - Which NodeIDs share affected files (must be implemented sequentially or by same agent)
435
+ - Which NodeIDs are independent (can be implemented in parallel)
436
+ - Sequential dependencies (NodeID-B requires NodeID-A's output)
437
+
438
+ #### Incremental Review
439
+ The reviewer can audit completed NodeIDs before all implementation finishes. Gap findings are routed back to the implementer for targeted fixes, then re-audited. Agents persist through this gap loop — no respawning.
440
+
441
+ #### Context Scouts
442
+ Dedicated context-gathering agents can run in parallel with core analysis:
443
+ - Local context scout: reads project history, specs, workgroups
444
+ - Knowz scout: queries and writes to knowledge management vaults for business context (full read/write access)
445
+ Both broadcast findings to inform analyst and architect work.
446
+
381
447
  ### Sequential Execution Protocol (for platforms without orchestration)
382
448
 
383
- For platforms like Cursor, Copilot, or Windsurf where there is no agent orchestration:
449
+ For platforms like Cursor, Copilot, or Windsurf where there is no agent orchestration.
450
+
451
+ **Copilot users:** Instead of manually reading phase prompts, use `#prompt:kc-*` prompt files in VS Code Copilot Chat (e.g., `#prompt:kc-work`, `#prompt:kc-specify`). These prompt files encode the sequential protocol below with `#file:` references for context. See `knowzcode/copilot_execution.md` for the full Copilot execution guide.
384
452
 
385
453
  ```
386
454
  FOR each phase in [1A, 1B, 2A, 2B, 3]:
@@ -0,0 +1,66 @@
1
+ # KnowzCode Orchestration Configuration
2
+
3
+ **Purpose:** Project-level defaults for team sizing and agent orchestration. Read by `/kc:work` and `/kc:audit` at startup. Per-invocation flags override these settings.
4
+
5
+ ---
6
+
7
+ ## Builder Configuration
8
+
9
+ ```yaml
10
+ # Maximum concurrent builders in Parallel Teams mode (default: 5, range: 1-5)
11
+ # Lower values reduce token usage and complexity; higher values increase parallelism.
12
+ # If the dependency map produces fewer partitions, fewer builders spawn regardless.
13
+ max_builders: 5
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Scout Configuration
19
+
20
+ ```yaml
21
+ # Scout mode controls context-scout spawning at Stage 0 (default: full)
22
+ # full — 3 scouts: specs, workgroups, backlog (default)
23
+ # minimal — 1 scout: combined scan of all local context
24
+ # none — skip scouts entirely (lead loads context inline)
25
+ scout_mode: full
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Specialist Defaults
31
+
32
+ ```yaml
33
+ # Specialists enabled by default for this project (default: none)
34
+ # These activate without needing --specialists on every invocation.
35
+ # Per-invocation --no-specialists overrides this setting.
36
+ # Values: security-officer, test-advisor, project-advisor
37
+ default_specialists: []
38
+
39
+ # Examples:
40
+ # default_specialists: [security-officer]
41
+ # default_specialists: [security-officer, test-advisor]
42
+ # default_specialists: [security-officer, test-advisor, project-advisor]
43
+ ```
44
+
45
+ ---
46
+
47
+ ## MCP Agent Configuration
48
+
49
+ ```yaml
50
+ # Enable MCP agents (knowz-scout, knowz-scribe) when vaults are configured (default: true)
51
+ # Set to false to skip vault agents even when vaults exist — reduces agent count.
52
+ mcp_agents_enabled: true
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Override Precedence
58
+
59
+ | Setting | Config Default | Flag Override |
60
+ |---------|---------------|--------------|
61
+ | max_builders | `max_builders:` | `--max-builders=N` |
62
+ | scout_mode | `scout_mode:` | `--no-scouts` |
63
+ | default_specialists | `default_specialists:` | `--specialists`, `--no-specialists` |
64
+ | mcp_agents_enabled | `mcp_agents_enabled:` | `--no-mcp` |
65
+
66
+ Per-invocation flags always win. `--specialists` adds to defaults; `--no-specialists` clears all.