Agent changes not auto-assigned to virtual branches
#13297 opened on Apr 14, 2026
Description
Version
0.19.7
Operating System
Windows
Distribution Method
msi (Windows)
Describe the issue
On Windows (v0.19.7), changes made by Claude Code are not automatically assigned to their respective virtual branches. All changes appear in the unstaged area of the default/leftmost branch, regardless of which virtual branch the agent session is tied to.
This happens with both:
- Agents Tab (built-in UI): Starting a Claude Code session tied to a specific branch — changes are not routed to that branch.
- Terminal with Hooks: Running Claude Code in PowerShell with
but claude pre-tool/post-tool/stophooks configured in.claude/settings.local.json.
The Rules drawer does show auto-generated rules after starting an AI session (e.g. claude --resume {uuid} → Assign to branch {branch_name}), so the session-to-branch mapping appears to be created correctly. However, the rules do not seem to take effect — file changes are still not routed to the correct branch.
Environment:
- GitButler: 0.19.7
- OS: Windows
- Shell: PowerShell
- GitButler CLI: Installed and confirmed working (
but --version) - Claude Code: Installed, logged in via Team plan subscription
- GitHub account: Connected and authenticated in GitButler
How to reproduce (Optional)
Via Agents Tab:
- Open GitButler and create two virtual branches (e.g. branch-A, branch-B)
- Open the Agents Tab
- Start a Claude Code session tied to branch-A
- Let the agent make file changes
- Observe that all changes appear in branch-B (or the default/leftmost branch), not in branch-A
- Clicking commit on branch-A shows all files checked, including files that should belong to branch-B
Via Terminal with Hooks:
- Install GitButler CLI:
copy "C:\Program Files\GitButler\but.exe" "$env:LOCALAPPDATA\Microsoft\WindowsApps\but.exe" - Add hooks to
.claude/settings.local.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [{ "type": "command", "command": "but claude pre-tool" }]
}
],
"PostToolUse": [
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [{ "type": "command", "command": "but claude post-tool" }]
}
],
"Stop": [
{
"matcher": "",
"hooks": [{ "type": "command", "command": "but claude stop" }]
}
]
}
}
- Run Claude Code in PowerShell and make changes
- Observe that changes are not assigned to any specific virtual branch
Expected behavior (Optional)
Changes made by a Claude Code session should be automatically assigned to the virtual branch that session is tied to, based on the auto-generated Rules (Claude Code Session ID filter). Each branch should only show its own changes when committing.
Relevant log output (Optional)
No error messages observed. GitButler appears to function normally — it creates the `.husky_` managed hooks (`GITBUTLER_MANAGED_HOOK_V1`), auto-generates Rules with session IDs, and detects file changes. The only issue is that changes are not routed to the correct branch despite the rules being present.