aiwr
aiwr is a lightweight, cross-platform Go CLI for inspecting and cleaning
detectable AI watermark carriers and provenance metadata from content that you
own or are authorized to process. Its behavior is informed by
watermarks-remover, but
aiwr's supported core is implemented and maintained here. It is released under
the MIT License; see LICENSE.
中文文档:README.zh-CN.md · 中文用户手册
What it covers
- Layer A text cleanup: zero-width and space-like characters, bidi controls,
selected homoglyphs, NFKC normalization, and emoji glue options.
- File metadata cleanup for PNG, JPEG, WebP, AVIF/HEIC, BMP, GIF, TIFF,
SVG, PDF, DOCX/XLSX/PPTX, ODT, EPUB, HTML, Markdown, LaTeX (.tex/.ltx),
MP4/MOV/M4A/M4V,
WAV, MP3, and FLAC.
- Inspection, detection, directory mirroring, JSON, SARIF, stdin, staged-file
checks, PostToolUse hooks, an HTTP API, website auditing, and the stealer
research workflow.
- Optional Layer B rewriting through a local Ollama or explicitly authorized
OpenAI-compatible endpoint. Heavy model and GPU dependencies are not
downloaded or embedded in the default build.
The repository also keeps compatibility/reference assets such as
service/scripts, skills, hooks, and research benchmarks. They are not part of
the native release runtime. See UPSTREAM.md for the mapping and
synchronization boundary.
Responsibility boundary
Native / bundled
The Go binary and normal packages include the deterministic cleaners, Unicode
and metadata inspection, format routing, local heuristic detectors, CLI/HTTP
interfaces, auditing, hooks, and staging workflows. They do not install Python,
Torch, Transformers, Diffusers, model weights, or external checkouts.
Optional external backends
score-synthid, detect-text-watermark, markdiffusion, clean-ctrlregen,
the SynthID sidecars, and the MarkLLM benchmark are adapters. They translate
aiwr arguments/protocols to third-party code supplied by the operator; they do
not reimplement or redistribute those algorithms or ML runtimes. Provide an
adapter directory with --upstream-scripts PATH (or
AIWR_UPSTREAM_SCRIPTS), then install/configure the corresponding upstream
checkout, Python environment, model, or sidecar yourself. A missing backend is
reported as unavailable; it is never downloaded automatically.
Install and verify
Go 1.26 or newer is required for a source build. Prebuilt archives and packages
are available from GitHub Releases.
The core module only needs the Unicode support dependency declared in go.mod.
go build -trimpath -o aiwr ./cmd/aiwr
go install github.com/ifloppy/aiwr/cmd/aiwr@latest
go test ./...
go vet ./...
./aiwr version
Distribution packages and offline build recipes are documented in
packaging/README.md.
Quick start
# Inspect without modifying the source.
aiwr inspect draft.txt
# Write draft.cleaned.txt beside the source.
aiwr clean draft.txt
# Mirror a directory to drafts.cleaned/.
aiwr clean ./drafts
# Replace a file in place after creating draft.txt.bak.
aiwr clean draft.txt --in-place
# Clean text from stdin.
printf 'hello\u200bworld\n' | aiwr clean-text -
To use the local Web UI, run aiwr serve and open
http://127.0.0.1:8765/ in your browser.
The default destination is new: NAME.cleaned.EXT for a file and
DIRECTORY.cleaned for a directory. Unknown files are not silently treated
as text. Use --as or --force-text only when that interpretation is
intentional.
Commands
| Command | Purpose |
|---|
clean, clean-file | Inspect the type and clean a file or directory |
inspect, inspect-file | Report metadata, findings, and residual risk |
detect | Produce a detection summary |
audit, audit-dir | Scan a file or directory; supports JSON and SARIF |
clean-text, inspect-text | Force the text pipeline; supports stdin |
clean-image, inspect-image | Force the image pipeline |
clean-audio, clean-video | Clean media containers; optional lossy processing |
score-stylometry | Run the local heuristic text-style score |
detect-gumbel | Recheck a same-key HMAC/EXP Gumbel watermark |
rewrite-text | Print a Layer B prompt or use an explicit provider |
audit-website | Audit public URLs from a same-origin sitemap |
check-staged, clean-staged | Check or clean repository files |
hook-written-file | Check or clean a file named by a PostToolUse payload |
doctor | Diagnose optional tools, runtimes, adapter scripts, backends, and model configuration |
| `stealer query | build |
download-prompts | Download a resumable prompt corpus |
serve | Start the HTTP service on 127.0.0.1:8765 by default |