We report an improved reversibility of magnetostriction and inverse magnetocaloric effect (MCE) for the magnetic shape-memory Heusler alloy Ni$_{1.8}$Mn$_{1.8}$In$_{0.4}$. We show that the magnetostriction and MCE crucially depends on the geometrical compatibility of the austenite and martensite phases. Detailed information on the compatibility of both phases has been obtained from the transformation matrix calculated from x-ray diffraction data. The uniqueness of the lattice parameters results in an improved reversibility of the magnetostriction and the MCE. In the thermal hysteresis region of the martensitic transformation, the maximum relative length change is 0.3% and the adiabatic temperature change $Delta T_{ad}approx -10$ K in pulsed magnetic fields. Our results reveal that the approach of geometric compatibility will allow one to design materials with reversible magnetostriction and reversible inverse MCE at a first-order magnetostructural phase transition in shape-memory Heusler alloys.