LIMA, Peru — In a dry canyon strewn with the ruins of a long-dead city, archaeologists have made a discovery they hope will help unravel one of the most tenacious mysteries of ancient Peru: how to read the knotted string records, known as khipus, kept by the Incas.

At the site called Incahuasi, about 100 miles south of Lima, excavators have found, for the first time, several khipus in the place where they were used — in this case, a storage house for agricultural products where they appear to have been used as accounting books to record the amount of peanuts, chili peppers, beans, corn and other items that went in and out.

In some cases the khipus — the first ones were found at the site in 2013 — were buried under the remnants of centuries-old produce, which was preserved thanks to the extremely dry desert conditions.

That was a blockbuster discovery because archaeologists had previously found khipus only in graves, where they were often buried with the scribes who created and used the devices. Many others are in the possession of collectors or museums, stripped of information relating to their provenance.