From a69b246c57c34cc6bf1ba3a192db281a6ec6eca9 Mon Sep 17 00:00:00 2001 From: hmo Date: Tue, 21 Jul 2026 01:17:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(guard):=20=E9=83=A8=E7=BD=B2=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E6=80=A7=E5=AE=88=E5=8D=AB=20deploy=5Fguard.py=20+=20?= =?UTF-8?q?=E7=9F=A5=E5=BE=AE=E8=BF=90=E7=BB=B4=E7=BA=AA=E5=BE=8B=20+=20?= =?UTF-8?q?=E5=81=A5=E5=BA=B7JSON=E7=A7=BB=E5=87=BA=E8=B7=9F=E8=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - deploy_guard.py (15min cron): 代码漂移自动回滚(仅未提交改动)+ session-work可快进时自动merge部署+幂等重链+cron引用完整性, 状态落盘JSON, 有动作即XMPP报备 - docs/zhiwei-ops-discipline.md: 知微纪律——禁止直接编辑被跟踪代码/ 禁stale提交/禁直调gateway批量LLM; 自愈白名单(rerun/restart/ sync/switch_key)本不改代码, 与纪律不矛盾; 紧急热修走git流程, 提交到session-work后guard 15min自动部署 - dev-spec 红线#6 补充部署守卫机制 - static/mofin_health.json 移出git跟踪(运行时产物, 常驻dirty 会废掉漂移检测) --- .gitignore | 2 + deploy/profile-scripts/deploy_guard.py | 197 ++ docs/dev-spec.md | 1 + docs/zhiwei-ops-discipline.md | 64 + static/mofin_health.json | 3046 ------------------------ 5 files changed, 264 insertions(+), 3046 deletions(-) create mode 100644 deploy/profile-scripts/deploy_guard.py create mode 100644 docs/zhiwei-ops-discipline.md delete mode 100644 static/mofin_health.json diff --git a/.gitignore b/.gitignore index b1357d66..bc7db9e6 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ data/stock_analysis.db gateway/logs/ gateway/temp/ index.html + +static/mofin_health.json diff --git a/deploy/profile-scripts/deploy_guard.py b/deploy/profile-scripts/deploy_guard.py new file mode 100644 index 00000000..9945e8b5 --- /dev/null +++ b/deploy/profile-scripts/deploy_guard.py @@ -0,0 +1,197 @@ +#!/usr/bin/env python3 +"""deploy_guard.py — 部署一致性守卫(每 15 分钟 cron,全天候) + +原则:实际部署的脚本 = MoFin git 最新版代码。 + +五件事: +1. 代码漂移检测:git 工作区中【被跟踪的代码文件】出现未提交改动 + → 自动 git checkout 回滚 + 重链硬链接 + XMPP 告警 + (只回滚未提交的工作区改动;git 提交永远安全) +2. 上游自动部署:session-work 分支领先 master 且可快进 + → 自动 merge + 重链 + 必要时重启 dashboard + 告警 +3. 硬链接一致性:幂等执行 sync_profile_scripts.sh +4. cron 引用完整性:jobs.json 引用的脚本必须存在 +5. 状态落盘:gateway/logs/deploy_guard_status.json + deploy_guard.log + (有动作/有问题才发 XMPP,沉默即正常) +""" +import json, os, subprocess, sys, glob +from datetime import datetime + +REPO = "/home/hmo/MoFin" +CANONICAL = f"{REPO}/deploy/profile-scripts" +PROFILE_DIRS = [ + "/home/hmo/.hermes/profiles/position-analyst/scripts", + "/home/hmo/.hermes/profiles/default/scripts", +] +LOG = f"{REPO}/gateway/logs/deploy_guard.log" +STATUS_JSON = f"{REPO}/gateway/logs/deploy_guard_status.json" +SYNC_SCRIPT = f"{CANONICAL}/sync_profile_scripts.sh" + +# 守卫范围:被 git 跟踪的【代码】路径(运行时产物 data/ logs/ static/*.json 不在其列) +CODE_PATHS = [ + "deploy/profile-scripts", "deploy/bot", "prompt_manager", + "server.py", "mofin_db.py", "strategy_lifecycle.py", "xmpp_logger.py", + "mo_config.py", "scripts/mo_data.py", + "static/index.html", "static/mofin_health.html", +] + +actions = [] # 采取了的动作(需告警) +problems = [] # 发现的问题(需告警) + + +def log(msg): + line = f"[{datetime.now().isoformat(timespec='seconds')}] {msg}" + print(line, flush=True) + try: + os.makedirs(os.path.dirname(LOG), exist_ok=True) + with open(LOG, "a", encoding="utf-8") as f: + f.write(line + "\n") + except Exception: + pass + + +def xmpp(msg): + try: + import urllib.request + req = urllib.request.Request( + "http://127.0.0.1:5805/", + data=json.dumps({"body": msg, "to": "hmo@yoin.fun", "type": "chat"}).encode(), + headers={"Content-Type": "application/json"}) + urllib.request.urlopen(req, timeout=5) + except Exception as e: + log(f"XMPP发送失败: {e}") + + +def git(*args, check=True): + r = subprocess.run(["git", "-C", REPO] + list(args), + capture_output=True, text=True, timeout=60) + if check and r.returncode != 0: + raise RuntimeError(f"git {' '.join(args)}: {r.stderr.strip()[:200]}") + return r.stdout.strip() + + +# ── 1. 代码漂移检测与回滚 ── +def check_code_drift(): + out = git("status", "--porcelain", "--", *CODE_PATHS) + if not out: + return + modified, untracked = [], [] + for line in out.splitlines(): + status, path = line[:2], line[3:].strip() + if status == "??": + untracked.append(path) + else: + modified.append(path) + if modified: + diff_stat = git("diff", "--stat", "--", *modified, check=False) + log(f"DRIFT: 检测到 {len(modified)} 个代码文件未入库改动: {modified}") + for f in modified: + git("checkout", "--", f) + subprocess.run(["bash", SYNC_SCRIPT], capture_output=True, timeout=120) + actions.append(f"回滚未入库代码改动 {len(modified)} 个: {', '.join(modified[:5])}" + + (f" 等(共{len(modified)}个)" if len(modified) > 5 else "")) + log(f"DRIFT_REVERTED: {modified}\n{diff_stat[:500]}") + if untracked: + # 未跟踪的新文件:不删(可能是在途工作),只告警 + problems.append(f"权威目录出现未跟踪文件(需人工确认): {', '.join(untracked[:5])}") + log(f"UNTRACKED: {untracked}") + + +# ── 2. session-work → master 自动部署 ── +def check_upstream_deploy(): + try: + git("rev-parse", "--verify", "session-work") + except Exception: + return # 无此分支 + ahead = git("rev-list", "--count", "master..session-work", check=False) + if not ahead.isdigit() or int(ahead) == 0: + return + # 仅当可快进(master 是 session-work 祖先)才自动合并 + r = subprocess.run(["git", "-C", REPO, "merge-base", "--is-ancestor", "master", "session-work"]) + if r.returncode != 0: + problems.append(f"session-work 领先 master {ahead} 个提交但存在分叉,需人工合并") + log(f"UPSTREAM_DIVERGED: ahead={ahead}") + return + log(f"UPSTREAM: session-work 领先 {ahead} 个提交,自动合并部署") + merge_out = git("merge", "session-work", "--no-edit") + sync_out = subprocess.run(["bash", SYNC_SCRIPT], capture_output=True, text=True, timeout=120) + # 触及 dashboard 代码则重启 + touched = git("diff", "--name-only", f"HEAD~{ahead}", "HEAD", check=False) + restarted = "" + if any(t.startswith(("server.py", "static/")) for t in touched.splitlines()): + rr = subprocess.run(["sudo", "-n", "systemctl", "restart", "mofin-dashboard"], + capture_output=True, text=True, timeout=30) + restarted = " + dashboard已重启" if rr.returncode == 0 else " (dashboard重启失败,需人工)" + actions.append(f"自动部署 session-work→master ({ahead}个提交){restarted}") + log(f"UPSTREAM_DEPLOYED: {merge_out[:200]} | sync: {sync_out.stdout.strip()[-100:]}") + + +# ── 3. 硬链接一致性 ── +def check_hardlinks(): + r = subprocess.run(["bash", SYNC_SCRIPT], capture_output=True, text=True, timeout=120) + tail = (r.stdout or "").strip().splitlines() + if tail: + log(f"SYNC: {tail[-1]}") + if r.returncode != 0: + problems.append(f"sync_profile_scripts.sh 执行失败: {(r.stderr or '')[:150]}") + + +# ── 4. cron 引用完整性 ── +def check_cron_refs(): + missing = [] + for pj in glob.glob("/home/hmo/.hermes/profiles/*/cron/jobs.json"): + profile = pj.split("/")[-3] + try: + with open(pj, encoding="utf-8") as f: + jobs = json.load(f) + jobs = jobs if isinstance(jobs, list) else jobs.get("jobs", []) + except Exception: + continue + for j in jobs: + if not j.get("enabled", True): + continue + script = j.get("script") or "" + if not script: + continue + base = os.path.basename(script) + if not any(os.path.exists(os.path.join(d, base)) for d in PROFILE_DIRS + [CANONICAL]): + missing.append(f"[{profile}]{j.get('name','?')}→{base}") + if missing: + problems.append(f"cron引用缺失脚本 {len(missing)} 个: {', '.join(missing[:5])}") + log(f"CRON_MISSING: {missing}") + + +def main(): + log("── deploy_guard 开始 ──") + for fn in (check_code_drift, check_upstream_deploy, check_hardlinks, check_cron_refs): + try: + fn() + except Exception as e: + problems.append(f"{fn.__name__} 异常: {str(e)[:150]}") + log(f"ERROR in {fn.__name__}: {e}") + + status = { + "ts": datetime.now().isoformat(timespec="seconds"), + "ok": not problems, + "actions": actions, + "problems": problems, + } + try: + with open(STATUS_JSON, "w", encoding="utf-8") as f: + json.dump(status, f, ensure_ascii=False, indent=1) + except Exception: + pass + + if actions or problems: + msg = "🛡️ 部署守卫\n" + for a in actions: + msg += f"✅ {a}\n" + for p in problems: + msg += f"⚠️ {p}\n" + xmpp(msg.strip()) + log(f"── 结束: actions={len(actions)} problems={len(problems)} ──") + return 0 if not problems else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/docs/dev-spec.md b/docs/dev-spec.md index 4a67e487..a2a2ef62 100644 --- a/docs/dev-spec.md +++ b/docs/dev-spec.md @@ -18,6 +18,7 @@ - **git hooks**(`.git/hooks/post-merge` + `post-checkout`):git 操作后自动重链 - **手动兜底**:`bash deploy/profile-scripts/sync_profile_scripts.sh`(改完文件随手跑) - 同步日志:`gateway/logs/link_sync.log`;断链检测同时是 L2 卫生审计的检查项 + - **部署守卫**(`deploy_guard.py`,每 15 分钟全天候):①被跟踪代码文件出现未提交改动 → 自动回滚+重链+告警(git 提交不受影响)②`session-work` 领先 master 且可快进 → 自动 merge+重链+(触及 dashboard 时)重启服务 ③幂等重链 ④cron 引用完整性检查。状态落盘 `gateway/logs/deploy_guard_status.json`,有动作即 XMPP 报备。**禁止直接编辑 246 上任何被跟踪的代码文件**——所有改动必须经 git(详见 `docs/zhiwei-ops-discipline.md`) 7. **数据路径必须绝对** — 引用数据文件/数据库时,必须写绝对路径并指向权威位置(`/home/hmo/MoFin/data/`)。**禁止**用 `Path(__file__).parent / "data"` 这类相对解析——同一个模块被硬链接到不同位置时会解析出不同的数据库(2026-07-20 三库事件的根因) 8. **备份/遗留物禁止留在生产数据目录** — `.bak`、`decisions_backup_*`、迁移残留 JSON、废弃 DB,必须在迁移/变更完成时移到 `archive/`。生产数据目录(`MoFin/data` = `web-dashboard/data`)只放活文件。监控脚本扫描生产目录时,遗留物就是未来的假警报 9. **死模块必须收尸** — 宣布模块废弃时,必须在同一轮操作中完成收尸六步:①杀进程 ②stop+disable systemd 服务 ③删 cron job ④归档脚本到 `archive/` ⑤归档数据文件 ⑥从期望矩阵/监控中移除。只说"已废弃"不收尸 = 没废弃(小果 bot 以 root 白跑 8 天 2.5GB 的教训) diff --git a/docs/zhiwei-ops-discipline.md b/docs/zhiwei-ops-discipline.md new file mode 100644 index 00000000..e3f46fc4 --- /dev/null +++ b/docs/zhiwei-ops-discipline.md @@ -0,0 +1,64 @@ +# 知微运维纪律(2026-07-21 生效) + +> 由小小莫(Sisyphus)与老爸共同制定。核心原则:**实际部署的脚本 = MoFin git 最新版代码**。 +> 违反本纪律的改动会被 `deploy_guard.py`(每 15 分钟)自动回滚并告警。 + +--- + +## 一、绝对禁止 + +1. **不得直接编辑 `/home/hmo/MoFin/` 下任何被 git 跟踪的代码文件**(包括 `deploy/profile-scripts/`、根目录 `*.py`、`server.py`、`static/*.html`、`prompt_manager/`)。部署守卫每 15 分钟扫描,**未提交的工作区改动一律自动 `git checkout` 回滚**,并通过 XMPP 告警 +2. **不得直接编辑 `/home/hmo/.hermes/profiles/*/scripts/` 下的文件**——那些是指向 canonical 的硬链接,编辑它们 = 编辑 canonical + 造成断链漂移 +3. **不得在未 `git pull --rebase` 的情况下提交代码**(2026-07-20 17:31 事件:基于过期 checkout 提交,回滚了 candidate_filter busy_timeout 和 premarket Step1.5 两处修复) +4. **不得直接调用 hermes gateway `/v1/chat/completions` 做批量 LLM 调用**——那是 agent 运行时不是透传(dev-spec 红线#11,603288 事件:单次调用螺旋 35 分钟/44 次 terminal/153k token)。批量调用一律用 `llm_client.call_llm()`(OCG 直连) + +## 二、自愈系统如何在纪律下运作(不矛盾) + +L3 自愈(self_repair.py)的动作白名单**本来就不改代码**,guard 不会干预: + +| 白名单动作 | 性质 | guard 态度 | +|---|---|---| +| `rerun_script` | 重跑脚本 | ✅ 允许 | +| `restart_service` | 重启 systemd 服务 | ✅ 允许 | +| `sync_links` | 重链硬链接 | ✅ 允许(与 guard 同向) | +| `switch_llm_key` | 切换 LLM key(改 hermes config,非 MoFin repo) | ✅ 允许 | +| `none`(只报告) | 报备 | ✅ 允许 | + +**key 切换、服务重启、任务重跑、硬链修复——自愈能做的一切都不需要碰代码。** + +## 三、当判断"需要改代码"时 + +### 路径 A(首选):kanban 提单给小小莫 +描述问题+证据+建议方案,小小莫处理。适用于一切非紧急情况。 + +### 路径 B(紧急热修):走 git 正规流程 +``` +cd /home/hmo/MoFin +git pull --rebase # 必须第一步!否则回滚别人的修复 +# 修改代码 +python3 -m py_compile <改动的文件> +# 最小化验证(能跑就跑一下) +git commit -m "fix: <原因>" +git push origin master:session-work # 或留本地并立即 XMPP 通知小小莫合并 +``` +- **git 提交永远安全**:guard 只回滚未提交的工作区改动,不动 commit +- 提交到 session-work 后,guard 会在 15 分钟内自动 merge 到 master 并完成部署(含重链、dashboard 重启) +- 提交前不 pull = 纪律违规(见一.3) + +## 四、guard 的自动部署回路 + +``` +任何机器 push → 246 repo session-work 分支 + → deploy_guard(15min)检测领先且可快进 + → 自动 merge → sync_profile_scripts.sh 重链 + → 触及 server.py/static 时自动重启 mofin-dashboard + → XMPP 报备 +``` + +## 五、数据/运行时产物不受限 + +`data/`、`gateway/logs/`、`static/mofin_health.json` 等运行时产物不在守卫范围,正常读写无碍。 + +--- + +*依据:dev-spec 十条红线 + 2026-07-20 stale 提交事件 + 2026-07-21 gateway agent 螺旋事件* diff --git a/static/mofin_health.json b/static/mofin_health.json deleted file mode 100644 index 46ce2f4d..00000000 --- a/static/mofin_health.json +++ /dev/null @@ -1,3046 +0,0 @@ -{ - "generated_at": "2026-07-20 22:00:13", - "feature_tree": { - "label": "MoFin 系统", - "status": "ok", - "children": [ - { - "label": "数据采集", - "status": "ok", - "children": [ - { - "label": "市场快照", - "status": "ok", - "desc": "每10分钟采集全市场板块和指数快照", - "pipes": [ - { - "name": "市场数据采集", - "script": "market_watch.py", - "schedule": "*/10 9-11,13-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:50", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "宏观新闻", - "status": "ok", - "desc": "采集宏观新闻和财经资讯" - }, - { - "label": "价格监控", - "status": "ok", - "desc": "每2分钟刷新持仓/自选实时价格→写入live_prices", - "pipes": [ - { - "name": "价格监控-高频", - "script": "price_monitor.py", - "schedule": "*/2 9-16 * * 1-5", - "status": "error", - "last_run": "2026-07-20T16:59", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "小果扫描", - "status": "ok", - "desc": "小果独立扫描潜在机会" - }, - { - "label": "资金流采集", - "status": "ok", - "desc": "盘中采集板块资金流向", - "pipes": [ - { - "name": "资金流采集-盘中", - "script": "capital_flow_collector.py", - "schedule": "1,31 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:32", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "宏观上下文刷新", - "status": "ok", - "desc": "刷新大盘指数/市场情绪", - "pipes": [ - { - "name": "宏观上下文刷新-每30分", - "script": "refresh_macro_context.py", - "schedule": "*/30 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:31", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "宏观新闻采集 (macro_context_collector.py)", - "desc": "采集宏观新闻", - "status": "ok", - "pipes": [ - { - "name": "宏观新闻采集", - "script": "macro_context_collector.py", - "schedule": "*/30 8-16 * * *", - "status": "ok", - "last_run": "2026-07-20T16:30", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ], - "desc": "从腾讯/东财/小果采集原始行情、新闻、资金流数据" - }, - { - "label": "策略分析", - "status": "ok", - "children": [ - { - "label": "策略重评", - "status": "ok", - "desc": "价格偏离买入区或策略过期时自动重评" - }, - { - "label": "持仓自选新鲜度检查", - "status": "ok", - "desc": "检查策略是否过期或价格严重偏离", - "pipes": [ - { - "name": "策略时效性检查(日)", - "script": "strategy-staleness-check.py", - "schedule": "0 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-14T09:40", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "自选买入区提醒", - "status": "ok", - "desc": "自选进入买入区时推送提醒", - "pipes": [ - { - "name": "自选买入区提醒-盘前午间尾盘", - "script": "per_stock_reassess.py", - "schedule": "0 12,15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:02", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "策略评估", - "status": "ok", - "desc": "每日/每周策略效果评估", - "pipes": [ - { - "name": "策略评估-每周", - "script": "strategy_evaluator.py", - "schedule": "0 21 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45", - "type": "no_agent", - "profile": "position-analyst" - }, - { - "name": "策略评估-每日", - "script": "stale_detector.py", - "schedule": "0 21 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:17", - "type": "LLM", - "profile": "position-analyst" - }, - { - "name": "数据采集-策略评估前", - "script": "collect_evaluation_data.py", - "schedule": "30 20 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T20:30", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "分支自成长", - "status": "ok", - "desc": "策略分支探索和剪枝", - "pipes": [ - { - "name": "分支自成长-盘中", - "script": "branch_scanner.py", - "schedule": "15,30,45,00 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "元自成长", - "status": "ok", - "desc": "系统元层级自我进化", - "pipes": [ - { - "name": "元自成长-每日", - "script": "meta_growth.py", - "schedule": "45 0,12 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T12:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "分支剪枝-每日 (prune_branches.py)", - "desc": "修剪已失效的策略分支", - "status": "ok", - "pipes": [ - { - "name": "分支剪枝-每日", - "script": "prune_branches.py", - "schedule": "0 21 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:00", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "自选股自动重评-周末 (stale_detector.py)", - "desc": "周末批量重评自选股策略", - "status": "ok", - "pipes": [ - { - "name": "自选股自动重评-周末", - "script": "stale_detector.py", - "schedule": "30 10 * * 0,6", - "status": "ok", - "last_run": "2026-07-20T20:47", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "盘前全量重评-自选退出 (premarket_full_review.py)", - "desc": "", - "status": "error", - "pipes": [ - { - "name": "盘前全量重评-自选退出", - "script": "premarket_full_review.py", - "schedule": "10 8 * * 1-5", - "status": "error", - "last_run": "2026-07-20T08:12", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ], - "desc": "策略评估、新鲜度检查、重评和成长分析" - }, - { - "label": "推荐推送", - "status": "ok", - "children": [ - { - "label": "MoFin盘前中监控", - "status": "ok", - "desc": "上午盘中实时监控+推送" - }, - { - "label": "MoFin午后监控", - "status": "ok", - "desc": "下午盘中实时监控+推送" - }, - { - "label": "cron报告推XMPP", - "status": "ok", - "desc": "cron报告通过XMPP推送到手机", - "pipes": [ - { - "name": "cron报告推XMPP-每5分", - "script": "cron_to_xmpp.py", - "schedule": "*/5 9-16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:55", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "开盘简报", - "status": "ok", - "desc": "每日开盘前市场简报", - "pipes": [ - { - "name": "开盘简报", - "script": "opening_brief.py", - "schedule": "35 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-17T09:49", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "收盘简报", - "status": "ok", - "desc": "每日收盘后市场简报", - "pipes": [ - { - "name": "收盘简报", - "script": "closing_brief.py", - "schedule": "10 16 * * 1-5", - "status": "ok", - "last_run": "2026-07-17T16:21", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "市场精选推荐", - "status": "ok", - "desc": "每日全市场潜力股精推", - "pipes": [ - { - "name": "市场精选推荐-每日", - "script": null, - "schedule": "0 16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:09", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "系统健康检查-开盘前 (system_health_check.py)", - "desc": "开盘前检查所有核心组件是否正常", - "status": "ok", - "pipes": [ - { - "name": "系统健康检查-开盘前", - "script": "system_health_check.py", - "schedule": "0 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T10:38", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "MoFin 系统常规体检-开盘前 (morning_health_check.py)", - "desc": "开盘前8:00全面系统体检", - "status": "ok", - "pipes": [ - { - "name": "MoFin 系统常规体检-开盘前", - "script": "morning_health_check.py", - "schedule": "0 8 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T08:01", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "开盘前钉对钉验证 (preflight_verify.py)", - "desc": "开盘前15项验证(脚本同步/DB完整性/资产公式)", - "status": "ok", - "pipes": [ - { - "name": "开盘前钉对钉验证", - "script": "preflight_verify.py", - "schedule": "30 8 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T08:30", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "cron-推XMPP中继 (cron_to_xmpp.py)", - "desc": "将cron输出通过XMPP中继推送", - "status": "ok", - "pipes": [ - { - "name": "cron-推XMPP中继", - "script": "cron_to_xmpp.py", - "schedule": "* 9-16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:59", - "type": "no_agent", - "profile": "default" - } - ] - } - ], - "desc": "生成简报、推荐并推送到XMPP" - }, - { - "label": "风险监控", - "status": "ok", - "children": [ - { - "label": "宏观风险扫描", - "status": "ok", - "desc": "从新闻中检测系统性风险", - "pipes": [ - { - "name": "宏观风险扫描", - "script": null, - "schedule": "30 8 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T08:43", - "type": "LLM", - "profile": "position-analyst" - }, - { - "name": "宏观风险扫描-午间", - "script": null, - "schedule": "30 11 * * 1-5", - "status": "ok", - "last_run": "2026-07-17T11:37", - "type": "LLM", - "profile": "position-analyst" - }, - { - "name": "宏观风险扫描-周末", - "script": null, - "schedule": "0 10 * * 0,6", - "status": "ok", - "last_run": "2026-07-19T10:11", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "宏观风险信号消费", - "status": "ok", - "desc": "消费宏观风险信号并生成建议", - "pipes": [ - { - "name": "宏观风险信号消费", - "script": "macro_signal_consumer.py", - "schedule": "5,20,35,50 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:50", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "跨市场背离检测", - "status": "ok", - "desc": "检测A股/港股/美股指数背离", - "pipes": [ - { - "name": "跨市场背离检测", - "script": "divergence_detector.py", - "schedule": "*/30 8-15 * * *", - "status": "ok", - "last_run": "2026-07-20T15:31", - "type": "no_agent", - "profile": "position-analyst" - }, - { - "name": "跨市场背离检测-周末", - "script": "divergence_detector.py", - "schedule": "30 8-16/2 * * 0,6", - "status": "ok", - "last_run": "2026-07-20T20:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ], - "desc": "宏观风险信号、跨市场背离检测" - }, - { - "label": "自检/审计", - "status": "ok", - "children": [ - { - "label": "系统全局审计", - "status": "ok", - "desc": "7维度系统全面审计", - "pipes": [ - { - "name": "系统全局审计", - "script": "system_audit.py", - "schedule": "30 17 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T17:39", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "全局cron健康监控", - "status": "ok", - "desc": "监控所有cron的运行状态" - }, - { - "label": "重评管道审计", - "status": "ok", - "desc": "审计策略重评管道完整性", - "pipes": [ - { - "name": "重评管道审计-每30分", - "script": "verify_reassess_pipeline.py", - "schedule": "*/30 9-16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:30", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "健康监控数据采集", - "status": "ok", - "desc": "采集健康数据供Dashboard展示", - "pipes": [ - { - "name": "健康监控数据采集-每15分", - "script": "mofin_health.py", - "schedule": "*/15 9-16,20-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "硬编码扫描-每日 (hardcode_scanner.py)", - "desc": "扫描脚本中的硬编码参数", - "status": "ok", - "pipes": [ - { - "name": "硬编码扫描-每日", - "script": "hardcode_scanner.py", - "schedule": "25 17 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T17:26", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "盘中自检-高频 (intraday_health_check.py)", - "desc": "每15分钟盘中自检", - "status": "ok", - "pipes": [ - { - "name": "盘中自检-高频", - "script": "intraday_health_check.py", - "schedule": "*/15 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "数据治理-每周 (data_governance.py)", - "desc": "每周数据治理", - "status": "ok", - "pipes": [ - { - "name": "数据治理-每周", - "script": "data_governance.py", - "schedule": "0 10 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "记忆守卫-每日 (memory_guardian.py)", - "desc": "每日记忆优化", - "status": "ok", - "pipes": [ - { - "name": "记忆守卫-每日", - "script": "memory_guardian.py", - "schedule": "0 7 * * *", - "status": "ok", - "last_run": "2026-07-20T07:02", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ], - "desc": "系统健康检查、监控采集、审计" - }, - { - "label": "执行/修复", - "status": "ok", - "children": [ - { - "label": "自愈执行器", - "status": "ok", - "desc": "每10分钟自动处理TODO列表", - "pipes": [ - { - "name": "自愈执行器-TODO自动处理", - "script": "self_todo_executor.py", - "schedule": "*/10 8-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:50", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "策略质量门禁", - "status": "ok", - "desc": "新策略必须通过9维验证才能写入", - "pipes": [ - { - "name": "策略质量门禁-重评跟进", - "script": "review_needed_watchdog.py", - "schedule": "0,30 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:30", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "自选自动清理", - "status": "ok", - "desc": "开盘前清理过期自选数据", - "pipes": [ - { - "name": "自选自动清理-开盘前", - "script": "clean_watchlist.py", - "schedule": "5 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T09:06", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "建议对账", - "status": "ok", - "desc": "每周对账校验建议准确性", - "pipes": [ - { - "name": "建议对账-每周", - "script": "advice_reconciliation.py", - "schedule": "0 20 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ], - "desc": "自愈系统、门禁跟进、清理修复" - }, - { - "label": "持仓复查", - "status": "ok", - "children": [ - { - "label": "持仓基本面复查", - "status": "ok", - "desc": "每周持仓基本面深度复查", - "pipes": [ - { - "name": "分析师-持仓复查", - "script": "prepare_report_data.py", - "schedule": "0 20 * * 4", - "status": "ok", - "last_run": "2026-07-16T20:14", - "type": "LLM", - "profile": "position-analyst" - } - ] - }, - { - "label": "策略复盘", - "status": "ok", - "desc": "每日策略执行复盘", - "pipes": [ - { - "name": "策略复盘-每日", - "script": "strategy_review.py", - "schedule": "0 20 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T20:00", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ], - "desc": "持仓基本面复查和策略复盘" - }, - { - "label": "信号消费", - "status": "ok", - "children": [ - { - "label": "小果情感分析", - "status": "ok", - "desc": "收盘后对持仓/自选做新闻情感分析" - }, - { - "label": "宏观风险信号消费-盘中", - "status": "ok", - "desc": "盘中消费宏观风险信号" - } - ], - "desc": "消费小果情感分析和宏观风险信号" - }, - { - "label": "持仓监控", - "status": "ok", - "children": [ - { - "label": "300308入场信号紧盯 (monitor_300308.py)", - "desc": "300308入场信号(13:00-14:00)", - "status": "ok", - "pipes": [ - { - "name": "300308入场信号紧盯", - "script": "monitor_300308.py", - "schedule": "*/2 13-14 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T14:58", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "300308午后紧盯 (300308_monitor.py)", - "desc": "300308午后监控(13:00-15:00含止损)", - "status": "ok", - "pipes": [ - { - "name": "300308午后紧盯", - "script": "300308_monitor.py", - "schedule": "*/2 13-14 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T14:58", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "多周期缓存刷新-盘中 (refresh_mtf_cache.py)", - "desc": "盘中刷新技术指标缓存", - "status": "ok", - "pipes": [ - { - "name": "多周期缓存刷新-盘中", - "script": "refresh_mtf_cache.py", - "schedule": "0 9,11,14 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T14:02", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ] - }, - { - "label": "未分类", - "status": "ok", - "children": [ - { - "label": "知微洞察生成 (market_insight.py)", - "desc": "生成每日市场洞察(15:35)", - "status": "error", - "pipes": [ - { - "name": "知微洞察生成", - "script": "market_insight.py", - "schedule": "35 15 * * 1-5", - "status": "error", - "last_run": "2026-07-20T15:35", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "小果市场筛选-全市场 (market_screener.py)", - "desc": "小果筛选全市场关注板块", - "status": "ok", - "pipes": [ - { - "name": "小果市场筛选-全市场", - "script": "market_screener.py", - "schedule": "35 15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:35", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "主力建仓扫描-每15分 (accumulation_scanner.py)", - "desc": "", - "status": "ok", - "pipes": [ - { - "name": "主力建仓扫描-每15分", - "script": "accumulation_scanner.py", - "schedule": "*/10 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:50", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "候选股自动提拔-每30分 (promote_candidates.py)", - "desc": "", - "status": "error", - "pipes": [ - { - "name": "候选股自动提拔-每30分", - "script": "promote_candidates.py", - "schedule": "*/30 9-15 * * 1-5", - "status": "error", - "last_run": "2026-07-20T15:31", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "候选股过滤管道-每30分 (candidate_filter.py)", - "desc": "", - "status": "ok", - "pipes": [ - { - "name": "候选股过滤管道-每30分", - "script": "candidate_filter.py", - "schedule": "*/30 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:31", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "Gateway看门狗-知微 (fix_gateway_port.py)", - "desc": "", - "status": "ok", - "pipes": [ - { - "name": "Gateway看门狗-知微", - "script": "fix_gateway_port.py", - "schedule": "every 10m", - "status": "ok", - "last_run": "2026-07-20T21:55", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "系统卫生审计-每日 (system_hygiene_audit.py)", - "desc": "", - "status": null, - "pipes": [ - { - "name": "系统卫生审计-每日", - "script": "system_hygiene_audit.py", - "schedule": "20 8 * * *", - "status": null, - "last_run": "", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "功能健康检查-L1 (functional_health_check.py)", - "desc": "", - "status": "ok", - "pipes": [ - { - "name": "功能健康检查-L1", - "script": "functional_health_check.py", - "schedule": "*/15 9-16,20-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "LLM修复循环-L3 (self_repair.py)", - "desc": "", - "status": "ok", - "pipes": [ - { - "name": "LLM修复循环-L3", - "script": "self_repair.py", - "schedule": "*/30 9-16,20-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:30", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "元监控-自检系统的自检-L4 (meta_watchdog.py)", - "desc": "", - "status": "ok", - "pipes": [ - { - "name": "元监控-自检系统的自检-L4", - "script": "meta_watchdog.py", - "schedule": "5 * * * *", - "status": "ok", - "last_run": "2026-07-20T21:05", - "type": "no_agent", - "profile": "position-analyst" - } - ] - }, - { - "label": "数据同步-dashboard (sync_dashboard.py)", - "desc": "同步数据到Dashboard", - "status": "ok", - "pipes": [ - { - "name": "数据同步-dashboard", - "script": "sync_dashboard.py", - "schedule": "55 8 * * *", - "status": "ok", - "last_run": "2026-07-20T08:55", - "type": "no_agent", - "profile": "default" - } - ] - } - ] - }, - { - "label": "系统服务", - "status": "ok", - "children": [ - { - "label": "state.db真空整理-每周 (vacuum_state_db.py)", - "desc": "每周DB真空整理", - "status": "ok", - "pipes": [ - { - "name": "state.db真空整理-每周", - "script": "vacuum_state_db.py", - "schedule": "0 3 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45", - "type": "no_agent", - "profile": "position-analyst" - } - ] - } - ] - } - ] - }, - "entities": [ - { - "name": "accuracy_stats", - "desc": "建议准确率统计", - "rows": 1, - "readers": [ - "mofin_db" - ], - "writers": [ - "strategy_review" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "策略准确率统计表,strategy_review复盘后写入各策略的正确/错误/待定计数。", - "writers": { - "strategy_review": "策略复盘后更新准确率统计" - }, - "readers": { - "mofin_db": "读取统计结果用于报告" - } - } - }, - { - "name": "advice_timeline", - "desc": "建议执行时间线", - "rows": 12735, - "readers": [ - "mofin_db", - "advice_reconciliation" - ], - "writers": [ - "advice_reconciliation" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "建议时间线表,记录每条推送建议的时间/内容/状态。用于审计和对账。", - "writers": { - "advice_reconciliation": "每周对账时写入对账结果" - }, - "readers": { - "advice_reconciliation": "读取历史建议做对账", - "mofin_db": "内部查询" - } - } - }, - { - "name": "candidate_score_history", - "desc": "", - "rows": 133, - "readers": [ - "mofin_db" - ], - "writers": [ - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "候选股评分历史表,记录每次全市场筛选时对候选股的评分。用于评分变化追踪。", - "writers": { - "mofin_db": "market_screener筛选结果写入评分记录" - }, - "readers": { - "mofin_db": "查询评分历史供展示" - } - } - }, - { - "name": "candidates", - "desc": "潜力股候选池(小果扫描产出)", - "rows": 185, - "readers": [ - "candidate_filter", - "accumulation_scanner", - "mofin_db", - "promote_candidates" - ], - "writers": [ - "candidate_filter", - "market_scanner", - "accumulation_scanner", - "promote_candidates" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "候选股池表,market_screener筛选出的值得关注的个股。包含评分/买入区/止损/目标价。", - "writers": { - "mofin_db": "market_screener写入候选股", - "market_screener": "直接写入候选股列表" - }, - "readers": { - "mofin_db": "读取候选股数据供展示和后续处理" - } - } - }, - { - "name": "capital_flow_cache", - "desc": "资金流缓存", - "rows": 1, - "readers": [ - "merge_third_db", - "batch_reassess", - "per_stock_reassess", - "mofin_db" - ], - "writers": [ - "merge_third_db", - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "资金流向缓存表,capital_flow_collector采集的板块资金流入流出数据。", - "writers": { - "mofin_db": "写入板块资金流向数据" - }, - "readers": { - "mofin_db": "读取缓存数据" - } - } - }, - { - "name": "cash_log", - "desc": "资金变动记录", - "rows": 20, - "readers": [ - "mofin_db", - "prepare_report_data" - ], - "writers": [ - "mo_data", - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "资金流水表,每次资金变动(入金/出金/冻结/解冻)记录一条日志。审计用。", - "writers": { - "mofin_db": "通过write_cash_log记录资金变动", - "mo_data": "write_cash_log函数入口" - }, - "readers": { - "prepare_report_data": "读取现金变动历史用于报告", - "mofin_db": "内部查询最近流水" - } - } - }, - { - "name": "health_check_log", - "desc": "健康检查日志", - "rows": 20, - "readers": [ - "morning_health_check" - ], - "writers": [ - "morning_health_check" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "健康检查日志表,morning_health_check每次运行记录检查结果。用于追踪系统健康历史。", - "writers": { - "morning_health_check": "每日开盘前体检后写入检查结果" - }, - "readers": { - "morning_health_check": "读取历史检查结果比较变化" - } - } - }, - { - "name": "holding_strategies", - "desc": "每只股票的完整策略参数", - "rows": 227, - "readers": [ - "mofin_db", - "per_stock_reassess", - "data_governance", - "verify_300308", - "mofin_collect", - "system_audit", - "verify_reassess_pipeline", - "accumulation_scanner", - "check_db_state", - "generate_report" - ], - "writers": [ - "mofin_db", - "per_stock_reassess", - "data_governance", - "promote_candidates", - "batch_reassess", - "sync_decisions_to_db", - "watchlist_auto_exit" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "策略数据表,记录每只持仓/自选股的策略配置(买入价/止损/止盈/目标价/分析维度等)。多写入方按各自职责更新不同字段。", - "writers": { - "data_governance": "归档过期策略、修复异常策略数据", - "sync_decisions_to_db": "从JSON同步策略到DB", - "mofin_db": "策略写入(内部函数)", - "strategy_review": "策略复盘后更新执行结果和评级" - }, - "readers": { - "data_governance": "读取所有活跃策略,检查缺失和异常", - "per_stock_reassess": "读取个股策略配置,判断是否需要重评", - "mo_data": "通过read_decisions()读取策略数据", - "stale_push_wlin": "读取买入区/止损/止盈配置,检查价格触发" - } - } - }, - { - "name": "holdings", - "desc": "当前持仓(权威源)", - "rows": 14, - "readers": [ - "mo_alphasift_bridge", - "mofin_db", - "per_stock_reassess", - "mofin_collect", - "prepare_recommendation", - "system_audit", - "accumulation_scanner", - "trend_detector", - "refresh_mtf_cache", - "import_holding_xls" - ], - "writers": [ - "import_holding_xls", - "mofin_db", - "price_monitor" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "当前持仓表,是系统最核心的数据表之一。import_holding_xls从券商文件导入持仓,mofin_db在价格刷新时更新市值。下游脚本读取持仓做策略分析和推送。", - "writers": { - "mofin_db": "写入price_monitor刷新后的持仓最新市值(通过write_holdings_batch)", - "import_holding_xls": "从券商holding.xls导入最新持仓数量/成本/市值" - }, - "readers": { - "stale_push_wlin": "读取持仓列表+最新价格,检查是否进入买入区/触发止损", - "mofin_db": "内部读取(get_price_from_db等函数)", - "system_audit": "读取持仓总数/品种分布,审计持仓完整性", - "server": "读取持仓数据供Web Dashboard展示", - "prepare_report_data": "读取持仓数据用于生成分析报告", - "mo_data": "通过read_portfolio()读取持仓结构化数据" - } - } - }, - { - "name": "live_prices", - "desc": "所有持仓+自选最新实时价", - "rows": 232, - "readers": [ - "candidate_filter", - "stale_push_wlin", - "mofin_db", - "generate_report", - "cron_health_monitor", - "system_audit", - "verify_reassess_pipeline", - "mo_data" - ], - "writers": [ - "mo_data", - "mofin_db", - "price_monitor" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "实时价格缓存表,price_monitor每2分钟写入全量持仓/自选价格。所有脚本必须通过mo_data.get_price()读取——先读此表,无数据才调API。单一写入、多方读取。", - "writers": { - "mofin_db": "price_monitor调用write_live_prices写入最新价格", - "mo_data": "get_price()兜底时从API拉取价格后写回此表" - }, - "readers": { - "mo_data": "get_price()/get_prices_batch()优先从此表读取价格", - "mofin_db": "内部读取(get_price_from_db)", - "system_audit": "读取价格更新时间和数据量", - "verify_reassess_pipeline": "验证重评管道是否有最新价格" - } - } - }, - { - "name": "macro_context_log", - "desc": "宏观上下文(大盘偏向/指数)", - "rows": 81, - "readers": [ - "stale_push_wlin", - "per_stock_reassess", - "system_audit", - "stock_profile", - "batch_reassess", - "divergence_detector", - "xiaoguo_signal_consumer", - "strategy_lifecycle", - "strategy_tree" - ], - "writers": [ - "refresh_macro_context" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "宏观上下文日志,refresh_macro_context每30分钟采集大盘指数/市场情绪/资金面数据。下游多个脚本按需读取最新宏观状态。", - "writers": { - "refresh_macro_context": "每30分钟采集上证/深证/创业板/恒指等指数+情绪指标" - }, - "readers": { - "stale_push_wlin": "读取大盘情绪用于策略推送的宏观背景", - "divergence_detector": "读取多市场指数数据做背离检测", - "system_audit": "审计数据采集是否正常", - "xiaoguo_signal_consumer": "读取宏观情绪辅助信号判定" - } - } - }, - { - "name": "macro_raw_news", - "desc": "宏观新闻原始数据", - "rows": 17383, - "readers": [ - "system_audit", - "macro_context_collector" - ], - "writers": [ - "macro_context_collector" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "宏观新闻原始数据表,macro_context_collector采集的未经处理的财经新闻。供后续清洗和分析。", - "writers": { - "macro_context_collector": "从财经网站采集原始新闻标题+URL+摘要" - }, - "readers": { - "macro_context_collector": "读取最近新闻hash避免重复采集", - "system_audit": "审计新闻采集量" - } - } - }, - { - "name": "market_snapshots", - "desc": "大盘指数快照(每10分)", - "rows": 989, - "readers": [ - "mofin_db", - "mofin_query", - "trend_detector", - "merge_third_db", - "system_audit", - "market_scanner", - "prepare_report_data", - "market_screener" - ], - "writers": [ - "merge_third_db", - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "市场快照表,market_watch每10分钟采集全市场大盘指数+板块涨跌+上涨下跌家数。下游用于判断市场情绪。", - "writers": { - "mofin_db": "market_watch采集后写入快照数据" - }, - "readers": { - "market_screener": "读取最新板块快照,判断热点板块", - "prepare_report_data": "读取市场情绪数据用于报告", - "mofin_db": "内部查询最新快照", - "system_audit": "审计数据新鲜度" - } - } - }, - { - "name": "mtf_cache", - "desc": "多周期均线缓存", - "rows": 64, - "readers": [ - "multi_timeframe", - "technical_analysis", - "mofin_db" - ], - "writers": [ - "multi_timeframe", - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "多周期技术指标缓存,refresh_mtf_cache计算MA5/MA20/MA60/支撑阻力位等。下游技术分析脚本从缓存读取避免重复计算。", - "writers": { - "multi_timeframe": "计算并写入多周期MA/支撑阻力位", - "mofin_db": "内部写入函数" - }, - "readers": { - "multi_timeframe": "读取已有缓存判断是否需要刷新", - "technical_analysis": "读取MA/支撑阻力位用于技术分析", - "mofin_db": "内部读取" - } - } - }, - { - "name": "portfolio_summary", - "desc": "总资产/现金/仓位汇总", - "rows": 1, - "readers": [ - "check_db_state", - "mofin_db", - "price_monitor", - "import_holding_xls", - "mo_data", - "prepare_report_data", - "preflight_verify" - ], - "writers": [ - "import_holding_xls", - "mofin_db", - "price_monitor" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "组合汇总表(id=1单行),记录总资产=持股市值+可用资金+冻结资金。每笔导入或价格刷新后更新。", - "writers": { - "mofin_db": "价格监控刷新总市值后更新total_mv/total_assets", - "import_holding_xls": "导入持仓后更新cash/frozen/total_assets" - }, - "readers": { - "import_holding_xls": "读取当前汇总信息,验证导入后是否正确", - "mo_data": "通过read_portfolio()读取组合汇总", - "price_monitor": "读取当前现金/市值,计算总资产变动", - "prepare_report_data": "读取总资产/现金数据用于报告", - "server": "读取汇总数据供Dashboard展示" - } - } - }, - { - "name": "price_events", - "desc": "价格区间突破事件日志", - "rows": 6353, - "readers": [ - "mofin_db", - "test_raw_insert", - "backfill_price_events", - "test_db_write", - "test_db_only", - "test_dual_write", - "check_price_events" - ], - "writers": [ - "mofin_db", - "test_raw_insert", - "backfill_price_events", - "test_db_write", - "test_db_only", - "test_dual_write" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "价格触发事件表,价格进入/离开买入区或触发止损止盈时记录事件。用于审计和重评触发。", - "writers": { - "mofin_db": "price_monitor检测到价格区间变化时写入事件记录" - }, - "readers": { - "mofin_db": "查询历史事件判断是否触发重评" - } - } - }, - { - "name": "sector_signals", - "desc": "行业信号(趋势检测产出)", - "rows": 653, - "readers": [ - "server", - "mofin_news", - "xiaoguo_news_processor", - "trend_detector" - ], - "writers": [ - "mofin_news", - "xiaoguo_news_processor", - "trend_detector" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "板块信号表,多源汇聚的板块级别信号(新闻情感+趋势+资金流向)。用于判断行业轮动。", - "writers": { - "mofin_news": "写入新闻分析得出的板块信号", - "xiaoguo_news_processor": "写入小果LLM分析的板块情感信号", - "trend_detector": "写入技术面趋势检测到的板块信号" - }, - "readers": { - "server": "读取供Dashboard展示", - "mofin_news": "读取已有信号做增量更新", - "xiaoguo_news_processor": "读取已有信号避免重复写入", - "trend_detector": "读取信号辅助趋势判定" - } - } - }, - { - "name": "sector_snapshots", - "desc": "行业板块数据", - "rows": 68408, - "readers": [ - "mofin_db", - "trend_detector", - "merge_third_db", - "inspect_third_db", - "market_scanner", - "strategy_lifecycle", - "market_screener" - ], - "writers": [ - "merge_third_db", - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "板块快照表,market_watch按板块写入涨跌/领涨股/资金流向。market_screener据此判断行业热点。", - "writers": { - "mofin_db": "market_watch采集后写入各板块数据" - }, - "readers": { - "market_screener": "读取板块涨跌排名,筛选热点行业", - "strategy_lifecycle": "读取板块数据用于策略生命周期管理", - "mofin_db": "内部查询", - "trend_detector": "读取板块趋势数据用于趋势检测" - } - } - }, - { - "name": "signal_news", - "desc": "信号相关新闻", - "rows": 1287, - "readers": [ - "server", - "per_stock_reassess", - "system_audit", - "batch_reassess", - "intraday_health_check", - "xiaoguo_signal_consumer", - "macro_signal_consumer" - ], - "writers": [ - "mofin_news", - "divergence_detector", - "xiaoguo_signal_consumer", - "macro_context_collector", - "macro_signal_consumer", - "xiaoguo_news_processor", - "xiaoguo_scanner" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "全系统信号/新闻的统一存储表,所有宏观分析、风险扫描、小果分析的输出汇聚地,也是下游消费脚本的输入源。7个写入方汇聚不同来源信号,5个读取方按需消费。", - "writers": { - "macro_context_collector": "写入宏观新闻原始数据(标题+摘要+分类),供后续风险扫描消费", - "xiaoguo_news_processor": "写入小果LLM处理后的新闻情感分析结果", - "macro_signal_consumer": "写入宏观风险信号判定结果(等级+来源+建议)", - "divergence_detector": "写入跨市场背离检测信号(A股/港股/美股指数对)", - "xiaoguo_signal_consumer": "写入小果扫描发现的个股/板块信号", - "mofin_news": "写入外部财经常规新闻采集结果", - "xiaoguo_scanner": "写入小果独立扫描的市场机会信号" - }, - "readers": { - "macro_signal_consumer": "读取原始宏观新闻和信号,判定风险等级并生成建议", - "system_audit": "读取信号表行数/更新时间,审计数据管道是否畅通", - "intraday_health_check": "读取最新信号,检查盘中是否有新的风险信号到达", - "xiaoguo_signal_consumer": "读取小果相关信号,生成买入/卖出建议", - "server": "读取信号数据供Web Dashboard展示" - } - } - }, - { - "name": "state_meta", - "desc": "系统状态元数据", - "rows": 1, - "readers": [ - "xiaoguo_scanner" - ], - "writers": [ - "xiaoguo_scanner" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "状态元数据表,记录各服务的状态追踪信息(如扫描偏移量/最新处理ID)。", - "writers": { - "xiaoguo_scanner": "写入扫描进度偏移量" - }, - "readers": { - "xiaoguo_scanner": "读取上次处理位置继续增量处理" - } - } - }, - { - "name": "stock_daily", - "desc": "日线行情", - "rows": 11968, - "readers": [ - "mofin_db" - ], - "writers": [ - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": {} - }, - { - "name": "stock_fundamentals", - "desc": "基本面数据(PE/PB)", - "rows": 37, - "readers": [ - "strategy_lifecycle" - ], - "writers": [ - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "基本面数据表,存储PE/PB/ROE/市值等财务指标。", - "writers": { - "mofin_db": "基本面数据采集后写入" - }, - "readers": { - "strategy_lifecycle": "读取基本面数据用于策略评估" - } - } - }, - { - "name": "stock_monthly", - "desc": "月线行情", - "rows": 1096, - "readers": [ - "multi_timeframe" - ], - "writers": [ - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": {} - }, - { - "name": "stock_sectors", - "desc": "股票行业映射", - "rows": 64, - "readers": [ - "mofin_db", - "trend_detector", - "per_stock_reassess", - "mofin_news", - "strategy_lifecycle", - "xiaoguo_news_processor" - ], - "writers": [ - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "股票-板块映射表,记录每只股票所属行业板块。多脚本用于行业分类和板块归因。", - "writers": { - "mofin_db": "股票行业分类数据写入" - }, - "readers": { - "xiaoguo_news_processor": "按行业分类新闻", - "mofin_news": "按行业归类新闻", - "mofin_db": "内部查询", - "strategy_lifecycle": "读取行业信息用于策略决策" - } - } - }, - { - "name": "stock_weekly", - "desc": "周线行情", - "rows": 2082, - "readers": [ - "multi_timeframe" - ], - "writers": [ - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": {} - }, - { - "name": "stocks", - "desc": "全量股票代码", - "rows": 5575, - "readers": [ - "check_stocks_table", - "mofin_db", - "trend_detector", - "xiaoguo_news_processor", - "mofin_news", - "accumulation_scanner", - "import_full_stocks" - ], - "writers": [ - "import_full_stocks", - "backfill_price_events", - "mofin_db", - "price_monitor" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "全量股票代码表,所有A股/港股基础信息。供各脚本按code查询股票名称/市场。", - "writers": { - "mofin_db": "初始化时导入全量股票代码" - }, - "readers": { - "mofin_news": "按股票代码查找新闻", - "xiaoguo_news_processor": "按股票代码过滤新闻", - "mofin_db": "内部查询", - "trend_detector": "按股票代码获取数据" - } - } - }, - { - "name": "strategy_evaluations", - "desc": "策略重评历史记录", - "rows": 217, - "readers": [ - "mofin_db", - "verify_reassess_pipeline" - ], - "writers": [ - "mofin_collect" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "策略评估结果表,策略评估脚本每次运行记录评估得分/等级/评语。", - "writers": { - "mofin_collect": "策略评估前采集数据并写入评估结果" - }, - "readers": { - "verify_reassess_pipeline": "读取评估结果验证管道完整性", - "mofin_db": "内部查询", - "system_audit": "审计评估是否按时执行" - } - } - }, - { - "name": "strategy_feedback", - "desc": "策略效果反馈", - "rows": 222, - "readers": [ - "mofin_db" - ], - "writers": [ - "mofin_db", - "server" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "策略反馈表,记录用户对建议的反馈(采纳/忽略/修改)。用于策略自学习。", - "writers": { - "mofin_db": "写入反馈数据", - "server": "通过Web提交反馈后写入" - }, - "readers": { - "mofin_db": "读取反馈用于分析和展示" - } - } - }, - { - "name": "todos", - "desc": "自愈任务队列", - "rows": 96, - "readers": [ - "self_todo_executor", - "merge_third_db", - "morning_health_check", - "intraday_health_check", - "strategy-staleness-check" - ], - "writers": [ - "self_todo_executor", - "merge_third_db", - "cron_health_monitor", - "morning_health_check", - "mofin_collect", - "intraday_health_check", - "strategy-staleness-check", - "preflight_verify" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "待办事项表,各脚本发现异常时写入TODO,self_todo_executor每10分钟执行修复。异常发现→自动修复的闭环。", - "writers": { - "morning_health_check": "体检发现异常写入TODO", - "intraday_health_check": "盘中自检发现异常写入TODO", - "strategy-staleness-check": "策略过期检测写入TODO", - "self_todo_executor": "执行完成后更新TODO状态", - "preflight_verify": "开盘前验证失败写入TODO" - }, - "readers": { - "morning_health_check": "读取待处理的TODO", - "self_todo_executor": "读取待处理的TODO并执行fix_action", - "strategy-staleness-check": "读取TODO避免重复写入", - "intraday_health_check": "读取TODO检查自愈进度" - } - } - }, - { - "name": "watchlist_log", - "desc": "", - "rows": 51, - "readers": [ - "watchlist_auto_exit", - "mofin_db" - ], - "writers": [ - "watchlist_auto_exit" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": {} - }, - { - "name": "watchlist_stocks", - "desc": "自选股列表", - "rows": 69, - "readers": [ - "stale_push_wlin", - "mo_alphasift_bridge", - "mofin_db", - "run_all_tests", - "trend_detector", - "per_stock_reassess", - "stock_quote", - "mofin_collect", - "refresh_mtf_cache", - "xiaoguo_signal_consumer" - ], - "writers": [ - "per_stock_reassess", - "mofin_db" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "自选股表,系统自动维护的观察列表。与持仓表分离,用于跟踪潜在买入机会。", - "writers": { - "per_stock_reassess": "策略重评时更新自选状态", - "mofin_db": "内部写入函数" - }, - "readers": { - "per_stock_reassess": "读取自选列表做重评", - "stock_quote": "读取自选代码拉取行情", - "mo_alphasift_bridge": "读取自选供Alpha分析", - "mo_data": "通过read_watchlist()读取自选数据" - } - } - }, - { - "name": "xiaoguo_scan_tracker", - "desc": "小果扫描跟踪", - "rows": 527, - "readers": [ - "server", - "xiaoguo_scanner" - ], - "writers": [ - "xiaoguo_scanner" - ], - "has_input": true, - "has_output": true, - "orphan": false, - "flow_status": "healthy", - "warn": false, - "flow_detail": { - "summary": "小果扫描追踪表,记录每次小果扫描的状态/耗时/结果数量。用于监控小果服务健康。", - "writers": { - "xiaoguo_scanner": "每次扫描完成后写入状态和统计" - }, - "readers": { - "server": "读取扫描状态供Dashboard展示", - "xiaoguo_scanner": "读取上次扫描时间判断是否需要全量扫描" - } - } - } - ], - "json_files": [ - { - "name": "accuracy_stats.json", - "desc": "", - "size_kb": 7.3, - "readers": [], - "writers": [], - "last_modified": "07-06 11:32", - "warn": true, - "migrated_to_db": null - }, - { - "name": "candidate_pool.json", - "desc": "潜力股候选池完整数据", - "size_kb": 51.1, - "readers": [], - "writers": [], - "last_modified": "07-17 15:38", - "warn": true, - "migrated_to_db": null - }, - { - "name": "evaluation.json", - "desc": "", - "size_kb": 51.1, - "readers": [], - "writers": [], - "last_modified": "06-20 12:15", - "warn": true, - "migrated_to_db": null - }, - { - "name": "evaluation_input.json", - "desc": "", - "size_kb": 45.0, - "readers": [], - "writers": [], - "last_modified": "07-08 19:50", - "warn": true, - "migrated_to_db": null - }, - { - "name": "format_error_library.json", - "desc": "", - "size_kb": 0.1, - "readers": [], - "writers": [], - "last_modified": "07-12 03:15", - "warn": true, - "migrated_to_db": null - }, - { - "name": "growth_registry.json", - "desc": "", - "size_kb": 1.3, - "readers": [], - "writers": [], - "last_modified": "07-20 12:45", - "warn": true, - "migrated_to_db": null - }, - { - "name": "hardcode_audit.json", - "desc": "", - "size_kb": 3680.4, - "readers": [], - "writers": [], - "last_modified": "07-20 17:26", - "warn": true, - "migrated_to_db": null - }, - { - "name": "health_checklist.json", - "desc": "", - "size_kb": 12.2, - "readers": [], - "writers": [], - "last_modified": "07-20 08:00", - "warn": true, - "migrated_to_db": null - }, - { - "name": "macro_divergence_state.json", - "desc": "", - "size_kb": 0.3, - "readers": [], - "writers": [], - "last_modified": "07-20 20:45", - "warn": true, - "migrated_to_db": null - }, - { - "name": "macro_risk_state.json", - "desc": "宏观风险状态(采集器写入) (已迁移到DB表 macro_context_log,此为遗留文件)", - "size_kb": 0.8, - "readers": [], - "writers": [], - "last_modified": "07-20 16:30", - "warn": false, - "migrated_to_db": "macro_context_log" - }, - { - "name": "market.json", - "desc": "市场概况数据 (已迁移到DB表 market_snapshots,此为遗留文件)", - "size_kb": 0.2, - "readers": [], - "writers": [], - "last_modified": "07-20 17:23", - "warn": false, - "migrated_to_db": "market_snapshots" - }, - { - "name": "mofin_health.json", - "desc": "健康监控数据", - "size_kb": 89.6, - "readers": [ - "verify_deployment", - "verify_self_check_section", - "analyze_health", - "verify_health_json" - ], - "writers": [], - "last_modified": "07-20 21:45", - "warn": false, - "migrated_to_db": null - }, - { - "name": "pipeline_registry.json", - "desc": "", - "size_kb": 33.5, - "readers": [], - "writers": [], - "last_modified": "07-17 08:01", - "warn": true, - "migrated_to_db": null - }, - { - "name": "portfolio.json", - "desc": "持仓汇总(兼容层)", - "size_kb": 5.1, - "readers": [ - "get_realtime_prices" - ], - "writers": [], - "last_modified": "07-20 08:03", - "warn": false, - "migrated_to_db": null - }, - { - "name": "preflight_result.json", - "desc": "", - "size_kb": 2.2, - "readers": [], - "writers": [], - "last_modified": "07-20 08:30", - "warn": true, - "migrated_to_db": null - }, - { - "name": "price_history.json", - "desc": "(已迁移到DB表 price_events,此为遗留文件)", - "size_kb": 34.0, - "readers": [], - "writers": [], - "last_modified": "07-20 21:14", - "warn": false, - "migrated_to_db": "price_events" - }, - { - "name": "push_cooldown.json", - "desc": "", - "size_kb": 1.1, - "readers": [], - "writers": [], - "last_modified": "07-10 09:32", - "warn": true, - "migrated_to_db": null - }, - { - "name": "scanner_state.json", - "desc": "", - "size_kb": 0.1, - "readers": [], - "writers": [], - "last_modified": "07-20 15:45", - "warn": true, - "migrated_to_db": null - }, - { - "name": "strategy_staleness_report.json", - "desc": "策略过期报告", - "size_kb": 31.4, - "readers": [], - "writers": [], - "last_modified": "07-20 09:00", - "warn": true, - "migrated_to_db": null - }, - { - "name": "system_audit.json", - "desc": "", - "size_kb": 0.9, - "readers": [], - "writers": [], - "last_modified": "07-07 17:33", - "warn": true, - "migrated_to_db": null - }, - { - "name": "system_audit_report.json", - "desc": "", - "size_kb": 1.8, - "readers": [], - "writers": [], - "last_modified": "07-20 17:30", - "warn": true, - "migrated_to_db": null - }, - { - "name": "system_inventory.json", - "desc": "全量系统清单", - "size_kb": 354.8, - "readers": [], - "writers": [], - "last_modified": "07-08 11:34", - "warn": true, - "migrated_to_db": null - } - ], - "pipelines": [ - { - "name": "300308入场信号紧盯", - "type": "no_agent", - "script": "monitor_300308.py", - "schedule": "*/2 13-14 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T14:58:41", - "profile": "position-analyst" - }, - { - "name": "300308午后紧盯", - "type": "no_agent", - "script": "300308_monitor.py", - "schedule": "*/2 13-14 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T14:58:41", - "profile": "position-analyst" - }, - { - "name": "Gateway看门狗-知微", - "type": "no_agent", - "script": "fix_gateway_port.py", - "schedule": "every 10m", - "status": "ok", - "last_run": "2026-07-20T21:55:11", - "profile": "position-analyst" - }, - { - "name": "LLM修复循环-L3", - "type": "no_agent", - "script": "self_repair.py", - "schedule": "*/30 9-16,20-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:30:06", - "profile": "position-analyst" - }, - { - "name": "MoFin 系统常规体检-开盘前", - "type": "no_agent", - "script": "morning_health_check.py", - "schedule": "0 8 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T08:01:00", - "profile": "position-analyst" - }, - { - "name": "bot-process-monitor", - "type": "no_agent", - "script": "bot_monitor.sh", - "schedule": "every 60m", - "status": "ok", - "last_run": "2026-07-20T21:04:56", - "profile": "default" - }, - { - "name": "cron-推XMPP中继", - "type": "no_agent", - "script": "cron_to_xmpp.py", - "schedule": "* 9-16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:59:26", - "profile": "default" - }, - { - "name": "cron报告推XMPP-每5分", - "type": "no_agent", - "script": "cron_to_xmpp.py", - "schedule": "*/5 9-16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:55:44", - "profile": "position-analyst" - }, - { - "name": "evolution-pulse", - "type": "LLM", - "script": null, - "schedule": "0 * * * *", - "status": "ok", - "last_run": "2026-07-20T21:07:18", - "profile": "default" - }, - { - "name": "state.db真空整理-每周", - "type": "no_agent", - "script": "vacuum_state_db.py", - "schedule": "0 3 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45:49", - "profile": "position-analyst" - }, - { - "name": "wiki-self-growth", - "type": "LLM", - "script": "wiki_health_aggregate.py", - "schedule": "0 3 * * *", - "status": "error", - "last_run": "2026-07-20T03:04:14", - "profile": "default" - }, - { - "name": "主力建仓扫描-每15分", - "type": "no_agent", - "script": "accumulation_scanner.py", - "schedule": "*/10 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:50:33", - "profile": "position-analyst" - }, - { - "name": "价格监控-高频", - "type": "no_agent", - "script": "price_monitor.py", - "schedule": "*/2 9-16 * * 1-5", - "status": "error", - "last_run": "2026-07-20T16:59:34", - "profile": "position-analyst" - }, - { - "name": "候选股自动提拔-每30分", - "type": "no_agent", - "script": "promote_candidates.py", - "schedule": "*/30 9-15 * * 1-5", - "status": "error", - "last_run": "2026-07-20T15:31:09", - "profile": "position-analyst" - }, - { - "name": "候选股过滤管道-每30分", - "type": "no_agent", - "script": "candidate_filter.py", - "schedule": "*/30 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:31:06", - "profile": "position-analyst" - }, - { - "name": "健康监控数据采集-每15分", - "type": "no_agent", - "script": "mofin_health.py", - "schedule": "*/15 9-16,20-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:45:17", - "profile": "position-analyst" - }, - { - "name": "元监控-自检系统的自检-L4", - "type": "no_agent", - "script": "meta_watchdog.py", - "schedule": "5 * * * *", - "status": "ok", - "last_run": "2026-07-20T21:05:54", - "profile": "position-analyst" - }, - { - "name": "元自成长-每日", - "type": "no_agent", - "script": "meta_growth.py", - "schedule": "45 0,12 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T12:45:47", - "profile": "position-analyst" - }, - { - "name": "分支剪枝-每日", - "type": "no_agent", - "script": "prune_branches.py", - "schedule": "0 21 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:00:55", - "profile": "position-analyst" - }, - { - "name": "分支自成长-盘中", - "type": "no_agent", - "script": "branch_scanner.py", - "schedule": "15,30,45,00 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:45:12", - "profile": "position-analyst" - }, - { - "name": "分析师-持仓复查", - "type": "LLM", - "script": "prepare_report_data.py", - "schedule": "0 20 * * 4", - "status": "ok", - "last_run": "2026-07-16T20:14:57", - "profile": "position-analyst" - }, - { - "name": "功能健康检查-L1", - "type": "no_agent", - "script": "functional_health_check.py", - "schedule": "*/15 9-16,20-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:45:11", - "profile": "position-analyst" - }, - { - "name": "多周期缓存刷新-盘中", - "type": "no_agent", - "script": "refresh_mtf_cache.py", - "schedule": "0 9,11,14 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T14:02:11", - "profile": "position-analyst" - }, - { - "name": "大脑任务执行", - "type": "LLM", - "script": "", - "schedule": "{'kind': 'cron', 'expr': '*/10 * * * *'}", - "status": "ok", - "last_run": "2026-07-20T21:50:39", - "profile": "default" - }, - { - "name": "宏观上下文刷新-每30分", - "type": "no_agent", - "script": "refresh_macro_context.py", - "schedule": "*/30 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:31:07", - "profile": "position-analyst" - }, - { - "name": "宏观新闻采集", - "type": "no_agent", - "script": "macro_context_collector.py", - "schedule": "*/30 8-16 * * *", - "status": "ok", - "last_run": "2026-07-20T16:30:58", - "profile": "position-analyst" - }, - { - "name": "宏观风险信号消费", - "type": "no_agent", - "script": "macro_signal_consumer.py", - "schedule": "5,20,35,50 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:50:18", - "profile": "position-analyst" - }, - { - "name": "宏观风险扫描", - "type": "LLM", - "script": null, - "schedule": "30 8 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T08:43:03", - "profile": "position-analyst" - }, - { - "name": "宏观风险扫描-午间", - "type": "LLM", - "script": null, - "schedule": "30 11 * * 1-5", - "status": "ok", - "last_run": "2026-07-17T11:37:54", - "profile": "position-analyst" - }, - { - "name": "宏观风险扫描-周末", - "type": "LLM", - "script": null, - "schedule": "0 10 * * 0,6", - "status": "ok", - "last_run": "2026-07-19T10:11:31", - "profile": "position-analyst" - }, - { - "name": "小果市场筛选-全市场", - "type": "no_agent", - "script": "market_screener.py", - "schedule": "35 15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:35:16", - "profile": "position-analyst" - }, - { - "name": "市场数据采集", - "type": "no_agent", - "script": "market_watch.py", - "schedule": "*/10 9-11,13-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:50:32", - "profile": "position-analyst" - }, - { - "name": "市场数据采集", - "type": "no_agent", - "script": "market_watch.py", - "schedule": "0,30 9-16 * * 1-5", - "status": "error", - "last_run": "2026-07-20T16:32:25", - "profile": "default" - }, - { - "name": "市场精选推荐-每日", - "type": "LLM", - "script": null, - "schedule": "0 16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:09:40", - "profile": "position-analyst" - }, - { - "name": "建议对账-每周", - "type": "no_agent", - "script": "advice_reconciliation.py", - "schedule": "0 20 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45:50", - "profile": "position-analyst" - }, - { - "name": "开盘前钉对钉验证", - "type": "no_agent", - "script": "preflight_verify.py", - "schedule": "30 8 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T08:30:35", - "profile": "position-analyst" - }, - { - "name": "开盘简报", - "type": "LLM", - "script": "opening_brief.py", - "schedule": "35 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-17T09:49:52", - "profile": "position-analyst" - }, - { - "name": "持仓情报-盘后", - "type": "LLM", - "script": null, - "schedule": "0 20 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T20:15:00", - "profile": "default" - }, - { - "name": "收盘简报", - "type": "LLM", - "script": "closing_brief.py", - "schedule": "10 16 * * 1-5", - "status": "ok", - "last_run": "2026-07-17T16:21:37", - "profile": "position-analyst" - }, - { - "name": "数据同步-dashboard", - "type": "no_agent", - "script": "sync_dashboard.py", - "schedule": "55 8 * * *", - "status": "ok", - "last_run": "2026-07-20T08:55:46", - "profile": "default" - }, - { - "name": "数据治理-每周", - "type": "no_agent", - "script": "data_governance.py", - "schedule": "0 10 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45:48", - "profile": "position-analyst" - }, - { - "name": "数据采集-策略评估前", - "type": "no_agent", - "script": "collect_evaluation_data.py", - "schedule": "30 20 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T20:30:38", - "profile": "position-analyst" - }, - { - "name": "梦境循环-知识库归并", - "type": "LLM", - "script": null, - "schedule": "0 22 * * *", - "status": "error", - "last_run": "2026-07-19T22:09:19", - "profile": "default" - }, - { - "name": "盘中自检-高频", - "type": "no_agent", - "script": "intraday_health_check.py", - "schedule": "*/15 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:45:12", - "profile": "position-analyst" - }, - { - "name": "盘前全量重评-自选退出", - "type": "no_agent", - "script": "premarket_full_review.py", - "schedule": "10 8 * * 1-5", - "status": "error", - "last_run": "2026-07-20T08:12:09", - "profile": "position-analyst" - }, - { - "name": "盘前热点扫描", - "type": "LLM", - "script": null, - "schedule": "30 8 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T08:43:15", - "profile": "default" - }, - { - "name": "知微周复盘", - "type": "LLM", - "script": null, - "schedule": "0 22 * * 0", - "status": "error", - "last_run": "2026-07-19T22:04:59", - "profile": "default" - }, - { - "name": "知微洞察生成", - "type": "no_agent", - "script": "market_insight.py", - "schedule": "35 15 * * 1-5", - "status": "error", - "last_run": "2026-07-20T15:35:06", - "profile": "position-analyst" - }, - { - "name": "知识研究-日常", - "type": "LLM", - "script": null, - "schedule": "0 22 * * *", - "status": "error", - "last_run": "2026-07-19T22:04:55", - "profile": "default" - }, - { - "name": "硬编码扫描-每日", - "type": "no_agent", - "script": "hardcode_scanner.py", - "schedule": "25 17 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T17:26:10", - "profile": "position-analyst" - }, - { - "name": "策略复盘-每日", - "type": "no_agent", - "script": "strategy_review.py", - "schedule": "0 20 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T20:00:31", - "profile": "position-analyst" - }, - { - "name": "策略时效性检查(日)", - "type": "LLM", - "script": "strategy-staleness-check.py", - "schedule": "0 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-14T09:40:58", - "profile": "position-analyst" - }, - { - "name": "策略评估-每周", - "type": "no_agent", - "script": "strategy_evaluator.py", - "schedule": "0 21 * * 6", - "status": "ok", - "last_run": "2026-07-20T20:45:54", - "profile": "position-analyst" - }, - { - "name": "策略评估-每日", - "type": "LLM", - "script": "stale_detector.py", - "schedule": "0 21 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:17:10", - "profile": "position-analyst" - }, - { - "name": "策略质量门禁-重评跟进", - "type": "no_agent", - "script": "review_needed_watchdog.py", - "schedule": "0,30 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:30:59", - "profile": "position-analyst" - }, - { - "name": "系统健康检查-开盘前", - "type": "LLM", - "script": "system_health_check.py", - "schedule": "0 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T10:38:16", - "profile": "position-analyst" - }, - { - "name": "系统全局审计", - "type": "LLM", - "script": "system_audit.py", - "schedule": "30 17 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T17:39:53", - "profile": "position-analyst" - }, - { - "name": "系统卫生审计-每日", - "type": "no_agent", - "script": "system_hygiene_audit.py", - "schedule": "20 8 * * *", - "status": null, - "last_run": "None", - "profile": "position-analyst" - }, - { - "name": "自愈执行器-TODO自动处理", - "type": "no_agent", - "script": "self_todo_executor.py", - "schedule": "*/10 8-22 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T21:50:10", - "profile": "position-analyst" - }, - { - "name": "自成长知识库-22:10中继推送", - "type": "no_agent", - "script": "relay_knowledge_report.py", - "schedule": "10 22 * * *", - "status": "ok", - "last_run": "2026-07-19T22:10:37", - "profile": "default" - }, - { - "name": "自选买入区提醒-盘前午间尾盘", - "type": "no_agent", - "script": "per_stock_reassess.py", - "schedule": "0 12,15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:02:36", - "profile": "position-analyst" - }, - { - "name": "自选股体检-每周", - "type": "LLM", - "script": null, - "schedule": "0 20 * * 6", - "status": "error", - "last_run": "2026-07-18T20:04:35", - "profile": "default" - }, - { - "name": "自选股自动重评-周末", - "type": "no_agent", - "script": "stale_detector.py", - "schedule": "30 10 * * 0,6", - "status": "ok", - "last_run": "2026-07-20T20:47:32", - "profile": "position-analyst" - }, - { - "name": "自选自动清理-开盘前", - "type": "no_agent", - "script": "clean_watchlist.py", - "schedule": "5 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T09:06:12", - "profile": "position-analyst" - }, - { - "name": "记忆守卫-每日", - "type": "no_agent", - "script": "memory_guardian.py", - "schedule": "0 7 * * *", - "status": "ok", - "last_run": "2026-07-20T07:02:49", - "profile": "position-analyst" - }, - { - "name": "记忆守卫-每日", - "type": "no_agent", - "script": "memory_guardian.py", - "schedule": "0 7 * * *", - "status": "error", - "last_run": "2026-07-20T07:02:09", - "profile": "default" - }, - { - "name": "资金流采集-盘中", - "type": "no_agent", - "script": "capital_flow_collector.py", - "schedule": "1,31 9-15 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T15:32:20", - "profile": "position-analyst" - }, - { - "name": "跨市场背离检测", - "type": "no_agent", - "script": "divergence_detector.py", - "schedule": "*/30 8-15 * * *", - "status": "ok", - "last_run": "2026-07-20T15:31:01", - "profile": "position-analyst" - }, - { - "name": "跨市场背离检测-周末", - "type": "no_agent", - "script": "divergence_detector.py", - "schedule": "30 8-16/2 * * 0,6", - "status": "ok", - "last_run": "2026-07-20T20:45:47", - "profile": "position-analyst" - }, - { - "name": "重评管道审计-每30分", - "type": "no_agent", - "script": "verify_reassess_pipeline.py", - "schedule": "*/30 9-16 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T16:30:56", - "profile": "position-analyst" - }, - { - "name": "集合竞价观察", - "type": "LLM", - "script": null, - "schedule": "28 9 * * 1-5", - "status": "ok", - "last_run": "2026-07-20T09:54:17", - "profile": "default" - } - ], - "db_freshness": [ - { - "table": "mtf_cache", - "label": "多周期均线缓存", - "last_record": "07-20 17:08", - "age_hours": 4.9, - "warn": false - }, - { - "table": "macro_context_log", - "label": "宏观上下文", - "last_record": "07-20 15:31", - "age_hours": 6.5, - "warn": false - }, - { - "table": "market_snapshots", - "label": "市场快照", - "last_record": "07-20 15:50", - "age_hours": 6.2, - "warn": false - }, - { - "table": "live_prices", - "label": "实时价格", - "last_record": "07-20 18:12", - "age_hours": 3.8, - "warn": false - }, - { - "table": "price_events", - "label": "价格事件", - "last_record": "07-20 17:06", - "age_hours": 4.9, - "warn": false - } - ], - "self_check": { - "functional": { - "generated_at": "2026-07-20 22:00:13", - "status": "warn", - "summary": { - "total": 10, - "ok": 3, - "warn": 1, - "fail": 0, - "skip": 6 - }, - "checks": [ - { - "module": "price_monitor", - "function": "实时价格写入DB(live_prices)", - "status": "skip", - "reason": "非交易时段" - }, - { - "module": "market_watch", - "function": "市场快照采集(market_snapshots)", - "status": "skip", - "reason": "非交易时段" - }, - { - "module": "mtf_cache", - "function": "多周期均线缓存刷新(mtf_cache)", - "status": "skip", - "reason": "非交易时段" - }, - { - "module": "macro_context", - "function": "宏观上下文刷新(macro_context_log)", - "status": "skip", - "reason": "非交易时段" - }, - { - "module": "health_collector", - "function": "健康数据采集(mofin_health.json)", - "status": "skip", - "reason": "非交易时段" - }, - { - "module": "premarket", - "function": "盘前全量重评(premarket summary)", - "status": "ok", - "reason": "829min前", - "repair": { - "action": "rerun_script", - "script": "premarket_full_review.py" - } - }, - { - "module": "gateway_llm", - "function": "LLM调用链可用(gateway agent.log)", - "status": "warn", - "reason": "最近成功LLM调用在 39min 前(无新流量,可能正常)", - "repair": { - "action": "llm_diagnose" - } - }, - { - "module": "sense_ocr", - "function": "识图服务(SenseNova OCR配置+API可达)", - "status": "ok", - "reason": "配置 OK + token.sensenova.cn:443 可达", - "repair": { - "action": "llm_diagnose" - } - }, - { - "module": "xmpp_bot", - "function": "XMPP消息收发(bot journal)", - "status": "ok", - "reason": "bot 活动正常", - "repair": { - "action": "llm_diagnose" - } - }, - { - "module": "cron_engine", - "function": "cron调度引擎本身(有job在最近10min运行)", - "status": "skip", - "reason": "非交易时段" - } - ] - }, - "meta_watchdog": { - "generated_at": "2026-07-20 21:05:54", - "status": "ok", - "layers": [ - { - "layer": "L0 agents_health_check", - "status": "ok", - "reason": "1min 前" - }, - { - "layer": "L1 functional_health", - "status": "skip", - "reason": "非交易时段" - }, - { - "layer": "L2 hygiene_audit", - "status": "ok", - "reason": "124min 前" - }, - { - "layer": "L1.5 mofin_health采集", - "status": "skip", - "reason": "非交易时段" - }, - { - "layer": "L3 self_repair", - "status": "ok", - "reason": "已注册" - }, - { - "layer": "XMPP桥 :5805", - "status": "ok", - "reason": "可达(HTTP 501)" - } - ] - }, - "hygiene": { - "generated_at": "2026-07-20 19:01:42", - "status": "ok", - "issue_count": 0, - "issues": [] - }, - "recent_repairs": [ - { - "ts": "2026-07-20T19:36:36.287827", - "module": "xmpp_bot", - "function": "XMPP消息收发(bot journal)", - "reason": "bot 服务非 active(已停止)", - "action": { - "action": "none", - "reason": "当前 xmpp-zhiwei 服务为 active,ejabberd 5222 端口也在监听,健康检查的异常或为瞬态误报或已自动恢复,无需动作" - }, - "ok": true, - "detail": "无需动作: 当前 xmpp-zhiwei 服务为 active,ejabberd 5222 端口也在监听,健康检查的异常或为瞬态误报或已自动恢复,无需动作", - "llm_note": "{\"action\": \"none\", \"reason\": \"当前 xmpp-zhiwei 服务为 active,ejabberd 5222 端口也在监听,健康检查的异常或为瞬态误报或已自动恢复,无需动作\"}" - } - ] - } -} \ No newline at end of file