# Analytics History + Cron no-_agent Pattern (2026-08-04) ## 🎯 两件事 1. **每次分析入库 + 中奖对比** — SQLite `analysis` 表 + CLI `add/list/hits` 2. **Cron 改 no_agent + script** — 避免 agent 模式编 --- ## 1. 分析入库 + check_hits ### SQLite schema (2026-08-04 加) ```sql CREATE TABLE analysis ( id INTEGER PRIMARY KEY AUTOINCREMENT, period TEXT NOT NULL, -- 分析期号 candidates TEXT NOT NULL, -- JSON: [{"num":16,"weight":3,"amount":5},...] budget INTEGER NOT NULL DEFAULT 15, -- 重点金额预算 v_xg_qi TEXT, v_xg_nq TEXT, -- 当时 v_xg.json 字段快照 v_xg_week TEXT, v_xg_day TEXT, actual_special INTEGER, -- 真开特码 (开彩后填) hit INTEGER, -- 1=中 / 0=没中 / NULL=未更新 created_at TEXT DEFAULT CURRENT_TIMESTAMP ); CREATE INDEX idx_analysis_period ON analysis(period); ``` ### CLI (lottery_特码.py) ```bash python3 scripts/lottery_特码.py 084 # 跑分析 + 自动入库 python3 scripts/lottery_特码.py list 10 # 列出最近 10 条分析 + hit python3 scripts/lottery_特码.py add 083 27 1 2 3 4 5 6 # 手填真开彩 python3 scripts/lottery_特码.py hits # 单独跑 check_hits ``` ### `add_draw` 流程 `add_draw(period, special, n1, n2, n3, n4, n5, n6)`: 1. INSERT OR REPLACE draws 表 2. **reset 该 period 所有 analysis 的 actual_special=NULL, hit=NULL** (重跑 check_hits) 3. check_hits() 自动跑 (查 draws.special, 找 candidates 里的命中) ### check_hits 找未更新行 ```sql -- 错: WHERE hit IS NULL (hit=0 是已检查过, 不能重跑) -- 对: WHERE actual_special IS NULL (没填过真开彩号) SELECT a.id, a.period, a.candidates FROM analysis a WHERE a.actual_special IS NULL; ``` **坑**: 之前用 `hit IS NULL` 找未更新,**hit=0 (已检查过没中) 也算了**, 重跑 check_hits 不更新。 --- ## 2. Cron 改 no_agent + script ### 背景 Agent 模式 cron 推送**经常编**: - 标题 "082 期" + 内容 "081 期号码" + 时间 "周二"(实际周四) - 即使 SKILL.md 改 Qi-2 描述, model 仍按旧认知编 ### 修法: `no_agent: true` + script ```bash # 改 cron hermes cronjob update 5bec1f60f77f --no_agent true --script lottery_特码_cron.sh ``` 效果: - 模型**不参与** cron 跑 - 直接执行 wrapper script - 输出直接推送到 QQ - **0% 编概率** ### Wrapper script 模板 ```bash #!/bin/bash # 1. 取参数 (从 v_xg.json 或 v_xg.json Qi) # 2. 调真脚本 # 3. 用 cron deliver 推 cd /home/openclaw/.hermes/skills/trading/lottery-hk QI=$(python3 -c " import json, urllib.request req = urllib.request.Request('https://btc.tktk.app/data/v_xg.json', headers={'User-Agent': 'Mozilla/5.0'}) with urllib.request.urlopen(req, timeout=10) as r: print(json.loads(r.read().decode('utf-8')).get('Qi', '???')) ") python3 scripts/lottery_特码.py "${QI}" ``` ⚠️ **prompt 字段还能改但没用** —— no_agent 模式不读 prompt。 ### 4 步流程 (写死 `lottery` skill 不参与) 1. **SKILL.md description** (高权重) - 系统 prompt 全文, 必读 2. **SKILL.md 硬规则块** (中权重) - 显眼, 加载后必看 3. **Cron prompt** (高权重) - 但 no_agent 模式不读 4. **真脚本** (最高保证) - cron 自动跑不靠 model ### 限额: prompt 改 v1.2.7 / 6 个 commit 修正 v_xg.json 字段语义 Qi=Nq 区别: - Qi = 最新已开 (刚开) - Nq = 未开下期 - Week/Day = **Nq 期**开彩日 (不是 Qi 期) - Data.1-7 = Qi-2 期已开号码 --- ## 3. GitLab 502 临时挂 ### 现象 ``` git push origin master fatal: unable to access 'https://git.hi6k.com/mike/Hermes-Skills.git/': The requested URL returned error: 502 ``` ### 修法 - **本地 commit 还在**(不会丢) - **等 5-10 秒重试**, 通常通了 - 多次 502 持续 → 整体 Gitea 服务挂了, **等运维恢复** ### 不影响 - 不影响 cron 跑 - 不影响 SKILL.md 本地版本 - 不影响 git log (本地有) --- ## 4. CN cron 1/3 换时间 `cn-dividend-buy-timing` cron 修改: - 原: `0 11` (11:00 北京, 跟 789a + 366 撞) - 后: `30 11` (11:30 北京, 避开冲突) `hermes cronjob update 8000d3cfed23 --schedule "30 11 * * 1-5"`