BMAD-METHOD/bmad-core
James (Claude Code) 6e97ddcbd1 feat: Implement Gemini's universal environment-adaptive solution with .bmad_env state file
Collaborative solution with Gemini to resolve bash approval prompts by shifting from
shell conditionals to agent guidance with persistent state management.

## Key Changes Based on Gemini's Analysis

### 1. Universal State Persistence (.bmad_env file)
- Updated lightweight-ide-detection.md to write IDE environment vars to .bmad_env
- Updated auto-language-init.md to append language environment vars to .bmad_env
- Each Bash tool call can now 'source .bmad_env' to load persistent state
- Supports all IDEs: Claude Code CLI, Cursor AI, Windsurf, Cline, Roo, Trae, Gemini, GitHub Copilot, CLI

### 2. Agent Guidance vs Shell Conditionals
- Restructured reality-audit-comprehensive.md Phase 2 from shell conditionals to agent instructions
- Replaced shell logic with clear procedural guidance for agents
- Task files now provide instructions FOR agents rather than literal bash scripts to execute

### 3. Universal Dev Agent Adaptive Tool Selection
- Added adaptive_tool_selection section to dev.md agent configuration
- Core directive: environment-adaptive tool selection based on detected IDE and language
- Universal compatibility: detects and optimizes for any supported IDE environment
- Language agnostic: supports C#, TypeScript, JavaScript, Java, Rust, Go, Python, Ruby, PHP

### 4. Environment Context Loading Pattern
- All environment-dependent operations start with 'source .bmad_env'
- Agent instructions specify when to use native vs CLI tools based on loaded environment
- Eliminates stateless environment variable issues across separate Bash tool calls
- Universal approach works across all IDE environments automatically

## Expected Results
- No more bash approval prompts in Claude Code CLI environments
- Native tool optimization in Cursor AI, Windsurf, and other supported IDEs
- Agents load environment state and make conscious tool selection decisions
- Graceful fallback to CLI batch mode when appropriate
- Universal language and IDE compatibility

## Collaboration Credit
This solution resulted from collaborative analysis with Gemini AI, identifying that
agents were interpreting shell conditionals as literal commands rather than guidance.

Key insight: shift from 'execute this shell logic' to 'read the state and decide what to do'.
2025-07-24 08:49:20 -04:00
..
agent-teams fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00
agents feat: Implement Gemini's universal environment-adaptive solution with .bmad_env state file 2025-07-24 08:49:20 -04:00
checklists fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00
data fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00
tasks feat: Implement Gemini's universal environment-adaptive solution with .bmad_env state file 2025-07-24 08:49:20 -04:00
templates fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00
workflows fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00
core-config.yaml fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00
user-guide.md fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00
working-in-the-brownfield.md fix: Add all missing files from quality-framework-enhancements branch 2025-07-23 20:59:37 -04:00