# OOP Refactoring Tracker

Tracks elimination of class-based OOP from the codebase to reduce AI agent scope misinterpretation.

## Status: IN PROGRESS

## Phase 1: Leaf Classes (No internal dependents)
These classes have no dependencies on other classes being refactored. Start here.

- [ ] `src/tool_bias.py` - ToolBiasEngine → module functions + dict
- [ ] `src/session_logger.py` - SessionLogger → module-level functions
- [ ] `src/summarize.py` - SummaryCache class → plain dict + functions

## Phase 2: Internal Classes (Depend on Phase 1)
These classes use Phase 1 classes. Refactor Phase 1 first.

- [ ] `src/project_manager.py` - ProjectManager class
- [ ] `src/aggregate.py` - Aggregator class

## Phase 3: Core Classes (High risk - many callers)
These have many dependents. Handle last with extra testing.

- [ ] `src/ai_client.py` - AI client classes (AIProvider, etc.)
- [ ] `src/mcp_client.py` - MCPClient, ToolRegistry
- [ ] `src/models.py` - Data classes → dataclass/NamedTuple

## Phase 4: GUI Classes (Highest risk)
Classes used in GUI callbacks. Require live testing.

- [ ] `src/gui_2.py` - Main GUI class, panel classes

## Anti-Regression Protocol

Before refactoring ANY class:

1. **Write test** that validates current behavior
2. **Commit baseline** with `test(baseline): add baseline for <class>`
3. **Extract method** into module-level function
4. **Update all callers** to use function directly
5. **Run test** - must pass identically
6. **Commit extraction** with `refactor(oop): extract <method> from <Class>`
7. **Delete class** only when ALL methods extracted

## Progress Log

### 2026-05-11
- Initial tracker created
- Anti-OOP conventions added to `conductor/code_styleguides/python.md`
- Ruff PLR rules added to `pyproject.toml`

## Notes

- Use Strangler Fig pattern: keep class working until last caller migrated
- Prefer `dict`/`NamedTuple` over classes for data containers
- Classes with only data: convert to `dataclass(frozen=True)` or `NamedTuple`