Files
ss-tools/specs/006-configurable-belief-logs/tasks.md
busya 83e34e1799 feat(logging): implement configurable belief state logging
- Add LoggingConfig model and logging field to GlobalSettings
- Implement belief_scope context manager for structured logging
- Add configure_logger for dynamic level and file rotation settings
- Add logging configuration UI to Settings page
- Update ConfigManager to apply logging settings on initialization and updates
2025-12-27 05:39:33 +03:00

2.8 KiB

Tasks: Configurable Belief State Logging

Spec: specs/006-configurable-belief-logs/spec.md Plan: specs/006-configurable-belief-logs/plan.md Status: Completed

Phase 1: Setup

Goal: Initialize project structure for logging.

  • T001 Ensure logs directory exists at logs/ (relative to project root)

Phase 2: Foundational

Goal: Define data models and infrastructure required for logging configuration.

  • T002 Define LoggingConfig model in backend/src/core/config_models.py
  • T003 Update GlobalSettings model to include logging field in backend/src/core/config_models.py
  • T004 Update ConfigManager to handle logging configuration persistence in backend/src/core/config_manager.py

Phase 3: User Story 1 - Structured Belief State Logging

Goal: Implement the core "Belief State" logging logic with context managers. Priority: P1

Independent Test: Run pytest backend/tests/test_logger.py and verify belief_scope generates [ID][Entry], [ID][Action], and [ID][Exit] logs.

  • T005 [US1] Create unit tests for belief state logging in backend/tests/test_logger.py
  • T006 [US1] Implement belief_scope context manager in backend/src/core/logger.py
  • T007 [US1] Implement log formatting and smart filtering (suppress Entry/Exit if disabled) in backend/src/core/logger.py

Phase 4: User Story 2 - Configurable Logging Settings

Goal: Expose logging configuration to the user via API and UI. Priority: P2

Independent Test: Update settings via API/UI and verify log level changes (e.g., DEBUG logs appear) and file rotation is active.

  • T008 [US2] Implement configure_logger function to apply settings (level, file, rotation) in backend/src/core/logger.py
  • T009 [US2] Update settings API endpoint to handle logging updates in backend/src/api/routes/settings.py
  • T010 [P] [US2] Add Logging configuration section (Level, File Path, Enable Belief State) to frontend/src/pages/Settings.svelte

Final Phase: Polish & Cross-Cutting Concerns

Goal: Verify system stability and cleanup.

  • T011 Verify log rotation works by generating dummy logs (manual verification)
  • T012 Ensure default configuration provides a sensible out-of-the-box experience

Dependencies

graph TD
    Setup[Phase 1: Setup] --> Foundational[Phase 2: Foundational]
    Foundational --> US1[Phase 3: US1 Belief State]
    US1 --> US2[Phase 4: US2 Configurable Settings]
    US2 --> Polish[Final Phase: Polish]

Parallel Execution Opportunities

  • US2: Frontend task (T010) can be implemented in parallel with Backend tasks (T008, T009) once the API contract is finalized.

Implementation Strategy

  1. MVP: Complete Phase 1, 2, and 3 to enable structured logging for the agent.
  2. Full Feature: Complete Phase 4 to allow users to control the verbosity and storage.