Integrations
Connect LoreHub with your development tools and workflow.
AI Assistants
Claude Desktop (MCP)
LoreHub includes a Model Context Protocol (MCP) server, allowing Claude Desktop to access your knowledge base.
Install LoreHub Globally
npm install -g lorehubFind Installation Path
npm list -g lorehub
# Note the path, e.g., /usr/local/lib/node_modules/lorehubConfigure Claude Desktop
Add to your Claude Desktop configuration:
macOS
Location: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"lorehub": {
"command": "node",
"args": ["/usr/local/lib/node_modules/lorehub/dist/mcp/index.js"]
}
}
}Restart Claude Desktop
After updating the configuration, restart Claude Desktop.
Use in Conversations
Claude can now:
- Search your lores: “What do we know about caching?”
- Add new knowledge: “Remember this decision about…”
- Find related lores: “Show me similar decisions”
- Analyze patterns: “What are our main technical risks?”
The MCP integration allows Claude to search and read your lores but not modify them directly, maintaining security.
IDE Integration
VS Code
While an official extension is coming soon, you can integrate LoreHub using VS Code’s built-in features.
Tasks Configuration
Create .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "LoreHub: Browse",
"type": "shell",
"command": "lh",
"args": ["browse"],
"presentation": {
"reveal": "always",
"focus": true,
"panel": "dedicated"
}
},
{
"label": "LoreHub: Add Lore",
"type": "shell",
"command": "lh",
"args": ["add"],
"presentation": {
"reveal": "always",
"focus": true
}
},
{
"label": "LoreHub: Search",
"type": "shell",
"command": "lh",
"args": ["search", "${input:searchTerm}"],
"presentation": {
"reveal": "always"
}
}
],
"inputs": [
{
"id": "searchTerm",
"type": "promptString",
"description": "Search for..."
}
]
}Keyboard Shortcuts
Add to .vscode/keybindings.json:
[
{
"key": "cmd+shift+l",
"command": "workbench.action.tasks.runTask",
"args": "LoreHub: Browse"
},
{
"key": "cmd+shift+a",
"command": "workbench.action.tasks.runTask",
"args": "LoreHub: Add Lore"
}
]Terminal Integration
Bash/Zsh Aliases
Add to ~/.bashrc or ~/.zshrc:
# Quick add functions
lha() { lh add "$@"; }
lhd() { lh add "$@" --type decree; }
lhw() { lh add "$@" --type wisdom; }
lhr() { lh add "$@" --type risk; }
lhq() { lh add "$@" --type quest; }
# Search shortcuts
lhs() { lh search "$@" --semantic; }
lhl() { lh search "$@"; } # literal (default)
# Browse current realm
alias lhb="lh browse --current"
# Export for backup
alias lhbackup="lh export --output ~/lorehub-backup-$(date +%Y%m%d).json"Fish Shell
Add to ~/.config/fish/config.fish:
# Quick add abbreviations
abbr -a lha 'lh add'
abbr -a lhd 'lh add --type decree'
abbr -a lhw 'lh add --type wisdom'
# Browse function
function lhb
lh browse --current
end
# Notify on directory change
function cd
builtin cd $argv
if test -d .git
echo "💡 LoreHub tip: Run 'lh browse' to see knowledge for this repo"
end
endGit Integration
Git Hooks
Pre-commit Hook
Create .git/hooks/pre-commit:
#!/bin/bash
# Remind to document significant changes
files_changed=$(git diff --cached --numstat | wc -l)
if [ $files_changed -gt 10 ]; then
echo "📝 Large commit detected!"
echo "Consider documenting:"
echo " - Key decisions made"
echo " - Patterns introduced"
echo " - Lessons learned"
echo ""
echo "Run: lh add"
fiPost-merge Hook
Create .git/hooks/post-merge:
#!/bin/bash
# Show recent lores after merge
echo "📚 Recent team knowledge:"
lh list --limit 5Git Aliases
Add to ~/.gitconfig:
[alias]
# Add lore about current changes
lore = "!f() { lh add \"$1\" --type wisdom; }; f"
# Document decision before commit
decide = "!f() { lh add \"$1\" --type decree --confidence 90; }; f"CI/CD Integration
GitHub Actions
Create .github/workflows/knowledge-capture.yml:
name: Knowledge Capture
on:
pull_request:
types: [closed]
issues:
types: [labeled, closed]
jobs:
capture-pr-decisions:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install LoreHub
run: npm install -g lorehub
- name: Capture Decision
run: |
# Extract decision from PR description
TITLE="${{ github.event.pull_request.title }}"
BODY="${{ github.event.pull_request.body }}"
PR_NUM="${{ github.event.pull_request.number }}"
# Add as decree
lh add "$TITLE" \
--type decree \
--why "PR #$PR_NUM: $BODY" \
--confidence 85
capture-bug-report:
if: |
github.event.issue.labels.*.name contains 'bug' &&
github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install -g lorehub
- name: Document Bug
run: |
TITLE="${{ github.event.issue.title }}"
lh add "Bug: $TITLE" \
--type anomaly \
--why "Issue #${{ github.event.issue.number }}"GitLab CI
Add to .gitlab-ci.yml:
stages:
- knowledge
capture-decisions:
stage: knowledge
image: node:18
only:
- merge_requests
script:
- npm install -g lorehub
- |
if [[ "$CI_MERGE_REQUEST_TITLE" == *"[DECISION]"* ]]; then
DECISION="${CI_MERGE_REQUEST_TITLE/\[DECISION\]/}"
lh add "$DECISION" \
--type decree \
--why "MR !$CI_MERGE_REQUEST_IID"
fiShell Productivity
fzf Integration
For fuzzy searching lores (requires fzf ):
# Add to ~/.bashrc or ~/.zshrc
lhf() {
local lore=$(lh export --format json | \
jq -r '.lores[] | "\(.type): \(.content)"' | \
fzf --preview 'echo {}' --preview-window down:3:wrap)
if [ -n "$lore" ]; then
echo "$lore" | pbcopy
echo "📋 Copied to clipboard"
fi
}Directory-specific Hooks
Using direnv :
Create .envrc in project root:
# Show project-specific lores on enter
echo "📚 Project Knowledge:"
lh list --current --limit 3
# Add project-specific aliases
alias decide="lh add --type decree --confidence 90"
alias learned="lh add --type wisdom"Team Collaboration
Slack Integration
Using webhooks to share knowledge:
#!/bin/bash
# share-lore.sh
WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
LORE_CONTENT=$(lh list --limit 1 --format json | jq -r '.lores[0].content')
LORE_TYPE=$(lh list --limit 1 --format json | jq -r '.lores[0].type')
curl -X POST $WEBHOOK_URL \
-H 'Content-type: application/json' \
--data "{
\"text\": \"📚 Team Knowledge Update\",
\"attachments\": [{
\"color\": \"good\",
\"fields\": [
{\"title\": \"Type\", \"value\": \"$LORE_TYPE\", \"short\": true},
{\"title\": \"Content\", \"value\": \"$LORE_CONTENT\"}
]
}]
}"Documentation Sites
Generate markdown for your docs:
#!/bin/bash
# generate-docs.sh
# Export decisions for architecture docs
lh export --format md --type decree > docs/decisions.md
# Export lessons learned
lh export --format md --type wisdom > docs/lessons.md
# Export current risks
lh list --type risk --format md > docs/risks.mdDatabase Access
Direct SQLite Access
For advanced queries or integrations:
# Open database in SQLite
sqlite3 ~/.lorehub/lorehub.db
# Example: Find most confident decisions
sqlite> SELECT content, confidence
FROM lores
WHERE type = 'decree'
ORDER BY confidence DESC
LIMIT 10;Python Integration
import sqlite3
import json
def get_recent_lores(limit=10):
conn = sqlite3.connect(os.path.expanduser('~/.lorehub/lorehub.db'))
cursor = conn.cursor()
cursor.execute("""
SELECT id, content, type, confidence, created_at
FROM lores
ORDER BY created_at DESC
LIMIT ?
""", (limit,))
lores = []
for row in cursor.fetchall():
lores.append({
'id': row[0],
'content': row[1],
'type': row[2],
'confidence': row[3],
'created_at': row[4]
})
conn.close()
return loresNode.js Integration
const { exec } = require('child_process');
const util = require('util');
const execPromise = util.promisify(exec);
class LoreHubClient {
async search(query, options = {}) {
const args = ['search', query];
if (options.semantic) args.push('--semantic');
if (options.type) args.push('--type', options.type);
if (options.limit) args.push('--limit', options.limit);
const { stdout } = await execPromise(`lh ${args.join(' ')} --format json`);
return JSON.parse(stdout);
}
async add(content, options = {}) {
const args = ['add', content];
if (options.type) args.push('--type', options.type);
if (options.confidence) args.push('--confidence', options.confidence);
await execPromise(`lh ${args.join(' ')}`);
}
}
// Usage
const lh = new LoreHubClient();
const results = await lh.search('authentication', { semantic: true });Monitoring & Analytics
Track Knowledge Growth
#!/bin/bash
# knowledge-stats.sh
echo "📊 LoreHub Statistics"
echo "===================="
# Total lores
TOTAL=$(lh list --format json | jq '.lores | length')
echo "Total Lores: $TOTAL"
# By type
echo -e "\nBy Type:"
lh list --format json | jq -r '.lores | group_by(.type) | .[] | "\(.[0].type): \(length)"'
# Recent activity
echo -e "\nLast 7 days:"
lh list --format json | jq -r '.lores | map(select(.created_at > (now - 604800))) | length'Best Practices
- Automate capture: Use git hooks and CI/CD to capture decisions
- Quick access: Set up aliases for common operations
- Team sharing: Export and share knowledge regularly
- AI assistance: Use MCP with Claude for knowledge discovery
- Backup regularly: Automate exports for disaster recovery
Next Steps
- Review the API Reference for programmatic access
- Check Commands for all CLI options
- Read Guides for workflow best practices