Skip to content

About

UNDERCOVER — Clean-room AI contribution watermark neutralization skill, SessionStart/PreToolUse guards, Git 3-layer hooks & safe history scrubber for Claude Code, Antigravity, Codex, and Cursor (MIT)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

UNDERCOVER — AI Contribution Watermark Neutralization Skill

Zero Attribution Drift: Full-Stack Undercover Protocol, Tool Hardening, Git Guard Hooks & Safe History Scrubber

Built for Claude Code, Google Antigravity, OpenAI Codex, Cursor, Gemini CLI, OpenCode, and Aider

CI License: MIT Agent Skills Spec Zero Dependencies

Install in 1 Command · 6-Layer Defense Architecture · CLI Reference · Clean-Room Notice · 한국어 안내 (Korean)


Why UNDERCOVER?

AI coding agents leave attribution watermarks across multiple layers of your Git workflow—often silently breaking corporate commitlint rules, DCO policies, changelog parsers, or public repository hygiene:

  • Git Commit Trailers & Bot Identities: Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>, Made-with: Cursor, Co-authored-by: Copilot, Assisted-by: codex:..., and Aider's (aider) author suffix.
  • PR & Issue Footers: 🤖 Generated with [Claude Code](https://claude.com/claude-code), HTML attribution comments, and confidential project references.
  • Agent Trace Files: Accidental staging of .claude/settings.local.json, CLAUDE.local.md, .cursorrules, .aider.chat.history.md, or exposing tooling hints in .gitignore instead of private .git/info/exclude.
  • Source Comments & Invisible Unicode Watermarks: // Generated by Claude Code headers, Unicode Tag blocks (U+E0000–U+E007F), stray zero-width characters (U+200B/200C/200D/2060/FEFF), Trojan Source bidi overrides, and LLM typographic tells (U+202F narrow no-break space).
  • Existing Unpushed History: Watermarks already baked into local commits before hooks or configs were hardened.

UNDERCOVER combines a cross-agent Agent Skill (skills/undercover/SKILL.md) with a zero-dependency Python 3.9+ CLI (skills/undercover/scripts/undercover.py) that automatically activates on external/public repos, injects clean-contribution session policies, and audits/prevents/scrubs all watermark layers offline.


Installation

Running ./install.sh enables full automatic protection by default in a single command:

  1. Agent Skill files installed globally for Codex (~/.agents/skills), Antigravity (~/.gemini/config/skills), and Claude Code (~/.claude/skills).
  2. Automatic Agent Hooks (SessionStart + PreToolUse) & Claude Code attribution: {"commit": "", "pr": ""} hardening (with automatic timestamped backups).
  3. Global Git 3-Layer Hooks (commit-msg auto-scrub, pre-commit guard, pre-push gate) in ~/.config/undercover/hooks via core.hooksPath (auto-chaining each repo's local hooks).
git clone https://github.com/planners1490/undercover.git
cd undercover

# Default: full install (skills + SessionStart/PreToolUse hooks + global Git hooks)
./install.sh

# Install across every supported agent (Codex, Antigravity, Claude Code, Cursor, Gemini CLI, OpenCode) + hooks
./install.sh --all

# Workspace-only install into a single repository (local skills, local hooks & repo .git/hooks)
./install.sh --local /path/to/your-repo

# Opt-out flags if you only want skill files without touching global hooks
./install.sh --skills-only
./install.sh --no-agent-hooks
./install.sh --no-git-hooks

# Remove global Git hooks anytime
./install.sh --uninstall-hooks

6-Layer Defense Architecture

Layer Mechanism What It Neutralizes
1. Auto-Scope Policy init-policy, repo-status Fail-closed git remote classifier (~/.config/undercover/config.json): stands down only when every remote matches your internal_remotes allowlist; stays active on external/public/unconnected repos or when UNDERCOVER_FORCE=1. Also enforces custom blocked_terms.
2. SessionStart Auto-Injection session-start Dual-protocol SessionStart hook for Claude Code (additionalContext) and Antigravity (injectSteps) that automatically injects clean-contribution guidance at session start/resume/compact on external repos.
3. Agent Skill Protocol SKILL.md Cross-agent instructions stopping agents from emitting trailers, PR footers, AI code comments, or staging trace files.
4. Tool Config Hardening harden-configs Sets Claude Code attribution: {"commit": "", "pr": ""}, registers SessionStart + PreToolUse hooks, sets Aider attribute-*: false, VS Code/Cursor git.addAICoAuthor: false, and private .git/info/exclude.
5. PreToolUse & Git 3-Hook Guard pre-tool-guard, install-hooks Blocks watermarked git commit/gh pr/git add before execution, and enforces commit-msg (auto-scrub or block), pre-commit (blocks agent files, AI comments, blocked terms & invisible Unicode), and pre-push (final outgoing commit gate).
6. Audit & Safe Scrub audit, clean-unicode, clean-comments, scrub Grades repository stealth (A–F), cleans files while preserving emojis/CJK/RTL joiners, and safely rewrites unpushed commits via pure git commit-tree with automatic backup refs (refs/undercover-backup/...).

CLI Subcommands

All mutating commands default to safe dry-run and require --apply to write changes.

# 1. Configure optional internal-remote allowlist & confidential blocked terms (fail-closed on external repos)
python3 skills/undercover/scripts/undercover.py init-policy \
  --mode auto \
  --internal-remotes "github.com/my-private-org/*" \
  --blocked-terms "ConfidentialProject,internal-wiki.local" \
  --apply

# Check evaluated scope for any repository
python3 skills/undercover/scripts/undercover.py repo-status /path/to/repo

# 2. Full 4-surface watermark audit (commits, artifacts, files, local tool configs)
python3 skills/undercover/scripts/undercover.py audit /path/to/repo --output /tmp/undercover.json

# 3. Harden Claude Code (+ SessionStart & PreToolUse hooks), Antigravity hooks, Aider, editors, and .git/info/exclude
python3 skills/undercover/scripts/undercover.py harden-configs --claude --with-claude-hook --antigravity-hook --project /path/to/repo
python3 skills/undercover/scripts/undercover.py harden-configs --claude --with-claude-hook --antigravity-hook --project /path/to/repo --apply

# 4. Install Git hooks (repo-local with safe chaining, or global across all repos)
python3 skills/undercover/scripts/undercover.py install-hooks --repo /path/to/repo --mode scrub --chain --apply
python3 skills/undercover/scripts/undercover.py install-hooks --global --mode scrub --apply

# 5. Sanitize a PR body or commit draft via stdin
cat pr_body.md | python3 skills/undercover/scripts/undercover.py sanitize-text --kind pr

# 6. Clean invisible Unicode watermarks & AI comment headers in working tree
python3 skills/undercover/scripts/undercover.py clean-unicode /path/to/repo --apply
python3 skills/undercover/scripts/undercover.py clean-comments /path/to/repo --apply

# 7. Safely scrub unpushed local commit history (creates automatic rollback ref)
python3 skills/undercover/scripts/undercover.py scrub /path/to/repo
python3 skills/undercover/scripts/undercover.py scrub /path/to/repo --apply

Running the Test Suite

python3 -m unittest discover -s tests -v

Clean-Room & Copyright Notice

UNDERCOVER is an independently authored, 100% clean-room open-source project released under the MIT License:

  • Contains zero proprietary source code, internal identifiers, internal codenames, or prompt text copied from any third-party vendor.
  • Interoperates solely through standard Git hooks (commit-msg, pre-commit, pre-push), publicly visible Git commit trailer conventions, and publicly documented official configuration/hook interfaces (settings.json, hooks.json).
  • Confidential keyword redaction (blocked_terms) is strictly user-supplied in local machine configuration (~/.config/undercover/config.json) and never hardcoded to any vendor's proprietary terminology.

Part II — 한국어 안내 (Korean)

UNDERCOVER란?

**UNDERCOVER**는 Claude Code, Antigravity, Codex, Cursor, Gemini CLI, OpenCode, Aider 등 AI 코딩 에이전트가 커밋·PR·코드·설정 파일에 남기는 모든 AI 기여 워터마크를 탐지·차단·무효화하는 풀스택 클린룸(Clean-Room) AI 스킬 + 오프라인 검증/정리 CLI입니다.

6단계 방어 구조

  1. 원격 저장소 자동 판별 정책 (init-policy, repo-status)
    • ~/.config/undercover/config.json에 사내/비공개 internal_remotes 허용 목록과 사용자 정의 blocked_terms(사내 프로젝트 코드명·내부 링크 등)를 등록할 수 있습니다.
    • Fail-Closed 원칙: 저장소의 모든 원격(git remote)이 허용 목록에 속할 때만 자동으로 해제되며, 외부/공개 저장소·원격 미연결 로컬 저장소·UNDERCOVER_FORCE=1 환경에서는 자동으로 활성화됩니다.
  2. 세션 시작 시 자동 정책 주입 (session-start)
    • **Claude Code (SessionStart / additionalContext)**와 Antigravity (SessionStart / injectSteps) 공식 문서화 훅 규격을 모두 자동 판별하여, 외부/공개 저장소 세션이 시작되거나 재개·컴팩트될 때 클린룸 기여 규율을 자동 주입합니다.
  3. 에이전트 언더커버 프로토콜 (SKILL.md)
    • 커밋 트레일러(Co-Authored-By, Made-with: Cursor, Assisted-by), PR 푸터(🤖 Generated with ...), AI 주석, 에이전트 흔적 파일 스테이징을 생성 단계부터 억제합니다.
  4. 로컬 도구 설정 자동 하드닝 (harden-configs)
    • Claude Code ~/.claude/settings.json에 공식 스키마 "attribution": {"commit": "", "pr": ""} 및 SessionStart·PreToolUse 훅을 자동 등록(백업 포함)하고, Antigravity hooks.json, Aider(.aider.conf.yml), VS Code/Cursor(git.addAICoAuthor: false), 비공개 .git/info/exclude까지 일괄 구성합니다.
  5. 실행 전 차단 훅 + Git 3중 훅 (pre-tool-guard, install-hooks)
    • PreToolUse 훅이 워터마크·기밀 키워드·흔적 파일이 포함된 git commit/gh pr/git add 명령 실행을 사전에 차단합니다.
    • Git commit-msg(자동 세탁/차단), pre-commit(흔적 파일·AI 주석·기밀 키워드·비가시 유니코드 차단), pre-push(원격 푸시 직전 최종 검사) 3중 방어를 제공합니다.
  6. 전수 감사·유니코드/주석 정리·안전한 로컬 히스토리 세탁 (audit, clean-unicode, clean-comments, scrub)
    • 한글·이모지 ZWJ(👨‍💻)·CJK 이체자(IVS)를 보존하면서 Unicode Tag(U+E0000–U+E007F), 제로폭 문자, Bidi 제어문자, LLM 특유 공백(U+202F)만 정밀 제거합니다.
    • scrub은 순수 Python + git commit-tree로 미푸시 커밋만 기본 세탁하며 실행 전 복구 ref(refs/undercover-backup/...)를 자동 생성합니다.

클린룸(Clean-Room) 저작권 준수 원칙

본 프로젝트는 특정 벤더의 비공개 소스코드·내부 코드명·내부 식별자·프롬프트 문구를 일절 포함하지 않고, 공개된 Git 표준 및 공식 문서화된 설정/훅 인터페이스만을 사용해 독립적으로 작성된 100% 클린룸 MIT 오픈소스 구현체입니다.

빠른 설치 (기본값으로 자동 방어 일괄 활성화)

./install.sh 한 번만 실행하면 스킬 설치 + Claude Code/Antigravity SessionStart·PreToolUse 훅 자동 등록 + 전역 Git 3중 훅 설치가 기본값으로 함께 활성화됩니다(기존 설정 자동 백업, 기존 로컬 Git 훅 자동 체이닝).

git clone https://github.com/planners1490/undercover.git
cd undercover

# 기본 전체 설치 (Codex·Antigravity·Claude Code 스킬 + 에이전트 훅 + 전역 Git 훅)
./install.sh

# 모든 지원 에이전트 전역 설치 (Cursor, Gemini CLI, OpenCode 포함) + 자동 훅 활성화
./install.sh --all

# 훅 없이 스킬 파일만 설치하고 싶을 때
./install.sh --skills-only

# 전역 Git 훅 해제
./install.sh --uninstall-hooks

About

UNDERCOVER — Clean-room AI contribution watermark neutralization skill, SessionStart/PreToolUse guards, Git 3-layer hooks & safe history scrubber for Claude Code, Antigravity, Codex, and Cursor (MIT)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages