LZW with dictionary clearing
When the compressor clears the dictionary, it emits the clear code.  This enables the decompressor to stay in sync: when it sees the clear code, the decompressor clears its own dictionary.  In this way, the decompressor can reconstruct/infer the state of the encoder's dictionary at each step.
Wikipedia says:

Smart encoders can monitor the compression efficiency and clear the table whenever the existing table no longer matches the input well.