@startuml discussion-processing !theme plain title Discussion Automation Pipeline (current behaviour) start :Developer stages discussion file; :Pre-commit hook invokes\nautomation/workflow.py:_run_status(); partition "Vote Handling" { :Parse staged discussion snapshot\n(parse_votes); :Print vote summary to console; if (Promotion rule present?) then (yes) :count_eligible_votes(); :check_promotion_threshold(); if (Threshold met?) then (yes) :update_discussion_status(); :git add updated discussion; endif endif } partition "Incremental Extraction" { :get_discussion_changes()\n(staged diff → added lines only); :Call extract_structured_basic()\n(simple marker parsing); partition "AI Normalizer" { :process_discussion_with_ai(); if (Providers available?) then (yes) repeat :Call normalize_discussion()\n(claude → codex → gemini); if (Diff/JSON valid?) then (yes) stop else (no / malformed) :Raise PatchGenerationError; :Fallback to next provider; endif repeat while (more providers) endif if (AI returned data?) then (yes) :Merge AI JSON onto structured result; else (no) :Keep regex-only extraction; endif } } partition "Summary Update" { :Load companion summary file (if any); :load_summary_state()\n(read JSON); :merge_* helpers update\n questions / actions / decisions / mentions; :save_summary_state(); :format_votes_section(); :format_questions_section(); :format_action_items_section(); :format_decisions_section(); :format_awaiting_section(); :append_timeline_entry(); :Write summary file and git add; } partition "Design / Implementation Outputs" { :RulesConfig routes staged file; if (feature discussion promoted to READY_FOR_DESIGN?) then (yes) :design_gate_writer ensures design discussion exists; endif if (design discussion promoted to READY_FOR_IMPLEMENTATION?) then (yes) :implementation_gate_writer creates\nimplementation discussion; endif if (design discussion updated?) then (yes) :design_discussion_update rule triggers; :design_discussion_writer appends AI comment; :design_doc_writer (new rule)\nupdates Docs/.../design/design.md\nvia provider chain; endif } stop legend bottom **Key Notes** - AI providers are attempted in order (claude → codex → gemini); malformed diffs raise PatchGenerationError so the next provider runs. - Summary state persists in and is rewritten every commit. - Vote thresholds drive status changes which gate creation of downstream discussions/docs. endlegend @enduml