Interact with your Logseq graph by directly reading and writing .md files on disk. No plugins, no HTTP APIs — just filesystem access to your Logseq graph directory.
text
Agent → Shell → Read/Write local `.md` files → Logseq reloads on next Cmd/Ctrl+R
Pure file operations. No HTTP APIs, no plugin bridges, no port listeners.
Your Logseq graph is stored as a local directory structure:
text
{graph_root}/
├── journals/ ← Daily notes *.md
├── pages/ ← Knowledge pages *.md
├── assets/ ← Images, attachments
├── logseq/ ← Config files
│ └── config.edn
└── .logseq/ ← Index database (auto-maintained)
└── graphs/
└── logseq_local_*.transit
What you need:
.logseq/ exists)Open Logseq → Settings → Advanced → Look for "Current graph directory"
bash
ls ~/.logseq/graphs/*.transit
# e.g.: logseq_local_E%3A+++Users++MyUser++Logseq.transit
The filename is URL-encoded. Decode it to find your path:
bash
# In WSL/Linux, mount the drive and set the path
export LQ="/mnt/c/Users/MyUser/Logseq"
Set the environment variable first:
bash
export LQ="/path/to/your/logseq/graph"
bash
DATE=$(date +%Y_%m_%d)
FILE="$LQ/journals/$DATE.md"
cat >> "$FILE" << 'EOF'
- 🦞 Note title
- Sub-item 1
- Sub-item 2
EOF
bash
cat "$LQ/journals/$(date +%Y_%m_%d).md"
# Or a specific date
cat "$LQ/journals/2026_04_25.md"
bash
cat "$LQ/pages/Page Name.md"
bash
# Search all pages
grep -ri "keyword" "$LQ/pages/"
# Search journals
grep -rn "keyword" "$LQ/journals/"
# Search the database index (faster)
strings ~/.logseq/graphs/*.transit | grep -i "keyword" | head -20
bash
cat > "$LQ/pages/New Page.md" << 'EOF'
title:: New Page
tags:: tag1, tag2
- Page content
- Sub content
EOF
bash
# Total journals
ls "$LQ/journals/" | wc -l
# Total pages
ls "$LQ/pages/" | wc -l
# Latest 5 journals
ls -t "$LQ/journals/" | head -5
Write notes in Logseq-compatible Markdown:
SyntaxExampleNoteBullet list- contentEvery line starts with - Indent children - child2-space indentBold**text**Standard MarkdownWiki link[[Page Name]]Auto-links pagesTag#tagnameAuto-indexedPropertykey:: valuePage or block-level propertyTODO markerTODO do somethingRenders as taskDONE markerDONE completedRenders as done
IssueDescriptionWorkaroundNo real-time refreshLogseq doesn't watch file changesPress Ctrl+Shift+R (or Cmd+Shift+R) to reloadStatic text readsReads raw .md, not block treeParse Markdown yourself for structured dataCloud sync delayGraph on OneDrive/Dropbox may lagWait a few seconds after writingSpecial characters in pathsChinese/Unicode charsWrap paths in double quotes
bash
# 1. Find your graph path in Logseq Settings → Advanced
# 2. Set the path
export LQ="/path/to/your/logseq/graph"
# 3. Write a test note
DATE=$(date +%Y_%m_%d)
echo "- 🎉 Logseq Bridge test successful!" >> "$LQ/journals/$DATE.md"
# 4. Reload Logseq (Ctrl+Shift+R or Cmd+Shift+R)
YYYY_MM_DD.md<< 'EOF' for multi-line content