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.
Files changed (59) hide show
  1. package/.claude-plugin/marketplace.json +6 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +132 -73
  4. package/agents/analyst.md +24 -62
  5. package/agents/architect.md +34 -43
  6. package/agents/builder.md +35 -86
  7. package/agents/closer.md +29 -87
  8. package/agents/context-scout.md +54 -0
  9. package/agents/knowledge-migrator.md +7 -7
  10. package/agents/knowz-scout.md +83 -0
  11. package/agents/knowz-scribe.md +155 -0
  12. package/agents/microfix-specialist.md +1 -6
  13. package/agents/reviewer.md +43 -91
  14. package/agents/update-coordinator.md +7 -18
  15. package/bin/knowzcode.mjs +94 -7
  16. package/commands/audit.md +156 -25
  17. package/commands/connect-mcp.md +525 -507
  18. package/commands/fix.md +8 -8
  19. package/commands/init.md +9 -5
  20. package/commands/learn.md +327 -308
  21. package/commands/plan.md +160 -26
  22. package/commands/register.md +21 -12
  23. package/commands/status.md +309 -291
  24. package/commands/telemetry.md +188 -188
  25. package/commands/work.md +577 -114
  26. package/knowzcode/automation_manifest.md +59 -59
  27. package/knowzcode/claude_code_execution.md +228 -22
  28. package/knowzcode/enterprise/compliance_manifest.md +2 -0
  29. package/knowzcode/knowzcode_loop.md +111 -45
  30. package/knowzcode/knowzcode_project.md +48 -233
  31. package/knowzcode/knowzcode_vaults.md +183 -54
  32. package/knowzcode/mcp_config.md +72 -47
  33. package/knowzcode/platform_adapters.md +43 -4
  34. package/knowzcode/prompts/Execute_Micro_Fix.md +57 -57
  35. package/knowzcode/prompts/Investigate_Codebase.md +227 -227
  36. package/knowzcode/prompts/Migrate_Knowledge.md +301 -301
  37. package/knowzcode/prompts/Refactor_Node.md +72 -72
  38. package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -59
  39. package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -52
  40. package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -75
  41. package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -55
  42. package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -72
  43. package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -67
  44. package/package.json +1 -1
  45. package/skills/alias-resolver.json +1 -1
  46. package/skills/architecture-diff.json +1 -1
  47. package/skills/check-installation-status.json +1 -1
  48. package/skills/continue.md +24 -4
  49. package/skills/environment-guard.json +1 -1
  50. package/skills/generate-workgroup-id.json +1 -1
  51. package/skills/install-knowzcode.json +1 -1
  52. package/skills/load-core-context.json +1 -1
  53. package/skills/log-entry-builder.json +1 -1
  54. package/skills/spec-quality-check.json +1 -1
  55. package/skills/spec-template.json +1 -1
  56. package/skills/spec-validator.json +1 -1
  57. package/skills/tracker-scan.json +1 -1
  58. package/skills/tracker-update.json +1 -1
  59. package/skills/validate-installation.json +1 -1
package/commands/plan.md CHANGED
@@ -26,54 +26,152 @@ If no argument provided, ask: "What would you like me to research?"
26
26
 
27
27
  If `knowzcode/` doesn't exist, inform user to run `/kc:init` first. STOP.
28
28
 
29
- ## Step 3: Launch Parallel Investigation
29
+ ## Step 3: Set Up Execution Mode
30
30
 
31
- ### Agent Teams Mode (if available)
31
+ Attempt `TeamCreate(team_name="kc-plan-{slug}")` (2-4 word kebab-case from topic):
32
32
 
33
- Spawn three teammates to investigate simultaneously:
33
+ - **If TeamCreate succeeds** Agent Teams mode:
34
+ 1. Announce: `**Execution Mode: Agent Teams** — created team kc-plan-{slug}`
35
+ 2. Read `knowzcode/claude_code_execution.md` for team conventions.
36
+ 3. You are the **team lead** — coordinate research, synthesize findings.
34
37
 
35
- 1. Spawn `analyst` teammate:
38
+ - **If TeamCreate fails** (error, unrecognized tool, timeout) → Subagent Delegation:
39
+ - Announce: `**Execution Mode: Subagent Delegation** — Agent Teams not available, using Task() fallback`
40
+
41
+ The user MUST see the execution mode announcement before investigation begins.
42
+
43
+ ## Step 4: Launch Parallel Investigation
44
+
45
+ ### MCP Probe
46
+
47
+ Before spawning agents, determine vault availability:
48
+ 1. Read `knowzcode/knowzcode_vaults.md` — partition entries into CONFIGURED (non-empty ID) and UNCREATED (empty ID)
49
+ 2. Call `list_vaults(includeStats=true)` **always** — regardless of whether any IDs exist in the file
50
+ 3. If `list_vaults()` fails → set `MCP_ACTIVE = false`, announce `**MCP Status: Not connected**`, skip vault setup
51
+ 4. If `list_vaults()` succeeds AND UNCREATED list is non-empty → present the **Vault Creation Prompt**:
52
+
53
+ ```markdown
54
+ ## Vault Setup
55
+
56
+ Your Knowz API key is valid and MCP is connected, but {N} default vault(s) haven't been created yet.
57
+ Creating vaults enables knowledge capture throughout the workflow:
58
+
59
+ | Vault | Type | Description | Written During |
60
+ |-------|------|-------------|----------------|
61
+ ```
62
+
63
+ Build table rows dynamically from the UNCREATED entries only. Derive "Written During" from each vault's Write Conditions field in `knowzcode_vaults.md`.
64
+
65
+ Then present options:
66
+ ```
67
+ Options:
68
+ **A) Create all {N} vaults** (recommended)
69
+ **B) Select which to create**
70
+ **C) Skip** — proceed without vaults (can create later with `/kc:connect-mcp --configure-vaults`)
71
+ ```
72
+
73
+ 5. Handle user selection:
74
+ - **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.
75
+ - **B**: Ask which vaults to create, then create only selected ones.
76
+ - **C**: Log `"Vault creation skipped — knowledge capture disabled."` Continue.
77
+ 6. After resolution, set:
78
+ - `MCP_ACTIVE = true` (MCP works regardless of vault creation outcome)
79
+ - `VAULTS_CONFIGURED = true` if at least 1 vault now has a valid ID, else `false`
80
+ - Announce: `**MCP Status: Connected — N vault(s) available**` or `**MCP Status: Connected — no vaults configured (knowledge capture disabled)**`
81
+
82
+ ### Agent Teams Mode (with scouts)
83
+
84
+ Create tasks first, pre-assign, then spawn with task IDs:
85
+
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`)
88
+ 3. `TaskCreate("Research: code exploration")` → `TaskUpdate(owner: "analyst")`
89
+ 4. `TaskCreate("Research: architecture")` → `TaskUpdate(owner: "architect")`
90
+ 5. `TaskCreate("Research: security + quality")` → `TaskUpdate(owner: "reviewer")`
91
+
92
+ Spawn up to five teammates with their task IDs:
93
+
94
+ 1. Spawn `context-scout` teammate:
95
+ > **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
96
+ > You are researching "{topic}" from a **knowzcode history** angle.
97
+ > Read `agents/context-scout.md` for your role definition.
98
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
99
+ > Find: existing specs, prior WorkGroups, tracker entries relevant to this topic.
100
+ > Broadcast findings to all teammates.
101
+
102
+ 2. If `VAULTS_CONFIGURED = true`, spawn `knowz-scout` teammate:
103
+ > **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
104
+ > You are researching "{topic}" from a **vault knowledge** angle.
105
+ > Read `agents/knowz-scout.md` for your role definition.
106
+ > Read `knowzcode/claude_code_execution.md` for team conventions.
107
+ > Query: team conventions, past decisions, similar implementations.
108
+ > Broadcast findings to all teammates.
109
+
110
+ 3. Spawn `analyst` teammate:
111
+ > **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
36
112
  > You are researching "{topic}" from a **code exploration** angle.
37
113
  > Read `agents/analyst.md` for your role definition.
38
114
  > Read `knowzcode/claude_code_execution.md` for team conventions.
39
115
  > Investigate: affected files, dependencies, existing patterns.
40
116
  > Max 10 tool calls. Write findings to a concise summary.
41
117
 
42
- 2. Spawn `architect` teammate:
118
+ 4. Spawn `architect` teammate:
119
+ > **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
43
120
  > You are researching "{topic}" from an **architecture** angle.
44
121
  > Read `agents/architect.md` for your role definition.
45
122
  > Read `knowzcode/claude_code_execution.md` for team conventions.
46
123
  > Investigate: layer analysis, design implications, pattern fit.
47
124
  > Max 10 tool calls. Write findings to a concise summary.
48
125
 
49
- 3. Spawn `reviewer` teammate:
126
+ 5. Spawn `reviewer` teammate:
127
+ > **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
50
128
  > You are researching "{topic}" from a **security and quality** angle.
51
129
  > Read `agents/reviewer.md` for your role definition.
52
130
  > Read `knowzcode/claude_code_execution.md` for team conventions.
53
131
  > Investigate: risks, performance concerns, quality gaps.
54
132
  > Max 10 tool calls. Write findings to a concise summary.
55
133
 
56
- Create three tasks (no dependencies all run in parallel).
57
- Wait for all three to complete, then synthesize in Step 5.
58
-
59
- ### Subagent Mode (fallback)
60
-
61
- Delegate to three agents in parallel via `Task()`:
62
- - **analyst**: Code exploration — affected files, dependencies, existing patterns
63
- - **architect**: Architecture assessment layer analysis, design implications, pattern fit
64
- - **reviewer**: Security and qualityrisks, performance concerns, quality gaps
134
+ Scouts broadcast findings; all three core researchers consume them.
135
+ Wait for all to complete, then synthesize in Step 5.
136
+
137
+ ### Subagent Mode
138
+
139
+ Delegate to up to five agents in parallel via `Task()`:
140
+
141
+ 1. **context-scout**Local context (3 parallel instances):
142
+ - `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.")`
143
+ - `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.")`
144
+ - `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.")`
145
+
146
+ 2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true`):
147
+ - `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
+
149
+ 3. **analyst** — Code exploration:
150
+ - `subagent_type`: `"analyst"`
151
+ - `prompt`: Task-specific context only (role definition is auto-loaded from `agents/analyst.md`):
152
+ > Research "{topic}" from a **code exploration** angle.
153
+ > Investigate: affected files, dependencies, existing patterns.
154
+ > Max 10 tool calls. Write findings to a concise summary.
155
+ - `description`: `"Plan research: code exploration"`
156
+
157
+ 4. **architect** — Architecture assessment:
158
+ - `subagent_type`: `"architect"`
159
+ - `prompt`: Task-specific context only (role definition is auto-loaded from `agents/architect.md`):
160
+ > Research "{topic}" from an **architecture** angle.
161
+ > Investigate: layer analysis, design implications, pattern fit.
162
+ > Max 10 tool calls. Write findings to a concise summary.
163
+ - `description`: `"Plan research: architecture"`
164
+
165
+ 5. **reviewer** — Security and quality:
166
+ - `subagent_type`: `"reviewer"`
167
+ - `prompt`: Task-specific context only (role definition is auto-loaded from `agents/reviewer.md`):
168
+ > Research "{topic}" from a **security and quality** angle.
169
+ > Investigate: risks, performance concerns, quality gaps.
170
+ > Max 10 tool calls. Write findings to a concise summary.
171
+ - `description`: `"Plan research: security and quality"`
65
172
 
66
173
  Each uses focused, efficient scoping (max 10 tool calls).
67
174
 
68
- ## Step 4: Check Existing Knowledge (in parallel)
69
-
70
- While agents investigate, also check:
71
- - `knowzcode/specs/*.md` for relevant specifications
72
- - `knowzcode/knowzcode_tracker.md` for related WorkGroups
73
- - `knowzcode/workgroups/*.md` for prior related work
74
-
75
- If MCP is configured: `search_knowledge(research_vault, "{topic}")` for past decisions.
76
-
77
175
  ## Step 5: Synthesize Findings
78
176
 
79
177
  ```markdown
@@ -88,9 +186,10 @@ If MCP is configured: `search_knowledge(research_vault, "{topic}")` for past dec
88
186
  ### Security & Quality
89
187
  {summarized findings from reviewer}
90
188
 
91
- ### Existing Knowledge
189
+ ### Existing Knowledge (from scouts)
92
190
  - **Relevant Specs**: {list or "None found"}
93
191
  - **Prior WorkGroups**: {list or "None found"}
192
+ - **Vault Knowledge**: {list or "N/A — MCP not configured"}
94
193
 
95
194
  ### Recommended Approaches
96
195
 
@@ -105,6 +204,19 @@ If MCP is configured: `search_knowledge(research_vault, "{topic}")` for past dec
105
204
  ### Risks & Considerations
106
205
  {synthesized risks}
107
206
 
207
+ ### Complexity Assessment
208
+ - **Files identified**: {count} — {file list}
209
+ - **Potential NodeIDs**: {count} — {brief descriptions}
210
+ - **Architectural impact**: Yes/No — {reason if yes}
211
+ - **Security-sensitive**: Yes/No — {reason if yes}
212
+ - **External integrations**: Yes/No — {list if yes}
213
+ - **Estimated scope**: ~{N} lines across {M} files
214
+ - **Recommended tier**: Tier 2 (Light) / Tier 3 (Full)
215
+
216
+ Tier recommendation follows work.md's classification rules:
217
+ - **Tier 3** if ANY: >3 files, >1 NodeID, architectural impact, security-sensitive, external integrations
218
+ - **Tier 2** if ALL: ≤3 files, single NodeID, no arch changes, no security, no external APIs
219
+
108
220
  ---
109
221
 
110
222
  **Ready to implement?** Say "implement", "do option 1", or "go ahead" to start `/kc:work` with this context.
@@ -114,7 +226,29 @@ If MCP is configured: `search_knowledge(research_vault, "{topic}")` for past dec
114
226
 
115
227
  Watch for: "implement", "do it", "go ahead", "option N", "start work", "build this"
116
228
 
117
- When triggered, invoke `/kc:work "{original_topic}"` with investigation context.
229
+ When triggered, invoke `/kc:work "{original_topic}" --tier {recommended_tier}` and include
230
+ a summary of investigation findings:
231
+
232
+ > **Plan investigation context:**
233
+ > - Files: {file list from complexity assessment}
234
+ > - Potential NodeIDs: {list}
235
+ > - Key risks: {top risks}
236
+ > - Recommended approach: {selected option or top recommendation}
237
+
238
+ This context gives work's analyst a head start and ensures correct tier classification.
239
+
240
+ ---
241
+
242
+ ## Cleanup
243
+
244
+ After synthesis is complete (or if the user cancels):
245
+
246
+ **Agent Teams Mode**:
247
+ 1. Shut down all active teammates. Wait for each to confirm shutdown.
248
+ 2. Once all teammates have shut down, clean up the team.
249
+ No teammates or team resources should remain after the research ends.
250
+
251
+ **Subagent Mode**: No cleanup needed — `Task()` calls are self-contained.
118
252
 
119
253
  ---
120
254
 
@@ -368,23 +368,29 @@ curl -X POST https://api.dev.knowz.io/api/v1/auth/register \
368
368
 
369
369
  ## Vaults
370
370
 
371
- ### Research Vault (Primary)
371
+ ### Ecosystem Vault (Primary)
372
372
  - **Vault ID**: {vault_id from registration}
373
373
  - **Vault Name**: {vault_name from registration}
374
- - **Purpose**: Learnings, conventions, decisions, patterns
374
+ - **Purpose**: Decisions, conventions, security, integrations, business rules
375
375
  - **Auto-configured**: Yes (via /kc:register)
376
376
 
377
377
  ### Code Vault (Optional)
378
378
  - **Vault ID**: (not configured)
379
- - **Purpose**: Indexed source code for semantic search
379
+ - **Purpose**: Implementation patterns, workarounds, performance
380
380
  - **Note**: Code search uses local grep/glob by default.
381
381
  Configure code vault for large codebases with /kc:connect-mcp --configure-vaults
382
+
383
+ ### Finalizations Vault (Optional)
384
+ - **Vault ID**: (not configured)
385
+ - **Purpose**: WorkGroup completion summaries, outcome records
386
+ - **Note**: Finalizations vault tracks completed work.
387
+ Configure for teams that want searchable completion history.
382
388
  ```
383
389
 
384
390
  **Edge case - existing vault config**:
385
- If `knowzcode/mcp_config.md` already has a Research Vault ID configured:
391
+ If `knowzcode/mcp_config.md` already has an Ecosystem Vault ID configured:
386
392
  - Use AskUserQuestion: "You already have a vault configured. Replace with new vault from registration? [Yes/No/Keep both]"
387
- - If "Yes": Replace Research Vault ID
393
+ - If "Yes": Replace Ecosystem Vault ID
388
394
  - If "No": Keep existing vault config
389
395
  - If "Keep both": Add new vault as secondary
390
396
 
@@ -488,9 +494,9 @@ After MCP is configured and before showing the final success message, offer vaul
488
494
  ┌────┬──────────────────────┬──────────────────┬───────────┐
489
495
  │ # │ Name │ Type │ Documents │
490
496
  ├────┼──────────────────────┼──────────────────┼───────────┤
491
- │ 1 │ KnowzCode (default) │ research │ 0 │
497
+ │ 1 │ KnowzCode (default) │ ecosystem │ 0 │
492
498
  │ 2 │ my-project-code │ code │ 1,234 │
493
- │ 3 │ engineering-wiki │ research │ 89 │
499
+ │ 3 │ engineering-wiki │ ecosystem │ 89 │
494
500
  └────┴──────────────────────┴──────────────────┴───────────┘
495
501
  ```
496
502
 
@@ -545,13 +551,13 @@ After MCP is configured and before showing the final success message, offer vaul
545
551
  ### {vault_id_1}
546
552
  - **Name**: {vault_name}
547
553
  - **ID**: {vault_id}
548
- - **Type**: {code | research}
554
+ - **Type**: {code | ecosystem | finalizations}
549
555
  - **Description**: {user_provided_description}
550
556
 
551
557
  ### {vault_id_2}
552
558
  - **Name**: {vault_name}
553
559
  - **ID**: {vault_id}
554
- - **Type**: {code | research}
560
+ - **Type**: {code | ecosystem | finalizations}
555
561
  - **Description**: {user_provided_description}
556
562
 
557
563
  ---
@@ -559,10 +565,13 @@ After MCP is configured and before showing the final success message, offer vaul
559
565
  ## Vault Routing Rules
560
566
 
561
567
  - **Code questions** (implementations, files, structure) → {first code vault}
562
- - **Convention questions** (patterns, decisions, best practices) → {first research vault}
563
- - **Learning capture** → {default research vault}
568
+ - **Convention questions** (patterns, decisions, best practices) → {first ecosystem vault}
569
+ - **Completion records** → {first finalizations vault}
570
+ - **Learning capture** → {default ecosystem vault}
564
571
  ```
565
572
 
573
+ **Null GUID detection**: After writing vault configuration to `knowzcode_vaults.md`, check for entries with empty **ID** fields. If found, prompt: "Found {N} default vault(s) not yet created. Create them now?" On confirmation, create each vault via MCP and update the ID fields.
574
+
566
575
  5. **Show vault configuration summary**
567
576
 
568
577
  After writing configuration:
@@ -570,7 +579,7 @@ After MCP is configured and before showing the final success message, offer vaul
570
579
  Vault configuration saved to knowzcode/knowzcode_vaults.md
571
580
 
572
581
  Connected Vaults:
573
- • KnowzCode (research) - "Team learnings and conventions"
582
+ • KnowzCode (ecosystem) - "Team learnings and conventions"
574
583
  • my-code (code) - "Source code for API project"
575
584
 
576
585
  Queries will be automatically routed based on your descriptions.