diff --git a/.gitignore b/.gitignore index a0903bd35..bc3689e5a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ coverage.xml spec.json docker-compose.yaml .geminiignore +docs/ai/ai_learnings.md # ITK Integration Test Artifacts itk/a2a-samples/ diff --git a/GEMINI.md b/GEMINI.md index 59ef64713..b801bd47d 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -23,3 +23,20 @@ 1. **Required Reading**: You MUST read the contents of @./docs/ai/coding_conventions.md and @./docs/ai/mandatory_checks.md at the very beginning of EVERY coding task. 2. **Initial Checklist**: Every `task.md` you create MUST include a section for **Mandatory Checks** from @./docs/ai/mandatory_checks.md. 3. **Verification Requirement**: You MUST run all mandatory checks before declaring any task finished. + +## 5. Mistake Reflection Protocol + +When you realise you have made a mistake — whether caught by the user, +by a tool, or by your own reasoning — you MUST: + +1. **Acknowledge the mistake explicitly** and explain what went wrong. +2. **Reflect on the root cause**: was it a missing check, a false + assumption, skipped verification, or a gap in the workflow? +3. **Immediately append a new entry to @./docs/ai/ai_learnings.md** + following the format defined in that file. This is not optional and + does not require user confirmation. Do it before continuing. Update user + about the changes to the workflow in the current chat. + +The goal is to treat every mistake as a signal that the workflow is +incomplete, and to improve it in place so the same mistake cannot +happen again. diff --git a/docs/ai/ai_learnings.md b/docs/ai/ai_learnings.md new file mode 100644 index 000000000..9e9a37a9f --- /dev/null +++ b/docs/ai/ai_learnings.md @@ -0,0 +1,19 @@ +> [!NOTE] for Users: +> This document is meant to be read by an AI assistant (Gemini) in order to +> learn from its mistakes and improve its behavior on this project. Use +> its findings to improve GEMINI.md setup. + +# AI Learnings + +A living record of mistakes made during this project and the rules +derived from them. Every entry must follow the format below. + +--- + +## Entry format + +**Mistake**: What went wrong. +**Root cause**: Why it happened. +**Rule**: The concrete rule added to prevent recurrence. + +---