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'.