In the Gemara, the shamir (Hebrew: שמיר) is a worm or a substance that had the power to cut through or disintegrate stone, iron and diamond. King Solomon is said to have used it in the building of the First Temple in Jerusalem in the place of cutting tools. For the building of the Temple, which promoted peace, it was inappropriate to use tools that could also cause war and bloodshed.
Referenced throughout the Talmud and the Midrashim, the Shamir was reputed to have existed in the time of Moses. Moses reputedly used the Shamir to engrave the Hoshen (Priestly breastplate) stones that were inserted into the breastplate. King Solomon, aware of the existence of the Shamir, but unaware of its location, commissioned a search that turned up a "grain of Shamir the size of a barley-corn".
Solomon's artisans reputedly used the Shamir in the construction of Solomon's Temple. The material to be worked, whether stone, wood or metal, was affected by being "shown to the Shamir." Following this line of logic (anything that can be 'shown' something must have eyes to see), early Rabbinical scholars described the Shamir almost as a living being. Other early sources, however, describe it as a green stone. For storage, the Shamir was meant to have been always wrapped in wool and stored in a container made of lead; any other vessel would burst and disintegrate under the Shamir's gaze. The Shamir was said to have been either lost or had lost its potency (along with the "dripping of the honeycomb") by the time of the destruction of the First Temple at the hands of Nebuchadnezzar in 586 B.C.
Solomon's shamir Wikipedia
According to the deutero-canonical Asmodeus legend, the shamir was given to Solomon as a gift from Asmodeus, the king of demons.
Another version of the story holds that a captured Asmodeus told Solomon the Shamir was entrusted to the care of a woodcock. Solomon then sends his trusted aide Benaiah on a quest to retrieve it.
The shamir worm was also used by King Solomon to engrave gemstones. Apparently he also used the blood of the shamir worm to make carved jewels with a mystical seal or design. According to an interview with Dr. George Frederick Kunz, an expert in gemstone and jewelry lore, this led to the belief that gemstones so engraved would have magical virtues, and they often also ended up with their own powers or guardian angel associated with either the gem, or the specifically engraved gemstones.