knowzcode 0.3.3 → 0.3.7

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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official KnowzCode plugin marketplace - Platform-agnostic AI development methodology",
9
- "version": "0.3.3"
9
+ "version": "0.3.7"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "kc",
14
14
  "source": "./",
15
15
  "description": "KnowzCode - Platform-agnostic AI development methodology with TDD, quality gates, and structured workflows",
16
- "version": "0.3.3",
16
+ "version": "0.3.7",
17
17
  "author": {
18
18
  "name": "Alex Headscarf"
19
19
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kc",
3
3
  "description": "KnowzCode - Platform-agnostic AI development methodology with TDD, quality gates, and structured workflows",
4
- "version": "0.3.3",
4
+ "version": "0.3.7",
5
5
  "author": {
6
6
  "name": "Alex Headscarf"
7
7
  }
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  [![License: MIT + Commons Clause](https://img.shields.io/badge/License-MIT_+_Commons_Clause-yellow.svg)](LICENSE)
8
8
  [![Claude Code Plugin](https://img.shields.io/badge/Claude_Code-Plugin-purple)](https://github.com/knowz-io/knowzcode)
9
- [![Version](https://img.shields.io/badge/version-0.3.3-blue)](https://github.com/knowz-io/knowzcode/releases)
9
+ [![Version](https://img.shields.io/badge/version-0.3.7-blue)](https://github.com/knowz-io/knowzcode/releases)
10
10
 
11
11
  [Installation](#installation) · [Quick Start](#quick-start) · [When to Use It](#when-to-use-knowzcode) · [How It Works](#how-it-works) · [Commands](#commands) · [Docs](#documentation)
12
12
 
package/agents/closer.md CHANGED
@@ -4,7 +4,7 @@ description: "KnowzCode: Finalization — specs, tracker, log, architecture, lea
4
4
  tools: Read, Write, Edit, Glob, Grep
5
5
  model: opus
6
6
  permissionMode: acceptEdits
7
- maxTurns: 20
7
+ maxTurns: 25
8
8
  ---
9
9
 
10
10
  # Closer
@@ -16,6 +16,16 @@ Your expertise: Finalization of specs, tracker, log, architecture docs, and lear
16
16
 
17
17
  Execute the finalization phase after implementation is verified. Update all KnowzCode artifacts to reflect the completed work, then create a final commit.
18
18
 
19
+ ## Startup MCP Verification
20
+
21
+ On spawn, verify MCP connectivity before beginning finalization:
22
+
23
+ 1. Read `knowzcode/knowzcode_vaults.md` — check for configured vaults (non-empty ID)
24
+ 2. If no configured vaults → skip vault writes (nothing to write to)
25
+ 3. If configured vaults exist → call `list_vaults()` to verify MCP connectivity
26
+ - If succeeds → proceed with vault writes during Learning Capture
27
+ - If fails → queue all captures to `knowzcode/pending_captures.md` during Learning Capture
28
+
19
29
  ## Finalization Protocol
20
30
 
21
31
  Follow the steps in `knowzcode_loop.md` section 3.5:
@@ -56,28 +66,105 @@ During finalization:
56
66
 
57
67
  ## Learning Capture
58
68
 
59
- Scan the WorkGroup for insight-worthy patterns using the signal types from `knowzcode_loop.md` section 7 (Pattern, Decision, Workaround, Performance, Security, Convention).
69
+ Scan the WorkGroup for insight-worthy patterns using the signal types from `knowzcode_loop.md` section 7 (Pattern, Decision, Workaround, Performance, Security, Convention, Integration, Scope).
60
70
 
61
71
  ### Knowz-Scribe Delegation (Parallel Teams)
62
72
 
63
73
  If knowz-scribe is active (Parallel Teams mode with MCP connected):
64
- - Send message to **knowz-scribe**: `"Capture Phase 3: {wgid}"` the scribe handles all vault writes (appropriate vaults by type)
74
+ - Create capture task: `TaskCreate("Scribe: Capture Phase 3")` `TaskUpdate(owner: "knowz-scribe")`
75
+ - Send DM to **knowz-scribe** with task ID: `"Capture Phase 3: {wgid}. Your task: #{task-id}"`
65
76
  - Do NOT call `create_knowledge` directly — the scribe owns all vault writes
77
+ - Note: The lead waits for the scribe's capture task to complete before shutdown. The closer does NOT wait — create the task, send the DM, and continue finalization.
66
78
 
67
79
  ### Direct Write Fallback (Sequential/Subagent)
68
80
 
69
- If knowz-scribe is NOT active but MCP is configured:
70
- 1. Read `knowzcode/knowzcode_vaults.md` to discover configured vaults
71
- 2. For each learning type, find the appropriate vault by type:
72
- - Pattern/Workaround/Performance → vault with type `code`
73
- - Decision/Convention/Security/Integration vault with type `ecosystem`
74
- - Completion records → vault with type `finalizations`
75
- - If a single vault covers all types (or only a `research`/`domain`/`platform` alias vault exists), write everything there
76
- 3. Only write if the targeted vault is configured skip gracefully if not
77
- 4. **Title prefixes**: `Pattern:`, `Decision:`, `Workaround:`, `Performance:`, `Security:`, `Convention:`
78
- 5. For enterprise audit trail: find vault matching type "enterprise", push completion record if configured and compliance is enabled
79
-
80
- If MCP is not available, skip learning capture and audit trail — all other finalization works normally.
81
+ If knowz-scribe is NOT active but MCP is available (verified at startup):
82
+
83
+ > **Content Detail Principle**: Vault entries are retrieved via semantic search — write detailed, self-contained content with full reasoning, technology names, and code examples. See `knowzcode/knowzcode_vaults.md` (canonical source for content filters).
84
+
85
+ #### Step 1: Read Context
86
+
87
+ 1. Read `knowzcode/knowzcode_vaults.md` to discover configured vaults, their IDs, write conditions, and content filters
88
+ 2. Skip vault entries with empty ID fieldsthese haven't been created on the server yet
89
+ 3. Treat backwards-compat aliases identically: `research`/`domain`/`platform` = `ecosystem`, `sessions` = `finalizations`
90
+ 4. If a single vault is configured (regardless of type), route everything there
91
+
92
+ #### Step 2: Determine Target Vaults
93
+
94
+ Use the **Learning Category Routing** table to map each detected learning to the correct vault type:
95
+
96
+ | Learning Category | Target Vault Type | Title Prefix |
97
+ |-------------------|-------------------|--------------|
98
+ | Pattern | `code` | `Pattern:` |
99
+ | Workaround | `code` | `Workaround:` |
100
+ | Performance | `code` | `Performance:` |
101
+ | Decision | `ecosystem` | `Decision:` |
102
+ | Convention | `ecosystem` | `Convention:` |
103
+ | Security | `ecosystem` | `Security:` |
104
+ | Integration | `ecosystem` | `Integration:` |
105
+ | Scope | `ecosystem` | `Scope:` |
106
+ | Completion record | `finalizations` | `Completion:` |
107
+ | Audit trail | user's enterprise vault (if configured) | `Audit:` |
108
+
109
+ Only write if the targeted vault is configured — skip gracefully if not.
110
+
111
+ #### Step 3: Format Content
112
+
113
+ For each target vault, apply its **Content Filter** as defined in `knowzcode/knowzcode_vaults.md`:
114
+
115
+ - `code` vault: `[CONTEXT]` / `[PATTERN]` / `[EXAMPLE]` / `[TAGS]`
116
+ - `ecosystem` vault: `[CONTEXT]` / `[INSIGHT]` / `[RATIONALE]` / `[TAGS]`
117
+ - `finalizations` vault: `[GOAL]` / `[OUTCOME]` / `[NODES]` / `[DURATION]` / `[SUMMARY]` / `[TAGS]`
118
+
119
+ Follow the Content Detail Principle: write self-contained entries with full reasoning, specific technology names, code examples, and file paths. Every entry must be useful without any other context — it will be found via semantic search months later.
120
+
121
+ - **Title**: Use the prefix from the routing table + descriptive summary with technology names
122
+ - **Tags**: learning category, `phase-3`, domain tags, technology names
123
+ - **Source**: `KnowzCode WorkGroup {wgid}`
124
+
125
+ #### Step 4: Dedup Check
126
+
127
+ Before each write, call `search_knowledge(title, vaultId, 3)` on the target vault. If a result with a substantially similar title AND content already exists, skip the write. Log dedup catches in the WorkGroup file.
128
+
129
+ #### Step 5: Write
130
+
131
+ Call `create_knowledge` with the formatted payload for each target vault.
132
+
133
+ #### Phase 3 Extraction Guide
134
+
135
+ When scanning the WorkGroup for learnings, extract:
136
+ - **Architectural learnings**: Structural discoveries, component relationships that were not obvious, integration patterns that emerged during implementation
137
+ - **Convention patterns established**: New team conventions with full rationale and examples
138
+ - **Consolidation decisions**: What was merged or refactored during finalization and why
139
+ - **Implementation patterns**: Any Pattern/Workaround/Performance insights captured in the WorkGroup during Phase 2A that were not already written by a scribe
140
+ - **Scope decisions**: What was included/excluded and the rationale (from Phase 1A)
141
+ - **Security findings**: From Phase 2B audit, with severity and remediation
142
+
143
+ #### Enterprise Audit Trail
144
+
145
+ If `knowzcode/enterprise/compliance_manifest.md` exists and `mcp_compliance_enabled: true`:
146
+ 1. Find vault matching type "enterprise" in `knowzcode/knowzcode_vaults.md`
147
+ 2. Push completion record with goal, NodeIDs, audit score, and decisions
148
+ 3. Push architecture drift findings if any detected during finalization
149
+
150
+ ### MCP Graceful Degradation
151
+
152
+ If MCP calls fail during vault writes (or MCP was unavailable at startup):
153
+
154
+ 1. **Queue locally**: Append each capture to `knowzcode/pending_captures.md`:
155
+ ```markdown
156
+ ### {timestamp} — {title}
157
+ - **Intent**: Phase 3 capture
158
+ - **Category**: {Pattern|Decision|Workaround|Performance|Security|Convention|Integration|Scope|Completion}
159
+ - **Target Vault Type**: {code|ecosystem|enterprise|finalizations}
160
+ - **Source**: closer / WorkGroup {wgid}
161
+ - **Content**: {full formatted content that would have been written to the vault}
162
+ ```
163
+ 2. Log the MCP failure in the WorkGroup file: `"KnowzCode: MCP unavailable — queued {N} capture(s) to pending_captures.md"`
164
+ 3. Note in the finalization report that captures were queued locally
165
+ 4. The pending file can be flushed later via `/kc:learn --flush` or by a future scribe instance
166
+
167
+ **Never drop knowledge.** If MCP is down, queue it. All other finalization steps (specs, tracker, log, architecture, commit) proceed normally regardless of MCP status.
81
168
 
82
169
  ## Exit Expectations
83
170
 
@@ -40,22 +40,32 @@ This catches MCP issues at Stage 0 instead of 10+ minutes later at first capture
40
40
 
41
41
  ## Capture Request Format
42
42
 
43
- You receive messages from the lead or other agents in this format:
43
+ You receive capture requests from the lead or other agents in three forms:
44
44
 
45
- ```
46
- Capture Phase {phase}: {wgid}
47
- ```
45
+ ### Phase Captures (task-tracked)
46
+ Format: `"Capture Phase {phase}: {wgid}. Your task: #{task-id}"`
48
47
 
49
- Examples:
50
- - `Capture Phase 1A: WG-feat-auth-20260212` — scope decision approved
51
- - `Capture Phase 2A: WG-feat-auth-20260212` — implementation patterns discovered
52
- - `Capture Phase 2B: WG-feat-auth-20260212` audit results
53
- - `Capture Phase 3: WG-feat-auth-20260212` finalization learnings
48
+ Triggered at quality gates. Read the WorkGroup file, extract phase-specific content, write to appropriate vaults.
49
+
50
+ ### Explicit Ad-Hoc: `"Log: {description}"`
51
+ A teammate has identified knowledge worth capturing and is telling you to write it.
52
+ You MUST write itdecide which vault based on content type using the Learning Category Routing table.
53
+ Apply standard dedup checking. If a task ID is included, track it.
54
+
55
+ ### Soft Ad-Hoc: `"Consider: {description}"`
56
+ A teammate is forwarding something that MIGHT be worth capturing — a catch-all.
57
+ Evaluate the content against the Learning Category signal types (Pattern, Decision, Workaround, Performance, Security, Convention).
58
+ If it's insight-worthy and not duplicative, write it. If not, skip silently.
59
+ The sender is not asking you to log it — they're asking you to use your judgement.
54
60
 
55
61
  ## Write Process
56
62
 
57
63
  For each capture request:
58
64
 
65
+ ### Step 0: Claim Task
66
+
67
+ If a pre-created task exists for this capture (task ID provided in the capture message), claim it immediately (`TaskUpdate(taskId, status: "in_progress")`). After completing all vault writes for this capture, mark the task complete with a summary (count of items written + vault names). If no task ID was provided (ad-hoc messages), proceed without task tracking.
68
+
59
69
  ### Step 1: Read Context
60
70
 
61
71
  1. Read the WorkGroup file (`knowzcode/workgroups/{wgid}.md`) to extract relevant content for the phase
@@ -90,9 +100,11 @@ If multiple vaults match the target type, use the first one listed in `knowzcode
90
100
 
91
101
  For each target vault, apply its **Content Filter** to format the `create_knowledge` payload:
92
102
 
93
- - **Title**: Use the appropriate prefix (`Pattern:`, `Decision:`, `Workaround:`, `Performance:`, `Security:`, `Convention:`, `Scope:`, `Audit:`, `Integration:`, `Completion:`)
94
- - **Content**: Follow the content filter structure defined for the vault type
95
- - **Tags**: Include learning category, phase, and domain-relevant tags
103
+ > **Content Detail Principle**: Vault entries are retrieved via semantic search, not read directly like local files. Every entry must be self-contained and detailed — include full reasoning, specific technology names, code examples, file paths, and error messages. A terse entry like `"[Risk] Medium"` is useless when retrieved months later. See `knowzcode/knowzcode_vaults.md` for the full principle and examples.
104
+
105
+ - **Title**: Use the appropriate prefix (`Pattern:`, `Decision:`, `Workaround:`, `Performance:`, `Security:`, `Convention:`, `Scope:`, `Audit:`, `Integration:`, `Completion:`) followed by a descriptive summary including key technology names for search discoverability
106
+ - **Content**: Follow the content filter structure defined for the vault type — fill every field with enough detail that the entry is useful without any other context
107
+ - **Tags**: Include learning category, phase, domain-relevant tags, and specific technology names
96
108
  - **Source**: `KnowzCode WorkGroup {wgid}`
97
109
 
98
110
  ### Step 4: Dedup Check
@@ -107,49 +119,62 @@ Call `create_knowledge` with the formatted payload for each target vault.
107
119
 
108
120
  ### Phase 1A (Scope Approved)
109
121
  Extract from WorkGroup:
110
- - NodeIDs in the change set
111
- - Risk assessment
112
- - User approval decision
122
+ - **NodeIDs**: List each with its description, affected files, and domain area
123
+ - **Risk assessment**: Include the full reasoning — what could break, which files are high-risk, what mitigation is planned. Never write just "Medium"
124
+ - **Scope decisions**: What was included/excluded and why — alternatives the user considered
113
125
  - Write to: `ecosystem` vault (or single vault)
114
126
 
115
127
  ### Phase 2A (Implementation Complete)
116
128
  Extract from WorkGroup:
117
- - Implementation patterns and workarounds discovered during build
118
- - New utilities or abstractions created
119
- - Performance optimizations applied
129
+ - **Patterns discovered**: Describe the pattern, why it was needed, how it works, and include file paths or code snippets. E.g., "Created retry wrapper in src/utils/retry.ts using exponential backoff with jitter for all external API calls"
130
+ - **Workarounds**: What limitation was hit, what the workaround does, and any upstream fix to watch for
131
+ - **New utilities or abstractions**: What was created, its API surface, and where it's used
132
+ - **Performance optimizations**: Before/after metrics, the technique used, and any trade-offs
120
133
  - Write to: `code` vault for patterns/workarounds/performance, `ecosystem` vault for decisions
121
134
 
122
135
  ### Phase 2B (Audit Complete)
123
136
  Extract from WorkGroup:
124
- - Audit score and findings
125
- - Security issues found
126
- - Gap resolution decisions
137
+ - **Audit findings**: Completion percentage, specific gaps with file paths and line references
138
+ - **Security issues**: Describe the vulnerability, affected code paths, severity reasoning, and how it was (or should be) fixed
139
+ - **Gap resolution decisions**: What was deferred vs fixed, and the rationale for each decision
127
140
  - Write to: `ecosystem` vault for audit learnings, user's enterprise vault for audit trail (if configured + compliance enabled)
128
141
 
129
142
  ### Phase 3 (Finalization)
130
143
  Extract from WorkGroup:
131
- - Architectural learnings and consolidation decisions
132
- - Convention patterns established
133
- - Any remaining insight-worthy content
144
+ - **Architectural learnings**: Structural discoveries, component relationships that weren't obvious, integration patterns that emerged
145
+ - **Convention patterns established**: New team conventions with full rationale and examples
146
+ - **Consolidation decisions**: What was merged or refactored during finalization and why
134
147
  - Write to: appropriate vault per learning category routing
135
148
 
136
149
  ## Communication
137
150
 
138
- - **Report to lead only on**: errors (MCP failures, vault not found) or dedup catches
139
- - **Silent on success** do not broadcast write confirmations to the team
151
+ - **Report to lead on**: errors (MCP failures, vault not found) or dedup catches
152
+ - **Task-based confirmation**: Mark pre-created capture tasks complete with summary (count + vault names) — this is the primary confirmation mechanism
153
+ - **Phase 3 DM confirmation REQUIRED**: After processing Phase 3, send confirmation DM to lead: `"Phase 3 capture complete: {N} items written to {vault names}"`
154
+ - **Silent on success for other phases** — task completion is sufficient, do not broadcast
140
155
  - Respond to direct queries from teammates about what has been captured
141
156
 
142
157
  ## MCP Graceful Degradation
143
158
 
144
- If MCP calls fail:
145
- 1. Log the failure
146
- 2. Report the error to the lead via direct message
147
- 3. Do not retry immediately wait for the next capture request or lead instruction
148
- 4. The workflow continues without vault writes
159
+ If MCP calls fail or MCP is unavailable:
160
+ 1. **Queue locally**: Append the capture to `knowzcode/pending_captures.md` using this format:
161
+ ```markdown
162
+ ### {timestamp}{title}
163
+ - **Intent**: {Phase capture | Log | Consider}
164
+ - **Category**: {Pattern|Decision|Workaround|Performance|Security|Convention}
165
+ - **Target Vault Type**: {code|ecosystem|enterprise|finalizations}
166
+ - **Source**: {agent name} / WorkGroup {wgid}
167
+ - **Content**: {description or extracted learning}
168
+ ```
169
+ 2. Report the MCP failure to the lead via DM: `"MCP unavailable — queued {N} capture(s) to pending_captures.md"`
170
+ 3. If MCP recovers mid-session, flush pending captures to vaults on the next capture request
171
+ 4. Mark the capture task complete (if task-tracked) with note: `"Queued locally — MCP unavailable"`
172
+
173
+ Never drop knowledge. If MCP is down, queue it. The pending file can be flushed later via `/kc:learn --flush` or by a future scribe instance.
149
174
 
150
175
  ## Exit Expectations
151
176
 
152
- - All capture requests processed
153
- - Dedup catches reported to lead
154
- - Errors reported to lead
155
- - Ready for shutdown after closer completes
177
+ - All capture tasks marked complete
178
+ - Phase 3 confirmation DM sent to lead
179
+ - Dedup catches and errors reported to lead
180
+ - Ready for shutdown only after all capture tasks are complete
@@ -69,10 +69,11 @@ Near the end of Stage 2 (before the gap loop), DM lead with structured proposals
69
69
 
70
70
  ## Knowz-Scribe Integration
71
71
 
72
- If knowz-scribe is active, DM it with idea captures:
73
- > "Capture idea: {description}. Category: {Pattern|Decision|Convention}. Source: WorkGroup {wgid}."
72
+ If knowz-scribe is active, DM it with idea captures. Include enough detail for the scribe to write a rich vault entry — terse one-liners produce poor search results when stored in the vault.
74
73
 
75
- The scribe routes to the correct vault based on category.
74
+ > "Log: {Detailed description including the specific technology, component, and rationale — e.g. 'Discovered that the Express auth middleware should validate JWT clockTolerance=0 to prevent revoked tokens being accepted during the tolerance window. Affects src/middleware/auth.ts and all protected routes.'}. Category: {Pattern|Decision|Convention}. Source: WorkGroup {wgid}."
75
+
76
+ The scribe routes to the correct vault based on category. The more context you provide in the DM, the more useful the vault entry will be when retrieved via search months later.
76
77
 
77
78
  ## Enterprise Compliance (Optional)
78
79
 
@@ -88,9 +88,9 @@ Configure the KnowzCode MCP server using Claude Code's built-in MCP management.
88
88
  - Store parsed values for use in configuration
89
89
 
90
90
  2. **Check for existing configuration**
91
- - Check if MCP server already configured: `claude mcp get knowzcode`
91
+ - Check if MCP server already configured: `CLAUDECODE= claude mcp get knowz`
92
92
  - If already configured, ask if user wants to reconfigure
93
- - If yes, run `claude mcp remove knowzcode` first
93
+ - If yes, run `CLAUDECODE= claude mcp remove knowz` first
94
94
 
95
95
  3. **Prompt for API key (if not provided)**
96
96
  - If no API key in arguments, prompt user interactively:
@@ -308,14 +308,14 @@ Configure the KnowzCode MCP server using Claude Code's built-in MCP management.
308
308
  ```bash
309
309
  claude mcp add --transport http \
310
310
  --scope <chosen-scope> \
311
- knowzcode \
311
+ knowz \
312
312
  <endpoint-url> \
313
313
  --header "Authorization: Bearer <api-key>" \
314
314
  --header "X-Project-Path: $(pwd)"
315
315
  ```
316
316
 
317
317
  8. **Verify configuration**
318
- - Run: `claude mcp get knowzcode`
318
+ - Run: `CLAUDECODE= claude mcp get knowz`
319
319
  - Confirm server appears in the list
320
320
  - Check for any error messages
321
321
 
@@ -461,7 +461,7 @@ If using --dev environment, verify the dev server is running.
461
461
  To change from local to project scope:
462
462
  ```bash
463
463
  # Remove existing (or the command will prompt to reconfigure)
464
- claude mcp remove knowzcode
464
+ CLAUDECODE= claude mcp remove knowz
465
465
 
466
466
  # Re-add with new scope
467
467
  /kc:connect-mcp <api-key> --scope project
package/commands/learn.md CHANGED
@@ -182,6 +182,9 @@ Capture the provided insight to the appropriate vault using the MCP `create_know
182
182
  ```
183
183
 
184
184
  7. **Build learning content**
185
+
186
+ > Vault entries are retrieved via semantic search — content must be detailed and self-contained. See `knowzcode/knowzcode_vaults.md` Content Detail Principle.
187
+
185
188
  ```markdown
186
189
  [CONTEXT]
187
190
  Project: {project-name}
@@ -189,9 +192,11 @@ Capture the provided insight to the appropriate vault using the MCP `create_know
189
192
  Vault: {selected_vault_name}
190
193
  Source: {--source value or "KnowzCode /kc:learn command"}
191
194
  Date: {ISO timestamp}
195
+ Situation: {Expand on what prompted this learning — the problem being solved, the component involved, relevant technology stack. Provide enough background that someone unfamiliar with the project can understand.}
192
196
 
193
197
  [INSIGHT]
194
198
  {User's insight text}
199
+ Detail: {Expand the user's insight with technical specifics — include file paths, library names, version numbers, code patterns, or error messages that make this actionable when retrieved via search.}
195
200
 
196
201
  [SOURCE]
197
202
  Captured via /kc:learn command
@@ -202,7 +207,7 @@ Capture the provided insight to the appropriate vault using the MCP `create_know
202
207
  ```json
203
208
  create_knowledge({
204
209
  "content": "{formatted content}",
205
- "title": "{Category}: {Brief summary from insight}",
210
+ "title": "{Category}: {Descriptive summary include key technology names for search discoverability}",
206
211
  "knowledgeType": "Note",
207
212
  "vaultId": "{selected_vault_id}",
208
213
  "tags": ["{category}", "{extracted-tags}", "{project-name}"],
@@ -111,7 +111,7 @@ YOU USER
111
111
 
112
112
  1. Check if MCP server already configured:
113
113
  ```bash
114
- claude mcp get knowzcode
114
+ CLAUDECODE= claude mcp get knowz
115
115
  ```
116
116
 
117
117
  2. If already configured, display:
@@ -127,7 +127,7 @@ YOU USER
127
127
  ```
128
128
 
129
129
  Use AskUserQuestion to get user choice. If they choose to keep existing, STOP.
130
- If they choose to continue, run `claude mcp remove knowzcode` first.
130
+ If they choose to continue, run `CLAUDECODE= claude mcp remove knowz` first.
131
131
 
132
132
  3. If not configured: Continue to Step 2.
133
133
 
@@ -330,7 +330,7 @@ curl -X POST https://api.dev.knowz.io/api/v1/auth/register \
330
330
  # Production (default)
331
331
  claude mcp add --transport http \
332
332
  --scope <chosen-scope> \
333
- knowzcode \
333
+ knowz \
334
334
  https://mcp.knowz.io/mcp \
335
335
  --header "Authorization: Bearer <api_key>" \
336
336
  --header "X-Project-Path: $(pwd)"
@@ -338,7 +338,7 @@ curl -X POST https://api.dev.knowz.io/api/v1/auth/register \
338
338
  # Development (with --dev flag)
339
339
  claude mcp add --transport http \
340
340
  --scope <chosen-scope> \
341
- knowzcode \
341
+ knowz \
342
342
  https://mcp.dev.knowz.io/mcp \
343
343
  --header "Authorization: Bearer <api_key>" \
344
344
  --header "X-Project-Path: $(pwd)"
@@ -346,7 +346,7 @@ curl -X POST https://api.dev.knowz.io/api/v1/auth/register \
346
346
 
347
347
  5. **Verify MCP configuration**:
348
348
  ```bash
349
- claude mcp get knowzcode
349
+ CLAUDECODE= claude mcp get knowz
350
350
  ```
351
351
 
352
352
  6. **Configure vault in mcp_config.md**:
@@ -41,7 +41,7 @@ Check Agent Teams status, then check the KnowzCode MCP server status, and report
41
41
 
42
42
  2. **Check MCP server configuration**
43
43
  ```bash
44
- claude mcp get knowzcode
44
+ CLAUDECODE= claude mcp get knowz
45
45
  ```
46
46
 
47
47
  - If configured: Extract scope, endpoint, headers
package/commands/work.md CHANGED
@@ -313,7 +313,10 @@ When Parallel Teams mode is active, follow these 4 stages instead of spawning on
313
313
  3. **MCP Probe** — determine vault availability BEFORE spawning:
314
314
  a. Read `knowzcode/knowzcode_vaults.md` — partition entries into CONFIGURED (non-empty ID) and UNCREATED (empty ID)
315
315
  b. Call `list_vaults(includeStats=true)` **always** — regardless of whether any IDs exist in the file
316
- c. If `list_vaults()` fails → set `MCP_ACTIVE = false`, announce `**MCP Status: Not connected**`, skip to Step 4
316
+ c. If `list_vaults()` fails:
317
+ - Check if `knowzcode/knowzcode_vaults.md` has any CONFIGURED entries (non-empty ID)
318
+ - **If CONFIGURED entries exist**: Set `MCP_ACTIVE = true`, `VAULTS_CONFIGURED = true` — vault agents will verify connectivity independently via their Startup Verification. Announce `**MCP Status: Lead probe failed — delegating verification to vault agents**`. Proceed to Step 4.
319
+ - **If no CONFIGURED entries** (all empty IDs or no file): Set `MCP_ACTIVE = false`, announce `**MCP Status: Not connected**`, skip Group B spawn
317
320
  d. If `list_vaults()` succeeds AND UNCREATED list is non-empty → present the **Vault Creation Prompt**:
318
321
 
319
322
  ```markdown
@@ -536,11 +539,16 @@ When Parallel Teams mode is active, follow these 4 stages instead of spawning on
536
539
  - Write ARC-Completion log entry
537
540
  - Review architecture docs for discrepancies
538
541
  - Schedule REFACTOR tasks for tech debt
539
- - Send learnings to knowz-scribe (if active): `"Capture Phase 3: {wgid}"`. Knowz-scout remains available for vault queries during finalization.
542
+ - Create capture task for knowz-scribe (if active): `TaskCreate("Scribe: Capture Phase 3")` → `TaskUpdate(owner: "knowz-scribe")`, then send DM with task ID: `"Capture Phase 3: {wgid}. Your task: #{task-id}"`. Knowz-scout remains available for vault queries during finalization.
540
543
  - Create final atomic commit
541
544
  4. Lead presents completion summary
542
- 5. Shut down knowz-scout, knowz-scribe (after Phase 3 capture completes), closer, and all remaining agents
543
- 6. Delete team
545
+ 5. **Wait for scribe Phase 3 capture** (if knowz-scribe is active):
546
+ - Check scribe capture task via `TaskGet(task-id)` — wait until status is `completed`
547
+ - Also wait for scribe's Phase 3 confirmation DM
548
+ - **Timeout**: If >2 minutes after closer completes and scribe task still not complete → DM scribe: `"Status check: Phase 3 capture for {wgid}?"`
549
+ - **Hard timeout**: If another minute passes with no completion → proceed with shutdown and log `WARNING: Scribe Phase 3 capture did not complete for {wgid}. Vault writes may be incomplete.`
550
+ 6. Shutdown order: knowz-scout, knowz-scribe, closer, remaining agents
551
+ 7. Delete team
544
552
 
545
553
  ### WorkGroup File Format (Parallel Mode)
546
554
 
@@ -592,6 +600,10 @@ When creating tasks, model the dependency chain with `addBlockedBy` and pre-assi
592
600
  | Fix gaps: NodeID-X round N | Audit: NodeID-X (or re-audit N-1) | builder-N |
593
601
  | Re-audit: NodeID-X round N | Fix gaps round N | reviewer-N |
594
602
  | Phase 3 finalization | All audits approved | closer |
603
+ | Scribe: Capture Phase 1A | Phase 1A (gate approval) | knowz-scribe |
604
+ | Scribe: Capture Phase 2A | Implement: NodeID-X | knowz-scribe |
605
+ | Scribe: Capture Phase 2B | All audits approved | knowz-scribe |
606
+ | Scribe: Capture Phase 3 | Phase 3 finalization | knowz-scribe |
595
607
 
596
608
  ---
597
609
 
@@ -601,6 +613,20 @@ When creating tasks, model the dependency chain with `addBlockedBy` and pre-assi
601
613
 
602
614
  When using Sequential Teams (`--sequential`) or Subagent Delegation, follow the traditional one-agent-per-phase flow. For each phase below: spawn the agent, create a task, wait for completion, present quality gate, shut down agent, proceed to next phase.
603
615
 
616
+ ### MCP Probe (Sequential/Subagent)
617
+
618
+ Determine vault availability before Phase 1A:
619
+
620
+ 1. Read `knowzcode/knowzcode_vaults.md` — check for CONFIGURED entries (non-empty ID)
621
+ 2. Attempt `list_vaults(includeStats=true)`
622
+ 3. If succeeds AND UNCREATED entries exist → present the **Vault Creation Prompt** (same as Parallel Teams Step 3d). Handle selection identically.
623
+ 4. After resolution, announce MCP status to the user:
624
+ - `list_vaults()` succeeded: `**MCP Status: Connected — N vault(s) available**`
625
+ - `list_vaults()` failed but configured vaults exist: `**MCP Status: Lead probe failed — closer will verify at Phase 3**`
626
+ - No configured vaults: `**MCP Status: Not configured**`
627
+
628
+ The closer agent independently verifies MCP at Phase 3 regardless of this result (see `agents/closer.md` — Startup MCP Verification). This probe is for the user announcement and vault creation opportunity only.
629
+
604
630
  ---
605
631
 
606
632
  ## Phase Prompt Reference
@@ -743,7 +769,7 @@ Two temporary agents that scan the codebase in parallel with the analyst, broadc
743
769
  **Dispatch**:
744
770
  - *Parallel Teams*: **Group B** — spawned at Stage 0 if `VAULTS_CONFIGURED = true`, no blockedBy. Persistent — stays alive through the entire workflow. Shut down after Phase 3 capture is complete.
745
771
  - *Sequential Teams*: Not applicable (knowz-scribe is Parallel Teams only).
746
- - *Subagent*: Not applicable — vault writes in subagent mode are handled inline by the lead.
772
+ - *Subagent*: Not applicable — vault writes in subagent mode are handled by the closer during Phase 3 finalization (see Direct Write Fallback in `agents/closer.md`).
747
773
 
748
774
  ---
749
775
 
@@ -855,7 +881,8 @@ If `AUTONOMOUS_MODE = false`: If rejected — re-run analyst with user feedback.
855
881
  ### MCP Learning Capture (Optional)
856
882
 
857
883
  If MCP is configured and knowz-scribe is active, after Change Set approval:
858
- - Send message to **knowz-scribe**: `"Capture Phase 1A: {wgid}"` the scribe reads the WorkGroup file, extracts scope/risk/decision data, and writes to the appropriate vault
884
+ - Create capture task: `TaskCreate("Scribe: Capture Phase 1A")` `TaskUpdate(owner: "knowz-scribe")`
885
+ - Send message to **knowz-scribe** with task ID: `"Capture Phase 1A: {wgid}. Your task: #{task-id}"` — the scribe reads the WorkGroup file, extracts scope/risk/decision data, and writes to the appropriate vault
859
886
  - `search_knowledge({resolved_domain_vault_id}, "patterns for {domain}")` — pull relevant past learnings to inform specification
860
887
  - Share any relevant findings with the architect in the Phase 1B prompt
861
888
 
@@ -988,7 +1015,8 @@ When complete, present implementation summary including files changed, tests wri
988
1015
  ### MCP Learning Capture (Optional)
989
1016
 
990
1017
  If MCP is configured and knowz-scribe is active, after implementation completes:
991
- - Send message to **knowz-scribe**: `"Capture Phase 2A: {wgid}"` the scribe reads implementation results from the WorkGroup file and captures patterns, workarounds, and performance optimizations to the `code` vault
1018
+ - Create capture task: `TaskCreate("Scribe: Capture Phase 2A")` `TaskUpdate(owner: "knowz-scribe")`
1019
+ - Send message to **knowz-scribe** with task ID: `"Capture Phase 2A: {wgid}. Your task: #{task-id}"` — the scribe reads implementation results from the WorkGroup file and captures patterns, workarounds, and performance optimizations to the `code` vault
992
1020
 
993
1021
  ---
994
1022
 
@@ -1069,7 +1097,8 @@ If `AUTONOMOUS_MODE = false`: User decides — proceed / fix gaps / modify specs
1069
1097
  ### MCP Learning Capture (Optional)
1070
1098
 
1071
1099
  If MCP is configured and knowz-scribe is active, after audit approval:
1072
- - Send message to **knowz-scribe**: `"Capture Phase 2B: {wgid}"` the scribe reads audit results from the WorkGroup file and writes findings to the appropriate vault
1100
+ - Create capture task: `TaskCreate("Scribe: Capture Phase 2B")` `TaskUpdate(owner: "knowz-scribe")`
1101
+ - Send message to **knowz-scribe** with task ID: `"Capture Phase 2B: {wgid}. Your task: #{task-id}"` — the scribe reads audit results from the WorkGroup file and writes findings to the appropriate vault
1073
1102
 
1074
1103
  ---
1075
1104
 
@@ -1077,7 +1106,7 @@ If MCP is configured and knowz-scribe is active, after audit approval:
1077
1106
 
1078
1107
  **Agent**: `closer` | **Loop.md**: Section 3.5
1079
1108
 
1080
- **Spawn prompt**:
1109
+ **Spawn prompt (Parallel Teams)**:
1081
1110
  > You are the **closer** for WorkGroup `{wgid}`.
1082
1111
  > Read `agents/closer.md` for your full role definition.
1083
1112
  >
@@ -1089,18 +1118,33 @@ If MCP is configured and knowz-scribe is active, after audit approval:
1089
1118
  >
1090
1119
  > **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
1091
1120
  > **Conventions**: Update WorkGroup file with results (prefix entries with `KnowzCode:`). If blocked, report blocker and notify lead.
1092
- > **Vault writes**: If knowz-scribe is active, send it `"Capture Phase 3: {wgid}"` to delegate learning capture and audit trail writes. Do NOT call `create_knowledge` directly.
1121
+ > **Vault writes**: Knowz-scribe is active. Create a capture task (`TaskCreate("Scribe: Capture Phase 3")` → `TaskUpdate(owner: "knowz-scribe")`), then send `"Capture Phase 3: {wgid}. Your task: #{task-id}"` to delegate learning capture and audit trail writes. Do NOT call `create_knowledge` directly.
1093
1122
  > **Deliverable**: Atomic finalization — update specs to FINAL, update tracker, write log entry, update architecture if needed, delegate learning capture to knowz-scribe, and create final commit.
1094
1123
 
1124
+ **Spawn prompt (Sequential Teams / Subagent)**:
1125
+ > You are the **closer** for WorkGroup `{wgid}`.
1126
+ > Read `agents/closer.md` for your full role definition.
1127
+ >
1128
+ > **Goal**: {goal}
1129
+ > **Change Set**: {NodeIDs}
1130
+ > **Specs**: {list of spec file paths}
1131
+ > **Context files**: Read sections 1-2, 3.5, 6, and 7 of `knowzcode/knowzcode_loop.md` (skip other phases), `knowzcode/knowzcode_tracker.md`, `knowzcode/knowzcode_project.md`, `knowzcode/knowzcode_architecture.md`, `knowzcode/knowzcode_log.md`
1132
+ > **WorkGroup file**: `knowzcode/workgroups/{wgid}.md`
1133
+ >
1134
+ > **Your Task**: #{task-id} — claim immediately (`TaskUpdate(status: "in_progress")`). Mark completed with summary when done.
1135
+ > **Conventions**: Update WorkGroup file with results (prefix entries with `KnowzCode:`). If blocked, report blocker and notify lead.
1136
+ > **Vault writes**: No knowz-scribe — you own all vault writes. Follow the Direct Write Fallback in `agents/closer.md`.
1137
+ > **Deliverable**: Atomic finalization — update specs to FINAL, update tracker, write log entry, update architecture if needed, write learnings to vaults, and create final commit.
1138
+
1095
1139
  **Dispatch**:
1096
- - *Parallel Teams*: Spawned at Stage 3 (`addBlockedBy`: last audit/re-audit task). All other agents shut down before closer starts, except knowz-scout and knowz-scribe (stay alive for Phase 3 capture).
1097
- - *Sequential Teams*: Spawn teammate `closer`, create task `Phase 3: Finalize WorkGroup {wgid}`, wait for completion.
1098
- - *Subagent*: `Task(subagent_type="closer", description="Phase 3 finalization", prompt=<above>)`
1140
+ - *Parallel Teams*: Spawned at Stage 3 (`addBlockedBy`: last audit/re-audit task). Use the **Parallel Teams** spawn prompt. All other agents shut down before closer starts, except knowz-scout and knowz-scribe (stay alive for Phase 3 capture).
1141
+ - *Sequential Teams*: Spawn teammate `closer`, create task `Phase 3: Finalize WorkGroup {wgid}`, wait for completion. Use the **Sequential Teams / Subagent** spawn prompt.
1142
+ - *Subagent*: `Task(subagent_type="closer", description="Phase 3 finalization", prompt=<Sequential/Subagent spawn prompt above>)`
1099
1143
 
1100
1144
  ### Phase 3 Output
1101
1145
 
1102
1146
  When complete, if MCP is configured and knowz-scribe is active:
1103
- - The closer sends a message to **knowz-scribe**: `"Capture Phase 3: {wgid}"` the scribe reads the WorkGroup file, extracts learnings, decisions, and outcomes, and writes to the appropriate vaults
1147
+ - The closer creates a capture task (`TaskCreate("Scribe: Capture Phase 3")` → `TaskUpdate(owner: "knowz-scribe")`) and sends a message with the task ID: `"Capture Phase 3: {wgid}. Your task: #{task-id}"`. The lead waits for the scribe's capture task to complete before shutdown.
1104
1148
 
1105
1149
  Update workgroup to "Closed" and report:
1106
1150