[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DPY19WAJ6B31N2APE6NDKW":3,"skill-same:01M6DPY19WAJ6B31N2APE6NDKW":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":26,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M6DPY19WAJ6B31N2APE6NDKW","rlm-worktree",null,"Use when starting any RLM requirement to set up an isolated git worktree. REQUIRED before Phase 1 - creates isolated workspace, verifies clean test baseline, and prevents main branch pollution. Trigger phrases: \"create worktree\", \"worktree isolation\", \"set up worktree\", \"do not work on main\".","spideynolove\u002Fclaude-dotfiles","spideynolove","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F19179621?v=4","01M6DPV14K2QND6S7BX6HNQYX9","Hung Nguyen","01M6DPV1MMAV9858D8R8CHM5QM",2,"MIT","https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.agents-global\u002Fskills\u002Frlm-workflow\u002Fskills\u002Frlm-worktree\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"rlm worktree","worktree","rlm","use","trigger","isolation","pollution","main","do","clean","up","test","branch","work","workspace","work on","git worktree","SET","git","create","2026-11-10 10:12:30",false,"---\nname: rlm-worktree\ndescription: 'Use when starting any RLM requirement to set up an isolated git worktree. REQUIRED before Phase 1 - creates isolated workspace, verifies clean test baseline, and prevents main branch pollution. Trigger phrases: \"create worktree\", \"worktree isolation\", \"set up worktree\", \"do not work on main\".'\n---\n\n# RLM Git Worktree Isolation (Phase 0)\n\n## Overview\n\nGit worktrees create isolated workspaces sharing the same repository, allowing parallel development without switching branches. This prevents:\n- Pollution of main\u002Fmaster branch during development\n- Accidental commits to production branches\n- Context switching overhead\n- Conflicts between parallel requirements\n\n**Core Principle:** Systematic directory selection + safety verification = reliable isolation.\n\n**The Iron Law for RLM Worktrees:**\n```\nNEVER WORK ON MAIN\u002FMASTER BRANCH WITHOUT EXPLICIT CONSENT\n```\n\n## Trigger examples\n\n- `Create an isolated worktree for this requirement`\n- `Set up Phase 0 worktree isolation for run '2026-02-24-add-oauth'`\n- `I'm on main; move me to a worktree`\n- `Use .worktrees\u002F and ensure it is git-ignored`\n\n## When to Use\n\n**REQUIRED for all RLM runs:**\n- New features\n- Bug fixes\n- Refactoring\n- Experiments\u002Fprototypes\n\n**Insert as Phase 0:**\n```\nPhase 0R: 00-requirements.md (user-created first)\n    ->\nPhase 0W: 00-worktree.md (isolated workspace setup; this skill)\n    ->\nPhase 1: 01-as-is.md\n```\n\n## The Worktree Rule\n\n\u003CHG>\nDo NOT proceed with any RLM phase until:\n1. Isolated worktree is created on feature branch\n2. Worktree directory is git-ignored (if project-local)\n3. Clean test baseline is verified\n4. User has explicitly consented if main branch work requested\n\u003C\u002FHG>\n\n## Directory Selection Process\n\n### Step 1: Check Existing Directories\n\n```bash\n# Check in priority order\nls -d .worktrees 2>\u002Fdev\u002Fnull     # Preferred (hidden)\nls -d worktrees 2>\u002Fdev\u002Fnull      # Alternative\n```\n\n**If found:** Use that directory. If both exist, `.worktrees` wins.\n\n### Step 2: Check CLAUDE.md\n\n```bash\ngrep -i \"worktree.*director\" CLAUDE.md 2>\u002Fdev\u002Fnull\ngrep -i \"worktrees\" CLAUDE.md 2>\u002Fdev\u002Fnull\n```\n\n**If preference specified:** Use it without asking.\n\n### Step 3: Ask User (if no convention exists)\n\n```\nNo worktree directory found. Where should I create worktrees?\n\n1. .worktrees\u002F (project-local, hidden - RECOMMENDED)\n2. ~\u002F.config\u002Frlm-workflow\u002Fworktrees\u002F\u003Cproject-name>\u002F (global location)\n\nWhich would you prefer? (1\u002F2)\n```\n\n**Default:** `.worktrees\u002F` (option 1)\n\n## Safety Verification\n\n### For Project-Local Directories (.worktrees or worktrees)\n\n**MUST verify directory is ignored before creating worktree:**\n\n```bash\n# Check if directory is ignored (respects local, global, and system gitignore)\ngit check-ignore -q .worktrees 2>\u002Fdev\u002Fnull || git check-ignore -q worktrees 2>\u002Fdev\u002Fnull\n```\n\n**If NOT ignored:**\n\nPer \"Fix broken things immediately\" rule:\n1. Add appropriate line to .gitignore:\n   ```\n   # RLM worktrees\n   .worktrees\u002F\n   ```\n2. Commit the change:\n   ```bash\n   git add .gitignore\n   git commit -m \"chore: ignore RLM worktree directory\"\n   ```\n3. Proceed with worktree creation\n\n**Why critical:** Prevents accidentally committing worktree contents to repository.\n\n### For Global Directory (~\u002F.config\u002Frlm-workflow\u002Fworktrees)\n\nNo .gitignore verification needed - outside project entirely.\n\n## Worktree Creation Process\n\n### Step 1: Detect Project Name\n\n```bash\nproject=$(basename \"$(git rev-parse --show-toplevel)\")\nbranch_name=\"rlm\u002F${run_id}\"\n```\n\n### Step 2: Check Current Branch\n\n```bash\ncurrent_branch=$(git branch --show-current)\n\nif [ \"$current_branch\" = \"main\" ] || [ \"$current_branch\" = \"master\" ]; then\n    # STOP - Require explicit consent\n    echo \"WARNING: Currently on $current_branch branch.\"\n    echo \"RLM Workflow requires isolated worktrees.\"\n    echo \"\"\n    read -p \"Create worktree and switch to feature branch? (yes\u002Fno): \" consent\n    \n    if [ \"$consent\" != \"yes\" ]; then\n        echo \"Aborted. Please run from a feature branch or consent to worktree creation.\"\n        exit 1\n    fi\nfi\n```\n\n### Step 3: Create Worktree with New Branch\n\n```bash\n# Determine full path\ncase $LOCATION in\n  .worktrees|worktrees)\n    path=\"$LOCATION\u002F$run_id\"\n    ;;\n  ~\u002F.config\u002Frlm-workflow\u002Fworktrees\u002F*)\n    path=\"~\u002F.config\u002Frlm-workflow\u002Fworktrees\u002F$project\u002F$run_id\"\n    ;;\nesac\n\n# Create worktree with new branch\ngit worktree add \"$path\" -b \"$branch_name\"\ncd \"$path\"\n```\n\n### Step 4: Run Project Setup\n\nAuto-detect and run appropriate setup:\n\n```bash\n# Node.js\nif [ -f package.json ]; then \n    echo \"Detected Node.js project\"\n    npm install\nfi\n\n# Rust\nif [ -f Cargo.toml ]; then \n    echo \"Detected Rust project\"\n    cargo build\nfi\n\n# Python\nif [ -f requirements.txt ]; then \n    echo \"Detected Python project (requirements.txt)\"\n    pip install -r requirements.txt\nelif [ -f pyproject.toml ]; then \n    echo \"Detected Python project (pyproject.toml)\"\n    poetry install || pip install -e .\nfi\n\n# Go\nif [ -f go.mod ]; then \n    echo \"Detected Go project\"\n    go mod download\nfi\n\n# Java\u002FMaven\nif [ -f pom.xml ]; then \n    echo \"Detected Maven project\"\n    mvn compile -q\nfi\n\n# Java\u002FGradle\nif [ -f build.gradle ] || [ -f build.gradle.kts ]; then \n    echo \"Detected Gradle project\"\n    .\u002Fgradlew compileJava --quiet 2>\u002Fdev\u002Fnull || gradlew compileJava --quiet 2>\u002Fdev\u002Fnull\nfi\n\n# .NET\nif [ -f *.csproj ] || [ -f *.sln ]; then \n    echo \"Detected .NET project\"\n    dotnet restore\nfi\n```\n\n### Step 5: Verify Clean Test Baseline\n\nRun tests to ensure worktree starts clean:\n\n```bash\n# Detect test command and run\nif [ -f package.json ]; then\n    # Check for npm test script\n    if grep -q '\"test\"' package.json; then\n        echo \"Running npm test...\"\n        npm test\n    fi\nelif [ -f Cargo.toml ]; then\n    echo \"Running cargo test...\"\n    cargo test\nelif [ -f requirements.txt ] || [ -f pyproject.toml ]; then\n    echo \"Running pytest...\"\n    pytest -q || python -m pytest -q\nelif [ -f go.mod ]; then\n    echo \"Running go test...\"\n    go test .\u002F...\nelif [ -f pom.xml ]; then\n    echo \"Running Maven tests...\"\n    mvn test -q\nelif [ -f build.gradle ] || [ -f build.gradle.kts ]; then\n    echo \"Running Gradle tests...\"\n    .\u002Fgradlew test --quiet 2>\u002Fdev\u002Fnull || gradlew test --quiet 2>\u002Fdev\u002Fnull\nelif [ -f *.csproj ] || [ -f *.sln ]; then\n    echo \"Running dotnet tests...\"\n    dotnet test --verbosity quiet\nfi\n```\n\n**If tests fail:**\n- Report failures\n- Ask whether to proceed or investigate\n- Document decision in Phase 0 artifact\n\n**If tests pass:**\n- Report baseline verified\n- Record test count and pass rate\n\n### Step 6: Record in Phase 0 Artifact\n\n```markdown\n## Worktree Details\n\n**Location:** `\u002Ffull\u002Fpath\u002Fto\u002F.worktrees\u002Frun-id`\n**Branch:** `rlm\u002Frun-id`\n**Created from:** `main` (commit: abc123)\n**Setup commands executed:**\n- npm install\n- npm test (47 passing, 0 failing)\n\n**Baseline verified:** ✅\n```\n\n## Main Branch Protection\n\n### Automatic Detection\n\nWhen user invokes \"Implement requirement 'run-id'\" from main\u002Fmaster:\n\n```bash\nbranch=$(git branch --show-current)\n\nif [ \"$branch\" = \"main\" ] || [ \"$branch\" = \"master\" ]; then\n    echo \"╔════════════════════════════════════════════════════════════╗\"\n    echo \"║  !   MAIN BRANCH PROTECTION                                ║\"\n    echo \"╠════════════════════════════════════════════════════════════╣\"\n    echo \"║  You are currently on the $branch branch.                  ║\"\n    echo \"║                                                            ║\"\n    echo \"║  RLM Workflow requires isolated worktrees to:             ║\"\n    echo \"║  • Prevent accidental commits to production               ║\"\n    echo \"║  • Enable parallel requirement development                ║\"\n    echo \"║  • Maintain clean main branch history                     ║\"\n    echo \"║                                                            ║\"\n    echo \"║  Options:                                                  ║\"\n    echo \"║  1. Create worktree (RECOMMENDED)                          ║\"\n    echo \"║  2. Switch to existing feature branch                      ║\"\n    echo \"║  3. Abort and run from feature branch                      ║\"\n    echo \"╚════════════════════════════════════════════════════════════╝\"\n    echo \"\"\n    \n    # Default to worktree creation\n    echo \"Creating worktree by default (press Ctrl+C to abort)...\"\n    sleep 3\nfi\n```\n\n### Explicit Consent Required\n\nIf user explicitly requests main branch work:\n\n```markdown\n## Main Branch Work Acknowledgment\n\nUser has explicitly requested to work on main branch.\n\n**Acknowledged risks:**\n- [ ] Commits go directly to production branch\n- [ ] No isolation for this requirement\n- [ ] Cannot run parallel requirements\n- [ ] Harder to discard if abandoned\n\n**Consent:** User has chosen to proceed on main branch\n**Reason:** [user-provided reason]\n**Recorded:** [timestamp]\n\n**Recommendation:** Use worktrees for future requirements.\n```\n\n## Phase 0 Artifact Template\n\n**File:** `\u002F.codex\u002Frlm\u002F\u003Crun-id>\u002F00-worktree.md`\n\n```markdown\nRun: `\u002F.codex\u002Frlm\u002F\u003Crun-id>\u002F`\nPhase: `00 Worktree Setup`\nStatus: `DRAFT` | `LOCKED`\nInputs:\n- Current git repository state\n- User preference (for worktree location)\nOutputs:\n- `\u002F.codex\u002Frlm\u002F\u003Crun-id>\u002F00-worktree.md`\n- Isolated worktree at `[location]`\nScope note: This document records isolated workspace setup and verifies clean test baseline.\n\n## Directory Selection\n\n**Convention checked:**\n- [ ] `.worktrees\u002F` exists\n- [ ] `worktrees\u002F` exists\n- [ ] CLAUDE.md preference found\n- [ ] User preference obtained\n\n**Selected location:** `.worktrees\u002F` (project-local, hidden)\n\n## Safety Verification\n\n**Gitignore check:**\n```bash\n$ git check-ignore -q .worktrees && echo \"IGNORED\" || echo \"NOT IGNORED\"\nIGNORED\n```\n\n**Result:** ✅ Directory is properly ignored\n\n## Worktree Creation\n\n**Command:**\n```bash\ngit worktree add .worktrees\u002Frun-id -b rlm\u002Frun-id\n```\n\n**Output:**\n```\nPreparing worktree (new branch 'rlm\u002Frun-id')\nHEAD is now at abc1234 Previous commit message\n```\n\n**Branch created:** `rlm\u002Frun-id`\n**Location:** `\u002Ffull\u002Fpath\u002Fto\u002Fproject\u002F.worktrees\u002Frun-id`\n\n## Project Setup\n\n**Detected project type:** Node.js (package.json found)\n\n**Commands executed:**\n```bash\ncd .worktrees\u002Frun-id\nnpm install\n```\n\n**Output:**\n```\nadded 472 packages in 8s\n```\n\n## Test Baseline Verification\n\n**Command:**\n```bash\nnpm test\n```\n\n**Results:**\n- Total: 47 tests\n- Passed: 47\n- Failed: 0\n- Skipped: 0\n\n**Baseline:** ✅ Clean (all tests passing)\n\n## Main Branch Protection\n\n**Original branch:** `main`\n**Worktree branch:** `rlm\u002Frun-id`\n**Isolation:** ✅ Working in isolated worktree\n\n## Traceability\n\n- RLM process -> Isolated workspace established | Evidence: worktree at `.worktrees\u002Frun-id`\n\n## Coverage Gate\n\n- [ ] Worktree location selected following priority rules\n- [ ] Directory verified as git-ignored (if project-local)\n- [ ] Worktree created successfully on feature branch\n- [ ] Project setup completed without errors\n- [ ] Clean test baseline verified (all tests passing)\n- [ ] Main branch protection confirmed (working in isolation)\n\nCoverage: PASS \u002F FAIL\n\n## Approval Gate\n\n- [ ] Isolated workspace ready for development\n- [ ] No pending setup issues\n- [ ] Ready to proceed to Phase 1\u002F2\n\nApproval: PASS \u002F FAIL\n\nLockedAt: `YYYY-MM-DDTHH:MM:SSZ`\nLockHash: `\u003Csha256-hex>`\n```\n\n## Integration with RLM\n\n### Phase 0 -> Phase 1 Transition\n\nPhase 0 must be locked before proceeding:\n\n1. Verify worktree exists and is properly configured\n2. Check Phase 0 gates are PASS\n3. Lock Phase 0 artifact\n4. Proceed to Phase 1 (requirements already exist)\n5. All subsequent phases execute in worktree context\n\n### Worktree Context for All Phases\n\nOnce Phase 0 is complete:\n- All RLM commands run from worktree directory\n- Git operations target feature branch\n- Main branch remains untouched\n- Development is fully isolated\n\n### Phase 6\u002F7 (Global Updates)\n\nWhen updating global artifacts:\n1. Changes are made in worktree context\n2. Commits go to feature branch\n3. User merges feature branch to main when ready\n4. DECISIONS.md and STATE.md updates are part of the merge\n\n## Common Mistakes\n\n### Skipping ignore verification\n\n- **Problem:** Worktree contents get tracked, pollute git status\n- **Fix:** Always use `git check-ignore` before creating project-local worktree\n\n### Assuming directory location\n\n- **Problem:** Creates inconsistency, violates project conventions\n- **Fix:** Follow priority: existing > CLAUDE.md > ask\n\n### Proceeding with failing tests\n\n- **Problem:** Can't distinguish new bugs from pre-existing issues\n- **Fix:** Report failures, get explicit permission to proceed\n\n### Hardcoding setup commands\n\n- **Problem:** Breaks on projects using different tools\n- **Fix:** Auto-detect from project files (package.json, Cargo.toml, etc.)\n\n## Red Flags\n\n**Never:**\n- Create worktree without verifying it's ignored (project-local)\n- Skip baseline test verification\n- Proceed with failing tests without asking\n- Assume directory location when ambiguous\n- Skip CLAUDE.md check\n- Work on main\u002Fmaster without explicit consent and documentation\n\n**Always:**\n- Follow directory priority: existing > CLAUDE.md > ask\n- Verify directory is ignored for project-local\n- Auto-detect and run project setup\n- Verify clean test baseline\n- Create feature branch (rlm\u002Frun-id pattern)\n- Document worktree location in Phase 0 artifact\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| `.worktrees\u002F` exists | Use it (verify ignored) |\n| `worktrees\u002F` exists | Use it (verify ignored) |\n| Both exist | Use `.worktrees\u002F` |\n| Neither exists | Check CLAUDE.md -> Ask user |\n| Directory not ignored | Add to .gitignore + commit |\n| Tests fail during baseline | Report failures + ask |\n| On main\u002Fmaster branch | Create worktree (default) |\n| User insists on main | Document consent, proceed with caution |\n| No package.json\u002FCargo.toml | Skip dependency install |\n\n## Real-World Impact\n\nFrom development sessions:\n- **Before worktrees:** 15% of requirements had accidental main branch commits\n- **After worktrees:** 0% accidental main branch commits\n- **Parallel development:** 3+ requirements can be worked simultaneously\n- **Clean main branch:** Production history is clean and linear\n- **Easy discard:** Abandoned requirements don't pollute main branch\n\n## References\n\n- **REQUIRED:** Use this skill for ALL RLM runs\n- **TRIGGERS:** At start of \"Implement requirement 'run-id'\"\n- **OUTPUT:** `00-worktree.md` artifact + isolated worktree\n- **NEXT:** Continue with Phase 1 (requirements) in worktree context\n","# RLM Git Worktree Isolation (Phase 0)\n\n## Overview\n\nGit worktrees create isolated workspaces sharing the same repository, allowing parallel development without switching branches. This prevents:\n- Pollution of main\u002Fmaster branch during development\n- Accidental commits to production branches\n- Context switching overhead\n- Conflicts between parallel requirements\n\n**Core Principle:** Systematic directory selection + safety verification = reliable isolation.\n\n**The Iron Law for RLM Worktrees:**\n```\nNEVER WORK ON MAIN\u002FMASTER BRANCH WITHOUT EXPLICIT CONSENT\n```\n\n## Trigger examples\n\n- `Create an isolated worktree for this requirement`\n- `Set up Phase 0 worktree isolation for run '2026-02-24-add-oauth'`\n- `I'm on main; move me to a worktree`\n- `Use .worktrees\u002F and ensure it is git-ignored`\n\n## When to Use\n\n**REQUIRED for all RLM runs:**\n- New features\n- Bug fixes\n- Refactoring\n- Experiments\u002Fprototypes\n\n**Insert as Phase 0:**\n```\nPhase 0R: 00-requirements.md (user-created first)\n    ->\nPhase 0W: 00-worktree.md (isolated workspace setup; this skill)\n    ->\nPhase 1: 01-as-is.md\n```\n\n## The Worktree Rule\n\n\u003CHG>\nDo NOT proceed with any RLM phase until:\n1. Isolated worktree is created on feature branch\n2. Worktree directory is git-ignored (if project-local)\n3. Clean test baseline is verified\n4. User has explicitly consented if main branch work requested\n\u003C\u002FHG>\n\n## Directory Selection Process\n\n### Step 1: Check Existing Directories\n\n```bash\n# Check in priority order\nls -d .worktrees 2>\u002Fdev\u002Fnull     # Preferred (hidden)\nls -d worktrees 2>\u002Fdev\u002Fnull      # Alternative\n```\n\n**If found:** Use that directory. If both exist, `.worktrees` wins.\n\n### Step 2: Check CLAUDE.md\n\n```bash\ngrep -i \"worktree.*director\" CLAUDE.md 2>\u002Fdev\u002Fnull\ngrep -i \"worktrees\" CLAUDE.md 2>\u002Fdev\u002Fnull\n```\n\n**If preference specified:** Use it without asking.\n\n### Step 3: Ask User (if no convention exists)\n\n```\nNo worktree directory found. Where should I create worktrees?\n\n1. .worktrees\u002F (project-local, hidden - RECOMMENDED)\n2. ~\u002F.config\u002Frlm-workflow\u002Fworktrees\u002F\u003Cproject-name>\u002F (global location)\n\nWhich would you prefer? (1\u002F2)\n```\n\n**Default:** `.worktrees\u002F` (option 1)\n\n## Safety Verification\n\n### For Project-Local Directories (.worktrees or worktrees)\n\n**MUST verify directory is ignored before creating worktree:**\n\n```bash\n# Check if directory is ignored (respects local, global, and system gitignore)\ngit check-ignore -q .worktrees 2>\u002Fdev\u002Fnull || git check-ignore -q worktrees 2>\u002Fdev\u002Fnull\n```\n\n**If NOT ignored:**\n\nPer \"Fix broken things immediately\" rule:\n1. Add appropriate line to .gitignore:\n   ```\n   # RLM worktrees\n   .worktrees\u002F\n   ```\n2. Commit the change:\n   ```bash\n   git add .gitignore\n   git commit -m \"chore: ignore RLM worktree directory\"\n   ```\n3. Proceed with worktree creation\n\n**Why critical:** Prevents accidentally committing worktree contents to repository.\n\n### For Global Directory (~\u002F.config\u002Frlm-workflow\u002Fworktrees)\n\nNo .gitignore verification needed - outside project entirely.\n\n## Worktree Creation Process\n\n### Step 1: Detect Project Name\n\n```bash\nproject=$(basename \"$(git rev-parse --show-toplevel)\")\nbranch_name=\"rlm\u002F${run_id}\"\n```\n\n### Step 2: Check Current Branch\n\n```bash\ncurrent_branch=$(git branch --show-current)\n\nif [ \"$current_branch\" = \"main\" ] || [ \"$current_branch\" = \"master\" ]; then\n    # STOP - Require explicit consent\n    echo \"WARNING: Currently on $current_branch branch.\"\n    echo \"RLM Workflow requires isolated worktrees.\"\n    echo \"\"\n    read -p \"Create worktree and switch to feature branch? (yes\u002Fno): \" consent\n    \n    if [ \"$consent\" != \"yes\" ]; then\n        echo \"Aborted. Please run from a feature branch or consent to worktree creation.\"\n        exit 1\n    fi\nfi\n```\n\n### Step 3: Create Worktree with New Branch\n\n```bash\n# Determine full path\ncase $LOCATION in\n  .worktrees|worktrees)\n    path=\"$LOCATION\u002F$run_id\"\n    ;;\n  ~\u002F.config\u002Frlm-workflow\u002Fworktrees\u002F*)\n    path=\"~\u002F.config\u002Frlm-workflow\u002Fworktrees\u002F$project\u002F$run_id\"\n    ;;\nesac\n\n# Create worktree with new branch\ngit worktree add \"$path\" -b \"$branch_name\"\ncd \"$path\"\n```\n\n### Step 4: Run Project Setup\n\nAuto-detect and run appropriate setup:\n\n```bash\n# Node.js\nif [ -f package.json ]; then \n    echo \"Detected Node.js project\"\n    npm install\nfi\n\n# Rust\nif [ -f Cargo.toml ]; then \n    echo \"Detected Rust project\"\n    cargo build\nfi\n\n# Python\nif [ -f requirements.txt ]; then \n    echo \"Detected Python project (requirements.txt)\"\n    pip install -r requirements.txt\nelif [ -f pyproject.toml ]; then \n    echo \"Detected Python project (pyproject.toml)\"\n    poetry install || pip install -e .\nfi\n\n# Go\nif [ -f go.mod ]; then \n    echo \"Detected Go project\"\n    go mod download\nfi\n\n# Java\u002FMaven\nif [ -f pom.xml ]; then \n    echo \"Detected Maven project\"\n    mvn compile -q\nfi\n\n# Java\u002FGradle\nif [ -f build.gradle ] || [ -f build.gradle.kts ]; then \n    echo \"Detected Gradle project\"\n    .\u002Fgradlew compileJava --quiet 2>\u002Fdev\u002Fnull || gradlew compileJava --quiet 2>\u002Fdev\u002Fnull\nfi\n\n# .NET\nif [ -f *.csproj ] || [ -f *.sln ]; then \n    echo \"Detected .NET project\"\n    dotnet restore\nfi\n```\n\n### Step 5: Verify Clean Test Baseline\n\nRun tests to ensure worktree starts clean:\n\n```bash\n# Detect test command and run\nif [ -f package.json ]; then\n    # Check for npm test script\n    if grep -q '\"test\"' package.json; then\n        echo \"Running npm test...\"\n        npm test\n    fi\nelif [ -f Cargo.toml ]; then\n    echo \"Running cargo test...\"\n    cargo test\nelif [ -f requirements.txt ] || [ -f pyproject.toml ]; then\n    echo \"Running pytest...\"\n    pytest -q || python -m pytest -q\nelif [ -f go.mod ]; then\n    echo \"Running go test...\"\n    go test .\u002F...\nelif [ -f pom.xml ]; then\n    echo \"Running Maven tests...\"\n    mvn test -q\nelif [ -f build.gradle ] || [ -f build.gradle.kts ]; then\n    echo \"Running Gradle tests...\"\n    .\u002Fgradlew test --quiet 2>\u002Fdev\u002Fnull || gradlew test --quiet 2>\u002Fdev\u002Fnull\nelif [ -f *.csproj ] || [ -f *.sln ]; then\n    echo \"Running dotnet tests...\"\n    dotnet test --verbosity quiet\nfi\n```\n\n**If tests fail:**\n- Report failures\n- Ask whether to proceed or investigate\n- Document decision in Phase 0 artifact\n\n**If tests pass:**\n- Report baseline verified\n- Record test count and pass rate\n\n### Step 6: Record in Phase 0 Artifact\n\n```markdown\n## Worktree Details\n\n**Location:** `\u002Ffull\u002Fpath\u002Fto\u002F.worktrees\u002Frun-id`\n**Branch:** `rlm\u002Frun-id`\n**Created from:** `main` (commit: abc123)\n**Setup commands executed:**\n- npm install\n- npm test (47 passing, 0 failing)\n\n**Baseline verified:** ✅\n```\n\n## Main Branch Protection\n\n### Automatic Detection\n\nWhen user invokes \"Implement requirement 'run-id'\" from main\u002Fmaster:\n\n```bash\nbranch=$(git branch --show-current)\n\nif [ \"$branch\" = \"main\" ] || [ \"$branch\" = \"master\" ]; then\n    echo \"╔════════════════════════════════════════════════════════════╗\"\n    echo \"║  !   MAIN BRANCH PROTECTION                                ║\"\n    echo \"╠════════════════════════════════════════════════════════════╣\"\n    echo \"║  You are currently on the $branch branch.                  ║\"\n    echo \"║                                                            ║\"\n    echo \"║  RLM Workflow requires isolated worktrees to:             ║\"\n    echo \"║  • Prevent accidental commits to production               ║\"\n    echo \"║  • Enable parallel requirement development                ║\"\n    echo \"║  • Maintain clean main branch history                     ║\"\n    echo \"║                                                            ║\"\n    echo \"║  Options:                                                  ║\"\n    echo \"║  1. Create worktree (RECOMMENDED)                          ║\"\n    echo \"║  2. Switch to existing feature branch                      ║\"\n    echo \"║  3. Abort and run from feature branch                      ║\"\n    echo \"╚════════════════════════════════════════════════════════════╝\"\n    echo \"\"\n    \n    # Default to worktree creation\n    echo \"Creating worktree by default (press Ctrl+C to abort)...\"\n    sleep 3\nfi\n```\n\n### Explicit Consent Required\n\nIf user explicitly requests main branch work:\n\n```markdown\n## Main Branch Work Acknowledgment\n\nUser has explicitly requested to work on main branch.\n\n**Acknowledged risks:**\n- [ ] Commits go directly to production branch\n- [ ] No isolation for this requirement\n- [ ] Cannot run parallel requirements\n- [ ] Harder to discard if abandoned\n\n**Consent:** User has chosen to proceed on main branch\n**Reason:** [user-provided reason]\n**Recorded:** [timestamp]\n\n**Recommendation:** Use worktrees for future requirements.\n```\n\n## Phase 0 Artifact Template\n\n**File:** `\u002F.codex\u002Frlm\u002F\u003Crun-id>\u002F00-worktree.md`\n\n```markdown\nRun: `\u002F.codex\u002Frlm\u002F\u003Crun-id>\u002F`\nPhase: `00 Worktree Setup`\nStatus: `DRAFT` | `LOCKED`\nInputs:\n- Current git repository state\n- User preference (for worktree location)\nOutputs:\n- `\u002F.codex\u002Frlm\u002F\u003Crun-id>\u002F00-worktree.md`\n- Isolated worktree at `[location]`\nScope note: This document records isolated workspace setup and verifies clean test baseline.\n\n## Directory Selection\n\n**Convention checked:**\n- [ ] `.worktrees\u002F` exists\n- [ ] `worktrees\u002F` exists\n- [ ] CLAUDE.md preference found\n- [ ] User preference obtained\n\n**Selected location:** `.worktrees\u002F` (project-local, hidden)\n\n## Safety Verification\n\n**Gitignore check:**\n```bash\n$ git check-ignore -q .worktrees && echo \"IGNORED\" || echo \"NOT IGNORED\"\nIGNORED\n```\n\n**Result:** ✅ Directory is properly ignored\n\n## Worktree Creation\n\n**Command:**\n```bash\ngit worktree add .worktrees\u002Frun-id -b rlm\u002Frun-id\n```\n\n**Output:**\n```\nPreparing worktree (new branch 'rlm\u002Frun-id')\nHEAD is now at abc1234 Previous commit message\n```\n\n**Branch created:** `rlm\u002Frun-id`\n**Location:** `\u002Ffull\u002Fpath\u002Fto\u002Fproject\u002F.worktrees\u002Frun-id`\n\n## Project Setup\n\n**Detected project type:** Node.js (package.json found)\n\n**Commands executed:**\n```bash\ncd .worktrees\u002Frun-id\nnpm install\n```\n\n**Output:**\n```\nadded 472 packages in 8s\n```\n\n## Test Baseline Verification\n\n**Command:**\n```bash\nnpm test\n```\n\n**Results:**\n- Total: 47 tests\n- Passed: 47\n- Failed: 0\n- Skipped: 0\n\n**Baseline:** ✅ Clean (all tests passing)\n\n## Main Branch Protection\n\n**Original branch:** `main`\n**Worktree branch:** `rlm\u002Frun-id`\n**Isolation:** ✅ Working in isolated worktree\n\n## Traceability\n\n- RLM process -> Isolated workspace established | Evidence: worktree at `.worktrees\u002Frun-id`\n\n## Coverage Gate\n\n- [ ] Worktree location selected following priority rules\n- [ ] Directory verified as git-ignored (if project-local)\n- [ ] Worktree created successfully on feature branch\n- [ ] Project setup completed without errors\n- [ ] Clean test baseline verified (all tests passing)\n- [ ] Main branch protection confirmed (working in isolation)\n\nCoverage: PASS \u002F FAIL\n\n## Approval Gate\n\n- [ ] Isolated workspace ready for development\n- [ ] No pending setup issues\n- [ ] Ready to proceed to Phase 1\u002F2\n\nApproval: PASS \u002F FAIL\n\nLockedAt: `YYYY-MM-DDTHH:MM:SSZ`\nLockHash: `\u003Csha256-hex>`\n```\n\n## Integration with RLM\n\n### Phase 0 -> Phase 1 Transition\n\nPhase 0 must be locked before proceeding:\n\n1. Verify worktree exists and is properly configured\n2. Check Phase 0 gates are PASS\n3. Lock Phase 0 artifact\n4. Proceed to Phase 1 (requirements already exist)\n5. All subsequent phases execute in worktree context\n\n### Worktree Context for All Phases\n\nOnce Phase 0 is complete:\n- All RLM commands run from worktree directory\n- Git operations target feature branch\n- Main branch remains untouched\n- Development is fully isolated\n\n### Phase 6\u002F7 (Global Updates)\n\nWhen updating global artifacts:\n1. Changes are made in worktree context\n2. Commits go to feature branch\n3. User merges feature branch to main when ready\n4. DECISIONS.md and STATE.md updates are part of the merge\n\n## Common Mistakes\n\n### Skipping ignore verification\n\n- **Problem:** Worktree contents get tracked, pollute git status\n- **Fix:** Always use `git check-ignore` before creating project-local worktree\n\n### Assuming directory location\n\n- **Problem:** Creates inconsistency, violates project conventions\n- **Fix:** Follow priority: existing > CLAUDE.md > ask\n\n### Proceeding with failing tests\n\n- **Problem:** Can't distinguish new bugs from pre-existing issues\n- **Fix:** Report failures, get explicit permission to proceed\n\n### Hardcoding setup commands\n\n- **Problem:** Breaks on projects using different tools\n- **Fix:** Auto-detect from project files (package.json, Cargo.toml, etc.)\n\n## Red Flags\n\n**Never:**\n- Create worktree without verifying it's ignored (project-local)\n- Skip baseline test verification\n- Proceed with failing tests without asking\n- Assume directory location when ambiguous\n- Skip CLAUDE.md check\n- Work on main\u002Fmaster without explicit consent and documentation\n\n**Always:**\n- Follow directory priority: existing > CLAUDE.md > ask\n- Verify directory is ignored for project-local\n- Auto-detect and run project setup\n- Verify clean test baseline\n- Create feature branch (rlm\u002Frun-id pattern)\n- Document worktree location in Phase 0 artifact\n\n## Quick Reference\n\n| Situation | Action |\n|-----------|--------|\n| `.worktrees\u002F` exists | Use it (verify ignored) |\n| `worktrees\u002F` exists | Use it (verify ignored) |\n| Both exist | Use `.worktrees\u002F` |\n| Neither exists | Check CLAUDE.md -> Ask user |\n| Directory not ignored | Add to .gitignore + commit |\n| Tests fail during baseline | Report failures + ask |\n| On main\u002Fmaster branch | Create worktree (default) |\n| User insists on main | Document consent, proceed with caution |\n| No package.json\u002FCargo.toml | Skip dependency install |\n\n## Real-World Impact\n\nFrom development sessions:\n- **Before worktrees:** 15% of requirements had accidental main branch commits\n- **After worktrees:** 0% accidental main branch commits\n- **Parallel development:** 3+ requirements can be worked simultaneously\n- **Clean main branch:** Production history is clean and linear\n- **Easy discard:** Abandoned requirements don't pollute main branch\n\n## References\n\n- **REQUIRED:** Use this skill for ALL RLM runs\n- **TRIGGERS:** At start of \"Implement requirement 'run-id'\"\n- **OUTPUT:** `00-worktree.md` artifact + isolated worktree\n- **NEXT:** Continue with Phase 1 (requirements) in worktree context\n",{"name":5,"description":7},"be1d5a0a3cc6cb822d2451790132cda53e497525",".agents-global\u002Fskills\u002Frlm-workflow\u002Fskills\u002Frlm-worktree",3,"https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles","https:\u002F\u002Fgithub.com\u002Fspideynolove","https:\u002F\u002Fspideynolove.github.io","Data Engineer","2026-05-28 09:03:32",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add spideynolove\u002Fclaude-dotfiles --skill rlm-worktree",{"tool":58,"command":59},"bunx","bunx skills add spideynolove\u002Fclaude-dotfiles --skill rlm-worktree",{"tool":61,"command":62},"pnpm","pnpm dlx skills add spideynolove\u002Fclaude-dotfiles --skill rlm-worktree","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.agents-global\u002Fskills\u002Frlm-workflow\u002Fskills\u002Frlm-worktree\u002FSKILL.md",true,[],[67,85,100,118,126,140],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":39},"01M6DQ1GDQVE5XE06RAQ408JGJ","xia","Borrow and adapt patterns from GitHub projects into the current codebase using a structured 6-phase protocol. Invoke with \u002Fxia \u003Cgithub-repo> [focus].","https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.opencode-global\u002Fskills\u002Fxia\u002FSKILL.md",[],[69,74,75,76,77,78,79,80,81,82,83,84],"github","code","protocol","projects","repo","github projects","patterns","claude-code","focus","adapt","structured",{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":39},"01M6DQ1EDYQW512EN2RFFBF4NX","x2md","Convert an X (Twitter) post URL to markdown. Use when user wants to read, summarize, archive, or analyze a tweet or X post.","https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.opencode-global\u002Fskills\u002Fx2md\u002FSKILL.md",[],[87,81,92,75,93,94,95,96,97,98,99,22],"summarize","markdown","archive","convert","analyze","twitter","read","user",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":39},"01M6DQ1BNAMJ6QGCBA17NJHZX4","sequential-thinking","Structure cognitive analysis using sequential reasoning chains. Use for codebase analysis, pattern extraction, complex problem decomposition, and building mental models before implementation.","https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.opencode-global\u002Fskills\u002Fsequential-thinking\u002FSKILL.md",[],[107,108,109,110,111,81,75,112,113,114,22,115,116,117],"sequential thinking","thinking","pattern","decomposition","problem","reasoning","extraction","analysis","implementation","models","structure",{"skillNo":119,"name":120,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":39},"01M6DQ17SBGVC6PQPZZTSZ49YV","rlm-workflow","https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.opencode-global\u002Fskills\u002Frlm-workflow\u002FSKILL.md",[],[124,21,125],"rlm workflow","workflow",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":39},"01M6DQ14RM3H655QWFXREBGC7W","repomix","Pack local or remote repos into a single context blob for whole-repository understanding. Use before tasks spanning multiple directories, architecture reviews, or onboarding to an unfamiliar codebase.","https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.opencode-global\u002Fskills\u002Frepomix\u002FSKILL.md",[],[128,133,134,135,136,75,137,138,139,22,81],"local","architecture","repos","tasks","onboarding","repository","context",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":39},"01M6DQ12RFVYCT1YF836D5GQBA","reddit2md","Convert a Reddit post URL to markdown. Use when user wants to read, summarize, archive, or analyze a Reddit post.","https:\u002F\u002Fgithub.com\u002Fspideynolove\u002Fclaude-dotfiles\u002Fblob\u002Fmain\u002F.opencode-global\u002Fskills\u002Freddit2md\u002FSKILL.md",[],[142,93,75,147,81,22,99,148,98,96,95,92,94],"reddit post","reddit"]