AI Coding Tools Filling Up Your C Drive? Data Types and Safe Migration Guide
AI coding tools can quickly consume C drive space by storing model caches, plugins, and inference logs. This guide explains how to diagnose disk usage, reduce data accumulation at the source, and safely migrate data directories to other drives using directory junctions.
Why Do AI Coding Tools Take Up So Much C Drive Space?
AI coding tools save three types of data locally: model caches, plugins and configuration files, and inference records and logs. These three data types grow at different rates. Model cache files are individually large but update infrequently. Inference records are small individually but continuously accumulate with each request. Understanding this distinction helps you determine what to clean up and what to migrate first.
When the C drive is nearly full, compiler temporary files, system virtual memory, and system updates may fail. Common symptoms for developers include interrupted compilations, inability to start new AI conversations, and tools failing to write to the cache. These issues directly slow down development progress, making it worthwhile to address them systematically.
How to Diagnose How Much Space AI Coding Tools Actually Use?
Diagnose first, then take action. The following methods do not require installing third-party software.
Use System Storage Settings to Check the Overview
Open “Settings -> System -> Storage”, wait for the scan to complete, and then expand “Temporary files” and the app list. You can see the general distribution of various data here, but you cannot locate specific subdirectories.
Use PowerShell to Calculate Large Folders in the User Directory
Open PowerShell as a regular user and execute the following command. Scanning the entire user directory usually takes a few minutes. Some system-protected folders will be skipped, which is normal.
Get-ChildItem -Path $env:USERPROFILE -Directory -Force -ErrorAction SilentlyContinue |ForEach-Object {$size = (Get-ChildItem -Path $_.FullName -Recurse -File -Force -ErrorAction SilentlyContinue |Measure-Object -Property Length -Sum).Sum[PSCustomObject]@{ Name = $_.Name; SizeGB = [math]::Round($size / 1GB, 2) }} |Sort-Object SizeGB -Descending |Select-Object -First 20
The command outputs the size of each first-level subdirectory, sorted from largest to smallest. If hidden directories starting with a dot appear in the list, such as .cache or .trae, they are likely the data directories for AI tools.
Calculate the Actual Size of a Specific Data Directory
Once the directory is identified, modify the path in the variable and execute the following command. YourUsername should be replaced with your Windows account name, or you can directly use $env:USERPROFILE instead.
$path = "C:\Users\YourUsername\.cache\ai-models"Get-ChildItem -Path $path -Recurse -File -Force -ErrorAction SilentlyContinue |Measure-Object -Property Length -Sum |ForEach-Object { "{0:N2} GB,共 {1} 个文件" -f ($_.Sum / 1GB), $_.Count }
Locate the Tool’s Data Directory
The location of the data directory varies by tool and version, so do not copy someone else’s path. First, check for a “Data Directory” or “Cache Path” option in the tool’s settings, or consult the tool’s official documentation. If you cannot find it, sort the contents in your user directory by modified date and observe which directories change after running the tool.
Determine if the Space Usage is Abnormal
The most reliable way to determine if usage is normal is to check the growth rate rather than the absolute numbers. Do the following:
- Record the size of the data directory today.
- Use the tool normally for a week, then measure it again.
- Compare the difference between the two measurements.
If the inference log directory grows by several GBs in a week, it indicates that the log level is too high or historical records are not being cleared. If the model directory retains multiple version folders with vastly different modification dates, the old versions were likely not automatically removed. If the number of items in the plugin directory clearly exceeds the plugins you actually use, it means there are residual configurations left after uninstallation.
How to Reduce Space Usage at the Source?
Choose a Non-System Drive During Installation
When the installer allows it, install the main program on a non-system drive like the D drive. If the tool provides cache path settings, you should also change it to another drive upon first launch.
Only Download Currently Needed Models
Find the options related to model downloads in the settings. If there is a toggle like “Automatically download all environment models”, turn it off and only keep the models corresponding to your current development language.
Limit Conversation History Retention
If you rarely review old sessions, you can disable the persistence feature for history logs or set a shorter retention period. This will significantly slow down the growth of inference records.
How to Safely Migrate Data Directories to Another Disk?
The most common approach for migration is to “copy, rename, and create a directory junction”. mklink /J creates a Junction, not a symbolic link. A directory junction points a folder to another location, and when the tool accesses the original path, it is transparently redirected to the new location. A symbolic link requires using mklink /D.
If the tool has a built-in migration feature or supports specifying the data directory via environment variables, prioritize the official method. Manual migration is only necessary when the tool does not support it. Before manually migrating, complete the following preparations:
- Completely exit the tool: Close the main window and verify in Task Manager that no residual background processes remain. If the tool writes files while running, the copied data may be incomplete.
- Confirm target space: The free space on the target drive should be larger than the source directory size, with about a 10% margin reserved.
- Keep the original directory: Do not delete the original directory during the migration process; rename it first to save as a backup.
Step 1: Copy the Data
Execute the following in a regular permission command prompt:
robocopy "C:\Users\YourUsername\.cache\ai-models" "D:\AIWorkSpace\ai-models" /E /R:1 /W:1 /LOG:"%USERPROFILE%\robocopy-ai-models.log"
The /E parameter copies all subdirectories, including empty ones. The command does not use /MIR, so it will not delete existing files in the target directory. Robocopy exit codes 0 to 7 indicate success, while 8 and above indicate failures. If you encounter permission errors, rerun it as an administrator.
Step 2: Verify the Results
After copying, check the log file for the word “FAILED”. Then use the previous PowerShell commands to calculate the source directory and target directory separately, confirming that the total size and file count match. Do not proceed to the next step if they do not match.
Step 3: Rename the Original Directory
ren "C:\Users\YourUsername\.cache\ai-models" ai-models.bak
Step 4: Create the Directory Junction
mklink /J "C:\Users\YourUsername\.cache\ai-models" "D:\AIWorkSpace\ai-models"
Creating a directory junction does not require administrator privileges. After executing the command, the original path will appear as a folder pointing to the D drive, and the tool can read and write to it just like a regular directory.
Step 5: Launch the Tool and Verify
Launch the tool and execute a feature that relies on the model, such as code completion or a chat request. Then check whether new files or size changes appear in the target directory on the D drive. If the tool runs normally and the target directory is indeed growing, the migration is successful.
Rollback Method
If the tool does not work properly, restore it in the following order:
- Exit the tool.
- Delete the directory junction. Note that you can only use
rmdirwithout the/Sparameter; do not userd /sordel /s, as these commands might delete the files in the target directory.
rmdir "C:\Users\YourUsername\.cache\ai-models"
- Restore the original directory name:
ren "C:\Users\YourUsername\.cache\ai-models.bak" ai-models
After confirming that the tool is running stably, keep it for a few more days, and finally manually delete the .bak backup directory.
How to Prevent Space from Filling Up Again with Daily Maintenance?
- Periodically clear conversation records: Confirm that there are no sessions you need to keep, then use the tool’s “Clear All Conversations” feature. Doing this once a week is sufficient.
- Lower the log level: If there is a log level option in the settings, adjust it to only log errors. Once the write frequency decreases, the log growth will slow down significantly.
- Monthly plugin audit: Disable plugins that have not been used for more than 30 days. Use the tool’s built-in plugin manager to uninstall plugins. After uninstalling, check the plugin’s data directory and manually delete any residual configuration files.
