Feature Request: Dynamic Context Management for Multi-Project Workflows

Resolved 💬 3 comments Opened Jul 29, 2025 by dylan-conlin Closed Aug 15, 2025

Executive Summary

Enable Claude Code to dynamically swap project contexts based on active work, rather than accumulating all contexts from added directories. This would allow users to start sessions from any location while maintaining appropriate project-specific context.

Problem Statement

Current behavior creates friction for users working across multiple projects:

  1. Starting Location Dependency: Users must remember to start Claude Code from the "correct" directory
  2. Context Accumulation: Adding directories accumulates all contexts, creating:
  • Pattern conflicts between projects
  • Cognitive overhead from multiple active contexts
  • Unclear precedence rules
  1. Flow State Interruption: Users must think about directory management during creative work

Example Scenario

A user working on three projects with different CLAUDE.md requirements:

  • Project A: "Never give generic advice, always search first"
  • Project B: "Speak in full technical terminology"
  • Project C: "Optimize for business stakeholders"

Currently, all three contexts remain active simultaneously when using /add-dir, creating confusion about which rules apply.

Proposed Solution

Implement dynamic context swapping where:

Active Context = Global CLAUDE.md + Current Project CLAUDE.md

Behavior

  1. Auto-detection: Claude Code detects active project from:
  • Current working directory
  • Recently accessed files
  • Explicit user indication
  1. Clean Swapping: When switching projects:
  • Previous project context unloads
  • New project context loads
  • Global context persists
  1. User Control: New commands:
  • /context - Show active context
  • /context switch <project> - Explicitly switch context
  • /context add <dir> - Temporarily add additional context

Benefits

  1. Reduced Cognitive Load: One project context active at a time
  2. Natural Flow: Context follows user attention
  3. Clear Mental Model: Like switching between applications
  4. Preserved Project Identity: Each project maintains distinct requirements

Use Case

As a developer working on multiple projects with different CLAUDE.md configurations, I frequently find myself:

  • Starting Claude Code from the wrong directory
  • Having to restart sessions to get the right context
  • Dealing with conflicting instructions from multiple active contexts
  • Losing flow state while managing directory contexts

This feature would allow me to:

  • Start Claude Code from anywhere
  • Have it intelligently load the right context
  • Switch projects seamlessly within a session
  • Maintain focus on the work, not the tool

Backward Compatibility

  • Maintain /add-dir for users who want cumulative behavior
  • Add setting: context.mode: "dynamic" | "cumulative"
  • Default to current behavior with opt-in to dynamic

Related Issues

  • #1628 (changing working directory) - This goes beyond just directory access to context management
  • #3146 (configure additional directories) - This proposes dynamic rather than static configuration
  • #1376 (multiple project confusion) - This directly addresses the root cause

Implementation Ideas

The simplest approach might be:

  1. Track which CLAUDE.md files are currently loaded
  2. When working directory changes, swap project-specific CLAUDE.md
  3. Keep global CLAUDE.md always active
  4. Provide visual indicator of active context

Thank you for considering this feature request. Happy to provide more details or clarify any aspects.

View original on GitHub ↗

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