knowzcode 0.1.0 → 0.2.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.
- package/.claude-plugin/marketplace.json +6 -3
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +132 -73
- package/agents/analyst.md +24 -62
- package/agents/architect.md +34 -43
- package/agents/builder.md +35 -86
- package/agents/closer.md +29 -87
- package/agents/context-scout.md +54 -0
- package/agents/knowledge-migrator.md +7 -7
- package/agents/knowz-scout.md +83 -0
- package/agents/knowz-scribe.md +155 -0
- package/agents/microfix-specialist.md +1 -6
- package/agents/reviewer.md +43 -91
- package/agents/update-coordinator.md +7 -18
- package/bin/knowzcode.mjs +94 -7
- package/commands/audit.md +156 -25
- package/commands/connect-mcp.md +525 -507
- package/commands/fix.md +8 -8
- package/commands/init.md +9 -5
- package/commands/learn.md +327 -308
- package/commands/plan.md +160 -26
- package/commands/register.md +21 -12
- package/commands/status.md +309 -291
- package/commands/telemetry.md +188 -188
- package/commands/work.md +577 -114
- package/knowzcode/automation_manifest.md +59 -59
- package/knowzcode/claude_code_execution.md +228 -22
- package/knowzcode/enterprise/compliance_manifest.md +2 -0
- package/knowzcode/knowzcode_loop.md +111 -45
- package/knowzcode/knowzcode_project.md +48 -233
- package/knowzcode/knowzcode_vaults.md +183 -54
- package/knowzcode/mcp_config.md +72 -47
- package/knowzcode/platform_adapters.md +43 -4
- package/knowzcode/prompts/Execute_Micro_Fix.md +57 -57
- package/knowzcode/prompts/Investigate_Codebase.md +227 -227
- package/knowzcode/prompts/Migrate_Knowledge.md +301 -301
- package/knowzcode/prompts/Refactor_Node.md +72 -72
- package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -59
- package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -52
- package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -75
- package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -55
- package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -72
- package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -67
- 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 +24 -4
- 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
package/agents/reviewer.md
CHANGED
|
@@ -3,7 +3,7 @@ name: reviewer
|
|
|
3
3
|
description: "KnowzCode: Quality audit, security review, and compliance verification"
|
|
4
4
|
tools: Read, Glob, Grep, Bash
|
|
5
5
|
model: opus
|
|
6
|
-
permissionMode:
|
|
6
|
+
permissionMode: default
|
|
7
7
|
maxTurns: 30
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -22,26 +22,11 @@ Perform an independent, READ-ONLY audit of the implementation to verify what per
|
|
|
22
22
|
|
|
23
23
|
For each NodeID in the WorkGroup:
|
|
24
24
|
|
|
25
|
-
### Spec-to-Implementation Comparison
|
|
26
25
|
1. Read the specification (`knowzcode/specs/{NodeID}.md`)
|
|
27
26
|
2. Extract all `VERIFY:` statements (or legacy `ARC_XXX_01:` criteria)
|
|
28
|
-
3. For each criterion, verify
|
|
29
|
-
- Does the code implement the described behavior?
|
|
30
|
-
- Do tests exist that validate this criterion?
|
|
31
|
-
- Do the tests pass?
|
|
27
|
+
3. For each criterion, verify: does the code implement it? Do tests exist and pass?
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```markdown
|
|
36
|
-
**Verification Criteria Status:**
|
|
37
|
-
- VERIFY: when valid credentials, returns JWT token -> PASS
|
|
38
|
-
- VERIFY: when email exists, returns 409 -> PASS
|
|
39
|
-
- VERIFY: when token expired, returns 401 -> FAIL (not implemented)
|
|
40
|
-
|
|
41
|
-
**Completion**: {X}%
|
|
42
|
-
**Gaps**: [list of unimplemented criteria]
|
|
43
|
-
**Recommendation**: proceed / return to implementation
|
|
44
|
-
```
|
|
29
|
+
Report format: see `knowzcode_loop.md` section 3.4 for audit outcome structure.
|
|
45
30
|
|
|
46
31
|
## Security Audit
|
|
47
32
|
|
|
@@ -56,8 +41,6 @@ Scan for common vulnerabilities focused on the change scope:
|
|
|
56
41
|
|
|
57
42
|
### Security Scanning Patterns
|
|
58
43
|
|
|
59
|
-
Use these concrete detection patterns during security audits:
|
|
60
|
-
|
|
61
44
|
**SQL Injection** — Search for unsanitized query construction:
|
|
62
45
|
- String concatenation in queries: `"SELECT.*" \+ `, `f"SELECT`, `\$\{.*\}.*query`
|
|
63
46
|
- Missing parameterized queries: raw SQL without bind parameters
|
|
@@ -77,7 +60,7 @@ Use these concrete detection patterns during security audits:
|
|
|
77
60
|
- Missing rate limiting on login/auth endpoints
|
|
78
61
|
- JWT without expiration (`exp` claim)
|
|
79
62
|
- Insecure session configuration (missing `httpOnly`, `secure`, `sameSite`)
|
|
80
|
-
- Password storage without hashing
|
|
63
|
+
- Password storage without hashing
|
|
81
64
|
|
|
82
65
|
**Broken Access Control** — Check for:
|
|
83
66
|
- Missing authorization middleware on protected routes
|
|
@@ -91,93 +74,73 @@ Use these concrete detection patterns during security audits:
|
|
|
91
74
|
### Language-Specific Patterns
|
|
92
75
|
|
|
93
76
|
**Go:**
|
|
94
|
-
- SQL injection: `fmt.Sprintf("SELECT.*%s`
|
|
95
|
-
- Command injection: `exec.Command(` with user input
|
|
96
|
-
- Path traversal: `filepath.Join` without `filepath.Clean
|
|
97
|
-
- Insecure crypto: `crypto/md5`, `crypto/sha1` for passwords
|
|
77
|
+
- SQL injection: `fmt.Sprintf("SELECT.*%s` (use `db.Query` with `$1` params)
|
|
78
|
+
- Command injection: `exec.Command(` with user input
|
|
79
|
+
- Path traversal: `filepath.Join` without `filepath.Clean`
|
|
80
|
+
- Insecure crypto: `crypto/md5`, `crypto/sha1` for passwords
|
|
98
81
|
|
|
99
82
|
**Rust:**
|
|
100
|
-
- SQL injection: `format!("SELECT.*{}`
|
|
101
|
-
- Command injection: `std::process::Command::new` with unsanitized
|
|
83
|
+
- SQL injection: `format!("SELECT.*{}` (use parameterized queries)
|
|
84
|
+
- Command injection: `std::process::Command::new` with unsanitized input
|
|
102
85
|
- Unsafe blocks: `unsafe { }` without documented justification
|
|
103
|
-
- Insecure deserialization: `serde_json::from_str` on untrusted input without size limits
|
|
104
86
|
|
|
105
87
|
**Java:**
|
|
106
88
|
- SQL injection: `Statement.execute(` with string concat (use `PreparedStatement`)
|
|
107
|
-
- XXE: `DocumentBuilderFactory` without
|
|
89
|
+
- XXE: `DocumentBuilderFactory` without disallow-doctype-decl
|
|
108
90
|
- Deserialization: `ObjectInputStream.readObject()` on untrusted data
|
|
109
91
|
- Path traversal: `new File(userInput)` without canonical path validation
|
|
110
|
-
- LDAP injection: `ctx.search(` with unsanitized filters
|
|
111
92
|
|
|
112
93
|
### Task-Scoped Analysis
|
|
113
|
-
When auditing a specific WorkGroup
|
|
114
|
-
1. Focus on security implications of the implemented changes
|
|
115
|
-
2. Check only OWASP categories related to the change
|
|
116
|
-
3. Example: auth changes -> A01, A07; skip SSRF, deserialization
|
|
117
|
-
|
|
118
|
-
### Full Audit Mode
|
|
119
|
-
When invoked for a comprehensive security audit (not scoped to a WorkGroup):
|
|
120
|
-
- Comprehensive OWASP Top 10 coverage
|
|
121
|
-
- Full vulnerability scanning using patterns above
|
|
94
|
+
When auditing a specific WorkGroup, focus on security implications of the implemented changes only. Check OWASP categories related to the change.
|
|
122
95
|
|
|
123
96
|
## Integration Health
|
|
124
97
|
|
|
125
98
|
Assess system-wide integration quality:
|
|
126
99
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
3. Verify error response formats are consistent across endpoints
|
|
133
|
-
|
|
134
|
-
**Cross-Component Dependency Analysis:**
|
|
135
|
-
1. Build dependency graph from imports/requires across changed files
|
|
136
|
-
2. Identify circular dependencies
|
|
137
|
-
3. Flag components with >5 direct dependents (high coupling risk)
|
|
138
|
-
|
|
139
|
-
**Orphaned Code Detection:**
|
|
140
|
-
1. Search for exported functions/classes with zero importers
|
|
141
|
-
2. Find unused route definitions or dead endpoints
|
|
142
|
-
3. Identify test files with no corresponding source file (or vice versa)
|
|
143
|
-
|
|
144
|
-
**Data Flow Consistency:**
|
|
145
|
-
1. Trace data from API entry points through service layer to persistence
|
|
146
|
-
2. Verify validation is applied at system boundaries (not just middleware)
|
|
147
|
-
3. Check that error handling doesn't swallow or expose sensitive data
|
|
148
|
-
|
|
149
|
-
**Test Coverage vs Critical Paths:**
|
|
150
|
-
1. Identify critical user-facing paths (auth, payments, data mutation)
|
|
151
|
-
2. Verify each critical path has at least one integration/e2e test
|
|
152
|
-
3. Flag critical paths with only unit tests (missing integration coverage)
|
|
100
|
+
- **API Contract Alignment**: Compare defined interfaces in specs vs implementations
|
|
101
|
+
- **Cross-Component Dependencies**: Build dependency graph, identify circular deps, flag high coupling (>5 dependents)
|
|
102
|
+
- **Orphaned Code**: Search for exports with zero importers, unused routes, unmatched test files
|
|
103
|
+
- **Data Flow Consistency**: Trace data from entry to persistence, verify validation at boundaries
|
|
104
|
+
- **Test Coverage vs Critical Paths**: Verify critical paths have integration/e2e tests
|
|
153
105
|
|
|
154
106
|
## Enterprise Compliance (Optional)
|
|
155
107
|
|
|
156
108
|
If `knowzcode/enterprise/compliance_manifest.md` exists and `compliance_enabled: true`:
|
|
157
109
|
1. Load active guidelines where `applies_to IN ['implementation', 'both']`
|
|
158
110
|
2. Check implementation against each guideline
|
|
159
|
-
3. Report blocking issues separately from advisory
|
|
160
|
-
4. Merge compliance results into overall audit report
|
|
111
|
+
3. Report blocking issues separately from advisory
|
|
161
112
|
|
|
162
|
-
|
|
113
|
+
## Spec Issue Detection
|
|
163
114
|
|
|
164
|
-
|
|
115
|
+
Scan the WorkGroup file for `[SPEC_ISSUE]` tags added during implementation. Validate each against current specs and code. Include in audit report.
|
|
165
116
|
|
|
166
|
-
|
|
117
|
+
## MCP Integration (Optional)
|
|
167
118
|
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
- `
|
|
119
|
+
If MCP is configured:
|
|
120
|
+
- Read `knowzcode/knowzcode_vaults.md` to resolve vault IDs by type
|
|
121
|
+
- `ask_question({vault matching "ecosystem" type}, "standards for {domain}", researchMode=true)` — comprehensive standards check
|
|
122
|
+
- `search_knowledge({vault matching "ecosystem" type}, "audit findings for {component_type}")` — past audit comparison
|
|
171
123
|
|
|
172
124
|
If MCP is not available, audit against specs and codebase directly. All auditing works without MCP.
|
|
173
125
|
|
|
174
|
-
##
|
|
126
|
+
## Incremental Audit (Parallel Teams)
|
|
127
|
+
|
|
128
|
+
In Parallel Teams mode, you are paired with a specific builder partition:
|
|
129
|
+
- You audit only the NodeIDs assigned to your partition
|
|
130
|
+
- Each audit task is blocked until the builder marks its implementation complete
|
|
131
|
+
- Audit each NodeID independently — don't wait for all implementation in your partition
|
|
132
|
+
- Other partitions have their own reviewer — do not audit their NodeIDs
|
|
133
|
+
|
|
134
|
+
### Structured Gap Report Format
|
|
135
|
+
|
|
136
|
+
When reporting gaps in task completion summaries, use this format:
|
|
175
137
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
138
|
+
**Gaps Found: {count}**
|
|
139
|
+
| # | NodeID | File:Line | VERIFY Criterion | Expected | Actual | Severity |
|
|
140
|
+
|---|--------|-----------|-----------------|----------|--------|----------|
|
|
141
|
+
| 1 | Auth | auth.ts:45 | VERIFY:token_expiry | 1hr exp | No expiry set | Critical |
|
|
142
|
+
|
|
143
|
+
The lead will create fix tasks for builders based on this report.
|
|
181
144
|
|
|
182
145
|
## Consolidated Audit Output
|
|
183
146
|
|
|
@@ -206,15 +169,4 @@ After audit report is generated, if MCP is configured:
|
|
|
206
169
|
- Produce objective completion percentage
|
|
207
170
|
- List all discrepancies between spec and implementation
|
|
208
171
|
- Recommend blocker vs acceptable debt
|
|
209
|
-
-
|
|
210
|
-
|
|
211
|
-
## Multi-Agent Coordination
|
|
212
|
-
|
|
213
|
-
When running in a multi-agent workflow:
|
|
214
|
-
- Ask the analyst about change scope if unclear
|
|
215
|
-
- Ask the architect about expected behavior and design intent
|
|
216
|
-
- Report specific gap details to the builder (file, line, criterion, expected vs actual) when gaps need fixing
|
|
217
|
-
- Report findings to the user for decision
|
|
218
|
-
- The closer proceeds with finalization after user approves audit results
|
|
219
|
-
|
|
220
|
-
For Claude Code Agent Teams behavior, see `knowzcode/claude_code_execution.md`.
|
|
172
|
+
- Report all gaps to the lead
|
|
@@ -173,7 +173,6 @@ Before any changes:
|
|
|
173
173
|
|
|
174
174
|
```markdown
|
|
175
175
|
1. Create timestamped backup:
|
|
176
|
-
.claude.backup.{timestamp}/
|
|
177
176
|
knowzcode.backup.{timestamp}/
|
|
178
177
|
|
|
179
178
|
2. Store backup manifest:
|
|
@@ -237,7 +236,6 @@ Create `knowzcode/update_manifest.md`:
|
|
|
237
236
|
✅ Project metadata: Preserved
|
|
238
237
|
|
|
239
238
|
### Backup Location
|
|
240
|
-
`.claude.backup.20250104_200000/`
|
|
241
239
|
`knowzcode.backup.20250104_200000/`
|
|
242
240
|
|
|
243
241
|
### Version Update
|
|
@@ -276,7 +274,7 @@ After update completion:
|
|
|
276
274
|
|
|
277
275
|
## Update Instructions
|
|
278
276
|
|
|
279
|
-
When invoked
|
|
277
|
+
When invoked (see "How to Invoke" below), provide the source path as context:
|
|
280
278
|
|
|
281
279
|
```markdown
|
|
282
280
|
1. Validate inputs:
|
|
@@ -286,7 +284,6 @@ When invoked via `/kc-update [source_path]`:
|
|
|
286
284
|
- No active WorkGroups blocking update
|
|
287
285
|
|
|
288
286
|
2. Create backups:
|
|
289
|
-
- Backup .claude/ directory
|
|
290
287
|
- Backup knowzcode/ directory
|
|
291
288
|
- Create backup manifest
|
|
292
289
|
|
|
@@ -368,27 +365,19 @@ After successful update:
|
|
|
368
365
|
|
|
369
366
|
3. Recommend next steps:
|
|
370
367
|
- Review any .new files
|
|
371
|
-
- Test orchestration: /kc
|
|
368
|
+
- Test orchestration: run /kc:work on a small task to verify
|
|
372
369
|
- Check for deprecated features
|
|
373
370
|
- Read changelog if provided
|
|
374
371
|
```
|
|
375
372
|
|
|
376
|
-
##
|
|
373
|
+
## How to Invoke
|
|
377
374
|
|
|
378
|
-
|
|
379
|
-
```
|
|
380
|
-
/kc-update /path/to/newer/knowzcode
|
|
381
|
-
```
|
|
375
|
+
This agent is invoked manually by name (e.g., spawned as a teammate or via `Task()` with `subagent_type: "update-coordinator"`). There is no dedicated slash command yet — a `/kc:update` command may be added in a future release.
|
|
382
376
|
|
|
383
|
-
**
|
|
384
|
-
|
|
385
|
-
/kc-update /path/to/newer/knowzcode strategy=preserve-custom
|
|
386
|
-
```
|
|
377
|
+
**Provide the source path in the spawn prompt:**
|
|
378
|
+
> Update KnowzCode from `/path/to/newer/knowzcode`. Use conflict strategy: preserve-custom.
|
|
387
379
|
|
|
388
|
-
**
|
|
389
|
-
```
|
|
390
|
-
/kc-update /path/to/newer/knowzcode --dry-run
|
|
391
|
-
```
|
|
380
|
+
**Dry run** — add `--dry-run` to the prompt to preview changes without writing files.
|
|
392
381
|
|
|
393
382
|
## Critical Safety Rules
|
|
394
383
|
|
package/bin/knowzcode.mjs
CHANGED
|
@@ -195,6 +195,65 @@ function listFilesRecursive(dir, base = dir) {
|
|
|
195
195
|
return files;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// ─── Marketplace Config ──────────────────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
function setMarketplaceConfig(claudeDir) {
|
|
201
|
+
ensureDir(claudeDir);
|
|
202
|
+
const settingsFile = join(claudeDir, 'settings.json');
|
|
203
|
+
let settings = {};
|
|
204
|
+
|
|
205
|
+
if (existsSync(settingsFile)) {
|
|
206
|
+
try {
|
|
207
|
+
settings = JSON.parse(readFileSync(settingsFile, 'utf8'));
|
|
208
|
+
} catch {
|
|
209
|
+
settings = {};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (!settings.extraKnownMarketplaces) settings.extraKnownMarketplaces = {};
|
|
214
|
+
settings.extraKnownMarketplaces.knowzcode = {
|
|
215
|
+
source: { source: 'github', repo: 'knowz-io/knowzcode' },
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
writeFileSync(settingsFile, JSON.stringify(settings, null, 2) + '\n');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function removeMarketplaceConfig(claudeDir) {
|
|
222
|
+
const settingsFile = join(claudeDir, 'settings.json');
|
|
223
|
+
if (!existsSync(settingsFile)) return;
|
|
224
|
+
|
|
225
|
+
try {
|
|
226
|
+
const settings = JSON.parse(readFileSync(settingsFile, 'utf8'));
|
|
227
|
+
if (settings.extraKnownMarketplaces && settings.extraKnownMarketplaces.knowzcode) {
|
|
228
|
+
delete settings.extraKnownMarketplaces.knowzcode;
|
|
229
|
+
writeFileSync(settingsFile, JSON.stringify(settings, null, 2) + '\n');
|
|
230
|
+
}
|
|
231
|
+
} catch {
|
|
232
|
+
// Ignore parse errors
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// ─── Stale File Cleanup ─────────────────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
function removeStaleFiles(sourceDir, targetDir) {
|
|
239
|
+
if (!existsSync(targetDir) || !existsSync(sourceDir)) return;
|
|
240
|
+
|
|
241
|
+
const sourceFiles = new Set(
|
|
242
|
+
readdirSync(sourceDir)
|
|
243
|
+
.filter((f) => f.endsWith('.md'))
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
for (const entry of readdirSync(targetDir)) {
|
|
247
|
+
if (entry.endsWith('.md') && !sourceFiles.has(entry)) {
|
|
248
|
+
const stale = join(targetDir, entry);
|
|
249
|
+
if (existsSync(stale) && statSync(stale).isFile()) {
|
|
250
|
+
log.info(`Removing stale file: ${stale}`);
|
|
251
|
+
rmSync(stale, { force: true });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
198
257
|
// ─── Tracker & Log Initializers ──────────────────────────────────────────────
|
|
199
258
|
|
|
200
259
|
function initTracker(filePath) {
|
|
@@ -311,10 +370,9 @@ async function promptConfirm(message) {
|
|
|
311
370
|
|
|
312
371
|
// ─── Agent Teams Enablement ──────────────────────────────────────────────────
|
|
313
372
|
|
|
314
|
-
function enableAgentTeams(
|
|
315
|
-
const claudeDir = join(dir, '.claude');
|
|
373
|
+
function enableAgentTeams(claudeDir, isGlobal) {
|
|
316
374
|
ensureDir(claudeDir);
|
|
317
|
-
const settingsFile = join(claudeDir, 'settings.local.json');
|
|
375
|
+
const settingsFile = join(claudeDir, isGlobal ? 'settings.json' : 'settings.local.json');
|
|
318
376
|
|
|
319
377
|
let settings = {};
|
|
320
378
|
if (existsSync(settingsFile)) {
|
|
@@ -329,7 +387,7 @@ function enableAgentTeams(dir) {
|
|
|
329
387
|
settings.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = '1';
|
|
330
388
|
|
|
331
389
|
writeFileSync(settingsFile, JSON.stringify(settings, null, 2) + '\n');
|
|
332
|
-
log.ok(
|
|
390
|
+
log.ok(`Agent Teams enabled in ${settingsFile}`);
|
|
333
391
|
}
|
|
334
392
|
|
|
335
393
|
// ─── Commands ────────────────────────────────────────────────────────────────
|
|
@@ -475,9 +533,21 @@ async function cmdInstall(opts) {
|
|
|
475
533
|
const claudeDir = opts.global ? join(process.env.HOME || process.env.USERPROFILE || '~', '.claude') : join(dir, '.claude');
|
|
476
534
|
|
|
477
535
|
log.info(`Installing Claude Code components to ${claudeDir}/`);
|
|
536
|
+
|
|
537
|
+
// Remove stale files before copying on --force
|
|
538
|
+
if (opts.force) {
|
|
539
|
+
removeStaleFiles(join(PKG_ROOT, 'commands'), join(claudeDir, 'commands'));
|
|
540
|
+
removeStaleFiles(join(PKG_ROOT, 'agents'), join(claudeDir, 'agents'));
|
|
541
|
+
removeStaleFiles(join(PKG_ROOT, 'skills'), join(claudeDir, 'skills'));
|
|
542
|
+
}
|
|
543
|
+
|
|
478
544
|
copyDirContents(join(PKG_ROOT, 'commands'), join(claudeDir, 'commands'));
|
|
479
545
|
copyDirContents(join(PKG_ROOT, 'agents'), join(claudeDir, 'agents'));
|
|
480
546
|
copyDirContents(join(PKG_ROOT, 'skills'), join(claudeDir, 'skills'));
|
|
547
|
+
|
|
548
|
+
// Pre-register marketplace in settings.json
|
|
549
|
+
setMarketplaceConfig(claudeDir);
|
|
550
|
+
|
|
481
551
|
adapterFiles.push(claudeDir + '/commands/', claudeDir + '/agents/', claudeDir + '/skills/');
|
|
482
552
|
} else {
|
|
483
553
|
// Other platforms: extract template and write adapter file
|
|
@@ -496,9 +566,12 @@ async function cmdInstall(opts) {
|
|
|
496
566
|
}
|
|
497
567
|
|
|
498
568
|
// 4. Agent Teams enablement
|
|
569
|
+
const agentTeamsClaudeDir = opts.global
|
|
570
|
+
? join(process.env.HOME || process.env.USERPROFILE || '~', '.claude')
|
|
571
|
+
: join(dir, '.claude');
|
|
499
572
|
let agentTeamsEnabled = false;
|
|
500
573
|
if (opts.agentTeams) {
|
|
501
|
-
enableAgentTeams(
|
|
574
|
+
enableAgentTeams(agentTeamsClaudeDir, opts.global);
|
|
502
575
|
agentTeamsEnabled = true;
|
|
503
576
|
} else if (selectedPlatforms.includes('claude') && !opts.force) {
|
|
504
577
|
// Interactive prompt for Claude Code users
|
|
@@ -507,7 +580,7 @@ async function cmdInstall(opts) {
|
|
|
507
580
|
console.log(`teammates handle each workflow phase. ${c.dim}(experimental)${c.reset}`);
|
|
508
581
|
const wantTeams = await promptConfirm('Enable Agent Teams? (recommended for Claude Code)');
|
|
509
582
|
if (wantTeams) {
|
|
510
|
-
enableAgentTeams(
|
|
583
|
+
enableAgentTeams(agentTeamsClaudeDir, opts.global);
|
|
511
584
|
agentTeamsEnabled = true;
|
|
512
585
|
}
|
|
513
586
|
}
|
|
@@ -531,7 +604,12 @@ async function cmdInstall(opts) {
|
|
|
531
604
|
console.log(' 1. Edit knowzcode/knowzcode_project.md — set project name, stack, standards');
|
|
532
605
|
console.log(' 2. Edit knowzcode/environment_context.md — configure build/test commands');
|
|
533
606
|
if (selectedPlatforms.includes('claude')) {
|
|
534
|
-
console.log(' 3.
|
|
607
|
+
console.log(' 3. Install the KnowzCode plugin (recommended):');
|
|
608
|
+
console.log(' /plugin install kc@knowzcode');
|
|
609
|
+
console.log(' 4. Start building:');
|
|
610
|
+
console.log(' /kc:work "Your first feature"');
|
|
611
|
+
console.log('');
|
|
612
|
+
console.log(' Note: Commands also work without plugin as /work, /plan, /fix, etc.');
|
|
535
613
|
} else {
|
|
536
614
|
console.log(' 3. Start building: use knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md');
|
|
537
615
|
}
|
|
@@ -624,6 +702,9 @@ async function cmdUninstall(opts) {
|
|
|
624
702
|
}
|
|
625
703
|
}
|
|
626
704
|
|
|
705
|
+
// Clean up marketplace config from settings.json
|
|
706
|
+
removeMarketplaceConfig(claudeDir);
|
|
707
|
+
|
|
627
708
|
console.log('');
|
|
628
709
|
log.ok('Uninstall complete');
|
|
629
710
|
console.log(' Removed:');
|
|
@@ -716,9 +797,15 @@ async function cmdUpgrade(opts) {
|
|
|
716
797
|
const claudeDir = join(dir, '.claude');
|
|
717
798
|
if (existsSync(join(claudeDir, 'commands')) || existsSync(join(claudeDir, 'agents'))) {
|
|
718
799
|
log.info('Updating Claude Code components...');
|
|
800
|
+
// Remove stale files before copying
|
|
801
|
+
removeStaleFiles(join(PKG_ROOT, 'commands'), join(claudeDir, 'commands'));
|
|
802
|
+
removeStaleFiles(join(PKG_ROOT, 'agents'), join(claudeDir, 'agents'));
|
|
803
|
+
removeStaleFiles(join(PKG_ROOT, 'skills'), join(claudeDir, 'skills'));
|
|
719
804
|
copyDirContents(join(PKG_ROOT, 'commands'), join(claudeDir, 'commands'));
|
|
720
805
|
copyDirContents(join(PKG_ROOT, 'agents'), join(claudeDir, 'agents'));
|
|
721
806
|
copyDirContents(join(PKG_ROOT, 'skills'), join(claudeDir, 'skills'));
|
|
807
|
+
// Ensure marketplace config is up to date
|
|
808
|
+
setMarketplaceConfig(claudeDir);
|
|
722
809
|
}
|
|
723
810
|
|
|
724
811
|
// Regenerate adapters for detected platforms
|
package/commands/audit.md
CHANGED
|
@@ -22,7 +22,7 @@ Run specialized audit workflows.
|
|
|
22
22
|
| **architecture** | Architecture health and drift |
|
|
23
23
|
| **security** | OWASP vulnerability scanning |
|
|
24
24
|
| **integration** | Cross-component consistency |
|
|
25
|
-
| **compliance** | Enterprise guideline compliance (if configured) |
|
|
25
|
+
| **compliance** | Enterprise guideline compliance (if configured, experimental) |
|
|
26
26
|
| *(no argument)* | Full parallel audit of all types |
|
|
27
27
|
|
|
28
28
|
---
|
|
@@ -34,39 +34,78 @@ Read:
|
|
|
34
34
|
- `knowzcode/knowzcode_architecture.md`
|
|
35
35
|
- `knowzcode/knowzcode_project.md`
|
|
36
36
|
|
|
37
|
-
## Step 2:
|
|
37
|
+
## Step 2: Set Up Execution Mode
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Attempt `TeamCreate(team_name="kc-audit-{timestamp}")`:
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
- **If TeamCreate succeeds** → Agent Teams mode:
|
|
42
|
+
1. Announce: `**Execution Mode: Agent Teams** — created team kc-audit-{timestamp}`
|
|
43
|
+
2. Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
44
|
+
3. You are the **team lead** — coordinate the audit and present results.
|
|
45
|
+
|
|
46
|
+
- **If TeamCreate fails** (error, unrecognized tool, timeout) → Subagent Delegation:
|
|
47
|
+
- Announce: `**Execution Mode: Subagent Delegation** — Agent Teams not available, using Task() fallback`
|
|
48
|
+
|
|
49
|
+
The user MUST see the execution mode announcement before audit work begins.
|
|
50
|
+
|
|
51
|
+
## Step 3: Execute Audit
|
|
52
|
+
|
|
53
|
+
### MCP Probe
|
|
54
|
+
|
|
55
|
+
Before spawning agents, determine vault availability:
|
|
56
|
+
1. Read `knowzcode/knowzcode_vaults.md` — partition entries into CONFIGURED (non-empty ID) and UNCREATED (empty ID)
|
|
57
|
+
2. Call `list_vaults(includeStats=true)` **always** — regardless of whether any IDs exist in the file
|
|
58
|
+
3. If `list_vaults()` fails → set `MCP_ACTIVE = false`, announce `**MCP Status: Not connected**`, skip vault setup
|
|
59
|
+
4. If `list_vaults()` succeeds AND UNCREATED list is non-empty → present the **Vault Creation Prompt**:
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
## Vault Setup
|
|
63
|
+
|
|
64
|
+
Your Knowz API key is valid and MCP is connected, but {N} default vault(s) haven't been created yet.
|
|
65
|
+
Creating vaults enables knowledge capture throughout the workflow:
|
|
66
|
+
|
|
67
|
+
| Vault | Type | Description | Written During |
|
|
68
|
+
|-------|------|-------------|----------------|
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Build table rows dynamically from the UNCREATED entries only. Derive "Written During" from each vault's Write Conditions field in `knowzcode_vaults.md`.
|
|
72
|
+
|
|
73
|
+
Then present options:
|
|
74
|
+
```
|
|
75
|
+
Options:
|
|
76
|
+
**A) Create all {N} vaults** (recommended)
|
|
77
|
+
**B) Select which to create**
|
|
78
|
+
**C) Skip** — proceed without vaults (can create later with `/kc:connect-mcp --configure-vaults`)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
5. Handle user selection:
|
|
82
|
+
- **A**: For each UNCREATED entry, call MCP `create_vault(name, description)`. If `create_vault` is not available, fall back to matching by name against `list_vaults()` results. Update `knowzcode_vaults.md`: fill ID field, change H3 heading from `(not created)` to vault ID. Report any failures.
|
|
83
|
+
- **B**: Ask which vaults to create, then create only selected ones.
|
|
84
|
+
- **C**: Log `"Vault creation skipped — knowledge capture disabled."` Continue.
|
|
85
|
+
6. After resolution, set:
|
|
86
|
+
- `MCP_ACTIVE = true` (MCP works regardless of vault creation outcome)
|
|
87
|
+
- `VAULTS_CONFIGURED = true` if at least 1 vault now has a valid ID, else `false`
|
|
88
|
+
- Announce: `**MCP Status: Connected — N vault(s) available**` or `**MCP Status: Connected — no vaults configured (knowledge capture disabled)**`
|
|
89
|
+
|
|
90
|
+
### Agent Teams Mode
|
|
91
|
+
|
|
92
|
+
#### Specific Audit Type (argument provided)
|
|
93
|
+
|
|
94
|
+
`TaskCreate("Audit: {audit_type}")` → `TaskUpdate(owner: "reviewer")`.
|
|
95
|
+
|
|
96
|
+
Spawn a single `reviewer` teammate:
|
|
97
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
42
98
|
> You are the **reviewer** running a {audit_type} audit.
|
|
43
99
|
> Read `agents/reviewer.md` for your role definition.
|
|
44
100
|
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
45
101
|
>
|
|
46
|
-
> **Audit scope**: {audit_type
|
|
102
|
+
> **Audit scope**: {audit_type}
|
|
47
103
|
> **Context files**: knowzcode_tracker.md, knowzcode_architecture.md, knowzcode_project.md
|
|
48
104
|
> **Specs directory**: knowzcode/specs/
|
|
49
105
|
>
|
|
50
106
|
> Deliverable: Audit report with health scores, critical issues, recommendations.
|
|
51
107
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### Subagent Mode (fallback)
|
|
55
|
-
|
|
56
|
-
Delegate to the **reviewer** agent via `Task()`. Pass the audit type and context file paths.
|
|
57
|
-
|
|
58
|
-
### Full Audit (no argument — DEFAULT)
|
|
59
|
-
|
|
60
|
-
The reviewer performs a comprehensive quality audit covering:
|
|
61
|
-
- Specification quality (all specs in `knowzcode/specs/`)
|
|
62
|
-
- Architecture health (`knowzcode/knowzcode_architecture.md`)
|
|
63
|
-
- Security vulnerability scan (OWASP Top 10)
|
|
64
|
-
- Integration consistency (cross-component patterns)
|
|
65
|
-
- Enterprise compliance (if `knowzcode/enterprise/` configured)
|
|
66
|
-
|
|
67
|
-
If MCP is configured: `ask_question(research_vault, "standards for {project_type}", researchMode=true)` to check against documented team standards.
|
|
68
|
-
|
|
69
|
-
### Specific Audit Type
|
|
108
|
+
Wait for completion. Shut down teammate. Clean up the team.
|
|
70
109
|
|
|
71
110
|
The reviewer focuses on the requested type with type-specific depth:
|
|
72
111
|
- **spec**: Validates 4-section format, VERIFY statement count, consolidation opportunities
|
|
@@ -75,7 +114,99 @@ The reviewer focuses on the requested type with type-specific depth:
|
|
|
75
114
|
- **integration**: API contracts, dependency graph, orphaned code, data flow
|
|
76
115
|
- **compliance**: Enterprise guideline enforcement levels
|
|
77
116
|
|
|
78
|
-
|
|
117
|
+
#### Full Audit (no argument — DEFAULT)
|
|
118
|
+
|
|
119
|
+
Create tasks first, pre-assign, then spawn with task IDs:
|
|
120
|
+
- `TaskCreate("Audit: spec + architecture")` → `TaskUpdate(owner: "reviewer-spec-arch")`
|
|
121
|
+
- `TaskCreate("Audit: security + integration")` → `TaskUpdate(owner: "reviewer-sec-int")`
|
|
122
|
+
- (Optional) `TaskCreate("Audit: compliance")` → `TaskUpdate(owner: "reviewer-compliance")` (if enterprise configured)
|
|
123
|
+
- `TaskCreate("Scout: vault standards")` → `TaskUpdate(owner: "knowz-scout")` (if `VAULTS_CONFIGURED = true`)
|
|
124
|
+
|
|
125
|
+
Spawn reviewers with their task IDs:
|
|
126
|
+
|
|
127
|
+
1. Spawn `reviewer` teammate (name: `reviewer-spec-arch`):
|
|
128
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
129
|
+
> You are the **reviewer** running a targeted audit.
|
|
130
|
+
> Read `agents/reviewer.md` for your role definition.
|
|
131
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
132
|
+
>
|
|
133
|
+
> **Audit scope**: Specification quality AND architecture health ONLY.
|
|
134
|
+
> Do NOT audit security or integration — another reviewer handles those.
|
|
135
|
+
> **Context files**: knowzcode_tracker.md, knowzcode_architecture.md, knowzcode_project.md
|
|
136
|
+
> **Specs directory**: knowzcode/specs/
|
|
137
|
+
>
|
|
138
|
+
> Deliverable: Audit report with spec quality scores, architecture health, critical issues.
|
|
139
|
+
|
|
140
|
+
2. Spawn `reviewer` teammate (name: `reviewer-sec-int`):
|
|
141
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
142
|
+
> You are the **reviewer** running a targeted audit.
|
|
143
|
+
> Read `agents/reviewer.md` for your role definition.
|
|
144
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
145
|
+
>
|
|
146
|
+
> **Audit scope**: Security vulnerability scan AND integration consistency ONLY.
|
|
147
|
+
> Do NOT audit specs or architecture — another reviewer handles those.
|
|
148
|
+
> **Context files**: knowzcode_tracker.md, knowzcode_architecture.md, knowzcode_project.md
|
|
149
|
+
> **Specs directory**: knowzcode/specs/
|
|
150
|
+
>
|
|
151
|
+
> Deliverable: Audit report with security posture, integration health, critical issues.
|
|
152
|
+
|
|
153
|
+
3. (Optional) If enterprise compliance configured, spawn `reviewer` (name: `reviewer-compliance`):
|
|
154
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
155
|
+
> **Audit scope**: Enterprise compliance ONLY.
|
|
156
|
+
> Check against guidelines in `knowzcode/enterprise/compliance_manifest.md`.
|
|
157
|
+
|
|
158
|
+
4. If `VAULTS_CONFIGURED = true`, spawn `knowz-scout` for standards lookup in parallel with reviewers:
|
|
159
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
160
|
+
> 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
|
+
|
|
162
|
+
Wait for all to complete. Synthesize results in Step 4.
|
|
163
|
+
|
|
164
|
+
### Subagent Mode
|
|
165
|
+
|
|
166
|
+
#### Specific Audit Type
|
|
167
|
+
|
|
168
|
+
Launch scouts + reviewer in parallel via `Task()`:
|
|
169
|
+
|
|
170
|
+
1. **context-scout** — Local context (3 parallel instances):
|
|
171
|
+
- `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.")`
|
|
172
|
+
- `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.")`
|
|
173
|
+
- `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.")`
|
|
174
|
+
|
|
175
|
+
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true`):
|
|
176
|
+
- `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
|
+
|
|
178
|
+
3. **reviewer** — The audit itself:
|
|
179
|
+
- `subagent_type`: `"reviewer"`
|
|
180
|
+
- `prompt`: Task-specific context only (role definition is auto-loaded from `agents/reviewer.md`):
|
|
181
|
+
> **Audit scope**: {audit_type}
|
|
182
|
+
> **Context files**: knowzcode_tracker.md, knowzcode_architecture.md, knowzcode_project.md
|
|
183
|
+
> **Specs directory**: knowzcode/specs/
|
|
184
|
+
>
|
|
185
|
+
> Deliverable: Audit report with health scores, critical issues, recommendations.
|
|
186
|
+
- `description`: `"Audit: {audit_type}"`
|
|
187
|
+
|
|
188
|
+
All launched in parallel. Synthesize scout findings alongside reviewer results.
|
|
189
|
+
|
|
190
|
+
#### Full Audit
|
|
191
|
+
|
|
192
|
+
Launch scouts + parallel reviewers via `Task()`:
|
|
193
|
+
|
|
194
|
+
1. **context-scout** — Local context (3 parallel instances):
|
|
195
|
+
- `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.")`
|
|
196
|
+
- `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.")`
|
|
197
|
+
- `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.")`
|
|
198
|
+
|
|
199
|
+
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true`):
|
|
200
|
+
- `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
|
+
|
|
202
|
+
3. **Parallel reviewers**:
|
|
203
|
+
- `Task(subagent_type="reviewer", description="Audit: spec + architecture", prompt="Audit scope: Specification quality AND architecture health ONLY. ...")`
|
|
204
|
+
- `Task(subagent_type="reviewer", description="Audit: security + integration", prompt="Audit scope: Security vulnerability scan AND integration consistency ONLY. ...")`
|
|
205
|
+
- `Task(subagent_type="reviewer", description="Audit: compliance", prompt="Audit scope: Enterprise compliance ONLY. ...")` (if enterprise configured)
|
|
206
|
+
|
|
207
|
+
Synthesize scout context alongside reviewer results.
|
|
208
|
+
|
|
209
|
+
## Step 4: Present Results
|
|
79
210
|
|
|
80
211
|
```markdown
|
|
81
212
|
## KnowzCode Audit Results
|
|
@@ -98,7 +229,7 @@ The reviewer focuses on the requested type with type-specific depth:
|
|
|
98
229
|
{prioritized action items}
|
|
99
230
|
```
|
|
100
231
|
|
|
101
|
-
## Step
|
|
232
|
+
## Step 5: Log Audit
|
|
102
233
|
|
|
103
234
|
Log to `knowzcode/knowzcode_log.md`:
|
|
104
235
|
```markdown
|