learn_from_attempts
Store lessons from task attempts to automatically recall solutions in future sessions, improving efficiency by documenting what worked and what failed.
Instructions
Store a lesson learned from a failed or successful attempt. Call this AFTER completing any non-trivial task (deploy, debug, fix, architecture decision). The lesson will be recalled automatically in future sessions via recall_best_solution. Fields: topic (short slug like "deploy:web"), outcome ("success"|"failure"), what_worked (what solved it), what_failed (what did NOT work), context (extra details). Supports structured metadata: severity, file_paths (files involved), commands (working commands), tags. Deduplication: if a lesson for this topic already exists, it is updated instead of duplicated. Example: learn_from_attempts(topic="deploy:api", outcome="success", what_worked="nohup docker compose up -d --build", what_failed="docker compose up hangs on SSH timeout", severity="critical", commands=["nohup docker compose up -d --build"])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_id | Yes | UUID of the cache instance | |
| topic | Yes | Short slug, e.g. "deploy:web", "debug:redis-tls", "fix:generate-series" | |
| outcome | Yes | Did it work? | |
| what_worked | Yes | What solved the problem or what approach succeeded | |
| what_failed | No | What did NOT work (optional but valuable) | |
| context | No | Additional context, error messages, root cause (optional) | |
| severity | No | Impact severity: critical (blocks work/deploy), major (significant slowdown), minor (nice to know). Default: major. | |
| file_paths | No | Files involved in this lesson (e.g. ["infra/deploy.sh", ".env"]) | |
| commands | No | Commands that worked or failed (e.g. ["rsync -avz ...", "docker compose up -d"]) | |
| tags | No | Topic tags for filtering (e.g. ["bash", "deploy", "env"]) |