Claude Code parallel sessions: isolation और handoff
worktree, focused tests और सुरक्षित handoff से दो स्वतंत्र Claude Code tasks चलाने का व्यावहारिक pattern।
विषय-सूची
Claude Code parallel sessions: isolation और handoff
Parallel work केवल अलग tasks में उपयोगी है। दो changes को वही file चाहिए तो एक owner तय करें और काम क्रम में करें। अलग API workflow के लिए BetterToken Claude Code guide अपनी API Key का setup बताती है; BetterToken Claude.ai subscription या shared account नहीं है।
task और file map करें
| Task | Allowed scope | Done when |
|---|---|---|
खाली amount | parser/, tests/import/ | validation error लौटे |
--dry-run | cmd/, tests/cli/ | plan दिखे, data न लिखा जाए |
साझा file parallel launch रोकने का signal है।
worktree से isolation
git status --short
git worktree add ../project-fix-empty-amount -b fix/empty-amount
git worktree add ../project-cli-dry-run -b feat/cli-dry-run
अनजान changes न छिपाएँ, न हटाएँ। worktree files और branches, session context अलग करता है; conflict अपने-आप हल नहीं होता।
prompt की सीमा दें
Allowed directories, निषेध और test स्पष्ट लिखें। साझा parser/schema.ts चाहिए तो चुपचाप edit न करें: blocker लिखकर रुकें।
handoff contract लिखें
Task: empty amount returns validation error
Worktree / branch: ../project-fix-empty-amount / fix/empty-amount
Changed: parser/amount.ts, tests/import/empty-amount.test.ts
Verified: npm test -- tests/import/empty-amount.test.ts
Not verified: full integration suite
Next: review diff before merge
Chat transcript नहीं, state और reproducible command दें।
verify और rollback
git status --short
git diff --check
npm test -- tests/import/empty-amount.test.ts
Receiving session worktree में जाकर वही command चलाती है। वह दोहर न सके तो change unverified है: rollback करें या owner को लौटाएँ।
Git, permissions और secrets
Overlap में owner दोनों diffs पढ़ता है, व्यवहार एक branch में मिलाता है और दोनों tests चलाता है। Scope से बाहर broad permission न दें। API Key, cookie, .env, personal data या full sensitive logs handoff/commit में न रखें।
CTA और sources
वर्तमान guide से केवल अपनी Key configure करें और secrets सामान्य secret mechanism से दें।