AI Coding Tools Filling Up Your C: Drive? How to Diagnose, Clean Up, and Prevent It

    AI coding tools can consume large amounts of disk space through model files, project indexes, extension dependencies, caches, and logs—even when your code repositories are stored on another drive. This guide explains how to identify the largest sources of usage, clean them safely by risk level, migrate data to another drive, and establish routines that prevent the problem from returning. Examples use VS Code and Windows PowerShell, but the same principles apply to other AI development tools.

    In everyday development, code repositories are often stored on a data drive, yet the system drive can quietly fill up within a few months. Developers may inspect their project folders and find that the source code itself is relatively small. The actual storage usage is often hidden in user profiles and application-data directories, where AI coding tools store model caches, project indexes, extension dependencies, and runtime logs.

    This guide uses VS Code and its AI extensions as examples. It explains where this data comes from, how to diagnose it safely, how to clean it up by risk level, and how to prevent disk usage from growing again. Directory names vary between AI coding tools, but the underlying storage patterns are generally similar. Before applying these steps, check the tool’s official documentation to confirm its data locations.

    Where Did the Space Go? Four Major Sources

    Local data from AI coding tools generally falls into four categories.

    Source Typical location in VS Code Why it is created Cleanup level
    Extensions and dependencies %USERPROFILE%\.vscode\extensions Each extension may store its own dependencies and runtime environment, and versions may not share them Level 2: confirm that the extension is no longer needed
    Caches and indexes %APPDATA%\Code\Cache, %APPDATA%\Code\CachedData Caches speed up loading; project indexes store code symbols and vector data Cache: Level 1; indexes: Level 2
    Runtime logs %APPDATA%\Code\logs Debug-level logs may be written continuously without effective rotation Level 1
    Local model files Confirm the tool’s documentation; commonly located in an extension or tool-data directory Local inference requires model weights, and old files may remain after upgrades Level 3: do not delete manually

    Tools that use cloud inference can also consume local storage. They typically keep context indexes and session state locally, so index directories grow with project size. Model files can range from hundreds of megabytes to several gigabytes, depending on the tool and selected model.

    Extension storage is easy to underestimate. Each installed extension may download its own set of dependencies. When multiple extensions use the same libraries, those libraries may be stored repeatedly, causing their disk usage to accumulate.

    Step 1: Diagnose Before Deleting Anything

    Before diagnosing the system, complete two preparations.

    First, fully exit the AI coding tool and use Task Manager to terminate any remaining background processes. This prevents files from being locked during scanning or cleanup.

    Second, enable Hidden items from File Explorer’s View menu. This prevents directories beginning with a dot from being overlooked. Scanning ordinary user directories usually does not require administrator privileges. If you receive an “Access denied” message, run PowerShell as an administrator.

    Start by recording the current disk usage on the C: drive. This provides a baseline for comparison.

    1. # Show used and free space on the C: drive
    2. Get-PSDrive C | Select-Object `
    3. @{Name='UsedGB';Expression={[math]::Round($_.Used/1GB,2)}}, `
    4. @{Name='FreeGB';Expression={[math]::Round($_.Free/1GB,2)}}

    Next, calculate the size of each subdirectory under local application data and display the 20 largest directories.

    1. # Calculate the size of subdirectories under AppData\Local
    2. # and display the 20 largest directories
    3. Get-ChildItem $env:LOCALAPPDATA -Directory -ErrorAction SilentlyContinue |
    4. ForEach-Object {
    5. $bytes = (Get-ChildItem $_.FullName -Recurse -File -Force -ErrorAction SilentlyContinue |
    6. Measure-Object -Property Length -Sum).Sum
    7. [PSCustomObject]@{ Directory = $_.Name; SizeGB = [math]::Round($bytes / 1GB, 2) }
    8. } |
    9. Sort-Object SizeGB -Descending |
    10. Select-Object -First 20

    Use the same method to inspect $env:APPDATA and $env:USERPROFILE\.vscode. Scanning large directories may take several minutes. If the process is too slow, use a graphical tool such as WizTree or TreeSize. WizTree reads the NTFS Master File Table directly, which usually makes scanning much faster.

    Record the size of each relevant directory. After cleanup, scan the directories again and compare the results to confirm how much space was actually recovered.

    Step 2: Clean Up by Risk Level

    Before any cleanup, verify that the tool is completely closed and that no background process is using the target files. Then handle files according to their importance.

    Level 1: Generally Safe to Remove

    • Crash dump files with .dmp or .core extensions. These are memory snapshots created when a program exits unexpectedly and are not required for normal use.
    • Log archives older than 30 days. Compressed files with date suffixes can usually be removed. Do not delete the log file currently being written.
    • Temporary extraction directories left behind by installers.

    After Level 1 files are removed, the tool will recreate necessary logs and caches when it starts again. Normal functionality should not be affected.

    Level 2: Back Up Before Deleting

    • Session records: Once deleted, historical conversations may no longer be available in the tool. Copy the relevant folder to another drive first. Keep the original for about a week and remove it only after confirming that the history is no longer needed.
    • Project indexes: Indexes for projects that you no longer open can be removed. The trade-off is that the index must be rebuilt the next time the project is opened. Rebuilding an index for a large repository may take tens of minutes. Make sure the project will not be needed soon before deleting its index.

    Level 3: Do Not Delete Manually

    • Runtime environments bundled with extensions, such as Node.js or Python interpreters.
    • Shared libraries such as .dll, .so, or .dylib files.
    • Model weight files.

    These files often have tightly coupled dependencies. Removing them may prevent the tool from starting or cause difficult-to-diagnose runtime errors. If you need to reclaim this space, use the tool’s own uninstall or update functionality instead.

    Common Accidental-Deletion Scenarios

    • Deleting a subfolder inside an extension directory: Missing manifests or dependencies can cause the extension to fail at startup. Uninstall the extension through the Extensions panel so the tool can remove its files correctly.
    • Deleting the Node.js runtime bundled with an extension: Language servers may stop working, disabling code completion and go-to-definition features.
    • Deleting all .dll files in bulk: Applications may fail to start because required dynamic libraries are missing.
    • Clearing the entire AppData\Roaming directory: This can also remove login sessions and configuration data for multiple applications.

    Step 3: Prevent Future Growth

    Cleanup only removes space that has already been consumed. Controlling future growth requires changes to both configuration and storage locations.

    1. Reduce Log Verbosity

    In VS Code, press Ctrl+Shift+P and run Developer: Set Log Level. Set the level to warning or info. If another tool does not provide a similar command, search its settings for terms such as log, logging, or their equivalent.

    If no such option exists, the tool may not support log-level configuration, so periodic cleanup is the practical alternative.

    After changing the setting, monitor the log directory for a week and compare its growth rate with the previous measurement.

    2. Move Data Directories to Another Drive

    A directory junction can redirect a directory on the C: drive to a location on another drive. Applications continue to access the original path, while the actual data is stored elsewhere.

    1. Confirm that the destination drive uses NTFS and has more free space than the directory being moved.
    2. Fully exit the tool and terminate its background processes.
    3. Copy the original directory to the destination drive, for example, D:\AIData\.vscode. After copying, compare the file count and total size.
    4. Rename the original directory to .vscode.bak and keep it as a rollback backup.
    5. Run the following command in Command Prompt. A junction usually does not require administrator privileges. If access is denied, run the shell as an administrator.
    1. mklink /J "%USERPROFILE%\.vscode" "D:\AIData\.vscode"
    1. Start the tool and test code completion, chat, extension loading, and other important functions.
    2. Keep the backup for at least a week. Delete .vscode.bak only after confirming that the tool continues to work normally.

    This approach has several risks. An update may recreate the original directory and cause the junction to stop being used, sending new data back to the C: drive. Check that the junction still exists after each update.

    Avoid placing these directories on removable or network drives if their connections are unstable, as interruptions may cause the tool to malfunction.

    To roll back the migration, first close the tool and run:

    1. rmdir "%USERPROFILE%\.vscode"

    Then rename .vscode.bak back to .vscode. Do not add the /s parameter when removing the junction, and confirm that the destination directory has been backed up. On some Windows versions, using /s may also delete the contents of the target directory.

    3. Adjust Model Quantization Carefully

    For locally deployed models, quantization directly affects file size and output quality. Compared with int4, int8 models are larger but may provide slightly higher accuracy. int4 models require less storage, but code-generation stability may decrease.

    The available quantization methods depend on the tool. Before switching, compare both versions using your actual workloads. Keep the original model files until you have confirmed that the new version provides acceptable results.

    4. Establish a Monthly Maintenance Routine

    Once a month, record the free space on the C: drive, run the scanning scripts above, and compare the results with the previous month. If a directory continues to grow, first determine which cleanup level it belongs to before taking action.

    Automated cleanup should be limited to Level 1 files. The following example targets log archives older than 30 days. It uses -WhatIf to preview the files that would be deleted. Remove that parameter only after verifying the result.

    1. # Preview log archives older than 30 days without deleting them
    2. $logDir = "$env:APPDATA\Code\logs"
    3. Get-ChildItem $logDir -Recurse -File -Filter *.zip |
    4. Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } |
    5. Remove-Item -WhatIf

    If the tool uses a format other than .zip for archived logs, modify the -Filter value. Do not include session or index directories in an automated cleanup script.

    Verify the Result After Cleanup or Migration

    After cleaning or moving data, verify the environment as follows:

    • Restart the tool and test code completion, chat, and go-to-definition.
    • Check whether the log directory is recreated and confirm that the tool is still writing logs normally.
    • Compare free space before and after the operation and record the amount recovered.
    • If something goes wrong, follow the rollback procedure and inspect the tool’s error logs to identify the cause.

    Page Files, Browser Caches, and WSL Disks

    When investigating C: drive usage, three other sources are easy to overlook.

    • Page file (pagefile.sys): Windows manages this file and adjusts it according to memory pressure. Do not delete it manually. If you need to reduce its size, change the virtual-memory settings in Windows. However, reducing it when physical memory is insufficient can cause applications to crash, so do not change it solely to save disk space without considering the consequences.
    • Browser cache: In Chrome or Edge, open Clear browsing data and select only Cached images and files. This does not clear login sessions.
    • WSL and Docker virtual disks: Deleting files inside an ext4.vhdx file does not automatically shrink the virtual disk. First run wsl --shutdown to stop all distributions. Then open PowerShell as an administrator and run:
    1. Optimize-VHD -Path "<full path to ext4.vhdx>" -Mode Full

    This command requires the relevant Hyper-V feature module to be enabled. Docker Desktop disk images should be managed through Docker Desktop’s own settings.

    Conclusion

    The safest way to recover space is to follow four stages: diagnose first, clean by risk level, limit future growth through configuration and storage management, and keep a rollback path.

    Deleting only the largest files may leave the tool unable to run. By following the steps in order, you can reclaim C: drive space while keeping your AI-assisted development environment stable.