Better support for bibliographies is an ongoing persistent feature request for Scrivener, and it is one of the most important demands for all academic / legal writing. There are of course lots of workarounds and workflows, even automating bibliography generation automatically during compile; but these involve 3rd part tools that numerous users are uncomfortable / unwilling to install.
Keith has stated that an API is too big a task for him to rebuild Scrivener with. BUT there are a few options that would be much simpler for Keith. Chief among them is to bundle citeproc-js that would be triggered during compile. citeproc takes a series of temporary citation identifiers, a bibliography text database and a style and returns a fully formatted bibliography. It needs a JS engine, which I assume Keith can use the already existing Webkit engine for (i.e. no dependencies or large additional bundles like Pandoc). It would be the responsibility of the user to supply the text database and style file (which could be stored in the Binder).
The author of citeproc-js, Frank Bennett, is active on this forum, and I believe is sympathetic to offering advice on integration.
Technically, the simplest route would be use a mechanism like Compile replacements, so we have some text like:
Perception has long been considered inferential {@helmholz1860; @gregory1980}.
Scrivener regex searches for e.g. {@[^}]+, collects these tags and calls citeproc to generate the in text replacement and the final bibliography which is appended to the compiled document. Slightly more elegant would be to use an inline style to mark up the in-text temporary citations.
Compile already does technically much more challenging feats. The major challenge here is optimising to what stage of the compile path this should be done. My assumption is it needs to be done quite early, to keep everything as RTF before compile converts to its multitudinous output formats.
SCOPE: this only applies to the compile workflow. Finding and inserting temporary citations is IMO a separate concern, for which I believe there are already ample options. Some users want CWYW, but this would add a significant level of complexity to the editor and the benefits are subjective and marginal at best. The user would need to provide the database and style files, but all reference managers and a simple search of a website deals with this.
COST / BENEFIT: the cost is an added pane and complexity in the compiler. The benefit is obvious for most academic users, because this would provide a way to generate properly cited academic output without the need to scan and fiddle with in external tools. Scrivener is already an excellent writing environment for academics; bibliography generation during compile would make it even better.