Researchers have hacked the immune system of a bacterium into serving as the equivalent of a molecular tape recorder.

By responding to chemical changes in the surroundings and then 'time-stamping' them in DNA, the technology paves the way for living monitoring devices that could be used in health screens or to analyse pollutants in ecosystems.

Scientists from Columbia University Medical Centre in the US co-opted the gene editing system known as CRISPR-Cas in the bacterium Escherichia coli, taking advantage of its natural ability to remember the genetic information of viruses.

"The CRISPR-Cas system is a natural biological memory device," says the study's senior author, biophysicist Harris Wang.

"From an engineering perspective that's actually quite nice, because it's already a system that has been honed through evolution to be really great at storing information."

CRISPR really is the gift that just keeps giving. Few technologies deserve the right to be called revolutionary, but thanks to its relative simplicity and reliability, the molecular system has already made its mark transforming the field of genetic engineering.

The tool works based on a principle we've observed in bacteria - as it turns out, a bacterium like E. coli contains 'libraries' of genetic sequences that help it identify invasive viruses.

The bacterium copies these libraries onto sections of RNA that helps enzymes called Cas to rapidly recognise viral genomes and tear them up before they can cause damage.

This is what makes the system incredibly useful as a molecular scalpel. But in this case, the researchers turned their attention to the library itself.

"When you think about recording temporally changing signals with electronics, or an audio recording … that's a very powerful technology, but we were thinking how can you scale this to living cells themselves?" says one of Wang's graduate students, Ravi Sheth.

The team used circular pieces of DNA called plasmids as the messages in the data library.

By triggering the production of specific messages in response to a particular signal – such as the presence of a metabolite like copper or the sugar fucose – the scientists were able to record a specific environmental change.

To turn it into a recording device, however, they would need to store these changes in a sequence that could be interpreted as a measure of time.

That's where CRISPR comes in. The CRISPR-Cas spacer acquisition machinery was tweaked to respond to the amount of these plasmids by stitching them into a sequence, much like a tape recorder.

When there was an absence of plasmids, the machinery continued to build the sequence using another kind of plasmid as a reference spacer; kind of the equivalent of dead air.

The mix of plasmids provides a timestamp for when changes in the environment occur.

"This approach enables stable recording over multiple days and accurate reconstruction of temporal and lineage information by sequencing CRISPR arrays," the researchers write in their report.

Check out the video below to get an idea of the process:

The team calls their technology 'temporal recording in arrays by CRISPR expansion', or TRACE for short.

The next step for TRACE is to respond to disease biomarkers in the digestive system that could fluctuate over several days.

With growing piles of evidence linking gut microbes with a variety of conditions, from Parkinson's to chronic fatigue to multiple sclerosis, having sharper tools for analysing the complex environments inside us is a no-brainer.

"Such bacteria, swallowed by a patient, might be able to record the changes they experience through the whole digestive tract, yielding an unprecedented view of previously inaccessible phenomena," says Wang.

This research was published in Science.