本卡屬 FR-091(母卡 CM-1690)三張大卡之一。重:施工日誌 189 處(全部套件最多)、35 條 route、11 張表、2 支 migration、沒有 harness,且主專案接線走 config/app_modules.py 的舊 blueprint 迴圈(api/detection_tools/__init__.pyinfra/detection_tools/adapters.py),不在 CM-1689 的 11 支內——本卡 G 組收進 core/plugins/detection.py。STATE §2 裁「detection 要開 identity port」:實查 detection_profile_service.py:50detection_orchestration_service.py:30 直接 from jedi_iam.domain.entities.user_query_entity import UserQueryEntity 查暱稱,改走 D8 identity。

問題是什麼(白話)

jedi-detection(檢測工具整合:profile、編排、任務下發到 agent)plugin.py 324 行 6 dataclass;api/init.py 含 ctx() 9 處與 35 條路由;logger 四種名(common.jedi_detection 11、__name__ 4、jedi_detection 1、"app" 1);22 個 entity 只有 11 個 dataclass(半套);189 處施工日誌。兩支 app service 直接 import jedi_iam 查使用者暱稱(_users.get_users(UserQueryEntity(_in_login_name=...))),是套件間反向依賴。主專案側接線散在 api/ 與 infra/ 兩處。

首腦核對(2026-09-13):plugin.py 324 行 6 dataclass;route 35;ctx() 9;entity 檔 22(11 dataclass);表 11;migration 2;tests 44 支(baseline 已跑:44 passed,無 integration);harness 無;施工日誌 189 處;logger 四種;jedi_iam 直接 import 2 處(非 authz);有吐 created_user_name(12 處);_PKG_ROOT = parent.parent / "jedi_detection"(不中 plugin 坑)。主專案 31 檔 import;接線 api/detection_tools/__init__.py(create_module)+infra/detection_tools/adapters.py(port adapter,另有 infra/readmodel/detection/detection_profile_usage_query.py 也實作 port)+config/app_modules.py:100;venv 指工作樹。

在哪裡

套件:/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-detection/
  app/service/detection_profile_service.py:50、:1068(UserQueryEntity 查暱稱)
  app/service/detection_orchestration_service.py:30
identity 範例:jedi-asset plugin/contract.py:83+app/service/_audit_names.py;jedi-survey CM-1716 commit 79e7b28;jedi-compliance-audit CM-1715(若已收回,照它)
新建 harness 範例:jedi-issue CM-1712 commit d510eb2(也是從零建)
SOP:extraction-sop.md §3.2/§4.3/§5.1/§5.2
主專案(本卡 G 組允許動):
  api/detection_tools/__init__.py             → 併進 core/plugins/detection.py 後刪
  infra/detection_tools/adapters.py           → 併進同檔 ① 段後刪(AST 掃誰在 import,若 di_containers 也用,照 CM-1700/1701 判準整批搬)
  infra/readmodel/detection/detection_profile_usage_query.py → 是 readmodel 查詢實作 port,留原地並登記守衛白名單(寫明理由)
  config/app_modules.py:100                    → 拿掉 "detection_tools"
  core/plugins/__init__.py                     → PLUGINS 加一列
  di_containers/detection_tools/detection_orchestration/agent_task → 只改 import
  test/test_module_boundaries.py               → 守衛清單
現成範本:core/plugins/evidence_classification.py、core/plugins/license.py

怎麼修(套件側 A~F 各一 commit;主專案側 G 一個 commit;兩 repo 分開)

要寫測試

手測(驗證等級:重——agent 派工路徑)