Skip to main content

Sync a Knowledge Graph Across Machines

"My knowledge graph is on one machine. How do I get it on all of them?"

Access the same knowledge graph on multiple machines without manual file copying. You need KMGraph initialized on at least one machine and a git remote accessible from all machines.

Project KG

Project KGs sync automatically with the project's git remote. No additional setup is needed beyond git pull on each machine.

Personal KG

On the source machine:

cd ~/.kmgraph
git init
git remote add origin git@github.com:yourname/personal-kg.git
git add .
git commit -m "chore: initial personal KG sync"
git push -u origin main

On additional machines:

git clone git@github.com:yourname/personal-kg.git ~/.kmgraph

Then register the KG with KMGraph:

/kmgraph:init-personal-kg
# or
/kmgraph:switch personal

Ongoing sync:

# Pull latest from another machine
cd ~/.kmgraph && git pull

# Push captures done on this machine
git add . && git commit -m "chore: sync captures" && git push

Confirm with /kmgraph:recall "a lesson you captured on the first machine" — it should appear.

Automating sync

Add a post-commit hook to auto-push personal KG entries:

# ~/.kmgraph/.git/hooks/post-commit
#!/bin/bash
git push origin main --quiet

Make it executable: chmod +x .git/hooks/post-commit