knowzcode 0.2.1 → 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.
@@ -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` |
@@ -112,6 +112,9 @@ When `mcp_compliance_enabled: true`:
112
112
  | analyst | create_knowledge | After 1A approval | Scope decisions, risk assessment |
113
113
  | reviewer | create_knowledge | After 2B audit | Audit findings, security posture |
114
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 |
115
118
 
116
119
  ---
117
120
 
@@ -446,7 +446,9 @@ Both broadcast findings to inform analyst and architect work.
446
446
 
447
447
  ### Sequential Execution Protocol (for platforms without orchestration)
448
448
 
449
- 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.
450
452
 
451
453
  ```
452
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.