Agent Memory and Recovery (SQLite MVP)¶
This documents a simple local SQLite strategy to help agents avoid repeated failures and recover from broken design states.
Goal¶
Capture enough execution history to answer:
- What failed?
- Where did it fail (tool + stage)?
- What is the likely root cause?
- What should we do next?
- Should we roll back before retrying?
Local Storage¶
Database path:
.solidworks_mcp/agent_memory.sqlite3
Core tables:
agent_runstool_eventserror_catalog
Error-Centric Recovery Loop¶
- Query
error_catalogfor similar failures bytool_name+error_type. - Present the top remediation options to the user.
- Prefer rollback/recovery actions before blind retries.
- Re-run with constrained parameters and capture outcome.
Example Troubleshooting Prompt¶
"Based on recent create_extrusion failures in the local SQLite catalog, suggest rollback-first recovery using existing MCP tools and avoid repeating known bad states."
Rollback-First Tooling Pattern¶
When a step fails:
- Capture snapshot metadata.
- Inspect recent feature-tree changes.
- Roll back/suppress latest risky feature.
- Re-run prerequisite validation tools.
- Retry only after preconditions pass.
Why This Helps¶
- Fewer repeated failures
- Faster root-cause diagnosis
- Better agent recommendations over time
- Better handoff between human and agent sessions