branching-workflow
Skill2 starsChanged 24 days agoMITView on GitHub
When and how to use the coding-agent CLI's `/rewind` to abandon a bad branch and restart from a prior turn. Documents the recovery primitive for the layered eval architecture's Layer 3 (universal recovery toolkit) and the branch-and-retry path. Use when an output is going off the rails, when a Critic verdict says BLOCK, or when a path-of-least-resistance failure has corrupted the conversation context. Pairs with /save (extract insight first), /scope (re-frame after rewind), and the Critic skill (verdict-driven branch trigger).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- LinuxSuRen/my-dsh-skillstheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- LinuxSuRen/my-dsh-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository57 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- advisorSkill
- agent-dispatchSkill
- arenaSkill
- audit-pypi-model-packageSkill
- code-reviewSkill
- criticSkill
- cron-child-oauth-auditSkill
- daily-forestSkill
- deep-researchSkill
- diagnose-cron-timeoutSkill
- dreamingSkill
- eod-summarySkill
- filingSkill
- forest-synthesisSkill
- goalsSkill
- graph-hygieneSkill
- ideaSkill
- inline-tagsSkill
- intel-analyzerSkill
- longformSkill
- loop-experimentSkill
- loop-librarySkill
- meta-memory-reviewSkill
- office-hoursSkill
- open-loopsSkill
- plan-ceo-reviewSkill
- plan-design-reviewSkill
- prdSkill
- progressive-disclosureSkill
- reality-feedback-createSkill
- reality-review-weeklySkill
- recallSkill
- reconcile-extractionSkill
- redactSkill
- repo-auditSkill
- research-digestSkill
- review-gateSkill
- run-long-job-detachedSkill
- saveSkill
- scopeSkill
- self-auditSkill
- shadow-test-local-classifierSkill
- signal-scorerSkill
- skill-auditSkill
- skill-chainingSkill
- spawn-agent-in-tenantSkill
- spawn-tenantSkill
- split-log-rows-by-session-kindSkill
- subagent-delegationSkill
- telegram-dump-routerSkill
- telegram-reply-toolSkill
- verify-stackSkill
- wave-planSkill
- weekly-retroSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
The bad path started recently enough: If the divergence is 1-3 turns back, rewind.
- Distinctive: line 21
Do NOT branch when:
- Very specific: line 51
When the Critic returns verdict: BLOCK, two paths: queue-for-review or branch-and-retry.
- Distinctive: line 64
After branching, the new branch starts with:
- Distinctive: line 72
Verify against /save'd memory writes before locking the output.
- Distinctive: line 73
If the new branch fails too: /save lessons, branch again.
- Distinctive: line 80
Always /save before branching: if learnings exist. Insights from bad branches are valuable for classifier training and the corrections …
- Distinctive: line 81
Don't branch trivially: If <2 high-friction turns of bad path, revise-in-place is cheaper.
- Distinctive: line 83
Three-strike escalation: If branched 3 times in the same session on the same problem, the issue is structural (mis-calibrated classifier, …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Branching workflow
/rewind (Claude Code v2.0.0+): fork from a prior assistant turn, take a different forward path. The abandoned branch's tokens leave context entirely. The cleanest zoom-out primitive available natively in the CLI.
This skill: WHEN to branch, WHAT to preserve first, HOW to recover. Pairs with the Critic skill (a BLOCK verdict often triggers a branch).
When to branch
Branch (use /rewind) when ALL three apply:
- The current path is going off the rails. Output is wrong, the agent is confidently asserting unverified claims, the classifier flagged high-stakes but the Critic says BLOCK, or a path-of-least-resistance failure (closure-bias / search-truncation / sycophancy) has visibly compromised the conversation.
- Continuing-with-corrections would be more polluting than rewinding. "Let me reconsider" + retry-emit will leave the bad branch in context as residue. Rewinding leaves it cleaner.
- The bad path started recently enough. If the divergence is 1-3 turns back, rewind. If it's 10+ turns back, /save the insights + /compact + start fresh with prepended context.
Do NOT branch when:
- The output is acceptable but imperfect (continue-with-revision is cheaper).
- You're in the middle of a long-running task with persistent state (database writes, sent messages, scheduled tasks fired). Branch does NOT undo external side effects.
- You're under 50 turns into the session (the cost of pollution is low; rewind overhead doesn't pay back yet).
What to preserve before branching
Branch is destructive of the abandoned branch's context. The new-branch agent has no memory of why the old branch was abandoned unless you tell it. Before invoking /rewind:
- Run /save if there are durable learnings. Insights from the bad path that should propagate forward must be persisted to disk first (memory/Decisions.md / Learnings.md / Feedback/). Otherwise they vanish with the branch.
- Note the divergence point. Identify which assistant turn started the bad path. The rewind targets THIS turn.
- Note WHY the path went bad. This will be re-injected into the new branch's context as the corrective prompt. Format: "rewinding because [specific failure mode], take this corrected approach: [what should happen instead]."
- Mark any side-effects that already fired. Tools called, files written, messages sent in the bad branch. These persist past the rewind. Note them so the new branch doesn't redo them or assume they didn't happen.
How to branch (operator workflow)
- Press
esc esc(the rewind keypress) to enter the rewind selector. - Select the assistant turn before divergence.
- The CLI discards subsequent turns from active context.
- Re-prompt with corrective context: "we were about to [bad path], instead [corrective intent]."
- Continue forward from the new branch.
Chat-only fallback (no esc esc from a phone). When the operator is on a chat channel and the agent flags branch-needed:
- The agent runs /save to persist learnings to
memory/Decisions.mdormemory/Learnings.md. - The agent replies with: "branch recommended. reason: [X]. corrective intent: [Y]. options: (a) /restart fresh, (b) reply 'continue with correction' to revise-in-place, (c) ignore."
- The operator picks. /restart fresh = clean slate. continue-with-correction = stay in current context, the agent applies the corrective prompt as the next turn.
- Programmatic /rewind from the agent side: not supported.
Critic-driven branch trigger
When the Critic returns verdict: BLOCK, two paths: queue-for-review or branch-and-retry.
Branch when:
- Errors are structural (sourcing gaps, stale facts, contaminated framing). Re-emitting from the same context replicates them.
- The Critic surfaces a category the agent didn't see. Re-emitting WITH the Critic verdict in context tends to produce cosmetic-only changes.
- Pollution cost is high (many turns to undo).
Queue-for-review when:
- The operator can supply the fix directly ("missing a source citation, add it").
- The bad path is short. revise-in-place is cheaper.
Recovery patterns (post-rewind)
After branching, the new branch starts with:
- The old branch's tokens removed from active context
- The corrective prompt as the first turn
- Any /save'd insights available via memory/ recall on next reference
- Any external side effects from the old branch persisted (NOT undone)
Recovery sequence:
- The new branch generates with corrective context.
- Verify against /save'd memory writes before locking the output.
- If the new branch fails too: /save lessons, branch again. Max 3 retries before escalating to an operator-final-gate.
- Track the branch count. >2 in one session = the classifier or Critic is mis-calibrated. Flag for review.
Hard rules
- Branch does NOT undo external side effects. Sent messages, DB writes, tool calls fired in the bad branch persist. Note them before branching.
- Branch is operator-only. The agent cannot invoke
/rewinditself (operator-empowered class). The agent recommends-but-doesn't-execute. - Always /save before branching if learnings exist. Insights from bad branches are valuable for classifier training and the corrections registry. Don't discard them.
- Don't branch trivially. If <2 high-friction turns of bad path, revise-in-place is cheaper. Branch is reserved for >3-turn drift or structural corruption.
- Document the branch in the corrective prompt. The reason for branching becomes part of the new branch's context. Helps the reality-feedback loop track branch outcomes for classifier training.
- Three-strike escalation. If branched 3 times in the same session on the same problem, the issue is structural (mis-calibrated classifier, weak Critic prompt, ambiguous source data). Stop branching, flag for refinement.
Out of scope
- Programmatic rewind (agent-triggered): not supported by the CLI as of v2.0.0. Operator-only.
- Cross-session branching: rewind operates within the current session. Cross-session "what would have happened if I had said X 2 days ago" is not supported. Use /save + replay from disk if needed.
- External side-effect compensation: branching does not undo sent messages / DB writes / etc. Substrate reversibility for external side effects is a confirmed literature gap. No general-purpose fix ships anywhere yet.
Source
Anchors: LangGraph time-travel docs, the CLI's /rewind (v2.0.0). This is the Layer 3 recovery primitive of the layered eval architecture.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

