# Step 7 — Implementation Detail 1. `app/states/lessons.py`: `collect_lesson_candidates` builds one record when an Execution ends, from what the Execution already holds. Candidate types: - `revision`: each reopen, with its reason and who asked. - `revision_limit`: a reopen refused at the cap. - `change_request`: the user's feedback on a Phase, with the Deliverables in it. - `finding`: each entry of every submitted `findings.json`, with the attempt it came from. - `refusal`: each tool reply that did nothing (`REJECTION_PREFIXES`, now in `app/adk/runtime.py`), with role, tool and Deliverable. - `unfinished`: a Specialist that stopped or spent its budget. 2. Refusals are captured in the nodes, not the runtime: `_noting_refusals` wraps each tool, so any runtime, the fake included, produces them. Specialist refusals travel in the outcome record; the Orchestrator's are kept in state under `refusals`. 3. The record names the Execution, its status, each role's Skills and a version per Skill. `skill_version` in `app/skills/agent_skills.py` is a 12-character content hash of the Skill's files. 4. It is written twice: through `ExecutionRecorder.record_lesson_candidates` (the database recorder stores it as an artifact of type `lesson_candidates`), and to `lessons/candidates/.json` under the output root. That directory is gitignored. Changed from the plan: the file is not inside `deliverables/executions//`. An Execution that ends with warnings must write no Deliverable files (an existing rule with a test), and those Executions are the ones most worth learning from. On "no secrets and no discovered cloud data": a refusal from a `cloud_read` tool keeps only the words before its first colon, and every message is cut at 500 characters. Revision reasons, user feedback and finding evidence are kept whole, so a record can quote the user and name resources in generated Terraform. Treat the files as client data. Tests: `tests/execution/test_lessons.py`.