跳到正文
cccskills
免费在 GitHub 公开

project-session-manager

Create separate Git working directories for issue fixes, pull request reviews, and feature development. Optional tmux terminal sessions help manage parallel tasks, return to ongoing work, and clean up completed sessions.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Worktree-first dev environment manager for issues, PRs, and features with optional tmux sessions

集成工具JiraGitHub
查看安装方法

适用场景

  • Working on several issue fixes in parallel
  • Preparing a separate workspace for a pull request review
  • Returning to an ongoing development session
  • Cleaning up sessions after issues close or pull requests merge

包含的文件(20)

  • SKILL.md15.7 KB
  • lib/config.sh3.7 KB
  • lib/parse.sh5.9 KB
  • lib/providers/azure-devops.sh1.5 KB
  • lib/providers/bitbucket.sh1.8 KB
  • lib/providers/gitea.sh2.7 KB
  • lib/providers/github.sh1.5 KB
  • lib/providers/gitlab.sh1.5 KB
  • lib/providers/interface.sh1.9 KB
  • lib/providers/jira.sh2.2 KB
  • lib/session.sh5.7 KB
  • lib/tmux.sh7.7 KB
  • lib/worktree.sh6.7 KB
  • psm.sh26.1 KB
  • templates/feature.md1.1 KB
  • templates/issue-fix.md1.1 KB
  • templates/pr-review.md1.5 KB
  • templates/projects.json418 B
  • tests/test-jira-provider.sh6.2 KB
  • tests/test-psm-prompt-injection.sh11.9 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Project Session Manager (PSM) Skill

psm is the compatibility alias for this canonical skill entrypoint.

Quick Start (worktree-first): Start with omc teleport when you want an isolated issue/PR/feature worktree before adding any tmux/session orchestration:

omc teleport #123          # Create worktree for issue/PR
omc teleport my-feature    # Create worktree for feature
omc teleport list          # List worktrees

See Teleport Command below for details.

Automate isolated development environments using git worktrees and tmux sessions with Claude Code. Enables parallel work across multiple tasks, projects, and repositories.

Canonical slash command: /oh-my-claudecode:project-session-manager (alias: /oh-my-claudecode:psm).

Commands

CommandDescriptionExample
review <ref>PR review session/psm review omc#123
fix <ref>Issue fix session/psm fix omc#42
feature <proj> <name>Feature development/psm feature omc add-webhooks
list [project]List active sessions/psm list
attach <session>Attach to session/psm attach omc:pr-123
kill <session>Kill session/psm kill omc:pr-123
cleanupClean merged/closed/psm cleanup
statusCurrent session info/psm status

Project References

Supported formats:

  • Alias: omc#123 (requires ~/.psm/projects.json)
  • Full: owner/repo#123
  • URL: https://github.com/owner/repo/pull/123
  • Current: #123 (uses current directory's repo)

Configuration

Project Aliases (~/.psm/projects.json)

{
  "aliases": {
    "omc": {
      "repo": "Yeachan-Heo/oh-my-claudecode",
      "local": "~/Workspace/oh-my-claudecode",
      "default_base": "main"
    }
  },
  "defaults": {
    "worktree_root": "~/.psm/worktrees",
    "cleanup_after_days": 14
  }
}

Providers

PSM supports multiple issue tracking providers:

ProviderCLI RequiredReference FormatsCommands
GitHub (default)ghowner/repo#123, alias#123, GitHub URLsreview, fix, feature
JirajiraPROJ-123 (if PROJ configured), alias#123fix, feature

Jira Configuration

To use Jira, add an alias with jira_project and provider: "jira":

{
  "aliases": {
    "mywork": {
      "jira_project": "MYPROJ",
      "repo": "mycompany/my-project",
      "local": "~/Workspace/my-project",
      "default_base": "develop",
      "provider": "jira"
    }
  }
}

Important: The repo field is still required for cloning the git repository. Jira tracks issues, but you work in a git repo.

For non-GitHub repos, use clone_url instead:

{
  "aliases": {
    "private": {
      "jira_project": "PRIV",
      "clone_url": "git@gitlab.internal:team/repo.git",
      "local": "~/Workspace/repo",
      "provider": "jira"
    }
  }
}

Jira Reference Detection

PSM only recognizes PROJ-123 format as Jira when PROJ is explicitly configured as a jira_project in your aliases. This prevents false positives from branch names like FIX-123.

Jira Examples

# Fix a Jira issue (MYPROJ must be configured)
psm fix MYPROJ-123

# Fix using alias (recommended)
psm fix mywork#123

# Feature development (works same as GitHub)
psm feature mywork add-webhooks

# Note: 'psm review' is not supported for Jira (no PR concept)
# Use 'psm fix' for Jira issues

Jira CLI Setup

Install the Jira CLI:

# macOS
brew install ankitpokhrel/jira-cli/jira-cli

# Linux
# See: https://github.com/ankitpokhrel/jira-cli#installation

# Configure (interactive)
jira init

The Jira CLI handles authentication separately from PSM.

Directory Structure

~/.psm/
├── projects.json       # Project aliases
├── sessions.json       # Active session registry
└── worktrees/          # Worktree storage
    └── <project>/
        └── <type>-<id>/

Session Naming

The public session ID (colon form, e.g. omc:pr-123) is the human-facing identifier stored in sessions.json and used with psm attach/psm kill. tmux reserves : and . for its session:window.pane target syntax and silently rewrites them, so the actual tmux session name uses a tmux-safe form where those characters become _ (issue #3528). PSM translates the public ID to the tmux-safe name at every tmux boundary; attach directly with the tmux-safe name.

TypePublic ID (psm attach/kill)Tmux Session (tmux attach -t)Worktree Dir
PR Reviewomc:pr-123psm_omc_pr-123~/.psm/worktrees/omc/pr-123
Issue Fixomc:issue-42psm_omc_issue-42~/.psm/worktrees/omc/issue-42
Featureomc:feat-authpsm_omc_feat-auth~/.psm/worktrees/omc/feat-auth

Implementation Protocol

When the user invokes a PSM command, follow this protocol:

Parse Arguments

Parse {{ARGUMENTS}} to determine:

  1. Subcommand: review, fix, feature, list, attach, kill, cleanup, status
  2. Reference: project#number, URL, or session ID
  3. Options: --branch, --base, --no-claude, --no-tmux, etc.

Subcommand: review <ref>

Purpose: Create PR review session

Steps:

  1. Resolve reference:

    # Read project aliases
    cat ~/.psm/projects.json 2>/dev/null || echo '{"aliases":{}}'
    
    # Parse ref format: alias#num, owner/repo#num, or URL
    # Extract: project_alias, repo (owner/repo), pr_number, local_path
    
  2. Fetch PR info:

    gh pr view <pr_number> --repo <repo> --json number,title,author,headRefName,baseRefName,body,files,url
    
  3. Ensure local repo exists:

    # If local path doesn't exist, clone
    if [[ ! -d "$local_path" ]]; then
      git clone "https://github.com/$repo.git" "$local_path"
    fi
    
  4. Create worktree:

    worktree_path="$HOME/.psm/worktrees/$project_alias/pr-$pr_number"
    
    # Fetch PR branch
    cd "$local_path"
    git fetch origin "pull/$pr_number/head:pr-$pr_number-review"
    
    # Create worktree
    git worktree add "$worktree_path" "pr-$pr_number-review"
    
  5. Create session metadata:

    cat > "$worktree_path/.psm-session.json" << EOF
    {
      "id": "$project_alias:pr-$pr_number",
      "type": "review",
      "project": "$project_alias",
      "ref": "pr-$pr_number",
      "branch": "<head_branch>",
      "base": "<base_branch>",
      "created_at": "$(date -Iseconds)",
      "tmux_session": "psm_${project_alias}_pr-$pr_number",
      "worktree_path": "$worktree_path",
      "source_repo": "$local_path",
      "github": {
        "pr_number": $pr_number,
        "pr_title": "<title>",
        "pr_author": "<author>",
        "pr_url": "<url>"
      },
      "state": "active"
    }
    EOF
    
  6. Update sessions registry:

    # Add to ~/.psm/sessions.json
    
  7. Create tmux session (tmux-safe name; :/. are translated to _):

    tmux new-session -d -s "psm_${project_alias}_pr-$pr_number" -c "$worktree_path"
    
  8. Launch Claude Code (unless --no-claude):

    # --dangerously-skip-permissions prevents the "Do you trust this directory?" prompt
    # and repeated tool-approval prompts from stalling the session (issue #2508).
    tmux send-keys -t "psm_${project_alias}_pr-$pr_number" "claude --dangerously-skip-permissions" Enter
    
    # After claude boots (PSM_CLAUDE_STARTUP_DELAY, default 5s), deliver the task.
    # Use -l (literal) so special characters are not misinterpreted by tmux.
    sleep "${PSM_CLAUDE_STARTUP_DELAY:-5}"
    tmux send-keys -t "psm_${project_alias}_pr-$pr_number" -l \
      "Review PR #$pr_number: \"$pr_title\" by @$pr_author ($head_branch → $base_branch). URL: $pr_url." Enter
    
  9. Output session info:

    Session ready!
    
      ID: omc:pr-123
      Worktree: ~/.psm/worktrees/omc/pr-123
      Tmux: psm_omc_pr-123
    
    To attach: tmux attach -t psm_omc_pr-123   (or: psm attach omc:pr-123)
    

Subcommand: fix <ref>

Purpose: Create issue fix session

Steps:

  1. Resolve reference (same as review)

  2. Fetch issue info:

    gh issue view <issue_number> --repo <repo> --json number,title,body,labels,url
    
  3. Create feature branch:

    cd "$local_path"
    git fetch origin main
    branch_name="fix/$issue_number-$(echo "$title" | tr ' ' '-' | tr '[:upper:]' '[:lower:]' | head -c 30)"
    git checkout -b "$branch_name" origin/main
    
  4. Create worktree:

    worktree_path="$HOME/.psm/worktrees/$project_alias/issue-$issue_number"
    git worktree add "$worktree_path" "$branch_name"
    
  5. Create session metadata (similar to review, type="fix")

  6. Update registry, create tmux, launch claude: Same as review, but pass issue context as the initial task prompt:

    tmux send-keys -t "psm_${project_alias}_issue-$issue_number" "claude --dangerously-skip-permissions" Enter
    # After claude boots, deliver the task (see PSM_CLAUDE_STARTUP_DELAY):
    tmux send-keys -t "psm_${project_alias}_issue-$issue_number" -l \
      "Fix issue #$issue_number: \"$issue_title\". URL: $issue_url. Branch: $branch_name." Enter
    

Subcommand: feature <project> <name>

Purpose: Start feature development

Steps:

  1. Resolve project (from alias or path)

  2. Create feature branch:

    cd "$local_path"
    git fetch origin main
    branch_name="feature/$feature_name"
    git checkout -b "$branch_name" origin/main
    
  3. Create worktree:

    worktree_path="$HOME/.psm/worktrees/$project_alias/feat-$feature_name"
    git worktree add "$worktree_path" "$branch_name"
    
  4. Create session, tmux, launch claude with feature context as initial prompt:

    tmux send-keys -t "psm_${project_alias}_feat-$feature_name" "claude --dangerously-skip-permissions" Enter
    tmux send-keys -t "psm_${project_alias}_feat-$feature_name" -l \
      "Implement feature \"$feature_name\" for project $project. Branch: $branch_name." Enter
    

Subcommand: list [project]

Purpose: List active sessions

Steps:

  1. Read sessions registry:

    cat ~/.psm/sessions.json 2>/dev/null || echo '{"sessions":{}}'
    
  2. Check tmux sessions:

    tmux list-sessions -F "#{session_name}" 2>/dev/null | grep "^psm_"
    
  3. Check worktrees:

    ls -la ~/.psm/worktrees/*/ 2>/dev/null
    
  4. Format output:

    Active PSM Sessions:
    
    ID                 | Type    | Status   | Worktree
    -------------------|---------|----------|---------------------------
    omc:pr-123        | review  | active   | ~/.psm/worktrees/omc/pr-123
    omc:issue-42      | fix     | detached | ~/.psm/worktrees/omc/issue-42
    

Subcommand: attach <session>

Purpose: Attach to existing session

Steps:

  1. Parse session ID: project:type-number

  2. Verify session exists:

    tmux has-session -t "psm_${session_id//[.:]/_}" 2>/dev/null   # translate public id to tmux-safe name
    
  3. Attach:

    tmux attach -t "psm_${session_id//[.:]/_}"
    

Subcommand: kill <session>

Purpose: Kill session and cleanup

Steps:

  1. Kill tmux session:

    tmux kill-session -t "psm_${session_id//[.:]/_}" 2>/dev/null
    
  2. Remove worktree:

    worktree_path=$(jq -r ".sessions[\"$session_id\"].worktree" ~/.psm/sessions.json)
    source_repo=$(jq -r ".sessions[\"$session_id\"].source_repo" ~/.psm/sessions.json)
    
    cd "$source_repo"
    git worktree remove "$worktree_path" --force
    
  3. Update registry:

    # Remove from sessions.json
    

Subcommand: cleanup

Purpose: Clean up merged PRs and closed issues

Steps:

  1. Read all sessions

  2. For each PR session, check if merged:

    gh pr view <pr_number> --repo <repo> --json merged,state
    
  3. For each issue session, check if closed:

    gh issue view <issue_number> --repo <repo> --json closed,state
    
  4. Clean up merged/closed sessions:

    • Kill tmux session
    • Remove worktree
    • Update registry
  5. Report:

    Cleanup complete:
      Removed: omc:pr-123 (merged)
      Removed: omc:issue-42 (closed)
      Kept: omc:feat-auth (active)
    

Subcommand: status

Purpose: Show current session info

Steps:

  1. Detect current session from tmux or cwd:

    tmux display-message -p "#{session_name}" 2>/dev/null
    # or check if cwd is inside a worktree
    
  2. Read session metadata:

    cat .psm-session.json 2>/dev/null
    
  3. Show status:

    Current Session: omc:pr-123
    Type: review
    PR: #123 - Add webhook support
    Branch: feature/webhooks
    Created: 2 hours ago
    

Error Handling

ErrorResolution
Worktree existsOffer: attach, recreate, or abort
PR not foundVerify URL/number, check permissions
No tmuxWarn and skip session creation
No gh CLIError with install instructions

Teleport Command

The omc teleport command provides a lightweight alternative to full PSM sessions. It creates git worktrees without tmux session management — ideal for quick, isolated development.

Usage

# Create worktree for an issue or PR
omc teleport #123
omc teleport owner/repo#123
omc teleport https://github.com/owner/repo/issues/42

# Create worktree for a feature
omc teleport my-feature

# List existing worktrees
omc teleport list

# Remove a worktree
omc teleport remove issue/my-repo-123
omc teleport remove --force feat/my-repo-my-feature

Options

FlagDescriptionDefault
--worktreeCreate worktree (default, kept for compatibility)true
--path <path>Custom worktree root directory~/Workspace/omc-worktrees/
--base <branch>Base branch to create frommain
--jsonOutput as JSONfalse

Worktree Layout

~/Workspace/omc-worktrees/
├── issue/
│   └── my-repo-123/        # Issue worktrees
├── pr/
│   └── my-repo-456/        # PR review worktrees
└── feat/
    └── my-repo-my-feature/ # Feature worktrees

PSM vs Teleport

FeaturePSMTeleport
Git worktreeYesYes
Tmux sessionYesNo
Claude Code launchYesNo
Session registryYesNo
Auto-cleanupYesNo
Project aliasesYesNo (uses current repo)

Use PSM for full managed sessions. Use teleport for quick worktree creation.


Requirements

Required:

  • git - Version control (with worktree support v2.5+)
  • jq - JSON parsing
  • tmux - Session management (optional, but recommended)

Optional (per provider):

  • gh - GitHub CLI (for GitHub workflows)
  • jira - Jira CLI (for Jira workflows)

Initialization

On first run, create default config:

mkdir -p ~/.psm/worktrees ~/.psm/logs

# Create default projects.json if not exists
if [[ ! -f ~/.psm/projects.json ]]; then
  cat > ~/.psm/projects.json << 'EOF'
{
  "aliases": {
    "omc": {
      "repo": "Yeachan-Heo/oh-my-claudecode",
      "local": "~/Workspace/oh-my-claudecode",
      "default_base": "main"
    }
  },
  "defaults": {
    "worktree_root": "~/.psm/worktrees",
    "cleanup_after_days": 14,
    "auto_cleanup_merged": true
  }
}
EOF
fi

# Create sessions.json if not exists
if [[ ! -f ~/.psm/sessions.json ]]; then
  echo '{"version":1,"sessions":{},"stats":{"total_created":0,"total_cleaned":0}}' > ~/.psm/sessions.json
fi

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Write or revise instructions, specifications, tickets, and skill files so an agent can act without prior chat history. Make rules checkable, explain their reasons, define completion criteria, and keep authoritative information in one place.

中文简介正在准备中。当前显示英语简介。

  • Clarifying instructions in CLAUDE.md
  • Making specifications and tickets actionable
  • Adding completion criteria to skill procedures
Yeachan-Heo/oh-my-claudecode4万2026年10月21日 更新

Simplify bloated AI-generated code by removing dead code, duplicated logic, and unnecessary layers while checking that existing behavior stays intact. Use a limited cleanup scope, verify changes with relevant checks, or request a review without edits.

中文简介正在准备中。当前显示英语简介。

  • Removing duplicate logic and unused code
  • Simplifying unnecessary wrappers without changing behavior
  • Cleaning up only a specified set of changed files
Yeachan-Heo/oh-my-claudecode4万2026年10月21日 更新

Review module relationships and change history to identify structural improvements in a codebase. Receive ranked candidates with file references, suggested changes, and risks, plus a recommendation for where to start, without modifying code.

中文简介正在准备中。当前显示英语简介。

  • Reviewing architecture after a batch of changes
  • Investigating changes that touch too many files
  • Prioritizing structural improvements
Yeachan-Heo/oh-my-claudecode4万2026年10月21日 更新

ask

免费

Send questions, review requests, or implementation tasks to a supported local AI command-line tool through one shared command. The wrapper handles provider-specific options and saves the result as a Markdown file for later reference.

中文简介正在准备中。当前显示英语简介。

  • Requesting a security review of a patch
  • Seeking UX suggestions for a user flow
  • Drafting an implementation plan for an issue
Yeachan-Heo/oh-my-claudecode4万2026年10月21日 更新

Turn an unclear idea into linked decision tickets on a repository’s issue tracker. Work through one decision per session, record outcomes and dependencies, and prepare a brief defining the objective, scope, and exclusions for delivery.

中文简介正在准备中。当前显示英语简介。

  • Clarifying the destination of an early idea
  • Mapping decisions and their dependencies
  • Resuming unresolved decisions across sessions
Yeachan-Heo/oh-my-claudecode4万2026年10月21日 更新

autopilot

免费

Turn a short product idea into working code through requirements analysis, technical planning, implementation, testing, and review. It coordinates agents across these stages, fixes detected problems, and reports assumptions that still need a human decision.

中文简介正在准备中。当前显示英语简介。

  • Building a product from a short idea
  • Creating a bookstore inventory API
  • Developing a habit-tracking command-line tool
Yeachan-Heo/oh-my-claudecode4万2026年10月21日 更新

查看 Yeachan-Heo 的全部技能

报告此技能的问题