hmo
574151aee9
docs: 红线#11 批量LLM调用禁走hermes gateway agent通道(603288事件)
2026-07-21 01:05:08 +08:00
hmo
60dbb64f92
docs(dev-spec): v2.1 — fix section numbering + outdated refs
...
Zhiwei flagged: '十条红线' but she counted 14. Real issues found:
- duplicate section numbers: two '三、' (验证闭环 + 自检体系矩阵),
two '四、' (开发流程 + 部署环境) -> renumbered 一~七 sequentially
- doc index said '含五条红线' (stale from v1) -> '含十条红线'
- F 小节 still used old Tier1/Tier2 framing -> aligned to L0/L1-L2
with pointer to the L0-L4 matrix section
- version bump v2.0 -> v2.1
Minimal edit: no content changes beyond numbering/consistency.
2026-07-20 21:21:21 +08:00
hmo
94883539de
docs: reply to zhiwei on cron error status accuracy
2026-07-20 20:57:20 +08:00
hmo
c42769f293
docs: zhiwei briefing on 2026-07-20 system changes
2026-07-20 20:36:50 +08:00
hmo
9a359f49bd
feat(deploy): automatic hardlink repair built into deployment pipeline
...
User insight: hardlink breakage only happens at deploy time (scp file
replacement / git checkout-merge), so detection must be welded INTO the
deploy pipeline, not left to daily audit.
Three automatic layers, no reliance on discipline:
1. systemd path watcher (profile-scripts-sync.path): watches
deploy/profile-scripts/ directory, auto-fires sync_profile_scripts.sh
on any change. Verified: fires within 4s of file replacement, logs to
gateway/logs/link_sync.log (runs as hmo user)
2. git hooks (.git/hooks/post-merge + post-checkout on 246 repo):
auto re-link after git operations
3. Manual fallback: sync_profile_scripts.sh (now self-logging)
dev-spec red line #6 updated: SSOT rule now documents the three layers
and states breakage only happens at deploy time.
2026-07-20 20:27:11 +08:00
hmo
08eef1e181
feat(self-check): L0-L4 layered self-check architecture with LLM auto-repair
...
User directive: daily not weekly; clear responsibilities per layer with no
overlap; functional criteria (does the function WORK) not process liveness;
problems get FIXED via LLM with file-and-report discipline (act first,
report after); plus a meta-layer watching the watchers; deeply integrated
into F健康.
Architecture (responsibility matrix in dev-spec.md):
- L0 agents_health_check (5min): port/HTTP/DB liveness + auto_heal executor
- L1 functional_health_check (15min trading): per-module FUNCTIONAL
criteria — output freshness/validity per REGISTRY (live_prices/market_
snapshots/mtf_cache/macro_context/bot/LLM/cron engine), not process alive
- L2 system_hygiene_audit (daily 08:20, was weekly): divergence/hardlink/
zombie/orphan/dead-cron/db-freshness
- L3 self_repair (30min): reads L1/L2 failures -> LLM diagnoses -> executes
WHITELISTED repair actions directly (rerun_script/restart_service/
sync_links/switch_llm_key/none) -> repair_log.jsonl + XMPP report.
Max 2 repairs/module/day anti-loop. LLM unavailable -> rule fallback.
- L4 meta_watchdog (hourly): checks L0-L3 output freshness + L3 cron
registration + XMPP bridge; direct XMPP alert as last resort
Retired (overlap): Cron监护-高频 (cron_watchdog -> L3), 全局cron健康监控
(cron_health_monitor -> L1).
Dashboard: mofin_health.py now emits self_check section (functional/meta/
hygiene/recent_repairs); mofin_health.html new '🩺 自检体系' tab rendering
L4 layers, L1 module checks, L2 issues, L3 repair history.
E2E verified: stopped xmpp bot -> L1 flagged fail -> systemd recovered ->
L3 LLM correctly diagnosed 'none needed' and logged; rerun_script whitelist
path executes real scripts successfully; meta_watchdog all-green after fix.
2026-07-20 19:39:58 +08:00
hmo
4f83ee8a01
feat(hygiene): anti-redundancy enforcement — spec rules + weekly audit
...
Root cause analysis of the 2026-07-20 redundancy incident:
1. No single-source-of-truth rule -> same file legitimately lived in 4+
locations, diverging silently
2. Relative path resolution (Path(__file__).parent/'data') -> each
hardlinked copy of mofin_db.py pointed to a DIFFERENT database
3. 'Backup habit' left .bak/legacy files in production dirs, which
monitoring then scanned and reported as false alarms
4. Half-done migrations: DB tables created but old JSON writers/readers
stayed (price_events), old files stayed
5. Dead modules never got buried: xiaoguo 'dead' but bot ran 8 days
as root eating 2.5GB
6. Monitoring checked 'does it exist' not 'is it alive' -> stale file
mtime reported as 'pipeline stalled 14 days' (false alarm)
7. No 'system hygiene' as a check category at all
Prevention implemented:
- dev-spec.md v2.0: 五条红线 -> 十条红线
#6 single source of truth (hardlink only, no independent copies)
#7 absolute data paths only (no __file__-relative data resolution)
#8 no backups/legacy in production data dirs (archive immediately)
#9 dead module burial checklist (6 mandatory steps)
#10 monitor liveness (DB table freshness) not existence
- File Location Constitution: canonical location per content type
- NEW system_hygiene_audit.py: weekly Monday 07:30 cron checking
diverged copies / broken hardlinks / zombie processes / orphan data
files / dead cron scripts / DB freshness -> hygiene_report.json + XMPP
- specs/hygiene.json: module spec per red line #1
- Verified: audit found 5 real issues on first run, all fixed, re-run clean
2026-07-20 19:04:05 +08:00
hmo
b41bed7959
feat: XMPP observability — logger, monitor endpoints, clean dead xiaoguo refs
2026-07-19 12:47:15 +08:00
hmo
49ccd7467d
docs: update module list — 10 specs completed
2026-07-19 11:18:22 +08:00
hmo
b08bfa5d03
refactor: integrate dashboard into server.py :8899, remove standalone dashboard
2026-07-19 11:06:50 +08:00
hmo
782a914a3c
fix: dashboard port 5804→5807 (avoid conflicts with wechat_webhook and zhiwei bot)
2026-07-19 10:56:42 +08:00
hmo
747fdfe467
feat: introduce spec system + dashboard + health pipeline (AgentsMeeting template)
2026-07-19 10:50:34 +08:00
知微
90966c63ca
chore: 同步运行版本与git一致
...
- strategy_lifecycle.py: GATE_9D_ANALYSIS → GATE_12D_ANALYSIS(12维交叉验证)
- system_audit.py: 审计策略评估改用holding_strategies.updated_at
- CHANGELOG.md + analyst-knowledge-log.md 日常更新
2026-07-17 23:08:11 +08:00
知微
136f3f9fb8
sync scripts/mofin_db.py with root + knowledge log
2026-07-14 11:01:59 +08:00
知微
59e94d135c
fix: 盘中脚本统一使用get_conn()替代raw sqlite3.connect防DB死锁
...
- mofin_health.py, cron_health_monitor.py, intraday_health_check.py,
self_todo_executor.py: 替换raw sqlite3.connect() → get_conn()
统一使用WAL模式+busy_timeout=30s连接
- mofin_db.py: get_conn()每次新建连接时WAL checkpoint
防止被kill进程残留WAL导致后续全部卡死
- 并发测试验证: 3x price_monitor + 3x mofin_health同时运行
6/6通过,WAL仅32bytes
关联问题: 2026-07-14 SQLite写锁死锁根因诊断
2026-07-14 10:56:38 +08:00
知微
02d1c93923
fix(price_monitor): DB写锁死锁根治 - 统一BEGIN IMMEDIATE + 5次重试指数退避 + emergency WAL checkpoint
...
- 统一一个BEGIN IMMEDIATE事务包裹所有写操作,替代独立写函数调用
- 5次重试 + 指数退避 (1s,2s,4s,8s,16s),原3次+固定2s
- 重试耗尽后自动 emergency WAL checkpoint(TRUNCATE)释放死锁
- try/except确保连接始终释放,修复conn泄漏
- 三副本同步:profile/scripts + MoFin/scripts + MoFin/root
2026-07-14 10:30:15 +08:00
知微
9239ab40c0
docs: 更新CHANGELOG + 开发日志记录07/13全部变更
...
- XMPP Bot非阻塞/本地XMPP/MUC修复
- price_monitor推送冷却持久化
- 深套股规则重构+换股规划swap-plan
- 周月线技术分析增强
- 健康Tab写无读清零
- stale_push_wlin/per_stock_reassess/promote_candidates更新
- static/index.html + mofin_health.json + server.py同步
2026-07-13 12:09:25 +08:00
知微
c4de7d6516
docs: 补充今日全量变更文档(扫描/过滤/九维/仓位/冷却/清理)
2026-07-10 01:30:11 +08:00
知微
52e70bde26
fix: 14个LLM cron prompt添加数据真实性铁律(置顶)+注册到提示词系统
2026-07-09 13:38:36 +08:00
知微
d2fe7e771f
fix: intraday_health_check + system_audit信号堆积监控盲区 — 增加全量未处理查询(非仅xiaoguo)
2026-07-09 10:50:50 +08:00
知微
2762ddf3ae
fix: DB路径大面积修复——mofin_db/server/technical_analysis/strategy_tree等脚本的Path(__file__).parent/data错误指向scripts/data而非data/ 导致读写分离
...
- 量价分析: full_analysis输出volume_deep+成交量存储在price_history.json
- FK约束移除: holding_strategies外键->holdings阻止自选股写入
- #000850 重评已写入(止损3.74/止盈4.06/RR1.67)含量价信号
2026-07-08 12:34:39 +08:00
知微
3e2f0315eb
完全DB版: 移除JSON写入/回退,所有操作直走SQLite
...
- price_monitor: 完全DB版,不再读写 portfolio.json/watchlist.json
- holdings代码从DB读取(SELECT code FROM holdings WHERE is_active=1)
- 价格写入DB holdings表 + portfolio_summary + live_prices
- 3次重试+指数退避防锁
- server.py: 移除API的JSON回退,DB失败直接返回500
- mofin_db.py: execute_with_retry/commit_with_retry + 15s timeout + busy_timeout
- mo_data.py: 已是纯DB模式(无JSON fallback)
这是推进的完全DB化。下一步可删除 data/portfolio.json data/decisions.json data/watchlist.json 等遗留JSON。
2026-07-06 12:08:08 +08:00
知微
e185b4e4dc
feat: DB-first architecture with lock-safe writes
...
- price_monitor: writes live prices to both JSON and mofin.db (holdings + live_prices + portfolio_summary)
- mofin_db: added execute_with_retry/commit_with_retry with exponential backoff on 'database is locked'
- mofin_db: increased timeout 5s->15s, added PRAGMA busy_timeout=15000
- price_monitor retry loop: fixed break-before-if-ok bug (was not retrying on write failure)
- DB connection: WAL mode + retry decorator for all write operations
- cash sync: preserves DB authoritative cash (JSON cash not pushed to DB)
This is the DB-first version. JSON writes remain for dashboard compatibility.
Next step: remove JSON writes entirely for full DB-only architecture.
2026-07-06 12:02:11 +08:00
知微
574f1be3ec
docs: reorganize — README index, archive old docs, add status headers
2026-07-04 10:22:51 +08:00
知微
7f84471aca
docs: development standards + test plan
2026-07-04 09:57:18 +08:00
知微
4e080d4fc5
docs: comprehensive test plan (10 categories, 70+ test cases)
2026-07-04 09:36:48 +08:00
知微
b6959f73bc
docs: update CHANGELOG + data model + mark decisions migration complete
2026-07-03 23:34:52 +08:00
知微
7c0e85af28
硬性策略质量门禁 validate_strategy()
...
新增 STRATEGY_QUALITY_GATES 检查清单(9条红线):
CRITICAL: 止损/止盈存在+>0, 买入区下沿<上沿
HIGH: 止损≤买入区, 买入推荐含RR≥1.5, 港股标currency=HKD
MEDIUM: signal短词, tech_snapshot含技术位
enforce_strategy_quality() 插在写入链的两处:
1. reassess_with_context() return前 → 单只重评必过
2. regenerate_all() for d in decisions: 写DB前 → 批量重评必过
不过的:status=review_needed, signal降级→信号不充分
不会写进DB/JSON,除非修复了CRITICAL问题
2026-07-02 13:46:53 +08:00
知微
6305204c7a
feat: mo_data.py unified read layer (DB-first, JSON fallback) + cash_log table + batch JSON→DB migration (16 files)
2026-07-01 23:45:30 +08:00
知微
82024a6d7f
给笑笑的接手说明 — refactor-for-xiaoxiao.md
2026-07-01 22:05:01 +08:00
知微
e1057bc747
docs: 数据管道诊断报告(交笑笑重构参考)
...
涵盖:系统数据架构总图、港股币种不统一问题、
总资产计算路径问题、现金管理缺失问题、
建议重构方向(单一日志数据源、统一价格写入路径、
现金 changelog 系统、币种感知比较)、
当前文件清单和 TODO
2026-06-30 09:34:59 +08:00
知微
12025d58a0
docs: 更新交接文档(含笑笑架构改革)
2026-06-30 03:04:26 +08:00
知微
04c98c23e1
docs: session交接文档
2026-06-30 03:02:29 +08:00
知微
fa45d8aa5f
fix: 小果地址统一node122(兼容LAN+EasyTier)
...
- health_checklist.json: 192.168.1.122→node122
- ocr_client.py: docstring IP→node122
- docs/market-data-requirements.md: IP→node122
- 所有API调用通过ProxyHandler({})绕过系统代理
Privoxy对node122:18003返回500,直连正常
2026-06-30 02:56:35 +08:00
知微
7d49470aeb
总资产公式修复+数据模型文档
...
bugfix: price_monitor写total_assets时漏算frozen_cash
公式修正: total_assets = market_value + cash + frozen_cash
影响: price_monitor两处公式 + stale_push_wlin fallback路径
docs: portfolio-data-model.md 新增
数据模型字段说明
现金流更新规则
常见错误清单
2026-06-29 22:35:07 +08:00
知微
6a97d93018
现金更正 + 法拉电子清仓记录
...
截图确认:
- 可用资金 92,664.20(含天添利)
- 冻结 39,481.40
- 总现金 132,145.60
- 总资产 = 持仓市值1,107,670 + 现金132,145.60 = 1,239,815.60
法拉电子 189.20卖出100股已记录
2026-06-29 12:40:50 +08:00
知微
2912b127e3
docs: 38个cron完全手册
...
- 全部32个脚本+8个LLM cron的设计意图/数据流/代码结构
- 暂停/废弃说明
- 每个cron关联脚本和调用链
- 自动注册脚本时参考此文档推断数据流
新增cron时应该在此文档追加条目,否则注册表审计只能推断不能确认
2026-06-27 02:26:34 +08:00
知微
b053103377
feat: 策略复盘闭环 Phase1
...
- 新增 scripts/strategy_review.py: 遍历所有active策略
- 腾讯API实时价对比止损/止盈/入场点
- 分类: correct/wrong/partial/pending
- 失败模式归因: 止损过紧/入场过早/止盈过远等
- 写入 accuracy_stats 表(首条真实数据)
- 新增 docs/strategy-review-loop.md: 完整闭环设计文档
- 含失败模式→修复方向映射表
Phase1 结果: 38条策略, 94.7%准确率(19条待定), 1条止损过紧
2026-06-25 19:58:00 +08:00
知微
147d6d0fa2
docs: 最终文档更新+全链路测试通过
...
自检结果: 8类48项全部运行正常
- 健康检查: ✅ 逻辑完整 43/48正常 (5项属预期行为)
- 盘中自检: ✅ SILENT
- 执行器: ✅ SILENT
- 信号消费: ✅ SILENT
- 全库表: ✅ 所有数据表正常积累
2026-06-24 23:05:16 +08:00
知微
4c074b789e
docs: 更新自愈循环+体检文档至最终版
2026-06-24 22:09:30 +08:00
知微
4407f35027
feat: 自愈循环系统 + xiaoguo信号桥
...
- 新增 docs/self-healing-loop.md: 自愈循环设计文档
- 修改 morning_health_check.py: 发现异常后自动写入TODO系统
- severity=critical→priority=high, error→medium, warn→low
- 相同问题已completed→重新打开并升一级
- 已有pending→不重复
- 新增 scripts/xiaoguo_signal_consumer.py: 知微消费小果扫描信号
- 每30分钟盘中运行
- 读signal_news未处理xiaoguo信号
- 五维快速评估→加自选/关注/跳过
- 标记processed=1
- 新增 cron: 小果信号消费-盘中 (15,45 9-15)
- 更新health_checklist自维护机制
自愈循环: 体检→TODO→修复→验证
2026-06-24 20:14:53 +08:00
知微
a24505ebef
feat: 系统常规体检机制
...
- 新增 morning_health_check.py:分层分类全面体检脚本
- 新增 health_checklist.json:可动态维护的检查清单(自动发现新组件)
- 新增 docs/morning-health-check.md:完整设计文档
- 新增 skill: morning-health-check
- 修复:xiaoguo_scanner.py 同步到profile脚本目录
- 修复:system_audit.py 从symlink改为硬拷贝(解决脚本路径越界)
- 修复:morning_health_check.py 使用jobs.json而非cron.db(更可靠)
自动检查7层43项:
基础设施/SENSE/RESPOND/ADAPT/IMPROVE/数据文件/管道完整性
每天8:00开盘前自动跑一次
2026-06-24 20:09:10 +08:00
知微
abd8d5c258
元自成长改为每日两次(12:45+00:45),半天内完成闭环
...
12:45: 上午盘发现问题→注入新规则→17:25审计就用新规则扫
00:45: 全天修复汇总→注册表更新→次日审计带新规则
Dad要求:用上午盘的发现提升下午盘,而不是等一周
2026-06-24 00:14:41 +08:00
知微
b4af8c9927
元自成长层:meta_growth 每周扫描修复模式→自动扩展扫描规则
...
- scripts/meta_growth.py (NEW): 每周日22:00分析git log中的修复模式,
识别新问题类型,向 hardcode_scanner 注入新规则
- scripts/hardcode_scanner.py (MODIFIED): 预置扩展点注释,
meta_growth 可直接在其后追加新规则元组
- docs/SELF_GROWTH_SYSTEM.md (UPDATED): 新增第七章"元自成长层"
- cron: 元自成长-每周 周日22:00 no_agent
设计理念:自成长机制本身必须也是自成长的。
hardcode_scanner 能扫什么不是写死的——meta_growth
会从你的修复习惯中学习新的扫描类别。
2026-06-24 00:10:45 +08:00
知微
e33a236bc1
自成长系统:四层循环架构文档 + 三个代码改动 + 所有日间修复
...
内容:
- docs/SELF_GROWTH_SYSTEM.md (NEW) — 完整的 Sense→Respond→Adapt→Improve 架构文档
- docs/SYSTEM_ARCHITECTURE.md (UPDATED) — 总索引指向新文档,cron数从14更新为31
- hk_rate.py (NEW) — HKD汇率模块,缓存+上次有效汇率自动恢复
- price_monitor.py (MODIFIED) — 价格监控注入分支评估+情景切换检测
- strategy_lifecycle.py (MODIFIED) — 策略生命周期评估上下文
- strategy_tree.py (NEW) — 情景化多分支决策引擎
日间修复(2026-06-23):
- stale_push_wlin: cash硬编码146837→读portfolio.json
- stale_push_wlin: lot_cost汇率0.93→hkd_to_cny动态
- stale_push_wlin: HK每手默认500股→Tencent API实时f[60]
- stale_push_wlin: 重评异步→串行(先重评再出报告)
- hk_rate: FALLBACK=0.87硬编码→缓存上次有效汇率
- 新增 cron: 分支扫描每30分, 分支剪枝周六, 硬编码审计17:25
- hardcode_scanner.py 每日扫描所有.py中大额数字
2026-06-24 00:04:26 +08:00
知微
eb8648839d
feat: 全局系统审计 system_audit.py + 每日cron
...
system_audit.py 每日17:30自动运行,7个维度全覆盖:
1. 信号管道 — 产出vs处理量,防积压
2. 股票池 — 自选/关注/持仓的数量健康
3. 策略状态 — 过期/缺止损/偏离检测
4. 建议闭环 — pending待执行建议
5. 组合健康 — 仓位/现金水位
6. 数据管道 — 采集时效性
7. 系统服务 — Dashboard/XMPP在线
发现HIGH问题自动触发修复,问题写入report供复盘
2026-06-22 20:21:52 +08:00
知微
06b8388887
docs+fix: 生命周期管理文档 + signal_news processed标记
...
- docs/lifecycle-management.md 完整生命周期规范(5大对象)
- 信号、股票、策略、建议、评估的完整状态流转
- 自我提升循环:信号→评估→执行→对比→修正→验证
- 当前缺口与修复清单
- signal_news 加 processed 列,处理完标记不重复
- 两个盯盘cron prompt同步更新:读未处理信号(WHERE processed=0)+标记已处理
2026-06-22 20:12:00 +08:00
知微
b32e2fd803
feat: 新增行业领涨股扫描 xiaoguo_scanner
...
- 新增 fetch_sector_leaders() 从 market.json 读取热门行业领涨股
- 三路并行:同花顺技术榜 + 行业领涨 + 东财热榜(502降级)
- 优先级排序:行业领涨 > 同花顺榜 > 东财热榜
- 名称→代码映射使用本地缓存,避免频繁调用akshare
- 更新文档
2026-06-22 20:00:40 +08:00
知微
b59c1f3bba
feat: xiaoguo信号管道完整链路
...
- xiaoguo_scanner: 6看多榜+5看空榜轮换,看空榜命中持仓预警
- 鹏华财富热榜降级静默
- 盯盘cron prompt: 接入xiaoguo信号+关注列表检查
- watchlist新增status=watching区分正式自选vs关注
- 楚江新材、中谷物流加入正式自选并生成策略
- 香农芯创、科安达加入关注列表等待回调
- 新增 docs/xiaoguo-signal-pipeline.md 完整流程文档
2026-06-22 19:46:21 +08:00
知微
aa1f621b03
文档同步:合并判断+时序控制
2026-06-21 02:36:38 +08:00