cba6e7d7ee
The user-reported models.py is a 'dumping ground' (1044 lines, 36 classes,
5+ unrelated domains). This track cleans it up PLUS addresses 5 ImGui
LEAKS that violate the 'ImGui belongs in gui_2.py' boundary PLUS
unifies 2 vendor files with ai_client.py.
TIER-1 READ AGENTS.md + conductor/workflow.md + conductor/edit_workflow.md
+ conductor/code_styleguides/data_oriented_design.md + conductor/code_styleguides/error_handling.md
+ conductor/code_styleguides/type_aliases.md + conductor/code_styleguides/code_path_audit.md
+ docs/reports/FOLLOWUP_module_taxonomy_20260627.md + conductor/tracks/cruft_elimination_20260627/SPEC_CORRECTION_phase_2.md
+ src/models.py before this commit.
User's principle: unify unless good reason (import load times or
definition pollution). No sub-directories; prefix naming.
Only 3 refactors justified (12 VCs total):
1. MERGE 5 ImGui LEAKS into gui_2.py (per user directive: 'all ImGui
rendering should be in gui_2.py; only exception imgui_scopes.py'):
- bg_shader.py, shaders.py, command_palette.py, diff_viewer.py,
patch_modal.py -> content to gui_2.py, git rm originals
2. MERGE 2 vendor files into ai_client.py (per user directive: 'vendor
files are the ai vendoring layer'):
- vendor_capabilities.py + vendor_state.py -> ai_client.py
- ai_client.py grows 3147 -> ~3310 lines (justified: unified)
3. SPLIT models.py (clear definition pollution: 5+ domains, 36 classes):
- CREATE src/mma.py (MMA Core: ThinkingSegment, Ticket, Track,
WorkerContext, TrackState)
- CREATE src/project.py (ProjectContext + 5 sub + config IO)
- CREATE src/project_files.py (FileItem, ContextPreset, etc.)
- MERGE 6+ classes into existing sub-system files:
- Persona -> personas.py
- Tool/ToolPreset -> tool_presets.py
- BiasProfile -> tool_bias.py
- TextEditorConfig/ExternalEditorConfig -> external_editor.py
- MCP config classes -> mcp_client.py
- WorkspaceProfile -> workspace_manager.py
- REDUCE models.py to ~30 lines (Pydantic proxies only) or DELETE
BONUS (user caught this): AGENT_TOOL_NAMES is REDUNDANT with
mcp_tool_specs.tool_names(). The existing test literally asserts
tool_names() ⊆ AGENT_TOOL_NAMES. DELETE the constant, update 8
consumer sites to use mcp_tool_specs.tool_names() directly.
Net scope: -4 files (65 -> 61; possibly 60 if models.py deleted).
22 atomic commits. 5 phases.
blocked_by: cruft_elimination_20260627 (the cruft track has a
ProjectContext-in-models.py commit that needs to coordinate with
this refactor's move to project.py)