Skip to content

Codebase health — avg cc 4.96, 73 funcs over fail, worst 238 #19

Description

@github-actions

Automated weekly codebase-health report (scripts/codebase_health.py).

This is a rolling tracking issue — it is updated in place each week. It
FLAGS structural-health signals that predict agent drag; it does not
change code. To act on a flagged file, invoke the codebase-health-audit
skill (review -> plan -> refactor -> re-measure) — flag-only, never auto-refactor.

Run: https://github.com/FracktalWorks/CommandCenter/actions/runs/32694520925

========================================================================
CODEBASE HEALTH REPORT
========================================================================
Files scanned:  415
Functions:      4733
Avg complexity: 4.96  (grade A)
Over cc=15 (warn): 281   Over cc=25 (fail): 73

-- 20 WORST FUNCTIONS ----------------------------------------
   238 [F]  apps/services/orchestrator/orchestrator/executor.py:2197  run_agent_stream
    84 [F]  apps/services/orchestrator/orchestrator/_tool_injection.py:639  _inject_agent_tools
    82 [F]  apps/services/gateway/gateway/chat_fold.py:112  fold_run_events
    72 [F]  apps/services/gateway/gateway/routes/email/automation/actions.py:265  _apply_rule_actions
    65 [F]  apps/services/gateway/gateway/routes/tasks/calendar.py:797  _replan_core
    62 [F]  apps/services/orchestrator/orchestrator/executor.py:500  _run_sub_agent_streaming
    56 [F]  apps/services/gateway/gateway/routes/tasks/ai.py:671  _llm_propose
    55 [F]  apps/services/gateway/gateway/routes/email/automation/rules.py:946  rule_feedback
    54 [F]  apps/services/gateway/gateway/routes/email/automation/assistant.py:244  get_assistant_settings
    49 [F]  apps/services/gateway/gateway/routes/agent.py:1722  run_agent_stream_endpoint
    49 [F]  apps/services/gateway/gateway/routes/people/quality.py:211  collect
    49 [F]  apps/services/gateway/gateway/routes/tasks/ai.py:233  propose
    48 [F]  apps/services/orchestrator/orchestrator/executor.py:1766  _run_agent_inner
    43 [F]  apps/services/gateway/gateway/routes/agent.py:1386  register_agent
    41 [F]  apps/services/gateway/gateway/routes/email/transport/contacts.py:378  contact_card
    40 [E]  apps/services/gateway/gateway/routes/tasks/capture_email.py:634  capture_from_email
    39 [E]  apps/services/gateway/gateway/routes/email/transport/messages.py:137  list_messages
    38 [E]  apps/services/gateway/gateway/routes/email/automation/drafting.py:2034  upsert_draft
    38 [E]  apps/services/gateway/gateway/routes/tasks/accounts.py:461  _reconcile_people
    38 [E]  apps/services/gateway/gateway/routes/tasks/capture_email.py:206  _llm_capture

-- FILES OVER 800 LOC (43) ------------------------------
   5027 LOC  (max cc 238, MI 0.0)  apps/services/orchestrator/orchestrator/executor.py
   3600 LOC  (max cc 49, MI 0.0)  apps/services/gateway/gateway/routes/agent.py
   2295 LOC  (max cc 38, MI 0.0)  apps/services/gateway/gateway/routes/email/automation/drafting.py
   2170 LOC  (max cc 20, MI 0.0)  apps/services/gateway/gateway/routes/settings.py
   2056 LOC  (max cc 20, MI 15.7)  apps/services/gateway/gateway/routes/projects/core.py
   2053 LOC  (max cc 36, MI 0.0)  apps/services/gateway/gateway/routes/integrations.py
   1986 LOC  (max cc 26, MI 0.0)  apps/agents/agent-email-assistant/agents.py
   1900 LOC  (max cc 56, MI 0.0)  apps/services/gateway/gateway/routes/tasks/ai.py
   1701 LOC  (max cc 32, MI 3.4)  apps/services/gateway/gateway/routes/email/automation/runner.py
   1663 LOC  (max cc 29, MI 16.3)  packages/acb_skills/acb_skills/loader.py
   1615 LOC  (max cc 26, MI 11.3)  apps/services/gateway/gateway/routes/email/automation/replyzero.py
   1615 LOC  (max cc 37, MI 7.4)  apps/services/gateway/gateway/routes/tasks/items.py
   1548 LOC  (max cc 37, MI 17.5)  apps/services/gateway/gateway/main.py
   1545 LOC  (max cc 65, MI 0.0)  apps/services/gateway/gateway/routes/tasks/calendar.py
   1534 LOC  (max cc 22, MI 16.9)  apps/services/gateway/gateway/routes/workspace.py
   1365 LOC  (max cc 40, MI 0.0)  apps/services/gateway/gateway/routes/tasks/capture_email.py
   1353 LOC  (max cc 17, MI 27.0)  apps/services/gateway/gateway/routes/crm/sync_zoho.py
   1342 LOC  (max cc 23, MI 23.8)  apps/services/gateway/gateway/routes/email/automation/senders.py
   1323 LOC  (max cc 14, MI 29.6)  apps/services/gateway/gateway/routes/crm/core.py
   1295 LOC  (max cc 20, MI 9.5)  apps/services/email_ingestion/email_ingestion/providers/outlook.py

-- LOW MAINTAINABILITY INDEX (<10.0) (14) --------------------
  MI   0.0  (1986 LOC)  apps/agents/agent-email-assistant/agents.py
  MI   5.0  (1142 LOC)  apps/services/email_ingestion/email_ingestion/providers/gmail.py
  MI   9.5  (1295 LOC)  apps/services/email_ingestion/email_ingestion/providers/outlook.py
  MI   0.0  (3600 LOC)  apps/services/gateway/gateway/routes/agent.py
  MI   0.0  (2295 LOC)  apps/services/gateway/gateway/routes/email/automation/drafting.py
  MI   3.4  (1701 LOC)  apps/services/gateway/gateway/routes/email/automation/runner.py
  MI   0.0  (2053 LOC)  apps/services/gateway/gateway/routes/integrations.py
  MI   0.0  (2170 LOC)  apps/services/gateway/gateway/routes/settings.py
  MI   0.0  (1900 LOC)  apps/services/gateway/gateway/routes/tasks/ai.py
  MI   0.0  (1545 LOC)  apps/services/gateway/gateway/routes/tasks/calendar.py
  MI   0.0  (1365 LOC)  apps/services/gateway/gateway/routes/tasks/capture_email.py
  MI   7.4  (1615 LOC)  apps/services/gateway/gateway/routes/tasks/items.py
  MI   0.0  (5027 LOC)  apps/services/orchestrator/orchestrator/executor.py
  MI   8.9  (1106 LOC)  apps/skills/skill-task-gtd/skill_task_gtd/core.py

Ratchet plan: dev_velocity_tooling_2026-07.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions