Loading...
Loading...
Use pkm for personal knowledge management with temporal awareness, quality filtering, hybrid search, and relationship tracking with LSP and MCP server integration.
npx skill4agent add lanej/dotfiles pkmpkmpkm# Search workspace documents
pkm search "kubernetes deployment strategies"
# Search with quality filters
pkm search --facts-only --fresh-only "API authentication"
# Search with result limit
pkm search -n 5 "error handling patterns"# Index current directory (both titles and content)
pkm index
# Index specific directory
pkm index ~/Documents/notes/
# Index specific files
pkm index note1.md note2.md# Index both titles and content (default)
pkm index ./notes/
# Index only titles (LSP autocomplete)
pkm index --titles-only ./notes/
# Index only content (search)
pkm index --content-only ./notes/
# Index to specific table
pkm index --table my_knowledge ./notes/
# Index specific file extensions
pkm index --extensions md,txt,pdf ./documents/
# Force re-index
pkm index --force ./notes/# Pipe file paths to index
find ~/Documents -name "*.md" -mtime -7 | pkm index --stdin
# From git changed files
git diff --name-only main | grep "\.md$" | pkm index --stdin# Vector + BM25 full-text search
pkm index ./notes/# Skip BM25 (faster indexing, semantic search only)
pkm index --no-hybrid ./notes/# Quiet mode (suppress progress)
pkm index --quiet ./large-corpus/
# Dry run (see what would be indexed)
pkm index --dry-run ./notes/
# Verbose logging
pkm index -v ./notes/# Basic search
pkm search "machine learning algorithms"
# Limit results
pkm search -n 10 "API design patterns"
# Set minimum score threshold
pkm search --min-score 0.1 "database optimization"
# Specify database path
pkm search --db-path ~/my-db "query"
# Specify workspace root
pkm search --workspace-root ~/Documents "query"
# Custom table name
pkm search --table-name custom_table "query"# Show only facts
pkm search --info-type fact "kubernetes architecture"
pkm search --facts-only "docker commands"
# Show only analysis
pkm search --info-type analysis "performance bottlenecks"
# Show only ideas
pkm search --info-type idea "feature proposals"# High certainty only
pkm search --certainty high "security best practices"
# Medium certainty
pkm search --certainty medium "migration strategies"
# Low certainty (speculative)
pkm search --certainty low "future trends"# Maximum age in days
pkm search --max-age 30 "recent updates"
# Only fresh documents
pkm search --fresh-only "current status"
# Exclude stale documents
pkm search --exclude-stale "active projects"# Facts from last 30 days
pkm search \
--facts-only \
--max-age 30 \
"authentication implementation"
# High certainty analysis (fresh)
pkm search \
--info-type analysis \
--certainty high \
--fresh-only \
"performance optimization"
# Recent ideas with threshold
pkm search \
--info-type idea \
--max-age 14 \
--min-score 0.15 \
-n 5 \
"feature enhancements"# Text output (default)
pkm search "query"
# JSON output for scripting
pkm search --output json "query" | jq '.results[] | .path'
# Verbose logging
pkm search -v "query"# Show all links from a document
pkm relationships --source notes/architecture.md
# Filter by relationship type
pkm relationships --source notes/api.md --rel-type wikilink
# JSON output
pkm relationships --source notes/design.md --output json# Show what links to a document
pkm backlinks notes/concepts/auth.md
# Filter by relationship type
pkm backlinks notes/api-spec.md --rel-type reference
# JSON output
pkm backlinks notes/design.md --output json# Find related documents
pkm relationships --source current-work.md
# Discover document impact
pkm backlinks important-concept.md
# Build knowledge graph
pkm relationships --source index.md --output json | \
jq '.relationships[] | .target'
# Find orphaned documents (no backlinks)
pkm backlinks my-note.md | grep -q "No backlinks" && \
echo "Orphaned document"# Index document for relationship tracking
pkm index-doc notes/new-concept.md
# With custom database
pkm index-doc --db-path ~/kb notes/article.md
# Verbose output
pkm index-doc -v notes/research.md# Audit entire workspace
pkm quality-audit
# Audit specific area/topic
pkm quality-audit --area kubernetes
# JSON output
pkm quality-audit --output json
# Verbose audit
pkm quality-audit -v# Find documents exceeding freshness threshold
pkm find-stale
# With workspace root
pkm find-stale --workspace-root ~/Documents/notes
# Verbose output
pkm find-stale -v# Show documents needing review
pkm verify-queue
# With specific workspace
pkm verify-queue --workspace-root ~/kb
# Verbose output
pkm verify-queue -v# Show basic stats
pkm stats
# Detailed breakdown by file extension
pkm stats -d
# Detailed stats with custom database
pkm stats --db-path ~/my-kb -d
# JSON output
pkm stats --output json# List all tables in database
pkm tables
# With custom database path
pkm tables --db-path ~/my-kb
# Verbose output
pkm tables -v# Start LSP server for editor integration
pkm lsp
# With verbose logging
pkm lsp -v# Start MCP server
pkm mcp
# With verbose logging
pkm mcp -v# Set default database path
export PKM_DB_PATH=~/my-knowledge-base
pkm search "query"
# Set workspace root
export PKM_ROOT=~/Documents/notes
pkm index
# Both together
export PKM_DB_PATH=~/kb
export PKM_ROOT=~/notes
pkm search "query"# 1. Index your workspace
cd ~/Documents/notes
pkm index
# 2. Check statistics
pkm stats -d
# 3. Test search
pkm search "recent projects"
# 4. Run quality audit
pkm quality-audit# 1. Find stale documents to review
pkm find-stale
# 2. Search for high-quality facts
pkm search --facts-only --certainty high "project status"
# 3. Index new/modified documents
find . -name "*.md" -mtime -1 | pkm index --stdin
# 4. Check relationships
pkm relationships --source today-notes.md# 1. Search for recent analysis
pkm search \
--info-type analysis \
--max-age 30 \
--certainty high \
-n 20 \
"performance optimization"
# 2. Find related documents
pkm relationships --source research-notes.md
# 3. Discover citations
pkm backlinks key-concept.md
# 4. Export for review
pkm search --output json "research topic" | \
jq '.results[] | {path, score, summary}' > research.json# 1. Find documents needing review
pkm verify-queue
# 2. Run quality audit
pkm quality-audit --output json > audit-results.json
# 3. Find stale content
pkm find-stale
# 4. Re-index updated documents
pkm index --force ./updated-notes/
# 5. Verify improvements
pkm stats -d# 1. Find recently modified files
find ~/notes -name "*.md" -mtime -7 > recent.txt
# 2. Index only recent changes
pkm index --stdin < recent.txt
# 3. Search fresh content
pkm search --max-age 7 "latest updates"
# 4. Update statistics
pkm stats -d# Index files changed in current branch
git diff --name-only main | \
grep "\.md$" | \
pkm index --stdin
# Index uncommitted changes
git diff --name-only | \
grep "\.md$" | \
pkm index --stdin
# Re-index entire repository
pkm index --force .pkm index --titles-only ~/notes/pkm index --content-only ~/important-docs/pkm index ~/knowledge-base/pkm search --facts-only --certainty high "API endpoints"pkm search --info-type analysis --max-age 14 "optimization"pkm search --info-type idea --exclude-stale "features"# Regular freshness check
pkm find-stale
# Periodic re-indexing
pkm index --force ./active-projects/
# Exclude stale from searches
pkm search --exclude-stale "current work"# After creating new note with wikilinks
pkm index-doc new-note.md
pkm relationships --source new-note.md
# Understand impact before editing
pkm backlinks important-concept.md# Weekly audit
pkm quality-audit --output json > audit-$(date +%Y%m%d).json
# Area-specific review
pkm quality-audit --area architecture
# Track verification queue
pkm verify-queue# Index markdown notes
pkm index --extensions md ~/notes/
# Include PDFs and markdown
pkm index --extensions md,pdf ~/research/
# Text files only
pkm index --extensions txt ~/logs/pkm search --min-score 0.05 "general topic"pkm search --min-score 0.1 "specific concept"pkm search --min-score 0.2 "exact information"~/Library/Application Support/Claude/claude_desktop_config.json{
"mcpServers": {
"pkm": {
"command": "pkm",
"args": ["mcp"],
"env": {
"PKM_ROOT": "/Users/username/Documents/notes",
"PKM_DB_PATH": "/Users/username/.pkm/db"
}
}
}
}pkm lsp# Work with multiple knowledge bases
pkm search --db-path ~/work-kb "work queries"
pkm search --db-path ~/personal-kb "personal queries"
# Separate workspace and database
pkm index \
--workspace-root ~/Documents/notes \
--db-path ~/kb/notes-index# Daily index automation
#!/bin/bash
cd ~/notes
find . -name "*.md" -mtime -1 | pkm index --quiet --stdin
pkm stats --output json > ~/stats/$(date +%Y%m%d).json
# Weekly quality report
#!/bin/bash
pkm quality-audit --output json > audit.json
pkm find-stale > stale.txt
pkm verify-queue > queue.txt# Process multiple directories
for dir in ~/notes/*/; do
echo "Indexing $dir"
pkm index "$dir"
done
# Selective re-indexing
pkm stats --output json | \
jq -r '.tables[] | select(.doc_count < 10) | .name' | \
xargs -I {} pkm index --force --table {}# Check if content is indexed
pkm stats -d
# Lower score threshold
pkm search --min-score 0.01 "query"
# Remove quality filters
pkm search "query" # No filters
# Verify database path
pkm search --db-path ~/kb -v "query"# Force re-index
pkm index --force .
# Check verbose output
pkm find-stale -v
# Verify workspace root
pkm find-stale --workspace-root ~/notes# Index document for relationships
pkm index-doc document.md
# Verbose indexing
pkm index-doc -v document.md
# Re-index entire workspace
pkm index --force .# Enable hybrid search (vector + BM25)
pkm index . # Default is hybrid
# Adjust filters
pkm search --min-score 0.05 "query"
# Check for sufficient indexed content
pkm stats -d# Verify server starts
pkm lsp -v
pkm mcp -v
# Check environment variables
echo $PKM_ROOT
echo $PKM_DB_PATH
# Restart server
pkill -f "pkm lsp"
pkm lsp -v# Indexing
pkm index # Index current directory
pkm index ~/notes/ # Index specific directory
pkm index --titles-only ~/notes/ # Titles only (LSP)
pkm index --force ~/notes/ # Force re-index
pkm index --extensions md,pdf ~/docs/ # Specific file types
# Searching
pkm search "query" # Basic search
pkm search -n 10 "query" # Limit results
pkm search --facts-only "query" # Facts only
pkm search --fresh-only "query" # Fresh only
pkm search --certainty high "query" # High certainty
pkm search --max-age 30 "query" # Last 30 days
# Relationships
pkm relationships --source note.md # Show outgoing links
pkm backlinks note.md # Show incoming links
pkm index-doc note.md # Index for relationships
# Quality management
pkm quality-audit # Audit workspace
pkm find-stale # Find stale documents
pkm verify-queue # Documents needing review
pkm stats -d # Detailed statistics
# Servers
pkm mcp # Start MCP server
pkm lsp # Start LSP server
# Output formats
pkm search --output json "query" # JSON output
pkm stats --output json # JSON stats
pkm quality-audit --output json # JSON auditpkm search --facts-only --certainty high -n 5 "API authentication"pkm search --info-type analysis --max-age 30 --fresh-only "optimization"pkm relationships --source research.md && \
pkm backlinks research.mdfind . -name "*.md" -mtime -1 | pkm index --quiet --stdin && \
pkm find-stalepkm search \
--facts-only \
--certainty high \
--fresh-only \
--min-score 0.15 \
-n 10 \
"deployment procedures"pkm index ~/notes/pkm search --facts-only --fresh-only "query"pkm relationships --source note.mdpkm quality-auditpkm stats -d