task: task-1753636924-a1d4c708 - created

Change-Id: Ic78528c47ae38114b9b7504f1c4a76f95e93eb13
diff --git a/server/cmd/commands/cleanup_clones.go b/server/cmd/commands/cleanup_clones.go
new file mode 100644
index 0000000..344c4f3
--- /dev/null
+++ b/server/cmd/commands/cleanup_clones.go
@@ -0,0 +1,53 @@
+package commands
+
+import (
+	"fmt"
+
+	"github.com/spf13/cobra"
+)
+
+var cleanupClonesCmd = &cobra.Command{
+	Use:   "cleanup-clones",
+	Short: "Clean up all agent Git clones",
+	Long: `Remove all agent Git clone directories to free up disk space.
+
+This command will:
+- Stop any running agents
+- Remove all agent-specific Git clone directories
+- Free up disk space used by clones
+
+Examples:
+  staff cleanup-clones`,
+	RunE: runCleanupClones,
+}
+
+// Note: Command is added in root.go init() function
+
+func runCleanupClones(cmd *cobra.Command, args []string) error {
+	if agentManager == nil {
+		return fmt.Errorf("agent manager not initialized")
+	}
+
+	// Stop all running agents first
+	fmt.Println("Stopping all running agents...")
+	for _, agent := range cfg.Agents {
+		if agentManager.IsAgentRunning(agent.Name) {
+			if err := agentManager.StopAgent(agent.Name); err != nil {
+				fmt.Printf("Warning: Failed to stop agent %s: %v\n", agent.Name, err)
+			} else {
+				fmt.Printf("Stopped agent: %s\n", agent.Name)
+			}
+		}
+	}
+
+	// Cleanup all clones by closing the agent manager
+	// This will trigger the cleanup automatically
+	if err := agentManager.Close(); err != nil {
+		return fmt.Errorf("failed to cleanup agent clones: %w", err)
+	}
+
+	fmt.Println("✅ All agent Git clones have been cleaned up successfully!")
+	fmt.Println("💡 Clones will be recreated automatically when agents start working on tasks")
+	
+	return nil
+}
\ No newline at end of file