implement
Audited by Socket on Aug 17, 2026
1 alert found:
SecurityThis module is primarily a local automation utility that removes merged Git worktrees/branches using git plus PR state from GitHub via the gh CLI. The dominant security concern is high-impact arbitrary code execution: if the repository contains a file at .agents/hooks/cleanup, the script executes it directly with subprocess.run, and that repository-controlled code runs with the privileges of the cleanup process. The code also performs destructive git operations (worktree/branch deletion) based on external-tool outputs, though it includes some safeguards to avoid deleting the current directory’s worktree and to skip dirty worktrees. No clear evidence of traditional stealth malware or data theft appears in the shown logic, but the hook execution pattern makes supply-chain and local-repo compromise scenarios significantly dangerous.