Text watermark fountain

From cafe3310/public-agent-skills · View interactive version

Text watermark fountain is an AI agent skill from the GitHub repository cafe3310/public-agent-skills. 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.

How to use this skill

Skill file

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)

  1. Sync Markers: The encoding script periodically inserts a unique length pattern [19, 4, 19] (Sync Marker) followed by a Frame ID.
  2. 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.
  3. 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:

  1. Generate Length Sequence:

```bash

python3 scripts/encode.py --mark "name_1" --count [TOTAL_DATA_SYMBOLS]

```

  1. Precise Text Fine-tuning (Batch Processing):

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

```bash

python3 -c "print([len(s.strip()) for s in [SEG1, SEG2, ...]])"

```

  1. Final Polishing & Formatting:
  1. Output:

Workflow: Extracting a Watermark

  1. Run Decoder:

```bash

python3 scripts/decode.py --text "THE_TEXT_CONTENT"

```

Guidelines for the Agent

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.