w3m fix
AI-powered build error fixing. Automatically detects Solidity compilation errors and sends them to an AI model that generates targeted fixes.
w3m fixDoes not require authentication (requires AI provider configuration).
You can also run this from the interactive workspace: run w3m, then select Auto-fix.
Options
| Option | Default | Description |
|---|---|---|
--auto | Skip confirmation prompts — apply fixes directly | |
--retries <n> | 3 | Maximum number of fix attempts (max 10) |
Requirements
- Must be run from a project directory with a
contracts/directory - Requires Foundry (
forge) for building contracts - Requires an AI provider (prompted on first use)
How It Works
Build Detection
Runs forge build to capture compilation errors. If the build already passes, exits immediately with no changes.
AI Analysis
Sends the compilation errors along with your contract source files to the configured AI provider. The AI generates minimal, targeted fixes — no refactoring or improvements beyond what’s needed to resolve the errors.
Diff Preview
Shows a diff of the proposed changes. In interactive mode, asks for confirmation before applying. With --auto, applies immediately.
Apply & Verify
Applies the fixes and re-runs forge build to verify. If errors remain, the AI retries with the updated error output (up to --retries attempts), adjusting its approach based on what changed.
Fix Loop
The fix process is iterative. On each attempt:
- AI reads the current errors and all contract source files
- Generates fixes and shows a diff
- After applying, re-builds to check
- If new errors appear, the AI sees both the previous and current errors to avoid repeating failed approaches
After exhausting all retries, you get suggestions for next steps.
Examples
# Run with defaults (interactive, 3 attempts)
w3m fix
# Fully automatic — no prompts, up to 5 attempts
w3m fix --auto --retries 5
# Quick single attempt
w3m fix --retries 1Requires Foundry for contract compilation. Install with:
curl -L https://foundry.paradigm.xyz | bash
foundryup