Move flattener to a sensible place.
Add logic for creating C_PRIMITIVE default constraints, to make archetype legal.