Skip to content

Add worktree.enabled config flag to skip git worktree operations#61

Open
automatebrisbaneai wants to merge 17 commits intomrocklin:mainfrom
automatebrisbaneai:worktree-disable-config
Open

Add worktree.enabled config flag to skip git worktree operations#61
automatebrisbaneai wants to merge 17 commits intomrocklin:mainfrom
automatebrisbaneai:worktree-disable-config

Conversation

@automatebrisbaneai
Copy link
Copy Markdown

Problem

On Windows (and likely slow-git repos generally), every subagent spawned with isolation: \"worktree\" triggers git worktree add + git worktree remove — each taking 2–5 seconds on a large repo. This causes noticeable UI hangs every time an agent is created.

Additionally, _populate_worktrees() and the worktree autocomplete scan both call git worktree list on startup and on every autocomplete refresh, adding further overhead for users who don't use the /worktree workflow at all.

Solution

Add a worktree.enabled flag to ~/.claude/.claudechic.yaml (defaults true, preserving existing behaviour).

When set to false:

  • _populate_worktrees() returns immediately — no git call on startup
  • Worktree autocomplete scanning is skipped — no blocking list_worktrees() call
  • EnterWorktree and ExitWorktree are added to disallowed_tools in ClaudeAgentOptions — subagents run locally in the current directory instead of creating isolated git worktrees

Usage

# ~/.claude/.claudechic.yaml
worktree:
  enabled: false  # set true to restore default behaviour

Changes

  • claudechic/config.py — adds worktree.enabled default
  • claudechic/app.py — gates three worktree code paths on the config flag

No behaviour change for users who don't set the flag.

automatebrisbaneai and others added 17 commits March 21, 2026 22:41
When worktree.enabled is false in ~/.claude/.claudechic.yaml:
- Skips _populate_worktrees() on startup (no git worktree list call)
- Skips worktree branch autocomplete scanning (no blocking git calls)
- Adds EnterWorktree/ExitWorktree to disallowed_tools so subagents
  run locally instead of creating isolated git worktrees

Solves significant UI hangs on Windows where git worktree operations
on large repos are slow (2-5s per subagent spawn). Users who don't
use the /worktree workflow get zero git overhead.

Enable/disable via ~/.claude/.claudechic.yaml:
  worktree:
    enabled: false  # set true to restore default behaviour
- Paste raw clipboard images (Win+Shift+S screenshots) via PIL fallback
- Fix Windows session path: replace ':' with '-' to match Claude Code's
  C--project-name format (was C-project-name, causing context bar to show
  zero and session history to fail)
- Fix UnicodeDecodeError when loading session history on Windows (use UTF-8
  instead of system default cp1252)
- Add remote_port config key so HTTP server port can be set in .claudechic.yaml
  without needing --remote-port CLI flag every launch
- Add /attach-image HTTP endpoint for external tool integration (e.g. ShareX)
- Graceful fallback when remote port is already in use (warning instead of crash)
- Disable worktree tools (EnterWorktree/ExitWorktree) when worktree.enabled: false

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All workers now use exit_on_error=False with a central
on_worker_state_changed handler that shows the error message as a
corner notification (severity=error, 10s timeout) and logs it.
Previously any worker failure would crash the whole app and close
the window.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ctx_execute and other mcp__plugin_context-mode__ tools are noisy
sandbox utilities that don't need to be visible in the chat flow.
Added prefix-based collapse rule so any tool whose name starts with
mcp__plugin_context-mode starts collapsed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Users can override via collapse-tool-prefixes in .claudechic.yaml.
Default list: mcp__plugin_context-mode, mcp__searxng.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
MCP tools like mcp__searxng__searxng_web_search now display as
'Web Search: <query>' instead of the raw tool name. Explicit labels
for context-mode, searxng, and qmd tools. Generic title-case fallback
for any other mcp__ tool.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- qmd__query: show intent field (human-readable) not raw search array
- ctx_execute: show language mode
- ctx_execute_file: show filename + language
- ctx_batch_execute: show command count
- qmd__get: show filename not full path
- searxng: show query (unchanged)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
config.setdefault stores None when key is absent; dict.get() returns the
stored None rather than the default arg, causing tuple(None) to crash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previous session often leaves port 9001 held after unclean exit.
On OSError, find the PID via netstat and kill it, then retry binding.
Falls back to warning notification only if retry also fails.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevents killing unrelated services or live sessions on the same port.
tasklist check ensures we only reclaim ports from crashed Python instances.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ExitPlanMode was creating a Markdown widget eagerly, which spawns hundreds
of child widgets for large plans and blocks Textual's layout thread.
Also had a double-render path via _try_update_plan_content. Fixed by:
- Using content_factory lazy loading for collapsed items (same as Edit)
- Replacing Markdown with Static(markup=False) - instantaneous render
- Fixing sync read_text() to use utf-8 encoding

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…shot paste

grabclipboard() blocks the event loop on Windows while reading/converting
large clipboard images. Moving it to asyncio.to_thread() keeps the UI
responsive during paste operations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Auto-kill stale port process on startup (Python-only, safe for live sessions)
- Clipboard paste freeze fix (asyncio.to_thread for PIL grabclipboard)
- Plan review hang fix (Static instead of Markdown, lazy content_factory)
- Startup crash fix (None-safe config fallback for collapse-tool-prefixes)
- Desktop shortcut now launches ClaudeChic via python -m claudechic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each session now displays a subtitle line showing the last thing
you typed — making it easy to spot "which one was I just working in".
Search also matches against the last message, not just the title.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
During streaming, Markdown.append() creates a new parser and does
remove()+mount() DOM operations on every text chunk. For a chat with
hundreds of tool widgets, each DOM op triggers a full layout pass over
all widgets — causing the UI to freeze constantly while Claude types.

Fix: new streaming messages start as Static (zero DOM cost per update).
On flush(), Static is swapped to Markdown once (one acceptable render).
History messages (non-empty initial content) still render as Markdown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant