learn_from_attempts
Log what worked and what failed from any attempt. Automatically recall the best solution in future sessions to prevent re-research.
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 with full audit trail. Contradiction detection: warns if new outcome conflicts with existing lesson outcome. Confidence: lesson starts at 1.0, decays after 5d (→0.7) and 10d (→0.5) without recall. 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"]) | |
| depends_on | No | Prerequisites this lesson depends on (e.g. ["node:>=20", "docker:running", "wireguard:active"]). When a dependency is marked stale, all dependent lessons get needs_review. | |
| author | No | Name or handle of the person storing this lesson (e.g. "alice", "bob"). Used for Team Telepathy — teammates see each other's lessons in session_start. |