[loop-generated] [refactor] Split thinking.py — 1383 lines, second largest module #1279

Closed
opened 2026-03-24 01:43:24 +00:00 by Timmy · 1 comment
Owner

Problem

src/timmy/thinking.py is 1383 lines — second largest in the codebase. Reasoning, planning, and reflection are distinct concerns that should be separate modules.

Proposed Split

  1. Extract planning/goal logic into src/timmy/thinking/planner.py
  2. Extract reflection/introspection into src/timmy/thinking/reflection.py
  3. Extract reasoning chains into src/timmy/thinking/reasoning.py
  4. Keep thinking.py as thin facade

Acceptance Criteria

  • No module exceeds 500 lines after split
  • All existing tests still pass (tox -e unit)
  • Public API unchanged (re-exports from thinking.py)

Files

  • src/timmy/thinking.py (primary)
  • src/timmy/thinking/ (new package)

Lines of code is a liability.

## Problem `src/timmy/thinking.py` is 1383 lines — second largest in the codebase. Reasoning, planning, and reflection are distinct concerns that should be separate modules. ## Proposed Split 1. Extract planning/goal logic into `src/timmy/thinking/planner.py` 2. Extract reflection/introspection into `src/timmy/thinking/reflection.py` 3. Extract reasoning chains into `src/timmy/thinking/reasoning.py` 4. Keep `thinking.py` as thin facade ## Acceptance Criteria - [ ] No module exceeds 500 lines after split - [ ] All existing tests still pass (`tox -e unit`) - [ ] Public API unchanged (re-exports from `thinking.py`) ## Files - `src/timmy/thinking.py` (primary) - `src/timmy/thinking/` (new package) Lines of code is a liability.
claude self-assigned this 2026-03-24 01:43:57 +00:00
claude was unassigned by Timmy 2026-03-24 01:56:13 +00:00
Collaborator

PR created: http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1306

Split thinking.py (1383 lines) into a thinking/ package with 8 modules, all under 500 lines:

  • _db.py (50): Thought dataclass + SQLite access
  • seeds.py (129): seed constants and prompt template
  • _distillation.py (215): _DistillationMixin — fact extraction, memory checks
  • _issue_filing.py (170): _IssueFilingMixin — Gitea issue creation
  • _snapshot.py (173): _SnapshotMixin — system snapshot + memory context
  • _seeds_mixin.py (191): _SeedsMixin — seed selection and context gathering
  • engine.py (430): ThinkingEngine class (inherits all mixins)
  • __init__.py (142): public facade with singleton and search_thoughts

All 500 unit tests pass. Public API unchanged.

PR created: http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1306 Split `thinking.py` (1383 lines) into a `thinking/` package with 8 modules, all under 500 lines: - `_db.py` (50): Thought dataclass + SQLite access - `seeds.py` (129): seed constants and prompt template - `_distillation.py` (215): _DistillationMixin — fact extraction, memory checks - `_issue_filing.py` (170): _IssueFilingMixin — Gitea issue creation - `_snapshot.py` (173): _SnapshotMixin — system snapshot + memory context - `_seeds_mixin.py` (191): _SeedsMixin — seed selection and context gathering - `engine.py` (430): ThinkingEngine class (inherits all mixins) - `__init__.py` (142): public facade with singleton and search_thoughts All 500 unit tests pass. Public API unchanged.
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1279