knowzcode 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +61 -61
- package/.claude-plugin/plugin.json +8 -8
- package/LICENSE +121 -121
- package/README.md +354 -320
- package/agents/analyst.md +114 -114
- package/agents/architect.md +200 -200
- package/agents/builder.md +104 -104
- package/agents/closer.md +177 -95
- package/agents/context-scout.md +54 -54
- package/agents/knowledge-migrator.md +349 -349
- package/agents/knowz-scout.md +83 -83
- package/agents/knowz-scribe.md +180 -180
- package/agents/microfix-specialist.md +135 -135
- package/agents/project-advisor.md +111 -111
- package/agents/reviewer.md +172 -172
- package/agents/security-officer.md +194 -194
- package/agents/test-advisor.md +162 -162
- package/agents/update-coordinator.md +394 -394
- package/bin/knowzcode.mjs +1199 -956
- package/commands/audit.md +328 -328
- package/commands/connect-mcp.md +549 -549
- package/commands/fix.md +107 -107
- package/commands/init.md +500 -439
- package/commands/learn.md +332 -332
- package/commands/plan.md +272 -272
- package/commands/register.md +733 -733
- package/commands/status.md +309 -309
- package/commands/telemetry-setup.md +368 -368
- package/commands/telemetry.md +188 -188
- package/commands/work.md +1204 -1170
- package/knowzcode/automation_manifest.md +59 -59
- package/knowzcode/claude_code_execution.md +431 -420
- package/knowzcode/copilot_execution.md +231 -231
- package/knowzcode/enterprise/compliance_manifest.md +137 -137
- package/knowzcode/enterprise/compliance_status.md +30 -30
- package/knowzcode/enterprise/guidelines/code-quality.md +67 -67
- package/knowzcode/enterprise/guidelines/security.md +355 -355
- package/knowzcode/enterprise/templates/guideline-template.md +55 -55
- package/knowzcode/gitignore.template +13 -13
- package/knowzcode/knowzcode_architecture.md +51 -51
- package/knowzcode/knowzcode_log.md +142 -142
- package/knowzcode/knowzcode_loop.md +596 -593
- package/knowzcode/knowzcode_orchestration.md +66 -66
- package/knowzcode/knowzcode_project.md +48 -48
- package/knowzcode/knowzcode_tracker.md +40 -40
- package/knowzcode/knowzcode_vaults.md +257 -257
- package/knowzcode/mcp_config.md +191 -191
- package/knowzcode/planning/Readme.md +6 -6
- package/knowzcode/platform_adapters.md +1260 -1047
- 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/knowzcode/specs/Readme.md +10 -10
- package/knowzcode/telemetry_config.md +89 -89
- package/knowzcode/user_preferences.md +120 -120
- package/package.json +53 -53
- package/skills/alias-resolver.json +15 -15
- package/skills/architecture-diff.json +12 -12
- package/skills/check-installation-status.json +14 -14
- package/skills/continue.md +126 -126
- package/skills/environment-guard.json +12 -12
- package/skills/generate-workgroup-id.json +25 -25
- package/skills/install-knowzcode.json +21 -21
- package/skills/load-core-context.json +18 -18
- package/skills/log-entry-builder.json +15 -15
- package/skills/spec-quality-check.json +14 -14
- package/skills/spec-template.json +15 -15
- package/skills/spec-validator.json +25 -25
- package/skills/start-work.md +224 -224
- package/skills/tracker-scan.json +12 -12
- package/skills/tracker-update.json +28 -28
- package/skills/validate-installation.json +14 -14
package/commands/plan.md
CHANGED
|
@@ -1,272 +1,272 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Research and investigate before implementing"
|
|
3
|
-
argument-hint: "<topic or question>"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# KnowzCode Plan
|
|
7
|
-
|
|
8
|
-
Research a topic, feature, or question using parallel investigation before committing to implementation.
|
|
9
|
-
|
|
10
|
-
**Usage**: `/kc:plan <topic or question>`
|
|
11
|
-
|
|
12
|
-
**Examples**:
|
|
13
|
-
```
|
|
14
|
-
/kc:plan "is the API using proper error handling?"
|
|
15
|
-
/kc:plan "add user authentication with JWT"
|
|
16
|
-
/kc:plan "how does caching work in this codebase?"
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Step 1: Validate Input
|
|
22
|
-
|
|
23
|
-
If no argument provided, ask: "What would you like me to research?"
|
|
24
|
-
|
|
25
|
-
## Step 2: Check Initialization
|
|
26
|
-
|
|
27
|
-
If `knowzcode/` doesn't exist, inform user to run `/kc:init` first. STOP.
|
|
28
|
-
|
|
29
|
-
## Step 3: Set Up Execution Mode
|
|
30
|
-
|
|
31
|
-
Attempt `TeamCreate(team_name="kc-plan-{slug}")` (2-4 word kebab-case from topic):
|
|
32
|
-
|
|
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.
|
|
37
|
-
|
|
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 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
|
-
|
|
53
|
-
## Step 4: Launch Parallel Investigation
|
|
54
|
-
|
|
55
|
-
### MCP Probe
|
|
56
|
-
|
|
57
|
-
Before spawning agents, determine vault availability:
|
|
58
|
-
1. Read `knowzcode/knowzcode_vaults.md` — partition entries into CONFIGURED (non-empty ID) and UNCREATED (empty ID)
|
|
59
|
-
2. Call `list_vaults(includeStats=true)` **always** — regardless of whether any IDs exist in the file
|
|
60
|
-
3. If `list_vaults()` fails → set `MCP_ACTIVE = false`, announce `**MCP Status: Not connected**`, skip vault setup
|
|
61
|
-
4. If `list_vaults()` succeeds AND UNCREATED list is non-empty → present the **Vault Creation Prompt**:
|
|
62
|
-
|
|
63
|
-
```markdown
|
|
64
|
-
## Vault Setup
|
|
65
|
-
|
|
66
|
-
Your Knowz API key is valid and MCP is connected, but {N} default vault(s) haven't been created yet.
|
|
67
|
-
Creating vaults enables knowledge capture throughout the workflow:
|
|
68
|
-
|
|
69
|
-
| Vault | Type | Description | Written During |
|
|
70
|
-
|-------|------|-------------|----------------|
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Build table rows dynamically from the UNCREATED entries only. Derive "Written During" from each vault's Write Conditions field in `knowzcode_vaults.md`.
|
|
74
|
-
|
|
75
|
-
Then present options:
|
|
76
|
-
```
|
|
77
|
-
Options:
|
|
78
|
-
**A) Create all {N} vaults** (recommended)
|
|
79
|
-
**B) Select which to create**
|
|
80
|
-
**C) Skip** — proceed without vaults (can create later with `/kc:connect-mcp --configure-vaults`)
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
5. Handle user selection:
|
|
84
|
-
- **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.
|
|
85
|
-
- **B**: Ask which vaults to create, then create only selected ones.
|
|
86
|
-
- **C**: Log `"Vault creation skipped — knowledge capture disabled."` Continue.
|
|
87
|
-
6. After resolution, set:
|
|
88
|
-
- `MCP_ACTIVE = true` (MCP works regardless of vault creation outcome)
|
|
89
|
-
- `VAULTS_CONFIGURED = true` if at least 1 vault now has a valid ID, else `false`
|
|
90
|
-
- Announce: `**MCP Status: Connected — N vault(s) available**` or `**MCP Status: Connected — no vaults configured (knowledge capture disabled)**`
|
|
91
|
-
|
|
92
|
-
### Agent Teams Mode (with scouts)
|
|
93
|
-
|
|
94
|
-
Create tasks first, pre-assign, then spawn with task IDs:
|
|
95
|
-
|
|
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`)
|
|
98
|
-
3. `TaskCreate("Research: code exploration")` → `TaskUpdate(owner: "analyst")`
|
|
99
|
-
4. `TaskCreate("Research: architecture")` → `TaskUpdate(owner: "architect")`
|
|
100
|
-
5. `TaskCreate("Research: security + quality")` → `TaskUpdate(owner: "reviewer")`
|
|
101
|
-
|
|
102
|
-
Spawn teammates with their task IDs (count depends on SCOUT_MODE and MCP settings):
|
|
103
|
-
|
|
104
|
-
1. If `SCOUT_MODE != "none"`, spawn `context-scout` teammate:
|
|
105
|
-
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
106
|
-
> You are researching "{topic}" from a **knowzcode history** angle.
|
|
107
|
-
> Read `agents/context-scout.md` for your role definition.
|
|
108
|
-
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
109
|
-
> Find: existing specs, prior WorkGroups, tracker entries relevant to this topic.
|
|
110
|
-
> Broadcast findings to all teammates.
|
|
111
|
-
|
|
112
|
-
2. If `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`, spawn `knowz-scout` teammate:
|
|
113
|
-
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
114
|
-
> You are researching "{topic}" from a **vault knowledge** angle.
|
|
115
|
-
> Read `agents/knowz-scout.md` for your role definition.
|
|
116
|
-
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
117
|
-
> Query: team conventions, past decisions, similar implementations.
|
|
118
|
-
> Broadcast findings to all teammates.
|
|
119
|
-
|
|
120
|
-
3. Spawn `analyst` teammate:
|
|
121
|
-
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
122
|
-
> You are researching "{topic}" from a **code exploration** angle.
|
|
123
|
-
> Read `agents/analyst.md` for your role definition.
|
|
124
|
-
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
125
|
-
> Investigate: affected files, dependencies, existing patterns.
|
|
126
|
-
> Max 10 tool calls. Write findings to a concise summary.
|
|
127
|
-
|
|
128
|
-
4. Spawn `architect` teammate:
|
|
129
|
-
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
130
|
-
> You are researching "{topic}" from an **architecture** angle.
|
|
131
|
-
> Read `agents/architect.md` for your role definition.
|
|
132
|
-
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
133
|
-
> Investigate: layer analysis, design implications, pattern fit.
|
|
134
|
-
> Max 10 tool calls. Write findings to a concise summary.
|
|
135
|
-
|
|
136
|
-
5. Spawn `reviewer` teammate:
|
|
137
|
-
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
138
|
-
> You are researching "{topic}" from a **security and quality** angle.
|
|
139
|
-
> Read `agents/reviewer.md` for your role definition.
|
|
140
|
-
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
141
|
-
> Investigate: risks, performance concerns, quality gaps.
|
|
142
|
-
> Max 10 tool calls. Write findings to a concise summary.
|
|
143
|
-
|
|
144
|
-
Scouts broadcast findings; all three core researchers consume them.
|
|
145
|
-
Wait for all to complete, then synthesize in Step 5.
|
|
146
|
-
|
|
147
|
-
### Subagent Mode
|
|
148
|
-
|
|
149
|
-
Delegate to up to five agents in parallel via `Task()`:
|
|
150
|
-
|
|
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.")`
|
|
158
|
-
|
|
159
|
-
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`):
|
|
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.")`
|
|
161
|
-
|
|
162
|
-
3. **analyst** — Code exploration:
|
|
163
|
-
- `subagent_type`: `"analyst"`
|
|
164
|
-
- `prompt`: Task-specific context only (role definition is auto-loaded from `agents/analyst.md`):
|
|
165
|
-
> Research "{topic}" from a **code exploration** angle.
|
|
166
|
-
> Investigate: affected files, dependencies, existing patterns.
|
|
167
|
-
> Max 10 tool calls. Write findings to a concise summary.
|
|
168
|
-
- `description`: `"Plan research: code exploration"`
|
|
169
|
-
|
|
170
|
-
4. **architect** — Architecture assessment:
|
|
171
|
-
- `subagent_type`: `"architect"`
|
|
172
|
-
- `prompt`: Task-specific context only (role definition is auto-loaded from `agents/architect.md`):
|
|
173
|
-
> Research "{topic}" from an **architecture** angle.
|
|
174
|
-
> Investigate: layer analysis, design implications, pattern fit.
|
|
175
|
-
> Max 10 tool calls. Write findings to a concise summary.
|
|
176
|
-
- `description`: `"Plan research: architecture"`
|
|
177
|
-
|
|
178
|
-
5. **reviewer** — Security and quality:
|
|
179
|
-
- `subagent_type`: `"reviewer"`
|
|
180
|
-
- `prompt`: Task-specific context only (role definition is auto-loaded from `agents/reviewer.md`):
|
|
181
|
-
> Research "{topic}" from a **security and quality** angle.
|
|
182
|
-
> Investigate: risks, performance concerns, quality gaps.
|
|
183
|
-
> Max 10 tool calls. Write findings to a concise summary.
|
|
184
|
-
- `description`: `"Plan research: security and quality"`
|
|
185
|
-
|
|
186
|
-
Each uses focused, efficient scoping (max 10 tool calls).
|
|
187
|
-
|
|
188
|
-
## Step 5: Synthesize Findings
|
|
189
|
-
|
|
190
|
-
```markdown
|
|
191
|
-
## Investigation: {topic}
|
|
192
|
-
|
|
193
|
-
### Code Analysis
|
|
194
|
-
{summarized findings from analyst}
|
|
195
|
-
|
|
196
|
-
### Architecture Assessment
|
|
197
|
-
{summarized findings from architect}
|
|
198
|
-
|
|
199
|
-
### Security & Quality
|
|
200
|
-
{summarized findings from reviewer}
|
|
201
|
-
|
|
202
|
-
### Existing Knowledge (from scouts)
|
|
203
|
-
- **Relevant Specs**: {list or "None found"}
|
|
204
|
-
- **Prior WorkGroups**: {list or "None found"}
|
|
205
|
-
- **Vault Knowledge**: {list or "N/A — MCP not configured"}
|
|
206
|
-
|
|
207
|
-
### Recommended Approaches
|
|
208
|
-
|
|
209
|
-
**Option 1**: {approach}
|
|
210
|
-
- Pros: ...
|
|
211
|
-
- Cons: ...
|
|
212
|
-
|
|
213
|
-
**Option 2**: {approach}
|
|
214
|
-
- Pros: ...
|
|
215
|
-
- Cons: ...
|
|
216
|
-
|
|
217
|
-
### Risks & Considerations
|
|
218
|
-
{synthesized risks}
|
|
219
|
-
|
|
220
|
-
### Complexity Assessment
|
|
221
|
-
- **Files identified**: {count} — {file list}
|
|
222
|
-
- **Potential NodeIDs**: {count} — {brief descriptions}
|
|
223
|
-
- **Architectural impact**: Yes/No — {reason if yes}
|
|
224
|
-
- **Security-sensitive**: Yes/No — {reason if yes}
|
|
225
|
-
- **External integrations**: Yes/No — {list if yes}
|
|
226
|
-
- **Estimated scope**: ~{N} lines across {M} files
|
|
227
|
-
- **Recommended tier**: Tier 2 (Light) / Tier 3 (Full)
|
|
228
|
-
|
|
229
|
-
Tier recommendation follows work.md's classification rules:
|
|
230
|
-
- **Tier 3** if ANY: >3 files, >1 NodeID, architectural impact, security-sensitive, external integrations
|
|
231
|
-
- **Tier 2** if ALL: ≤3 files, single NodeID, no arch changes, no security, no external APIs
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
**Ready to implement?** Say "implement", "do option 1", or "go ahead" to start `/kc:work` with this context.
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Step 6: Listen for Implementation Intent
|
|
239
|
-
|
|
240
|
-
Watch for: "implement", "do it", "go ahead", "option N", "start work", "build this"
|
|
241
|
-
|
|
242
|
-
When triggered, invoke `/kc:work "{original_topic}" --tier {recommended_tier}` and include
|
|
243
|
-
a summary of investigation findings:
|
|
244
|
-
|
|
245
|
-
> **Plan investigation context:**
|
|
246
|
-
> - Files: {file list from complexity assessment}
|
|
247
|
-
> - Potential NodeIDs: {list}
|
|
248
|
-
> - Key risks: {top risks}
|
|
249
|
-
> - Recommended approach: {selected option or top recommendation}
|
|
250
|
-
|
|
251
|
-
This context gives work's analyst a head start and ensures correct tier classification.
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## Cleanup
|
|
256
|
-
|
|
257
|
-
After synthesis is complete (or if the user cancels):
|
|
258
|
-
|
|
259
|
-
**Agent Teams Mode**:
|
|
260
|
-
1. Shut down all active teammates. Wait for each to confirm shutdown.
|
|
261
|
-
2. Once all teammates have shut down, clean up the team.
|
|
262
|
-
No teammates or team resources should remain after the research ends.
|
|
263
|
-
|
|
264
|
-
**Subagent Mode**: No cleanup needed — `Task()` calls are self-contained.
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
## Notes
|
|
269
|
-
|
|
270
|
-
- Research agents use focused, efficient scoping (max 10 tool calls each)
|
|
271
|
-
- Investigation context is preserved when transitioning to `/kc:work`
|
|
272
|
-
- This replaces the old planning types (strategy, ideas, pre-flight, etc.)
|
|
1
|
+
---
|
|
2
|
+
description: "Research and investigate before implementing"
|
|
3
|
+
argument-hint: "<topic or question>"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# KnowzCode Plan
|
|
7
|
+
|
|
8
|
+
Research a topic, feature, or question using parallel investigation before committing to implementation.
|
|
9
|
+
|
|
10
|
+
**Usage**: `/kc:plan <topic or question>`
|
|
11
|
+
|
|
12
|
+
**Examples**:
|
|
13
|
+
```
|
|
14
|
+
/kc:plan "is the API using proper error handling?"
|
|
15
|
+
/kc:plan "add user authentication with JWT"
|
|
16
|
+
/kc:plan "how does caching work in this codebase?"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1: Validate Input
|
|
22
|
+
|
|
23
|
+
If no argument provided, ask: "What would you like me to research?"
|
|
24
|
+
|
|
25
|
+
## Step 2: Check Initialization
|
|
26
|
+
|
|
27
|
+
If `knowzcode/` doesn't exist, inform user to run `/kc:init` first. STOP.
|
|
28
|
+
|
|
29
|
+
## Step 3: Set Up Execution Mode
|
|
30
|
+
|
|
31
|
+
Attempt `TeamCreate(team_name="kc-plan-{slug}")` (2-4 word kebab-case from topic):
|
|
32
|
+
|
|
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.
|
|
37
|
+
|
|
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 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
|
+
|
|
53
|
+
## Step 4: Launch Parallel Investigation
|
|
54
|
+
|
|
55
|
+
### MCP Probe
|
|
56
|
+
|
|
57
|
+
Before spawning agents, determine vault availability:
|
|
58
|
+
1. Read `knowzcode/knowzcode_vaults.md` — partition entries into CONFIGURED (non-empty ID) and UNCREATED (empty ID)
|
|
59
|
+
2. Call `list_vaults(includeStats=true)` **always** — regardless of whether any IDs exist in the file
|
|
60
|
+
3. If `list_vaults()` fails → set `MCP_ACTIVE = false`, announce `**MCP Status: Not connected**`, skip vault setup
|
|
61
|
+
4. If `list_vaults()` succeeds AND UNCREATED list is non-empty → present the **Vault Creation Prompt**:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
## Vault Setup
|
|
65
|
+
|
|
66
|
+
Your Knowz API key is valid and MCP is connected, but {N} default vault(s) haven't been created yet.
|
|
67
|
+
Creating vaults enables knowledge capture throughout the workflow:
|
|
68
|
+
|
|
69
|
+
| Vault | Type | Description | Written During |
|
|
70
|
+
|-------|------|-------------|----------------|
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Build table rows dynamically from the UNCREATED entries only. Derive "Written During" from each vault's Write Conditions field in `knowzcode_vaults.md`.
|
|
74
|
+
|
|
75
|
+
Then present options:
|
|
76
|
+
```
|
|
77
|
+
Options:
|
|
78
|
+
**A) Create all {N} vaults** (recommended)
|
|
79
|
+
**B) Select which to create**
|
|
80
|
+
**C) Skip** — proceed without vaults (can create later with `/kc:connect-mcp --configure-vaults`)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
5. Handle user selection:
|
|
84
|
+
- **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.
|
|
85
|
+
- **B**: Ask which vaults to create, then create only selected ones.
|
|
86
|
+
- **C**: Log `"Vault creation skipped — knowledge capture disabled."` Continue.
|
|
87
|
+
6. After resolution, set:
|
|
88
|
+
- `MCP_ACTIVE = true` (MCP works regardless of vault creation outcome)
|
|
89
|
+
- `VAULTS_CONFIGURED = true` if at least 1 vault now has a valid ID, else `false`
|
|
90
|
+
- Announce: `**MCP Status: Connected — N vault(s) available**` or `**MCP Status: Connected — no vaults configured (knowledge capture disabled)**`
|
|
91
|
+
|
|
92
|
+
### Agent Teams Mode (with scouts)
|
|
93
|
+
|
|
94
|
+
Create tasks first, pre-assign, then spawn with task IDs:
|
|
95
|
+
|
|
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`)
|
|
98
|
+
3. `TaskCreate("Research: code exploration")` → `TaskUpdate(owner: "analyst")`
|
|
99
|
+
4. `TaskCreate("Research: architecture")` → `TaskUpdate(owner: "architect")`
|
|
100
|
+
5. `TaskCreate("Research: security + quality")` → `TaskUpdate(owner: "reviewer")`
|
|
101
|
+
|
|
102
|
+
Spawn teammates with their task IDs (count depends on SCOUT_MODE and MCP settings):
|
|
103
|
+
|
|
104
|
+
1. If `SCOUT_MODE != "none"`, spawn `context-scout` teammate:
|
|
105
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
106
|
+
> You are researching "{topic}" from a **knowzcode history** angle.
|
|
107
|
+
> Read `agents/context-scout.md` for your role definition.
|
|
108
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
109
|
+
> Find: existing specs, prior WorkGroups, tracker entries relevant to this topic.
|
|
110
|
+
> Broadcast findings to all teammates.
|
|
111
|
+
|
|
112
|
+
2. If `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`, spawn `knowz-scout` teammate:
|
|
113
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
114
|
+
> You are researching "{topic}" from a **vault knowledge** angle.
|
|
115
|
+
> Read `agents/knowz-scout.md` for your role definition.
|
|
116
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
117
|
+
> Query: team conventions, past decisions, similar implementations.
|
|
118
|
+
> Broadcast findings to all teammates.
|
|
119
|
+
|
|
120
|
+
3. Spawn `analyst` teammate:
|
|
121
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
122
|
+
> You are researching "{topic}" from a **code exploration** angle.
|
|
123
|
+
> Read `agents/analyst.md` for your role definition.
|
|
124
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
125
|
+
> Investigate: affected files, dependencies, existing patterns.
|
|
126
|
+
> Max 10 tool calls. Write findings to a concise summary.
|
|
127
|
+
|
|
128
|
+
4. Spawn `architect` teammate:
|
|
129
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
130
|
+
> You are researching "{topic}" from an **architecture** angle.
|
|
131
|
+
> Read `agents/architect.md` for your role definition.
|
|
132
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
133
|
+
> Investigate: layer analysis, design implications, pattern fit.
|
|
134
|
+
> Max 10 tool calls. Write findings to a concise summary.
|
|
135
|
+
|
|
136
|
+
5. Spawn `reviewer` teammate:
|
|
137
|
+
> **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
|
|
138
|
+
> You are researching "{topic}" from a **security and quality** angle.
|
|
139
|
+
> Read `agents/reviewer.md` for your role definition.
|
|
140
|
+
> Read `knowzcode/claude_code_execution.md` for team conventions.
|
|
141
|
+
> Investigate: risks, performance concerns, quality gaps.
|
|
142
|
+
> Max 10 tool calls. Write findings to a concise summary.
|
|
143
|
+
|
|
144
|
+
Scouts broadcast findings; all three core researchers consume them.
|
|
145
|
+
Wait for all to complete, then synthesize in Step 5.
|
|
146
|
+
|
|
147
|
+
### Subagent Mode
|
|
148
|
+
|
|
149
|
+
Delegate to up to five agents in parallel via `Task()`:
|
|
150
|
+
|
|
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.")`
|
|
158
|
+
|
|
159
|
+
2. **knowz-scout** — MCP knowledge (if `VAULTS_CONFIGURED = true` AND `MCP_AGENTS_ENABLED = true`):
|
|
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.")`
|
|
161
|
+
|
|
162
|
+
3. **analyst** — Code exploration:
|
|
163
|
+
- `subagent_type`: `"analyst"`
|
|
164
|
+
- `prompt`: Task-specific context only (role definition is auto-loaded from `agents/analyst.md`):
|
|
165
|
+
> Research "{topic}" from a **code exploration** angle.
|
|
166
|
+
> Investigate: affected files, dependencies, existing patterns.
|
|
167
|
+
> Max 10 tool calls. Write findings to a concise summary.
|
|
168
|
+
- `description`: `"Plan research: code exploration"`
|
|
169
|
+
|
|
170
|
+
4. **architect** — Architecture assessment:
|
|
171
|
+
- `subagent_type`: `"architect"`
|
|
172
|
+
- `prompt`: Task-specific context only (role definition is auto-loaded from `agents/architect.md`):
|
|
173
|
+
> Research "{topic}" from an **architecture** angle.
|
|
174
|
+
> Investigate: layer analysis, design implications, pattern fit.
|
|
175
|
+
> Max 10 tool calls. Write findings to a concise summary.
|
|
176
|
+
- `description`: `"Plan research: architecture"`
|
|
177
|
+
|
|
178
|
+
5. **reviewer** — Security and quality:
|
|
179
|
+
- `subagent_type`: `"reviewer"`
|
|
180
|
+
- `prompt`: Task-specific context only (role definition is auto-loaded from `agents/reviewer.md`):
|
|
181
|
+
> Research "{topic}" from a **security and quality** angle.
|
|
182
|
+
> Investigate: risks, performance concerns, quality gaps.
|
|
183
|
+
> Max 10 tool calls. Write findings to a concise summary.
|
|
184
|
+
- `description`: `"Plan research: security and quality"`
|
|
185
|
+
|
|
186
|
+
Each uses focused, efficient scoping (max 10 tool calls).
|
|
187
|
+
|
|
188
|
+
## Step 5: Synthesize Findings
|
|
189
|
+
|
|
190
|
+
```markdown
|
|
191
|
+
## Investigation: {topic}
|
|
192
|
+
|
|
193
|
+
### Code Analysis
|
|
194
|
+
{summarized findings from analyst}
|
|
195
|
+
|
|
196
|
+
### Architecture Assessment
|
|
197
|
+
{summarized findings from architect}
|
|
198
|
+
|
|
199
|
+
### Security & Quality
|
|
200
|
+
{summarized findings from reviewer}
|
|
201
|
+
|
|
202
|
+
### Existing Knowledge (from scouts)
|
|
203
|
+
- **Relevant Specs**: {list or "None found"}
|
|
204
|
+
- **Prior WorkGroups**: {list or "None found"}
|
|
205
|
+
- **Vault Knowledge**: {list or "N/A — MCP not configured"}
|
|
206
|
+
|
|
207
|
+
### Recommended Approaches
|
|
208
|
+
|
|
209
|
+
**Option 1**: {approach}
|
|
210
|
+
- Pros: ...
|
|
211
|
+
- Cons: ...
|
|
212
|
+
|
|
213
|
+
**Option 2**: {approach}
|
|
214
|
+
- Pros: ...
|
|
215
|
+
- Cons: ...
|
|
216
|
+
|
|
217
|
+
### Risks & Considerations
|
|
218
|
+
{synthesized risks}
|
|
219
|
+
|
|
220
|
+
### Complexity Assessment
|
|
221
|
+
- **Files identified**: {count} — {file list}
|
|
222
|
+
- **Potential NodeIDs**: {count} — {brief descriptions}
|
|
223
|
+
- **Architectural impact**: Yes/No — {reason if yes}
|
|
224
|
+
- **Security-sensitive**: Yes/No — {reason if yes}
|
|
225
|
+
- **External integrations**: Yes/No — {list if yes}
|
|
226
|
+
- **Estimated scope**: ~{N} lines across {M} files
|
|
227
|
+
- **Recommended tier**: Tier 2 (Light) / Tier 3 (Full)
|
|
228
|
+
|
|
229
|
+
Tier recommendation follows work.md's classification rules:
|
|
230
|
+
- **Tier 3** if ANY: >3 files, >1 NodeID, architectural impact, security-sensitive, external integrations
|
|
231
|
+
- **Tier 2** if ALL: ≤3 files, single NodeID, no arch changes, no security, no external APIs
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
**Ready to implement?** Say "implement", "do option 1", or "go ahead" to start `/kc:work` with this context.
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Step 6: Listen for Implementation Intent
|
|
239
|
+
|
|
240
|
+
Watch for: "implement", "do it", "go ahead", "option N", "start work", "build this"
|
|
241
|
+
|
|
242
|
+
When triggered, invoke `/kc:work "{original_topic}" --tier {recommended_tier}` and include
|
|
243
|
+
a summary of investigation findings:
|
|
244
|
+
|
|
245
|
+
> **Plan investigation context:**
|
|
246
|
+
> - Files: {file list from complexity assessment}
|
|
247
|
+
> - Potential NodeIDs: {list}
|
|
248
|
+
> - Key risks: {top risks}
|
|
249
|
+
> - Recommended approach: {selected option or top recommendation}
|
|
250
|
+
|
|
251
|
+
This context gives work's analyst a head start and ensures correct tier classification.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Cleanup
|
|
256
|
+
|
|
257
|
+
After synthesis is complete (or if the user cancels):
|
|
258
|
+
|
|
259
|
+
**Agent Teams Mode**:
|
|
260
|
+
1. Shut down all active teammates. Wait for each to confirm shutdown.
|
|
261
|
+
2. Once all teammates have shut down, clean up the team.
|
|
262
|
+
No teammates or team resources should remain after the research ends.
|
|
263
|
+
|
|
264
|
+
**Subagent Mode**: No cleanup needed — `Task()` calls are self-contained.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Notes
|
|
269
|
+
|
|
270
|
+
- Research agents use focused, efficient scoping (max 10 tool calls each)
|
|
271
|
+
- Investigation context is preserved when transitioning to `/kc:work`
|
|
272
|
+
- This replaces the old planning types (strategy, ideas, pre-flight, etc.)
|