Migrating AI Coding Tool Local Caches and Freeing Up C Drive Space

    This article explains why AI coding tools gradually fill up the system drive and how to move their local state data to another disk using symbolic links. It covers the four main categories of local data, a comparison of migration approaches, a pre-migration checklist, handling process locks, the standard migration and verification steps, rollback procedures, long-term space governance, and common mistakes to avoid.

    1. Background: The System Drive Fills Up Quietly

    Over the past couple of years, AI coding tools (AI IDEs and code assistants) have become part of the everyday development workflow. The convenience is obvious: natural language code generation, cross-file completion, automated refactoring, unit test drafts, error explanations, and more. But behind that convenience sits an easily overlooked engineering problem: rapid growth of local state data.

    The typical symptom is that after a month or two, free space on the system drive drops from tens of gigabytes to nearly zero bytes. The tool starts misbehaving with errors like “cannot create a new session,” “completion unresponsive,” and “index rebuild failed.” Only at that point do users realize the problem is on the disk.

    It is worth stressing that this usage is not simply “cache junk.” A significant portion of the files are required data that the tool depends on to run normally. Deleting them outright breaks indexes, loses session history, disables plugins, and may even force a full workspace re-initialization. So the right approach is not to delete, but to move.

    2. Root Cause Analysis: What Is Actually Eating the Space

    Local data for AI coding tools falls into roughly four categories, and understanding their nature is the prerequisite for designing a migration strategy.

    1. Model and Weight Caches

    Some tools keep model files or quantized copies locally to reduce time-to-first-token and enable offline use. A single file is typically hundreds of MB to a few GB, and they accumulate by version, with old versions never cleaned up automatically.

    2. Plugin and Extension Directories

    The plugin system follows the general IDE extension model: each plugin carries bundled artifacts, type declarations, a dependency tree, and documentation resources. As the number of plugins grows, the directory size grows roughly linearly, and multiple versions often coexist.

    3. Inference and Session State Data

    Conversation records, context snapshots, intermediate reasoning traces, and tool call results are high-frequency write data. The characteristics are many fragments, frequent writes, and long lifetimes, and over long-term use this often becomes the largest category by share.

    4. Logs and Index Artifacts

    Log files roll daily, and code indexes and symbol tables grow with repository size. For a large monorepo, an index of several GB is common.

    A simplified illustrative structure looks like this (a generic shape only, not representative of any specific implementation):

    1. <user home>/
    2. ├── .tool/ # config and plugin root
    3. │ ├── extensions/ # plugins and dependencies
    4. │ └── cache/ # models and intermediate artifacts
    5. ├── .tool-reasoning/ # session and reasoning state
    6. └── logs/ # rolling logs

    The conclusion: what these directories have in common is that they can be relocated but must not be casually deleted, which is exactly the scenario where a symbolic link approach fits.

    Before starting, compare the common approaches used in the industry to avoid picking the wrong path.

    Approach Advantages Risks
    Delete the cache directory directly Simplest to do Index and session loss, requires re-initialization
    Change the path via tool configuration Clear semantics Most tools do not expose customization for all directories
    Mount a volume / partition redirection Stable Requires repartitioning, high cost
    Symbolic link Transparent to the application, rollbackable Needs admin privileges, must handle process locks

    The core value of a symbolic link is decoupling path semantics from physical location: the application accesses files at the original path, and the operating system redirects the request to the target disk at the filesystem layer. To the tool, everything is “still in place,” so no configuration change is needed, and there is no risk of configuration breaking after a version upgrade.

    Be clear about its boundaries: a symbolic link is a filesystem-level mechanism, not a backup, and it provides no redundancy. If the target disk fails, the data is lost just the same, and important workspaces should still be covered by a regular backup strategy.

    4. Pre-Migration Checklist

    A rigorous migration should narrow the risk surface first. Confirm the following items in order:

    1. Confirm the space gain: measure the size of each candidate directory first and estimate the reclaimable space, to avoid an insufficient payoff after migration.
    2. Confirm free space on the target disk: available space on the target partition should be significantly larger than the volume to be moved, with room left for future growth.
    3. Confirm filesystem consistency: crossing filesystems (for example, linking from NTFS to FAT32/exFAT) can cause permission and link behavior anomalies, so it is recommended that the target partition use the same type of modern filesystem.
    4. Confirm privileges: creating a symbolic link is a system-level operation and requires admin privileges; it will fail under normal privileges.
    5. Confirm no process is holding files: this is the step with the highest failure rate, explained separately in the next section.
    6. Confirm rollback is possible: before migrating, record the original absolute path of each directory as the basis for rollback.

    5. Key Difficulty: Process Locks and File Handles

    Even after the UI is closed, AI coding tools usually leave background resident processes behind (language services, index services, plugin hosts, and so on). These processes hold file handles, so moving a directory fails with “file in use,” producing a partially migrated intermediate state. This is the outcome to avoid most, because at that point the data is half on the source disk and half on the target disk, the link has not been created yet, and the tool may read incomplete data.

    The handling principles are:

    • Prefer shutting down the tool and its tray processes through the normal exit flow;
    • Confirm no residual background processes remain before running the migration;
    • If residuals exist, use the operating system’s built-in process management to end the corresponding process tree rather than deleting the directory outright;
    • Do not launch the tool during migration; start it only after the migration is complete and verified.

    A generic way to end a process tree on Windows (example only, no third-party tools involved):

    1. :: List residual processes
    2. tasklist | findstr /i "node"
    3. :: End the given PID and its child processes
    4. taskkill /PID 12345 /T /F

    The equivalent approach on Linux:

    1. ps -ef | grep -i node
    2. kill -TERM <PID> # terminate gracefully first, force only if necessary

    6. Standard Migration Procedure

    The steps below assume manual operation, and any automation script should follow the same order and verification points.

    1. Exit the tool completely and confirm no background processes remain.
    2. Open a terminal as administrator.
    3. Move the source directory as a whole to the target location (move, not copy, to avoid two copies of the data causing misjudgment).
    4. Create a symbolic link at the original path pointing to the new location.
    5. Verify the link is accessible and the content is complete.
    6. Start the tool and confirm the index, session history, and plugins all work.

    The generic command to create a directory link on Windows:

    1. mklink /D "C:\Users\<username>\.tool" "D:\AIState\.tool"

    The corresponding commands on Linux / macOS:

    1. mv ~/.tool /mnt/data/AIState/.tool
    2. ln -s /mnt/data/AIState/.tool ~/.tool

    The verification step cannot be skipped. At minimum, confirm three things:

    1. # 1. Whether the link points to the right place
    2. ls -ld ~/.tool
    3. # 2. Whether key subdirectories are readable
    4. ls ~/.tool/extensions | head
    5. # 3. Whether space on the source disk has been freed
    6. df -h /

    7. Rollback Strategy: Always Keep an Undo

    Any storage migration should be treated as a reversible operation. The rollback steps are: exit the tool → delete the symbolic link (delete only the link, not the target data) → move the data back to the original path → start and verify.

    Key caution: when deleting the link, do not use a recursive delete that targets the contents, otherwise you may wipe the real data on the target disk directly. The safe approach is to first confirm it is a link, then remove the link itself separately.

    1. # Confirm it is a link (output contains -> pointing to)
    2. ls -ld ~/.tool
    3. # Remove only the link
    4. rm ~/.tool

    8. Long-Term Governance: From a One-Time Move to Ongoing Control

    Migration only stops the bleeding; over the long term you also need to control growth:

    • Periodic inspection: include candidate directory sizes in routine checks and set threshold alerts;
    • Log rotation: configure a retention period for the log directory to avoid unlimited growth;
    • Plugin pruning: uninstall plugins that have gone unused for a long time to reduce multi-version leftovers;
    • Index scope control: configure ignore rules for very large repositories to reduce meaningless indexing;
    • Observability: use general monitoring and alerting to set tiered thresholds on system drive usage, intervening early at the 80% and 90% levels;
    • Cloud coordination: sync sessions and artifacts that need long-term retention to managed services such as object storage, keeping only hot data locally.

    If you use a cloud development environment or a container platform, a more thorough approach is to mount the state directories on a separate data volume so data survives environment rebuilds, avoiding system drive bloat at the architecture level.

    9. Common Misconceptions

    1. “Deleting the cache is the easiest fix”: it ignores the cost of rebuilding models and indexes, and ends up slower.
    2. “Copy it, then delete the original directory”: this easily leaves two inconsistent copies of the data, and the tool reads stale data.
    3. “Normal privileges are enough to create a link”: creating a symbolic link requires higher privileges, so when it fails, check permissions instead of retrying repeatedly.
    4. “Migration can be done while still working”: process locks will interrupt the migration halfway, so you must clear the field first.
    5. “Once the link is created, everything is fine”: target disk capacity and backup strategy need planning too.

    10. Summary

    AI coding tools consuming the system drive is essentially a scale effect of local state data, not a design flaw. The right path for handling this class of problem is: first analyze the nature of each directory and separate what can be deleted from what can only be moved; then use symbolic links to decouple paths from physical storage; make process locks, privileges, verification, and rollback mandatory parts of the procedure; and finally bring space usage under long-term governance through inspection, log rotation, and monitoring alerts. Following this practice, you can typically and reliably free up tens of gigabytes on the system drive while keeping tool configuration and historical data intact.