Skip to content

Split events.py into per-domain event modules #110

@Aureliolo

Description

@Aureliolo

Problem

observability/events.py is a single 141-line file containing ~50 event constants across 8+ domains (config, provider, task, template, routing, budget, tool, prompt). Every module that logs events imports from this one file.

As M3+ adds more domains (agent execution, communication, memory, HR, security), this will grow to 200+ constants in a single file — hard to navigate, easy to miss naming conflicts, and poor locality.

Proposed Solution

Split into per-domain modules under observability/events/:

observability/events/
  __init__.py    # re-exports everything for backward compatibility
  config.py      # CONFIG_* constants
  provider.py    # PROVIDER_* constants
  routing.py     # ROUTING_* constants
  budget.py      # BUDGET_* constants
  tool.py        # TOOL_* constants
  task.py        # TASK_* constants
  template.py    # TEMPLATE_* constants
  prompt.py      # PROMPT_* constants
  role.py        # ROLE_* constants

The __init__.py re-exports all constants so existing imports continue working:

from ai_company.observability.events.config import *  # noqa: F403
from ai_company.observability.events.provider import *  # noqa: F403
# etc.

Modules can then import only what they need:

from ai_company.observability.events.provider import PROVIDER_CALL_START

Acceptance Criteria

  • Event constants split into per-domain modules under observability/events/
  • observability/events/__init__.py re-exports all constants
  • All existing imports continue to work unchanged
  • No functional changes — pure file reorganization
  • All tests pass
  • Update CLAUDE.md logging convention to reference per-domain modules (already done in M2.5 doc update — verify still accurate)
  • Verify DESIGN_SPEC.md §15.3 observability structure remains consistent after implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumShould do, but not blockingscope:medium1-3 days of workscope:smallLess than 1 day of workspec:architectureDESIGN_SPEC Section 15 - Technical Architecturetype:refactorCode restructuring, cleanup

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions