Setting up and using Foam as a personal knowledge management system in VS Code
Foam
Foam is an extension that turns VS Code into a personal knowledge management system based on the Zettelkasten method, similar to Obsidian but integrated directly within VS Code.
Setup
- Install the Foam extension from the VS Code Marketplace.
- Alternatively, clone the
foam-templaterepository. - Ensure your workspace includes
.vscode/settings.jsonand.vscode/extensions.json.
Recommended complementary extensions:
- Markdown All in One — shortcuts, Table of Contents, and preview enhancements.
- Markdown Links — interactive clickable wikilinks.
- Paste Image — paste images directly from clipboard.
Wikilinks
Syntax reference:
Creating a new note: type [[new-note]] → press Ctrl+Click → Foam automatically creates the file.
Daily Notes
Execute Foam: Open Daily Note (Alt+D):
- Automatically generates a file using the format
yyyy-mm-dd.md. - Customize daily templates in
.foam/templates/daily-note.md.
Sample template:
Note Templates
Define custom templates inside .foam/templates/:
Trigger via command: Foam: Create New Note From Template
Tags
Organize content using tag annotations:
Use command Foam: Find notes by tag to filter workspace notes.
Graph Visualization
Execute Foam: Show Graph to view your interactive knowledge graph:
- Nodes represent notes.
- Edges represent wikilinks connecting notes.
- Filter node displays by folder or tag.
- Click any node to open the corresponding note.
Backlinks
The Backlinks panel in the sidebar displays all notes referencing the currently active note.
Useful for:
- Viewing contextual references surrounding a concept.
- Identifying orphan notes (notes with zero incoming links).
Front Matter Properties
Foam indexes front matter metadata for filtering and searching.
Placeholders & Variables
Available template variables:
Embedded Notes
Markdown previews render embedded note contents dynamically.
Recommended Workspace File Structure
Recommended Settings
Configuration for .vscode/settings.json:
Keyboard Shortcuts
Advanced Tips
- Zettelkasten IDs: Prefix filenames using timestamps (e.g.
202401151030-concept-name.md) for chronological sorting. - MOC (Map of Content): Create index notes listing links to related notes as an alternative to folder hierarchies.
- Git Integration: Commit notes regularly to maintain version history and backup copies.
- Publishing with VitePress: Use wikilinks while editing, then convert to relative Markdown links during deployment workflows.
- Orphan Notes: Run
Foam: Show Graphto identify unlinked nodes for periodic review.