Discover missing relationships for a note via multi-strategy analysis
Discovers missing relationships for a note via multi-strategy analysis
/plugin marketplace add witt3rd/claude-plugins/plugin install azkg@witt3rd-claude-pluginsDiscover missing relationships between a note and the rest of the knowledge graph through multi-strategy analysis.
Check for AZKG_REPO_PATH environment variable:
if [ -z "$AZKG_REPO_PATH" ]; then REPO_PATH=$(pwd); else REPO_PATH="$AZKG_REPO_PATH"; fiAll file operations must use REPO_PATH:
Read(REPO_PATH/filename.md) or Read("$REPO_PATH/filename.md")Write(REPO_PATH/filename.md) or Write("$REPO_PATH/filename.md")Edit(REPO_PATH/filename.md) or Edit("$REPO_PATH/filename.md")Grep(pattern, path=REPO_PATH) or with explicit pathGlob(pattern, path=REPO_PATH) or with explicit pathExample usage:
# Check environment variable
if [ -z "$AZKG_REPO_PATH" ]; then
REPO_PATH=$(pwd)
else
REPO_PATH="$AZKG_REPO_PATH"
fi
# Then use REPO_PATH for all operations
Read("$REPO_PATH/agents.md")
Concrete examples:
Input format: User provides:
/expand-graph mcp_security.md/expand-graph mcp_securityNormalize and validate:
.md extension if missingRead the target note:
Analyze note content for:
Technical terms:
Domain concepts:
Wikilinks:
[[note]]Tags:
Output concept extraction:
š Analyzing mcp_security.md...
š Key concepts identified:
Technologies: OAuth, JWT, SAML, Active Directory
Domains: security, authentication, authorization, privacy
Protocols: RFC 8707, Resource Indicators, OAuth flows
Patterns: least privilege, defense in depth, audit logging
Tags: #mcp #protocol #security #authentication #authorization
š Current relationships:
ā
Prerequisites: 2 (mcp_overview, mcp_architecture)
ā
Related Topics: 3
ā
Extends: 1
ā
Examples: 0
ā
Alternatives: 0
Strategy 1: Content-Based Search (Grep)
For each key concept, search other notes:
Searching for "OAuth" across knowledge base...
Found in:
- oauth_fundamentals.md (15 mentions)
- api_security.md (8 mentions)
- enterprise_auth.md (12 mentions)
Searching for "authentication" across knowledge base...
Found in:
- fastmcp_auth.md (20 mentions)
- api_security.md (18 mentions)
- enterprise_auth.md (25 mentions)
Filter out:
Strategy 2: Tag-Based Discovery
Use Grep to find notes with overlapping tags:
Target has tags: #mcp #security #authentication
Finding notes with overlapping tags...
Use Grep to search for "tags: [" in YAML frontmatter
Parse out tags and find overlaps:
- #mcp + #security: mcp_implementation.md, mcp_tools.md
- #security + #authentication: api_security.md, zero_trust.md
- #mcp (any): 12 other MCP-related notes
Strategy 3: Wikilink Analysis
Use Grep to find wikilinks in target note content:
Checking wikilinks in content vs "Related Concepts" section...
Found in content but NOT in "Related Concepts":
- [[mcp_overview]] - mentioned in text but not in prerequisites
- [[oauth_fundamentals]] - referenced but not linked formally
Use Grep to find backlinks (other notes linking to this note):
Found in other notes' "Related Concepts" sections pointing here:
- fastmcp_auth.md lists this as "related" (we should reciprocate)
Strategy 4: Research with Perplexity
Ask targeted questions:
Query 1: "What foundational knowledge is required to understand [main topic of note]?"
Query 2: "What concepts are commonly related to [main topic] in practice?"
Query 3: "What are concrete examples or implementations of [main topic]?"
Query 4: "What are alternative approaches to [main topic]?"
Use Perplexity responses to:
For each discovered note, determine:
Prerequisites: Does target need this first?
Related Topics: Parallel/complementary topics?
Extends: Does target build on this?
Examples: Is this a concrete implementation?
Alternatives: Different approach to same problem?
High (ā ā ā ā ā ):
Medium (ā ā ā āā):
Low (ā ā āāā):
For each relationship, capture:
Format as organized report:
# Graph Expansion: mcp_security.md
Found **12 potential relationships** across 8 notes
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## š Suggested Prerequisites (2)
### 1. [[mcp_overview]] ā prerequisite
**Confidence:** ā
ā
ā
ā
ā
High
**Evidence:**
- Mentioned 3 times in target note
- Target references "MCP fundamentals" and "protocol basics"
- Research confirms: "Understanding MCP basics required before security"
**Reasoning:** Can't understand MCP security without knowing what MCP is.
The security model builds directly on protocol concepts.
**Current status:** Referenced in content but missing from "Related Concepts"
---
### 2. [[oauth_fundamentals]] ā prerequisite
**Confidence:** ā
ā
ā
ā
ā
High
**Evidence:**
- 15 mentions of "OAuth" in target note
- Entire section dedicated to "OAuth Flows"
- Tags overlap: #authentication, #security
- Research confirms: "OAuth knowledge essential for MCP auth"
**Reasoning:** OAuth is the primary authentication mechanism. Deep understanding
needed before tackling MCP-specific OAuth implementation.
**Current status:** Not currently linked
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## š Suggested Related Topics (4)
### 3. [[enterprise_architecture]] ā related
**Confidence:** ā
ā
ā
āā Medium
**Evidence:**
- Both discuss: VNet integration, DLP, enterprise deployment
- 8 shared concepts
- Tags overlap: #enterprise
**Reasoning:** Both address enterprise concerns at similar abstraction level.
MCP security is part of broader enterprise architecture.
**Current status:** Not currently linked
---
### 4. [[api_security_best_practices]] ā related
**Confidence:** ā
ā
ā
āā Medium
**Evidence:**
- MCP is API protocol
- 12 security best practices mentioned in both
- Research: "General API security principles apply to MCP"
**Reasoning:** MCP security inherits from general API security principles.
Provides broader context for MCP-specific patterns.
**Current status:** Not currently linked
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## šļø Suggested "Extends" (1)
### 5. mcp_security extends [[mcp_architecture]]
**Confidence:** ā
ā
ā
ā
ā
High
**Evidence:**
- Security is explicit layer on architecture diagram
- Target states: "Security model built on top of MCP architecture"
- Architecture defines components, security defines protections
**Reasoning:** Security adds protection layer to architectural components.
Cannot exist without the architecture it secures.
**Current status:** Architecture listed as prerequisite, should be "extends"
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## š” Suggested Examples (3)
### 6. [[fastmcp_authentication]] ā example
**Confidence:** ā
ā
ā
ā
ā
High
**Evidence:**
- Python implementation of MCP auth patterns
- Shows OAuth flow implementation
- Research: "FastMCP demonstrates MCP security in practice"
**Reasoning:** Concrete Python code implementing concepts discussed in target.
Shows theory in action.
**Current status:** Not currently linked
---
### 7. [[csharp_mcp_auth]] ā example
**Confidence:** ā
ā
ā
ā
ā High
**Evidence:**
- C# implementation of same patterns
- Demonstrates enterprise auth integration
- Tags: #csharp, #mcp, #authentication
**Reasoning:** Alternative language implementation showing same concepts.
Useful for enterprise/.NET developers.
**Current status:** Not currently linked
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## š Suggested Alternatives (2)
### 8. [[zero_trust_security_model]] ā alternative
**Confidence:** ā
ā
āāā Low
**Evidence:**
- Different security paradigm
- Both address: authentication, authorization, least privilege
- Research: "Zero trust can be applied to MCP deployments"
**Reasoning:** Alternative security philosophy applicable to MCP.
Different approach to similar goals.
**Current status:** Not currently linked
---
## š Discovery Statistics
- **Total candidates examined:** 93 notes
- **Content matches found:** 23 notes
- **Tag overlaps found:** 15 notes
- **After filtering:** 12 high-quality suggestions
- **Confidence breakdown:**
- High (ā
ā
ā
ā
ā
): 5 suggestions
- Medium (ā
ā
ā
āā): 5 suggestions
- Low (ā
ā
āāā): 2 suggestions
## š” Insights
**Critical missing prerequisite:** oauth_fundamentals
This note is heavily referenced but not formally linked. High priority addition.
**Weak example coverage:** Only 0 examples currently
Consider adding fastmcp_authentication and csharp_mcp_auth to show practical application.
**Architecture relationship:** Currently listed as prerequisite
Should be "extends" relationship - security is layer on architecture.
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Offer interaction modes:
How would you like to proceed?
[A] Accept all high-confidence suggestions (ā
ā
ā
ā
ā
)
[R] Review each suggestion individually
[C] Custom selection (specify which to add)
[S] Save suggestions to file for later review
[Q] Quit without changes
Choice: ā
If user chooses [R] (Review):
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Review 1 of 12
Add [[mcp_overview]] as prerequisite?
Confidence: ā
ā
ā
ā
ā
High
Evidence: Referenced 3 times, foundational concept
Reasoning: Must understand MCP basics before security
[Y] Yes, add this relationship
[N] No, skip this one
[E] Edit relationship type (suggest different type)
[?] Show full context from both notes
[S] Skip remaining and finish
Choice: ā
Track decisions:
For each accepted relationship:
Use Edit tool to update target note's "Related Concepts" section:
Read the target note:
Use Read tool to get full content
Parse "Related Concepts" section
Add forward relationship:
## Related Concepts
### Prerequisites
- [[mcp_overview]] - Must understand MCP basics first
- [[oauth_fundamentals]] - OAuth is primary auth mechanism
Use Edit tool to surgically insert new relationships in appropriate subsections.
For each note mentioned, add inverse relationship:
Read the related note:
Use Read tool to get its "Related Concepts" section
Add bidirectional inverse:
If target has "Prerequisites: [[mcp_overview]]" Then mcp_overview gets "Extended By: [[target]]"
If target has "Related Topics: [[api_security]]" Then api_security gets "Related Topics: [[target]]"
If target has "Extends: [[mcp_architecture]]" Then mcp_architecture gets "Extended By: [[target]]"
Use Edit tool to add inverse relationships to each related note.
Ensure every relationship has an inverse:
| Forward Type | Inverse Type |
|---|---|
| Prerequisites | Extended By or Related Topics |
| Related Topics | Related Topics (symmetric) |
| Extends | Extended By |
| Examples | Extended By |
| Alternatives | Alternatives (symmetric) |
ā
Graph Expansion Complete!
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## Changes Applied
### mcp_security.md
**Added relationships:**
ā
Prerequisites: 2
- [[mcp_overview]] - Must understand MCP basics first
- [[oauth_fundamentals]] - OAuth is primary auth mechanism
ā
Related Topics: 3
- [[enterprise_architecture]] - Parallel enterprise concerns
- [[api_security_best_practices]] - General API security principles
- [[fastmcp_authentication]] - Moved from suggested examples
ā
Extends: 1 (modified)
- [[mcp_architecture]] - Changed from prerequisite to extends
ā
Examples: 2
- [[fastmcp_authentication]] - Python implementation
- [[csharp_mcp_auth]] - C# implementation
**Rejected:**
ā [[zero_trust_security_model]] - User declined (too tangential)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## Bidirectional Updates
Updated 9 additional notes with inverse relationships:
- mcp_overview.md ā added to Extended By
- oauth_fundamentals.md ā added to Extended By
- enterprise_architecture.md ā added to Related Topics
- api_security_best_practices.md ā added to Related Topics
- mcp_architecture.md ā moved to Extended By (from prerequisite inverse)
- fastmcp_authentication.md ā added to Extended By
- csharp_mcp_auth.md ā added to Extended By
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## Knowledge Graph Stats
**Before expansion:**
- Total relationships in mcp_security.md: 6
**After expansion:**
- Total relationships in mcp_security.md: 12 (+6)
- Files modified: 10 (target + 9 related notes)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## Quality Improvements
šÆ **Closed gaps:**
- Connected heavily-referenced OAuth concepts
- Added missing example implementations
- Corrected architecture relationship type
š **Coverage increase:**
- Prerequisites: 2 ā 4 (+100%)
- Examples: 0 ā 2 (new coverage)
- Related Topics: 3 ā 6 (+100%)
š **Network density:**
- mcp_security.md now has 12 total relationships (was 6)
- Better integrated into knowledge graph
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## Next Steps
š” **Suggestions:**
1. Run `/learning-path mcp_security` to see updated prerequisite chain
2. Run `/expand-graph oauth_fundamentals` to enrich that critical note
3. Run `/graph-validate` to verify all bidirectional links
š **Consider expanding:**
- fastmcp_authentication.md (added as example, may need more connections)
- csharp_mcp_auth.md (added as example, may need more connections)
š **Graph health:**
ā
All relationships bidirectional
ā
No orphaned nodes created
ā
Relationship types semantically appropriate
No new relationships found:
ā
Graph Analysis Complete
No new high-confidence relationships discovered for mcp_security.md
**Current coverage:**
- Prerequisites: 3 (comprehensive)
- Related Topics: 5 (well-connected)
- Extends: 1 (appropriate)
- Examples: 2 (good coverage)
- Alternatives: 1 (adequate)
**Analysis:**
- 93 notes examined
- 0 high-confidence matches found
- This note appears well-integrated
š” This is actually good news - the note is already well-connected!
Conflicting relationships:
ā ļø Potential Conflict Detected
[[mcp_architecture]] appears as both:
- Prerequisite (current)
- Should extend (suggested)
**Analysis:**
A note cannot both be a prerequisite AND be extended by the same note.
**Recommendation:**
Change to "extends" because:
- Security is specialized layer on architecture
- "extends" captures that security builds upon architecture
- Prerequisites should be for foundational knowledge
**Action:**
[Y] Accept recommendation (change to extends)
[N] Keep as prerequisite
[?] Explain difference between prerequisite and extends
Choice: ā
Circular dependency risk:
ā ļø Circular Dependency Warning
Adding [[note_a]] as prerequisite would create cycle:
mcp_security ā oauth_fundamentals ā mcp_implementation ā mcp_security
**Options:**
1. Don't add this relationship
2. Add as "related" instead of "prerequisite"
3. Review and break the existing cycle
Recommended: Option 2 (related instead)
Choice: ā
Quality principles:
Performance considerations:
User experience:
Execute graph expansion for the note provided by the user.