ChatGPTClaudeGrok / X / CursorGemini

DSH plugin byte preservation: four silent rewrites to stop

Plugin DevelopmentPublished 2026-11-10Author: DeepSeek Plugin Market
DSH pluginDeepSeek Harnesssession referencebyte preservationcontent
A missing space or a changed line ending points at host cleanup, not model memory. Four rewrite classes, how they differ from truncation, and a byte diff.

Referenced content differing from the original by one space usually means someone in the chain did a friendly cleanup: DSH plugin's byte preservation allows only mention token removal, and everything else is carried as-is. The more harmless a normalization looks, the more likely it leaves a trace here.

DeepSeek Harness: Why one character differs

The differences hide in invisible whitespace. (source) Three frequent scenes:

text
source:  line one\r\nline two      reference: line one\nline two
source:  a  =  1                   reference: a = 1
source:  你好,世界。                reference: 你好,世界.

Users do not compare bytes; models do. A changed line ending can alter code block parsing, and a changed punctuation width can alter retrieval matches.

What these share: the text "looks the same" but is not the same bytes.

DeepSeek Harness: The byte preservation contract

It is a content contract, not a performance tweak. (source) Three layers of meaning:

  1. Referenced content is carried as a snapshot, not reflowed for display;
  2. The only permitted modification is removing host mention tokens;
  3. Compression and truncation are explicit behaviors that must record facts.

Layer two draws the responsibility line: prepare subtracts, the host does not beautify.

Layer three separates "omitted" from "rewritten": the former is recorded, the latter is not.

DeepSeek Harness: Four rewrites that change content

Four actions cover most quiet rewrites. (source) Comparison:

ProcessingApparent purposeActual effect
Merge consecutive spacesTidier layoutBreaks code indentation and alignment
Normalize line endingsCross-platform consistencyChanges code blocks and paragraphs
Convert full-width punctuationUniform punctuationBreaks matching against the original
Append missing punctuationComplete sentencesAdds content from nothing

The third is the most invisible: after Chinese punctuation becomes ASCII, searching the original text may fail.

The fourth is worse in kind: it is not a rewrite but generation.

DeepSeek Harness: Truncation, compaction, preservation

All three change what arrives, but only one is a rewrite. (source) Comparison:

BehaviorChanges the originalLeaves a record
Byte preservationNoNot applicable
TruncationYes, removes contentRecords omitted fields and truncated
Source compactionYes, restructures contentRecords compacted

Truncation and compaction are explicit contracts that callers can see; rewrites leave no trace, which makes them hardest to diagnose.

The test is simple: if a difference has no field explaining it, it is a rewrite.

DeepSeek Harness: What hosts should do instead

Three actions keep processing on input shape. (source) Practices:

  1. Convert editor structure into content blocks without touching the text;
  2. Keep only necessary invalid-character cleanup and record its scope;
  3. Put display polish in the render layer and never write it back to submitted content.

The third is fundamental: once polish is written back, every later stage can only see the polished version.

If a product truly wants uniform punctuation, ship it as an explicit feature users can choose, not as an invisible default.

One more easily missed point: logs and telemetry should not truncate or redact in ways that change content, or debugging shows something other than what reached the model.

DeepSeek Harness: A three-step byte comparison

Three steps locate the source of a difference. (source) Steps:

  1. Take content containing consecutive spaces, CRLF, and full-width punctuation;
  2. Bypass host preprocessing, call prepare directly, and record the result;
  3. Run prepare through the full host chain and diff the two results byte by byte.

A difference at step 2 points at the service side (rare); a difference only at step 3 points at the host.

Do not judge with an editor's "looks the same"; use a diff or a hash.

If the two results differ only by mention tokens, the host chain did not rewrite content; any other difference deserves tracing to a specific stage.

With the difference located, the next topic is normalization boundaries. Read what hosts normalize before referencing; to see how truncation is recorded, read DSH plugin truncation fields; for the wider picture, read how DSH plugin implements session references.

Sources: DeepSeek Harness reference - Session references, session-reference/src/types.ts

ChatGPTClaudeGrok / X / CursorGemini

FAQ

In DSH plugin, why does referenced content differ from the original by a single space?

Someone in the chain tidied it, which DSH plugin byte preservation forbids. DSH plugin byte preservation allows only removing mention tokens; treating whitespace as cleanup changes the referenced snapshot.

For DSH plugin, does byte preservation mean no character may ever change?

DSH plugin byte preservation constrains how referenced content is carried. DSH plugin permits removing host mention tokens but forbids rewriting the body for display, such as merging spaces or converting punctuation.

With DSH plugin, is stripping control characters a byte preservation violation?

It depends on scope in DSH plugin. The rule targets content rewriting; removing genuinely invalid characters that would break parsing is input legality handling, but tabs and newlines are not dirt.

In DSH plugin, how do I prove the host rewrote referenced content?

Call DSH plugin prepare directly with the same content, bypassing host preprocessing, and diff the two results byte by byte. DSH plugin's output should differ only by mention tokens.

Related Terms

byte preservation
Byte preservation requires carrying referenced content as-is except for removing mention markers, never reshaping it for display.— DeepSeek Harness reference - Session references
content rewrite
A content rewrite changes spaces, line endings, punctuation, or encoding even when the result looks tidier.— DeepSeek Harness reference - Session references
token removal
Token removal is the only permitted modification: prepare deletes host mention markers from the body.— session-reference/src/types.ts
byte diff
A byte diff compares processed and original content byte by byte to locate exactly where a rewrite happened.— DeepSeek Harness reference - Session references

Sources