Migrate Logseq graphs to Obsidian vaults. Use when the user wants to convert their Logseq notes to Obsidian format, migrate from Logseq, or mentions both Logseq and Obsidian in a migration context...
Migrate Logseq graphs to clean Obsidian vaults while preserving content and structure.
First, find the Logseq graph. Check current directory for pages/ and journals/ folders:
ls -la
If not in a Logseq graph, ask the user for the path.
Run the analysis script to detect patterns:
python3 scripts/analyze_graph.py /path/to/logseq/graph --json
This outputs a JSON report of detected features (admonitions, block refs, properties, namespaces, etc.).
Check if a config file already exists:
cat /path/to/logseq/graph/.logseq-to-obsidian/config.json 2>/dev/null || echo "No config found"
If config exists, ask: "Found existing migration config. Use these settings, or reconfigure?"
If using existing config, skip to Step 4.
Based on analysis, ask ONLY the questions that matter. Skip questions for features not detected.
IMPORTANT: The AskUserQuestion tool has a maximum of 4 questions per call. If you have more than 4 questions, ask in multiple rounds. Never skip questions.
../obsidian-vault)pages/ subfolder?" (recommend root β cleaner structure)Parent/Child pages to folder hierarchy?"If no conditional questions are needed, skip Round 2.
Daily/ folder, YYYY-MM-DD.md formatcollapsed:: true β Removelogseq.order-list-type:: number β Standard numbered lists{:height X, :width Y} β RemoveAfter gathering preferences, create the config directory and write the config file:
mkdir -p /path/to/logseq/graph/.logseq-to-obsidian
Then use the Write tool to create /path/to/logseq/graph/.logseq-to-obsidian/config.json:
{
"version": 1,
"source": "/absolute/path/to/logseq/graph",
"output": "/absolute/path/to/obsidian/vault",
"preferences": {
"flattenTopLevel": false,
"namespacesToFolders": false,
"organizeByParent": false,
"pagesInRoot": false,
"blockRefs": "flag",
"journalsFolder": "Daily"
}
}
Important: Use absolute paths in the config file.
Always run dry-run first using the config:
python3 scripts/migrate.py --config /path/to/logseq/graph/.logseq-to-obsidian/config.json --dry-run
Show the user:
After user confirms:
python3 scripts/migrate.py --config /path/to/logseq/graph/.logseq-to-obsidian/config.json
The script:
.md files in pages/ and journals/assets/ folderAfter migration, provide:
Recommended Obsidian plugins for Logseq refugees:
Manual fixes needed (if any):
<!-- TODO: -->Quick start: "Open Obsidian β Open folder as vault β Select the output folder"
The config file is stored at .logseq-to-obsidian/config.json in the Logseq graph directory.
{
"version": 1,
"source": "/absolute/path/to/logseq/graph",
"output": "/absolute/path/to/obsidian/vault",
"preferences": {
"flattenTopLevel": false,
"namespacesToFolders": false,
"organizeByParent": false,
"pagesInRoot": false,
"blockRefs": "flag",
"journalsFolder": "Daily"
}
}
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
version |
number | No | 1 |
Config schema version |
source |
string | Yes | - | Absolute path to Logseq graph |
output |
string | Yes | - | Absolute path to output Obsidian vault |
preferences.flattenTopLevel |
boolean | No | false |
Convert top-level bullets to paragraphs |
preferences.namespacesToFolders |
boolean | No | false |
Convert A/B pages to folder hierarchy |
preferences.organizeByParent |
boolean | No | false |
Nest pages under their parent's folder (pages with exactly 1 incoming link) |
preferences.pagesInRoot |
boolean | No | false |
Place pages in vault root instead of pages/ folder |
preferences.blockRefs |
string | No | "flag" |
"flag" or "remove" |
preferences.journalsFolder |
string | No | "Daily" |
Folder name for journal files |
Users can edit the config file directly and re-run without going through questions again:
python3 scripts/migrate.py --config .logseq-to-obsidian/config.json
Or via the Node wrapper:
logseq-to-obsidian --config .logseq-to-obsidian/config.json
See references/patterns.md for complete LogseqβObsidian syntax mappings.
python3 scripts/analyze_graph.py <logseq-path> [--sample-size N] [--json]
--sample-size: Number of files to analyze (default: 50)--json: Output raw JSON only (for parsing)python3 scripts/migrate.py --config <config-file> [--dry-run] [--verbose]
python3 scripts/migrate.py <logseq-path> --output <obsidian-path> [options]
Config mode (recommended):
--config: Path to config JSON fileCLI mode options:
--dry-run: Preview without writing files--journals-folder NAME: Journal folder name (default: "Daily")--flatten-top-level: Convert top-level bullets to paragraphs--namespaces-to-folders: Convert A/B pages to A/B.md in folders--organize-by-parent: Nest pages under their parent's folder (pages linked from exactly one parent)--pages-in-root: Place pages in vault root instead of pages/ folder--block-refs [flag|remove]: How to handle block references (default: flag)--verbose: Show detailed progress