This project is a fork of the Foam VSCode extension to implement a smarter and more structured knowledge graph. The key goals are to enhance the visualization and semantic structure of personal wikis by integrating file hierarchy, custom node behavior, and improved UX into the Foam graph panel.
This document provides a high-level roadmap for the project.
-
Dual Relationship Model
- Show both:
- Reference links (
[[wikilinks]]
,#tags
, etc.) - Structural links (folder hierarchy, special parent-child relationships)
- Reference links (
- Show both:
-
Smarter Node Behavior
- Use
README.md
or designated index files as the main node for a folder. - Display clean and zoom-adaptive node titles (e.g. show only top-level folders when zoomed out).
- Use
-
Better UX and Control
- Highlight differences between structural and reference links visually.
- Let user toggle visibility and weight of structural/reference links.
- Provide an elegant, tree-first graph layout, with wikilinks bringing context-aware "cross-branches".
-
Start from the official Foam repo:
- GitHub: https://github.com/foambubble/foam
- Extension ID:
foam.foam-vscode
- The graph view lives in the WebView under
static/dataviz
, with supporting logic insrc/core/
.
-
Create a fork of the repo:
- Name:
neuchatech/foam
- Maintain easy upgradeability from upstream
- Isolate our custom logic in a
neuchatech
namespace or a feature flag if needed
- Name:
This section explains how to compile, install, and run this custom version of Foam.
- Node.js (version specified in
engines.node
inpackage.json
, currently>=18
) - Yarn
- Git
-
Clone the repository: If you haven't already, clone the
neuchatech-foam
repository (or your fork of it):git clone https://github.com/neuchatech/foam.git # Or your fork's URL cd neuchatech-foam
-
Install dependencies: From the root of the
neuchatech-foam
directory:yarn install
-
Build the extension: This command compiles all packages in the monorepo.
yarn build
-
Package the VSCode extension: This creates a
.vsix
file for thefoam-vscode
package.yarn package-extension
The packaged extension (e.g.,
foam-vscode-0.26.11.vsix
) will be located in theprojets/neuchatech-foam/packages/foam-vscode/
directory. The version number in the filename (currently0.26.11
as perpackages/foam-vscode/package.json
) might differ based on the current package version.
-
Uninstall or Disable Official Foam Extension: This fork currently uses the same extension ID (
foam.foam-vscode
) as the official Foam extension (defined inpackages/foam-vscode/package.json
). To avoid conflicts, you must uninstall or disable the official Foam extension from your VSCode instance before installing this fork. -
Install from VSIX:
- Open VSCode.
- Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X).
- Click on the "..." (More Actions) menu in the top-right corner of the Extensions view.
- Select "Install from VSIX..."
- Navigate to and select the
.vsix
file you created in the compilation step (e.g.,projets/neuchatech-foam/packages/foam-vscode/foam-vscode-0.26.11.vsix
). - VSCode will install the extension. You may need to reload VSCode.
Once installed, Neuchatech Foam will replace the standard Foam extension. You can use its features as you normally would with Foam, now including the enhanced graph visualization and other custom features detailed in this README.
Important Note on Extension ID:
As mentioned, this fork uses the ID foam.foam-vscode
. If you plan to use this fork alongside the official Foam extension or distribute it more widely, it is highly recommended to change the publisher
and/or name
fields in the packages/foam-vscode/package.json
file to create a unique extension ID (e.g., neuchatech.foam-custom
). This would allow both extensions to be installed simultaneously, though you would still need to manage which one is active for your workspace to avoid potential feature overlap or conflicts.
- For each note, create an edge from its parent folder (or index file) to itself.
- Create folder nodes (
id: "folder:/path/to/folder"
) for structure. - Use
README.md
or special files (e.g.index.md
,folder.md
) as the visual anchor node of a folder.
- Add
type: 'reference' | 'structural' | 'tag'
to each edge. - Render edges with type-aware styles and behaviors.
- Option 1: Add actual folder nodes.
- Option 2 (preferred): Use a note within the folder (e.g.
README.md
) as the node for the folder, and attach all structural links to that.
- Structural links: thicker, more stable spring force, gray color.
- Reference links: thinner, more flexible, blue or colored.
- Show only top-level folders and key nodes at low zoom.
- Gradually reveal child nodes' labels as you zoom in.
- Use force-directed simulation with stronger spring constants for structural edges.
- Ensure a quasi-tree layout that becomes radial at scale, but keeps structure readable.
- Toggle buttons for:
β Show Structural Links
β Show Reference Links
- Optional: show/hide tag nodes separately.
- Fork Foam repository to
neuchatech/foam
- Set up dev environment and local build process
- Rebrand extension (if needed) with namespace (e.g.
neuchatech.foam-viz
)
-
Modify
generateGraphData
to:- Include parent folder links
- Create synthetic folder nodes (if no README found)
- Recognize
README.md
orindex.md
as a folder root node
-
Tag all edges with
type: 'structural'
or'reference'
-
Update
graph.js
to:- Style structural edges differently
- Add toggles to control edge types
- Filter edges at draw time based on toggle states
-
Update layout algorithm:
- Assign higher strength to structural links
- Tune repulsion/spring constants for clarity
- Display simplified node labels at low zoom (e.g. only top folders)
- Add hover tooltips or node popups for additional info
- Use
README.md
or designated file as title node for folders
-
Add settings to
foam.graph.style
:structuralLineColor
structuralLineWidth
labelVisibilityZoomThresholds
-
Optional: Add metadata overrides via frontmatter (e.g.
parent:
ordisplayInGraph: false
)
- Custom edge types (e.g. manual
parent:
relationships in frontmatter) - Add a "breadcrumb" overlay on graph traversal
- Export graph snapshots as SVG or image
- Integration with GitHub README rendering
- Use mermaid graphs or YAML metadata for predefined structures
wiki/
βββ repice/
β βββ README.md β becomes node for "repice/"
β βββ pasta.md
β βββ cake.md
βββ research/
β βββ README.md β node for "research/"
β βββ foam-study.md
β βββ graph-algos.md
βββ index.md β global root node
Graph edges:
index.md β repice/README.md
(structural)repice/README.md β pasta.md
(structural)pasta.md β cake.md
(reference: if linked via[[cake]]
)
- Fork the Foam repo and clone locally
- Keep upstream compatibility in mind
- Document every change and push to the
neuchatech/foam
fork - Coordinate large refactors via issues in the new repo
Project Maintainer: You
Central Project File: projets/neuchatech-foam/README.md
For low-level implementation notes, refer to DR-implementation.md