Add a typed bidirectional relationship between two notes
Adds a bidirectional typed relationship between two notes in the knowledge graph.
/plugin marketplace add witt3rd/claude-plugins/plugin install azkg@witt3rd-claude-pluginsManually add a typed relationship between two notes with bidirectional update.
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:
User provides:
agents.mdsemantic_routing.mdrelated_topics (or prerequisites, extends, alternatives, examples)Example: /graph-add-relationship agents semantic_routing related_topics "Enables model selection"
prerequisites - Target must be understood firstrelated_topics - Connected ideas at same levelextends - Source builds upon targetalternatives - Different approaches to same problemexamples - Target is concrete implementation of sourceEnsure both filenames have .md extension.
Use Glob to verify both files exist:
Glob "agents.md"
Glob "semantic_routing.md"
Use Read tool to get source note content, including current "Related Concepts" section.
Use Edit tool to add relationship to appropriate section in source note:
## Related Concepts
### Related Topics
- [[existing_note]] - Existing relationship
- [[semantic_routing]] - Enables intelligent model selection for agent tasks
Use Read tool to get target note content, including current "Related Concepts" section.
Determine inverse relationship type:
prerequisites in A → add A to related_topics or extended_by in B (depending on context)related_topics in A → add A to related_topics in Bextends in A → add A to extended_by in Balternatives in A → add A to alternatives in Bexamples in A → add A to extended_by or related_topics in BUse Edit tool to add inverse relationship to target note.
Show what was added to both files.
Added Relationship
============================================================
✓ Forward relationship:
agents.md → semantic_routing.md
Type: related_topics
Why: Enables intelligent model selection for agent tasks
✓ Inverse relationship:
semantic_routing.md → agents.md
Type: related_topics
Why: Agents use semantic routing for task delegation
============================================================
✅ Relationship Added!
============================================================
Updated files:
• agents.md - Added to "Related Topics" section
• semantic_routing.md - Added to "Related Topics" section
💡 Next steps:
• Review both notes to verify relationships make sense
• Use `/graph-note agents.md` to see all relationships
• Use `/graph-validate` to check bidirectionality
Before adding:
After adding:
| Forward Type | Inverse Type | Notes |
|---|---|---|
| prerequisites | related_topics or extended_by | Context dependent |
| related_topics | related_topics | Symmetric |
| extends | extended_by | Clear inverse |
| alternatives | alternatives | Symmetric |
| examples | extended_by | Examples extend the concept |
/graph-validate if unsure about bidirectionality