You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: per-archetype PremortemTask decomposition for small-model compatibility
PremortemAnalysis required the LLM to emit a deeply nested schema:
3 AssumptionItem + 3 FailureModeItem, with 11+ required fields per item
including linked cross-reference IDs. Qwen 3.5-35B and other small local
models consistently echoed the schema structure back instead of producing
values, causing validation errors after exhausting all retries.
Fix (applies the 'LLMs handle narrative; code handles structure' principle):
- New ArchetypeNarrative schema: 5 plain text fields only (no IDs, no
cross-references, no counts). The LLM writes narrative content only.
- Per-archetype decomposition: one independent LLM call per archetype
with up to 5 retries. Failed archetypes are skipped gracefully.
- IDs, indices, and cross-references (assumption_id, failure_mode_index,
root_cause_assumption_id) are assigned by code, not the LLM.
- falsifier derived from test_now field to avoid hardcoded tautologies.
- _calculate_risk_level_verbose returns 'Not Scored' when likelihood or
impact is None (was rendering 'Likelihood None/5, Impact None/5').
- Dead code removed: ArchetypeAnalysis class, PREMORTEM_SYSTEM_PROMPT_TEMPLATE.
Validated: PremortemTask PASSED on GLM 4.7 Flash (HVT_minimal run).
Copy file name to clipboardExpand all lines: worker_plan/worker_plan_internal/diagnostics/premortem.py
+55-64Lines changed: 55 additions & 64 deletions
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,14 @@ class PremortemAnalysis(BaseModel):
71
71
assumptions_to_kill: List[AssumptionItem] =Field(description="A list of 3 new, critical, underlying assumptions to test immediately.")
72
72
failure_modes: List[FailureModeItem] =Field(description="A list containing exactly 3 distinct failure failure_modes, one for each archetype.")
73
73
74
+
classArchetypeNarrative(BaseModel):
75
+
"""Minimal per-archetype schema. IDs and cross-references are assigned by the program, not the LLM."""
76
+
assumption: str=Field(description="One critical assumption the project is making that, if false, would cause this failure.")
77
+
test_now: str=Field(description="One concrete action to immediately test if this assumption holds.")
78
+
failure_title: str=Field(description="A short, compelling title for this failure scenario (e.g. 'The Gridlock Gamble').")
79
+
failure_story: str=Field(description="A detailed narrative of how this failure unfolds. Explain causes, chain of events, and impact.")
80
+
warning_signs: List[str] =Field(description="2-4 observable signals that this failure is beginning to occur.")
81
+
74
82
PREMORTEM_SYSTEM_PROMPT="""
75
83
Persona: You are a senior project analyst. Your primary goal is to write compelling, detailed, and distinct failure stories that are also operationally actionable.
0 commit comments