Skip to content

Codebase health — avg cc 5.35, 64 funcs over fail, worst 243 #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/30797942078

========================================================================
CODEBASE HEALTH REPORT
========================================================================
Files scanned:  333
Functions:      3570
Avg complexity: 5.35  (grade B)
Over cc=15 (warn): 243   Over cc=25 (fail): 64

-- 20 WORST FUNCTIONS ----------------------------------------
   243 [F]  apps/services/orchestrator/orchestrator/executor.py:2139  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:801  _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:984  rule_feedback
    54 [F]  apps/services/gateway/gateway/routes/email/automation/assistant.py:244  get_assistant_settings
    53 [F]  apps/services/orchestrator/orchestrator/executor.py:1683  run_agent
    49 [F]  apps/services/gateway/gateway/routes/agent.py:1684  run_agent_stream_endpoint
    49 [F]  apps/services/gateway/gateway/routes/tasks/ai.py:233  propose
    43 [F]  apps/services/gateway/gateway/routes/agent.py:1348  register_agent
    41 [F]  apps/services/gateway/gateway/routes/email/transport/contacts.py:376  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:140  list_messages
    38 [E]  apps/services/gateway/gateway/routes/email/automation/drafting.py:2020  upsert_draft
    38 [E]  apps/services/gateway/gateway/routes/tasks/accounts.py:477  _reconcile_people
    38 [E]  apps/services/gateway/gateway/routes/tasks/capture_email.py:206  _llm_capture
    38 [E]  apps/services/gateway/gateway/routes/tasks/sync.py:178  _sync_account

-- FILES OVER 800 LOC (33) ------------------------------
   5011 LOC  (max cc 243, MI 0.0)  apps/services/orchestrator/orchestrator/executor.py
   3544 LOC  (max cc 49, MI 0.0)  apps/services/gateway/gateway/routes/agent.py
   2293 LOC  (max cc 38, MI 0.0)  apps/services/gateway/gateway/routes/email/automation/drafting.py
   2053 LOC  (max cc 36, MI 0.0)  apps/services/gateway/gateway/routes/integrations.py
   1974 LOC  (max cc 26, MI 0.0)  apps/agents/agent-email-assistant/agents.py
   1922 LOC  (max cc 56, MI 0.0)  apps/services/gateway/gateway/routes/tasks/ai.py
   1736 LOC  (max cc 32, MI 2.5)  apps/services/gateway/gateway/routes/email/automation/runner.py
   1722 LOC  (max cc 20, MI 5.6)  apps/services/gateway/gateway/routes/settings.py
   1663 LOC  (max cc 29, MI 16.3)  packages/acb_skills/acb_skills/loader.py
   1623 LOC  (max cc 37, MI 5.4)  apps/services/gateway/gateway/routes/tasks/items.py
   1594 LOC  (max cc 26, MI 10.9)  apps/services/gateway/gateway/routes/email/automation/replyzero.py
   1561 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
   1430 LOC  (max cc 37, MI 19.0)  apps/services/gateway/gateway/main.py
   1386 LOC  (max cc 40, MI 0.0)  apps/services/gateway/gateway/routes/tasks/capture_email.py
   1359 LOC  (max cc 23, MI 22.7)  apps/services/gateway/gateway/routes/email/automation/senders.py
   1295 LOC  (max cc 20, MI 9.5)  apps/services/email_ingestion/email_ingestion/providers/outlook.py
   1281 LOC  (max cc 55, MI 13.3)  apps/services/gateway/gateway/routes/email/automation/rules.py
   1164 LOC  (max cc 84, MI 23.4)  apps/services/orchestrator/orchestrator/_tool_injection.py
   1142 LOC  (max cc 25, MI 5.0)  apps/services/email_ingestion/email_ingestion/providers/gmail.py

-- LOW MAINTAINABILITY INDEX (<10.0) (14) --------------------
  MI   0.0  (1974 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  (3544 LOC)  apps/services/gateway/gateway/routes/agent.py
  MI   0.0  (2293 LOC)  apps/services/gateway/gateway/routes/email/automation/drafting.py
  MI   2.5  (1736 LOC)  apps/services/gateway/gateway/routes/email/automation/runner.py
  MI   0.0  (2053 LOC)  apps/services/gateway/gateway/routes/integrations.py
  MI   5.6  (1722 LOC)  apps/services/gateway/gateway/routes/settings.py
  MI   0.0  (1922 LOC)  apps/services/gateway/gateway/routes/tasks/ai.py
  MI   0.0  (1561 LOC)  apps/services/gateway/gateway/routes/tasks/calendar.py
  MI   0.0  (1386 LOC)  apps/services/gateway/gateway/routes/tasks/capture_email.py
  MI   5.4  (1623 LOC)  apps/services/gateway/gateway/routes/tasks/items.py
  MI   0.0  (5011 LOC)  apps/services/orchestrator/orchestrator/executor.py
  MI   8.8  (1094 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