How to Completely Uninstall a Local AI Agent: A Full Cleanup Guide

    This guide provides a step-by-step framework for completely removing a local AI agent from your system. Learn how to stop background processes, clean up configuration files and credentials, delete scheduled tasks, and verify that no residual files or permissions remain. It covers Linux, macOS, and Windows, and includes commands for package managers, systemd, cron, and containers.

    1. The Problem and the Core Challenges

    As large language models become more capable on consumer hardware, more users are running AI agent applications that use local compute, read and write files, and perform automated tasks. These tools usually run as a standalone desktop app or a background daemon and often have broad privileges: they can access the clipboard, create scheduled jobs, modify workspace documents, and spawn child processes.

    When you decide to stop using one of these tools—for performance reasons, privacy concerns, or simply a workflow change—dragging the app icon to the Trash is usually not enough. There are four main reasons:

    1. Leftover configuration and credentials: To keep you logged in and remember your preferences, an agent typically stores session tokens, API keys, and custom settings in a hidden dot-directory in your home folder. If these weakly protected credentials leak through a backup, your account is effectively exposed.
    2. Background processes and auto-start entries: Some agents keep a background process running in the system tray or register themselves to launch at login. Deleting the main app files does not stop these background components.
    3. Scheduled tasks and hook scripts: Many users configure agents to run periodic syncs or automated note cleanup. If you forget to remove these scheduled entries, you may waste resources or end up with scripts that keep failing because they point to paths that no longer exist.
    4. Filesystem links and permission changes: Some agents request Full Disk Access, Accessibility, or network capture permissions and create symbolic links in working directories. A thorough cleanup should revoke those permissions and remove those links so you do not leave behind a security gap.

    This guide provides a product-agnostic, phased approach that works for most local AI agent tools.


    2. Phase 0: Environment Discovery and Information Gathering

    Before planning the uninstall, map the agent’s footprint on your machine. Run the appropriate checks for your operating system.

    2.1 Identify the operating system and package manager

    Different operating systems have very different conventions for where software is installed. On Unix-like systems, you can quickly identify the distribution and kernel with a few basic commands:

    1. uname -s # Operating system type
    2. cat /etc/os-release # Distribution details on Linux
    3. sw_vers # Version details on macOS

    Once you know the system type, determine where the agent came from:

    Installation source Typical characteristics Cleanup entry point
    Official installer (pkg/dmg/msi/exe) System-level install, requires admin password Apps list in System Settings, or the vendor’s package tool
    Language runtime package manager (npm/pip/cargo/brew) Installed in user-level directories with many dependencies The package manager’s uninstall command
    Portable binary Single executable extracted from an archive Delete the containing directory
    Containerized deployment Runs as a Docker/Podman image Stop the container and remove the image layers

    2.2 Locate executables and processes

    On Unix-like systems, use which or whereis to find the command path, and ps to find related running processes:

    1. which <agent_binary_name>
    2. ps aux | grep -i agent | grep -v grep

    If you find a background process, note its PID so you can terminate it during the uninstall.

    2.3 Scan user configuration directories

    Most desktop agents create a dedicated folder in the user’s home directory. Common patterns include dot-directories named after the product (.<productname>/), XDG-compliant directories (~/.config/<appname>/), and on macOS ~/Library/Application Support/<AppName>/. Run these commands to list likely candidates:

    1. ls -la ~ | grep -iE 'agent|claw|workspace'
    2. ls -la ~/.config/ 2>/dev/null
    3. ls -la ~/Library/Application\ Support/ 2>/dev/null

    3. Phase 1: Graceful Shutdown and Process Termination

    Before deleting anything, shut the agent down gracefully for two reasons: to avoid corrupting configuration files that are being written, and to give the agent a chance to release file locks and free its ports.

    Recommended sequence:

    1. Use the app menu’s “Quit” option instead of just closing the window.
    2. Check the system tray or menu bar for a remaining icon and quit from there.
    3. Verify in the terminal that the process is gone:
    1. # Find the PID
    2. pgrep -f '<agent_pattern>'
    3. # If the process is still running, send a TERM signal (preferred)
    4. kill <PID>
    5. # If TERM does not work, consider a forced kill (last resort)
    6. kill -9 <PID>

    For agents that auto-start at login, also check these locations after terminating the process:

    • Linux systemd user services: ~/.config/systemd/user/ for a .service file named after the app.
    • macOS Launch Agents: ~/Library/LaunchAgents/.
    • Windows startup folder and the Run registry keys.

    4. Phase 2: Data Backup Decision—Keep or Delete

    This is the step that most requires your own judgment. An agent’s workspace usually holds all the documents, notes, and code snippets you created while working with the AI. This data lives on local disk and will not disappear when you uninstall the app, but it may be erased if you later format the drive or run a system cleanup tool.

    Use this decision tree:

    1. Do you need to keep any workspace documents?
    2. ├── Yes → Copy the workspace directory to external or cloud storage, verify integrity, then delete the local copy
    3. └── No → Move on to the next step

    When backing up, use a method with verification so an interrupted transfer does not corrupt the data:

    1. # Incremental backup with rsync, preserving permissions and timestamps
    2. rsync -avh --progress ~/AgentWorkspace/ /external/backup/path/

    If you decide to keep the workspace, tell any automation assistant you use for the uninstall explicitly: “Keep the Workspace directory; uninstall only the application and its configuration.”


    5. Phase 3: Uninstall the Main Application

    Use the path that matches the installation source you identified in Phase 0.

    5.1 System-level installers

    • macOS: Drag the app from /Applications to the Trash, or run the vendor’s uninstall script if one is provided; then empty the Trash.
    • Windows: Open “Settings → Apps → Installed apps,” find the program, click Uninstall, and follow the wizard. Do not just delete the desktop shortcut.
    • Linux desktop environments: Use the distro’s software center, or run the package manager command:
    1. # Debian/Ubuntu
    2. sudo apt remove --purge <package_name>
    3. sudo apt autoremove # Remove dependencies that are no longer needed
    4. # RHEL/Fedora
    5. sudo dnf remove <package_name>

    5.2 CLI tools installed via a language runtime

    1. # Node
    2. npm uninstall -g <package_name>
    3. # Python
    4. pip uninstall <package_name>
    5. # Rust
    6. cargo uninstall <package_name>

    5.3 Containerized deployments

    1. # Stop and remove the container
    2. docker stop <container_id> && docker rm <container_id>
    3. # Remove the associated image
    4. docker rmi <image_id>
    5. # If a data volume was used, remove it if needed
    6. docker volume rm <volume_name>

    6. Phase 4: Deep Cleanup of Configuration and Credentials

    After the main app is removed, leftover configuration and credentials are the main security risk. Check and delete the following items one by one:

    6.1 User-level configuration directories

    1. # List all possible leftover configuration
    2. find ~ -maxdepth 3 -name "*<agent_keyword>*" -type d 2>/dev/null
    3. find ~ -maxdepth 3 -name "*<agent_keyword>*" -type f 2>/dev/null

    After reviewing the results manually, delete the relevant directories and files. Pay particular attention to these file types:

    • config.json / settings.yaml: default model selection, API endpoints, and similar settings.
    • credentials / token / .env: may contain plaintext or Base64-encoded keys.
    • history.db / conversations.jsonl: conversation history, which may contain private data.

    6.2 System-level configuration

    Some agents write system-level configuration under /etc/ or /Library/. These require admin privileges to inspect:

    1. sudo find /etc /Library -name "*<agent_keyword>*" 2>/dev/null

    6.3 Keychains and credential managers

    • macOS: Open Keychain Access, search for the app name, and delete the matching entries.
    • Windows: Check Windows Credentials and Web Credentials in Credential Manager.
    • Linux: If you use GNOME Keyring or KWallet, clean them up with the corresponding GUI tool.

    6.4 Revoke permissions

    On macOS, open “System Settings → Privacy & Security” and check whether the target app still has entries under these categories:

    • Full Disk Access
    • Accessibility
    • Automation
    • Network Extensions

    On Windows, open “Settings → Privacy & Security” and check camera, microphone, filesystem, and similar permissions one by one. Remove any remaining entries.


    7. Phase 5: Clean Up Scheduled Tasks and Automation Hooks

    If you created scheduled jobs or webhook callbacks while using the agent, these configurations are usually independent of the main app and must be handled separately.

    7.1 Cron jobs (Unix-like systems)

    1. # View the current user's crontab
    2. crontab -l
    3. # If there are agent-related entries, edit and remove them
    4. crontab -e

    Also check the system-level cron directories:

    1. ls /etc/cron.d/
    2. ls /etc/cron.daily/

    7.2 systemd timers (Linux)

    1. systemctl --user list-timers | grep <keyword>
    2. # Disable and remove the corresponding .timer and .service files
    3. systemctl --user disable <timer_name>
    4. rm ~/.config/systemd/user/<timer_name>.timer

    7.3 Task Scheduler (Windows)

    Open Task Scheduler via taskschd.msc, search the task library for agent-related entries, and delete them. You can also query and remove them from the command line:

    1. schtasks /query /fo LIST | findstr /i "agent"
    2. schtasks /delete /tn "task name" /f

    7.4 Git hooks and editor plugins

    If you integrated the agent into your Git workflow through hooks such as pre-commit or post-merge, check the .git/hooks/ directory of each repository and remove non-standard hook scripts. Also check whether your editor has plugins installed that integrate with the agent.


    8. Phase 6: Clear Caches, Logs, and Temporary Files

    Even after the app and configuration are removed, scattered cache data can still consume disk space and may retain sensitive information.

    8.1 Application caches

    1. # Common cache locations on Unix-like systems
    2. rm -rf ~/.cache/<app_name>
    3. rm -rf ~/Library/Caches/<AppName> # macOS
    4. rm -rf ~/AppData/Local/<AppName> # Windows (Git Bash)

    8.2 Log files

    1. # Check common log locations
    2. ls /var/log/ | grep <keyword>
    3. ls ~/Library/Logs/ | grep <keyword>

    8.3 Browser downloads and temporary extracted files

    If you downloaded the installer through a browser or generated temporary files with the agent, do not forget to clean ~/Downloads/ and the system temp directory:

    1. find /tmp -name "*<agent_keyword>*" -mtime +7 2>/dev/null

    9. Phase 7: Verify and Check System Health

    After all cleanup steps, run a systematic scan to confirm the uninstall is complete:

    1. # 1. Search the home directory for the keyword (limited to user-accessible areas to avoid protected system paths)
    2. find ~ -iname "*<agent_keyword>*" 2>/dev/null
    3. # 2. Confirm no related processes remain
    4. ps aux | grep -i <agent_keyword> | grep -v grep
    5. # 3. Confirm no related network connections remain
    6. lsof -i | grep <agent_keyword> # macOS/Linux
    7. netstat -ano | findstr <keyword> # Windows
    8. # 4. Verify auto-start entries are removed
    9. # macOS: System Settings → General → Login Items
    10. # Windows: Task Manager → Startup apps
    11. # Linux: Check ~/.config/autostart/

    If all of these checks pass, the agent has been fully removed.


    10. Best Practices and Long-Term Recommendations

    Reviewing the full process, these core principles are worth reusing whenever you remove any high-privilege local application:

    1. Discover before deleting: Always complete a full scan first and build a four-part checklist covering files, processes, tasks, and credentials. Blind deletion is the main source of leftovers.
    2. Prefer graceful shutdown: Try the normal quit flow first, and escalate to forced termination only when necessary to minimize file corruption and lock leaks.
    3. Never skip credential cleanup: Even if you do not care about the rest of the configuration directory, files containing keys and tokens must be confirmed destroyed. For keys that may exist in paper or electronic backups, proactively revoke them on the corresponding platforms.
    4. Audit scheduled tasks separately: Tasks created by the agent are decoupled from the agent itself. Removing the agent does not remove the tasks, and this is the most commonly overlooked step in practice.
    5. Close the loop with verification: Uninstalling is not the end; verification is. Use a keyword scan, a process check, and a network connection check to confirm there are no ghost remnants.
    6. Document your actions: When performing a multi-step uninstall, record each step in a temporary note so you can trace back and spot anything you missed.

    For teams that need to standardize deployment and rollback of agent software across multiple machines, script the process above and add it to your internal system setup/cleanup toolkit. The main value of scripting is to eliminate the randomness of manual work, ensure every cleanup covers the same checklist, and make it fast to identify which step failed when something goes wrong.

    By following this phased, checklist-based method, both individual users and IT operations staff can approach local AI agent uninstalls with a clear plan and reliable evidence, ultimately restoring a safe, clean, and verifiable system environment.