[FEATURE REQUEST] Context Reset/Compact Command/Rules in the YOLO mode

Resolved 💬 4 comments Opened Jun 11, 2025 by GregorGk Closed Jan 5, 2026

Feature Request: Context Reset/Compact Command/Rules in the YOLO mode

Problem Statement

When using Claude Code with --dangerously-skip-permissions for iterative development, accumulated context from processing large datasets becomes a bottleneck. There's currently no way to programmatically clear context between iterations, which is critical for tasks requiring repeated evaluation and automatic script refinement.

Use Case

I'm developing a flashcard language learning application with:

  • A grammar evaluation script
  • A word/sentence categorization script

My workflow requires Claude Code to:

  1. Process batches of sentences (7, 70, and 700) in a prompt to LLM (no other tools/scripts) to evaluate script accuracy (e.g. in different applications is the grammar correct, what can be the gender of the speaker, what category should that sentence be in)
  2. Automatically modify and correct the scripts based on evaluation results
  3. Reset context before each iteration to ensure clean decision-making

Currently, accumulated context from hundreds of processed sentences interferes with Claude's ability to make clear corrections to the scripts in subsequent iterations.

Proposed Solution

Add a /reset or /compact slash command that:

  • Can be invoked by Claude based on rules specified by the user
  • Clears conversation context while preserving script files and project state
  • Can be invoked programmatically in automated workflows
  • Maintains awareness of the overall task goal while discarding processed data

Example Workflow

# Set up automated context management rule
claude "When processing batches of sentences, automatically reset context after each evaluation cycle"

# Initial small batch test
claude "Evaluate these 7 sentences categorized by category_check.py. Identify errors, fix the script, and retest."
# Claude: 1) evaluates sentences, 2) identifies categorization errors, 3) modifies category_check.py, 4) retests
# Claude automatically invokes /compact after completing the cycle

# Medium batch iteration
claude "Now test with 70 sentences, fix any new issues found"
# Claude: 1) processes 70 sentences, 2) finds edge cases, 3) updates category_check.py, 4) validates fixes
# Claude automatically invokes /compact

# Large batch validation
claude "Validate with 700 sentences and apply final refinements"
# Claude: 1) runs comprehensive test, 2) makes final adjustments, 3) confirms accuracy
# Claude automatically invokes /compact

# Grammar script testing (separate workflow)
claude "Switch to grammar_check.py - test with 70 sentences and refine rules"
# Clean context for new script evaluation

Alternative Implementation

A --reset-context flag for non-interactive mode with a rule provided by the user:

claude "Process batch and update script" --reset-context

Benefits

  • Enables true iterative development with automatic script improvement
  • Prevents context pollution affecting script corrections
  • Allows Claude to maintain focus on rule refinement rather than individual sentences
  • Supports automated testing pipelines where Claude progressively improves code quality

This feature would transform Claude Code from a coding assistant into a true iterative development partner capable of autonomously refining scripts through multiple test cycles.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗