Magic infoboxes are defined using a new mechanism (which is distinct from templates or modules) and they are not a direct part of the page content. The primary goals are: Make them fully machine readable and writable, separate their content from the layout and they should be aware of Wikibase. On top of all that the data, the data schema and the layout is fully user defined (but each part is separated).
Rough implementation sketch (as discussed during the Wikimania) (WIP):
* Data source which delivers DataValue objects (given an Item and a Property ID)
* Takes a schema from a page (similar to Template(Meta)Data, but more advanced)
** logical field name -> data type and/or wikibase property (plus documentation, etc)
** Definitions for reoccuring set of fields (eg. multiple office held)
* Puts together data according to that schema
* Loads data from a subpage/ separate namespace/ associated content object
* Enriches that data with data from WikibaseClient, according to the given schema
* Provides the data (consisting of DataValue objects) to the restricted Capiunto layout mode (for desktop), other means of visualizing the data might be used for other use cases (API?, Mobile?, …).
* Default Layout is defined in the schema?
Capiunto "Layout mode":
* Very restricted Lua environment where people can only access the data to use for the infobox and a Capiunto object. Returns html or prefereably an mw.html object. (Does that HTML need to be safe for use in Wikitext?)
** NOTE: this means that Capiunto needs to use HTML formatters here, instead of wikitext formatters.
* Consumes DataValue objects
* Must not alter the data in any way, it's just for visualization