From e0538ef1ccddee2f226b22019b854bdd759ec552 Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:10:23 +0900 Subject: [PATCH] refactor: move worktree directory to workspace/.worktrees/ Previously workspace/.picoclaw/worktrees/ which created redundant nesting since workspace is already under ~/.picoclaw/. The dot prefix hides the directory from normal project listings. Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 2 +- pkg/agent/instance.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7a82c88b4..1938a5ce8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,7 +26,7 @@ Lint: `golangci-lint run` ## Known Gaps - **Mini App log viewer has no frontend tests**: `renderLogs()` in `pkg/miniapp/static/index.html` is inline vanilla JS with no unit/E2E test coverage. Backend (Go) tests cover `RecentLogs`, `SanitizeFields`, and JSON serialization, but nothing verifies the JS rendering. This allowed the Fields display bug (fields sent but not rendered) to ship undetected. -- **No human intervention for heartbeat worktrees**: Heartbeat sessions create git worktrees (`.picoclaw/worktrees/heartbeat-YYYYMMDD/`) but there is no CLI or Mini App command to list, inspect, or manually dispose them. Need a `/plan worktrees` command (or similar) that shows active worktrees with branch/commit info and allows manual merge/dispose. `PruneOrphaned` on startup only removes directories without auto-committing first, so uncommitted changes in orphaned worktrees are silently lost. +- **No human intervention for heartbeat worktrees**: Heartbeat sessions create git worktrees (`.worktrees/heartbeat-YYYYMMDD/`) but there is no CLI or Mini App command to list, inspect, or manually dispose them. Need a `/plan worktrees` command (or similar) that shows active worktrees with branch/commit info and allows manual merge/dispose. `PruneOrphaned` on startup only removes directories without auto-committing first, so uncommitted changes in orphaned worktrees are silently lost. ## Memory Optimization Candidates diff --git a/pkg/agent/instance.go b/pkg/agent/instance.go index f7aa5e256..a767bcb04 100644 --- a/pkg/agent/instance.go +++ b/pkg/agent/instance.go @@ -131,7 +131,7 @@ func NewAgentInstance( } // Startup cleanup: prune orphaned worktrees - worktreesDir := filepath.Join(workspace, ".picoclaw", "worktrees") + worktreesDir := filepath.Join(workspace, ".worktrees") if repoRoot := git.FindRepoRoot(workspace); repoRoot != "" { git.PruneOrphaned(repoRoot, worktreesDir) } @@ -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. -// Worktree path: /.picoclaw/worktrees// +// Worktree path: /.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(ai.Workspace, ".picoclaw", "worktrees", baseName) + wtPath := filepath.Join(ai.Workspace, ".worktrees", baseName) wt, err := git.CreateWorktree(repoRoot, wtPath, branchName) if err != nil {