本卡屬 FR-166(母卡 CM-母卡號(建完補)),卡 P2-9,階段 P2 離線能做事、批 5。只改 evidence-agent。依賴:P1-3、P0-6、P2-8a。
心跳收到主系統的重啟旗標就重啟:等閒置或立即。
一支 observer
extend:observer 照既有形狀掛 enroll.py 一行;重啟動作 reuse P2-8a 的 ops
repo:~/Projects/Billows/Audit-Manager/evidence-agent
改既有:core/restart_flag.py(P1-3 已掛的 no-op 殼,填內容)
細節在 design.md 對應段(~/Projects/Billows/Audit-Manager/compliance-manager-be/docs/features/FR-166-2610-agent-standalone-console/design.md §5,開 design.html 看導覽),本段只列本卡要做到的點:
restart_flag.py(P1-3 no-op 殼填):observe(data) 讀 restart;now 立即走 P2-8a 的重啟;when_idle 等 _RUNNING_TASKS 空;回報 last_restart_reason。心跳帶 restart: now→任務 cancelled 後 exit;when_idle→等;回報 last_restart_reason
對照雛形:~/Projects/Billows/Audit-Manager/compliance-manager-be/docs/features/FR-166-2610-agent-standalone-console/prototype/index.html(上方「跟著走」)。
docs/claude/domain-capabilities.md 與 FE docs/claude/frontend-overview.md §4。三擇一、預設不新增:reuse → extend 加參數 → 兩邊都確認沒有才新增。既有的是 stub/壞掉 → 修它或回報,不另寫繞過。回寫列出本卡 reuse 了哪些、新增了哪些、為什麼不能 reuse。if source == ... 分支。紅旗:複製一段既有函式改兩行、開 XxxV2/XxxForAgent、同一行為兩條路徑各自演化——出現就停下先抽共用。回寫列出哪些 extend 了既有的、哪些 new 及為什麼不能 extend。api//app//infra//scripts/sql/ 時 .claude/rules/security/ 八支自動載入(總覽 docs/claude/secure-coding-rules.md);FE 規則在 FE repo .claude/rules/security/frontend.md;Agent 與套件 repo 沒有自動載入,動手前讀 BE 的八支。本案特別要守:四種登入失敗同一回應、body 上限、subprocess 不經 shell、CERT_NONE 禁用、新表 RLS、argon2id 不回雜湊、密碼欄進遮罩。design §5.7 與討論稿 §13.6 有逐條對照。回寫列出本卡對到哪幾條、怎麼滿足。core/console/routes.py(owner P1-4)、core/enroll.py(owner P1-3)、console/Shell.vue 與 i18n key(owner P1-7a)、core/plugins/remote_agent.py 的 _ADMIN_CAPABILITIES(owner P1-1)。本卡若不是 owner,只填自己的檔,不往登記檔加行;發現 owner 沒佔到位,回寫說明、不自己加。