rejoin

A command for leaving a Git worktree and preserving its branch in the main repository after rebasing it onto develop. A worktree is a separate folder that checks out another branch.

In plain words
What is it for?
Use it with an issue ID or branch name to remove the worktree, update develop, rebase the branch, and keep the branch locally.
Why use it?
It lets you continue work in the main repository without reinstalling dependencies or rebuilding editor caches in the separate folder.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/circui-try/circuit/rejoin
Clone the repo
git clone --depth 1 https://github.com/CIrcui-try/Circuit

Made for: Claude Code.

Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,105 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.01105
Opus 5 $0.00023 $0.00553
Sonnet 5 $0.00009 $0.00221
Haiku 4.5 $0.00005 $0.00111

Measured yesterday against content hash c65216f662cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rejoin scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/rejoin.md · 44 lines

How it starts

The opening of the file, as written. The whole thing — 44 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PR 머지 여부와 무관하게, 워크트리에서 빠져나와 진행 중인 브랜치를 메인 레포에 develop 위로 리베이스된 로컬 브랜치로 보존한다. 워크트리는 별도 디렉토리라 의존성 설치·빌드 캐시·IDE 인덱싱을 다시 해야 하므로, 메인 레포(이미 갖춰진 환경)로 항로를 다시 잡고 그쪽에서 작업을 이어가거나 다른 브랜치로 컨텍스트 스위칭하기 위함이다.

$ARGUMENTS 형식: <ISSUE-ID 또는 branch>. 예: /rejoin CIR-15, /rejoin feature/cir-15-fix-....

자기 단계 실행 절차

  1. 인자 확인: $ARGUMENTS 비어있으면 사용법 안내 후 중단.
  2. 메인 레포로 이동: MAIN_REPO_ROOT = $(git rev-parse --path-format=absolute --git-common-dir | xargs dirname)cd $MAIN_REPO_ROOT.
  3. 브랜치명 결정:
    • 인자가 CIR-/PROJ- 같은 이슈 키 패턴이면 Linear MCP get_issuegitBranchName 을 조회.
    • 인자에 / 가 포함되어 있으면 그대로 브랜치명으로 사용.
    • 둘 다 실패하면 사용자에게 직접 입력받는다.
  4. 방어: <branch>develop / main 이면 거부하고 중단.
  5. 워크트리 탐색: git worktree list --porcelain 으로 <branch> 가 체크아웃된 워크트리 경로 확인.
    • 워크트리가 없고 로컬 브랜치만 존재 → 사용자에게 "워크트리가 없는데 develop 위로 리베이스만 진행할까요?" 확인 후 진행.
    • 워크트리도 로컬 브랜치도 없으면 중단.
  6. 워크트리 미커밋 변경 체크: 해당 워크트리 안에서 git status --porcelain 결과가 비어있지 않으면 "미커밋 변경이 있습니다 — 커밋/스태시 후 다시 실행해주세요" 안내 후 중단. 자동 stash 금지.
  7. develop 최신화 (메인 레포): git fetch origin developgit checkout developgit pull --ff-only origin develop.
    • fast-forward 실패 시 사용자 위임 후 중단.
  8. 워크트리 제거: git worktree remove .claude/worktrees/<branch>.
    • 잠김/실패 시 사용자 확인 후 --force.
  9. 브랜치 리베이스 (메인 레포):
    • git checkout <branch>.
    • git rebase origin/develop.
    • 충돌 발생 시: 자동 해결 시도하지 말고 "리베이스 충돌 상태 — 해결 후 git rebase --continue 또는 git rebase --abort" 안내 후 중단. 메인 레포의 HEAD 는 리베이스 진행 중 상태로 둔다.
  10. 티켓 상태 동기화: 이슈 키를 확인할 수 있고 이슈가 Done/Canceled 가 아니면 Linear 상태를 In Progress 로 직접 유지한다. rejoin 은 작업 보존 단계이므로 Done 으로 바꾸지 않는다.
  11. 상태 파일 정리(있으면): 인자가 이슈 키였고 .claude/state/<ISSUE>.* 잔재가 있으면 함께 삭제. (보통 takeoff 후 호출되므로 잔재 없음.)
  12. 요약 출력: <branch> 가 develop 보다 N 커밋 앞섬 (git rev-list --count origin/develop..<branch>), HEAD 해시, 삭제된 워크트리 경로, "원격에는 영향 없음 (push 미수행)" 한두 문장으로 안내.

주의사항

  • 원격 push / force-push / gh pr 호출 금지. 본 커맨드는 로컬 전용.
  • 자동 stash 금지. 미커밋 변경은 사용자에게 처리 위임.
  • 리베이스 충돌은 사용자 위임. 자동 해결 시도 금지.
  • develop / main 을 대상 브랜치로 받지 않는다.
  • Linear 티켓 상태는 자동화에 위임하지 않고 직접 TodoIn ProgressDone 으로만 처리한다.
  • PR 머지 후 사후 정리는 /rejoin 이 아닌 /landing 으로 진행.

Read the full file on GitHub · 44 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 44 lines · 45 tokens per session scan A c65216f662cb

Subscribe to this mod's changes

rejoin is a command published in the GitHub repository CIrcui-try/Circuit (5 stars, last pushed 3mo ago), licensed MIT. It adds 45 tokens to every session and 1,105 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.