[FEATURE] Git-like context management from within a session
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I would like to use LLM contexts like a "graph", a bit like a git history.
This means that after a few conversation turns, I like to re-use that existing context for other tasks or explore "sub-branches" of a given conversation state.
This would help mitigate issues that keep biting like context poisoning, context explosion, continuously growing CLAUDE.md files and lots of initial conversation message duplication.
Currently the claude CLI supports a "linear" graph - this means that I can't go back to previous conversation turns and edit what I've said, re-use the context window I've built up for other tasks easily or remove things which I think are "poisoning" the conversation context.
Proposed Solution
Add in-session git-like history navigation and management:
/log - show git-like list of commits and maybe a history graph./checkout <vertex hash> - navigate to a particular vertex in the graph./branch <name> - create a new branch under the current vertex in the graph./branch delete <name> - delete a vertex in the graph.
Each <user, assistant> message pair in the conversation would create a new vertex in the graph (effectively a git commit), which could then be branched off.
Alternative Solutions
- Manual management of
.claudedirectories via the cli - clunky and error-prone. - Manually reconstruct the conversation history to the point I want to "branch" from - time consuming and inconsistent.
Priority
High - Significant impact on productivity
Feature Category
Interactive mode (TUI)
Use Case Example
- I have a conversation with
claudeabout modifying a code repo - we load a bunch of relevant stuff into the context and discuss some ideas.claudethen makes a very context-hungry MCP call and eats up a lot of the context window - I want to "undo" this.
- Similar scenario to 1., except I want to explore multiple approaches to a problem without each exploration polluting the next.
Additional Context
Being able to do this through the claude cli would be a game changer for my workflow!
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗