untitled

tags: project

need to clean up worktree dir

git status quo

  • git worktree commands:
git worktree add
git worktree list [-v | --porcelain [-z]]
git worktree lock [--reason <string>] <worktree>
git worktree move <worktree> <new-path>
git worktree prune [-n] [-v] [--expire <expire>]
git worktree remove [-f] <worktree>
git worktree repair [<path>...]
git worktree unlock <worktree>

commands

  • all commands are under the same git repo
  • list: to show all agents status, include:
NAME        BRANCH        PATH                     STATUS
api-fix     fix/api-bug   ~/project/wt/api-fix     clean
agent-ai    feat/agent    ~/project/wt/agent-ai    2 files modified
refactor    refactor/db   ~/project/wt/refactor    clean
  • add: add worktree, and cd into that worktree, and launch agents
  • switch: Automatically cd into that worktree
  • remove: remove worktree and its directory
  • agent-status or status:
    • how to detect interactive agents' activity?
WORKTREE     AGENT     STATUS
agent-ai     gpt4      running (PID 4923)
api-fix      none      idle
  • cli should work on all worktree and repo’s root directories

unsure:

  • sync:
    • Checks if any worktrees are out of sync with remote.
    • Optionally auto-pull or rebase.

questions

  • what if the agent is running in an interactive mode? like normal TUI agents?

    • tmux?
      • should be doable, just need commands to switch tmux window
    • different tab?
      • this involves terminal operation
      • wezterm should have CLI for its term operation
      • ghostty doesn’t seem to have it
  • how to detect interactive agents' activity?

    • claude has hooks

ideas

  • do not use interactive agents, just show a textbox for the user to type prompts
    • what about claude’s commands? like /something?
  • and when user switch to it, it just use claude’s resume function, resume in the interactive mode