Why Use External Editors?
- AI coding agents - Claude Code, Cursor, Windsurf can read and edit your notes
- Advanced text editing - Vim, Emacs, VS Code with custom extensions
- Automation scripts - Process notes with Python, Node.js, shell scripts
- Bulk operations - Rename, search/replace, or format multiple files at once
Scratch’s file watcher runs continuously when a notes folder is set. External changes appear in Scratch within 500ms (debounced per file).
File Watcher Implementation
Scratch uses the Rustnotify crate to watch your notes folder for changes:
How It Works
- Recursive watching - Monitors the entire notes folder (up to 10 levels deep)
- Event debouncing - Groups rapid changes (500ms window per file)
- Change detection - Detects create, modify, and delete events
- Frontend notification - Emits
file-changeevents to the UI - Auto-reload - Reloads the current note if changed externally
What’s Watched
All.md files except those in excluded folders:
.git(Git metadata).scratch(App settings).obsidian(Obsidian vault).trash(Deleted notes)assets(Images and attachments)
Using External Text Editors
Quick Edit Workflow
Open in Editor
Right-click a note in Scratch’s sidebar and select Reveal in File Manager. Then open the
.md file in your preferred editor.Recommended Editors
| Editor | Best For | Setup |
|---|---|---|
| VS Code | Markdown extensions, AI plugins | Install Markdown Preview Enhanced |
| Vim/Neovim | Keyboard-driven editing | Use markdown plugins like vim-markdown |
| Sublime Text | Fast, lightweight editing | Install Markdown Extended package |
| Obsidian | Graph view, community plugins | Open same folder as Scratch |
| iA Writer | Distraction-free writing | Set notes folder as library |
AI Agent Integration
Scratch works seamlessly with AI coding agents that can read and write files:Claude Code (Anthropic)
Claude can read your notes, answer questions, and make edits:- Install Claude Code CLI from claude.ai
- Run
claudein your notes folder - Scratch auto-reloads when Claude saves changes
Cursor / Windsurf
AI-first code editors can edit notes like source code:GitHub Copilot Workspace
Use Copilot to generate note content:- Open your notes folder in VS Code
- Create a new
.mdfile - Write a prompt as a comment:
<!-- Generate a book summary for "Atomic Habits" --> - Copilot generates the summary
- Save the file - Scratch adds it to the note list
Automation Scripts
Example: Daily Note Generator
Create daily notes automatically with a shell script:Example: Markdown Linter
Fix markdown formatting across all notes:Example: Note Tagger (Python)
Add tags to notes based on content:Scratch’s file watcher handles frontmatter changes gracefully. The editor shows the rendered note (frontmatter hidden), while source mode shows the raw YAML.
File Watcher Behavior
Reload Logic
When an external change is detected:- Debounce check - Waits 500ms for additional changes to the same file
- Self-save detection - Ignores changes from Scratch’s own saves
- Notification - Shows “External changes detected” toast
- Auto-reload - If the changed note is currently open, shows reload prompt
Manual Reload
If auto-reload doesn’t trigger:- Single note: Press
Cmd+Ror click the Reload button (↻) - All notes: Close and reopen Scratch
- Search index: Search automatically rebuilds on file changes
External Change Detection
Current Note Detection
Scratch shows a banner when the open note changes externally:- Reload - Fetches the latest content from disk (discards unsaved changes)
- Dismiss - Keeps the current editor content (your version)
Sidebar Refresh
The note list refreshes automatically when:- A new
.mdfile is created - A note is deleted externally
- A note’s title (first
# Heading) changes
Conflict Resolution
If you edit the same note in Scratch and externally:Scenario 1: External Edit While Not Editing
✅ Safe - Scratch reloads the note seamlesslyScenario 2: External Edit While Editing
⚠️ Conflict - Scratch shows the reload banner. Choose:- Reload - Accept external changes (lose your unsaved edits)
- Dismiss - Keep your version (save to overwrite external changes)
Scenario 3: Simultaneous Edits
❌ Last save wins - No merge conflict UI. Use Git for version control if this is common.Combining Scratch with Obsidian
Many users run Scratch and Obsidian on the same notes folder:Setup
What Works
- ✅ Basic Markdown - Both editors support standard Markdown
- ✅ Wikilinks -
[[Note Title]]works in both - ✅ Images - Both use
syntax - ✅ Frontmatter - YAML metadata is preserved
What Doesn’t Work
- ❌ Obsidian plugins - Dataview, Templater, etc. are Obsidian-specific
- ❌ Canvas files - Scratch doesn’t support
.canvasformat - ❌ Embedded queries - Obsidian’s
queryblocks won’t render in Scratch
Scratch focuses on fast, distraction-free writing. Use Obsidian for graph view, advanced queries, and community plugins.
Performance Considerations
Large Note Collections
The file watcher is optimized for thousands of notes:- Efficient recursion - Only watches note folders (excludes
.git, etc.) - Debouncing - Prevents event spam from rapid saves
- Incremental index updates - Search index updates per-file, not full rebuild
High-Frequency Edits
If an external tool edits files rapidly (e.g., live sync):- Debounce prevents thrashing - Multiple edits within 500ms are batched
- Reload only if viewing - Sidebar updates don’t disrupt the editor
Disabling File Watching
File watching cannot be disabled (by design). If you need to pause it:- Close Scratch
- Make bulk changes
- Reopen Scratch - notes and search index refresh on startup
Troubleshooting
”File watcher failed to start”
Cause: OS file descriptor limit exceeded (macOS/Linux). Fix: Increase the limit:Notes not auto-reloading
- Check file watcher status - Restart Scratch
- Verify file changes - Save the file in your external editor
- Manual reload - Press
Cmd+R
High CPU usage
Cause: Too many file change events (e.g., live sync). Fix: Exclude the sync folder from Scratch’s notes folder or disable live sync temporarily.Best Practices
- Close before bulk operations - Avoid overwhelming the file watcher
- Use Git for versioning - External edits don’t create undo history in Scratch
- Test on a subset first - When running automation scripts, test on a few notes
- Keep backups - External tools can corrupt files; Git or Time Machine saves the day
- Communicate intent - If using AI agents, review changes before closing Scratch