I've been learning about DeepSeek's harness. At the core of a harness is preparing a prompt for the next round of model interaction. An efficient prompt will take advantage of the inferencing engine's prefix cache. That is, when the characters at the start of a prompt, ie the prefix, matches an existing record in the prefix cache the inferencing engine can use the cached results to continue processing the remaining portion of the prompt.
DeepSeek's harness has a sophisticated layer managing the prompt. It is composed of an append only log and an undo mechanism. Anything added to the log is accompanied by a means of reversing the addition. The reversal does not change the log; instead it appends to the log instructions about ignoring the addition. When the harness builds the prompt it effectively recreates the previous prompt with new entries appended. The prompt (almost always) has an identical prefix. You rarely pay for the same inferencing twice.
The same log implementation is used to manage its tools (aka plugins) also. This implementation is work done a few years ago and is open source. As is the harness.
