I'm not sure if it meets all your criteria, especially as the meaning of certain features from program to program can vastly differ. However, if I've correctly understood what you're looking for, it matches at least some of them.
Natural hierarchy: notes can be organized into any tree that you like because notes can be cloned (not just copied) into any location.
Very easy to create references with automatic back-references: bi-directional linking is built in and is as simple as typing @notename or Ctrl+L. It also includes automatically generated link-maps and self created reference-maps to see all the links between each document.
Embedded documents: You can embed any document into any other document and have it referenced live and thus updated anywhere it's embedded.
Self-hosting: You can either run it on a local machine or host your own sync server (which also allows you to access it from a browser), super simple to setup.
Large file support: I haven't run into any issues with this, seems reasonably limitless.
Full point-in-time history: From the official wiki: "supports seamless versioning of notes by storing snapshots ("revisions") of notes at regular intervals.". You get to choose this interval.
Programmatic access: Full built-in scripting support.
Every link/bookmark I add could download the webpage and cache it: You can definitely script this yourself but the web-clipper extension for Trilium allows you to save directly from the browser into a new note (text, screenshot, or local copy of site). Not exactly what you're looking for but a derivative that could be modified to suit your needs.
There are so many other features that make it the best note-taking application for me (saved search queries represented & updated as notes in the note tree, full theming support, encrypted notes with timeout function, customizable keyboard shortcuts, active developer that you can speak to, etc).
My multi-year search for an advanced customizable note taking application has finally come to an end. Frankly, I like the application so much that I created an HN account just so I could pass the link on to you.
The best way to understand the benefits of Trilium is to give yourself 10 minutes to read the documentation[2] and take it for a test run.
[1]https://github.com/zadam/trilium/ [2]https://github.com/zadam/trilium/wiki
When I found Roam Research I had two thoughts: 1) wow, this UI is rather polished and the UX is very good too and 2) it would be quite annoying if Roam Research disappeared after I had put in a lot of effort in my database and became familiar with the editor and UI/UX affordances. I know you can export the Roam database to a quite sensible JSON/Markdown format, but if I can't self host the editor I will always be worried about this.
Basically this was a a deal breaker for me so I looked around for alternatives and found org-roam[1]. It's an Emacs package that gives you a similar workflow for creating notes, inserting links to notes, viewing note backlinks and a few other things. It's easier to get into the org-roam ecosystem if you already either use Emacs or vim, but I know a lot of people that have started using Emacs just to use org-roam.
There's a quite high learning curve compared to Roam Research but you have the certainty that it won't disappear from one day to the next :)
I don't want to be too much of an Emacs/org-roam evangelist because it's definitely not for everyone, but here are some of the workflows I do regularly:
1. Have a 'daily notes' file where I initially write most kinds of notes; for example when I change the configuration of a system I'm working on, lecture notes, or pretty much anything else. I can insert inline images and attach any kind of file to each of these headings.
2. Refile those daily notes into dedicated notes and link them to other relevant notes. For example, I would link the file containing my notes for a given lecture to the top-level note for that class, etc.
3. Manage the research notes for my master's thesis. I actually have a pretty cool workflow here:
- I find interesting papers or websites online and capture them into Zotero[2] using the browser extension. This automatically creates a fully populated entry in my .bib file and downloads the relevant PDF or snapshot of the website into my local storage.
- I then use helm-bibtex[3] in combination with org-roam-bibtex[4] to create and easily access my notes on this particular bibliographical source. This note is just like any other org-roam note, so it can contain forward and backward links, etc.
- And finally, I use org-noter[5] to read the PDF and make notes on each page or paragraph. These notes are simply plain text entries on the bibnote. This is pretty huge for me, because it gives me a very focused interface for reading and processing what is being said in the article while I make detailed notes about it (which helps recall and understanding). And also, finding exactly where in the source a given note came from is literally one keyboard shortcut away.
In conclusion, it's a lot of up-front learning and tweaking to get your knowledge management system just right for you, but it may be worth it for some people. BTW, feel free to join the org-roam Slack - there are a lot of people there who are very willing to help.
[1] https://github.com/org-roam/org-roam
[3] https://github.com/tmalsburg/helm-bibtex
What I'm missing the most from it is self-hosting, large file support, full point-in-time history, and programmatic access. I want it to be self-hosted because I don't want to lose my "second brain" just because some company couldn't find a viable business model and went belly up 20 years from now. I want large file support so I can put everything in my life in it: pictures, videos, pdfs, web page archive files, source code etc and I don't want to pay uber-$$$ to store huge files in their cloud. And I'd like programmatic access so I can make my own additions. For example, every link/bookmark I add could download the webpage and cache it so I can search its content and so it's not lost when the website changes owners.