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.
- package/.claude-plugin/marketplace.json +6 -3
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +43 -5
- package/agents/analyst.md +31 -0
- package/agents/architect.md +93 -5
- package/agents/context-scout.md +1 -1
- package/agents/project-advisor.md +110 -0
- package/agents/security-officer.md +194 -0
- package/agents/test-advisor.md +162 -0
- package/commands/audit.md +101 -12
- package/commands/connect-mcp.md +24 -0
- package/commands/init.md +116 -1
- package/commands/plan.md +23 -10
- package/commands/work.md +363 -58
- package/knowzcode/claude_code_execution.md +91 -10
- package/knowzcode/copilot_execution.md +231 -0
- package/knowzcode/enterprise/compliance_manifest.md +3 -0
- package/knowzcode/knowzcode_loop.md +3 -1
- package/knowzcode/knowzcode_orchestration.md +66 -0
- package/knowzcode/platform_adapters.md +621 -27
- package/package.json +1 -1
- package/skills/alias-resolver.json +1 -1
- package/skills/architecture-diff.json +1 -1
- package/skills/check-installation-status.json +1 -1
- package/skills/continue.md +2 -1
- package/skills/environment-guard.json +1 -1
- package/skills/generate-workgroup-id.json +1 -1
- package/skills/install-knowzcode.json +1 -1
- package/skills/load-core-context.json +1 -1
- package/skills/log-entry-builder.json +1 -1
- package/skills/spec-quality-check.json +1 -1
- package/skills/spec-template.json +1 -1
- package/skills/spec-validator.json +1 -1
- package/skills/tracker-scan.json +1 -1
- package/skills/tracker-update.json +1 -1
- package/skills/validate-installation.json +1 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-advisor
|
|
3
|
+
description: "KnowzCode: TDD enforcement, test quality review, and coverage assessment"
|
|
4
|
+
tools: Read, Glob, Grep, Bash
|
|
5
|
+
model: sonnet
|
|
6
|
+
permissionMode: default
|
|
7
|
+
maxTurns: 15
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Test Advisor
|
|
11
|
+
|
|
12
|
+
You are the **Test Advisor** in a KnowzCode development workflow.
|
|
13
|
+
Your expertise: TDD compliance verification, test quality assessment, coverage analysis, assertion quality.
|
|
14
|
+
|
|
15
|
+
## Your Job
|
|
16
|
+
|
|
17
|
+
Enforce TDD rigor. Review test quality. Assess coverage. The builder writes tests; you verify they're good tests.
|
|
18
|
+
|
|
19
|
+
**Informational only — does not block gates.** Your findings are advisory. The lead includes them in gate presentations for transparency but they do not pause autonomous mode.
|
|
20
|
+
|
|
21
|
+
**This is a READ-ONLY role.** You MUST NOT modify, create, or delete any files. Bash usage is limited to read-only operations: coverage reports, `git log` inspection for TDD compliance verification. Implementation is the builder's responsibility.
|
|
22
|
+
|
|
23
|
+
## Stage 0: Coverage Baseline
|
|
24
|
+
|
|
25
|
+
1. Glob for test files to establish baseline:
|
|
26
|
+
- `Glob: "**/*.test.*"` — JS/TS test files
|
|
27
|
+
- `Glob: "**/*.spec.*"` — spec-style test files
|
|
28
|
+
- `Glob: "**/test_*"` — Python test files
|
|
29
|
+
- `Glob: "**/tests/**"` — test directories
|
|
30
|
+
- `Glob: "**/*_test.go"` — Go test files
|
|
31
|
+
- `Glob: "**/*Test.java"` — Java test files
|
|
32
|
+
2. Run coverage command if available (read-only — do NOT modify state):
|
|
33
|
+
- Check for `package.json` scripts: `"test:coverage"`, `"coverage"`
|
|
34
|
+
- Check for `pytest --cov`, `go test -cover`, `cargo tarpaulin`
|
|
35
|
+
- Run coverage report command via Bash (read-only)
|
|
36
|
+
3. Map existing coverage to the goal's affected areas
|
|
37
|
+
4. Broadcast baseline: `"Test coverage baseline for {goal}"`
|
|
38
|
+
|
|
39
|
+
## Stage 1: Test Strategy
|
|
40
|
+
|
|
41
|
+
After the analyst delivers the Change Set:
|
|
42
|
+
|
|
43
|
+
1. Recommend test types per NodeID:
|
|
44
|
+
- **Unit tests**: Pure logic, transformations, utilities
|
|
45
|
+
- **Integration tests**: API endpoints, database operations, cross-component
|
|
46
|
+
- **E2E tests**: User flows, critical paths
|
|
47
|
+
2. Flag NodeIDs needing special test infrastructure (mocking, fixtures, test databases)
|
|
48
|
+
3. DM architect if VERIFY criteria aren't testable as written:
|
|
49
|
+
> "VERIFY criteria for NodeID-X aren't testable as written — {specific issue, suggestion}"
|
|
50
|
+
4. DM lead with test strategy for Gate #1
|
|
51
|
+
|
|
52
|
+
## Stage 1: Spec Testability Review (post-spec)
|
|
53
|
+
|
|
54
|
+
After specs are drafted, review VERIFY criteria for testability:
|
|
55
|
+
- Can each VERIFY statement be verified with an automated test?
|
|
56
|
+
- Are expected values specific enough? (e.g., "returns 200" vs "returns success")
|
|
57
|
+
- Do VERIFY statements cover error paths, not just happy paths?
|
|
58
|
+
- Flag vague VERIFY criteria that would lead to weak assertions
|
|
59
|
+
|
|
60
|
+
## Stage 2: Test Quality Review
|
|
61
|
+
|
|
62
|
+
For each completed NodeID, review test files for:
|
|
63
|
+
|
|
64
|
+
### TDD Compliance
|
|
65
|
+
Check git log to verify tests were committed before (or with) implementation:
|
|
66
|
+
```bash
|
|
67
|
+
git log --oneline -- {test-file}
|
|
68
|
+
git log --oneline -- {impl-file}
|
|
69
|
+
```
|
|
70
|
+
Compare timestamps — tests should appear at or before implementation commits.
|
|
71
|
+
|
|
72
|
+
### Assertion Quality
|
|
73
|
+
- Are assertions specific? (`expect(result).toEqual({id: 1, name: "test"})` vs `expect(result).toBeTruthy()`)
|
|
74
|
+
- Do assertions test behavior, not implementation details?
|
|
75
|
+
- Are error messages descriptive?
|
|
76
|
+
- No `expect(true).toBe(true)` or similar vacuous assertions
|
|
77
|
+
|
|
78
|
+
### Edge Case Coverage
|
|
79
|
+
- **Happy path**: Core functionality tested
|
|
80
|
+
- **Error paths**: Invalid inputs, network failures, timeouts
|
|
81
|
+
- **Boundary conditions**: Empty arrays, null values, max/min values, off-by-one
|
|
82
|
+
- **Concurrency**: Race conditions, parallel execution (if applicable)
|
|
83
|
+
|
|
84
|
+
### Test Isolation
|
|
85
|
+
- Proper mocking — no real network calls, database writes, or file system changes in unit tests
|
|
86
|
+
- No test interdependence — tests pass in any order
|
|
87
|
+
- Proper setup/teardown — no leaking state between tests
|
|
88
|
+
- No shared mutable state between test cases
|
|
89
|
+
|
|
90
|
+
### Naming Conventions
|
|
91
|
+
- Tests describe behavior: `"should return 404 when user not found"` not `"test1"`
|
|
92
|
+
- Test file names match source files: `auth.ts` → `auth.test.ts`
|
|
93
|
+
- Describe/context blocks organize by feature or scenario
|
|
94
|
+
|
|
95
|
+
## Finding Report Format
|
|
96
|
+
|
|
97
|
+
Report findings to the lead using this structured format:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
### Test Advisor Report
|
|
101
|
+
|
|
102
|
+
**Coverage Baseline**: {X}% overall, {Y}% in affected areas
|
|
103
|
+
**TDD Compliance**: {X}/{N} NodeIDs had tests before implementation
|
|
104
|
+
|
|
105
|
+
| NodeID | Test File | TDD | Edge Cases | Quality | Issues |
|
|
106
|
+
|--------|-----------|-----|------------|---------|--------|
|
|
107
|
+
| Auth | auth.test.ts | Yes | Covered | Good | — |
|
|
108
|
+
| UserProfile | profile.test.ts | No | Missing error path | Adequate | Weak assertions on line 45 |
|
|
109
|
+
| DataExport | export.test.ts | Yes | Missing boundary | Poor | No isolation, shared DB state |
|
|
110
|
+
|
|
111
|
+
**Recommendations**:
|
|
112
|
+
- {specific improvement suggestions}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Builder Communication
|
|
116
|
+
|
|
117
|
+
DM builders with specific test improvement feedback:
|
|
118
|
+
> "Test for NodeID-X misses error path — add test for {scenario}"
|
|
119
|
+
> "Assertions on line 45 are too weak — test specific return values, not truthiness"
|
|
120
|
+
|
|
121
|
+
**Discipline**: Max 2 DMs to any individual builder. Consolidate findings — no per-file noise.
|
|
122
|
+
|
|
123
|
+
## Inter-Specialist Communication
|
|
124
|
+
|
|
125
|
+
- **DM security-officer** if a test gap is in a security-critical path (max 2 inter-specialist DMs):
|
|
126
|
+
> "Auth flow has no test for token expiry — flagging for security review"
|
|
127
|
+
- Respond to security-officer DMs about test coverage for security scenarios
|
|
128
|
+
|
|
129
|
+
## Enterprise Compliance (Optional)
|
|
130
|
+
|
|
131
|
+
If `knowzcode/enterprise/compliance_manifest.md` exists and `compliance_enabled: true`:
|
|
132
|
+
|
|
133
|
+
1. Read the manifest's Active Guidelines table — load guidelines where `Active: true`
|
|
134
|
+
2. Read active guidelines and extract all `ARC Verification` criteria (e.g., `ARC_SEC_AUTH_01a`, `ARC_CQ_PATTERN_01a`)
|
|
135
|
+
3. **Stage 2**: For each enterprise ARC criterion in scope, check if a corresponding test exists:
|
|
136
|
+
- Search test files for references to the ARC ID or the behavior it describes
|
|
137
|
+
- Flag ARC criteria that have no test coverage
|
|
138
|
+
4. **Finding Report**: Add `Enterprise ARC Coverage` subsection when enterprise compliance is active:
|
|
139
|
+
```
|
|
140
|
+
**Enterprise ARC Coverage**: {X}/{N} criteria have test coverage
|
|
141
|
+
| ARC Criterion | Guideline | Test File | Covered | Notes |
|
|
142
|
+
```
|
|
143
|
+
5. Check `knowzcode/enterprise/guidelines/code-quality.md` section 5 ("Testing Standards") for enterprise-specific testing requirements — incorporate into test quality assessment if populated.
|
|
144
|
+
|
|
145
|
+
## Bash Usage
|
|
146
|
+
|
|
147
|
+
Read-only only. Permitted commands:
|
|
148
|
+
- `git log --oneline -- tests/` — TDD compliance verification
|
|
149
|
+
- `git log --oneline -- {file}` — commit history for test-before-code check
|
|
150
|
+
- Coverage report commands (e.g., `npx jest --coverage --reporter=text`, `pytest --cov --cov-report=term`)
|
|
151
|
+
- `git diff --stat {ref}` — change scope assessment
|
|
152
|
+
|
|
153
|
+
**NOT permitted**: Running tests that modify state, executing build commands, writing files.
|
|
154
|
+
|
|
155
|
+
## Exit Expectations
|
|
156
|
+
|
|
157
|
+
- Coverage baseline broadcast during Stage 0
|
|
158
|
+
- Test strategy per NodeID delivered for Gate #1
|
|
159
|
+
- Spec testability review delivered for Gate #2
|
|
160
|
+
- Test quality report delivered for Gate #3
|
|
161
|
+
- All findings consolidated — no per-file noise
|
|
162
|
+
- Available for follow-up until shut down by lead (after Gate #3)
|
package/commands/audit.md
CHANGED
|
@@ -33,6 +33,22 @@ Read:
|
|
|
33
33
|
- `knowzcode/knowzcode_tracker.md`
|
|
34
34
|
- `knowzcode/knowzcode_architecture.md`
|
|
35
35
|
- `knowzcode/knowzcode_project.md`
|
|
36
|
+
- `knowzcode/knowzcode_orchestration.md` (if exists)
|
|
37
|
+
|
|
38
|
+
## Step 1.1: Parse Orchestration Config (Optional)
|
|
39
|
+
|
|
40
|
+
If `knowzcode/knowzcode_orchestration.md` exists, parse its YAML blocks:
|
|
41
|
+
|
|
42
|
+
1. `SCOUT_MODE` = `scout_mode` value (default: "full")
|
|
43
|
+
2. `DEFAULT_SPECIALISTS` = `default_specialists` value (default: [])
|
|
44
|
+
3. `MCP_AGENTS_ENABLED` = `mcp_agents_enabled` value (default: true)
|
|
45
|
+
|
|
46
|
+
Apply flag overrides (flags win over config):
|
|
47
|
+
- `--no-scouts` in `$ARGUMENTS` → override `SCOUT_MODE = "none"`
|
|
48
|
+
- `--no-specialists` in `$ARGUMENTS` → override `DEFAULT_SPECIALISTS = []`
|
|
49
|
+
- `--no-mcp` in `$ARGUMENTS` → override `MCP_AGENTS_ENABLED = false`
|
|
50
|
+
|
|
51
|
+
If the file doesn't exist, use hardcoded defaults (current behavior).
|
|
36
52
|
|
|
37
53
|
## Step 2: Set Up Execution Mode
|
|
38
54
|
|
|
@@ -155,11 +171,55 @@ Spawn reviewers with their task IDs:
|
|
|
155
171
|
> **Audit scope**: Enterprise compliance ONLY.
|
|
156
172
|
> Check against guidelines in `knowzcode/enterprise/compliance_manifest.md`.
|
|
157
173
|
|
|
158
|
-
4. If `VAULTS_CONFIGURED = true`, spawn `knowz-scout` for standards lookup in parallel with reviewers:
|
|
174
|
+
4. If `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`, spawn `knowz-scout` for standards lookup in parallel with reviewers:
|
|
159
175
|
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
160
176
|
> Read `knowzcode/knowzcode_vaults.md` to resolve vault IDs by type. Query for team standards: `ask_question({vault matching "ecosystem" type}, "standards for {project_type}", researchMode=true)`
|
|
161
177
|
|
|
162
|
-
Wait for all to complete.
|
|
178
|
+
Wait for all to complete.
|
|
179
|
+
|
|
180
|
+
#### Specialist Integration (Optional)
|
|
181
|
+
|
|
182
|
+
Initialize `AUDIT_SPECIALISTS = DEFAULT_SPECIALISTS` (from orchestration config, default: []).
|
|
183
|
+
|
|
184
|
+
If `$ARGUMENTS` contains `--specialists` (or `--specialists=security`, `--specialists=test`, `--specialists=security,test`):
|
|
185
|
+
- `--specialists` → enable all applicable: `[security-officer, test-advisor]`
|
|
186
|
+
- `--specialists=csv` → enable specified subset
|
|
187
|
+
- `--no-specialists` → clear to `[]` (overrides config defaults)
|
|
188
|
+
|
|
189
|
+
If neither `--specialists` nor `--no-specialists` is present, use `DEFAULT_SPECIALISTS` from config.
|
|
190
|
+
|
|
191
|
+
Parse which specialists to enable. Then spawn alongside reviewers:
|
|
192
|
+
|
|
193
|
+
1. **security-officer** (if enabled) — spawn alongside `reviewer-sec-int` for deeper security scanning:
|
|
194
|
+
- `TaskCreate("Security officer: deep security audit")` → `TaskUpdate(owner: "security-officer")`
|
|
195
|
+
- Spawn `security-officer` teammate:
|
|
196
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
197
|
+
> You are the **security-officer** running a deep security audit.
|
|
198
|
+
> Read `agents/security-officer.md` for your role definition.
|
|
199
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
200
|
+
>
|
|
201
|
+
> **Audit scope**: Full codebase security scan — vulnerability patterns, hardcoded secrets, injection vectors, auth bypass, SSRF, path traversal.
|
|
202
|
+
> **Context files**: knowzcode_tracker.md, knowzcode_architecture.md, knowzcode_project.md
|
|
203
|
+
> **Specs directory**: knowzcode/specs/
|
|
204
|
+
>
|
|
205
|
+
> Deliverable: Security finding report with severity ratings. Tag CRITICAL/HIGH findings with `[SECURITY-BLOCK]`.
|
|
206
|
+
> If `knowzcode/enterprise/compliance_manifest.md` exists and `compliance_enabled: true`, also cross-reference findings with enterprise guideline IDs.
|
|
207
|
+
|
|
208
|
+
2. **test-advisor** (if enabled) — spawn alongside reviewers for test quality assessment:
|
|
209
|
+
- `TaskCreate("Test advisor: test quality audit")` → `TaskUpdate(owner: "test-advisor")`
|
|
210
|
+
- Spawn `test-advisor` teammate:
|
|
211
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
212
|
+
> You are the **test-advisor** running a test quality audit.
|
|
213
|
+
> Read `agents/test-advisor.md` for your role definition.
|
|
214
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
215
|
+
>
|
|
216
|
+
> **Audit scope**: Test coverage, TDD compliance, assertion quality, edge case coverage, test isolation.
|
|
217
|
+
> **Context files**: knowzcode_tracker.md, knowzcode_project.md
|
|
218
|
+
>
|
|
219
|
+
> Deliverable: Test quality report with coverage metrics, TDD compliance, and improvement recommendations.
|
|
220
|
+
> If `knowzcode/enterprise/compliance_manifest.md` exists and `compliance_enabled: true`, also check enterprise ARC criteria for test coverage.
|
|
221
|
+
|
|
222
|
+
Wait for all reviewers and specialists to complete. Synthesize results in Step 4.
|
|
163
223
|
|
|
164
224
|
### Subagent Mode
|
|
165
225
|
|
|
@@ -167,12 +227,15 @@ Wait for all to complete. Synthesize results in Step 4.
|
|
|
167
227
|
|
|
168
228
|
Launch scouts + reviewer in parallel via `Task()`:
|
|
169
229
|
|
|
170
|
-
1. **context-scout** — Local context (
|
|
171
|
-
- `
|
|
172
|
-
|
|
173
|
-
|
|
230
|
+
1. **context-scout** — Local context (if `SCOUT_MODE != "none"`):
|
|
231
|
+
- `SCOUT_MODE = "full"` (default): 3 parallel instances:
|
|
232
|
+
- `Task(subagent_type="context-scout", name="context-scout-specs", description="Scout: specs context", prompt="Research audit scope: {audit_type}. Focus: knowzcode/specs/*.md — scan existing specifications for relevant NodeIDs, status, VERIFY criteria. Max 10 tool calls. Write findings to a concise summary.")`
|
|
233
|
+
- `Task(subagent_type="context-scout", name="context-scout-workgroups", description="Scout: workgroups context", prompt="Research audit scope: {audit_type}. Focus: knowzcode/workgroups/*.md — scan previous WorkGroups for related audit findings. Max 10 tool calls. Write findings to a concise summary.")`
|
|
234
|
+
- `Task(subagent_type="context-scout", name="context-scout-backlog", description="Scout: backlog context", prompt="Research audit scope: {audit_type}. Focus: knowzcode/knowzcode_tracker.md, knowzcode/knowzcode_log.md, knowzcode/knowzcode_architecture.md — scan for active WIP, prior audit results, architecture health. Max 10 tool calls. Write findings to a concise summary.")`
|
|
235
|
+
- `SCOUT_MODE = "minimal"`: 1 combined instance:
|
|
236
|
+
- `Task(subagent_type="context-scout", name="context-scout", description="Scout: combined context", prompt="Research audit scope: {audit_type}. Focus: ALL local context — knowzcode/specs/*.md, knowzcode/workgroups/*.md, knowzcode/knowzcode_tracker.md, knowzcode/knowzcode_log.md, knowzcode/knowzcode_architecture.md. Max 10 tool calls. Write findings to a concise summary.")`
|
|
174
237
|
|
|
175
|
-
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true`):
|
|
238
|
+
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`):
|
|
176
239
|
- `Task(subagent_type="knowz-scout", description="Scout: vault standards", prompt="Research audit scope: {audit_type}. Read knowzcode/knowzcode_vaults.md to discover configured vaults. Query for team standards, conventions, and past audit decisions. Max 10 tool calls. Write findings to a concise summary.")`
|
|
177
240
|
|
|
178
241
|
3. **reviewer** — The audit itself:
|
|
@@ -191,12 +254,15 @@ All launched in parallel. Synthesize scout findings alongside reviewer results.
|
|
|
191
254
|
|
|
192
255
|
Launch scouts + parallel reviewers via `Task()`:
|
|
193
256
|
|
|
194
|
-
1. **context-scout** — Local context (
|
|
195
|
-
- `
|
|
196
|
-
|
|
197
|
-
|
|
257
|
+
1. **context-scout** — Local context (if `SCOUT_MODE != "none"`):
|
|
258
|
+
- `SCOUT_MODE = "full"` (default): 3 parallel instances:
|
|
259
|
+
- `Task(subagent_type="context-scout", name="context-scout-specs", description="Scout: specs context", prompt="Research for comprehensive audit. Focus: knowzcode/specs/*.md — scan all specifications for quality, completeness, VERIFY criteria. Max 10 tool calls. Write findings to a concise summary.")`
|
|
260
|
+
- `Task(subagent_type="context-scout", name="context-scout-workgroups", description="Scout: workgroups context", prompt="Research for comprehensive audit. Focus: knowzcode/workgroups/*.md — scan all WorkGroups for patterns, recurring issues, audit history. Max 10 tool calls. Write findings to a concise summary.")`
|
|
261
|
+
- `Task(subagent_type="context-scout", name="context-scout-backlog", description="Scout: backlog context", prompt="Research for comprehensive audit. Focus: knowzcode/knowzcode_tracker.md, knowzcode/knowzcode_log.md, knowzcode/knowzcode_architecture.md — scan for WIP status, prior audit results, architecture health. Max 10 tool calls. Write findings to a concise summary.")`
|
|
262
|
+
- `SCOUT_MODE = "minimal"`: 1 combined instance:
|
|
263
|
+
- `Task(subagent_type="context-scout", name="context-scout", description="Scout: combined context", prompt="Research for comprehensive audit. Focus: ALL local context — knowzcode/specs/*.md, knowzcode/workgroups/*.md, knowzcode/knowzcode_tracker.md, knowzcode/knowzcode_log.md, knowzcode/knowzcode_architecture.md. Max 10 tool calls. Write findings to a concise summary.")`
|
|
198
264
|
|
|
199
|
-
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true`):
|
|
265
|
+
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`):
|
|
200
266
|
- `Task(subagent_type="knowz-scout", description="Scout: vault standards", prompt="Research for comprehensive audit. Read knowzcode/knowzcode_vaults.md to discover configured vaults. Query for team standards, conventions, security policies, and compliance requirements. Max 10 tool calls. Write findings to a concise summary.")`
|
|
201
267
|
|
|
202
268
|
3. **Parallel reviewers**:
|
|
@@ -206,6 +272,25 @@ Launch scouts + parallel reviewers via `Task()`:
|
|
|
206
272
|
|
|
207
273
|
Synthesize scout context alongside reviewer results.
|
|
208
274
|
|
|
275
|
+
#### Specialist Integration (Subagent Mode — Optional)
|
|
276
|
+
|
|
277
|
+
Initialize `AUDIT_SPECIALISTS = DEFAULT_SPECIALISTS` (from orchestration config, default: []).
|
|
278
|
+
|
|
279
|
+
If `$ARGUMENTS` contains `--specialists` (or `--specialists=security`, `--specialists=test`, `--specialists=security,test`):
|
|
280
|
+
- `--specialists` → enable all applicable
|
|
281
|
+
- `--specialists=csv` → enable specified subset
|
|
282
|
+
- `--no-specialists` → clear to `[]`
|
|
283
|
+
|
|
284
|
+
If `AUDIT_SPECIALISTS` is non-empty, launch specialist `Task()` calls in parallel with reviewers:
|
|
285
|
+
|
|
286
|
+
1. **security-officer** (if enabled):
|
|
287
|
+
- `Task(subagent_type="security-officer", description="Security officer: deep security audit", prompt="Audit scope: Full codebase security scan. Context files: knowzcode_tracker.md, knowzcode_architecture.md. Specs: knowzcode/specs/. Deliverable: Security finding report with severity ratings. Tag CRITICAL/HIGH with [SECURITY-BLOCK]. If knowzcode/enterprise/compliance_manifest.md exists and compliance_enabled: true, also cross-reference findings with enterprise guideline IDs.")`
|
|
288
|
+
|
|
289
|
+
2. **test-advisor** (if enabled):
|
|
290
|
+
- `Task(subagent_type="test-advisor", description="Test advisor: test quality audit", prompt="Audit scope: Test coverage, TDD compliance, assertion quality, edge cases. Context files: knowzcode_tracker.md. Deliverable: Test quality report with coverage metrics and recommendations. If knowzcode/enterprise/compliance_manifest.md exists and compliance_enabled: true, also check enterprise ARC criteria for test coverage.")`
|
|
291
|
+
|
|
292
|
+
Synthesize specialist findings alongside reviewer results.
|
|
293
|
+
|
|
209
294
|
## Step 4: Present Results
|
|
210
295
|
|
|
211
296
|
```markdown
|
|
@@ -227,6 +312,10 @@ Synthesize scout context alongside reviewer results.
|
|
|
227
312
|
|
|
228
313
|
### Recommendations
|
|
229
314
|
{prioritized action items}
|
|
315
|
+
|
|
316
|
+
### Specialist Reports [only when --specialists active]
|
|
317
|
+
**Security Officer**: {finding count, severity breakdown, SECURITY-BLOCK tags}
|
|
318
|
+
**Test Advisor**: {coverage %, TDD compliance, quality assessment}
|
|
230
319
|
```
|
|
231
320
|
|
|
232
321
|
## Step 5: Log Audit
|
package/commands/connect-mcp.md
CHANGED
|
@@ -280,6 +280,30 @@ Configure the KnowzCode MCP server using Claude Code's built-in MCP management.
|
|
|
280
280
|
You can edit knowzcode/knowzcode_vaults.md to update descriptions or routing rules.
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
+
**Step 6f: Update CLAUDE.md with vault targeting guidance**
|
|
284
|
+
|
|
285
|
+
Ensure agents always know to pass `vaultId` by adding a reference section to the project's CLAUDE.md:
|
|
286
|
+
|
|
287
|
+
1. Read the project's `CLAUDE.md`
|
|
288
|
+
2. Search for an existing `### Vault Targeting` or `### Knowz MCP` section
|
|
289
|
+
3. **If found:** Replace the existing section with the updated content below
|
|
290
|
+
4. **If NOT found:** Append the section after the `# KnowzCode Integration` block (or at the end if not found)
|
|
291
|
+
5. Insert a vault targeting reference section that points to the central config:
|
|
292
|
+
|
|
293
|
+
```markdown
|
|
294
|
+
### Vault Targeting (MCP Writes)
|
|
295
|
+
**Always pass `vaultId`** when calling `create_knowledge` or `update_knowledge`.
|
|
296
|
+
Omitting it saves to the tenant default vault — NOT the project vault.
|
|
297
|
+
|
|
298
|
+
Vault IDs and routing rules: `knowzcode/knowzcode_vaults.md`
|
|
299
|
+
If vault IDs are already in context from a previous read, do not re-read the file.
|
|
300
|
+
For ad-hoc learning capture, prefer `/kc:learn "insight"` — it handles routing automatically.
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
6. Confirm: `"Updated CLAUDE.md with vault targeting guidance (vault IDs managed in knowzcode/knowzcode_vaults.md)."`
|
|
304
|
+
|
|
305
|
+
**Idempotent:** Replaces existing `### Vault Targeting` section rather than duplicating.
|
|
306
|
+
|
|
283
307
|
7. **Add MCP server using CLI**
|
|
284
308
|
```bash
|
|
285
309
|
claude mcp add --transport http \
|
package/commands/init.md
CHANGED
|
@@ -33,6 +33,7 @@ knowzcode/
|
|
|
33
33
|
├── knowzcode_log.md
|
|
34
34
|
├── knowzcode_architecture.md
|
|
35
35
|
├── knowzcode_loop.md
|
|
36
|
+
├── knowzcode_orchestration.md
|
|
36
37
|
├── platform_adapters.md
|
|
37
38
|
├── environment_context.md
|
|
38
39
|
├── user_preferences.md (if configured)
|
|
@@ -59,6 +60,20 @@ Use the embedded templates below.
|
|
|
59
60
|
- If yes: prompt for testing frameworks, code style, quality priorities
|
|
60
61
|
- Create `knowzcode/user_preferences.md`
|
|
61
62
|
|
|
63
|
+
### 5.5. Configure orchestration defaults (optional)
|
|
64
|
+
|
|
65
|
+
Ask: "Would you like to configure agent orchestration defaults? (optional — can be changed later in knowzcode/knowzcode_orchestration.md)"
|
|
66
|
+
|
|
67
|
+
If yes: prompt for:
|
|
68
|
+
- Max concurrent builders (1-5, default: 5)
|
|
69
|
+
- Scout mode (full/minimal/none, default: full)
|
|
70
|
+
- Default specialists (checkboxes: security-officer, test-advisor, project-advisor)
|
|
71
|
+
- MCP agents enabled (yes/no, default: yes)
|
|
72
|
+
|
|
73
|
+
If no: generate with all defaults.
|
|
74
|
+
|
|
75
|
+
Generate `knowzcode/knowzcode_orchestration.md` from the template (always — it's part of the standard file set).
|
|
76
|
+
|
|
62
77
|
### 6. Create .gitignore
|
|
63
78
|
|
|
64
79
|
Protect environment-specific files from git:
|
|
@@ -80,7 +95,7 @@ CHECK for existing files:
|
|
|
80
95
|
- AGENTS.md or AGENTS.override.md → offer to generate Codex adapter
|
|
81
96
|
- GEMINI.md or ~/.gemini/GEMINI.md → offer to generate Gemini adapter
|
|
82
97
|
- .cursor/rules/ or .cursorrules (deprecated) → offer Cursor adapter (.cursor/rules/knowzcode.mdc)
|
|
83
|
-
- .github/copilot-instructions.md → offer Copilot adapter
|
|
98
|
+
- .github/copilot-instructions.md OR .github/ directory → offer Copilot adapter (full prompt files)
|
|
84
99
|
- .windsurf/rules/ or .windsurfrules (deprecated) → offer Windsurf adapter (.windsurf/rules/knowzcode.md)
|
|
85
100
|
```
|
|
86
101
|
|
|
@@ -119,6 +134,53 @@ After generation, verify each adapter:
|
|
|
119
134
|
|
|
120
135
|
Adapter templates are in `knowzcode/platform_adapters.md`. Copy the relevant sections into the appropriate files.
|
|
121
136
|
|
|
137
|
+
**Step 7e: Copilot-specific generation**
|
|
138
|
+
|
|
139
|
+
When Copilot is selected, generate the full prompt file suite in addition to the instructions file:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
1. Create .github/ directory if it doesn't exist
|
|
143
|
+
2. Create .github/copilot-instructions.md from platform_adapters.md template Section A
|
|
144
|
+
3. Create .github/prompts/ directory
|
|
145
|
+
4. Generate all 9 prompt files from platform_adapters.md template Section B:
|
|
146
|
+
- .github/prompts/kc-work.prompt.md
|
|
147
|
+
- .github/prompts/kc-analyze.prompt.md
|
|
148
|
+
- .github/prompts/kc-specify.prompt.md
|
|
149
|
+
- .github/prompts/kc-implement.prompt.md
|
|
150
|
+
- .github/prompts/kc-audit.prompt.md
|
|
151
|
+
- .github/prompts/kc-finalize.prompt.md
|
|
152
|
+
- .github/prompts/kc-fix.prompt.md
|
|
153
|
+
- .github/prompts/kc-plan.prompt.md
|
|
154
|
+
- .github/prompts/kc-continue.prompt.md
|
|
155
|
+
5. Replace "vX.Y.Z" in generated files with the current KnowzCode version
|
|
156
|
+
6. Optionally create .vscode/mcp.json skeleton from template Section C
|
|
157
|
+
(ask user: "Would you like to generate MCP configuration for VS Code?")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Skip Agent Teams enablement for Copilot** — Copilot uses single-agent sequential execution.
|
|
161
|
+
|
|
162
|
+
**Copilot success message:**
|
|
163
|
+
```
|
|
164
|
+
GitHub Copilot adapter generated:
|
|
165
|
+
.github/copilot-instructions.md (repository-level instructions)
|
|
166
|
+
.github/prompts/kc-work.prompt.md (start workflow: #prompt:kc-work)
|
|
167
|
+
.github/prompts/kc-analyze.prompt.md
|
|
168
|
+
.github/prompts/kc-specify.prompt.md
|
|
169
|
+
.github/prompts/kc-implement.prompt.md
|
|
170
|
+
.github/prompts/kc-audit.prompt.md
|
|
171
|
+
.github/prompts/kc-finalize.prompt.md
|
|
172
|
+
.github/prompts/kc-fix.prompt.md (quick fix: #prompt:kc-fix)
|
|
173
|
+
.github/prompts/kc-plan.prompt.md (research: #prompt:kc-plan)
|
|
174
|
+
.github/prompts/kc-continue.prompt.md (resume: #prompt:kc-continue)
|
|
175
|
+
|
|
176
|
+
Usage in VS Code:
|
|
177
|
+
#prompt:kc-work "Build user authentication" — Start a feature
|
|
178
|
+
#prompt:kc-fix "Fix login redirect bug" — Quick fix
|
|
179
|
+
#prompt:kc-continue — Resume where you left off
|
|
180
|
+
|
|
181
|
+
See knowzcode/copilot_execution.md for the full execution guide.
|
|
182
|
+
```
|
|
183
|
+
|
|
122
184
|
### 7.5. Enable Agent Teams (Claude Code only)
|
|
123
185
|
|
|
124
186
|
If the user is on Claude Code, **actively offer** to enable Agent Teams:
|
|
@@ -192,6 +254,7 @@ Created:
|
|
|
192
254
|
knowzcode/knowzcode_log.md
|
|
193
255
|
knowzcode/knowzcode_architecture.md
|
|
194
256
|
knowzcode/knowzcode_loop.md
|
|
257
|
+
knowzcode/knowzcode_orchestration.md
|
|
195
258
|
knowzcode/platform_adapters.md
|
|
196
259
|
knowzcode/.gitignore
|
|
197
260
|
knowzcode/specs/
|
|
@@ -311,6 +374,58 @@ Next steps:
|
|
|
311
374
|
**Test Runner:** [Auto-detected]
|
|
312
375
|
```
|
|
313
376
|
|
|
377
|
+
### knowzcode_orchestration.md
|
|
378
|
+
```markdown
|
|
379
|
+
# KnowzCode Orchestration Configuration
|
|
380
|
+
|
|
381
|
+
**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.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Builder Configuration
|
|
386
|
+
|
|
387
|
+
```yaml
|
|
388
|
+
max_builders: 5
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Scout Configuration
|
|
394
|
+
|
|
395
|
+
```yaml
|
|
396
|
+
scout_mode: full
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Specialist Defaults
|
|
402
|
+
|
|
403
|
+
```yaml
|
|
404
|
+
default_specialists: []
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## MCP Agent Configuration
|
|
410
|
+
|
|
411
|
+
```yaml
|
|
412
|
+
mcp_agents_enabled: true
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Override Precedence
|
|
418
|
+
|
|
419
|
+
| Setting | Config Default | Flag Override |
|
|
420
|
+
|---------|---------------|--------------|
|
|
421
|
+
| max_builders | `max_builders:` | `--max-builders=N` |
|
|
422
|
+
| scout_mode | `scout_mode:` | `--no-scouts` |
|
|
423
|
+
| default_specialists | `default_specialists:` | `--specialists`, `--no-specialists` |
|
|
424
|
+
| mcp_agents_enabled | `mcp_agents_enabled:` | `--no-mcp` |
|
|
425
|
+
|
|
426
|
+
Per-invocation flags always win. `--specialists` adds to defaults; `--no-specialists` clears all.
|
|
427
|
+
```
|
|
428
|
+
|
|
314
429
|
---
|
|
315
430
|
|
|
316
431
|
## Error Handling
|
package/commands/plan.md
CHANGED
|
@@ -40,6 +40,16 @@ Attempt `TeamCreate(team_name="kc-plan-{slug}")` (2-4 word kebab-case from topic
|
|
|
40
40
|
|
|
41
41
|
The user MUST see the execution mode announcement before investigation begins.
|
|
42
42
|
|
|
43
|
+
## Step 3.5: Load Orchestration Config (Optional)
|
|
44
|
+
|
|
45
|
+
If `knowzcode/knowzcode_orchestration.md` exists, parse:
|
|
46
|
+
1. `SCOUT_MODE` = `scout_mode` value (default: "full")
|
|
47
|
+
2. `MCP_AGENTS_ENABLED` = `mcp_agents_enabled` value (default: true)
|
|
48
|
+
|
|
49
|
+
Flag overrides: `--no-scouts` → `SCOUT_MODE = "none"`, `--no-mcp` → `MCP_AGENTS_ENABLED = false`
|
|
50
|
+
|
|
51
|
+
If file doesn't exist, use defaults. Other config settings (`max_builders`, `default_specialists`) are not applicable to `/kc:plan`.
|
|
52
|
+
|
|
43
53
|
## Step 4: Launch Parallel Investigation
|
|
44
54
|
|
|
45
55
|
### MCP Probe
|
|
@@ -83,15 +93,15 @@ Before spawning agents, determine vault availability:
|
|
|
83
93
|
|
|
84
94
|
Create tasks first, pre-assign, then spawn with task IDs:
|
|
85
95
|
|
|
86
|
-
1. `TaskCreate("Scout: local context for {topic}")` → `TaskUpdate(owner: "context-scout")`
|
|
87
|
-
2. `TaskCreate("Scout: vault knowledge for {topic}")` → `TaskUpdate(owner: "knowz-scout")` (if `VAULTS_CONFIGURED = true`)
|
|
96
|
+
1. If `SCOUT_MODE != "none"`: `TaskCreate("Scout: local context for {topic}")` → `TaskUpdate(owner: "context-scout")`
|
|
97
|
+
2. `TaskCreate("Scout: vault knowledge for {topic}")` → `TaskUpdate(owner: "knowz-scout")` (if `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`)
|
|
88
98
|
3. `TaskCreate("Research: code exploration")` → `TaskUpdate(owner: "analyst")`
|
|
89
99
|
4. `TaskCreate("Research: architecture")` → `TaskUpdate(owner: "architect")`
|
|
90
100
|
5. `TaskCreate("Research: security + quality")` → `TaskUpdate(owner: "reviewer")`
|
|
91
101
|
|
|
92
|
-
Spawn
|
|
102
|
+
Spawn teammates with their task IDs (count depends on SCOUT_MODE and MCP settings):
|
|
93
103
|
|
|
94
|
-
1.
|
|
104
|
+
1. If `SCOUT_MODE != "none"`, spawn `context-scout` teammate:
|
|
95
105
|
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
96
106
|
> You are researching "{topic}" from a **knowzcode history** angle.
|
|
97
107
|
> Read `agents/context-scout.md` for your role definition.
|
|
@@ -99,7 +109,7 @@ Spawn up to five teammates with their task IDs:
|
|
|
99
109
|
> Find: existing specs, prior WorkGroups, tracker entries relevant to this topic.
|
|
100
110
|
> Broadcast findings to all teammates.
|
|
101
111
|
|
|
102
|
-
2. If `VAULTS_CONFIGURED = true`, spawn `knowz-scout` teammate:
|
|
112
|
+
2. If `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`, spawn `knowz-scout` teammate:
|
|
103
113
|
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
104
114
|
> You are researching "{topic}" from a **vault knowledge** angle.
|
|
105
115
|
> Read `agents/knowz-scout.md` for your role definition.
|
|
@@ -138,12 +148,15 @@ Wait for all to complete, then synthesize in Step 5.
|
|
|
138
148
|
|
|
139
149
|
Delegate to up to five agents in parallel via `Task()`:
|
|
140
150
|
|
|
141
|
-
1. **context-scout** — Local context (
|
|
142
|
-
- `
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
1. **context-scout** — Local context (if `SCOUT_MODE != "none"`):
|
|
152
|
+
- `SCOUT_MODE = "full"` (default): 3 parallel instances:
|
|
153
|
+
- `Task(subagent_type="context-scout", name="context-scout-specs", description="Scout: specs context", prompt="Research \"{topic}\". Focus: knowzcode/specs/*.md — scan existing specifications for relevant NodeIDs, status, VERIFY criteria. Max 10 tool calls. Write findings to a concise summary.")`
|
|
154
|
+
- `Task(subagent_type="context-scout", name="context-scout-workgroups", description="Scout: workgroups context", prompt="Research \"{topic}\". Focus: knowzcode/workgroups/*.md — scan previous WorkGroups for similar goals, what was tried, what succeeded/failed. Max 10 tool calls. Write findings to a concise summary.")`
|
|
155
|
+
- `Task(subagent_type="context-scout", name="context-scout-backlog", description="Scout: backlog context", prompt="Research \"{topic}\". Focus: knowzcode/knowzcode_tracker.md, knowzcode/knowzcode_log.md, knowzcode/knowzcode_architecture.md, knowzcode/knowzcode_project.md — scan for active WIP, REFACTOR tasks, architecture summary, recent log patterns. Max 10 tool calls. Write findings to a concise summary.")`
|
|
156
|
+
- `SCOUT_MODE = "minimal"`: 1 combined instance:
|
|
157
|
+
- `Task(subagent_type="context-scout", name="context-scout", description="Scout: combined context", prompt="Research \"{topic}\". Focus: ALL local context — knowzcode/specs/*.md, knowzcode/workgroups/*.md, knowzcode/knowzcode_tracker.md, knowzcode/knowzcode_log.md, knowzcode/knowzcode_architecture.md, knowzcode/knowzcode_project.md. Max 10 tool calls. Write findings to a concise summary.")`
|
|
145
158
|
|
|
146
|
-
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true`):
|
|
159
|
+
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`):
|
|
147
160
|
- `Task(subagent_type="knowz-scout", description="Scout: vault knowledge", prompt="Research \"{topic}\". Read knowzcode/knowzcode_vaults.md to discover configured vaults. Query each for relevant knowledge: team conventions, past decisions, similar implementations. Max 10 tool calls. Write findings to a concise summary.")`
|
|
148
161
|
|
|
149
162
|
3. **analyst** — Code exploration:
|