agentleFS
GargantuaXGargantuaX/gemini-watermark-remover/AGENTS.md

gemini-watermark-remover

AGENTS.md5.6k starsChanged 5 months agoMITView on GitHub

  • Reads credentials

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 3 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 2 mentionsJul 2026: 3 mentionsAug 2026: 3 mentionsSep 2026: 3 mentionsOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the GargantuaX/gemini-watermark-remover repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about GargantuaX/gemini-watermark-remover

The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 15

Talked about on GitHub and Bluesky (15 times).

On GitHub · 14

9 more on GitHub

On Bluesky · 1

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

51 rules. About 0 are common, 32 are distinctive, and 19 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈32

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 19

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat best-effort processing as the minimum product guarantee: when the input is available and processing can run, return the best result …

    line 5
  2. Distinctive:

    Do not tell users to refresh or retry when repeating the same action is not expected to change the outcome.

    line 8
  3. Distinctive:

    When learning or comparing upstream watermark catalog specs, alpha maps, video rules, FDnCNN behavior, or CLI behavior, prefer this local …

    line 24
  4. Distinctive:

    Treat upstream specs as candidate priors until they are verified against this repo's sample scoring, crop sheets, and output residual gates.

    line 25
  5. Distinctive:

    When user-provided samples show obvious watermarks being skipped or poorly removed, treat the first task as pattern discovery, not …

    line 29
  6. Distinctive:

    before/after crops for every changed strategy

    line 40
  7. Distinctive:

    Prefer improving candidate localization and alpha estimation over loosening safety/protection gates.

    line 41
  8. Distinctive:

    Do not generalize from a single image when the user supplied a sample set.

    line 43
  9. Distinctive:

    When residual artifacts remain after mathematically valid inverse alpha removal, do not assume stronger inpaint, preview-only priors, or …

    line 44
  10. Distinctive:

    Keep deployment assumptions aligned with the current repo contents.

    line 54
  11. Very specific:

    After every core package release, compare the website's pinned SDK version with npm latest before treating the website as current.

    line 60
  12. Distinctive:

    Verify the deployed Worker itself with a real sample and inspect its selected candidate / strategy metadata or other version-specific …

    line 61
  13. Distinctive:

    Treat the website as a separate release surface.

    line 63
  14. Distinctive:

    Use this catalog when checking watermark size and anchor regressions against Gemini image outputs.

    line 67
  15. Distinctive:

    Use the local proxy

    line 152
  16. Very specific:

    Start the local artifact server, for example pnpm dev

    line 160
  17. Very specific:

    If you do not want the repo's default proxy, pass --proxy off

    line 162
  18. Distinctive:

    Do this only once in the fixed profile:

    line 166
  19. Distinctive:

    Keep Developer Mode enabled.

    line 170
  20. Very specific:

    Use the active local build server URL printed by pnpm dev

    line 173
  21. Very specific:

    Default pnpm dev start port: http://127.0.0.1:4173/

    line 181
  22. Very specific:

    if freshness returns stale, probe:tm must fail before running the worker/bridge smoke page

    line 190
  23. Distinctive:

    if the freshness preflight context itself is unavailable, for example:

    line 191
  24. Very specific:

    When real-page behavior does not match the current worktree, verify the installed userscript body, not just the script name or @version.

    line 200
  25. Very specific:

    If you just reinstalled the userscript and the check still reports stale, refresh the already-open Tampermonkey editor page once, then run …

    line 211
  26. Distinctive:

    Check that the console shows:

    line 238
  27. Distinctive:

    If bridge validation is needed, trigger from page side:

    line 241
  28. Distinctive:

    If the original URL binding is unavailable when the required download/original request arrives, the action must fail closed with:

    line 250
  29. Very specific:

    All ready images on the current Gemini page: pnpm probe:real-page:compare --all

    line 260
  30. Very specific:

    Use this when page-level screenshots are not enough and you need original blob pixel metrics for before/after.

    line 266
  31. Very specific:

    Do not rely on hardcoded sample counts here.

    line 268
  32. Distinctive:

    keep request-layer preview interception enabled as an early processing source and observability point

    line 284
  33. Very specific:

    do not assume Gemini's final displayed blob: image is fully controlled by the page fetch hook chain

    line 285
  34. Very specific:

    keep src/shared/pageImageReplacement.js as the production display path for preview replacement

    line 286
  35. Distinctive:

    treat request-layer preview handling as supportive, but rely on page-level replacement to guarantee the user-visible preview is actually …

    line 287
  36. Distinctive:

    When the user reports "this version became much slower", check these first before touching the core algorithm:

    line 299
  37. Very specific:

    use the actual userscript URL from the active pnpm dev server

    line 307
  38. Distinctive:

    If this regresses, inspect the waiting / retry path before changing watermark math

    line 320
  39. Distinctive:

    Do not re-enable preview-anchor subpixel search unless you have a real fixture that proves the accepted result is both safer and materially …

    line 330
  40. Distinctive:

    Use stronger preview edge cleanup only when:

    line 337
  41. Distinctive:

    Do not re-enable the old active direct-download click hook in production.

    line 350
  42. Very specific:

    When the userscript intercepts 下载完整尺寸的图片 at capture time and calls preventDefault()/stopImmediatePropagation(), Gemini's own download flow …

    line 354
  43. Distinctive:

    keep the intent gate for copy / download gestures

    line 373
  44. Very specific:

    keep Gemini RPC discovery hooks (hNvQHb, c8o8Fe, related batchexecute responses)

    line 374
  45. Distinctive:

    keep generated-asset fetch interception for the native request flow

    line 375
  46. Distinctive:

    do not block the button just to start a parallel userscript-only download path

    line 377
  47. Distinctive:

    keep a download-specific sticky intent window for Gemini download asset URLs

    line 378
  48. Very specific:

    Do not treat new Worker(blobUrl) returning without an immediate throw as proof that the worker is usable.

    line 413
  49. Very specific:

    If [Gemini Watermark Remover] Worker acceleration enabled appears, that only means startup was attempted.

    line 417
  50. Very specific:

    If [Gemini Watermark Remover] Worker initialization failed, using main thread: ...

    line 419
  51. Distinctive:

    After fallback, the page should still continue with:

    line 420

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Best-Effort Product Principle

  • Treat best-effort processing as the minimum product guarantee: when the input is available and processing can run, return the best result the current system can produce.
  • A result with visible residuals or minor imperfections is preferable to returning the unchanged input or no result.
  • Low confidence, incomplete catalog coverage, or a quality warning should not by themselves block output. Use the most plausible validated/fallback strategy, produce the result, and surface the uncertainty as non-blocking metadata or UI copy.
  • Do not tell users to refresh or retry when repeating the same action is not expected to change the outcome. Retry guidance is allowed only when there is a concrete, recoverable state change and the user can take an actionable step.
  • Reserve hard failure for cases where processing truly cannot run or no usable input/output can be produced; do not use failure as a substitute for a best-effort result.

Debug Workflow

Supported Sample Scope

  • Quality fixes target original Gemini outputs. Inputs with repeated watermarking, screenshots, or subsequent image edits are outside the required support scope; do not add special processing solely to accommodate them.
  • Classify sample provenance separately from processing quality. Keep confirmed edited exports as observations, with the evidence for exclusion; retain unknown provenance as unknown. Neither unusual dimensions, missing metadata, nor poor removal quality establishes editing history.
  • An unknown-source upload can motivate an investigation, but does not by itself establish a defect in supported original outputs. Reproduce the suspected issue on a verified original or a controlled fixture before promoting a fix. Do not silently relabel unresolved samples as passing or edited to satisfy a release gate.
  • This scope is an investigation and acceptance rule, not a new runtime rejection rule. Preserve existing best-effort behavior and content-damage regression controls.

Allenk Upstream Reference

  • The local fork of allenk/GeminiWatermarkTool is at ${GWR_ALLENK_ROOT}.
  • Local-only path variables are configured in .env; use .env.example as the public template.
  • When learning or comparing upstream watermark catalog specs, alpha maps, video rules, FDnCNN behavior, or CLI behavior, prefer this local fork over temporary clones or remote README-only assumptions.
  • Treat upstream specs as candidate priors until they are verified against this repo's sample scoring, crop sheets, and output residual gates.

Data-Driven Watermark Investigation

  • When user-provided samples show obvious watermarks being skipped or poorly removed, treat the first task as pattern discovery, not threshold tuning.
  • Derive the watermark geometry and rendering rules from the samples before changing removal heuristics:
    • exact anchor position (x/y, right/bottom margins)
    • watermark size and aspect
    • subpixel offset / scale drift
    • alpha map shape and alpha strength
    • background-dependent compositing behavior
  • Build batch reports and visual artifacts from the sample set:
    • full image list with dimensions and scores
    • bottom-right crop sheets
    • candidate-position overlays when debugging detection
    • before/after crops for every changed strategy
  • Prefer improving candidate localization and alpha estimation over loosening safety/protection gates.
  • Safety gates are a final fallback. If a visible watermark is skipped, first ask whether the selected position/size/alpha candidate is wrong or incomplete.
  • Do not generalize from a single image when the user supplied a sample set. Cluster samples by size, anchor, background, and residual behavior, then make the smallest algorithm change supported by that cluster.
  • When residual artifacts remain after mathematically valid inverse alpha removal, do not assume stronger inpaint, preview-only priors, or subpixel sweeps are safe production fixes. First verify whether the real alpha edge profile / antialiasing model differs from the current template, and keep any visual cleanup evidence-gated.
  • Do not treat a restoration score measured only with the candidate's own selected alpha map and geometry as independent cleanliness or damage evidence. A wrong candidate can erase the pattern it scores against while leaving an obvious hole, shifted star, or larger residual outside that ROI. Use those self-consistent scores for candidate ranking only; promotion evidence should come from frozen cross-profile/decoy signals and blind visual review.
  • Preserve signed source polarity when a rescue assumes a white alpha template. A localized gradient or edge witness can be strong even when the spatial template polarity is inverted; the fresh exact-48 R96 case 77 passed the decoy/edge gates but inverse removal turned it into a dark star. Keep the exact-48 R96 white source-witness gate constrained to spatialSignedTarget > 0; do not replace this with an absolute/max score or generalize it to other polarity models without independent validation.
  • Issue #123 independently confirmed the same collision class at exact-96 R192: a near-zero negative spatial witness with highly localized unsigned edges can be structured dark content, and applying the white 20260520 rescue creates a visible black hole. Require positive signed spatial evidence for the normal white rescue. Only retain the established structured-content exception when a drifted dark-polarity selection independently exists and the exact anchor has sufficiently strong, localized spatial evidence; a gradient/edge witness alone is not enough.
  • Treat texture.hardReject, visibleDarkHole, and selection-stage damage warnings as noisy review signals, not independent cleanliness truth. Confirmed clean exact-48 rescues can trigger them, while visible dark residuals can still retain a top-level clean status. Do not directly map these signals to qualityStatus, candidate ranking, blocking, or retry behavior without frozen independent validation.
  • Background-endpoint consistency is not by itself a safe gate for row/patch inpainting. A discovery-only endpoint threshold improved one dark-hole sample but later triggered on a clean fresh exact-48 rescue and introduced visible horizontal banding. Keep such repair offline until a preregistered temporal holdout demonstrates both useful recall and no clean-output damage.

Deployment Note

  • The active local/debugging build surface is the generated dist/ directory.
  • Keep deployment assumptions aligned with the current repo contents.

Website SDK Release Sync

  • https://geminiwatermarkremover.io/ is deployed from the separate local geminiwatermarkremover.io repository; resolve its checkout from local configuration instead of committing a machine-specific absolute path.
  • Publishing this repository to npm, GitHub Releases, or the Chrome Web Store does not update the website's image-processing Worker. The website pins @pilio/gemini-watermark-remover in both package.json and pnpm-lock.yaml and must be upgraded, rebuilt, tested, and deployed separately.
  • After every core package release, compare the website's pinned SDK version with npm latest before treating the website as current. A current website userscript or extension download does not prove that the website Worker uses the current SDK.
  • Verify the deployed Worker itself with a real sample and inspect its selected candidate / strategy metadata or other version-specific behavior. Do not rely only on CDN asset timestamps, package release status, userscript @version, or successful HTTP responses.
  • Known failure mode from issue #115: the public site still bundled SDK 1.0.31 after 1.0.33 was published. Upgrading exposed a second path mismatch: the browser engine loaded the real 36-v2 template while the sync image-data SDK interpolated size 36, allowing local validation to select 48x48 while the deployed Worker skipped. Keep runtime alpha-map catalogs and candidate orchestration aligned across SDK entry points.
  • Treat the website as a separate release surface. If its main worktree contains unrelated user changes, prepare and validate the dependency upgrade in an isolated worktree so those changes are not overwritten or accidentally deployed.

Gemini Image Size / Watermark Catalog

Use this catalog when checking watermark size and anchor regressions against Gemini image outputs.

Current code expectation:

  • 0.5K preview outputs use a 48x48 watermark with 32px right/bottom margins.
  • 1K, 2K, and 4K preview/full outputs use a 96x96 watermark with 64px right/bottom margins.
  • New reported anchor type: exact 1K / 2K / 4K catalog sizes also consider a secondary 96x96 candidate with 192px right/bottom margins. Keep the canonical 64px anchor first; the 192px anchor must remain evidence-gated by candidate validation.
  • Known confirmed local exception: 2816x1536 uses 96x96 with 192px right/bottom margins (2k-new-margin in src/core/geminiSizeCatalog.js).
  • The local catalog also keeps a confirmed 1408x768 16:9 1K variant.

Gemini 3.1 Flash Image Preview

Aspect ratio512 resolution0.5K tokens1K resolution1K tokens2K resolution2K tokens4K resolution4K tokens
1:1512x5127471024x102411202048x204816804096x40962520
1:4256x1024747512x204811201024x409616802048x81922520
1:8192x1536747384x30721120768x614416801536x122882520
2:3424x632747848x126411201696x252816803392x50562520
3:2632x4247471264x84811202528x169616805056x33922520
3:4448x600747896x120011201792x240016803584x48002520
4:11024x2567472048x51211204096x102416808192x20482520
4:3600x4487471200x89611202400x179216804800x35842520
4:5464x576747928x115211201856x230416803712x46082520
5:4576x4647471152x92811202304x185616804608x37122520
8:11536x1927473072x38411206144x768168012288x15362520
9:16384x688747768x137611201536x275216803072x55042520
16:9688x3847471376x76811202752x153616805504x30722520
21:9792x1687471584x67211203168x134416806336x26882520

Gemini 3 Pro Image Preview

Aspect ratio1K resolution1K tokens2K resolution2K tokens4K resolution4K tokens
1:11024x102411202048x204811204096x40962000
2:3848x126411201696x252811203392x50562000
3:21264x84811202528x169611205056x33922000
3:4896x120011201792x240011203584x48002000
4:31200x89611202400x179211204800x35842000
4:5928x115211201856x230411203712x46082000
5:41152x92811202304x185611204608x37122000
9:16768x137611201536x275211203072x55042000
16:91376x76811202752x153611205504x30722000
21:91584x67211203168x134411206336x26882000

Gemini 2.5 Flash Image

Aspect ratioResolutionTokens
1:11024x10241290
2:3832x12481290
3:21248x8321290
3:4864x11841290
4:31184x8641290
4:5896x11521290
5:41152x8961290
9:16768x13441290
16:91344x7681290
21:91536x6721290

Fixed Tampermonkey / Gemini Environment

  • Fixed Chrome profile: .chrome-debug/tampermonkey-profile
  • Fixed CDP port: 9226
  • Default proxy: http://127.0.0.1:7890
  • Production userscript artifact: dist/userscript/gemini-watermark-remover.user.js

Platform notes:

  • macOS launcher uses /usr/bin/open -na "Google Chrome.app" --args ...
  • macOS default Chrome app lookup:
    • /Applications/Google Chrome.app
    • ~/Applications/Google Chrome.app
  • Override Chrome location on any platform with GWR_DEBUG_EXECUTABLE_PATH

Open the Fixed Profile

  • Shell launcher: ./scripts/open-fixed-chrome-profile.sh
  • Node launcher: node scripts/open-tampermonkey-profile.js --cdp-port 9226
  • CMD launcher: .\scripts\open-fixed-chrome-profile.cmd
  • PowerShell launcher: .\scripts\open-fixed-chrome-profile.ps1

Default behavior:

  • Reuse the fixed Chrome profile
  • Open remote debugging on port 9226
  • Use the local proxy
  • The plain Node launcher opens the Tampermonkey Chrome Web Store page by default unless --url is passed
  • The shell wrapper opens the local probe page on http://127.0.0.1:4173/tampermonkey-worker-probe.html by default and still forwards extra args
  • The current CMD/PowerShell wrappers are fixed shortcuts to the same local probe page; they do not forward additional CLI args

macOS quick path:

  1. Run pnpm build
  2. Start the local artifact server, for example pnpm dev
  3. Open the fixed profile with ./scripts/open-fixed-chrome-profile.sh --url https://gemini.google.com/app
  4. If you do not want the repo's default proxy, pass --proxy off

One-Time Manual Setup

Do this only once in the fixed profile:

  1. Install Tampermonkey.
  2. Enable Allow User Scripts in Chrome extension details.
  3. Keep Developer Mode enabled.
  4. Install public/tampermonkey-worker-probe.user.js when local probe validation is needed.
  5. Install or reinstall the production userscript from the current local build server when validating the latest build.
    • Use the active local build server URL printed by pnpm dev
    • pnpm dev starts probing from http://127.0.0.1:4173/ and will auto-increment if that port is occupied
    • A previously confirmed request-layer debugging session used http://127.0.0.1:4317/userscript/gemini-watermark-remover.user.js, but do not assume that is still current

Local Build and Services

  • Production build: pnpm build
  • Local dist server: pnpm dev, pnpm serve, or the active local build server for this worktree
  • Default pnpm dev start port: http://127.0.0.1:4173/
  • Actual active dev server port may be higher; always trust the current pnpm dev console output
  • Probe smoke test: pnpm probe:tm
  • Installed userscript freshness check: pnpm probe:tm:freshness
  • Open fixed profile: pnpm probe:tm:profile

Current pnpm probe:tm behavior:

  • in run mode it now attempts a Tampermonkey userscript freshness preflight first
  • if freshness returns stale, probe:tm must fail before running the worker/bridge smoke page
  • if the freshness preflight context itself is unavailable, for example:
    • fixed 9226 profile is not open
    • the CDP endpoint is unavailable
    • the editor is mid-navigation then the preflight is recorded as skipped and the smoke flow continues
  • this keeps stale installs fail-fast without making probe:tm hard-depend on a manually opened editor page

Installed Userscript Freshness Check

When real-page behavior does not match the current worktree, verify the installed userscript body, not just the script name or @version.

  • Same @version does not guarantee the fixed profile is running the latest build.
  • A stale Tampermonkey script can still show:
    • [Gemini Watermark Remover] Initializing...
    • [Gemini Watermark Remover] Ready
    • while silently missing newer request-layer fixes such as the download sticky intent window
  • Preferred check:
    1. Open the Tampermonkey editor for Gemini NanoBanana 图片水印移除
    2. Run pnpm probe:tm:freshness
    3. Read .artifacts/tampermonkey-freshness/latest.json
  • If you just reinstalled the userscript and the check still reports stale, refresh the already-open Tampermonkey editor page once, then run pnpm probe:tm:freshness again.
  • Current command behavior:
    • exits 0 when the installed userscript exactly matches the local dist/userscript/gemini-watermark-remover.user.js
    • exits 1 when the installed userscript is stale or mismatched
    • compares full normalized source hashes, not just @version
    • also reports whether expected markers are missing
  • Current report path:
    • .artifacts/tampermonkey-freshness/latest.json
  • Manual fallback if needed:
    1. Compare the installed source against dist/userscript/gemini-watermark-remover.user.js
    2. Confirm the installed source contains the expected newer markers before continuing real-page debugging
      • DEFAULT_DOWNLOAD_STICKY_WINDOW_MS
      • downloadStickyUntil
      • getActionContextFromIntentGate(intentGate = null, candidate = null)
    3. Refresh the real Gemini page after the fixed profile is updated

Real Gemini Page Validation

Target page:

  • https://gemini.google.com/app

Minimum validation flow:

  1. Run pnpm build
  2. Reinstall the latest userscript in the fixed profile
  3. Open the real Gemini page
  4. Check that the console shows:
    • [Gemini Watermark Remover] Initializing...
    • [Gemini Watermark Remover] Ready
  5. If bridge validation is needed, trigger from page side:
    • gwr:userscript-process-request
    • Expect gwr:userscript-process-response

Current confirmed request-layer behavior on the fixed profile:

  • copy can populate the strict original binding path through real rd-gg asset fetches and then place a processed image/png onto the clipboard
  • download stays on Gemini's native c8o8Fe -> gg-dl -> rd-gg-dl export flow; the userscript does not cancel the click
  • the userscript keeps explicit download intent alive for Gemini download asset URLs long enough to catch late rd-gg-dl requests on the native chain
  • If the original URL binding is unavailable when the required download/original request arrives, the action must fail closed with:
    • 无法获取原图,请刷新页面后重试
  • A successful real-page full-size download currently produces:
    • a browser download event
    • a blob-backed saved file such as Gemini_Generated_Image_vusbaevusbaevusb.png
    • local detector result skipReason=no-watermark-detected

Real-Page Pixel Verification

  • Single image compare: pnpm probe:real-page:compare
  • All ready images on the current Gemini page: pnpm probe:real-page:compare --all
  • Latest batch summary:
    • .artifacts/real-page-pixel-compare/latest-summary.json
  • Complex-figure validation checklist:
    • docs/complex-figure-verification-checklist.md

Use this when page-level screenshots are not enough and you need original blob pixel metrics for before/after.

Do not rely on hardcoded sample counts here. Treat .artifacts/real-page-pixel-compare/latest-summary.json as the source of truth for the current worktree.

Current checked local summary in this worktree:

  • artifact timestamp: 2026-04-06T07:25:13.120Z
  • total = 1
  • the recorded ready image landed at:
    • afterSpatial ~= -0.2707
    • afterGradient ~= 0.1075

Historical multi-image baselines from earlier fixed-profile sessions should be treated as dated reference points, not as the current expected batch shape.

Current Preview Display Path

Current production expectation for real Gemini preview display is:

  • keep request-layer preview interception enabled as an early processing source and observability point
  • do not assume Gemini's final displayed blob: image is fully controlled by the page fetch hook chain
  • keep src/shared/pageImageReplacement.js as the production display path for preview replacement
  • treat request-layer preview handling as supportive, but rely on page-level replacement to guarantee the user-visible preview is actually de-watermarked

Current real-page success signal for preview display:

  • the displayed image reaches:
    • data-gwr-page-image-state=ready
    • data-gwr-watermark-object-url=blob:...
  • detector on that processed overlay blob reports:
    • skipReason=no-watermark-detected

Confirmed Performance Pitfalls

When the user reports "this version became much slower", check these first before touching the core algorithm:

  1. Page runtime / page bridge did not actually install into the real Gemini page.
    • Symptom:
      • Real page silently falls back to the userscript sandbox / slow main-thread path.
      • Earlier bad runs showed removeWatermarkMs on the order of 11s ~ 13s for a single preview image.
    • Verify:
      • Reinstall the latest userscript from the current active build server
        • use the actual userscript URL from the active pnpm dev server
        • the server starts probing from http://127.0.0.1:4173/ and may auto-increment
      • Refresh the real page
      • Confirm console reaches Initializing... and Ready
      • Confirm preview images continue to page image process success
  2. Preview queue blocked by a blob: image that is not renderable yet.
    • Symptom:
      • One image gets stuck at state=processing
      • The element often has complete=false, naturalWidth=0, naturalHeight=0
      • Later images stop progressing because the serial queue is effectively wedged
    • Current fix:
      • src/shared/pageImageReplacement.js now waits for renderability and retries instead of processing immediately
    • If this regresses, inspect the waiting / retry path before changing watermark math
  3. Preview-anchor cleanup accidentally doing expensive work that is not adopted.
    • Symptom:
      • Main thread is busy, but output source does not include a successful +subpixel
      • Earlier bad runs showed subpixelRefinementMs ~= 80ms ~ 115ms on strong preview samples with no accepted subpixel shift
    • Current fix:
      • preview-anchor cleanup no longer runs the expensive subpixel refinement path
      • It relies on cheaper preview edge cleanup instead
    • Rule:
      • Do not re-enable preview-anchor subpixel search unless you have a real fixture that proves the accepted result is both safer and materially better

Confirmed Quality / Performance Tradeoff

For strong real-page preview samples, the current strategy is:

  • Skip expensive preview-anchor subpixel refinement
  • Use stronger preview edge cleanup only when:
    • the image is a preview-anchor style match
    • spatial residual is already low enough to be safe
    • gradient residual is still strong enough to justify cleanup

Why this exists:

  • It lowers strong-sample real-page residual gradient from roughly 0.53 to roughly 0.30
  • It keeps preview-anchor cleanup latency low by avoiding no-op subpixel sweeps
  • It accepts some spatial drift to stay within a safe residual envelope rather than overfitting and risking content damage

Confirmed Download / Copy Integration Constraint

Do not re-enable the old active direct-download click hook in production.

Confirmed real-page failure mode on https://gemini.google.com/u/1/app/d3cd7d14852ecd3b?pageId=none:

  • When the userscript intercepts 下载完整尺寸的图片 at capture time and calls preventDefault()/stopImmediatePropagation(), Gemini's own download flow is blocked before it can issue its native c8o8Fe / rd-gg-dl chain.
  • In that state, the userscript only has the earlier history bootstrap bindings from hNvQHb.
  • Current real hNvQHb bindings are mostly preview-style gg/...=s0 URLs, not the final native download URL.
  • Falling back to those preview bindings makes the userscript attempt its own fetch path too early, which previously surfaced as:
    • Original image is unavailable for download processing
    • or Failed to fetch image: 403
    • followed by the user-facing retry alert

There is a second real-page failure mode to keep in mind even after removing the active click hook:

  • Gemini's native full-size download chain can be much slower than the base intent window.
  • On the 2026-04-04 fixed-profile trace:
    • c8o8Fe request started about +50ms after click
    • c8o8Fe response returned about +22.4s
    • final rd-gg-dl ... image/png arrived about +23.9s
  • A plain 5000ms intent window expires far too early, so the passive request hook stops processing before the final full-size image request appears.

Current correct production shape:

  • keep the intent gate for copy / download gestures
  • keep Gemini RPC discovery hooks (hNvQHb, c8o8Fe, related batchexecute responses)
  • keep generated-asset fetch interception for the native request flow
  • let Gemini continue its own click handling
  • do not block the button just to start a parallel userscript-only download path
  • keep a download-specific sticky intent window for Gemini download asset URLs
    • current default: 30000ms
    • release it after terminal success/failure so it does not leak across actions

Current confirmed real-page result with the passive native chain plus sticky download intent:

  • 下载完整尺寸的图片 produced a browser download event
  • the resulting download used a blob URL generated from the page flow
  • the saved file was 3136 x 1344, about 5.4MB, sha256 4e945813779b58a5eda0f01f7973c924210477a84ae1d3826138f57b60eb691f
  • local detector on that downloaded file reported:
    • skipReason = no-watermark-detected
    • originalSpatialScore ~= -0.4096
    • originalGradientScore ~= 0.0826
  • no 无法获取原图,请刷新页面后重试 alert appeared
  • 复制图片 wrote an image/png item to the clipboard without a failure alert
  • the request-layer verification report path is session-specific; do not assume an older dated artifact still exists in the current worktree

Worker Debug Flow

For reproduction only. This is not the default production path.

  1. In the real page DevTools, run:
    • localStorage.setItem('__gwr_force_inline_worker__', '1')
  2. Refresh https://gemini.google.com/app/...
  3. Inspect console logs

Current confirmed result:

  • The real Gemini page can attempt to start the inline worker.
  • The worker crashes during startup because of CSP / runtime restrictions.
  • Production must stay on the main-thread path by default.
  • The force flag is for debugging only.

Worker Success / Failure Criteria

Do not treat new Worker(blobUrl) returning without an immediate throw as proof that the worker is usable.

Current correct criteria:

  • If [Gemini Watermark Remover] Worker acceleration enabled appears, that only means startup was attempted.
  • The worker is only considered usable if the startup handshake succeeds.
  • If [Gemini Watermark Remover] Worker initialization failed, using main thread: ... appears, safe fallback has happened.
  • After fallback, the page should still continue with:
    • page image process start
    • page image process strategy
    • page image process success

Known Constraints

  • Direct new Worker(blobUrl) from Tampermonkey DOM sandbox is not reliable in the current environment.
  • The real Gemini page has CSP restrictions, so worker assumptions must not be based on probe-page success.
  • Runtime flags must be read across unsafeWindow; reading only the userscript sandbox globalThis/localStorage is insufficient.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.