knowzcode 0.1.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 (73) hide show
  1. package/.claude-plugin/marketplace.json +55 -0
  2. package/.claude-plugin/plugin.json +8 -0
  3. package/LICENSE +121 -0
  4. package/README.md +223 -0
  5. package/agents/analyst.md +121 -0
  6. package/agents/architect.md +121 -0
  7. package/agents/builder.md +155 -0
  8. package/agents/closer.md +148 -0
  9. package/agents/knowledge-migrator.md +349 -0
  10. package/agents/microfix-specialist.md +140 -0
  11. package/agents/reviewer.md +220 -0
  12. package/agents/update-coordinator.md +405 -0
  13. package/bin/knowzcode.mjs +869 -0
  14. package/commands/audit.md +108 -0
  15. package/commands/connect-mcp.md +507 -0
  16. package/commands/fix.md +107 -0
  17. package/commands/init.md +320 -0
  18. package/commands/learn.md +308 -0
  19. package/commands/plan.md +125 -0
  20. package/commands/register.md +724 -0
  21. package/commands/status.md +291 -0
  22. package/commands/telemetry-setup.md +368 -0
  23. package/commands/telemetry.md +188 -0
  24. package/commands/work.md +390 -0
  25. package/knowzcode/automation_manifest.md +59 -0
  26. package/knowzcode/claude_code_execution.md +133 -0
  27. package/knowzcode/enterprise/compliance_manifest.md +132 -0
  28. package/knowzcode/enterprise/compliance_status.md +30 -0
  29. package/knowzcode/enterprise/guidelines/code-quality.md +67 -0
  30. package/knowzcode/enterprise/guidelines/custom/.gitkeep +0 -0
  31. package/knowzcode/enterprise/guidelines/security.md +355 -0
  32. package/knowzcode/enterprise/reports/.gitkeep +0 -0
  33. package/knowzcode/enterprise/templates/guideline-template.md +55 -0
  34. package/knowzcode/gitignore.template +13 -0
  35. package/knowzcode/knowzcode_architecture.md +51 -0
  36. package/knowzcode/knowzcode_log.md +142 -0
  37. package/knowzcode/knowzcode_loop.md +515 -0
  38. package/knowzcode/knowzcode_project.md +233 -0
  39. package/knowzcode/knowzcode_tracker.md +40 -0
  40. package/knowzcode/knowzcode_vaults.md +104 -0
  41. package/knowzcode/mcp_config.md +166 -0
  42. package/knowzcode/planning/Readme.md +6 -0
  43. package/knowzcode/platform_adapters.md +388 -0
  44. package/knowzcode/prompts/Execute_Micro_Fix.md +57 -0
  45. package/knowzcode/prompts/Investigate_Codebase.md +227 -0
  46. package/knowzcode/prompts/Migrate_Knowledge.md +301 -0
  47. package/knowzcode/prompts/Refactor_Node.md +72 -0
  48. package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -0
  49. package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -0
  50. package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -0
  51. package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -0
  52. package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -0
  53. package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -0
  54. package/knowzcode/specs/Readme.md +10 -0
  55. package/knowzcode/telemetry_config.md +89 -0
  56. package/knowzcode/user_preferences.md +120 -0
  57. package/package.json +53 -0
  58. package/skills/alias-resolver.json +15 -0
  59. package/skills/architecture-diff.json +12 -0
  60. package/skills/check-installation-status.json +14 -0
  61. package/skills/continue.md +105 -0
  62. package/skills/environment-guard.json +12 -0
  63. package/skills/generate-workgroup-id.json +25 -0
  64. package/skills/install-knowzcode.json +21 -0
  65. package/skills/load-core-context.json +18 -0
  66. package/skills/log-entry-builder.json +15 -0
  67. package/skills/spec-quality-check.json +14 -0
  68. package/skills/spec-template.json +15 -0
  69. package/skills/spec-validator.json +25 -0
  70. package/skills/start-work.md +224 -0
  71. package/skills/tracker-scan.json +12 -0
  72. package/skills/tracker-update.json +28 -0
  73. package/skills/validate-installation.json +14 -0
@@ -0,0 +1,188 @@
1
+ ---
2
+ description: "Investigate telemetry data from Sentry, App Insights, and other sources"
3
+ argument-hint: "<natural language description>"
4
+ ---
5
+
6
+ # KnowzCode Telemetry Investigation
7
+
8
+ Investigate production telemetry to diagnose errors, trace issues, and identify root causes.
9
+
10
+ **Usage**: `/kc:telemetry "<natural language description>"`
11
+
12
+ Describe everything in plain English - environment, timeframe, and error context will be extracted automatically.
13
+
14
+ **Examples**:
15
+ ```
16
+ /kc:telemetry "in staging in the last 20 min, error 500"
17
+ /kc:telemetry "NullReferenceException in production over the past hour"
18
+ /kc:telemetry "checkout failures in dev since this morning"
19
+ /kc:telemetry "slow API responses in user service today"
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Parameter
25
+
26
+ | Parameter | Required | Description |
27
+ |-----------|----------|-------------|
28
+ | `description` | Yes | Natural language query describing what to investigate, including any context about environment, timeframe, etc. |
29
+
30
+ ---
31
+
32
+ ## Workflow
33
+
34
+ ### Step 1: Parse Natural Language Query
35
+
36
+ Extract from the user's description:
37
+ - **Environment**: staging/production/dev (from phrases like "in staging", "in prod")
38
+ - **Timeframe**: How far back to search (from phrases like "last 20 min", "past 4 hours")
39
+ - **Search query**: The error/symptom to investigate (everything else)
40
+
41
+ ### Step 2: Load Configuration and Detect Sources
42
+
43
+ Before investigation, load configuration and verify sources are available AND authenticated.
44
+
45
+ #### 2.1 Load Telemetry Configuration
46
+
47
+ Read `knowzcode/telemetry_config.md` to get environment-to-resource mappings.
48
+
49
+ **Parse the config** to extract:
50
+ - **Sentry**: Enabled status, **method** (cli or mcp), organization, environment-to-project mappings
51
+ - **App Insights**: Enabled status, subscription, environment-to-app ID mappings
52
+
53
+ #### 2.2 Detect Tool Installation
54
+
55
+ ```bash
56
+ # Check Sentry CLI installation
57
+ which sentry-cli 2>/dev/null && echo "SENTRY_CLI_INSTALLED" || echo "NO_SENTRY_CLI"
58
+
59
+ # Check Azure CLI + App Insights extension
60
+ which az 2>/dev/null && az extension list --query "[?name=='application-insights'].name" -o tsv 2>/dev/null && echo "APPINSIGHTS_INSTALLED" || echo "NO_APPINSIGHTS"
61
+ ```
62
+
63
+ #### 2.3 Verify Authentication
64
+
65
+ For each installed tool, verify it's authenticated:
66
+
67
+ ```bash
68
+ # Sentry: Check authentication (quick check)
69
+ sentry-cli info 2>&1 | grep -q "Organization" && echo "SENTRY_AUTHENTICATED" || echo "SENTRY_NOT_AUTHENTICATED"
70
+
71
+ # Azure: Check authentication
72
+ az account show --query "name" -o tsv 2>/dev/null && echo "AZURE_AUTHENTICATED" || echo "AZURE_NOT_AUTHENTICATED"
73
+ ```
74
+
75
+ #### 2.4 Handle Configuration Issues
76
+
77
+ **If config doesn't exist or sources not configured:**
78
+
79
+ ```markdown
80
+ Telemetry not configured.
81
+
82
+ Run `/kc:telemetry-setup` to:
83
+ 1. Detect available telemetry tools
84
+ 2. Verify authentication
85
+ 3. Auto-discover projects/resources
86
+ 4. Configure environment mappings
87
+
88
+ After setup, re-run your telemetry query.
89
+ ```
90
+
91
+ **If tools not authenticated:**
92
+
93
+ ```markdown
94
+ Telemetry tools detected but not authenticated.
95
+
96
+ Sentry: {status}
97
+ App Insights: {status}
98
+
99
+ Run `/kc:telemetry-setup` to verify authentication and configure sources.
100
+ ```
101
+
102
+ ### Step 3: Investigate Telemetry
103
+
104
+ Spawn the **reviewer** agent to perform the telemetry investigation:
105
+
106
+ ```
107
+ Task(reviewer):
108
+ Investigate telemetry for the following issue.
109
+
110
+ Natural Language Query: {user's full natural language description}
111
+ Available Sources: {detected sources that are installed AND authenticated}
112
+
113
+ Telemetry Configuration:
114
+ - Sentry: {enabled, method, org, environment mappings}
115
+ - App Insights: {enabled, subscription, environment mappings}
116
+
117
+ Instructions:
118
+ 1. Parse the natural language query to extract environment, timeframe, and search terms
119
+ 2. Use the environment to look up the correct project/app ID from config
120
+ 3. Query available sources using CLI tools (sentry-cli, az monitor)
121
+ 4. Synthesize into unified timeline
122
+ 5. Generate root cause hypothesis
123
+ 6. Return structured findings
124
+ ```
125
+
126
+ ### Step 4: Present Findings
127
+
128
+ Display the synthesized telemetry investigation results:
129
+
130
+ ```markdown
131
+ ## KnowzCode Telemetry Investigation
132
+
133
+ **Original Query**: {user's natural language description}
134
+ **Extracted**:
135
+ - Environment: {extracted env}
136
+ - Timeframe: {extracted timeframe}
137
+ - Search: {extracted search terms}
138
+ **Sources Queried**: {list of sources}
139
+
140
+ ### Event Timeline (merged)
141
+ | Timestamp | Source | Type | Summary |
142
+ |-----------|--------|------|---------|
143
+ | ... | ... | ... | ... |
144
+
145
+ ### Root Cause Hypothesis
146
+ **Most Likely**: {hypothesis}
147
+ **Evidence**: {supporting evidence}
148
+ **Confidence**: HIGH/MEDIUM/LOW
149
+
150
+ ### Recommendations
151
+ 1. {quick fix recommendation}
152
+ 2. {proper fix recommendation}
153
+
154
+ ---
155
+
156
+ **Next Steps:**
157
+ - `/kc:fix {target}` - Apply a micro-fix
158
+ - `/kc:work "Fix {issue}"` - Full implementation workflow
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Integration with Other Commands
164
+
165
+ | Command | Relationship |
166
+ |---------|--------------|
167
+ | `/kc:fix` | Hand off quick fixes discovered |
168
+ | `/kc:work` | Hand off larger remediation tasks |
169
+ | `builder` | Can invoke telemetry investigation during debugging |
170
+ | `microfix-specialist` | Can invoke telemetry investigation for verification |
171
+
172
+ ---
173
+
174
+ ## Logging
175
+
176
+ After investigation, log to `knowzcode/knowzcode_log.md`:
177
+
178
+ ```markdown
179
+ ---
180
+ **Type:** Telemetry Investigation
181
+ **Timestamp:** {timestamp}
182
+ **Query:** {original natural language query}
183
+ **Extracted**: env={env}, timeframe={timeframe}
184
+ **Sources:** {sources queried}
185
+ **Finding:** {one-line root cause summary}
186
+ **Status:** Complete
187
+ ---
188
+ ```
@@ -0,0 +1,390 @@
1
+ ---
2
+ description: "Start a new KnowzCode development workflow with TDD, quality gates, and structured phases"
3
+ argument-hint: "[feature_description]"
4
+ ---
5
+
6
+ # Work on New Feature
7
+
8
+ Start a new KnowzCode development workflow session.
9
+
10
+ **Usage**: `/kc:work "feature description"`
11
+ **Example**: `/kc:work "Build user authentication with JWT"`
12
+
13
+ **Primary Goal**: $ARGUMENTS
14
+
15
+ ---
16
+
17
+ ## Step 0: Prerequisite Check
18
+
19
+ Verify KnowzCode is initialized:
20
+ 1. Check if `knowzcode/` directory exists
21
+ 2. Check required files exist: `knowzcode_loop.md`, `knowzcode_tracker.md`, `knowzcode_project.md`, `knowzcode_architecture.md`
22
+
23
+ If missing: inform user to run `/kc:init` first. STOP.
24
+
25
+ ## Step 1: Generate WorkGroup ID
26
+
27
+ **Format**: `kc-{type}-{slug}-YYYYMMDD-HHMMSS`
28
+
29
+ - `{type}`: feat, fix, refactor, or issue
30
+ - `{slug}`: 2-4 word kebab-case from goal (remove common words: build, add, create, implement, the, a, with, for)
31
+ - Truncate slug to max 25 characters
32
+
33
+ ## Step 2: Detect Execution Mode
34
+
35
+ Check if Agent Teams is enabled: you have team management capabilities (spawning teammates, shared task list, messaging) when `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set. If these tools are available, use Agent Teams mode. Otherwise, use subagent fallback.
36
+
37
+ The user never selects a mode — the phases, quality gates, and interactions are identical in both paths.
38
+
39
+ > **Note:** Agent Teams is experimental and the API may change.
40
+
41
+ ### If Agent Teams is available:
42
+
43
+ 1. Read `knowzcode/claude_code_execution.md` for team conventions
44
+ 2. You are the **team lead in delegate mode** — you coordinate phases, present quality gates, and manage the workflow. You NEVER write code, specs, or project files directly. All work is done by teammates. (Tip: the user can press Shift+Tab to system-enforce delegate mode.)
45
+ 3. For each phase:
46
+ - Spawn ONE teammate with the spawn prompt defined in that phase section below
47
+ - Create a task describing the phase work and assign it to the teammate
48
+ - Wait for the teammate to complete the task
49
+ - Review the teammate's output
50
+ - Present results at the quality gate for user approval
51
+ - Shut down the teammate before spawning the next phase's teammate
52
+ 4. After Phase 3 completes or if the user cancels at any point, shut down all active teammates (see Cleanup section)
53
+
54
+ ### If Agent Teams is NOT available (subagent fallback):
55
+
56
+ Use `Task()` calls to delegate each phase to the named agent. Pass the WorkGroupID, goal, and context file paths. This is the existing behavior — each phase section below includes both paths.
57
+
58
+ ## Step 3: Load Context Files (ONCE)
59
+
60
+ Read these files ONCE (do NOT re-read between phases):
61
+ - `knowzcode/knowzcode_loop.md`
62
+ - `knowzcode/knowzcode_tracker.md`
63
+ - `knowzcode/knowzcode_project.md`
64
+ - `knowzcode/knowzcode_architecture.md`
65
+
66
+ ## Step 3.5: Pull Team Standards (MCP — Optional)
67
+
68
+ If MCP is configured and enterprise compliance is enabled:
69
+ 1. Check `knowzcode/enterprise/compliance_manifest.md` for `mcp_compliance_enabled: true`
70
+ 2. If enabled: `ask_question(enterprise_vault, "team standards for {project_type}")`
71
+ 3. Merge returned standards into WorkGroup context for quality gate criteria
72
+
73
+ If MCP is not configured or enterprise is not enabled, skip this step.
74
+
75
+ ## Step 4: Create WorkGroup File
76
+
77
+ Create `knowzcode/workgroups/{WorkGroupID}.md`:
78
+ ```markdown
79
+ # WorkGroup: {WorkGroupID}
80
+
81
+ **Primary Goal**: {$ARGUMENTS}
82
+ **Created**: {timestamp}
83
+ **Status**: Active
84
+ **Current Phase**: 1A - Impact Analysis
85
+
86
+ ## Change Set
87
+ (Populated after Phase 1A)
88
+
89
+ ## Todos
90
+ - KnowzCode: Initialize WorkGroup
91
+ - KnowzCode: Complete Phase 1A impact analysis
92
+
93
+ ## Phase History
94
+ | Phase | Status | Timestamp |
95
+ |-------|--------|-----------|
96
+ | 1A | In Progress | {timestamp} |
97
+ ```
98
+
99
+ ## Step 5: Input Classification
100
+
101
+ **Question indicators** (suggest `/kc:plan` instead): starts with is/does/how/why/what/should, contains `?`, phrased as inquiry.
102
+
103
+ **Implementation indicators** (proceed): starts with build/add/create/implement/fix/refactor, action-oriented verbs.
104
+
105
+ If ambiguous, proceed with implementation.
106
+
107
+ ## Step 6: Spec Detection (Optional Optimization)
108
+
109
+ Check for existing specs covering this work:
110
+ 1. Extract key terms from goal
111
+ 2. Search `knowzcode/specs/*.md` for matching specs
112
+ 3. If comprehensive matching specs found, offer:
113
+ - **A) Quick Path** — skip discovery, use existing specs
114
+ - **B) Validation Path** (recommended) — quick check specs match codebase
115
+ - **C) Full Workflow** — complete Phase 1A discovery
116
+
117
+ If no matches found, proceed to Phase 1A.
118
+
119
+ ---
120
+
121
+ ## Phase 1A: Impact Analysis
122
+
123
+ ### Agent Teams Mode
124
+
125
+ Spawn a teammate named `analyst` with this prompt:
126
+
127
+ > You are the **analyst** for WorkGroup `{wgid}`.
128
+ > Read `agents/analyst.md` for your full role definition.
129
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
130
+ >
131
+ > **Goal**: {goal}
132
+ > **Context files**: `knowzcode/knowzcode_loop.md`, `knowzcode/knowzcode_tracker.md`, `knowzcode/knowzcode_project.md`, `knowzcode/knowzcode_architecture.md`
133
+ > **WorkGroup file**: `knowzcode/workgroups/{wgid}.md`
134
+ >
135
+ > **Deliverable**: Change Set proposal written to the WorkGroup file. Include NodeIDs, descriptions, affected files, and risk assessment.
136
+ > **Prefix rule**: All todo entries MUST start with `KnowzCode:`.
137
+
138
+ Create task: `Phase 1A: Impact analysis for "{goal}"` and assign to the analyst.
139
+ Wait for task completion, then review the Change Set output.
140
+
141
+ ### Subagent Mode
142
+
143
+ Delegate to the **analyst** agent via `Task()`. Pass WorkGroupID, goal, and context file paths.
144
+
145
+ ### Quality Gate #1 (both modes)
146
+
147
+ Present the Change Set for user approval:
148
+
149
+ ```markdown
150
+ ## Approval Gate #1: Change Set
151
+
152
+ **WorkGroupID**: {wgid}
153
+ **Proposed Change Set** ({N} nodes):
154
+ {NodeIDs with descriptions}
155
+
156
+ **Risk Assessment**: {Low/Medium/High}
157
+
158
+ Approve this Change Set to proceed to specification?
159
+ ```
160
+
161
+ If rejected: re-run analyst with user feedback. If approved: update tracker, proceed.
162
+
163
+ ---
164
+
165
+ ## Phase 1B: Specification
166
+
167
+ ### Agent Teams Mode
168
+
169
+ Spawn a teammate named `architect` with this prompt:
170
+
171
+ > You are the **architect** for WorkGroup `{wgid}`.
172
+ > Read `agents/architect.md` for your full role definition.
173
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
174
+ >
175
+ > **Goal**: {goal}
176
+ > **Approved Change Set**: {NodeIDs from Gate #1}
177
+ > **Context files**: `knowzcode/knowzcode_loop.md`, `knowzcode/knowzcode_project.md`, `knowzcode/knowzcode_architecture.md`
178
+ > **WorkGroup file**: `knowzcode/workgroups/{wgid}.md`
179
+ > **Specs directory**: `knowzcode/specs/`
180
+ >
181
+ > **Plan approval enabled**: Present your spec design (structure, VERIFY criteria, test strategy) for lead review BEFORE writing final specs. Wait for approval.
182
+ > **Deliverable**: Finalized specs for all NodeIDs written to `knowzcode/specs/`.
183
+ > **Prefix rule**: All todo entries MUST start with `KnowzCode:`.
184
+
185
+ Create task: `Phase 1B: Draft specifications for {N} NodeIDs` and assign to the architect.
186
+ Wait for the architect to present their plan. Review and approve or request changes.
187
+ After plan approval, wait for task completion.
188
+
189
+ ### Subagent Mode
190
+
191
+ Delegate to the **architect** agent via `Task()`. Pass WorkGroupID, approved Change Set NodeIDs, and context file paths.
192
+
193
+ ### Quality Gate #2 (both modes)
194
+
195
+ Present specs for batch approval:
196
+
197
+ ```markdown
198
+ ## Approval Gate #2: Specifications
199
+
200
+ **Specs Drafted**: {count}
201
+ | NodeID | File | Key VERIFY Criteria |
202
+ |--------|------|---------------------|
203
+ | ... | ... | ... |
204
+
205
+ Review specs and approve to proceed to implementation?
206
+ ```
207
+
208
+ If rejected: re-run specs needing revision. If approved: pre-implementation commit, proceed.
209
+
210
+ **Pre-Implementation Commit:**
211
+ ```bash
212
+ git add knowzcode/
213
+ git commit -m "KnowzCode: Specs approved for {WorkGroupID}"
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Phase 2A: Implementation
219
+
220
+ ### Agent Teams Mode
221
+
222
+ Spawn a teammate named `builder` with this prompt:
223
+
224
+ > You are the **builder** for WorkGroup `{wgid}`.
225
+ > Read `agents/builder.md` for your full role definition.
226
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
227
+ >
228
+ > **Goal**: {goal}
229
+ > **Approved Change Set**: {NodeIDs}
230
+ > **Specs**: {list of spec file paths from Phase 1B}
231
+ > **Context files**: `knowzcode/knowzcode_loop.md`, `knowzcode/knowzcode_project.md`
232
+ > **WorkGroup file**: `knowzcode/workgroups/{wgid}.md`
233
+ >
234
+ > **Plan approval enabled**: Present your implementation approach (file changes, test strategy, execution order) for lead review BEFORE writing code. Wait for approval.
235
+ > **TDD mandatory**: Write failing tests first, then implement, then refactor. Every NodeID must have tests.
236
+ > **Deliverable**: All NodeIDs implemented with passing tests. Update WorkGroup file with results.
237
+ > **Prefix rule**: All todo entries MUST start with `KnowzCode:`.
238
+
239
+ Create task: `Phase 2A: Implement {N} NodeIDs with TDD` and assign to the builder.
240
+ Wait for the builder to present their plan. Review and approve or request changes.
241
+ After plan approval, wait for task completion.
242
+
243
+ ### Subagent Mode
244
+
245
+ Delegate to the **builder** agent via `Task()`. Pass WorkGroupID, NodeIDs, spec file paths, and context file paths.
246
+
247
+ ### Phase 2A Output (both modes)
248
+
249
+ When complete, present implementation summary including files changed, tests written, and test results.
250
+
251
+ ---
252
+
253
+ ## Phase 2B: Completeness Audit
254
+
255
+ ### Agent Teams Mode
256
+
257
+ Spawn a teammate named `reviewer` with this prompt:
258
+
259
+ > You are the **reviewer** for WorkGroup `{wgid}`.
260
+ > Read `agents/reviewer.md` for your full role definition.
261
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
262
+ >
263
+ > **Goal**: {goal}
264
+ > **Change Set**: {NodeIDs}
265
+ > **Specs**: {list of spec file paths}
266
+ > **Context files**: `knowzcode/knowzcode_loop.md`, `knowzcode/knowzcode_project.md`, `knowzcode/knowzcode_architecture.md`
267
+ > **WorkGroup file**: `knowzcode/workgroups/{wgid}.md`
268
+ >
269
+ > **This is a READ-ONLY audit.** Do not modify any source code or test files.
270
+ > **Deliverable**: Audit report with ARC completion %, security posture, and gap list. Write results to WorkGroup file.
271
+ > **Prefix rule**: All todo entries MUST start with `KnowzCode:`.
272
+
273
+ Create task: `Phase 2B: Completeness audit for {N} NodeIDs` and assign to the reviewer.
274
+ Wait for task completion, then review audit results.
275
+
276
+ ### Subagent Mode
277
+
278
+ Delegate to the **reviewer** agent via `Task()`. Pass WorkGroupID, NodeIDs, spec file paths, and context file paths.
279
+
280
+ ### Quality Gate #3 (both modes)
281
+
282
+ Present audit results:
283
+
284
+ ```markdown
285
+ ## Approval Gate #3: Audit Results
286
+
287
+ **ARC Completion**: {X}%
288
+ **Security Posture**: {status}
289
+ **Gaps Found**: {count}
290
+
291
+ **Recommendation**: {proceed / return to implementation}
292
+
293
+ How would you like to proceed?
294
+ ```
295
+
296
+ ### Gap Loop (when user chooses to fix gaps)
297
+
298
+ If the user wants gaps fixed:
299
+
300
+ **Agent Teams Mode**: The previous builder teammate was already shut down. Spawn a NEW `builder` teammate with the same base prompt as Phase 2A, plus these additions:
301
+
302
+ > **Gap fix mode**: You are fixing gaps found during audit, not doing fresh implementation.
303
+ > **Gaps to fix**:
304
+ > {gap list from reviewer — file path, criterion not met, expected vs actual}
305
+ >
306
+ > Fix each gap, re-run affected tests, and report completion.
307
+
308
+ Create task: `Phase 2A (gap fix): Address {N} audit gaps` and assign to the new builder.
309
+ Wait for completion, then re-run Phase 2B (spawn a new reviewer).
310
+
311
+ **Subagent Mode**: Delegate gap fixes to the **builder** agent via `Task()` with gap details. Then re-delegate audit to the **reviewer** agent.
312
+
313
+ If approved at Gate #3: proceed to finalization.
314
+
315
+ ---
316
+
317
+ ## Phase 3: Finalization
318
+
319
+ ### Agent Teams Mode
320
+
321
+ Spawn a teammate named `closer` with this prompt:
322
+
323
+ > You are the **closer** for WorkGroup `{wgid}`.
324
+ > Read `agents/closer.md` for your full role definition.
325
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
326
+ >
327
+ > **Goal**: {goal}
328
+ > **Change Set**: {NodeIDs}
329
+ > **Specs**: {list of spec file paths}
330
+ > **Context files**: `knowzcode/knowzcode_loop.md`, `knowzcode/knowzcode_tracker.md`, `knowzcode/knowzcode_project.md`, `knowzcode/knowzcode_architecture.md`, `knowzcode/knowzcode_log.md`
331
+ > **WorkGroup file**: `knowzcode/workgroups/{wgid}.md`
332
+ >
333
+ > **Deliverable**: Atomic finalization — update specs to FINAL, update tracker, write log entry, update architecture if needed, capture learnings, and create final commit.
334
+ > **Prefix rule**: All todo entries MUST start with `KnowzCode:`.
335
+
336
+ Create task: `Phase 3: Finalize WorkGroup {wgid}` and assign to the closer.
337
+ Wait for task completion.
338
+
339
+ ### Subagent Mode
340
+
341
+ Delegate to the **closer** agent via `Task()`. Pass WorkGroupID, NodeIDs, spec file paths, and all context file paths.
342
+
343
+ ### Phase 3 Output (both modes)
344
+
345
+ When complete, push completion record to MCP vault if configured:
346
+ - `create_knowledge` with WorkGroup summary, decisions, and outcomes
347
+
348
+ Update workgroup to "Closed" and report:
349
+
350
+ ```markdown
351
+ ## Workflow Complete
352
+
353
+ **WorkGroupID**: {wgid}
354
+ **Primary Goal**: {$ARGUMENTS}
355
+ **Status**: VERIFIED and CLOSED
356
+
357
+ - NodeIDs completed: {list}
358
+ - Specs finalized: {count}
359
+ - Tech debt scheduled: {count REFACTOR_ tasks}
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Cleanup
365
+
366
+ After Phase 3 completes successfully, or if the user cancels the workflow at any point:
367
+
368
+ **Agent Teams Mode**: Shut down all active teammates. No teammates should remain running after the workflow ends.
369
+
370
+ **Subagent Mode**: No cleanup needed — `Task()` calls are self-contained.
371
+
372
+ ---
373
+
374
+ ## Complexity Triage
375
+
376
+ Before full orchestration, assess the change:
377
+ - Single file, <50 lines, isolated fix? Consider `/kc:fix` instead
378
+ - Multiple files or architectural impact? Continue with full workflow
379
+
380
+ ## Handling Failures
381
+
382
+ - Phase 1A rejected: re-run analyst with feedback
383
+ - Phase 1B rejected: re-run architect with specific issues
384
+ - Phase 2A max iterations exceeded: pause, report blocker
385
+ - Phase 2B audit shows gaps: return to 2A with gap list (see Gap Loop above)
386
+ - If >3 failures on same phase: PAUSE and ask user for direction
387
+
388
+ ## KnowzCode: Prefix Enforcement
389
+
390
+ Every todo in workgroup files MUST start with `KnowzCode:`. Pass this to all agents.
@@ -0,0 +1,59 @@
1
+ # KnowzCode Automation Manifest
2
+
3
+ This manifest describes the resources that support the KnowzCode workflow.
4
+
5
+ ## Commands
6
+
7
+ | Command | Purpose |
8
+ | --- | --- |
9
+ | `/kc:work` | Start feature workflow with TDD, quality gates, and structured phases |
10
+ | `/kc:plan` | Research and investigate using parallel agents before implementing |
11
+ | `/kc:audit` | Run quality audits (spec, architecture, security, integration) |
12
+ | `/kc:fix` | Execute targeted micro-fix workflow |
13
+ | `/kc:init` | Initialize KnowzCode in current project + generate platform adapters |
14
+ | `/kc:telemetry` | Investigate production telemetry |
15
+ | `/kc:telemetry-setup` | Configure telemetry sources |
16
+ | `/kc:connect-mcp` | Configure MCP server connection |
17
+ | `/kc:learn` | Capture learning to vault |
18
+ | `/kc:register` | Register and configure MCP |
19
+ | `/kc:status` | Check MCP and vault status |
20
+
21
+ ## Agents
22
+
23
+ | Agent | Phase | Description |
24
+ | --- | --- | --- |
25
+ | `analyst` | 1A | Impact analysis and Change Set proposals |
26
+ | `architect` | 1B | Specification drafting and architecture review |
27
+ | `builder` | 2A | TDD implementation and verification loops |
28
+ | `reviewer` | 2B | Quality audit, security review, compliance |
29
+ | `closer` | 3 | Finalization — specs, tracker, log, architecture |
30
+ | `microfix-specialist` | - | Scope-gated quick fixes |
31
+ | `knowledge-migrator` | - | External knowledge import |
32
+ | `update-coordinator` | - | Framework self-update |
33
+
34
+ ## Skills
35
+
36
+ | Skill | Purpose |
37
+ | --- | --- |
38
+ | `start-work` | Detect implementation intent and redirect to /kc:work |
39
+ | `continue` | Detect continuation intent and resume active WorkGroup |
40
+ | `load-core-context` | Load project overview, architecture, tracker into memory |
41
+ | `generate-workgroup-id` | Produce WorkGroupID timestamps |
42
+ | `tracker-update` | Apply validated updates to tracker |
43
+ | `spec-template` | Seed specs with 4-section template |
44
+ | `spec-quality-check` | Verify spec completeness |
45
+ | `log-entry-builder` | Structure log entries |
46
+ | `architecture-diff` | Highlight differences between specs and architecture docs |
47
+ | `environment-guard` | Confirm environment context is complete |
48
+ | `tracker-scan` | Extract current status and WorkGroup assignments |
49
+ | `alias-resolver` | Convert natural language to canonical KnowzCode values |
50
+ | `spec-validator` | Validate individual spec quality |
51
+
52
+ ## State Files
53
+
54
+ The authoritative state:
55
+ - `knowzcode/knowzcode_tracker.md` — backlog and node status
56
+ - `knowzcode/knowzcode_log.md` — operational history
57
+ - `knowzcode/specs/` — NodeID specifications
58
+ - `knowzcode/workgroups/` — session todo queues
59
+ - `knowzcode/knowzcode_architecture.md` — architecture documentation