Smart Mode
Smart Mode is a new intelligent security review feature introduced in iFlow CLI v0.4.6, providing intelligent security protection through a three-layer progressive review architecture while ensuring development efficiency.
Overview
Smart Mode is based on a three-layer security review architecture that provides intelligent risk assessment and automated decision-making for each tool call:
- Whitelist Check - Quickly approve verified safe tools
- Blacklist Check - Rule-based detection of high-risk operations
- AI Review - Context-aware risk analysis using AI models
How It Works
Three-Layer Review Architecture
Smart Mode uses a progressive review process where each layer has specific responsibilities:
User Request → Whitelist Check → Blacklist Check → AI Review → Execution Decision
↓ ↓ ↓ ↓
Safe Direct Pass Risk Detection Smart Analysis User Confirmation/Auto Execute
Layer 1: Whitelist Check
- Purpose: Quickly identify and approve verified safe tools
- Mechanism: Maintains a predefined list of safe tools
- Result: Tools on the whitelist execute directly without further review
- Advantage: Zero latency, improves execution efficiency for common safe operations
Layer 2: Blacklist Check
- Purpose: Detect obvious high-risk operations based on predefined rules
- Mechanism: Uses regular expressions and pattern matching to detect dangerous commands
- Coverage:
- Shell commands (e.g., system deletion, network attacks)
- File operations (e.g., accessing sensitive directories, modifying system files)
- Network requests (e.g., accessing malicious domains, internal network scanning)
- Result: Operations triggering blacklist rules are marked as high-risk and require user confirmation
Layer 3: AI Review
- Purpose: Intelligent analysis of complex scenarios with context awareness
- Mechanism: Uses AI models to analyze tool call intent and potential risks
- Analysis Dimensions:
- Operation content and parameters
- Current session context
- Historical operation records
- Working directory environment
- Decision Output: SAFE (safe), RISKY (requires confirmation)
Enabling Smart Mode
Enable via Command Line
iflow --approval-mode smart
Enable via Configuration File
Set in .iflow/settings.json:
{
"approvalMode": "smart"
}
Runtime Switching
Use keyboard shortcuts in iFlow CLI session:
shift + tab- Switch to Smart Mode