⚠️ DANGER: This tool can PERMANENTLY DAMAGE your [[knowledge-graph]] if used incorrectly! Repairs [[graph]] corruption by replacing [[concept]] variants with canonical form in source [[markdown]] files. Fixes the source of truth rather than just the database. Use this to consolidate [[concept]] families while preserving semantic meaning.
🛡️ SEMANTIC VALIDATION: Automatically blocks unsafe consolidations by checking semantic similarity between concepts using [[vector-embeddings]]. Only proceeds if ALL variants have similarity >= minSemanticSimilarity threshold (default 0.7).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| conceptsToReplace | string | Yes | Comma/semicolon-separated list of concept variants to replace | ”tools,Tools,TOOLS” |
| canonicalConcept | string | Yes* | The canonical concept to use (*empty string for WikiLink removal) | “tool” |
| folder | string | No | Subfolder under memory root to process (default: all memory) | “research/ai” |
| dryRun | bool | No | ALWAYS START WITH TRUE! Preview changes without modifying files (default: true) | true |
| createWikiLinks | bool | No | Create [[WikiLinks]] from plain text instead of replacing existing (default: false) | false |
| minSemanticSimilarity | double | No | Minimum similarity threshold (0.0-1.0) for safe consolidation (default: 0.7) | 0.7 |
{
"conceptsToReplace": "tools,Tools,TOOLS",
"canonicalConcept": "tool",
"dryRun": true
}
⚠️ First run with dryRun=true to preview changes. This is SAFE - just plural standardization.
{
"conceptsToReplace": "tools,Tools,TOOLS",
"canonicalConcept": "tool",
"dryRun": false
}
Only run with dryRun=false AFTER reviewing the dry run output and confirming safety.
{
"conceptsToReplace": "mcp,Mcp,MCP",
"canonicalConcept": "MCP",
"dryRun": true
}
Standardizes casing - semantic validation will pass as these are identical concepts.
{
"conceptsToReplace": "machine learning,neural network",
"canonicalConcept": "Machine Learning",
"createWikiLinks": true,
"dryRun": true
}
Converts plain text “machine learning” → [[Machine Learning]] for graph integration.
{
"conceptsToReplace": "agents,Agents",
"canonicalConcept": "agent",
"folder": "research/ai",
"dryRun": true
}
Limits changes to research/ai subfolder - useful for targeted cleanup.
{
"conceptsToReplace": "test-coverage,coverage",
"canonicalConcept": "coverage",
"minSemanticSimilarity": 0.0,
"dryRun": true
}
⚠️ Setting minSemanticSimilarity=0.0 disables safety checks - only use if you understand the risk.
Class Names → Generic Concepts
Specific Types → Generic Categories
File Paths → Concepts
Compound Concepts → Base Terms
Plurals → Singular
Case Variations → Standard Case
Typos → Correct Spelling
=== SEMANTIC VALIDATION ===
Checking semantic similarity with threshold 0.70...
WARNING: Unsafe consolidation detected! The following concepts are semantically dissimilar:
- coding-agent: similarity 0.623
- deployment-agent: similarity 0.589
This would destroy semantic meaning. Review concepts manually or increase similarity threshold.
{
"conceptsToReplace": "deprecated-concept",
"canonicalConcept": "",
"dryRun": true
}
⚠️ Empty canonicalConcept removes [[brackets]] entirely, breaking graph connections. Only use for de-linking obsolete concepts.
{
"minSemanticSimilarity": 0.0
}
🚨 Disables safety checks - you can destroy semantic meaning. Only use if semantic validation is preventing a consolidation you’ve manually verified as safe.
Process concept families one at a time rather than bulk operations:
# Step 1: Fix "tool" family
RepairConcepts conceptsToReplace='tools,Tools' canonicalConcept='tool' dryRun=true
# Step 2: Fix "agent" family
RepairConcepts conceptsToReplace='agents,Agents' canonicalConcept='agent' dryRun=true
# Step 3: Fix "test" family
RepairConcepts conceptsToReplace='tests,Tests' canonicalConcept='test' dryRun=true
Test repairs on small subfolders before processing entire memory:
{
"conceptsToReplace": "experimental,Experimental",
"canonicalConcept": "experiment",
"folder": "research/experiments",
"dryRun": true
}
Cause: Semantic similarity validation failed - variants are not semantically equivalent Solution: Review the similarity scores. If consolidation is truly safe, either:
Cause: Set createWikiLinks=true with empty canonicalConcept Solution: Choose one mode: create WikiLinks OR remove them, not both
Cause: Folder parameter points to non-existent directory Solution: Verify folder path relative to memory root, or omit for full memory scan
Cause: Embeddings don’t capture context (e.g., “tests” vs “test” may have lower similarity than expected) Solution: Review specific use cases, then override with minSemanticSimilarity=0.0 if truly safe
Cause: Forgot to run Sync after applying repairs Solution: Always run Sync tool after RepairConcepts to rebuild knowledge graph
=== SEMANTIC VALIDATION ===
Checking semantic similarity with threshold 0.70...
All variants passed semantic validation.
Scanning 245 markdown files...
Looking for variants: tools, Tools, TOOLS
Will replace with: [[tool]] (normalized: tool)
Would modify: research/machine-learning/transformers.md
[[tools]] → [[tool]]
[[Tools]] → [[tool]]
Would modify: projects/2024/ai-infrastructure.md
[[TOOLS]] → [[tool]]
=== SUMMARY ===
Files scanned: 245
Files to modify: 2
Total replacements: 3
This was a DRY RUN. To apply changes, run with dryRun=false
After applying changes, run 'sync' to rebuild the graph with clean concepts.
✓ Modified: research/machine-learning/transformers.md
[[tools]] → [[tool]]
[[Tools]] → [[tool]]
✓ Modified: projects/2024/ai-infrastructure.md
[[TOOLS]] → [[tool]]
=== SUMMARY ===
Files scanned: 245
Files modified: 2
Total replacements: 3
✓ Changes applied successfully!
Run 'sync' to rebuild the graph with the cleaned concepts.
{
"conceptFamily": "tool"
}
Output shows: [[tool]] (245x), [[tools]] (89x), [[Tools]] (12x), [[VectorTools.cs]] (18x)
✅ Safe to merge: [[tools]], [[Tools]] → [[tool]] 🚨 DO NOT merge: [[VectorTools.cs]] (file path)
{
"conceptsToReplace": "tools,Tools",
"canonicalConcept": "tool",
"dryRun": true
}
=== SEMANTIC VALIDATION ===
All variants passed semantic validation.
- tools: similarity 0.983
- Tools: similarity 0.983
Would modify: 15 files
Total replacements: 101
{
"conceptsToReplace": "tools,Tools",
"canonicalConcept": "tool",
"dryRun": false
}
{
"tool": "Sync"
}
RepairConcepts follows Maenifold’s Ma Protocol principles:
This tool embodies Ma Protocol’s principle of preserving space through careful action - the semantic validation ensures you don’t collapse important conceptual distinctions in your [[knowledge-graph]].