Claude Code plugin (Windows): flush worker's git calls flash console windows — DETACHED_PROCESS should be CREATE_NO_WINDOW
Posted by Claude Code on behalf of @leftos.
Component
Plugin
Description
Summary
On Windows, the Claude Code plugin makes console windows flash on screen, in bursts of 4–8, every few minutes while Claude Code is in use. Each window is one git process run by the background flush worker.
detached_process_kwargs() in core/memory_core.py starts the worker with DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP, so the worker has no console at all. When a console-less process runs a console program, Windows gives the child a new console, and that console is visible. So every subprocess.run(["git", "-C", cwd, ...]) in memory_core._git() opens a window for as long as git runs. With Windows Terminal as the default terminal, the window is a PseudoConsoleWindow that briefly takes focus.
Steps to Reproduce
- On Windows 11, install the Claude Code plugin (0.3.3) and use Claude Code in a git repository.
- Finish a few turns, which fires the
Stophook and startscore/flush_worker.py. - Watch for console windows flashing for a split second. To confirm, log
EVENT_OBJECT_SHOWfor top-level windows (classPseudoConsoleWindow) alongsideWin32_Processcreation events. Each flashinggit.exehasflush_worker.pyas its parent.
Expected Behavior
The background worker and the processes it starts don't show any window.
Actual Behavior
One visible console window per git call the worker makes.
Environment
- mem0 Claude Code plugin 0.3.3 (marketplace checkout at 94c3fe9)
- Claude Code 2.1.283
- Python 3.14 (uv-managed CPython)
- Windows 11 Pro 10.0.26200, Windows Terminal as the default terminal
How You Verified This
What I Ran
- A window-event watcher (
SetWinEventHookonEVENT_OBJECT_SHOW) logged every top-level window as it appeared. - A
__InstanceCreationEventsubscription onWin32_Processrecorded every new process with its PID, parent PID and command line for 10 minutes. - I joined the two on PID.
What I Saw
Window log, one burst:
2026-09-26 22:43:27 APPEARED git [pid 25000] "(no title)" (class PseudoConsoleWindow)
2026-09-26 22:43:27 APPEARED git [pid 62680] "(no title)" (class PseudoConsoleWindow)The process log for the same PIDs. Parent 13912 is the worker:
22:43:27.365 pid 25000 parent 13912 git.exe git -C D:\yaat branch --show-current
22:43:27.561 pid 62680 parent 13912 git.exe git -C D:\yaat rev-parse HEAD
existing pid 13912 parent 39588 python.exe ...\claude-code-plugin\core\flush_worker.py ...\pending\idle-...runningA second burst at 22:46:30–32 had five flashing git.exe processes (54560, 9528, 30604, 10300, 2424). All five had parent 1344, another flush_worker.py started by the Stop hook's hook.py stop.
Why This Is a Bug
The worker only needs to survive the agent exiting and to stay invisible. DETACHED_PROCESS does the first but breaks the second on Windows for every console child the worker runs.
What I Ruled Out
Other processes on the machine run git a lot, including Claude Code's own Bash tool, other tools that poll git status, and test suites. None of them caused a window: during a 2.5-minute capture, git ran dozens of times from those parents and no window appeared. Every flashing git.exe I could match by PID had flush_worker.py as its parent.
Fix
Give the worker a hidden console instead of none. Every child then inherits it, and the worker still outlives the agent:
def detached_process_kwargs(platform: str | None = None) -> dict:
if (platform or sys.platform) == "win32":
return {
- "creationflags": subprocess.DETACHED_PROCESS
+ "creationflags": subprocess.CREATE_NO_WINDOW
| subprocess.CREATE_NEW_PROCESS_GROUP
}Before the change, bursts appeared every 1–3 minutes. With this change applied locally, no flashes appeared in the 15 minutes afterwards, while the worker kept running and writing its log. hook_runner.py and telemetry.py both start processes through this function, so the change covers them too. The same function is copied in agent-plugin-core/python/memory_core.py and the other generated plugin cores. test_flush_worker_detaches_on_windows_as_well_as_posix pins the old flag value and needs the new one (0x08000200).
Unrelated to this change: test_launch_handoff_always_requests_detachment fails on Windows with the unpatched code too. It asserts start_new_session, which detached_process_kwargs() returns only on POSIX.
AI Assistance
AI helped me find it, and I reproduced it myself afterwards
Source: mem0ai/mem0