小唯
84c21803c0
fix(distill): 日限额按日历日重置,修复跨日不归零导致蒸馏永久冻结
...
checkDailyLimit 原用 time.Since(dailyReset) > 24h 判断跨天,
若进程重启点晚于当日 00:00,则次日重启点之前不会归零 ->
dailyUsed 达上限后持续 FALLBACK 直到重启时刻(2026-09-21 实测冻结 84min)。
改为比较年月日;跨日时清零并把 dailyReset 设为当日 00:00。
新增 engine_dailylimit_test.go 三个用例(同日保持/跨日清零/复现冻结场景)。
2026-09-21 12:04:40 +08:00
小唯
ece2da12ac
fix(distill): narrow short-fact exemption to structured prefixes only
...
The <20-char exemption added earlier for human-side soulful facts also
carried a 'hasStatementSubject && !status && !question' fallback.
hasStatementSubject only checks for a subject word - it does not check
that the content is a fact - so fragments, questions and status
reports all passed:
'用户喜欢喝咖啡' (7 chars, fragment)
'用户重启了系统' (7 chars, fragment)
'用户今天完成了一次系统检查工作' (14 chars, fragment)
'用户要不要升级系统吗' (question)
'小唯a06与all桥接状态同步完成' (status report)
Five assertions in the distill suite were failing because of this
(TestIsQualityFact_ShortFragmentsRejected, _PureQuestionRejected,
_StatusReportRejected, and TestDistillOne_QualityGateBlocksFragments
which kept 2 facts where the gate should keep 1).
The exemption is now limited to daemon-written structured prefixes
(画像规则:/心迹:/牵挂:/偏好:/习惯:/目标:/行为规则:) - strong signals that
cannot be confused with noise. Natural short sentences are weak signals
and are rejected as fragments; if a writer genuinely needs one kept, it
should supply the structured prefix rather than loosen this gate.
go test ./... now passes (TEST_EXIT=0, 8 packages ok).
2026-09-20 08:55:37 +08:00
小唯
3e8157307e
fix distill threshold: allow soulful short facts even when LLM score is low
2026-09-19 23:51:32 +08:00
小唯
3ab4ab01bd
fix HardRulesPass rule2: allow soulful short facts (<10 chars) into distill
2026-09-19 22:23:37 +08:00
小唯
6d4cbc79ca
fix distill quality gate short-fact rejection + register conflicts into active
2026-09-19 21:38:59 +08:00
小唯
68ce2c9678
feat(distill): 限制 prompt ≤8k token 保护本地 2B 单槽; storage: 添加 SoftDeleteBatch 及 Rust 端批量软删除优化 (t_3fb41049)
2026-09-14 22:09:44 +08:00
小唯
e91ca91367
fix(security): 写入侧凭证过滤 — 密钥不再进记忆/图谱/Obsidian 镜像
...
背景(2026-09-10 mc P0 事故):某轮蒸馏把含真 Tailscale 预授权 key 的原始对话
当事实入库 → 知识图谱按其文本建实体 → ObsidianSyncer 用实体标题当文件名/正文,
把 tskey-auth-… 落成可读镜像文件,又被 git 跟踪并推送 Gitea。
本提交在三个写入边界统一加脱敏。
新增 internal/redact(唯一真源):
- SecretPattern 覆盖 sk- / tskey- / github_pat_ / ghp_ / nvapi- / AKIA
- Go RE2 不支持 lookbehind,故"前一字符是否属于更长标识符"手工判定(isTokenByte)
- sk- 段只吃 [A-Za-z0-9],避免误伤 URL 里的 task-driven 片段(事故中的假阳性来源)
- RedactSecrets 幂等;ContainsSecret 供"直接丢弃"场景用
四处接入:
- distill/quality.go IsQualityFact 判定前脱敏 + FilterQualityFacts 返回值脱敏
- governance/graph_auto.go cleanEntityName 命中→空串;UpdateFromDistill 只对有效实体
建节点/建边;extractEntitiesFromText 过滤;含凭证的 fact 不建节点
- api/routes/obsidian.go sanitizeFilename 入参脱敏 + PushToObsidian 镜像正文脱敏
- api/server.go 蒸馏直写记忆库路径(绕过 FilterQualityFacts 的那条)同步脱敏
测试:13 条新用例(redact 5 / distill 3 / governance 4 / routes 1),
含 URL 假阳性回归与幂等性断言。全部使用构造的假密钥,不含任何真实凭证。
证据:go build ./... OK;
go test -count=1 ./internal/redact/ ./internal/distill/ ./internal/governance/ ./internal/api/routes/ 全绿。
顺带修既有 test 腐化(否则 governance 包根本无法编译测试,非本任务引入):
governance_test.go isContradiction→IsContradiction、Navigate 补 relFilter 参数;
bench_test.go 同。仅测试文件,无生产行为改动。
2026-09-11 00:41:59 +08:00
小唯
cdf902b5c0
fix(distill-quality): 严格质量门槛 1b (t_cc07ef4b) — <20字/纯疑问句/状态汇报拒绝; 20-50需实体或动词
...
方案B 严格版(替代 946f0c9 宽松版): quality.go IsQualityFact 重写
- <20字一律拒绝(无用户信号豁免, 与质量看门狗 FRAG_LEN=20 对齐 → AC-2 碎片率<10%)
- 纯疑问句拒绝(带?/?、疑问前缀+吗呢么、无陈述主语短问句)
- 状态汇报型拒绝(无主状态句/健康检查/桥接/reflection/完成重启类)
- 20-50字需含实体(织忆/hermes/牧尘/大写词/数字)或动词短语才入库
engine.go: distillOne 源头过滤(图谱/AAAK/记忆库同源干净) + fallbackSingle 过滤
server.go 写回 IsQualityFact 双保险(同一函数自动变严格)
单测 quality_test.go + quality_engine_test.go (mock LLM 短对话episode → 0碎片入库)
AC-1 dev 验证: 构造含短对话episodes → 蒸馏后碎片不入库 ✅
2026-09-07 21:50:37 +08:00
xiaowei
d454cae849
feat(memory-quality): 方案B写时质量门槛+方案C provenance 标注
...
方案B: distill 结果写 memories 前 IsQualityFact 过滤(碎片<8字拒/8-20字需用户信号/噪声前缀拦)+完全重复查重跳过
- quality.go: 与 LightMem 保留细节哲学兼容(咖啡偏好保留), 拦进程噪声/桥接/reflection
- 单测 8/8 通过
方案C: distill MemoryRecord 标 Source=llm_distill(provenance); volatile_flag 降权已确认生效(×0.5)
- ContentMD5/VersionHistory 字段已在, bi-temporal valid_to 加列缓行(风险高)
2026-09-07 21:50:37 +08:00
xiaowei
2a350cf781
fix(distill): max_tokens 800→1200 — Agnes推理token预算不足
...
Agnes 2.0-flash是推理模型,推理token占大量预算。
800仍不够→JSON截断(parse error: unexpected end of JSON input)。
1200确保推理+正文都够用。
2026-08-20 01:13:06 +08:00