From bb64d41b87f0b2184efd260ab0203a23a0a8623a Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:05:40 +0900 Subject: [PATCH] fix: worktree path stays under workspace, not inside project repo repoRoot is used for git operations only. The worktree directory lives under ai.Workspace/.picoclaw/worktrees/ to avoid polluting the user's project with a .picoclaw directory. Co-Authored-By: Claude Opus 4.6 --- pkg/agent/instance.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/agent/instance.go b/pkg/agent/instance.go index 358a38a19..f7aa5e256 100644 --- a/pkg/agent/instance.go +++ b/pkg/agent/instance.go @@ -208,7 +208,7 @@ func resolvePlanFallbacks(agentCfg *config.AgentConfig, defaults *config.AgentDe // ActivateWorktree creates a worktree for a session. // projectDir is the git repository to create the worktree in. // If empty, falls back to ai.Workspace. -// Path: /.picoclaw/worktrees// +// Worktree path: /.picoclaw/worktrees// func (ai *AgentInstance) ActivateWorktree(sessionKey, taskName, projectDir string) (*git.WorktreeInfo, error) { if projectDir == "" { projectDir = ai.Workspace @@ -220,7 +220,7 @@ func (ai *AgentInstance) ActivateWorktree(sessionKey, taskName, projectDir strin branchName := git.SanitizeBranchName(taskName) baseName := git.BranchBaseName(branchName) - wtPath := filepath.Join(repoRoot, ".picoclaw", "worktrees", baseName) + wtPath := filepath.Join(ai.Workspace, ".picoclaw", "worktrees", baseName) wt, err := git.CreateWorktree(repoRoot, wtPath, branchName) if err != nil {