If you want to build a residential structure in San Francisco you have to do one of two things.
Either (a) build exactly to the building code with every detail compliant and no variations. If you need a single variation the Planning Department will require a ‘variance’ which will require notification of neighbors for several blocks in every direction and a public hearing. The neighbors will defeat your whole building plan even if you just want two extra feet in front to plant a tree.
Or (b) call your plans a ‘modification of an existing building’. The builder in the case of this photo used this option. He saved about 600 square feet of an existing one story home with a fairly large adjacent lot. He tore off the face of the home and built a connecting three story building with over 6,000 square feet. No need for notification of the neighbors or a public hearing. Just a modification.
What this means is you must hire an architect or builder who is fully cognizant of how San Francisco building works. Support for locals. The same for contractors. Irish for carpentry, Chinese for electrical and Mexican for roofing.
Everyone else should take a hand full of sleeping pills and dream of a building that will never happen or take an overdose and save everyone the time wasted in stopping your building.