| name | text-watermark-fountain |
| description | 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. |
| license | MIT |
| author | github/cafe3310 |
| depends_on_skill | [] |
| depends_on_binary | ["python3"] |
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:
-
Precise Text Fine-tuning (Batch Processing):
To ensure 100% accuracy, you MUST use a multi-stage approach:
-
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:
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.