Repository navigation
Description
Problem
On a Windows host, OneDrive backs up Documents and Desktop by default. Python writes __pycache__ beside each module it imports. ruff writes .ruff_cache in the project root. Code that runs or is linted from a synced folder therefore turns every run into OneDrive create and delete churn, thousands of sync operations on a busy host.
The global package caches are not part of this. pip, uv, npm, and NuGet already keep theirs under %LOCALAPPDATA% or the profile root, which OneDrive does not sync.
Proposal
Set these user-scope environment variables from the host-setup\windows tooling:
PYTHONPYCACHEPREFIX=%USERPROFILE%\.cache\pycacheRUFF_CACHE_DIR=%USERPROFILE%\.cache\ruff
Each tool names its redirected cache by the project's absolute path, so separate checkouts and worktrees never share an entry.
State in docs/host-setup.md that a repository checkout belongs outside a synced folder, ideally on a Dev Drive. That is the root fix for checkouts. The variables cover code that has to stay in a synced folder.
What This Leaves Out
MYPY_CACHE_DIR. mypy keys its cache by module name rather than by path. Worktrees of one repository then share entries, and agents working in separate worktrees at once keep invalidating each other's cache. Left in-tree, each worktree keeps its own.- Linux hosts. No folder is synced by default, and an in-tree cache is deleted with its worktree. A redirect there gains nothing and leaves an entry behind per removed worktree.
UV_PROJECT_ENVIRONMENTandCOVERAGE_FILE. Each is one path for every project, so concurrent runs collide.
Cost
A removed worktree leaves its entry behind under %USERPROFILE%\.cache\pycache and %USERPROFILE%\.cache\ruff. Deleting either folder at any time is safe, since the tool rebuilds it on the next run. A periodic or age-based cleanup bounds the growth.
Open Questions
- Which script owns a persistent user environment variable. No
host-setup\windowsscript sets one, andinstall-tools.ps1installs tools. - Whether host-setup owns the cleanup, as a scheduled task or a menu action.
- Whether the host gate reports a Windows host lacking the variables.
The gate block in OPERATIONS.md exports a run-scoped RUFF_CACHE_DIR, which overrides the user-scope value for that run. The two do not conflict.
Activity
ptr727 commentedon Nov 24, 2026
Question for the maintainer (backlog burndown away run, 2026-11-24, round 1). This issue lists three open questions in its body, and the committed rules settle only one of them. So the away run labels it
decisionand holds it. It is also Windows-lane work, since setting a user-scope variable is verified on a Windows host.1. Which script sets
PYTHONPYCACHEPREFIXandRUFF_CACHE_DIRat user scope?host-setup/windows/install-tools.ps1(recommended). It already runs on every Windows host the bootstrap sets up, and it owns the Python install whose cache this redirects. Setting the two variables there is idempotent, and no new entry point needs documenting.host-setup/windows/script. It keepsinstall-tools.ps1to installing tools, at the cost of one more script the bootstrap and docs must name.upgrade-host.ps1. It reaches existing hosts on their next upgrade, but a freshly stood-up host gets nothing until then.2. Does host-setup clean up existing
__pycache__and.ruff_cachefolders in synced locations?3. Does the host gate report a Windows host lacking the variables?
ptr727 commentedon Nov 25, 2026
Answered by the maintainer (decision triage, 2026-11-25):
install-tools.ps1sets and reports, with no cleanup code.host-setup/windows/install-tools.ps1setsPYTHONPYCACHEPREFIXandRUFF_CACHE_DIRat user scope, idempotently. Its-Reportrun names a missing variable along with the command that sets it.docs/host-setup.mdsays to keep checkouts outside synced folders, and that the redirected cache folders are always safe to delete.scripts/host_gate.pychange. Leftover in-tree cache folders are detected and reported, never corrected by code (GOVERNANCE.mdone-off rule, Detect and Report a One-Off, and Let a Rollback Reopen on Promotion #4346).This is Windows-lane work, because the change counts as verified only when run on a Windows host. The issue stays open as work.