  Samarium hexaboride (SmB$_6$), a Kondo insulator with mixed valence, has
recently attracted much attention as a possible host for correlated topological
surface states. Here, we use a combination of x-ray absorption and
reflectometry techniques, backed up with a theoretical model for the resonant
$M_{4,5}$ absorption edge of Sm and photoemission data, to establish laterally
averaged chemical and valence depth profiles at the surface of SmB$_6$.
  We show that upon cleaving, the highly polar (001) surface of SmB$_6$
undergoes substantial chemical and valence reconstruction, resulting in boron
termination and a Sm$^{3+}$ dominated sub-surface region. Whereas at room
temperature, the reconstruction occurs on a time scale of less than two hours,
it takes about 24 hours below 50 K. The boron termination is eventually
established, irrespective of the initial termination. Our findings reconcile
earlier depth resolved photoemission and scanning tunneling spectroscopy
studies performed at different temperatures and are important for better
control of polarity and, as a consequence, surface states in this system.
