One-key handoff for deep Claude Code sessions. Pass your work to a fresh window with an independent audit — no manual summary pasting, no copy-pasted "here's what I was doing".
Claude Code sessions degrade past ~400K tokens. You've seen it:
- Fabricates file paths that never existed
- Skips TODOs it explicitly acknowledged earlier
- Contradicts its own setup decisions from 200 turns ago
The natural fix is opening a new window. But the manual workflow is painful:
- Ask old Claude: "summarize what we were doing, write an opening message for a new window"
- Copy-paste into new window
- Ask new Claude: "does this match what's actually in the codebase?"
- Ask old Claude to verify, loop
Steps 3-4 exist because old Claude writing its own handoff produces self-congratulatory summaries — it remembers claiming to push the image, forgets whether it actually did.
claude-next automates the loop, and adds an independent fresh-context auditor that checks every claim against the real filesystem before handoff.
old window new window
────────── ──────────
/next → handoff + audit stored
│
▼
first message: "continue A"
│
drift-check + inject ◄───┘
│
▼
Claude picks up exactly where you left off
- Old window:
/next— produces a structured handoff, spawns a fresh-context subagent to audit every claim against the filesystem, gives you a short pass-phrase (continue A). - New window: paste the pass-phrase as the first message. A
UserPromptSubmithook intercepts, re-verifies the handoff is still current (git HEAD / cwd / age), and injects it as context. The new Claude starts fully oriented.
You never write a summary yourself. You never ask "does this match reality" — the audit already did.
npx claude-next installgit clone https://github.com/llmapi-pro/claude-next ~/.claude/skills/next
bash ~/.claude/skills/next/install.shThe installer is idempotent:
- Backs up your existing
~/.claude/settings.jsonto.bak-<timestamp> - Adds only the
UserPromptSubmithook, preserving every other field - Self-tests three hook scenarios before declaring success
rm -rf ~/.claude/skills/next ~/.claude/next
cp ~/.claude/settings.json.bak-<latest> ~/.claude/settings.jsonIn the old (long) session:
/next
Claude will:
- Identify the current task from the last ~20 turns of your conversation
- Announce the identification — you have 3 seconds to correct it
- Allocate a slot (
A,B, ...,Z, thenAA...) - Fill a structured handoff (context, progress, changed state, next step, mandatory ≥3 uncertainties)
- Spawn a fresh-context subagent to audit every claim
- Print a pass-phrase
Example output:
━━━━━━━━━━━━━━━━━━━━
📋 Pass-phrase: continue A
Task: Deploy identity-guard v2b to staging
project: /root/myproject
audit: warnings (2 ⚠️ wording nits, 0 ❌)
file: ~/.claude/next/pending/A.md
━━━━━━━━━━━━━━━━━━━━
Open a fresh Claude Code window. First message:
continue A
Or with extra direction:
continue A run the smoke test first
The hook will:
- Match the pass-phrase (
continue/next/继续all work) - Run a drift check — has
git HEADmoved? Is the cwd insideproject_root? Is the handoff >24h old? - Inject the full handoff (with both audit passes) as additional context
- Delete the source handoff file (consumed)
Claude opens by summarizing the task, listing the next step and uncertainties, and waits for your go-ahead.
/next list # Show all pending handoffs
/next remove A # Delete a specific one
Or from a new window, as the first message:
drop A # Same as /next remove A
claude-next is not a memory system. It's a handoff protocol with a quality gate. The difference matters.
| Memory-bank tools (claude-mem, memory-bank-mcp, ...) |
claude-next |
|
|---|---|---|
| Captures everything passively | ✅ | ❌ (explicit /next only) |
| Auto-injects on new session | ✅ | ❌ (pass-phrase required) |
| Independent audit before handoff | ❌ | ✅ fresh-context subagent |
| Drift check before ingest | ❌ | ✅ git/cwd/age verified |
| Forces uncertainty declaration | ❌ | ✅ ≥3 real items, rejected otherwise |
| Zero ambient impact on unrelated windows | ✅ no SessionStart hook |
If you want general-purpose memory capture, use claude-mem. If you want deliberate handoff with built-in skepticism about what the source session claims, use claude-next. The two can coexist — claude-next touches only UserPromptSubmit and only fires when you explicitly paste a pass-phrase.
The auditor runs in a subagent with fresh context — it has not seen the conversation that produced the handoff. It only has:
- The handoff file
- Read-only access to the project directory
- A strict rubric (see
templates/audit.rubric.md)
For every claim — "I pushed image X", "commit abc123 contains the fix", "file src/y.ts modified" — the auditor runs the corresponding real check (docker image inspect, git cat-file -e, ls). Results are appended to the handoff as ## Audit — Pass A (write-time) with verdicts:
passed— all claims verified, ≥3 uncertaintieswarnings— 1-2⚠️ minor discrepancies, worth notingfailed— ❌ verified fiction, or <3 uncertainties (you get to rewrite)
Because the auditor is fresh, it catches exactly the class of error that long-context self-summarization produces: the claim "I deployed it" when the deploy actually failed and was forgotten 50 turns ago.
- Claude Code on macOS, Linux, or Windows (Git-bash)
- Requires:
bash,perl(core modules only —JSON::PP,Time::Local— both ship with Perl 5.14+) - Optional:
gitanddockerfor richer drift/audit checks - Does not require: Python,
jq, Node (except for thenpxinstaller), or any external LLM API
Match is at the start of your first message in a new window:
| Action | English | Chinese |
|---|---|---|
| Load handoff | continue A or next A |
继续 A |
| Delete handoff | drop A |
移除 A |
Slot is case-insensitive in the pass-phrase but stored uppercase. You can add any text after the slot (continue A run tests first) — Claude sees both.
Defaults are sensible, override via env vars if needed:
| Variable | Default | Purpose |
|---|---|---|
NEXT_HOME |
~/.claude/next |
Runtime state directory |
NEXT_PENDING_DIR |
$NEXT_HOME/pending |
Where handoffs live |
NEXT_MIN_UNK |
3 |
Minimum uncertainty items |
- Optional consumed-handoff archive (
NEXT_ARCHIVE=1) - MCP server wrapper (for Cursor, Cline, other MCP-compatible clients)
- Auto-trigger at configurable token thresholds
- PowerShell fallback for pure-Windows environments (no Git-bash)
- Per-project handoff directories (isolate monorepo sub-projects)
- Handoff signing for team use (cryptographically attest audit verdict)
Vote / propose in Issues.
Small project, welcoming contributions. Start here:
- Read
SKILL.md— source of truth for what/nextdoes - Read
templates/audit.rubric.md— most improvements live here - Clone,
bash install.sh, dogfood a day, open a PR
Please keep PRs focused — one behavioral change per PR, with a one-line rationale.
MIT — see LICENSE. Use freely, modify freely, no warranty.
Claude Code 深度对话超过约 400K token 后明显退化——捏造、偷懒、记忆丢失。自然的解决办法是开新窗口,但手动工作流有摩擦:
- 让老窗口总结 + 写开场白
- 粘贴到新窗口
- 反过来问老窗口"和代码真实状态一致吗"
- 循环
步骤 3-4 存在的原因是老窗口写自己的交接稿会自圆其说——它记得说过"我 push 了镜像",但忘了实际有没有 push。
claude-next 把整个流程自动化,并用独立 fresh-context auditor 对每一条 claim 做核对。
- Fresh-context subagent 审稿:写完 handoff 立刻由独立子代理(零对话历史)核对每条 claim vs 真实文件系统
- Drift 检查:新窗口 ingest 前再验一次 git HEAD / cwd / age
- 强制不确定声明:每份 handoff 至少 3 条真实 uncertainty,凑不够拒绝生成
npx claude-next install然后:
- 老窗口:
/next→ 拿到口令继续 A - 新窗口首条消息:
继续 A→ 续接完成
claude-next 不是记忆系统,是有质量门的交接协议。它和 claude-mem 可以共存——前者只在你主动粘口令时才动作,零被动副作用。
如果你只想被动记忆捕获 + 自动注入,用 claude-mem。如果你想要带审稿的明确交接,用 claude-next。
| 操作 | 英文 | 中文 |
|---|---|---|
| 载入 | continue A / next A |
继续 A |
| 删除 | drop A |
移除 A |
From the same maintainer:
- llmapi-pro/claude-code-setup — One-line installer for Claude Code with a Claude-compatible relay backend.
- llmapi-pro/claude-md-templates — Drop-in
CLAUDE.mdtemplates for popular stacks (Next.js, FastAPI, Express+TS, Go). - llmapi-pro/awesome-claude-code-china — Curated Claude Code resources for Chinese developers (tutorials, mirror services, tools).
For the backend that powers the default install, see llmapi.pro.
Built by humans working alongside Claude. Inspired by the pain of every deep session that hit 400K and fell over.
Report issues, ideas, war stories: https://github.com/llmapi-pro/claude-next/issues