CODE_HEALTH #4 (see docs/CODE_HEALTH.md in #37).
cognifold.service.llm_keys is imported by five packages below the service layer: agent/ (7 sites), query/ (incl. query/llm.py:16), utils/, embeddings/, and config.py:161 — meaning the root config module depends on the HTTP service layer, inverting the documented layering (docs/ARCHITECTURE.md §Module Dependencies). A visible symptom: 287 function-local from cognifold... imports across src/ exist to dodge the resulting cycles.
llm_keys.py has no FastAPI dependency — it is simply misfiled.
Fix direction (small + mechanical, good first refactor):
CODE_HEALTH #4 (see
docs/CODE_HEALTH.mdin #37).cognifold.service.llm_keysis imported by five packages below the service layer:agent/(7 sites),query/(incl.query/llm.py:16),utils/,embeddings/, andconfig.py:161— meaning the root config module depends on the HTTP service layer, inverting the documented layering (docs/ARCHITECTURE.md§Module Dependencies). A visible symptom: 287 function-localfrom cognifold...imports acrosssrc/exist to dodge the resulting cycles.llm_keys.pyhas no FastAPI dependency — it is simply misfiled.Fix direction (small + mechanical, good first refactor):
service/llm_keys.py→cognifold/llm/keys.py(orutils/)service/imports from it again (rule already stated inCLAUDE.md)