The operating system would be based on the concept of schemes and nodes. Nodes are the common abstraction of programs, libraries and plugins. Schemes are basically descriptions about various types of nodes listing the functionalities the given node should provide. The registration of schemes and implementing nodes would be handled by the kernel. Files would be also nodes with a fake implementation provided by the kernel. Files could also be implemented by programs, so things dynamic documents could easily be constructed by implementing that scheme.
Programs would be simply implementations of the program scheme by having the main function. There could be also a command line tool scheme with start, input and end functions, where input would be called when standard input is recieved. So there could be multiple ways of creating programs. Every pluginable program could provide a scheme and load any node that is implementing it and use the provided functions.
The kernel should provide functionality to register a node as default implementation and to get the default implementation from code or the one selected by the programmer. Default implementation should not be always allowed. For programs for example.
Dynamic libraries might be done by constructing schemes for them and simply using the kernel provided methods to get access to the desired functionality or by creating a library scheme that allows linkers to link binaries against them.
Files additionally could tell to be handled not by the standard fake implementation but a given one. Symbolic links for example could simply tell that they should be handled by another node. That node would simply redirects all calls to the third one. File implementations thus should somehow handle base data.