@dzhechkov/p-replicator 1.0.0 → 1.1.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/README.md +25 -3
- package/package.json +7 -4
- package/src/commands/doctor.js +2 -2
- package/src/commands/list.js +1 -1
- package/templates/.claude/rules/replicate-pipeline.md +13 -1
- package/templates/.claude/rules/skill-interface-protocol.md +148 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +116 -63
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/01-detect-parse.md +329 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/02-analyze-map.md +449 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/03-generate-p0.md +630 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/04-generate-p1.md +537 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/05-generate-p2p3.md +512 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/06-package-deliver.md +710 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/07-harvest-feedback.md +286 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/08-skill-composition.md +378 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/09-cross-project-learning.md +461 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/README.md +83 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/maturity-integration.md +198 -0
- package/templates/.claude/skills/pipeline-forge/references/self-extracted-patterns.md +260 -0
package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/09-cross-project-learning.md
ADDED
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
# Module: Cross-Project Learning
|
|
2
|
+
|
|
3
|
+
Enable toolkit generation to learn from previous projects' harvested artifacts.
|
|
4
|
+
When generating a new toolkit, this module checks a cross-project artifact registry
|
|
5
|
+
for proven patterns, battle-tested rules, and validated templates that match the
|
|
6
|
+
new project's characteristics, then injects them into the appropriate generation phase.
|
|
7
|
+
|
|
8
|
+
## Input
|
|
9
|
+
|
|
10
|
+
| Parameter | Type | Description | Required |
|
|
11
|
+
|-----------|------|-------------|----------|
|
|
12
|
+
| `project_ipm` | Object | Internal Project Model from Module 01 (tech stack, architecture, domain, features) | YES |
|
|
13
|
+
| `artifact_registry_path` | Path | Cross-project artifact registry (default: `.claude/skills/knowledge-extractor/registry/`) | NO |
|
|
14
|
+
| `maturity_model` | Reference | `view() knowledge-extractor/references/maturity-model.md` | YES |
|
|
15
|
+
| `artifact_categories` | Reference | `view() knowledge-extractor/references/artifact-categories.md` | YES |
|
|
16
|
+
| `minimum_relevance_score` | Number | Minimum relevance score for auto-include (default: 70) | NO |
|
|
17
|
+
| `minimum_maturity_for_auto` | Level | Minimum maturity for auto-include (default: Beta) | NO |
|
|
18
|
+
|
|
19
|
+
### Internal Project Model (IPM) Structure
|
|
20
|
+
|
|
21
|
+
The IPM is produced by Module 01 (Detect & Parse). Relevant fields for matching:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"project_name": "{{PROJECT_NAME}}",
|
|
26
|
+
"tech_stack": {
|
|
27
|
+
"languages": ["{{LANG_1}}", "{{LANG_2}}"],
|
|
28
|
+
"frameworks": ["{{FW_1}}", "{{FW_2}}"],
|
|
29
|
+
"databases": ["{{DB_1}}"],
|
|
30
|
+
"infrastructure": ["{{INFRA_1}}"]
|
|
31
|
+
},
|
|
32
|
+
"architecture_type": "{{MONOLITH|MICROSERVICES|SERVERLESS|MONOREPO}}",
|
|
33
|
+
"domain": "{{DOMAIN_KEYWORD}}",
|
|
34
|
+
"has_external_apis": {{BOOLEAN}},
|
|
35
|
+
"has_database": {{BOOLEAN}},
|
|
36
|
+
"has_authentication": {{BOOLEAN}},
|
|
37
|
+
"docker_services": ["{{SERVICE_1}}", "{{SERVICE_2}}"],
|
|
38
|
+
"detected_pipeline": "{{SPARC|IDEA2PRD|MIXED}}"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Process
|
|
43
|
+
|
|
44
|
+
### Step 1: Scan Cross-Project Artifact Registry
|
|
45
|
+
|
|
46
|
+
Locate and load the artifact registry:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
SCAN locations in priority order:
|
|
50
|
+
1. {{artifact_registry_path}} (explicit parameter)
|
|
51
|
+
2. .claude/skills/knowledge-extractor/registry/
|
|
52
|
+
3. .claude/toolkit-manifest.json
|
|
53
|
+
4. docs/harvest-report-*.md (parse individual reports)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Registry Format (if `registry/` directory exists):**
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
registry/
|
|
60
|
+
├── index.json # Master artifact index
|
|
61
|
+
├── skills/
|
|
62
|
+
│ ├── {{artifact-name}}.json # Artifact metadata
|
|
63
|
+
│ └── ...
|
|
64
|
+
├── patterns/
|
|
65
|
+
│ ├── {{artifact-name}}.json
|
|
66
|
+
│ └── ...
|
|
67
|
+
├── rules/
|
|
68
|
+
│ ├── {{artifact-name}}.json
|
|
69
|
+
│ └── ...
|
|
70
|
+
├── templates/
|
|
71
|
+
│ ├── {{artifact-name}}.json
|
|
72
|
+
│ └── ...
|
|
73
|
+
├── commands/
|
|
74
|
+
│ ├── {{artifact-name}}.json
|
|
75
|
+
│ └── ...
|
|
76
|
+
├── snippets/
|
|
77
|
+
│ ├── {{artifact-name}}.json
|
|
78
|
+
│ └── ...
|
|
79
|
+
└── hooks/
|
|
80
|
+
├── {{artifact-name}}.json
|
|
81
|
+
└── ...
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Artifact Metadata Format:**
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"name": "{{ARTIFACT_NAME}}",
|
|
89
|
+
"category": "{{CATEGORY}}",
|
|
90
|
+
"maturity": "{{ALPHA|BETA|STABLE|PROVEN}}",
|
|
91
|
+
"version": "v{{MAJOR}}.{{MINOR}}",
|
|
92
|
+
"description": "{{DESCRIPTION}}",
|
|
93
|
+
"source_projects": ["{{PROJECT_1}}", "{{PROJECT_2}}"],
|
|
94
|
+
"extracted": "{{DATE}}",
|
|
95
|
+
"last_updated": "{{DATE}}",
|
|
96
|
+
"characteristics": {
|
|
97
|
+
"tech_stacks": ["{{STACK_1}}", "{{STACK_2}}", "*"],
|
|
98
|
+
"architecture_types": ["{{TYPE_1}}", "*"],
|
|
99
|
+
"domains": ["{{DOMAIN_1}}", "*"],
|
|
100
|
+
"requires_database": {{BOOLEAN|NULL}},
|
|
101
|
+
"requires_external_apis": {{BOOLEAN|NULL}},
|
|
102
|
+
"requires_authentication": {{BOOLEAN|NULL}}
|
|
103
|
+
},
|
|
104
|
+
"tags": ["{{TAG_1}}", "{{TAG_2}}"],
|
|
105
|
+
"artifact_path": "{{PATH_TO_ARTIFACT_FILE}}",
|
|
106
|
+
"usage_count": {{N}},
|
|
107
|
+
"feedback_score": {{0-100|NULL}}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If no registry exists, report:
|
|
112
|
+
```
|
|
113
|
+
No cross-project artifact registry found.
|
|
114
|
+
Proceeding with standard toolkit generation (no cross-project learning).
|
|
115
|
+
Tip: Run /harvest on completed projects to build the registry over time.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Step 2: Match Project Characteristics Against Artifact Metadata
|
|
119
|
+
|
|
120
|
+
For each artifact in the registry, compute a relevance score based on how well
|
|
121
|
+
its characteristics match the new project's IPM:
|
|
122
|
+
|
|
123
|
+
**Matching Dimensions:**
|
|
124
|
+
|
|
125
|
+
| Dimension | Weight | Matching Logic |
|
|
126
|
+
|-----------|--------|----------------|
|
|
127
|
+
| Tech Stack | 30 | Language/framework overlap percentage |
|
|
128
|
+
| Architecture Type | 20 | Exact match = full score, related match = half |
|
|
129
|
+
| Domain | 15 | Exact match = full, related = half, wildcard = quarter |
|
|
130
|
+
| Infrastructure Match | 10 | Database/Docker/API overlap |
|
|
131
|
+
| Maturity Level | 15 | Proven=15, Stable=12, Beta=8, Alpha=3 |
|
|
132
|
+
| Usage Count | 10 | Logarithmic: log2(usage_count + 1) * 10/5, capped at 10 |
|
|
133
|
+
|
|
134
|
+
**Relevance Score Formula:**
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
FUNCTION compute_relevance(artifact, project_ipm):
|
|
138
|
+
score = 0
|
|
139
|
+
|
|
140
|
+
# Tech Stack Match (0-30 points)
|
|
141
|
+
artifact_stacks = artifact.characteristics.tech_stacks
|
|
142
|
+
IF "*" IN artifact_stacks:
|
|
143
|
+
stack_score = 25 # Universal gets high but not full score
|
|
144
|
+
ELSE:
|
|
145
|
+
overlap = intersection(artifact_stacks, project_ipm.tech_stack.all())
|
|
146
|
+
total = union(artifact_stacks, project_ipm.tech_stack.all())
|
|
147
|
+
stack_score = (len(overlap) / max(len(total), 1)) * 30
|
|
148
|
+
score += stack_score
|
|
149
|
+
|
|
150
|
+
# Architecture Type Match (0-20 points)
|
|
151
|
+
IF artifact.characteristics.architecture_types contains "*":
|
|
152
|
+
score += 16
|
|
153
|
+
ELIF project_ipm.architecture_type IN artifact.characteristics.architecture_types:
|
|
154
|
+
score += 20
|
|
155
|
+
ELIF architecture_is_related(project_ipm.architecture_type, artifact.characteristics):
|
|
156
|
+
score += 10
|
|
157
|
+
|
|
158
|
+
# Domain Match (0-15 points)
|
|
159
|
+
IF artifact.characteristics.domains contains "*":
|
|
160
|
+
score += 4 # Universal domain artifacts get minimal domain score
|
|
161
|
+
ELIF project_ipm.domain IN artifact.characteristics.domains:
|
|
162
|
+
score += 15
|
|
163
|
+
ELIF domain_is_related(project_ipm.domain, artifact.characteristics.domains):
|
|
164
|
+
score += 8
|
|
165
|
+
|
|
166
|
+
# Infrastructure Match (0-10 points)
|
|
167
|
+
infra_checks = [
|
|
168
|
+
(artifact.requires_database, project_ipm.has_database),
|
|
169
|
+
(artifact.requires_external_apis, project_ipm.has_external_apis),
|
|
170
|
+
(artifact.requires_authentication, project_ipm.has_authentication)
|
|
171
|
+
]
|
|
172
|
+
FOR each (artifact_req, project_has) IN infra_checks:
|
|
173
|
+
IF artifact_req == NULL:
|
|
174
|
+
score += 3 # No requirement = compatible
|
|
175
|
+
ELIF artifact_req == project_has:
|
|
176
|
+
score += 3 # Match
|
|
177
|
+
# Mismatch: no points (but not blocking)
|
|
178
|
+
|
|
179
|
+
# Maturity Level (0-15 points)
|
|
180
|
+
maturity_scores = {PROVEN: 15, STABLE: 12, BETA: 8, ALPHA: 3}
|
|
181
|
+
score += maturity_scores[artifact.maturity]
|
|
182
|
+
|
|
183
|
+
# Usage Count (0-10 points)
|
|
184
|
+
score += min(log2(artifact.usage_count + 1) * 2, 10)
|
|
185
|
+
|
|
186
|
+
RETURN round(score) # 0-100
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Step 3: Score and Rank Artifacts
|
|
190
|
+
|
|
191
|
+
Sort all artifacts by relevance score and prepare the ranked list:
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
## Artifact Relevance Ranking
|
|
195
|
+
|
|
196
|
+
| Rank | Artifact | Category | Maturity | Relevance | Matching Dimensions |
|
|
197
|
+
|------|----------|----------|----------|-----------|---------------------|
|
|
198
|
+
| 1 | {{NAME}} | {{CAT}} | {{LEVEL}} | {{SCORE}}/100 | Stack: {{X}}, Arch: {{Y}}, Domain: {{Z}} |
|
|
199
|
+
| 2 | {{NAME}} | {{CAT}} | {{LEVEL}} | {{SCORE}}/100 | Stack: {{X}}, Arch: {{Y}}, Domain: {{Z}} |
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Step 4: Filter by Maturity Level
|
|
203
|
+
|
|
204
|
+
Apply maturity-based filtering rules from the maturity model:
|
|
205
|
+
|
|
206
|
+
| Maturity Level | Symbol | Auto-Include Threshold | Action |
|
|
207
|
+
|----------------|--------|------------------------|--------|
|
|
208
|
+
| Proven | *** | Relevance >= 50 | Auto-include in P0 generation |
|
|
209
|
+
| Stable | *** | Relevance >= 60 | Auto-include in P1 generation |
|
|
210
|
+
| Beta | *** | Relevance >= 70 | Recommend in P2, include with user confirmation |
|
|
211
|
+
| Alpha | *** | N/A (never auto) | Mention in report only, never auto-include |
|
|
212
|
+
|
|
213
|
+
**Filter Logic:**
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
FOR each artifact IN ranked_artifacts:
|
|
217
|
+
IF artifact.maturity == PROVEN AND relevance >= 50:
|
|
218
|
+
→ INJECT into P0 (mandatory items)
|
|
219
|
+
ELIF artifact.maturity == STABLE AND relevance >= 60:
|
|
220
|
+
→ INJECT into P1 (recommended items)
|
|
221
|
+
ELIF artifact.maturity == BETA AND relevance >= 70:
|
|
222
|
+
→ RECOMMEND in P2 (optional items, user confirms)
|
|
223
|
+
ELIF artifact.maturity == ALPHA:
|
|
224
|
+
→ REPORT only (mention in cross-project learning report)
|
|
225
|
+
ELSE:
|
|
226
|
+
→ SKIP (relevance too low for maturity level)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Step 5: Inject Matched Artifacts into Toolkit Generation
|
|
230
|
+
|
|
231
|
+
For each artifact that passed the filter, determine the injection target
|
|
232
|
+
within the toolkit generator's output:
|
|
233
|
+
|
|
234
|
+
**Injection Targets by Category:**
|
|
235
|
+
|
|
236
|
+
| Artifact Category | P0 Injection Target | P1 Injection Target |
|
|
237
|
+
|-------------------|---------------------|---------------------|
|
|
238
|
+
| Skills | Copy to `.claude/skills/`, add to CLAUDE.md skills table | Add as recommended skill |
|
|
239
|
+
| Commands | Add to `.claude/commands/`, reference in CLAUDE.md | Add as recommended command |
|
|
240
|
+
| Hooks | Merge into `settings.json` hooks | Add as recommended hook |
|
|
241
|
+
| Rules | Add to `.claude/rules/`, reference in CLAUDE.md | Add as recommended rule |
|
|
242
|
+
| Templates | Use as improved default for scaffold generation | Suggest as alternative template |
|
|
243
|
+
| Patterns | Embed in `project-context/` skill, reference in architect agent | Add to knowledge base |
|
|
244
|
+
| Snippets | Include in `coding-standards/` skill | Add to utility references |
|
|
245
|
+
|
|
246
|
+
**Injection Protocol:**
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
FOR each injected_artifact:
|
|
250
|
+
1. READ artifact content from artifact_path
|
|
251
|
+
2. VERIFY artifact has been decontextualized (no project-specific references)
|
|
252
|
+
3. DETERMINE injection target based on category + generation phase
|
|
253
|
+
4. IF category == "skill":
|
|
254
|
+
→ Use Module 08 (Skill Composition) for copy + path rewrite
|
|
255
|
+
5. IF category == "rule":
|
|
256
|
+
→ Append to existing rule file or create new rule in .claude/rules/
|
|
257
|
+
6. IF category == "template":
|
|
258
|
+
→ Replace or supplement default template in generation
|
|
259
|
+
7. IF category == "pattern":
|
|
260
|
+
→ Add to project-context/ or architect agent references
|
|
261
|
+
8. RECORD injection in usage tracking
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Step 6: Track Usage for Maturity Promotion
|
|
265
|
+
|
|
266
|
+
Every injected artifact gets a usage record for future maturity assessment:
|
|
267
|
+
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"artifact_name": "{{ARTIFACT_NAME}}",
|
|
271
|
+
"used_in_project": "{{PROJECT_NAME}}",
|
|
272
|
+
"used_at": "{{DATE}}",
|
|
273
|
+
"injection_phase": "{{P0|P1|P2}}",
|
|
274
|
+
"injection_target": "{{TARGET_PATH}}",
|
|
275
|
+
"relevance_score": {{SCORE}},
|
|
276
|
+
"outcome": "{{PENDING|SUCCESS|REMOVED}}"
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**Usage Tracking File:** `{{artifact_registry_path}}/usage-log.jsonl`
|
|
281
|
+
|
|
282
|
+
Each line is a JSON object (JSON Lines format for append-only writes).
|
|
283
|
+
|
|
284
|
+
**Maturity Promotion Triggers:**
|
|
285
|
+
|
|
286
|
+
After recording usage, check if any artifact qualifies for promotion:
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
FOR each artifact WITH new usage record:
|
|
290
|
+
current_usage_count = count_unique_projects(artifact.name, usage_log)
|
|
291
|
+
|
|
292
|
+
IF artifact.maturity == ALPHA AND current_usage_count >= 2:
|
|
293
|
+
→ RECOMMEND promotion to Beta
|
|
294
|
+
→ CHECK: at least 1 edge case handled, "When NOT to use" documented
|
|
295
|
+
IF artifact.maturity == BETA AND current_usage_count >= 3:
|
|
296
|
+
→ RECOMMEND promotion to Stable
|
|
297
|
+
→ CHECK: multiple variants documented, no open issues
|
|
298
|
+
IF artifact.maturity == STABLE AND current_usage_count >= 5:
|
|
299
|
+
→ RECOMMEND promotion to Proven
|
|
300
|
+
→ CHECK: exemplary docs, community consensus
|
|
301
|
+
|
|
302
|
+
# Promotions are RECOMMENDATIONS, not automatic
|
|
303
|
+
# Add to output report for user review
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Output
|
|
307
|
+
|
|
308
|
+
### 1. Cross-Project Learning Report
|
|
309
|
+
|
|
310
|
+
```markdown
|
|
311
|
+
# Cross-Project Learning Report: {{PROJECT_NAME}}
|
|
312
|
+
Date: {{DATE}}
|
|
313
|
+
|
|
314
|
+
## Project Characteristics (from IPM)
|
|
315
|
+
- Tech Stack: {{LANGUAGES}}, {{FRAMEWORKS}}
|
|
316
|
+
- Architecture: {{ARCHITECTURE_TYPE}}
|
|
317
|
+
- Domain: {{DOMAIN}}
|
|
318
|
+
- Database: {{YES/NO}} | External APIs: {{YES/NO}} | Auth: {{YES/NO}}
|
|
319
|
+
|
|
320
|
+
## Registry Summary
|
|
321
|
+
- Total artifacts scanned: {{N}}
|
|
322
|
+
- Artifacts matched (relevance >= 50): {{M}}
|
|
323
|
+
- Artifacts injected: {{K}}
|
|
324
|
+
- Artifacts recommended: {{R}}
|
|
325
|
+
- Artifacts reported only: {{A}}
|
|
326
|
+
|
|
327
|
+
## Injected Artifacts (Auto-Included)
|
|
328
|
+
|
|
329
|
+
### P0 — Mandatory (Proven artifacts, relevance >= 50)
|
|
330
|
+
|
|
331
|
+
| # | Artifact | Category | Relevance | Injection Target | Source Projects |
|
|
332
|
+
|---|----------|----------|-----------|------------------|-----------------|
|
|
333
|
+
| 1 | {{NAME}} | {{CAT}} | {{SCORE}} | {{TARGET}} | {{PROJECTS}} |
|
|
334
|
+
|
|
335
|
+
### P1 — Recommended (Stable artifacts, relevance >= 60)
|
|
336
|
+
|
|
337
|
+
| # | Artifact | Category | Relevance | Injection Target | Source Projects |
|
|
338
|
+
|---|----------|----------|-----------|------------------|-----------------|
|
|
339
|
+
| 1 | {{NAME}} | {{CAT}} | {{SCORE}} | {{TARGET}} | {{PROJECTS}} |
|
|
340
|
+
|
|
341
|
+
### P2 — Suggested (Beta artifacts, relevance >= 70)
|
|
342
|
+
|
|
343
|
+
| # | Artifact | Category | Relevance | Injection Target | User Action |
|
|
344
|
+
|---|----------|----------|-----------|------------------|-------------|
|
|
345
|
+
| 1 | {{NAME}} | {{CAT}} | {{SCORE}} | {{TARGET}} | Confirm to include |
|
|
346
|
+
|
|
347
|
+
## Report Only (Alpha artifacts — for awareness)
|
|
348
|
+
|
|
349
|
+
| # | Artifact | Category | Relevance | Why Not Auto-Included |
|
|
350
|
+
|---|----------|----------|-----------|------------------------|
|
|
351
|
+
| 1 | {{NAME}} | {{CAT}} | {{SCORE}} | Alpha maturity — needs validation in more projects |
|
|
352
|
+
|
|
353
|
+
## Maturity Promotion Candidates
|
|
354
|
+
|
|
355
|
+
| Artifact | Current | Proposed | Usage Count | Missing Criteria |
|
|
356
|
+
|----------|---------|----------|-------------|------------------|
|
|
357
|
+
| {{NAME}} | {{CURRENT}} | {{PROPOSED}} | {{COUNT}} | {{MISSING}} |
|
|
358
|
+
|
|
359
|
+
## Skipped Artifacts (Low Relevance)
|
|
360
|
+
|
|
361
|
+
| Artifact | Relevance | Reason |
|
|
362
|
+
|----------|-----------|--------|
|
|
363
|
+
| {{NAME}} | {{SCORE}} | {{REASON}} |
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### 2. Usage Tracking Records
|
|
367
|
+
|
|
368
|
+
Appended to `{{artifact_registry_path}}/usage-log.jsonl`.
|
|
369
|
+
|
|
370
|
+
### 3. Modified Generation Output
|
|
371
|
+
|
|
372
|
+
Artifacts injected into the toolkit generator's output at their respective
|
|
373
|
+
phase targets (P0, P1, P2).
|
|
374
|
+
|
|
375
|
+
## Quality Gate
|
|
376
|
+
|
|
377
|
+
| Check | Threshold | Blocking? |
|
|
378
|
+
|-------|-----------|-----------|
|
|
379
|
+
| No Alpha artifacts auto-included | 0 Alpha in P0/P1 | YES |
|
|
380
|
+
| Relevance score >= 70 for Beta auto-include | Minimum 70 | YES |
|
|
381
|
+
| Relevance score >= 60 for Stable auto-include | Minimum 60 | YES |
|
|
382
|
+
| Relevance score >= 50 for Proven auto-include | Minimum 50 | YES |
|
|
383
|
+
| All injected artifacts pass decontextualization check | No project-specific references | YES |
|
|
384
|
+
| Usage tracking record created for each injection | 100% tracked | YES |
|
|
385
|
+
| Maturity promotions follow promotion criteria | All criteria checked | YES (for promotions) |
|
|
386
|
+
| No duplicate artifacts injected (same artifact twice) | 0 duplicates | YES |
|
|
387
|
+
| Injection targets exist in generation plan | All targets valid | YES |
|
|
388
|
+
|
|
389
|
+
**Validation Sequence:**
|
|
390
|
+
|
|
391
|
+
```
|
|
392
|
+
1. VERIFY no Alpha artifacts in auto-include lists
|
|
393
|
+
2. VERIFY all relevance scores meet maturity-specific thresholds
|
|
394
|
+
3. FOR each injected artifact:
|
|
395
|
+
a. GREP for project-specific references (company names, URLs, credentials)
|
|
396
|
+
b. VERIFY injection target exists in the generation plan
|
|
397
|
+
c. VERIFY no naming conflicts with existing generated artifacts
|
|
398
|
+
4. VERIFY usage-log.jsonl is append-only (no overwrites)
|
|
399
|
+
5. VERIFY promotion candidates meet ALL criteria from maturity-model.md
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Dependencies
|
|
403
|
+
|
|
404
|
+
| Dependency | Purpose | Fallback |
|
|
405
|
+
|------------|---------|----------|
|
|
406
|
+
| `view() knowledge-extractor/references/maturity-model.md` | Maturity level definitions, promotion criteria, trust levels | Use inline maturity table: Alpha (first use) / Beta (2+ projects) / Stable (3+ projects) / Proven (5+ projects, exemplary) |
|
|
407
|
+
| `view() knowledge-extractor/references/artifact-categories.md` | Category definitions for injection target mapping | Use inline category list: Skills, Commands, Hooks, Rules, Templates, Patterns, Snippets |
|
|
408
|
+
| Module 01 (Detect & Parse) | Provides IPM for project characteristic matching | Require user to provide tech stack and architecture manually |
|
|
409
|
+
| Module 08 (Skill Composition) | Copy and rewrite skills that are injected from the registry | Copy skills manually with path substitution |
|
|
410
|
+
|
|
411
|
+
## Reusability
|
|
412
|
+
|
|
413
|
+
The cross-project learning pattern is **universal** for any AI pipeline that generates
|
|
414
|
+
output from templates. The core insight is: **previous outputs improve future generation**.
|
|
415
|
+
|
|
416
|
+
**Pattern: Registry-Scored-Injection**
|
|
417
|
+
|
|
418
|
+
```
|
|
419
|
+
[Previous Projects] → [Harvest/Extract] → [Artifact Registry]
|
|
420
|
+
↓
|
|
421
|
+
[Score & Match]
|
|
422
|
+
↓
|
|
423
|
+
[New Project IPM] → [Filter by Maturity] → [Inject into Generation]
|
|
424
|
+
↓
|
|
425
|
+
[Track Usage]
|
|
426
|
+
↓
|
|
427
|
+
[Promote Maturity]
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Reuse scenarios:**
|
|
431
|
+
|
|
432
|
+
| Scenario | Adaptation |
|
|
433
|
+
|----------|------------|
|
|
434
|
+
| CI/CD pipeline generator | Match project characteristics against pipeline artifact registry |
|
|
435
|
+
| Infrastructure-as-Code generator | Match cloud provider + scale against infra pattern registry |
|
|
436
|
+
| API scaffolder | Match API style + auth requirements against API pattern registry |
|
|
437
|
+
| Documentation generator | Match doc style + audience against documentation template registry |
|
|
438
|
+
| Test framework configurator | Match test strategy + tech stack against testing pattern registry |
|
|
439
|
+
| AI prompt library | Match task type + domain against prompt template registry |
|
|
440
|
+
|
|
441
|
+
**To adapt for a different pipeline:**
|
|
442
|
+
|
|
443
|
+
1. Define your equivalent of the IPM (project characteristics model)
|
|
444
|
+
2. Define your equivalent of the artifact registry (stored outputs from previous runs)
|
|
445
|
+
3. Implement the relevance scoring function with weights appropriate to your domain
|
|
446
|
+
4. Map your artifact categories to injection targets in your generation pipeline
|
|
447
|
+
5. Keep the maturity model, usage tracking, and promotion logic unchanged
|
|
448
|
+
|
|
449
|
+
**Key design decisions:**
|
|
450
|
+
|
|
451
|
+
- Relevance scoring is **weighted multi-dimensional**, not binary match/no-match,
|
|
452
|
+
because partial matches are often valuable (a pattern from a similar but not identical
|
|
453
|
+
stack is still useful)
|
|
454
|
+
- Alpha artifacts are **never auto-included** because untested artifacts in generated
|
|
455
|
+
toolkits create unpredictable downstream issues
|
|
456
|
+
- Usage tracking uses **append-only JSON Lines** for simplicity and crash safety
|
|
457
|
+
- Maturity promotions are **recommendations**, not automatic, because promotion criteria
|
|
458
|
+
include qualitative checks (documentation quality, edge case handling) that require
|
|
459
|
+
human or AI judgment
|
|
460
|
+
- The registry is **file-based** (not a database) for portability across development
|
|
461
|
+
environments and compatibility with version control
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# CC-Toolkit-Generator-Enhanced — Modules
|
|
2
|
+
|
|
3
|
+
Modular phase architecture for the toolkit generator.
|
|
4
|
+
Each module is self-contained with: INPUT → PROCESS → OUTPUT → QUALITY GATE.
|
|
5
|
+
|
|
6
|
+
## Phase Modules (Core Pipeline)
|
|
7
|
+
|
|
8
|
+
| # | Module | File | Size | Purpose |
|
|
9
|
+
|---|--------|------|------|---------|
|
|
10
|
+
| 01 | Detect & Parse | `01-detect-parse.md` | 10K | Scan docs, detect pipeline type (SPARC/idea2prd), build IPM |
|
|
11
|
+
| 02 | Analyze & Map | `02-analyze-map.md` | 16K | Map documents to toolkit instruments with scoring engine |
|
|
12
|
+
| 03 | Generate P0 | `03-generate-p0.md` | 22K | Mandatory toolkit items (CLAUDE.md, rules, commands, skills) |
|
|
13
|
+
| 04 | Generate P1 | `04-generate-p1.md` | 24K | Recommended items + enterprise lifecycle + automation |
|
|
14
|
+
| 05 | Generate P2-P3 | `05-generate-p2p3.md` | 20K | Optional: TDD guide, DDD validators, MCP configs |
|
|
15
|
+
| 06 | Package & Deliver | `06-package-deliver.md` | 29K | Master validation checklist + delivery report |
|
|
16
|
+
|
|
17
|
+
## Extension Modules (Reusable Across Projects)
|
|
18
|
+
|
|
19
|
+
| # | Module | File | Size | Purpose |
|
|
20
|
+
|---|--------|------|------|---------|
|
|
21
|
+
| 07 | Harvest Feedback | `07-harvest-feedback.md` | 11K | Post-project learning loop (harvest → improve → generate) |
|
|
22
|
+
| 08 | Skill Composition | `08-skill-composition.md` | 12K | Dependency graph, copying, path rewriting, manifest |
|
|
23
|
+
| 09 | Cross-Project Learning | `09-cross-project-learning.md` | 18K | Pattern reuse via maturity model + relevance scoring |
|
|
24
|
+
|
|
25
|
+
## Execution Flow
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
01-detect-parse → IPM (Internal Project Model)
|
|
29
|
+
02-analyze-map → Instrument Map (scored items)
|
|
30
|
+
↓ [OPTIONAL]
|
|
31
|
+
09-cross-project → Augmented Instrument Map (with proven patterns)
|
|
32
|
+
↓
|
|
33
|
+
03-generate-p0 → P0 files (mandatory)
|
|
34
|
+
↓ uses
|
|
35
|
+
08-skill-composition → Skills copied + paths rewritten
|
|
36
|
+
↓
|
|
37
|
+
04-generate-p1 → P1 files (recommended)
|
|
38
|
+
05-generate-p2p3 → P2-P3 files (optional)
|
|
39
|
+
↓
|
|
40
|
+
06-package-deliver → Validated package + report
|
|
41
|
+
↓ [POST-PROJECT]
|
|
42
|
+
07-harvest-feedback → Template improvements for next generation
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Module Interface Contract
|
|
46
|
+
|
|
47
|
+
Every module follows this structure:
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
# Module: [Name]
|
|
51
|
+
|
|
52
|
+
## Input
|
|
53
|
+
[What this module receives — typed interface]
|
|
54
|
+
|
|
55
|
+
## Process
|
|
56
|
+
[Step-by-step execution with concrete logic]
|
|
57
|
+
|
|
58
|
+
## Output
|
|
59
|
+
[What this module produces — typed interface]
|
|
60
|
+
|
|
61
|
+
## Quality Gate
|
|
62
|
+
[Checklist: what must pass before proceeding]
|
|
63
|
+
|
|
64
|
+
## Dependencies
|
|
65
|
+
[Which skills/modules this calls via view()]
|
|
66
|
+
|
|
67
|
+
## Reusability
|
|
68
|
+
[How this module can be used outside cc-toolkit-generator-enhanced]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Reusability Guide
|
|
72
|
+
|
|
73
|
+
These modules are designed for reuse in other IT contexts:
|
|
74
|
+
|
|
75
|
+
| Module | Reusable Pattern | Use Cases |
|
|
76
|
+
|--------|-----------------|-----------|
|
|
77
|
+
| 01 | Document type detection + project classification | Any pipeline needing input analysis |
|
|
78
|
+
| 02 | Scored document-to-artifact mapping | Any doc-driven generation system |
|
|
79
|
+
| 03-05 | Template-based tiered generation (P0/P1/P2) | Scaffolding, config generation |
|
|
80
|
+
| 06 | Multi-tier validation + budget enforcement | Any multi-file output system |
|
|
81
|
+
| 07 | Harvest → Improve → Generate feedback loop | CI/CD, doc generators, prompt libraries |
|
|
82
|
+
| 08 | Plugin/skill dependency resolution + path rewriting | Plugin installers, template repos |
|
|
83
|
+
| 09 | Registry + relevance scoring + maturity gating | Package recommendation, best practices |
|