Project Session Manager (PSM) Skill
psm is the compatibility alias for this canonical skill entrypoint.
Quick Start (worktree-first): Start with
omq teleportwhen you want an isolated issue/PR/feature worktree before adding any tmux/session orchestration:omq teleport #123 # Create worktree for issue/PR omq teleport my-feature # Create worktree for feature omq teleport list # List worktreesSee Teleport Command below for details.
Automate isolated development environments using git worktrees and tmux sessions with Qoder CLI. Enables parallel work across multiple tasks, projects, and repositories.
Canonical slash command: /oh-my-qoder:project-session-manager (alias: /oh-my-qoder:psm).
Commands
| Command | Description | Example |
|---|---|---|
review <ref> |
PR review session | /psm review omq#123 |
fix <ref> |
Issue fix session | /psm fix omq#42 |
feature <proj> <name> |
Feature development | /psm feature omq add-webhooks |
list [project] |
List active sessions | /psm list |
attach <session> |
Attach to session | /psm attach omq:pr-123 |
kill <session> |
Kill session | /psm kill omq:pr-123 |
cleanup |
Clean merged/closed | /psm cleanup |
status |
Current session info | /psm status |
Project References
Supported formats:
- Alias:
omq#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": {
"omq": {
"repo": "spring-ai-alibaba/oh-my-qoder",
"local": "~/Workspace/oh-my-qoder",
"default_base": "main"
}
},
"defaults": {
"worktree_root": "~/.psm/worktrees",
"cleanup_after_days": 14
}
}
Providers
PSM supports multiple issue tracking providers:
| Provider | CLI Required | Reference Formats | Commands |
|---|---|---|---|
| GitHub (default) | gh |
owner/repo#123, alias#123, GitHub URLs |
review, fix, feature |
| Jira | jira |
PROJ-123 (if PROJ configured), alias#123 |
fix, 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
| Type | Tmux Session | Worktree Dir |
|---|---|---|
| PR Review | psm:omq:pr-123 |
~/.psm/worktrees/omq/pr-123 |
| Issue Fix | psm:omq:issue-42 |
~/.psm/worktrees/omq/issue-42 |
| Feature | psm:omq:feat-auth |
~/.psm/worktrees/omq/feat-auth |
Implementation Protocol
When the user invokes a PSM command, follow this protocol:
Parse Arguments
Parse {{ARGUMENTS}} to determine:
- Subcommand: review, fix, feature, list, attach, kill, cleanup, status
- Reference: project#number, URL, or session ID
- Options: --branch, --base, --no-claude, --no-tmux, etc.
Subcommand: review <ref>
Purpose: Create PR review session
Steps:
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_pathFetch PR info:
gh pr view <pr_number> --repo <repo> --json number,title,author,headRefName,baseRefName,body,files,urlEnsure local repo exists:
# If local path doesn't exist, clone if [[ ! -d "$local_path" ]]; then git clone "https://github.com/$repo.git" "$local_path" fiCreate 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"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" } EOFUpdate sessions registry:
# Add to ~/.psm/sessions.jsonCreate tmux session:
tmux new-session -d -s "psm:$project_alias:pr-$pr_number" -c "$worktree_path"Launch Qoder CLI (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." EnterOutput session info:
Session ready! ID: omq:pr-123 Worktree: ~/.psm/worktrees/omq/pr-123 Tmux: psm:omq:pr-123 To attach: tmux attach -t psm:omq:pr-123
Subcommand: fix <ref>
Purpose: Create issue fix session
Steps:
Resolve reference (same as review)
Fetch issue info:
gh issue view <issue_number> --repo <repo> --json number,title,body,labels,urlCreate 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/mainCreate worktree:
worktree_path="$HOME/.psm/worktrees/$project_alias/issue-$issue_number" git worktree add "$worktree_path" "$branch_name"Create session metadata (similar to review, type="fix")
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:
Resolve project (from alias or path)
Create feature branch:
cd "$local_path" git fetch origin main branch_name="feature/$feature_name" git checkout -b "$branch_name" origin/mainCreate worktree:
worktree_path="$HOME/.psm/worktrees/$project_alias/feat-$feature_name" git worktree add "$worktree_path" "$branch_name"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:
Read sessions registry:
cat ~/.psm/sessions.json 2>/dev/null || echo '{"sessions":{}}'Check tmux sessions:
tmux list-sessions -F "#{session_name}" 2>/dev/null | grep "^psm:"Check worktrees:
ls -la ~/.psm/worktrees/*/ 2>/dev/nullFormat output:
Active PSM Sessions: ID | Type | Status | Worktree -------------------|---------|----------|--------------------------- omq:pr-123 | review | active | ~/.psm/worktrees/omq/pr-123 omq:issue-42 | fix | detached | ~/.psm/worktrees/omq/issue-42
Subcommand: attach <session>
Purpose: Attach to existing session
Steps:
Parse session ID:
project:type-numberVerify session exists:
tmux has-session -t "psm:$session_id" 2>/dev/nullAttach:
tmux attach -t "psm:$session_id"
Subcommand: kill <session>
Purpose: Kill session and cleanup
Steps:
Kill tmux session:
tmux kill-session -t "psm:$session_id" 2>/dev/nullRemove 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" --forceUpdate registry:
# Remove from sessions.json
Subcommand: cleanup
Purpose: Clean up merged PRs and closed issues
Steps:
Read all sessions
For each PR session, check if merged:
gh pr view <pr_number> --repo <repo> --json merged,stateFor each issue session, check if closed:
gh issue view <issue_number> --repo <repo> --json closed,stateClean up merged/closed sessions:
- Kill tmux session
- Remove worktree
- Update registry
Report:
Cleanup complete: Removed: omq:pr-123 (merged) Removed: omq:issue-42 (closed) Kept: omq:feat-auth (active)
Subcommand: status
Purpose: Show current session info
Steps:
Detect current session from tmux or cwd:
tmux display-message -p "#{session_name}" 2>/dev/null # or check if cwd is inside a worktreeRead session metadata:
cat .psm-session.json 2>/dev/nullShow status:
Current Session: omq:pr-123 Type: review PR: #123 - Add webhook support Branch: feature/webhooks Created: 2 hours ago
Error Handling
| Error | Resolution |
|---|---|
| Worktree exists | Offer: attach, recreate, or abort |
| PR not found | Verify URL/number, check permissions |
| No tmux | Warn and skip session creation |
| No gh CLI | Error with install instructions |
Teleport Command
The omq 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
omq teleport #123
omq teleport owner/repo#123
omq teleport https://github.com/owner/repo/issues/42
# Create worktree for a feature
omq teleport my-feature
# List existing worktrees
omq teleport list
# Remove a worktree
omq teleport remove issue/my-repo-123
omq teleport remove --force feat/my-repo-my-feature
Options
| Flag | Description | Default |
|---|---|---|
--worktree |
Create worktree (default, kept for compatibility) | true |
--path <path> |
Custom worktree root directory | ~/Workspace/omq-worktrees/ |
--base <branch> |
Base branch to create from | main |
--json |
Output as JSON | false |
Worktree Layout
~/Workspace/omq-worktrees/
├── issue/
│ └── my-repo-123/ # Issue worktrees
├── pr/
│ └── my-repo-456/ # PR review worktrees
└── feat/
└── my-repo-my-feature/ # Feature worktrees
PSM vs Teleport
| Feature | PSM | Teleport |
|---|---|---|
| Git worktree | Yes | Yes |
| Tmux session | Yes | No |
| Qoder CLI launch | Yes | No |
| Session registry | Yes | No |
| Auto-cleanup | Yes | No |
| Project aliases | Yes | No (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 parsingtmux- 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": {
"omq": {
"repo": "spring-ai-alibaba/oh-my-qoder",
"local": "~/Workspace/oh-my-qoder",
"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