When to query and save to Graphiti knowledge graph. PROACTIVELY query before starting work. Save important decisions and patterns.
Queries and saves architectural decisions and patterns to a knowledge graph before and after coding tasks.
/plugin marketplace add geojaz/graphiti-context-hub/plugin install graphiti-context-hub@geojaz-graphiti-pluginsThis skill is limited to using the following tools:
Query PROACTIVELY:
Save Immediately After:
Step 1: Get config and repo context (run once):
[ -f "$HOME/.config/claude/graphiti-context-hub.conf" ] && source "$HOME/.config/claude/graphiti-context-hub.conf"
[ -f ".context-hub.conf" ] && source ".context-hub.conf"
GROUP_ID="${GRAPHITI_GROUP_ID:-main}"
REPO_NAME=$(git remote get-url origin 2>/dev/null | sed 's/.*\///' | sed 's/\.git$//' || basename "$PWD")
Step 2: Search Graphiti (use GROUP_ID from above):
# Search nodes (entities)
nodes_result = mcp__graphiti__search_nodes({
"query": "authentication patterns",
"group_ids": [GROUP_ID], # Always "main"
"max_nodes": 10
})
# Search facts (relationships)
facts_result = mcp__graphiti__search_memory_facts({
"query": "authentication flow",
"group_ids": [GROUP_ID],
"max_facts": 20
})
Step 1: Get config (if not already loaded):
[ -f "$HOME/.config/claude/graphiti-context-hub.conf" ] && source "$HOME/.config/claude/graphiti-context-hub.conf"
[ -f ".context-hub.conf" ] && source ".context-hub.conf"
GROUP_ID="${GRAPHITI_GROUP_ID:-main}"
REPO_NAME=$(git remote get-url origin 2>/dev/null | sed 's/.*\///' | sed 's/\.git$//' || basename "$PWD")
Step 2: Save episode with repo tagging:
# IMPORTANT: Prefix episode_body with "Repo: {REPO_NAME}\n\n"
result = mcp__graphiti__add_memory({
"name": "Auth Decision: JWT with httponly cookies",
"episode_body": f"""Repo: {REPO_NAME}
Decision: Using JWT tokens stored in httponly cookies.
Rationale:
- XSS protection via httponly flag
- CSRF protection via SameSite attribute
- Automatic token rotation on refresh
Implementation:
- Access token: 15 min expiry
- Refresh token: 7 day expiry
- Redis for token storage
""",
"group_id": GROUP_ID, # Always "main"
"source": "context-hub",
"source_description": "Architectural decision"
})
episode_id = result.get('episode_id', result.get('uuid'))
Key Pattern: Always prefix episode_body with Repo: {REPO_NAME}\n\n to tag which repository the memory belongs to.
Automatic Entity Extraction:
Search Capabilities:
Knowledge Graph Benefits:
Global config (optional): ~/.config/claude/graphiti-context-hub.conf
GRAPHITI_GROUP_ID=main
GRAPHITI_ENDPOINT=http://localhost:8000
Repo-level override (optional): .context-hub.conf
GRAPHITI_GROUP_ID=main
Defaults: GROUP_ID defaults to "main". Repo name is auto-detected from git remote.
Before implementing a feature:
# Search for related patterns
nodes = mcp__graphiti__search_nodes({
"query": f"implementing {feature_name}",
"group_ids": [GROUP_ID],
"max_nodes": 10
})
# Check for architectural decisions
facts = mcp__graphiti__search_memory_facts({
"query": f"{feature_name} architecture",
"group_ids": [GROUP_ID],
"max_facts": 20
})
After making a decision:
mcp__graphiti__add_memory({
"name": f"Decision: {decision_title}",
"episode_body": f"""Repo: {REPO_NAME}
Decision: {what_you_decided}
Context: {why_this_matters}
Rationale: {reasoning}
Trade-offs: {alternatives_considered}
""",
"group_id": GROUP_ID,
"source": "context-hub"
})
This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.