← ClaudeAtlas

flask-debug-cross-worktree-edit-stalelisted

Diagnose "I edited the template / view / CSS but Flask debug-mode keeps serving the old version" when running a local dev server (Flask, Django runserver, Rails server, etc.) from one git worktree while editing files in a sibling worktree of the same repo. Use when: (1) you have multiple `git worktree` checkouts of the same repo (typical with `.claude/worktrees/<feature>` directories), (2) a dev server is running in worktree A serving its working tree, (3) you're making edits in worktree B because branch X is checked out at A and you can't `git checkout X` in B too, (4) `curl http://127.0.0.1:PORT/page` returns byte-identical responses despite your edits, (5) you're tempted to blame Jinja bytecode cache, Flask `@_ttl_cache`, or browser caching. Root cause is filesystem-level: each git worktree has its own independent working tree on disk; Flask is reading worktree A's files, not worktree B's. Cache-busting tricks (`touch app.py`, browser hard refresh, restart Flask) won't help. Sister skill to `flask-debug-tt
wan-huiyan/agent-traffic-control · ★ 2 · Code & Development · score 79
Install: claude install-skill wan-huiyan/agent-traffic-control
# Flask debug edits cross-worktree stale ## Problem You're running a Flask dev server (`python app.py` with `debug=True`, or `flask run --debug`) from one git worktree. You're editing template / static / view files from a *sibling* worktree of the same repo, because the branch you want to ship is checked out at the running worktree and `git checkout <branch>` fails in your editing worktree. You hit `curl http://127.0.0.1:PORT/the-page` after each edit, and the response bytes don't change. You hypothesize Jinja bytecode cache, Flask `@_ttl_cache`, browser caching, CDN, or stale `__pycache__`. You try `touch app.py` to bust Flask's debug-reload, restart the process, clear browser cache. Nothing fixes it. **Root cause:** git worktrees have **independent working trees on disk**. Each `git worktree` directory has its own copy of every tracked file. Flask is reading from `<worktree-A>/templates/page.html`. Your edits live in `<worktree-B>/templates/page.html`. They're physically different files; the dev server has no way to see B's edits until A's disk state changes. ## Trigger conditions (high-confidence diagnosis) Fire this skill when ALL of these are true: 1. `git worktree list` shows ≥2 worktrees of the same repo. 2. A dev server is bound to a known port; `lsof -i :PORT` shows the server process. 3. The server's CWD (`lsof -p <PID> | grep cwd`, or check the script that launched it) is in worktree A. 4. Your editor is making changes in worktree B (different path, sa