Tailoring and programing the behavior of protein biomaterials is complex. Here, the authors report on the use of polyelectrolytes for controlling the stiffness to allow programing of protein hydrogels and generate reversible shape changes via folding and unfolding reactions.