The English verb “keep” often translates the Hebrew shamar , “guard,” often used to describe the temple ministry of priests and Levites. Priests and Levites guarded the house of Yahweh, and also, literally, guarded the commandments, written on tablets and placed in the ark of the covenant.
When the OT speaks of “keeping commandments,” then, it is imagining the Israelite as priest, guarding the commandments in the heart of the temple and guarding the commandments taught in Israel. When the new covenant comes, the law is written on tablets of the human heart, and keeping commandments is another way of speaking of guarding the Spirit’s deposit in the treasure house at the heart of the human temple.