Virtual files: for plugin interop and external resources

Use case or problem

Two issues:

  • Communication between plugins is quite poor. Example: TaskNote don’t work with tasks, one can’t import inline tasks into bases. It is not possible (afaik) to use spaced repetition card from another plugin, .. .

  • Importing external resources is hard: for external resources, plugin author have to build both the data extractor and the ui interface. Then, users can’t use another interface or pair it with other sources

Proposed solution

Adding a pretty simple api: plugins would be able to create virtual files, and other plugin would then read them.

A virtual file would be pretty much like a physical file:

  • A title, a content
  • A bunch of properties
  • Metadatas (such as created date, ..)
  • A flag to indicate that it is not an on-disk file

Plugins would then, at startup or later, register their files into the system.

Then, plugin such as bases, calendars, .. would display them like regular files, without caring about the plugin that created the file

Usescases examples

  • A task plugin would export each individual task (even if those are inline tasks, or externally managed such as with CalDav), a flashcard plugin would export cards, a mail system may export mails, ..
  • One could then import tasks (google events, inline tasks, caldav, ticktick) in bases, dataview, …

Concerns

Speed

There would be no io involved for this specifically, so it should be fast, even if there are thousands of small virtual files.

Complexity

For users: as it would basically be a bunch of files, it would be straightforward to use: you take your favorite query plugin, such as dataview, and tell it to filter files from a certain source.

For plugin developers: the api don’t have to be complicated: query systems from tags, .. already exists, and creating a file would just be filling a bunch of fields. Moreover, as plugins already have the datas, it should be possible to implement it on top of existing plugins.

For obsidian developers: Again, most systems already exists

Writable virtual files

It would require a callback from the virtual file source, otherwize the file would be read-only

Links

Links would require the source to give a stable id one way or another

Current workaround (optional)

  • It is possible to put an adapter on top on the filesystem used by obsidian (see the Folder Bridge plugin). However, it is probably slower, and each plugin would need to use that trick.
  • Each plugin can implement it’s own solutions, but it means that among

Related feature requests (optional)

Virtual notes for Bases would be solved by a simple plugin

Many requests around caldav support, bases supporting X

A public virtual-file API would also help plugins that need ordinary links and embeds to reach content which should never become a physical vault file. Three concrete use cases came up in plugin-development discussions in January 2025:

  1. A plugin manual or generated canvas built entirely in memory.
  2. Embedding content from outside the vault through a plugin-provided reader, without first copying it into the vault.
  3. Monthly notes that can be opened from a template before the user chooses to create a real note.

For these cases, I would like a supported registration API for something like TVirtualFile. The name and exact signature are secondary; the useful contract would be:

  1. A plugin registers a stable, collision-checked identity or path and provides content. Existing real files must never be shadowed.
  2. Normal links and embeds resolve to that registration, including supported subpaths such as Markdown headings and blocks. Opening it uses the appropriate view with an explicit read-only state.
  3. Reads and resource URLs come from the provider. External content may need asynchronous loading, particularly on mobile; the API should not assume access to Node.js or synchronous filesystem reads.
  4. Virtual files are distinguishable from persisted files. They stay out of Sync and the file explorer by default, while consumers can explicitly opt into discovering them. Merely opening one must not create a file or cause autosave to write its contents to disk.
  5. Registration is tied to the owning plugin’s lifetime. Disposing it removes the link destination, releases resource URLs and handles open views predictably. Paths retained in saved workspaces need a defined unavailable state until the provider registers them again.

The template use case could start as a read-only preview, with a separate explicit action to create a real note. Supporting writable virtual files and write-back to an external source could be a later extension.

There is working prior art in registerVirtualFile in obsidian-lib, described in its virtual files guide, with the implementation here. It registers immutable UTF-8 text as an in-memory TFile, supplies Markdown metadata, supports link resolution and memory reads, protects Markdown editors from changes, and cleans up on disposal. It writes no vault file.

That implementation illustrates why a core API would help: it relies on internal vault.fileMap and metadataCache.uniqueFileLookup entries, metadata-cache registration, patches around vault/adapter reads and getResourcePath, and Markdown view/editor safeguards to prevent accidental writes. Other approaches intercept getFirstLinkpathDest and resource resolution directly. These workarounds depend on internals and each needs its own lifecycle and collision handling.

The library helper does not provide read-only editing behavior for Canvas or arbitrary third-party views, and it does not make virtual files automatically available to Bases or other indexers. Those remain core API design questions. A documented read-only registration contract would already give plugins a useful foundation for the cases above.