Claude Code की 5-घंटे सीमा: graceful stop जाँचें, checkpoint बचाएँ और आगे बढ़ें
Claude Code की पाँच-घंटे सीमा के लिए व्यावहारिक recovery workflow: repository जाँचें, recoverable Git state बचाएँ और wait, usage credits या अलग API में सही विकल्प चुनें।
विषय-सूची

अगर coding task के बीच Claude Code पाँच-घंटे की subscription limit पर रुक जाए, तो उसकी आखिरी reply को task पूरा होने का प्रमाण न मानें। नया graceful stop एक best-effort buffer है: Claude Code weekly usage से एक छोटा fixed allowance लेकर किसी सुरक्षित stopping point तक पहुँचने की कोशिश कर सकता है, लेकिन clean working tree, commit, passing tests या पूरी feature की guarantee नहीं देता।
यह क्रम अपनाएँ:
- Limit का सही प्रकार और reset time पढ़ें।
- Staged, unstaged और untracked changes जाँचें।
- सबसे छोटी उपयोगी validation चलाएँ।
- Recoverable Git checkpoint बनाएँ।
- उसके बाद तय करें कि wait करना है, usage credits चालू करने हैं या API route लेना है।
इस क्रम से अनिश्चित interruption एक नियंत्रित handoff बन जाती है। Repository की वास्तविक स्थिति जाने बिना extra usage पर खर्च करने से भी बचते हैं।
Graceful stop एक buffer है, completed task नहीं
Claude Developers की घोषणा के अनुसार, पाँच-घंटे की limit task के बीच आने पर Claude Code किसी graceful stopping point तक पहुँचने की कोशिश करेगा और wrap-up के लिए weekly usage से छोटा fixed allowance पाएगा। मुख्य शब्द हैं कोशिश करेगा और जितना संभव हो।
एक user report में पुराने mid-edit cutoff की तुलना में अधिक व्यवस्थित stop बताया गया। यह उपयोगी firsthand example है, लेकिन एक account का अनुभव है—सभी repositories के लिए reliability guarantee नहीं।
इन तीन mechanisms को अलग रखें:
| Mechanism | क्या सुरक्षित करता है | क्या guarantee नहीं करता |
|---|---|---|
| Limit पर graceful stop | Agent को अधिक coherent जगह पर रुकने के लिए थोड़ा समय देता है | Completion, commit, clean tree, passing tests |
| Claude Code checkpoint | /rewind से session की कई direct file edits restore हो सकती हैं | Bash changes, अधिकतर subagent edits, external edits, पूरा repo history |
| Git checkpoint | Review, branch, share और restore करने योग्य state रिकॉर्ड करता है | Review और test के बिना correctness |
Graceful stop बेहतर summary या कम अधूरा code छोड़ सकता है। वास्तविक acceptance फिर भी Git inspection से शुरू होती है।
पहले पता करें कि कौन-सी limit ने रोका है
हर interruption पाँच घंटे बाद खत्म नहीं होती। Anthropic की usage-limit documentation usage limits को context-length limits से अलग बताती है; एक account की अलग Claude surfaces usage साझा कर सकती हैं।
Message को ठीक उसी अर्थ में पढ़ें:
- Approaching 5-hour limit: scope बढ़ाना रोकें और checkpoint की तैयारी करें।
- 5-hour limit reached — resets …: उसी displayed reset time को मानें।
- Weekly या model-specific limit, पाँच-घंटे window reset होने के बाद भी रह सकती है।
- Capacity या service error अलग समस्या है; extra usage outage ठीक नहीं करता।
अगर current interactive client session खुली रखकर reset तक wait और फिर auto-continue का विकल्प दे, तो वह आसान path हो सकता है। अपनी installed version और mode का prompt देखें: session से निकलने पर wait खत्म हो सकती है, और background, print या API-key modes अलग व्यवहार कर सकते हैं।
Claude से और edits कराने से पहले repository जाँचें
Repository root से ये read-only commands चलाएँ:
git status --short --branch
git diff --stat
git diff
git diff --cached
git ls-files --others --exclude-standard
Claude Code का /diff भी मदद करता है, लेकिन working tree की source of truth Git ही है।
आगे बढ़ने से पहले पाँच प्रश्नों का उत्तर दें:
- कौन-सी files बदलीं?
- कौन-से changes staged, unstaged या untracked हैं?
- क्या कोई आधा edit है—जैसे नया call site लेकिन type, test या migration update नहीं?
- क्या lockfile, generated file, config या migration अनजाने में बदली?
- कौन-सा सबसे छोटा command मुख्य breakage दिखा सकता है?
Project की वास्तविक validation चलाएँ:
# उदाहरण: अपने repository का सबसे छोटा relevant command चुनें
npm test -- path/to/affected.test.ts
pytest tests/test_affected.py -q
cargo test affected_module
git diff --check
Safe stop का अर्थ “Claude ने अच्छा summary लिखा” नहीं है। इसका अर्थ है कि आप changed files, बचा हुआ काम, test result और अगला छोटा कदम स्पष्ट बता सकते हैं।
अगर diff समझ नहीं आ रहा, तो “बाकी सब पूरा कर दो” न कहें। पहले checkpoint बनाएँ।
Recoverable checkpoint के लिए दो में से एक तरीका चुनें
तरीका 1: reviewed local WIP commit
जब current state पर्याप्त coherent हो और local branch में temporary commit स्वीकार्य हो, यह सबसे सरल तरीका है।
git status --short --branch
git add -p
# Reviewed new files अलग से add करें; git add -p सभी untracked files नहीं जोड़ता।
git add -- path/to/reviewed-new-file
git diff --cached --check
git diff --cached
# यहाँ सबसे छोटा relevant test या lint चलाएँ।
git commit -m "WIP: checkpoint before Claude Code limit reset"
git rev-parse --short HEAD
git add -A बिना review के न चलाएँ। .env, credentials, private fixtures, generated artifacts, बड़े binaries और debug dumps देखें। Local WIP commit recovery point है, protected branch पर push की मंजूरी नहीं।
एक छोटा handoff भी लिखें:
Goal: token-expiry validation पूरा करना
Checkpoint: a1b2c3d
Changed: auth_service.py, tests/test_auth.py
Validation: targeted test fail; expected 401, received 200
Next step: callers बदलने से पहले expiry comparison जाँचें
तरीका 2: repository के बाहर patches और reviewed untracked files
Commit नहीं बनाना चाहते तो यह external checkpoint तरीका इस्तेमाल करें। Script पहले CLAUDE_CHECKPOINT_DIR का resolved real path जाँचती है; अगर वह repository के भीतर है—symlink के जरिए भी—तो कोई checkpoint file बनाने से पहले रुक जाती है।
इसे तीन चरणों में चलाएँ: पहले staged, unstaged और untracked candidates तथा diffs को read-only रूप में देखें; फिर हर group में exact path numbers चुनें, और जो नहीं चुना गया वह साफ तौर पर exclude होगा; अंत में SAVE REVIEWED लिखने पर ही files बनेंगी। चुनने से पहले पूरा diff या untracked file जाँचें और keys, private data या ऐसी किसी चीज़ को बाहर रखें जिसे सहेजना नहीं चाहिए। अगर किसी file के केवल कुछ changes ही safe हैं, तो changes split करें या ऊपर वाला WIP commit तरीका इस्तेमाल करें; पूरी file न चुनें।
बाहरी तरीका tracked rename मिलने पर रुकता है; उसकी जगह reviewed WIP commit उपयोग करें। चुने हुए unstaged path में staged बदलाव भी हों, तो दोनों versions की समीक्षा करके साथ सहेजें। Restore से पहले checkpoint में save step का दिया absolute directory रखें। गलत base, dirty checkout या किसी भी चरण की विफलता पर restoration रुक जाता है।
repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root"
# Step 1: inspect everything. These commands do not save files.
git status --short --branch
git diff --cached
git diff
git ls-files --others --exclude-standard
# Steps 2-3: choose reviewed paths explicitly, then save only that scope.
python3 /dev/fd/3 3<<'PY'
from datetime import datetime, timezone
from pathlib import Path
import json, os, shlex, subprocess, tarfile
def git(*args):
return subprocess.run(["git", *args], check=True, stdout=subprocess.PIPE).stdout
def path_list(*args):
return list(dict.fromkeys(Path(os.fsdecode(x)) for x in git(*args).split(b"\0") if x))
def choose(label, items):
print(f"\n{label} candidates:")
if not items:
print(" (none)")
return []
for i, path in enumerate(items, 1):
print(f" {i:>3} {shlex.quote(os.fspath(path))}")
answer = input(
"Select reviewed numbers to save "
"(1,3-5; 'all'; blank saves none): "
).strip().lower()
if not answer:
return []
if answer == "all":
return items[:]
chosen = set()
try:
for token in answer.split(","):
bounds = [int(x) for x in token.strip().split("-", 1)]
chosen.update(range(min(bounds), max(bounds) + 1))
except ValueError as exc:
raise SystemExit("Invalid selection; nothing was saved.") from exc
if not chosen or min(chosen) < 1 or max(chosen) > len(items):
raise SystemExit("Selection is outside the displayed range; nothing was saved.")
return [path for i, path in enumerate(items, 1) if i in chosen]
def patch(cached, items):
if not items:
return b""
args = ["diff"] + (["--cached"] if cached else [])
return git(*args, "--binary", "--", *(os.fspath(path) for path in items))
repo = Path(git("rev-parse", "--show-toplevel").decode().rstrip("\n")).resolve()
root = Path(os.environ.get(
"CLAUDE_CHECKPOINT_DIR", os.fspath(Path.home() / "claude-checkpoints")
)).expanduser().resolve(strict=False)
if root == repo or repo in root.parents:
raise SystemExit("CLAUDE_CHECKPOINT_DIR must resolve outside the repository.")
root.mkdir(parents=True, exist_ok=True)
root = root.resolve()
if root == repo or repo in root.parents:
raise SystemExit("CLAUDE_CHECKPOINT_DIR must resolve outside the repository.")
# A path-only selection cannot represent both sides of a detected rename.
if (git("diff", "--cached", "--find-renames", "--diff-filter=R", "--name-only", "-z")
or git("diff", "--find-renames", "--diff-filter=R", "--name-only", "-z")):
raise SystemExit("Renames require a reviewed WIP commit; nothing was saved.")
candidates = {
"staged": path_list("diff", "--cached", "--name-only", "-z"),
"unstaged": path_list("diff", "--name-only", "-z"),
"untracked": path_list("ls-files", "--others", "--exclude-standard", "-z"),
}
if not any(candidates.values()):
raise SystemExit("No staged, unstaged, or untracked changes were found.")
selected = {name: choose(name, items) for name, items in candidates.items()}
if not any(selected.values()):
raise SystemExit("No reviewed changes were selected; nothing was saved.")
missing_baseline = set(selected["unstaged"]) & (
set(candidates["staged"]) - set(selected["staged"])
)
if missing_baseline:
raise SystemExit(
"Selected unstaged paths also have staged changes. Select both reviewed "
"versions or use a WIP commit; nothing was saved."
)
not_saved = {
name: [path for path in candidates[name] if path not in selected[name]]
for name in candidates
}
print("\nSelected for saving:")
for name, items in selected.items():
print(f" {name}: " + (", ".join(shlex.quote(os.fspath(p)) for p in items) or "(none)"))
print("Excluded and NOT saved:")
for name, items in not_saved.items():
print(f" {name}: " + (", ".join(shlex.quote(os.fspath(p)) for p in items) or "(none)"))
if input("Type SAVE REVIEWED to save exactly this scope: ").strip() != "SAVE REVIEWED":
raise SystemExit("Confirmation did not match; nothing was saved.")
current = {
"staged": path_list("diff", "--cached", "--name-only", "-z"),
"unstaged": path_list("diff", "--name-only", "-z"),
"untracked": path_list("ls-files", "--others", "--exclude-standard", "-z"),
}
if current != candidates:
raise SystemExit("The candidate list changed during review; rerun from step 1.")
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
checkpoint = (root / f"{repo.name}-claude-{stamp}").resolve(strict=False)
if checkpoint == repo or repo in checkpoint.parents:
raise SystemExit("Checkpoint path unexpectedly resolves inside the repository.")
checkpoint.mkdir(exist_ok=False)
(checkpoint / "base-commit.txt").write_bytes(git("rev-parse", "HEAD"))
(checkpoint / "status.txt").write_bytes(git("status", "--short", "--branch"))
(checkpoint / "staged.patch").write_bytes(patch(True, selected["staged"]))
(checkpoint / "unstaged.patch").write_bytes(patch(False, selected["unstaged"]))
(checkpoint / "untracked.list0").write_bytes(b"".join(
os.fsencode(os.fspath(path)) + b"\0" for path in selected["untracked"]
))
manifest = {
"selected": {name: [os.fspath(p) for p in items] for name, items in selected.items()},
"not_saved": {name: [os.fspath(p) for p in items] for name, items in not_saved.items()},
}
(checkpoint / "selection.json").write_text(
json.dumps(manifest, ensure_ascii=True, indent=2) + "\n", encoding="utf-8"
)
omitted = [
f"{name}\t{json.dumps(os.fspath(path), ensure_ascii=True)}"
for name, items in not_saved.items() for path in items
]
(checkpoint / "not-saved.txt").write_text(
"\n".join(omitted) + ("\n" if omitted else "(none)\n"), encoding="utf-8"
)
if selected["untracked"]:
with tarfile.open(checkpoint / "untracked.tar.gz", "w:gz", dereference=False) as archive:
for path in selected["untracked"]:
archive.add(repo / path, arcname=path.as_posix(), recursive=False)
partial = bool(omitted)
(checkpoint / "scope.txt").write_text(
"PARTIAL: see not-saved.txt; this is not a complete recovery point.\n"
if partial else
"REVIEWED SCOPE: every listed candidate was saved; ignored files remain outside scope.\n",
encoding="utf-8",
)
print(("PARTIAL checkpoint" if partial else "Reviewed checkpoint") + f" saved to {checkpoint}")
if partial:
print("Some listed changes were not saved; read not-saved.txt before recovery.")
PY
selection.json selected और excluded paths रिकॉर्ड करता है, not-saved.txt हर छोड़ी गई item दिखाता है, और scope.txt scope बताता है। किसी भी staged, unstaged या untracked candidate को exclude करने पर terminal और scope.txt result को PARTIAL कहते हैं; तब यह complete recovery point नहीं है और केवल selected scope restore होगा। Ignored files scope से बाहर रहते हैं, और checkpoint code के सही होने का प्रमाण नहीं है।
Restore करने से पहले scope.txt और not-saved.txt पढ़ें। Recorded base commit के clean checkout में केवल saved scope restore करें:
(
set -eu
checkpoint="/absolute/path/printed-by-the-save-step" # Replace with the actual checkpoint directory.
test -d "$checkpoint"
repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root"
for required in base-commit.txt scope.txt not-saved.txt staged.patch unstaged.patch untracked.list0; do
test -f "$checkpoint/$required"
done
cat "$checkpoint/scope.txt" "$checkpoint/not-saved.txt"
test "$(git rev-parse HEAD)" = "$(cat "$checkpoint/base-commit.txt")"
test -z "$(git status --porcelain --untracked-files=all)"
if [ -s "$checkpoint/staged.patch" ]; then
git apply --index "$checkpoint/staged.patch"
fi
if [ -s "$checkpoint/unstaged.patch" ]; then
git apply "$checkpoint/unstaged.patch"
fi
if [ -s "$checkpoint/untracked.list0" ]; then
tar -xzkf "$checkpoint/untracked.tar.gz"
fi
git status --short
)
अगर current repository उस base commit पर नहीं है, patches force न करें। Saved commit पर clean branch या worktree बनाएँ, वहाँ restore करें और फिर सोच-समझकर merge करें।
Claude Code checkpoints उपयोगी हैं, लेकिन Git का विकल्प नहीं
Official checkpointing documentation के अनुसार Claude Code session की direct file edits track करता है और /rewind से उन्हें review या restore किया जा सकता है। Documentation session के सबसे recent 100 checkpoints और conversation के साथ उनके बने रहने का वर्णन करती है, इसलिए resume के बाद भी वे उपलब्ध हो सकते हैं।
यह खराब agent turn undo करने के लिए उपयोगी है, लेकिन repository backup नहीं। Documented limitations में Bash से बदली files, अधिकतर subagent edits, concurrent external changes और कुछ symlink/hardlink cases शामिल हैं। Git durable commit ID, branches, reviewable patches और Claude session से स्वतंत्र recovery देता है।
दोनों layers उपयोग करें:
/rewindसे session-level rollback;- Git commit या external patch bundle से durable repository checkpoint।
CLI reference में ये commands हैं:
claude -c
claude -r "<session>"
Resume के बाद edits की अनुमति देने से पहले git status फिर चलाएँ। Conversation वापस मिलना यह सिद्ध नहीं करता कि filesystem पुराने summary के समान है।
Checkpoint के बाद wait, usage credits या API चुनें
| स्थिति | पहला विकल्प | कारण |
|---|---|---|
| Reset पास है, checkpoint सुरक्षित है, deadline pause स्वीकारती है | Wait | Extra metered charge या auth change नहीं |
| वही interface और conversation चाहिए, metered spend स्वीकार है | Usage credits | Eligible accounts included usage के बाद जारी रख सकते हैं |
| अलग key, provider balance या project budget चाहिए | API | Billing और authentication subscription से अलग रहते हैं |
| कई सामान्य workdays में limits बार-बार रोकती हैं | Plan और workflow review | एक interruption permanent upgrade का पर्याप्त कारण नहीं |
Pause, route बदलने से सस्ती हो तो wait करें
Reset पास हो और checkpoint तैयार हो, तो wait अक्सर safest है। Exact time और handoff लिखें। Session केवल तभी खुली रखें जब client स्पष्ट रूप से wait-and-resume offer करे।
वापस आने पर:
git status --short --branch
git diff --stat
फिर अगला कदम स्पष्ट लिखें। केवल “continue” agent को state का अनुमान लगाने पर मजबूर करता है।
Context continuity सबसे जरूरी हो तो usage credits लें
Anthropic की usage credits documentation बताती है कि eligible Pro और Max users Settings > Usage में extra pay-as-you-go usage enable कर सकते हैं, funds जोड़ सकते हैं और spend controls सेट कर सकते हैं। Charge subscription से अलग है; सामान्य पाँच-घंटे windows फिर भी reset होती हैं।
Enable करने से पहले:
- Monthly cap और alerts सेट करें;
- Auto-reload स्वीकार है या नहीं तय करें;
- Interface में usage credits से continuation की पुष्टि करें;
- Urgent checkpoint या acceptance test पूरा होते ही रुकें।
यह interface और context बचाता है, पर subscription का free overflow नहीं है।
अलग authentication या budget चाहिए तो API लें
API अलग billing और auth route है। यह subscription allowance inherit नहीं करता, और केवल एक environment variable बदलने से saved login override हो, यह जरूरी नहीं। Claude Code में /status देखें, active provider या gateway confirm करें, फिर provider usage log में request खोजें।
BetterToken Anthropic-compatible pay-as-you-go API route है, Claude subscription का extension नहीं। Separate key और balance चाहिए तो यह एक विकल्प है, लेकिन checkpoint और handoff हर provider के साथ जरूरी हैं।
Same model की API list prices तुलना करें, task cost घोषित न करें
नीचे standard text-token prices 2026-10-01 को verify किए गए। सभी मूल्य USD per one million tokens हैं। Anthropic data उसकी official API pricing से और BetterToken data उसकी pricing page से है।
| Exact model ID | Anthropic input | Anthropic output | BetterToken input | BetterToken output |
|---|---|---|---|---|
claude-opus-5-5 | $4.00 | $20.00 | $2.72 | $13.60 |
claude-sonnet-5 | $2.00 | $10.00 | $1.36 | $6.80 |
claude-haiku-4-5-20251001 | $1.00 | $5.00 | $0.68 | $3.40 |
यह table केवल उसी model ID की standard input/output token price दिखाती है। तीन billing pools सीधे बराबर नहीं हैं:
- Subscription usage plan की included allowance है;
- Usage credits eligible Claude interfaces में metered continuation है;
- API usage अलग provider account में tokens और applicable features के अनुसार bill होती है।
Actual task cost input/output tokens, cache reads/writes, long context या fast mode, retries, tool calls और account rules पर निर्भर है। कम list price यह साबित नहीं करती कि आपका पूरा repository task सस्ता होगा।
Resume करते समय केवल “continue” नहीं, state handoff दें
अगली session को छोटा, verifiable handoff दें:
Goal: task पूरा होने पर क्या सत्य होना चाहिए
Base: branch और commit/checkpoint ID
Changes: staged, unstaged और untracked
Validation: exact commands और results
Known failure: exact error या failing assertion
Do not touch: sensitive या unrelated files
Next action: एक छोटा, testable step
Claude Code से पहले current diff inspect कराएँ और intended next step दोहराने को कहें। इससे stale summary, बदली branch या incomplete graceful stop नए edits से पहले पकड़ में आता है।
अक्सर पूछे जाने वाले प्रश्न
क्या graceful stop अपने-आप commit करता है?
नहीं। Official statement सुरक्षित जगह पर रुकने की कोशिश का वादा करता है, Git commit का नहीं।
क्या task पूरा होने की guarantee है?
नहीं। Agent कुछ pending work के साथ या केवल आंशिक changes के बाद रुक सकता है। Tests और acceptance criteria ही निर्णय लेते हैं।
क्या wrap-up पर extra charge लगता है?
घोषणा वाला छोटा fixed allowance weekly usage से आता है। Usage credits और API अलग metered routes हैं; account में दिख रहा billing mode देखें।
क्या /rewind Git को replace कर सकता है?
नहीं। यह direct session edits में मदद करता है, लेकिन documented exclusions सभी repository changes cover नहीं करते।
Message में weekly limit हो तो?
पाँच-घंटे reset उसे हटाए, यह जरूरी नहीं। Checkpoint बचाएँ, client में दिखे limit type और reset time का पालन करें, फिर अतिरिक्त usage खरीदने से पहले blocking counter confirm करें।