Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计提醒

rlm-worktreeRLM 工作树

Agent Skill

rlm-worktree 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

306

周安装

13

GitHub Stars

53

下载量

107
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:rlm-worktree(RLM 工作树)
来源仓库:https://github.com/doubleuuser/rlm-workflow
仓库路径:skills/rlm-worktree
安装命令:
npx skills add https://github.com/doubleuuser/rlm-workflow --skill rlm-worktree
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/doubleuuser/rlm-workflow --skill rlm-worktree

简介

rlm-worktree 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 适用于代码协作、仓库管理和开发流程优化场景。
  • 支持主流 Agent 宿主环境,通过 npx 方式便捷安装。

SKILL.md

RLM Git Worktree Isolation (Phase 0)

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing parallel development without switching branches. This prevents:

  • Pollution of main/master branch during development
  • Accidental commits to production branches
  • Context switching overhead
  • Conflicts between parallel requirements

Core Principle: Systematic directory selection + safety verification = reliable isolation.

The Iron Law for RLM Worktrees:

NEVER WORK ON MAIN/MASTER BRANCH WITHOUT EXPLICIT CONSENT

Trigger examples

  • Create an isolated worktree for this requirement
  • Set up Phase 0 worktree isolation for run '2026-02-24-add-oauth'
  • I'm on main; move me to a worktree
  • Use.worktrees/ and ensure it is git-ignored

When to Use

REQUIRED for all RLM runs:

  • New features
  • Bug fixes
  • Refactoring
  • Experiments/prototypes

Insert as Phase 0:

Phase 0R: 00-requirements.md (user-created first)
    ->
Phase 0W: 00-worktree.md (isolated workspace setup; this skill)
    ->
Phase 1: 01-as-is.md

The Worktree Rule

Directory Selection Process

Step 1: Check Existing Directories

# Check in priority order
ls -d .worktrees 2>/dev/null     # Preferred (hidden)
ls -d worktrees 2>/dev/null      # Alternative

If found: Use that directory. If both exist, .worktrees wins.

Step 2: Check CLAUDE.md

grep -i "worktree.*director" CLAUDE.md 2>/dev/null
grep -i "worktrees" CLAUDE.md 2>/dev/null

If preference specified: Use it without asking.

Step 3: Ask User (if no convention exists)

No worktree directory found. Where should I create worktrees?

1. .worktrees/ (project-local, hidden - RECOMMENDED)
2. ~/.config/rlm-workflow/worktrees/<project-name>/ (global location)

Which would you prefer? (1/2)

Default: .worktrees/ (option 1)

Safety Verification

For Project-Local Directories (.worktrees or worktrees)

MUST verify directory is ignored before creating worktree:

# Check if directory is ignored (respects local, global, and system gitignore)
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null

If NOT ignored:

Per "Fix broken things immediately" rule:

  1. Add appropriate line to.gitignore: # RLM worktrees.worktrees/
  2. Commit the change: git add.gitignore git commit -m "chore: ignore RLM worktree directory"
  3. Proceed with worktree creation

Why critical: Prevents accidentally committing worktree contents to repository.

For Global Directory (~/.config/rlm-workflow/worktrees)

No.gitignore verification needed - outside project entirely.

Worktree Creation Process

Step 1: Detect Project Name

project=$(basename "$(git rev-parse --show-toplevel)")
branch_name="rlm/${run_id}"

Step 2: Check Current Branch

current_branch=$(git branch --show-current)

if [ "$current_branch" = "main" ] || [ "$current_branch" = "master" ]; then
    # STOP - Require explicit consent
    echo "WARNING: Currently on $current_branch branch."
    echo "RLM Workflow requires isolated worktrees."
    echo ""
    read -p "Create worktree and switch to feature branch? (yes/no): " consent

    if [ "$consent" != "yes" ]; then
        echo "Aborted. Please run from a feature branch or consent to worktree creation."
        exit 1
    fi
fi

Step 3: Create Worktree with New Branch

# Determine full path
case $LOCATION in
  .worktrees|worktrees)
    path="$LOCATION/$run_id"
    ;;
  ~/.config/rlm-workflow/worktrees/*)
    path="~/.config/rlm-workflow/worktrees/$project/$run_id"
    ;;
esac

# Create worktree with new branch
git worktree add "$path" -b "$branch_name"
cd "$path"

Step 4: Run Project Setup

Auto-detect and run appropriate setup:

# Node.js
if [ -f package.json ]; then
    echo "Detected Node.js project"
    npm install
fi

# Rust
if [ -f Cargo.toml ]; then
    echo "Detected Rust project"
    cargo build
fi

# Python
if [ -f requirements.txt ]; then
    echo "Detected Python project (requirements.txt)"
    pip install -r requirements.txt
elif [ -f pyproject.toml ]; then
    echo "Detected Python project (pyproject.toml)"
    poetry install || pip install -e .
fi

# Go
if [ -f go.mod ]; then
    echo "Detected Go project"
    go mod download
fi

# Java/Maven
if [ -f pom.xml ]; then
    echo "Detected Maven project"
    mvn compile -q
fi

# Java/Gradle
if [ -f build.gradle ] || [ -f build.gradle.kts ]; then
    echo "Detected Gradle project"
    ./gradlew compileJava --quiet 2>/dev/null || gradlew compileJava --quiet 2>/dev/null
fi

# .NET
if [ -f *.csproj ] || [ -f *.sln ]; then
    echo "Detected .NET project"
    dotnet restore
fi

Step 5: Verify Clean Test Baseline

Run tests to ensure worktree starts clean:

# Detect test command and run
if [ -f package.json ]; then
    # Check for npm test script
    if grep -q '"test"' package.json; then
        echo "Running npm test..."
        npm test
    fi
elif [ -f Cargo.toml ]; then
    echo "Running cargo test..."
    cargo test
elif [ -f requirements.txt ] || [ -f pyproject.toml ]; then
    echo "Running pytest..."
    pytest -q || python -m pytest -q
elif [ -f go.mod ]; then
    echo "Running go test..."
    go test ./...
elif [ -f pom.xml ]; then
    echo "Running Maven tests..."
    mvn test -q
elif [ -f build.gradle ] || [ -f build.gradle.kts ]; then
    echo "Running Gradle tests..."
    ./gradlew test --quiet 2>/dev/null || gradlew test --quiet 2>/dev/null
elif [ -f *.csproj ] || [ -f *.sln ]; then
    echo "Running dotnet tests..."
    dotnet test --verbosity quiet
fi

If tests fail:

  • Report failures
  • Ask whether to proceed or investigate
  • Document decision in Phase 0 artifact

If tests pass:

  • Report baseline verified
  • Record test count and pass rate

Step 6: Record in Phase 0 Artifact

## Worktree Details

**Location:** `/full/path/to/.worktrees/run-id`
**Branch:** `rlm/run-id`
**Created from:** `main` (commit: abc123)
**Setup commands executed:**
- npm install
- npm test (47 passing, 0 failing)

**Baseline verified:** ✅

Main Branch Protection

Automatic Detection

When user invokes "Implement requirement 'run-id'" from main/master:

branch=$(git branch --show-current)

if [ "$branch" = "main" ] || [ "$branch" = "master" ]; then
    echo "╔════════════════════════════════════════════════════════════╗"
    echo "║  !   MAIN BRANCH PROTECTION                                ║"
    echo "╠════════════════════════════════════════════════════════════╣"
    echo "║  You are currently on the $branch branch.                  ║"
    echo "║                                                            ║"
    echo "║  RLM Workflow requires isolated worktrees to:             ║"
    echo "║  • Prevent accidental commits to production               ║"
    echo "║  • Enable parallel requirement development                ║"
    echo "║  • Maintain clean main branch history                     ║"
    echo "║                                                            ║"
    echo "║  Options:                                                  ║"
    echo "║  1. Create worktree (RECOMMENDED)                          ║"
    echo "║  2. Switch to existing feature branch                      ║"
    echo "║  3. Abort and run from feature branch                      ║"
    echo "╚════════════════════════════════════════════════════════════╝"
    echo ""

    # Default to worktree creation
    echo "Creating worktree by default (press Ctrl+C to abort)..."
    sleep 3
fi

Explicit Consent Required

If user explicitly requests main branch work:

## Main Branch Work Acknowledgment

User has explicitly requested to work on main branch.

**Acknowledged risks:**
- [ ] Commits go directly to production branch
- [ ] No isolation for this requirement
- [ ] Cannot run parallel requirements
- [ ] Harder to discard if abandoned

**Consent:** User has chosen to proceed on main branch
**Reason:** [user-provided reason]
**Recorded:** [timestamp]

**Recommendation:** Use worktrees for future requirements.

Phase 0 Artifact Template

File: /.codex/rlm/<run-id>/00-worktree.md

Run: `/.codex/rlm/<run-id>/`
Phase: `00 Worktree Setup`
Status: `DRAFT` | `LOCKED`
Inputs:
- Current git repository state
- User preference (for worktree location)
Outputs:
- `/.codex/rlm/<run-id>/00-worktree.md`
- Isolated worktree at `[location]`
Scope note: This document records isolated workspace setup and verifies clean test baseline.

## Directory Selection

**Convention checked:**
- [ ] `.worktrees/` exists
- [ ] `worktrees/` exists
- [ ] CLAUDE.md preference found
- [ ] User preference obtained

**Selected location:** `.worktrees/` (project-local, hidden)

## Safety Verification

**Gitignore check:**

$ git check-ignore -q .worktrees && echo "IGNORED" || echo "NOT IGNORED" IGNORED


**Result:** ✅ Directory is properly ignored

## Worktree Creation

**Command:**

git worktree add .worktrees/run-id -b rlm/run-id


**Output:**

Preparing worktree (new branch 'rlm/run-id') HEAD is now at abc1234 Previous commit message


**Branch created:** `rlm/run-id` **Location:** `/full/path/to/project/.worktrees/run-id`

## Project Setup

**Detected project type:** Node.js (package.json found)

**Commands executed:**

cd .worktrees/run-id npm install


**Output:**

added 472 packages in 8s


## Test Baseline Verification

**Command:**

npm test


**Results:**

- Total: 47 tests
- Passed: 47
- Failed: 0
- Skipped: 0

**Baseline:** ✅ Clean (all tests passing)

## Main Branch Protection

**Original branch:** `main` **Worktree branch:** `rlm/run-id` **Isolation:** ✅ Working in isolated worktree

## Traceability

- RLM process -> Isolated workspace established | Evidence: worktree at `.worktrees/run-id`

## Coverage Gate

- Worktree location selected following priority rules
- Directory verified as git-ignored (if project-local)
- Worktree created successfully on feature branch
- Project setup completed without errors
- Clean test baseline verified (all tests passing)
- Main branch protection confirmed (working in isolation)

Coverage: PASS / FAIL

## Approval Gate

- Isolated workspace ready for development
- No pending setup issues
- Ready to proceed to Phase 1/2

Approval: PASS / FAIL

LockedAt: `YYYY-MM-DDTHH:MM:SSZ` LockHash: `<sha256-hex>`

Integration with RLM

Phase 0 -> Phase 1 Transition

Phase 0 must be locked before proceeding:

  1. Verify worktree exists and is properly configured
  2. Check Phase 0 gates are PASS
  3. Lock Phase 0 artifact
  4. Proceed to Phase 1 (requirements already exist)
  5. All subsequent phases execute in worktree context

Worktree Context for All Phases

Once Phase 0 is complete:

  • All RLM commands run from worktree directory
  • Git operations target feature branch
  • Main branch remains untouched
  • Development is fully isolated

Phase 6/7 (Global Updates)

When updating global artifacts:

  1. Changes are made in worktree context
  2. Commits go to feature branch
  3. User merges feature branch to main when ready
  4. DECISIONS.md and STATE.md updates are part of the merge

Common Mistakes

Skipping ignore verification

  • Problem: Worktree contents get tracked, pollute git status
  • Fix: Always use git check-ignore before creating project-local worktree

Assuming directory location

  • Problem: Creates inconsistency, violates project conventions
  • Fix: Follow priority: existing > CLAUDE.md > ask

Proceeding with failing tests

  • Problem: Can't distinguish new bugs from pre-existing issues
  • Fix: Report failures, get explicit permission to proceed

Hardcoding setup commands

  • Problem: Breaks on projects using different tools
  • Fix: Auto-detect from project files (package.json, Cargo.toml, etc.)

Red Flags

Never:

  • Create worktree without verifying it's ignored (project-local)
  • Skip baseline test verification
  • Proceed with failing tests without asking
  • Assume directory location when ambiguous
  • Skip CLAUDE.md check
  • Work on main/master without explicit consent and documentation

Always:

  • Follow directory priority: existing > CLAUDE.md > ask
  • Verify directory is ignored for project-local
  • Auto-detect and run project setup
  • Verify clean test baseline
  • Create feature branch (rlm/run-id pattern)
  • Document worktree location in Phase 0 artifact

Quick Reference

SituationAction
.worktrees/ existsUse it (verify ignored)
worktrees/ existsUse it (verify ignored)
Both existUse .worktrees/
Neither existsCheck CLAUDE.md -> Ask user
Directory not ignoredAdd to .gitignore + commit
Tests fail during baselineReport failures + ask
On main/master branchCreate worktree (default)
User insists on mainDocument consent, proceed with caution
No package.json/Cargo.tomlSkip dependency install

Real-World Impact

From development sessions:

  • Before worktrees: 15% of requirements had accidental main branch commits
  • After worktrees: 0% accidental main branch commits
  • Parallel development: 3+ requirements can be worked simultaneously
  • Clean main branch: Production history is clean and linear
  • Easy discard: Abandoned requirements don't pollute main branch

References

  • REQUIRED: Use this skill for ALL RLM runs
  • TRIGGERS: At start of "Implement requirement 'run-id'"
  • OUTPUT: 00-worktree.md artifact + isolated worktree
  • NEXT: Continue with Phase 1 (requirements) in worktree context

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.1%
按下载量换算38

Claude

28.88%
按下载量换算31

Cursor

20.09%
按下载量换算21

Gemini CLI

10.17%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills