Multi-KG Workflows
"I have knowledge that spans multiple projects. How do I manage more than one graph?"
KMGraph supports multiple knowledge graphs — project-local, personal, and cowork — each capturing a different scope of knowledge. KMGraph must be initialized (/kmgraph:init) and git configured before using multiple KGs.
KG types
| Type | Storage location | Shared with |
|---|---|---|
project-local | docs/ (in the project repo) | Anyone with repo access |
personal | ~/.kmgraph/ | Only the individual (synced via personal git remote) |
cowork | Configurable shared path | Team (synced via shared git remote) |
custom | Any path | Configured per instance |
View and switch
/kmgraph:list
Shows all configured KGs and which is currently active.
/kmgraph:switch personal
/kmgraph:switch project-local
/kmgraph:switch cowork
All capture and recall commands operate on the active KG.
Run /kmgraph:status to confirm the active KG and entry count, or /kmgraph:list to see all registered KGs.
Set up a personal KG
/kmgraph:init-personal-kg
Creates ~/.kmgraph/ and registers it. Use this for patterns that apply across all projects.
Set up a cowork KG
Edit ~/.claude/kg-config.json:
{
"graphs": {
"cowork": {
"type": "cowork",
"path": "/path/to/shared/kg",
"gitStrategy": "commit"
}
}
}
Then switch to it: /kmgraph:switch cowork
gitStrategy controls what happens to entries after capture:
| Value | Behavior |
|---|---|
commit | Auto-commits each new entry |
stage | Stages entry but does not commit |
ignore | Creates the file but does not touch git |
Set per-KG in kg-config.json under the graphs[name] block.
Capture without switching
/kmgraph:capture-lesson --targetKg personal
/kmgraph:capture-lesson --targetKg project-local
Search across all KGs
/kmgraph:recall --all "search terms"
Related
- Sync Across Machines — keep KGs in sync on multiple machines
- Sanitize Before Sharing — scrub sensitive data from a shared KG
- Graph Configuration — full
kg-config.jsonschema