Writing protocol For writing, the tip follows a programmed trajectory (NanoScript) in the xy -plane with the peakforce (PF) feedback enabled, while applying either a potential difference between the tip and the substrate (potentiostat) or forcing a fixed current through the tip (galvanostat). In all presented experiments, the peakforce frequency was set to 2 kHz, other AFM parameters used are listed in the supplementary file.