labali-image-desensitize
Treat this skill as a layered system.
Layer Contract
SKILL.mdis the policy layer.references/architecture.mdis the strategy layer.scripts/sanitize-image.shis the execution layer.
NEVER
- Never overwrite the input file — always write to a separate output path.
- Never report PASS on the sensitive-info scan without completing Step 4.
- Never skip Step 3 diagnostics — before/after comparison is required output regardless of result.
- Never describe this skill as OCR, visible-content review, screenshot redaction, or pixel-level masking.
Pipeline Steps
Execute in fixed order:
If the intent or design rationale of any pipeline step is unclear, load
references/plan.mdbefore proceeding.
Step 1 — Validate prerequisites
- Confirm
magickandexiftoolare available in PATH. - Fail fast with explicit error if either is missing.
- Confirm input image path is readable.
Step 2 — ImageMagick re-encode
- Run
scripts/sanitize-image.shwith input and output paths. - Apply
-resize 99% -resize 101% -strip -quality 90. - Require only two runtime inputs: input image path and output image path.
Step 3 — Diagnostics
- Print before/after comparison:
- file size,
- dimensions,
- EXIF line count,
- SHA256 hash,
- EXIF diff.
Step 4 — Reviewer: sensitive metadata scan
- Run post-sanitize hidden metadata scan on output image via
scripts/check-sensitive-info.sh. - Check EXIF/XMP/IPTC metadata for sensitive key/value patterns.
- Treat the scan as metadata-only:
- do not infer anything from visible UI text, buttons, usernames, or other pixels,
- do not present this skill as a substitute for blur, mosaic, crop, or mask workflows.
- Load
references/model-review.mdfor review rubric. - Print
Sensitive info review: PASS|REVIEW_REQUIRED. - Print
MODEL_REVIEW_SUMMARY+MODEL_REVIEW_JSONpayload. - Apply in-agent model judgment (no API key required):
- read payload from script output,
- decide
PASS|REVIEW_REQUIRED|BLOCK, - report verdict with reason and evidence.
Step 5 — Return result
- In normal mode: report verdict and summary.
- In
--strictmode: exit non-zero when sensitive metadata candidates are detected.
Success Criteria
A run is successful only when all conditions hold:
- Input image is readable.
- Output image is generated at target path.
- Before/after diagnostics are printed.
- EXIF diff section is printed (empty diff is acceptable).
- Post-sanitize sensitive metadata scan section is printed.
- Model review verdict section is printed.
- In strict mode, suspicious hidden metadata produces non-zero exit.
Runtime Inputs
Use skill.yaml as input schema source of truth.
Operational Mode
- Deterministic local shell execution only.
- No browser, no network, no API.
- Keep output reproducible and script-driven.
- Metadata-only scope: no OCR, no visible-content analysis, no pixel redaction.
Resources
- Architecture:
references/architecture.md - Workflow plan:
references/plan.md - Model review rubric:
references/model-review.md - Deterministic script:
scripts/sanitize-image.sh - Post-check script:
scripts/check-sensitive-info.sh - Optional CLI wrapper:
scripts/run.ts - Regression checks:
tests/test_regression.sh