SKILL-006: Error-State Recovery
Overview
Agents often fail due to transient or trivial errors (e.g., missing Python module, locked file, timeout). This skill provides a Invoke-Recoverable wrapper that catches these errors, attempts to apply known fixes, and retries the operation.
Trigger Phrases
run with recovery
auto-fix <command>
try hard <command>
Inputs
| Parameter |
Type |
Required |
Default |
Description |
--command |
string |
Yes |
- |
The command to execute |
--retries |
int |
No |
3 |
Max retry attempts |
--heuristics |
switch |
No |
True |
Enable heuristic auto-fixes (pip, npm, mkdir) |
Outputs
- Success: Standard output of the command.
- Failure:
ERROR_STATE.json containing the stack trace, context, and failed fix attempts.
Supported Heuristics
- Python
ModuleNotFoundError: Auto-runs pip install <module>.
- DirectoryNotFound: Auto-runs
mkdir -p.
- File Locked: Waits 2s and retries.
- CLI Missing: Checks standard paths for tool (e.g.,
forge, dotnet).
Preconditions
- PowerShell 7+
Implementation
See invoke_recovery.ps1.
Integration
.\skills\06_error_recovery\invoke_recovery.ps1 -Command "python hunt.py" -Retries 3