Free and open source preferably but if it has to be paid (I don't mind paying if somebody builds a perfect tool for me, I'll donate if it's free) - it is to be single-time payment, not any kind of subscription.
100%-internet-independent. An option to synchronize data over the internet is a nice thing to have but it must be E2E-encrypted (I feel like a manually-set private key symmetric encryption is ok) and support P2P-synchronization via local network.
It should better work on all the platforms but desktop Linux is the most important and minimally-sufficient.
It is to store the data in a format easy to read and modify programmatically. E.g. SQLite (seems the best choice, also does great storing attached files as BLOBs within the DB), XML, JSON or whatever with sane scheme.
A node can be folder/document, a document section with a heading (including subsections), a paragraph (with support for marking particular spans as non-breakable and inserting manual line breaks), a picture (svg, png or jpg), a numbered or bulleted list (of whatever a depth) or its element, a video, an audio, a table, a formula, a piece of code, an attached file (stored within or alongside the database), a link to a node or to an external URL. Something else too perhaps.
It should be possible to attach tags and custom properties to the nodes. Every node should have a UUID. The tagging system should support implications (e.g. if I tag something with "python" tag "programming" tag is applied implicitly). It should be possible to rename tags and merge tags into one.
Full text search (and replace) by content, tag, property etc.
Drag&Drop nodes migration and reordering.
Export a node with all its subnodes into a file, execute a command line with its name substituted and import it back. I am going to use this feature mostly to author documents (markdown, latex, epub etc) and blog posts via Python scripts.
What I want to use it for:
Writing down random ideas and notes, mindmapping, organizing reasonably small files and scanned stuff, writing lecture notes, papers, blog posts and books and all these with all their hierarchy elements (to the sane depth, treating every word as an node or looking inside attached files would be too much) should be 1-st class nodes displayed in the tree and available for the operations.