Why
`clawloop/core/loop.py:156` defines `learning_loop()`, a single function ~420 lines long that handles:
- task sampling
- batch episode execution
- archive writes
- evolver context construction
- per-layer transactions
- rollback on failure
- generation flush
- structured logging
Reading the loop end-to-end requires holding all seven concerns in your head at once. New contributors trying to add a feature touch this function and can't tell what's load-bearing vs incidental.
What
Acceptance
- `learning_loop()` is ≤100 lines
- All existing tests pass with no behavioral change
- New unit tests for each extracted helper (small, focused)
Effort
~3 hours. Touches a hot path so testing matters; existing 1023-test suite gives good coverage.
Source
Codex code audit, 2026-04-18 (S1 finding).
Why
`clawloop/core/loop.py:156` defines `learning_loop()`, a single function ~420 lines long that handles:
Reading the loop end-to-end requires holding all seven concerns in your head at once. New contributors trying to add a feature touch this function and can't tell what's load-bearing vs incidental.
What
Acceptance
Effort
~3 hours. Touches a hot path so testing matters; existing 1023-test suite gives good coverage.
Source
Codex code audit, 2026-04-18 (S1 finding).