knowzcode 0.4.0 → 0.5.2
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 +379 -354
- package/agents/analyst.md +114 -114
- package/agents/architect.md +200 -200
- package/agents/builder.md +104 -104
- package/agents/closer.md +177 -177
- 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 +1457 -1199
- package/commands/audit.md +328 -328
- package/commands/connect-mcp.md +574 -549
- package/commands/fix.md +107 -107
- package/commands/init.md +616 -500
- package/commands/learn.md +332 -332
- package/commands/plan.md +272 -272
- package/commands/register.md +757 -733
- package/commands/status.md +338 -309
- package/commands/telemetry-setup.md +368 -368
- package/commands/telemetry.md +188 -188
- package/commands/work.md +1204 -1204
- package/knowzcode/automation_manifest.md +59 -59
- package/knowzcode/claude_code_execution.md +431 -431
- 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 +601 -596
- 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 +196 -191
- package/knowzcode/planning/Readme.md +6 -6
- package/knowzcode/platform_adapters.md +2577 -1260
- 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
|
@@ -1,301 +1,301 @@
|
|
|
1
|
-
# KnowzCode: Migrate Knowledge
|
|
2
|
-
|
|
3
|
-
**Sources:** [List of source paths, patterns, or text]
|
|
4
|
-
**Format Override:** [auto|kc-v1|noderr|generic]
|
|
5
|
-
**Mode:** [normal|dry-run]
|
|
6
|
-
**Conflict Strategy:** [merge|overwrite|prompt]
|
|
7
|
-
|
|
8
|
-
> **Automation Path:** Invoke the `knowledge-migrator` agent for streamlined migration.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Your Mission
|
|
13
|
-
|
|
14
|
-
You have been instructed to migrate external knowledge into KnowzCode spec format. This protocol handles legacy KnowzCode (v1.x), Noderr output, and generic markdown analysis.
|
|
15
|
-
|
|
16
|
-
**CRITICAL RULE: Preserve valuable information.** Never discard content that might be useful. When in doubt, include it with appropriate markers for later review.
|
|
17
|
-
|
|
18
|
-
**Reference:** Your actions are governed by the spec template in `knowzcode/knowzcode_loop.md`.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Extraction Rules by Format
|
|
23
|
-
|
|
24
|
-
### KnowzCode v1.x
|
|
25
|
-
|
|
26
|
-
**Detection Markers:**
|
|
27
|
-
```
|
|
28
|
-
## Node Specification:
|
|
29
|
-
**NodeID:** {value}
|
|
30
|
-
## ARC Criteria
|
|
31
|
-
**Type:** Component|UseCase
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**Field Mapping:**
|
|
35
|
-
|
|
36
|
-
| v1.x Field | KnowzCode Section |
|
|
37
|
-
|------------|--------------|
|
|
38
|
-
| `**NodeID:**` | Filename (knowzcode/specs/{NodeID}.md) |
|
|
39
|
-
| `## Purpose` / `## Overview` | Rules & Decisions |
|
|
40
|
-
| `## Dependencies` | Rules & Decisions (convert to bullet list with context) |
|
|
41
|
-
| `## Interfaces` / `## API` | Interfaces |
|
|
42
|
-
| `## Implementation` / `## Logic` | Rules & Decisions |
|
|
43
|
-
| `## Data` / `## Models` | Interfaces (as contracts) |
|
|
44
|
-
| `## ARC Criteria` / `## Verification` | Verification Criteria (VERIFY: format) |
|
|
45
|
-
| `## Tech Debt` / `## Issues` | Debt & Gaps |
|
|
46
|
-
|
|
47
|
-
**Transformation Rules:**
|
|
48
|
-
1. Convert bullet lists to markdown tables where appropriate
|
|
49
|
-
2. Preserve code blocks exactly as-is
|
|
50
|
-
3. Update date fields to current timestamp
|
|
51
|
-
4. Add `[MIGRATED]` marker to Tech Debt section
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
### Noderr Format
|
|
56
|
-
|
|
57
|
-
**Detection Markers:**
|
|
58
|
-
```
|
|
59
|
-
## Component: {name}
|
|
60
|
-
## Service: {name}
|
|
61
|
-
### Dependencies
|
|
62
|
-
{
|
|
63
|
-
"type": "component|service",
|
|
64
|
-
"name": "...",
|
|
65
|
-
"dependencies": [...]
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Field Mapping:**
|
|
70
|
-
|
|
71
|
-
| Noderr Field | KnowzCode Section |
|
|
72
|
-
|--------------|--------------|
|
|
73
|
-
| `name` / `## Component:` | NodeID (with prefix inference) |
|
|
74
|
-
| First paragraph / `description` | Rules & Decisions |
|
|
75
|
-
| `dependencies` / `### Dependencies` | Rules & Decisions (as context bullets) |
|
|
76
|
-
| `inputs` / `## Inputs` | Interfaces → Inputs |
|
|
77
|
-
| `outputs` / `## Outputs` | Interfaces → Outputs |
|
|
78
|
-
| `logic` / `## Process` | Rules & Decisions |
|
|
79
|
-
| `schema` / `## Data` | Interfaces (as contracts) |
|
|
80
|
-
| — | Verification Criteria (VERIFY: format, generate placeholders) |
|
|
81
|
-
| `issues` / `## Known Issues` | Debt & Gaps |
|
|
82
|
-
|
|
83
|
-
**NodeID Prefix Inference from Noderr:**
|
|
84
|
-
|
|
85
|
-
| Noderr Type | Inferred Prefix |
|
|
86
|
-
|-------------|-----------------|
|
|
87
|
-
| `component` with `ui` in name/path | `UI_` |
|
|
88
|
-
| `component` otherwise | `SVC_` |
|
|
89
|
-
| `service` | `SVC_` |
|
|
90
|
-
| `api` / `endpoint` | `API_` |
|
|
91
|
-
| `model` / `data` | `DB_` |
|
|
92
|
-
| `utility` / `helper` | `LIB_` |
|
|
93
|
-
| `config` | `CONFIG_` |
|
|
94
|
-
| `flow` / `workflow` | `UC_` |
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
### Generic Markdown
|
|
99
|
-
|
|
100
|
-
**Detection:** Fallback when no specific format markers found.
|
|
101
|
-
|
|
102
|
-
**Entity Extraction Heuristics:**
|
|
103
|
-
|
|
104
|
-
1. **Component Names** (scan for):
|
|
105
|
-
- Capitalized multi-word phrases in headers: `## User Authentication`
|
|
106
|
-
- Capitalized references in body: "The `AuthService` handles..."
|
|
107
|
-
- Function/class references: `class UserManager`, `function handleLogin`
|
|
108
|
-
|
|
109
|
-
2. **Relationships** (scan for patterns):
|
|
110
|
-
- "X depends on Y" → Dependency
|
|
111
|
-
- "X calls Y" → Dependency
|
|
112
|
-
- "X uses Y" → Dependency
|
|
113
|
-
- "X is responsible for Y" → Purpose description
|
|
114
|
-
- "X handles Y" → Purpose description
|
|
115
|
-
- "X returns Y" → Output interface
|
|
116
|
-
|
|
117
|
-
3. **Type Inference** (from keywords):
|
|
118
|
-
|
|
119
|
-
| Keywords in Context | Inferred Type |
|
|
120
|
-
|---------------------|---------------|
|
|
121
|
-
| button, form, component, page, modal, dialog | `UI_` |
|
|
122
|
-
| endpoint, route, REST, GraphQL, API | `API_` |
|
|
123
|
-
| service, handler, processor, worker, manager | `SVC_` |
|
|
124
|
-
| model, schema, table, entity, record | `DB_` |
|
|
125
|
-
| util, helper, lib, format, parse, validate | `LIB_` |
|
|
126
|
-
| config, settings, env, options | `CONFIG_` |
|
|
127
|
-
| flow, journey, process, workflow, use case | `UC_` |
|
|
128
|
-
|
|
129
|
-
4. **ARC Criteria Generation** (when not present):
|
|
130
|
-
- Generate 3-5 testable criteria based on extracted purpose
|
|
131
|
-
- Format: "[ ] {Action verb} {expected behavior}"
|
|
132
|
-
- Examples:
|
|
133
|
-
- "[ ] Returns valid JWT token on successful authentication"
|
|
134
|
-
- "[ ] Displays error message when validation fails"
|
|
135
|
-
- "[ ] Persists data to database within 100ms"
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Consolidation Decision Tree
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
FOR EACH extracted NodeID:
|
|
143
|
-
│
|
|
144
|
-
├─► Does knowzcode/specs/{NodeID}.md exist?
|
|
145
|
-
│ │
|
|
146
|
-
│ ├─► NO: Create new spec
|
|
147
|
-
│ │
|
|
148
|
-
│ └─► YES: Compare content
|
|
149
|
-
│ │
|
|
150
|
-
│ ├─► Identical? → Skip (log: "already up-to-date")
|
|
151
|
-
│ │
|
|
152
|
-
│ ├─► Existing is SUBSET of new? → Merge (add new sections)
|
|
153
|
-
│ │
|
|
154
|
-
│ ├─► New is SUBSET of existing? → Skip (log: "existing is more complete")
|
|
155
|
-
│ │
|
|
156
|
-
│ └─► Divergent content?
|
|
157
|
-
│ │
|
|
158
|
-
│ ├─► Strategy = merge → Merge with [MIGRATED] markers
|
|
159
|
-
│ │
|
|
160
|
-
│ ├─► Strategy = overwrite → Replace entirely
|
|
161
|
-
│ │
|
|
162
|
-
│ └─► Strategy = prompt → Ask user
|
|
163
|
-
│ │
|
|
164
|
-
│ ├─► User: "merge" → Merge with markers
|
|
165
|
-
│ ├─► User: "overwrite" → Replace
|
|
166
|
-
│ ├─► User: "skip" → Skip this NodeID
|
|
167
|
-
│ └─► User: "abort" → Stop migration
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Spec Completeness Assessment
|
|
173
|
-
|
|
174
|
-
Before merging, assess completeness of both sources:
|
|
175
|
-
|
|
176
|
-
| Section | Weight | Complete If |
|
|
177
|
-
|---------|--------|-------------|
|
|
178
|
-
| Rules & Decisions | 35 | >150 characters, includes purpose, key decisions, or constraints |
|
|
179
|
-
| Interfaces | 25 | Inputs/Outputs defined OR dependency context provided |
|
|
180
|
-
| Verification Criteria | 25 | At least 3 VERIFY: statements present |
|
|
181
|
-
| Debt & Gaps | 15 | Any content present |
|
|
182
|
-
|
|
183
|
-
**Score Calculation:**
|
|
184
|
-
- Sum weights of complete sections
|
|
185
|
-
- Score 0-100
|
|
186
|
-
|
|
187
|
-
**Comparison:**
|
|
188
|
-
- `new_score > existing_score + 10` → New is significantly better
|
|
189
|
-
- `existing_score > new_score + 10` → Existing is significantly better
|
|
190
|
-
- Otherwise → Comparable, merge recommended
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## Template Application Instructions
|
|
195
|
-
|
|
196
|
-
When generating a spec, follow this exact structure:
|
|
197
|
-
|
|
198
|
-
```markdown
|
|
199
|
-
# {NodeID}: {Human-Readable Name}
|
|
200
|
-
|
|
201
|
-
**Updated:** {timestamp}
|
|
202
|
-
**Status:** Migrated
|
|
203
|
-
**Migrated From:** {source_path} ({source_format} format)
|
|
204
|
-
|
|
205
|
-
## Rules & Decisions
|
|
206
|
-
- [Extracted purpose, constraints, and key decisions from source]
|
|
207
|
-
- [Dependencies context: "Requires X for Y functionality"]
|
|
208
|
-
- [Implementation rules: "Must use pattern X because Y"]
|
|
209
|
-
- [Migrated from: {source_path} ({source_format} format)]
|
|
210
|
-
|
|
211
|
-
## Interfaces
|
|
212
|
-
**Inputs:**
|
|
213
|
-
- [Extracted inputs OR "Inputs to be documented"]
|
|
214
|
-
|
|
215
|
-
**Outputs:**
|
|
216
|
-
- [Extracted outputs OR "Outputs to be documented"]
|
|
217
|
-
|
|
218
|
-
**Dependencies:**
|
|
219
|
-
- [Extracted dependencies with context OR "Dependencies to be documented"]
|
|
220
|
-
|
|
221
|
-
{Preserve any code blocks from source showing API contracts or data structures}
|
|
222
|
-
|
|
223
|
-
## Verification Criteria
|
|
224
|
-
- VERIFY: [Testable assertion extracted or inferred from source]
|
|
225
|
-
- VERIFY: [Testable assertion extracted or inferred from source]
|
|
226
|
-
- VERIFY: [Testable assertion extracted or inferred from source]
|
|
227
|
-
|
|
228
|
-
{If no criteria extracted, generate 3-5 placeholders based on purpose:}
|
|
229
|
-
- VERIFY: Component initializes without errors
|
|
230
|
-
- VERIFY: Primary function executes successfully
|
|
231
|
-
- VERIFY: Error handling covers edge cases
|
|
232
|
-
|
|
233
|
-
## Debt & Gaps
|
|
234
|
-
- TODO: Review migrated spec for accuracy
|
|
235
|
-
- TODO: Verify all extracted information matches current codebase
|
|
236
|
-
- [MIGRATED] Migrated from {format} format on {date}
|
|
237
|
-
|
|
238
|
-
{Any additional extracted tech debt items}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## Output Artifacts
|
|
244
|
-
|
|
245
|
-
### 1. Specs (unless dry-run)
|
|
246
|
-
Location: `knowzcode/specs/{NodeID}.md`
|
|
247
|
-
|
|
248
|
-
### 2. Migration Report
|
|
249
|
-
Location: `knowzcode/planning/migration-{YYYYMMDD-HHMMSS}.md`
|
|
250
|
-
|
|
251
|
-
Content:
|
|
252
|
-
- Summary statistics
|
|
253
|
-
- Full NodeID extraction table
|
|
254
|
-
- Conflict resolution log
|
|
255
|
-
- Warnings and issues
|
|
256
|
-
- Next steps checklist
|
|
257
|
-
|
|
258
|
-
### 3. Log Entry (unless dry-run)
|
|
259
|
-
Location: `knowzcode/knowzcode_log.md` (prepend)
|
|
260
|
-
|
|
261
|
-
Format:
|
|
262
|
-
```markdown
|
|
263
|
-
---
|
|
264
|
-
**Type:** Migration
|
|
265
|
-
**Timestamp:** {timestamp}
|
|
266
|
-
**NodeID(s):** {comma-separated}
|
|
267
|
-
**Logged By:** knowledge-migrator
|
|
268
|
-
**Details:**
|
|
269
|
-
- **Sources:** {count} processed
|
|
270
|
-
- **Format:** {format(s)}
|
|
271
|
-
- **Created:** {n} specs
|
|
272
|
-
- **Updated:** {n} specs
|
|
273
|
-
- **Report:** {report_path}
|
|
274
|
-
---
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
## Final Report Format
|
|
280
|
-
|
|
281
|
-
After completing migration:
|
|
282
|
-
|
|
283
|
-
```markdown
|
|
284
|
-
✓ Migration completed.
|
|
285
|
-
|
|
286
|
-
**Summary:**
|
|
287
|
-
- Sources: {n} files processed
|
|
288
|
-
- Format: {detected format(s)}
|
|
289
|
-
- Created: {n} new specs
|
|
290
|
-
- Updated: {n} existing specs
|
|
291
|
-
- Skipped: {n} (already complete or identical)
|
|
292
|
-
|
|
293
|
-
**Report:** knowzcode/planning/migration-{timestamp}.md
|
|
294
|
-
|
|
295
|
-
**Next Steps:**
|
|
296
|
-
1. Review migrated specs for accuracy
|
|
297
|
-
2. Run a spec audit to validate completeness
|
|
298
|
-
3. Update any `[NEEDS_REVIEW]` markers
|
|
299
|
-
|
|
300
|
-
Awaiting next goal.
|
|
301
|
-
```
|
|
1
|
+
# KnowzCode: Migrate Knowledge
|
|
2
|
+
|
|
3
|
+
**Sources:** [List of source paths, patterns, or text]
|
|
4
|
+
**Format Override:** [auto|kc-v1|noderr|generic]
|
|
5
|
+
**Mode:** [normal|dry-run]
|
|
6
|
+
**Conflict Strategy:** [merge|overwrite|prompt]
|
|
7
|
+
|
|
8
|
+
> **Automation Path:** Invoke the `knowledge-migrator` agent for streamlined migration.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Your Mission
|
|
13
|
+
|
|
14
|
+
You have been instructed to migrate external knowledge into KnowzCode spec format. This protocol handles legacy KnowzCode (v1.x), Noderr output, and generic markdown analysis.
|
|
15
|
+
|
|
16
|
+
**CRITICAL RULE: Preserve valuable information.** Never discard content that might be useful. When in doubt, include it with appropriate markers for later review.
|
|
17
|
+
|
|
18
|
+
**Reference:** Your actions are governed by the spec template in `knowzcode/knowzcode_loop.md`.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Extraction Rules by Format
|
|
23
|
+
|
|
24
|
+
### KnowzCode v1.x
|
|
25
|
+
|
|
26
|
+
**Detection Markers:**
|
|
27
|
+
```
|
|
28
|
+
## Node Specification:
|
|
29
|
+
**NodeID:** {value}
|
|
30
|
+
## ARC Criteria
|
|
31
|
+
**Type:** Component|UseCase
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Field Mapping:**
|
|
35
|
+
|
|
36
|
+
| v1.x Field | KnowzCode Section |
|
|
37
|
+
|------------|--------------|
|
|
38
|
+
| `**NodeID:**` | Filename (knowzcode/specs/{NodeID}.md) |
|
|
39
|
+
| `## Purpose` / `## Overview` | Rules & Decisions |
|
|
40
|
+
| `## Dependencies` | Rules & Decisions (convert to bullet list with context) |
|
|
41
|
+
| `## Interfaces` / `## API` | Interfaces |
|
|
42
|
+
| `## Implementation` / `## Logic` | Rules & Decisions |
|
|
43
|
+
| `## Data` / `## Models` | Interfaces (as contracts) |
|
|
44
|
+
| `## ARC Criteria` / `## Verification` | Verification Criteria (VERIFY: format) |
|
|
45
|
+
| `## Tech Debt` / `## Issues` | Debt & Gaps |
|
|
46
|
+
|
|
47
|
+
**Transformation Rules:**
|
|
48
|
+
1. Convert bullet lists to markdown tables where appropriate
|
|
49
|
+
2. Preserve code blocks exactly as-is
|
|
50
|
+
3. Update date fields to current timestamp
|
|
51
|
+
4. Add `[MIGRATED]` marker to Tech Debt section
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### Noderr Format
|
|
56
|
+
|
|
57
|
+
**Detection Markers:**
|
|
58
|
+
```
|
|
59
|
+
## Component: {name}
|
|
60
|
+
## Service: {name}
|
|
61
|
+
### Dependencies
|
|
62
|
+
{
|
|
63
|
+
"type": "component|service",
|
|
64
|
+
"name": "...",
|
|
65
|
+
"dependencies": [...]
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Field Mapping:**
|
|
70
|
+
|
|
71
|
+
| Noderr Field | KnowzCode Section |
|
|
72
|
+
|--------------|--------------|
|
|
73
|
+
| `name` / `## Component:` | NodeID (with prefix inference) |
|
|
74
|
+
| First paragraph / `description` | Rules & Decisions |
|
|
75
|
+
| `dependencies` / `### Dependencies` | Rules & Decisions (as context bullets) |
|
|
76
|
+
| `inputs` / `## Inputs` | Interfaces → Inputs |
|
|
77
|
+
| `outputs` / `## Outputs` | Interfaces → Outputs |
|
|
78
|
+
| `logic` / `## Process` | Rules & Decisions |
|
|
79
|
+
| `schema` / `## Data` | Interfaces (as contracts) |
|
|
80
|
+
| — | Verification Criteria (VERIFY: format, generate placeholders) |
|
|
81
|
+
| `issues` / `## Known Issues` | Debt & Gaps |
|
|
82
|
+
|
|
83
|
+
**NodeID Prefix Inference from Noderr:**
|
|
84
|
+
|
|
85
|
+
| Noderr Type | Inferred Prefix |
|
|
86
|
+
|-------------|-----------------|
|
|
87
|
+
| `component` with `ui` in name/path | `UI_` |
|
|
88
|
+
| `component` otherwise | `SVC_` |
|
|
89
|
+
| `service` | `SVC_` |
|
|
90
|
+
| `api` / `endpoint` | `API_` |
|
|
91
|
+
| `model` / `data` | `DB_` |
|
|
92
|
+
| `utility` / `helper` | `LIB_` |
|
|
93
|
+
| `config` | `CONFIG_` |
|
|
94
|
+
| `flow` / `workflow` | `UC_` |
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### Generic Markdown
|
|
99
|
+
|
|
100
|
+
**Detection:** Fallback when no specific format markers found.
|
|
101
|
+
|
|
102
|
+
**Entity Extraction Heuristics:**
|
|
103
|
+
|
|
104
|
+
1. **Component Names** (scan for):
|
|
105
|
+
- Capitalized multi-word phrases in headers: `## User Authentication`
|
|
106
|
+
- Capitalized references in body: "The `AuthService` handles..."
|
|
107
|
+
- Function/class references: `class UserManager`, `function handleLogin`
|
|
108
|
+
|
|
109
|
+
2. **Relationships** (scan for patterns):
|
|
110
|
+
- "X depends on Y" → Dependency
|
|
111
|
+
- "X calls Y" → Dependency
|
|
112
|
+
- "X uses Y" → Dependency
|
|
113
|
+
- "X is responsible for Y" → Purpose description
|
|
114
|
+
- "X handles Y" → Purpose description
|
|
115
|
+
- "X returns Y" → Output interface
|
|
116
|
+
|
|
117
|
+
3. **Type Inference** (from keywords):
|
|
118
|
+
|
|
119
|
+
| Keywords in Context | Inferred Type |
|
|
120
|
+
|---------------------|---------------|
|
|
121
|
+
| button, form, component, page, modal, dialog | `UI_` |
|
|
122
|
+
| endpoint, route, REST, GraphQL, API | `API_` |
|
|
123
|
+
| service, handler, processor, worker, manager | `SVC_` |
|
|
124
|
+
| model, schema, table, entity, record | `DB_` |
|
|
125
|
+
| util, helper, lib, format, parse, validate | `LIB_` |
|
|
126
|
+
| config, settings, env, options | `CONFIG_` |
|
|
127
|
+
| flow, journey, process, workflow, use case | `UC_` |
|
|
128
|
+
|
|
129
|
+
4. **ARC Criteria Generation** (when not present):
|
|
130
|
+
- Generate 3-5 testable criteria based on extracted purpose
|
|
131
|
+
- Format: "[ ] {Action verb} {expected behavior}"
|
|
132
|
+
- Examples:
|
|
133
|
+
- "[ ] Returns valid JWT token on successful authentication"
|
|
134
|
+
- "[ ] Displays error message when validation fails"
|
|
135
|
+
- "[ ] Persists data to database within 100ms"
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Consolidation Decision Tree
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
FOR EACH extracted NodeID:
|
|
143
|
+
│
|
|
144
|
+
├─► Does knowzcode/specs/{NodeID}.md exist?
|
|
145
|
+
│ │
|
|
146
|
+
│ ├─► NO: Create new spec
|
|
147
|
+
│ │
|
|
148
|
+
│ └─► YES: Compare content
|
|
149
|
+
│ │
|
|
150
|
+
│ ├─► Identical? → Skip (log: "already up-to-date")
|
|
151
|
+
│ │
|
|
152
|
+
│ ├─► Existing is SUBSET of new? → Merge (add new sections)
|
|
153
|
+
│ │
|
|
154
|
+
│ ├─► New is SUBSET of existing? → Skip (log: "existing is more complete")
|
|
155
|
+
│ │
|
|
156
|
+
│ └─► Divergent content?
|
|
157
|
+
│ │
|
|
158
|
+
│ ├─► Strategy = merge → Merge with [MIGRATED] markers
|
|
159
|
+
│ │
|
|
160
|
+
│ ├─► Strategy = overwrite → Replace entirely
|
|
161
|
+
│ │
|
|
162
|
+
│ └─► Strategy = prompt → Ask user
|
|
163
|
+
│ │
|
|
164
|
+
│ ├─► User: "merge" → Merge with markers
|
|
165
|
+
│ ├─► User: "overwrite" → Replace
|
|
166
|
+
│ ├─► User: "skip" → Skip this NodeID
|
|
167
|
+
│ └─► User: "abort" → Stop migration
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Spec Completeness Assessment
|
|
173
|
+
|
|
174
|
+
Before merging, assess completeness of both sources:
|
|
175
|
+
|
|
176
|
+
| Section | Weight | Complete If |
|
|
177
|
+
|---------|--------|-------------|
|
|
178
|
+
| Rules & Decisions | 35 | >150 characters, includes purpose, key decisions, or constraints |
|
|
179
|
+
| Interfaces | 25 | Inputs/Outputs defined OR dependency context provided |
|
|
180
|
+
| Verification Criteria | 25 | At least 3 VERIFY: statements present |
|
|
181
|
+
| Debt & Gaps | 15 | Any content present |
|
|
182
|
+
|
|
183
|
+
**Score Calculation:**
|
|
184
|
+
- Sum weights of complete sections
|
|
185
|
+
- Score 0-100
|
|
186
|
+
|
|
187
|
+
**Comparison:**
|
|
188
|
+
- `new_score > existing_score + 10` → New is significantly better
|
|
189
|
+
- `existing_score > new_score + 10` → Existing is significantly better
|
|
190
|
+
- Otherwise → Comparable, merge recommended
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Template Application Instructions
|
|
195
|
+
|
|
196
|
+
When generating a spec, follow this exact structure:
|
|
197
|
+
|
|
198
|
+
```markdown
|
|
199
|
+
# {NodeID}: {Human-Readable Name}
|
|
200
|
+
|
|
201
|
+
**Updated:** {timestamp}
|
|
202
|
+
**Status:** Migrated
|
|
203
|
+
**Migrated From:** {source_path} ({source_format} format)
|
|
204
|
+
|
|
205
|
+
## Rules & Decisions
|
|
206
|
+
- [Extracted purpose, constraints, and key decisions from source]
|
|
207
|
+
- [Dependencies context: "Requires X for Y functionality"]
|
|
208
|
+
- [Implementation rules: "Must use pattern X because Y"]
|
|
209
|
+
- [Migrated from: {source_path} ({source_format} format)]
|
|
210
|
+
|
|
211
|
+
## Interfaces
|
|
212
|
+
**Inputs:**
|
|
213
|
+
- [Extracted inputs OR "Inputs to be documented"]
|
|
214
|
+
|
|
215
|
+
**Outputs:**
|
|
216
|
+
- [Extracted outputs OR "Outputs to be documented"]
|
|
217
|
+
|
|
218
|
+
**Dependencies:**
|
|
219
|
+
- [Extracted dependencies with context OR "Dependencies to be documented"]
|
|
220
|
+
|
|
221
|
+
{Preserve any code blocks from source showing API contracts or data structures}
|
|
222
|
+
|
|
223
|
+
## Verification Criteria
|
|
224
|
+
- VERIFY: [Testable assertion extracted or inferred from source]
|
|
225
|
+
- VERIFY: [Testable assertion extracted or inferred from source]
|
|
226
|
+
- VERIFY: [Testable assertion extracted or inferred from source]
|
|
227
|
+
|
|
228
|
+
{If no criteria extracted, generate 3-5 placeholders based on purpose:}
|
|
229
|
+
- VERIFY: Component initializes without errors
|
|
230
|
+
- VERIFY: Primary function executes successfully
|
|
231
|
+
- VERIFY: Error handling covers edge cases
|
|
232
|
+
|
|
233
|
+
## Debt & Gaps
|
|
234
|
+
- TODO: Review migrated spec for accuracy
|
|
235
|
+
- TODO: Verify all extracted information matches current codebase
|
|
236
|
+
- [MIGRATED] Migrated from {format} format on {date}
|
|
237
|
+
|
|
238
|
+
{Any additional extracted tech debt items}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Output Artifacts
|
|
244
|
+
|
|
245
|
+
### 1. Specs (unless dry-run)
|
|
246
|
+
Location: `knowzcode/specs/{NodeID}.md`
|
|
247
|
+
|
|
248
|
+
### 2. Migration Report
|
|
249
|
+
Location: `knowzcode/planning/migration-{YYYYMMDD-HHMMSS}.md`
|
|
250
|
+
|
|
251
|
+
Content:
|
|
252
|
+
- Summary statistics
|
|
253
|
+
- Full NodeID extraction table
|
|
254
|
+
- Conflict resolution log
|
|
255
|
+
- Warnings and issues
|
|
256
|
+
- Next steps checklist
|
|
257
|
+
|
|
258
|
+
### 3. Log Entry (unless dry-run)
|
|
259
|
+
Location: `knowzcode/knowzcode_log.md` (prepend)
|
|
260
|
+
|
|
261
|
+
Format:
|
|
262
|
+
```markdown
|
|
263
|
+
---
|
|
264
|
+
**Type:** Migration
|
|
265
|
+
**Timestamp:** {timestamp}
|
|
266
|
+
**NodeID(s):** {comma-separated}
|
|
267
|
+
**Logged By:** knowledge-migrator
|
|
268
|
+
**Details:**
|
|
269
|
+
- **Sources:** {count} processed
|
|
270
|
+
- **Format:** {format(s)}
|
|
271
|
+
- **Created:** {n} specs
|
|
272
|
+
- **Updated:** {n} specs
|
|
273
|
+
- **Report:** {report_path}
|
|
274
|
+
---
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Final Report Format
|
|
280
|
+
|
|
281
|
+
After completing migration:
|
|
282
|
+
|
|
283
|
+
```markdown
|
|
284
|
+
✓ Migration completed.
|
|
285
|
+
|
|
286
|
+
**Summary:**
|
|
287
|
+
- Sources: {n} files processed
|
|
288
|
+
- Format: {detected format(s)}
|
|
289
|
+
- Created: {n} new specs
|
|
290
|
+
- Updated: {n} existing specs
|
|
291
|
+
- Skipped: {n} (already complete or identical)
|
|
292
|
+
|
|
293
|
+
**Report:** knowzcode/planning/migration-{timestamp}.md
|
|
294
|
+
|
|
295
|
+
**Next Steps:**
|
|
296
|
+
1. Review migrated specs for accuracy
|
|
297
|
+
2. Run a spec audit to validate completeness
|
|
298
|
+
3. Update any `[NEEDS_REVIEW]` markers
|
|
299
|
+
|
|
300
|
+
Awaiting next goal.
|
|
301
|
+
```
|