Files
CyberGril/docs/budget-plan-hel874.md
T
zonggongandmultica-agent e978e878df HEL-874 rework: bounded verbatim readback reaches the real provider input, real pinned Mem0 2.2.1 SDK contract verified live and the adapter's five wiring defects fixed, budget gates made provable (atomic reserve/settle embed ledger + independent llm_ops cap), definite-cap real-check execution table, 8360 isolated release package prepared (not deployed), 2026-10-26 user originals recorded source-only - semantic.context now quotes chain-verified archive rows (original words + role + when, <=200-char window with visible trim marker, summary demoted to a one-line pointer, same min(600,budget) cap) and episodic.context flips from gist-first-120-chars to verbatim-first (<=240) + role + date, both proven by tests/test_readback_hel874.py capturing the actual messages handed to the provider through the real API path: a detail absent from the gist yet quoted verbatim from a turn pushed outside the recent-20 window, the same for a semantic chain hit, and an unshared companion row never leaking through FTS, semantic or any anchor (AM-001); tools/verify_mem0_real_hel874.py runs the FIXED install itself (mem0ai 2.2.1 2c81af3, real embedded qdrant, real fastembed from the existing cache, deterministic 127.0.0.1 fake gateway, temp ledgers only): before=31970c4 dies at construction (second QdrantClient on the same path rejected by the SDK - recorded), and source-level findings confirmed live and fixed - unscoped search raises ValueError in 2.2.1 (add now carries user_id scope, search passes filters+top_k since limit is silently ignored), payload reads ride the SDK's own vector_store.client, the old outer search debit double-counted (wrapper is now the single accounting point), the SDK's internal extraction LLM was ungated (LlmLedgerGuard with its own llm_ops table, cap default 0) and check-then-debit could overshoot under concurrency (EmbedLedgerGuard now reserves atomically in BEGIN IMMEDIATE, releases on failure/cancel, purges stale holds); after fixes all 12 checks pass (construction/anchor payload/user scope/1 LLM + 2-3 embeds per add measured/extraction input set provably only prior gated batches incl. old memories and rolling history/unshared canary zero outbound/search single debit/concurrency never over cap/close-reopen intact/both zero caps refuse with ZERO outbound LLM requests), evidence in docs/rework/hel874/; mood sensitivity returns to the original repo's continuous rule 1.35-0.70*strength (bazi.sensitivity_from_strength, foundation commit 1012d8b) replacing HEL-870's invented 1.25/0.8 step and is labeled an engineering heuristic, never user-approved bazi science (external agent formulas remain not adopted); docs/budget-plan-hel874.md gives definite caps for the one-time team check (55 requests/0 embeds), first-week semantic activation (<=60 extract LLM / <=180 embeds) and user daily use with code-level hard-gate facts and authorization sources (old 20-30/100-200 were estimates, not approved quota; frozen 39/60 and 498/500 untouched and never挪用); deploy/hel874-release.md + cybergril-hel874-8360.service.example prepare the isolated fresh-empty-data-dir release with health capability matrix and data-preserving rollback (NOT executed, PR#11 not merged, no user-facing loop, no experience address); sources/comment-evidence-full-experience-20261026.json adds the two 2026-10-26 user originals (01a17806, 01a1780e full-experience-then-iterate) with authorship verified and manifest appended only - baseline/current/coverage/changes untouched; verification: 256 python tests pass on 3.11.16 venv + requirements.lock offline (3 new real-provider-input readback cases incl. AM-001 negative, mem0 fake rebuilt to mirror the real 2.2.1 surfaces, 9 cases), ruff clean, web tsc + 42 vitest + build pass, local 8360 stub smoke (loopback, isolated temp DB) health R4-assembly all green then stopped, real-SDK script re-run 12/12 after final edits, dual-target requirement checks 4/4 pass with handoff-HEL-874.json; zero real model calls, zero real embeddings, zero outbound (fake gateway on loopback + existing local model cache only), authoritative ledgers and freezes untouched, no existing services or profiles touched
Co-authored-by: multica-agent <github@multica.ai>
2026-10-26 22:13:45 +08:00

4.5 KiB
Raw Blame History

HEL-874 · 真实整体检查执行表(有确定上限,交总管核定)

本表取代 runbook-hel870 §6 的估算口径:**原「约 20–30 次请求 / 100–200 条嵌入」 只是估算,不构成任何已批准额度。**本卡(HEL-874)零真实模型调用、零真实嵌入、 零出站(真实 SDK 验证全部走本地确定性替身与本地模型缓存)。

三部分各自独立账本与授权来源;超出既有授权的部分由总管向白栖知申请, 批准前对应硬闸保持 cap=0(fail-closed,任何真实工作前拒绝)。 HEL-857 系列冻结余额(真实请求 39/60、嵌入 498/500、HEL-835 闸)不挪用、 不清零、不并入本表任何一部分。

0. 实测单次开销(本卡真实 SDK 验证得出,docs/rework/hel874/)

操作 LLM 请求 嵌入条数 说明
Mem0 单行 add(infer) 1 2–3 phase1 查询嵌入 1 + phase3 提取批嵌入 N + phase7 实体 upsert 0..N
Mem0 search 0 1 问答每轮 1 条查询嵌入
失败/取消 预占即释放 不计账 预占-落账事务制;仅 LLM 失败前已成功的嵌入照实计(工作真实发生)
重试上限 每批 ≤3 次 同上×3 作业循环 attempts<3,租约过期回收不重发已成功批次

1. A 部分 · 一次性团队整体检查(隔离空库,非用户档案)

用途:统一候选在 8360 隔离实例上按体验链路清单 1–7 全链走一遍(stub 语义, 不激活 Mem0),验证创建→对话→生活→情绪/关系→主动联系→重开同步与隐私负例。

项 次数上限(硬顶)
创建 + 自主诠释 + 初始习惯 4 次请求
对话(含多轮、中断重试) 12 轮 ≤ 16 次请求
生活槽(4 槽)+ 打断/恢复 ≤ 8 次请求
分享判定 / 成长 / gist ≤ 20 次请求(每完成轮 2 条 gist × 最多 8 轮 + 判定/成长若干)
主动联系措辞 ≤ 3 次请求
合计硬顶 55 次请求 / 500,000 tokens / 0 嵌入
  • 硬闸:BudgetGuard(daily_tokens,见 config/models.yaml)+ 每 Scene 记账; 到 95% 非关键场景降档、单次超限降一档,不静默超支。
  • 授权来源:需总管新批(.11:8731 网关在产品环境的用量不属于 HEL-857 的 60 次实验授权)。

2. B 部分 · 首周后台/语义激活(需白栖知批准后执行)

用途:CYBERGRIL_SEMANTIC=mem0 真实激活,独立新账(embed_ops 续账 + llm_ops 新表),观察提取/检索/原话回读在真实使用中的质量。

项 上限(硬顶)
Mem0 提取 LLM(随公开轮 add) ≤ 60 次
嵌入(提取批 + 实体 + 查询) ≤ 180 条
对话/生活/判定等其余 并入 C 部分日账
  • 硬闸:embed_cap / llm_cap 写入 config/semantic.yaml(默认 0=拒绝); 预占-落账事务制保证并发不越 cap、失败不计账;embed_reserve 预留复测余量。
  • 碰上限即停:作业批标 failed:semantic_embed_budget_exhausted,检索返回空 块、对话回落词面 FTS,主对话不中断;恢复需总管调 cap,不自动翻页。
  • 授权来源:需白栖知明确批准(提高嵌入上限或另批独立账;现有 498/500 余额 2 条不够任何真实激活,属 HEL-835 未解闸范围)。

3. C 部分 · 用户日常使用(体验地址交付后)

项 日上限(硬顶,建议值交核定)
主对话 + 主动措辞 + 危机 ≤ 60 次/日
生活事件生成(4 槽/天) ≤ 8 次/日
gist/判定/成长 ≤ 40 次/日
Mem0 提取 LLM ≤ 40 次/日
嵌入(全部) ≤ 60 条/日
tokens 2,000,000/日(既有 BudgetConfig 硬闸)
  • 硬闸同上;daily_tokens 到 95% 降档、到顶停(非关键场景转规则路径), 嵌入/提取到顶只停语义层,主对话可继续。
  • 授权来源:需白栖知批准日预算后才能交付体验地址;首周日用量按本表 B 部分上限受控观察,超限如实记录不补发。

4. 本卡已核实的闸门事实(代码级,测试可复现)

  1. embed_cap=0 / llm_cap=0 在任何真实工作前拒绝,出站 LLM 为 0 (真实 SDK 实测 C5)。
  2. 每次 search 恰好 1 条嵌入记账;并发预占不越 cap(C4/C6)。
  3. 对话同一轮绝不双发(chat_lock + 轮次幂等重放)。
  4. 语义作业失败 ≤3 次重试、租约回收不重复发送;失败嵌入不计账。
  5. 主对话 token 走 BudgetGuard 唯一闸,按 Scene 分桶可审计。