[chat] ai_interaction.py at 1807 lines massively exceeds AGENTS.md ~400 line limit #722

Closed
opened 2026-06-03 00:07:08 +02:00 by sleepy · 0 comments
Owner

Problem

src/ai_interaction.py is 1807 lines — 4.5× the AGENTS.md ~400 line limit.

The file contains at least 8 distinct responsibilities:

  1. Global manager singleton management (set_session_manager, get_session_manager, etc.)
  2. Model resolution (_resolve_model)
  3. Chat-with-model tool (do_chat_with_model)
  4. Teacher/escalation tools (do_ask_teacher)
  5. Second-opinion tool (do_second_opinion)
  6. Session management tools (do_create_session, do_list_sessions, do_send_to_session, do_manage_session)
  7. Memory management tool (do_manage_memory)
  8. Image generation (do_generate_image)
  9. Pipeline orchestration (do_pipeline)

AGENTS.md violations

  • Split files exceeding ~400 lines or containing multiple concerns
  • Multiple concerns co-located in a single file

Suggested fix

Split into domain-specific modules under src/ai_interaction/ or src/ai_tools/:

  • model_resolver.py — model resolution logic
  • chat_tools.py — do_chat_with_model, do_send_to_session
  • session_tools.py — create/list/manage session
  • memory_tools.py — manage_memory
  • pipeline_tools.py — pipeline, second_opinion
  • image_tools.py — generate_image
  • _globals.py — shared manager singletons
## Problem `src/ai_interaction.py` is 1807 lines — 4.5× the AGENTS.md ~400 line limit. The file contains at least 8 distinct responsibilities: 1. Global manager singleton management (`set_session_manager`, `get_session_manager`, etc.) 2. Model resolution (`_resolve_model`) 3. Chat-with-model tool (`do_chat_with_model`) 4. Teacher/escalation tools (`do_ask_teacher`) 5. Second-opinion tool (`do_second_opinion`) 6. Session management tools (`do_create_session`, `do_list_sessions`, `do_send_to_session`, `do_manage_session`) 7. Memory management tool (`do_manage_memory`) 8. Image generation (`do_generate_image`) 9. Pipeline orchestration (`do_pipeline`) ## AGENTS.md violations - **Split files exceeding ~400 lines or containing multiple concerns** - Multiple concerns co-located in a single file ## Suggested fix Split into domain-specific modules under `src/ai_interaction/` or `src/ai_tools/`: - `model_resolver.py` — model resolution logic - `chat_tools.py` — do_chat_with_model, do_send_to_session - `session_tools.py` — create/list/manage session - `memory_tools.py` — manage_memory - `pipeline_tools.py` — pipeline, second_opinion - `image_tools.py` — generate_image - `_globals.py` — shared manager singletons
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sleepy/odysseus#722
No description provided.