بنقرة واحدة
pwrl-learnings-dedup
Identify and merge duplicate or redundant learnings while preserving historical lineage.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Identify and merge duplicate or redundant learnings while preserving historical lineage.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Extract, classify, deduplicate, structure, and save learnings from code, commits, tasks, and documentation
Create structured implementation plans with three tiers (Fast/Standard/Deep). Pure skill pipeline orchestrator—no agent routing.
Review code changes through 4-phase micro-skill pipeline (scope, prepare, analyze, report)
Execute implementation work efficiently through 4-phase micro-skill pipeline
Verify repository state and confirm session completion before committing.
Create a clear session commit with state and next steps. Orchestrates checkpoint and commit micro-skills, optionally chains to pwrl-learnings.
| name | pwrl-learnings-dedup |
| description | Identify and merge duplicate or redundant learnings while preserving historical lineage. |
| argument-hint | [structure artifact from pwrl-learnings-structure] |
Purpose: Phase 4 of learnings workflow. Detects and merges duplicate or semantically similar learnings while preserving complete audit trails and source history. Maintains knowledge base quality and discoverability.
Expects artifact from pwrl-learnings-structure with:
structure_id: YYYY-MM-DD-NNN-structure
learnings: [array of structured learnings with metadata]
Emit dedup artifact (YAML + markdown):
---
format: pwrl-learnings-dedup-artifact
version: "1.0"
dedup_id: YYYY-MM-DD-NNN-dedup
created: ISO-8601-timestamp
---
# Learning Deduplication Results
## Summary
- **Before Dedup:** [count] learnings
- **After Dedup:** [count] unique learnings
- **Duplicates Merged:** [count]
- **Archived:** [count]
- **Dedup Confidence:** [0-100%]
## Merge Actions
### Exact Merges: [count]
- [Learning A] merged into [Learning B]
- Preserved: sources, examples, tags from both
### High-Similarity Flagged: [count]
- [Learning C] similar to [Learning D] (94% match)
- User decision: merged | kept-separate
### Related Linked: [count]
- [Learning E] complements [Learning F]
- Cross-reference created
## Archived Mapping
- `OLD_ID_1` → `NEW_ID_1`
- `OLD_ID_2` → `NEW_ID_2`
## Ready for Save
- **Status:** ready
- **Next Skill:** pwrl-learnings-save
- **Artifacts Passed:** This dedup artifact + updated learnings
For complete step-by-step instructions, see dedup-learnings-detailed-workflow.md.
This SKILL.md provides an overview. The detailed workflow document contains:
This phase performs final duplicate resolution using three fingerprinting strategies:
See duplicate-handling-consolidated.md for complete fingerprinting details.
After completing this phase, run quality gate validation:
/pwrl-phase-checkpoint learnings 4 [artifact-path]
See pwrl-phase-checkpoint for validation rules.
Check input has valid structure_id and learnings array with complete metadata.
For each learning, generate three fingerprints:
Exact Fingerprint: MD5(type + domain + title.lowercase.strip())
Semantic Fingerprint: MD5(type + domain + problem_hash + tags_sorted)
Text Similarity: Cosine similarity of (title + problem + tags)
Compare all fingerprints:
For each pair (L1, L2):
if exact_fingerprint(L1) == exact_fingerprint(L2):
→ Exact duplicate (auto-merge)
elif semantic_fingerprint(L1) == semantic_fingerprint(L2):
→ Semantic duplicate (auto-merge)
elif text_similarity(L1, L2) > 0.85:
→ High similarity (flag for review)
elif related_tags(L1, L2) and type(L1) != type(L2):
→ Complementary learning (cross-reference)
Three strategies available:
| Strategy | Behavior | Confidence |
|---|---|---|
| exact | Only auto-merge exact/semantic duplicates | 95%+ |
| semantic | + flag high-similarity (85%+) for review | 85-95% |
| hybrid | All of above + link related learnings | 70-95% |
Default: hybrid (recommended)
For exact/semantic matches:
Choose winner:
created_at)problem + application)applicability scorePreserve loser data:
winner.examples.push(...loser.examples)winner.sources.push(...loser.sources)merged_from: [loser.id]Archive loser:
archived: truemerged_into: winner.idExample:
Winner: learning-id-1
title: "Race Condition in Shared Cache"
problem: "Multiple threads accessing cache without locking"
tags: [concurrency, cache, threading]
sources:
- src/cache.ts:42
examples: ["Reproducer code 1"]
Loser: learning-id-2
title: "Race Condition - Cache Access" # Similar but different
problem: "Concurrent cache access causes data corruption"
tags: [concurrency, cache] # Subset of winner's
sources:
- src/old-cache.ts:20
examples: ["Reproducer code 2"]
Result: learning-id-1 (winner)
title: "Race Condition in Shared Cache"
problem: "Multiple threads accessing cache without locking, causing data corruption"
tags: [concurrency, cache, threading] # Merged + deduped
sources:
- src/cache.ts:42
- src/old-cache.ts:20 # Both preserved
examples:
- "Reproducer code 1"
- "Reproducer code 2" # Both preserved
merged_from: [learning-id-2]
merged_at: 2026-06-12T10:30:00Z
For 85%+ similarity (non-exact):
Display to user:
High Similarity Match (91%)
Learning A: "React Hook Dependency Gotcha"
Learning B: "React Hooks - Dependency Array Gotcha"
Should these be merged? Yes / No / Keep separate
User decides:
For complementary learnings:
Learning: "Race Condition Gotcha"
Related:
- [prevents]: "Mutex Usage Pattern"
- [complements]: "Immutable Data Structures"
Emit artifact with:
| Error | Recovery |
|---|---|
| Structure artifact invalid | Return error; direct to pwrl-learnings-structure |
| Fingerprint calculation fails | Skip that learning; continue with others |
| User can't decide | Default: keep separate; add cross-reference |
| Merge conflicts | Manual merge; preserve all data |
Test file: tests/pwrl-learnings/dedup-learnings.test.ts
Happy Path Tests:
Edge Cases:
Output Validation Tests: