一键导入
psm
Project Session Manager — isolated dev environments with git worktrees and tmux
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Project Session Manager — isolated dev environments with git worktrees and tmux
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
UI/UX design intelligence with searchable database
Generate comprehensive implementation plans through systematic discovery, synthesis, verification, and decomposition into beads. Use when asked to plan a feature, create a roadmap, design an implementation approach, or decompose work into trackable issues. Do NOT use for simple one-step tasks, quick fixes, or when the user just wants to execute an existing plan — use the work skill instead.
Execute a plan or direct task with worker delegation and verification.
Deep investigation mode. Gather context, analyze, synthesize recommendations without making code changes.
Fetch up-to-date library documentation via Context7 MCP. Use when working with external libraries, APIs, or frameworks.
Start interview-driven planning with Prometheus. Asks clarifying questions before generating implementation plan.
| name | psm |
| description | Project Session Manager — isolated dev environments with git worktrees and tmux |
| argument-hint | review <ref> | fix <ref> | feature <name> | list | attach <session> | kill <session> | cleanup | status |
| aliases | ["session","worktree-session"] |
| disable-model-invocation | true |
Manage isolated development sessions with git worktrees and tmux.
All PSM state lives under ~/.maestro-psm/.
$ARGUMENTS
| Pattern | Action |
|---|---|
review <ref> | Create PR review session |
fix <ref> | Create issue-fix session |
feature <name> | Create feature session from main |
list | List sessions from state + tmux |
attach <session> | Show attach command for a session |
kill <session> | Kill tmux + remove worktree + delete state |
cleanup | Auto-clean merged PR / closed issue sessions |
status | Show current session context |
STATE_DIR="$HOME/.maestro-psm"
WORKTREE_ROOT="$STATE_DIR/worktrees"
LOG_DIR="$STATE_DIR/logs"
SESSIONS_FILE="$STATE_DIR/sessions.json"
mkdir -p "$WORKTREE_ROOT" "$LOG_DIR"
if [[ ! -f "$SESSIONS_FILE" ]]; then
cat > "$SESSIONS_FILE" <<'EOF'
{"version": 1, "sessions": {}}
EOF
fi
Rules:
$HOME (expanded ~) for filesystem operations.Support these forms for review and fix:
#123 → current repoowner/repo#123 → explicit repohttps://github.com/owner/repo/pull/123 → PR URLhttps://github.com/owner/repo/issues/123 → issue URLNormalize parsed data into:
repo: owner/reponumber: numeric ref (123)kind: pull or issuereview <ref> accepts PR formats only (#, owner/repo#, or /pull/).fix <ref> accepts issue formats only (#, owner/repo#, or /issues/).#123 is used, resolve repo from current directory with gh repo view --json nameWithOwner.Use this consistent session metadata model in ~/.maestro-psm/sessions.json:
{
"version": 1,
"sessions": {
"project:pr-123": {
"id": "project:pr-123",
"type": "review",
"repo": "owner/repo",
"number": 123,
"ref": "#123",
"title": "Add webhook support",
"branch": "pr-123-review",
"base": "main",
"worktree": "/Users/me/.maestro-psm/worktrees/project/pr-123",
"tmux": "maestro:project:pr-123",
"createdAt": "2026-02-09T00:00:00Z",
"url": "https://github.com/owner/repo/pull/123"
}
}
}
Session naming:
<alias>:<ref-id>maestro:<session-id>owner/repo)review <ref>Goal: Create a PR review workspace from the PR head branch.
<ref> into repo + pr_number.gh pr view <num> --repo <repo> --json number,title,headRefName,baseRefName,url
<repo>.~/.maestro-psm/repos/<owner>__<repo>.git -C <repo_root> fetch origin pull/<num>/head:pr-<num>-review
git -C <repo_root> worktree add <worktree_path> pr-<num>-review
where worktree_path=~/.maestro-psm/worktrees/<alias>/pr-<num>.tmux new-session -d -s maestro:<alias>:pr-<num> -c <worktree_path>
~/.maestro-psm/sessions.json with session metadata.fix <ref>Goal: Create issue-fix branch from main, plus isolated worktree + tmux.
<ref> into repo + issue_number.gh issue view.main:
git -C <repo_root> fetch origin main
git -C <repo_root> worktree add -b fix/<num>-<slug> <worktree_path> origin/main
where worktree_path=~/.maestro-psm/worktrees/<alias>/issue-<num>.tmux new-session -d -s maestro:<alias>:issue-<num> -c <worktree_path>
feature <name>Goal: Create feature branch from main in an isolated session.
gh repo view --json nameWithOwner).<name> for branch-safe naming.git -C <repo_root> fetch origin main
git -C <repo_root> worktree add -b feature/<slug> <worktree_path> origin/main
where worktree_path=~/.maestro-psm/worktrees/<alias>/feat-<slug>.tmux new-session -d -s maestro:<alias>:feat-<slug> -c <worktree_path>
listGoal: Show persisted sessions and whether tmux is alive.
~/.maestro-psm/sessions.json.tmux list-sessions -F "#{session_name}" 2>/dev/null
tmux value.active if tmux exists, otherwise dead)attach <session>Goal: Provide exact attach command.
maestro:<session>.tmux has-session -t maestro:<session>
tmux attach -t maestro:<session>
/psm list.kill <session>Goal: Fully remove one session.
tmux kill-session -t maestro:<session>
git -C <repo_root> worktree remove <worktree_path> --force
cleanupGoal: Auto-clean completed review/fix sessions.
For each session in sessions.json:
If type=review, check merge status:
gh pr view <num> --repo <repo> --json merged
If merged, remove session (same steps as kill).
If type=fix, check close status:
gh issue view <num> --repo <repo> --json closed
If closed, remove session (same steps as kill).
If type=feature, skip automatic cleanup unless explicitly requested.
Output summary:
statusGoal: Show session context for current environment.
Detection order:
tmux display-message -p '#S').Use this exact structure when creating a session:
Session Ready!
ID: project:pr-123
Type: review
PR: #123 - Add webhook support
Worktree: ~/.maestro-psm/worktrees/project/pr-123
Tmux: maestro:project:pr-123
Commands:
Attach: tmux attach -t maestro:project:pr-123
Kill: /psm kill project:pr-123
Cleanup: /psm cleanup
For issue/fix or feature sessions, replace the PR line with the relevant reference label.
gh CLI for all GitHub operations (auth + repo context).~/.maestro-psm/ for all state (never ~/.psm/, never .maestro/).~ to $HOME in real command execution.tmux attach -t maestro:<session>).