From 911deae36fbcc311d76bb9491d836c21c0d7827f Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Sun, 5 Apr 2026 03:30:42 +0000 Subject: [PATCH] =?UTF-8?q?chore(agents):=20improve=20implementer=20agents?= =?UTF-8?q?=20=E2=80=94=20verify=20domain=20model=20fields=20before=20refe?= =?UTF-8?q?rencing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Approved proposal: #2879 Pattern: prompt_improvement Evidence: PRs #1566, #1567, #1569, #1481 referenced non-existent Session fields (automation_profile, list_messages, etc.), causing 5 Pyright type errors and runtime crashes on session CLI commands. Fix: Add domain model verification step to all three implementer agents (sonnet, codex, opus) requiring them to read actual class definitions before referencing fields/methods. ISSUES CLOSED: #2879 --- .opencode/agents/ca-implementer-codex.md | 19 ++++++++++++++++--- .opencode/agents/ca-implementer-opus.md | 19 ++++++++++++++++--- .opencode/agents/ca-implementer-sonnet.md | 19 ++++++++++++++++--- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/.opencode/agents/ca-implementer-codex.md b/.opencode/agents/ca-implementer-codex.md index b877d93c8..73074af80 100644 --- a/.opencode/agents/ca-implementer-codex.md +++ b/.opencode/agents/ca-implementer-codex.md @@ -64,12 +64,25 @@ Follow these rules strictly: 1. Read and understand the subtask requirements. 2. Read any existing code in the relevant modules to understand the current state. -3. Implement the required changes: +3. **Verify domain model fields exist (CRITICAL).** Before writing code that + references any field, method, or attribute on a domain model class, you + MUST verify it exists by reading the actual class definition. **Never + assume a field exists based solely on the issue description.** Issue + descriptions often describe *desired* behavior — the field may not yet + exist in the codebase. Specifically: + - Before accessing `model.some_field`, read the model class to confirm + `some_field` is defined. + - Before calling `service.some_method()`, read the service class to + confirm `some_method` exists with the expected signature. + - If a required field or method does not exist, you must CREATE it as + part of your implementation (including database schema changes if + needed), not just reference it and hope it exists. +4. Implement the required changes: - Write clean, well-typed Python code. - Follow the architectural patterns from the specification. - Add appropriate docstrings and inline comments for complex logic. -4. Do NOT write tests (separate agents handle testing). -5. Do NOT run nox or quality checks (separate agents handle this). +5. Do NOT write tests (separate agents handle testing). +6. Do NOT run nox or quality checks (separate agents handle this). ## Escalation Context diff --git a/.opencode/agents/ca-implementer-opus.md b/.opencode/agents/ca-implementer-opus.md index 597e71b36..02b516031 100644 --- a/.opencode/agents/ca-implementer-opus.md +++ b/.opencode/agents/ca-implementer-opus.md @@ -65,12 +65,25 @@ Follow these rules strictly: 1. Read and understand the subtask requirements. 2. Read any existing code in the relevant modules to understand the current state. -3. Implement the required changes: +3. **Verify domain model fields exist (CRITICAL).** Before writing code that + references any field, method, or attribute on a domain model class, you + MUST verify it exists by reading the actual class definition. **Never + assume a field exists based solely on the issue description.** Issue + descriptions often describe *desired* behavior — the field may not yet + exist in the codebase. Specifically: + - Before accessing `model.some_field`, read the model class to confirm + `some_field` is defined. + - Before calling `service.some_method()`, read the service class to + confirm `some_method` exists with the expected signature. + - If a required field or method does not exist, you must CREATE it as + part of your implementation (including database schema changes if + needed), not just reference it and hope it exists. +4. Implement the required changes: - Write clean, well-typed Python code. - Follow the architectural patterns from the specification. - Add appropriate docstrings and inline comments for complex logic. -4. Do NOT write tests (separate agents handle testing). -5. Do NOT run nox or quality checks (separate agents handle this). +5. Do NOT write tests (separate agents handle testing). +6. Do NOT run nox or quality checks (separate agents handle this). ## Escalation Context diff --git a/.opencode/agents/ca-implementer-sonnet.md b/.opencode/agents/ca-implementer-sonnet.md index 9a7139d1a..055d6b19f 100644 --- a/.opencode/agents/ca-implementer-sonnet.md +++ b/.opencode/agents/ca-implementer-sonnet.md @@ -64,12 +64,25 @@ Follow these rules strictly: 1. Read and understand the subtask requirements. 2. Read any existing code in the relevant modules to understand the current state. -3. Implement the required changes: +3. **Verify domain model fields exist (CRITICAL).** Before writing code that + references any field, method, or attribute on a domain model class, you + MUST verify it exists by reading the actual class definition. **Never + assume a field exists based solely on the issue description.** Issue + descriptions often describe *desired* behavior — the field may not yet + exist in the codebase. Specifically: + - Before accessing `model.some_field`, read the model class to confirm + `some_field` is defined. + - Before calling `service.some_method()`, read the service class to + confirm `some_method` exists with the expected signature. + - If a required field or method does not exist, you must CREATE it as + part of your implementation (including database schema changes if + needed), not just reference it and hope it exists. +4. Implement the required changes: - Write clean, well-typed Python code. - Follow the architectural patterns from the specification. - Add appropriate docstrings and inline comments for complex logic. -4. Do NOT write tests (separate agents handle testing). -5. Do NOT run nox or quality checks (separate agents handle this). +5. Do NOT write tests (separate agents handle testing). +6. Do NOT run nox or quality checks (separate agents handle this). ## Escalation Context -- 2.52.0