[routes] session_routes.py at 1072 lines exceeds AGENTS.md ~400 line limit #778

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

Problem

routes/session_routes.py is 1072 lines with 23 endpoint handlers mixing:

  • Session CRUD (list, create, rename, delete, archive/unarchive)
  • Session import/export
  • Message injection
  • Session compaction
  • Auto-sort with LLM-based categorization
  • Context info retrieval
  • OpenAI-compatible session creation
  • Bulk operations (delete all, bulk delete)

The auto_sort_sessions function alone is ~220 lines with deeply nested LLM calls and fallback logic.

AGENTS.md violation

Split files that exceed ~400 lines or contain multiple concerns.

Suggested split

  • routes/session/crud.py — basic session CRUD
  • routes/session/export.py — export/import
  • routes/session/sort.py — auto-sort logic
  • routes/session/compact.py — session compaction
  • Move auto-sort business logic to a service
## Problem `routes/session_routes.py` is 1072 lines with 23 endpoint handlers mixing: - Session CRUD (list, create, rename, delete, archive/unarchive) - Session import/export - Message injection - Session compaction - Auto-sort with LLM-based categorization - Context info retrieval - OpenAI-compatible session creation - Bulk operations (delete all, bulk delete) The `auto_sort_sessions` function alone is ~220 lines with deeply nested LLM calls and fallback logic. ## AGENTS.md violation > Split files that exceed ~400 lines or contain multiple concerns. ## Suggested split - `routes/session/crud.py` — basic session CRUD - `routes/session/export.py` — export/import - `routes/session/sort.py` — auto-sort logic - `routes/session/compact.py` — session compaction - Move auto-sort business logic to a service
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#778
No description provided.