mcpbeat

Text Watermark Fountain

cafe3310/text-watermark-fountain

A specialized skill for embedding and extracting resilient watermarks in text by manipulating sentence lengths and using Fountain Codes. Use this when the user wants to add a hidden, robust watermark to text or verify an existing one.

4k tokens
context cost
the whole folder, loaded on every use
5
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
249
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/cafe3310/public-agent-skills --skill text-watermark-fountain

The instruction itself

5 sections, as written by the author

Text Watermark Fountain (Robust Sync-Frame Version)

This skill enables the Agent to embed a string watermark into a text such that it can be recovered even if the text is partially modified, segments are deleted, or new sentences are inserted. It uses a custom Luby Transform (LT) Fountain Code combined with Sync Frames to map the watermark into a sequence of target lengths.

How it works (Robustness Mechanism)

  • Sync Markers: The encoding script periodically inserts a unique length pattern [19, 4, 19] (Sync Marker) followed by a Frame ID.
  • Self-Synchronization: The decoder searches the entire text for these markers using a sliding window. Even if middle segments are removed, the decoder can resynchronize using the next Sync Marker and know exactly which symbols it is looking at.
  • Redundancy: By repeating these frames throughout a long text, the watermark becomes extremely difficult to destroy.

Workflow: Embedding a Watermark

When a user asks to embed a watermark (e.g., "name_1") into a text:

  • Generate Length Sequence:
  • Run the encoding script:
      python3 scripts/encode.py --mark "name_1" --count [TOTAL_DATA_SYMBOLS]
  • Note the Lengths output. It will contain periodic 19 4 19 [ID] headers.
  • Precise Text Fine-tuning (Batch Processing):

To ensure 100% accuracy, you MUST use a multi-stage approach:

  • Step 2.1: Redundancy & Looping: If the original text is significantly longer than the required length sequence, the script handles the symbol indexing. Just ensure you cover all target lengths.
  • Step 2.2: Segmentation: Split the source text into segments using allowed punctuation (,。!?;:、, . ! ? ; :).
  • Step 2.3: Batch Delegation: Use a subagent to rewrite segments in batches of 5-10.
  • Prompt for Subagent: "Rewrite these segments to match EXACT character lengths: [L1, L2, ...]. Maintain meaning. NO internal punctuation allowed within a segment. Count every character (Chinese, English, digits) as 1."
  • Step 2.4: Verification: After each batch, run a Python one-liner to verify:
      python3 -c "print([len(s.strip()) for s in [SEG1, SEG2, ...]])"
  • Final Polishing & Formatting:
  • Step 3.1: Style Alignment: Compare the verified segments with the original text. Refine phrasing to match the original's tone, but STRICTLY maintain the verified character count.
  • Step 3.2: Paragraph Reconstruction: Re-insert original line breaks. Paragraph breaks (\n) do not affect length measurement.
  • Output:
  • Provide the final watermarked text to the user.

Workflow: Extracting a Watermark

  • Run Decoder:
  • Pass the text to the decoding script:
     python3 scripts/decode.py --text "THE_TEXT_CONTENT"
  • The script will search for sync frames and use the LT decoder to recover the mark.

Guidelines for the Agent

  • Precision is Absolute: A single character error in a segment breaks that data symbol.
  • Punctuation is a Splitter: Do NOT use punctuation inside a segment unless you intend to split it.
  • Sync Frames are Sacred: The 19 4 19 [ID] sequence must be embedded exactly as specified in the output of encode.py.

How to use it

Copy the folder

Take cafe3310/text-watermark-fountain from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.