dsh-vibe-math 2.2.2 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUDIT-CHECKLIST.md +61 -3
- package/README.md +119 -1
- package/RELEASE-NOTES-2.3.0.md +207 -0
- package/RELEASE-NOTES-2.3.1.md +134 -0
- package/audit-formal-sensitivity.mjs +333 -0
- package/audit-persona-sensitivity.mjs +249 -0
- package/audit-persona-surface.test.mjs +349 -0
- package/audit-v5-integrity.mjs +43 -2
- package/audit-v5-sensitivity.mjs +77 -6
- package/docs/formal-verification.md +401 -0
- package/docs/generate_framework_diagram_v5.mjs +22 -16
- package/docs/test-timing.md +79 -0
- package/formal-verify-v2.test.mjs +951 -0
- package/formal-verify-v3.test.mjs +1031 -0
- package/formal-verify-v4.test.mjs +882 -0
- package/formal-verify-v5.test.mjs +598 -0
- package/package.json +22 -2
- package/prompt-corpus-persona/persona-corpus.json +32 -0
- package/prompt-corpus-persona/persona-corpus.md +674 -0
- package/prompt-corpus-v2/formal-verify-v2.json +394 -0
- package/prompt-corpus-v2/formal-verify-v2.md +4250 -0
- package/prompt-corpus-v3/formal-verify-v3.json +382 -0
- package/prompt-corpus-v3/formal-verify-v3.md +3843 -0
- package/prompt-corpus-v4/formal-verify-v4.json +84 -0
- package/prompt-corpus-v4/formal-verify-v4.md +255 -0
- package/prompt-corpus-v5/prompt-corpus-v5.json +109 -5
- package/prompt-corpus-v5/prompt-corpus-v5.md +653 -109
- package/prompt-v5-integrity.test.mjs +1158 -984
- package/run-tests.mjs +99 -0
- package/vibe-math-v2/agent.cordis.yml +40 -2
- package/vibe-math-v2/vibe-math-v2.js +811 -21
- package/vibe-math-v2//345/256/236/347/216/260/346/226/271/346/241/210.md +218 -1
- package/vibe-math-v3/agent.cordis.yml +46 -2
- package/vibe-math-v3/vibe-math-v3.js +810 -21
- package/vibe-math-v3//345/256/236/347/216/260/346/226/271/346/241/210.md +104 -2
- package/vibe-math-v4/agent.cordis.yml +46 -4
- package/vibe-math-v4/vibe-math-v4.js +744 -15
- package/vibe-math-v4//345/256/236/347/216/260/346/226/271/346/241/210.md +255 -0
- package/vibe-math-v5/agent.cordis.yml +41 -5
- package/vibe-math-v5/vibe-math-v5.js +621 -9
- package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +131 -4
- package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +57 -0
- package//347/244/272/344/276/213/345/233/276//346/241/206/346/236/266/345/233/276-v5.svg +51 -46
|
@@ -122,6 +122,7 @@ VibeMath/Projects/<project>/
|
|
|
122
122
|
| **任务板** | 常驻在会议/留言提议任务 → 框架记 `Shared/taskboard.md`;认领后被唤醒 | 框架只搬运,不决定谁做什么 |
|
|
123
123
|
| **产物沉淀** | `vibe_v4_publish_progress` / `record_proposition` / `record_method` / `record_subproblem` | **必填**:价值程度 / 动机用途计划 / 自身概率估计(框架校验,缺则提示) |
|
|
124
124
|
| **共识验证** | `vibe_v4_propose_verify(targetId)` → 常驻们同意后开辩论 | 独立初评→公开辩论→**全票真/假才入 Verified/**;否则留库附概率 |
|
|
125
|
+
| **Lean 形式化验证** | `vibe_v4_lean_run` / `vibe_v4_lean_archive` / `vibe_v4_lean_lib` + `formalVerify` 三档开关 | 见 §31;`passed` 后表决对象从"推导是否正确"变成**忠实性**;`require` 档在收口点加门禁 |
|
|
125
126
|
| **停止条件** | 会议中全体常驻对"原问题已解决"投票,**全部同意** → 停止唤醒 | 人工 `abort` 始终可用 |
|
|
126
127
|
| **上下文/compact** | 监测每常驻上下文占比 ≥ 阈值 → 触发 DSH `/compact` | `compactThreshold` 默认 66,可调 |
|
|
127
128
|
| **人工/助手干预** | `vibe_v4_message(all, content)` / `vibe_v4_meeting` / `vibe_v4_add_member` / `remove_member` / `vibe_v4_message(to, content)`;`/v4` slash | 不改变"之后由它们自组织" |
|
|
@@ -303,6 +304,10 @@ VibeMath/Projects/<project>/
|
|
|
303
304
|
| `activityTimeoutMs` | 120000 | 无新消息/任务/提案时的心跳间隔 |
|
|
304
305
|
| `verdictQuorum` | `all` | 固定"全部常驻一致"(哲学要求,不建议放宽) |
|
|
305
306
|
| `perResidentLibs` | 每常驻独立目录 | 若"共享库+署名"会重新引入写锁竞争,不推荐 |
|
|
307
|
+
| `formalVerify` | `'off'` | Lean 形式化三档开关,见 §31.2 |
|
|
308
|
+
| `leanCommand` | `'lean'` | 要执行的 Lean 可执行文件(例:`'lake'`) |
|
|
309
|
+
| `leanArgs` | `[]` | 插在文件名之前的附加参数(例:`['env','lean']` 配合 `leanCommand='lake'`) |
|
|
310
|
+
| `leanTimeoutMs` | `120000` | 单次 Lean 运行的超时上限(非正数回退默认) |
|
|
306
311
|
|
|
307
312
|
---
|
|
308
313
|
|
|
@@ -642,6 +647,256 @@ VibeMath/Projects/<project>/
|
|
|
642
647
|
>
|
|
643
648
|
> 全套测试仍全绿:`selfdrive-v4` 21/21、`e2e-v4-fixes` 94/94(T1–T32)、v3 100/100、v2 business 18/regression 14、multisession 25/25、selfdrive-v3 0 异常。
|
|
644
649
|
|
|
650
|
+
---
|
|
651
|
+
|
|
652
|
+
## 31. Lean 形式化验证(docs/formal-verification.md 的 v4 实现)
|
|
653
|
+
|
|
654
|
+
契约文件是 `../docs/formal-verification.md`(v2/v3/v4/v5 共用);v4 **独立实现同一套语义**,
|
|
655
|
+
零共享模块。核心不是"多一道工序",而是**审查对象的转移**:
|
|
656
|
+
|
|
657
|
+
| | 原验证工作 | 启用形式化后的验证工作 |
|
|
658
|
+
|---|---|---|
|
|
659
|
+
| 审查对象 | 命题本身(推导是否正确) | **忠实性**:Lean 代码 ↔ 命题原文是否逐条一致 |
|
|
660
|
+
| 结论强度 | 共识(可能共同出错) | 严格(内核已检查),前提是忠实性成立 |
|
|
661
|
+
| 副产品 | 无 | 可跨项目复用的 Lean 定义/引理库 |
|
|
662
|
+
|
|
663
|
+
`passed` 只表示"形式化代码通过内核检查",**不**等于"命题为真"——忠实性仍由全体常驻投票审查
|
|
664
|
+
(对应上表"审查对象变化")。框架**不**内置 Lean、**不**判忠实性。
|
|
665
|
+
|
|
666
|
+
### 31.1 四个参数
|
|
667
|
+
|
|
668
|
+
| 参数 | 取值 | 默认 | 校验规则 |
|
|
669
|
+
|---|---|---|---|
|
|
670
|
+
| `formalVerify` | `'off'` \| `'encourage'` \| `'require'` | `'off'` | 非法值一律回退 `'off'`;**绝不**回退到更强的档(一个笔误不得静默强制形式化) |
|
|
671
|
+
| `leanCommand` | 字符串 | `'lean'` | 空白/纯空格 → `'lean'` |
|
|
672
|
+
| `leanArgs` | 字符串数组 | `[]` | 也接受逗号分隔字符串;去空白、丢空项 |
|
|
673
|
+
| `leanTimeoutMs` | 正整数 | `120000` | 非正/NaN → 回退默认 |
|
|
674
|
+
|
|
675
|
+
四者都在 `DEFAULT_PARAMS`、`normalizeParam`(`vibe_v4_set` / `configure.params` / `State/settings.json`
|
|
676
|
+
三条入口共用)、`vibe_v4_set` 的 schema、以及 `status()` 可读参数串里。
|
|
677
|
+
**模式是动态的**:所有与模式相关的提示词文本都在**构造提示词的那一刻**由 `params.formalVerify`
|
|
678
|
+
现算(`formalOn()` / `formalMode()`),**不**写进任何"入职时冻结"的简报快照——切换模式后
|
|
679
|
+
成员在**下一轮**就读到新指令(`formal-verify-v4` 第 2 节钉住这一点)。
|
|
680
|
+
|
|
681
|
+
### 31.2 三档语义
|
|
682
|
+
|
|
683
|
+
**`off`(默认)—— 真无操作。** 提示词里不出现任何 Lean 文本;验证流程、门禁、归档全部不变;
|
|
684
|
+
`Verified/` 卡片不带 `- 形式化:` 行。三个 Lean 工具**仍然注册**(注册是静态的,与既有
|
|
685
|
+
`ctx.effect` 纪律一致),但框架不会告诉代理它们存在;代理/人主动调用时照常工作。
|
|
686
|
+
|
|
687
|
+
**`encourage`—— 鼓励但不强制。**
|
|
688
|
+
- 验证提示词注入 `formalPromptBlock`:先判断**实现难度**,能形式化就优先写 Lean 并执行;
|
|
689
|
+
**一旦 Lean 通过,唯一需要确认的就是忠实性**(逐条核对定义/对象/条件/假设/结论)。
|
|
690
|
+
- 平时工作提示词(normal / heartbeat / 压缩后的 `[核心规则重申]`)注入 `formalWorkLine()`:
|
|
691
|
+
把常用或可复用的对象/假设/新定义用 Lean 形式化并归档(`kind='def'`),已成立引理归 `Formal/Proved/`
|
|
692
|
+
(`kind='lemma'`),写前先 `vibe_v4_lean_lib` 查重。
|
|
693
|
+
- 判断不值得/无法形式化可以不做,但**鼓励**在回执 `formal` 字段写明难度判断。
|
|
694
|
+
- **不设门禁**:没有 Lean 产物也照常收口(与 `off` 相同结论,只是卡片会记 `- 形式化: 未尝试`)。
|
|
695
|
+
|
|
696
|
+
**`require`—— 强制 + 门禁。**
|
|
697
|
+
- 注入文本与 `encourage` 相同,但语气为"必须"(`【Lean 形式化验证(强制模式)】`)。
|
|
698
|
+
- 门禁:对象要被判定为**真**或**假**,必须 `formal.status ∈ {'passed','blocked'}`;否则本次裁定
|
|
699
|
+
**不生效**——记为 `undecided`(原因 `formal-required`)、写 `Formal/TODO.md`、记入活动日志,
|
|
700
|
+
对象**留在原库**且**不写** `Verified/` 卡片、**不**改来源卡的"已验证·真/假"。
|
|
701
|
+
- `passed`:有 Lean 产物且最近一次运行 `exitCode === 0`(**必须真的跑绿**,手写文件不能绕过门禁)。
|
|
702
|
+
- `blocked`:代理给出**显式**难度判断/阻塞原因(`note` 非空)。`note` 空 → 工具直接拒绝。
|
|
703
|
+
这就是"根据实现难度决定是否通过 Lean"的落点:决定权在代理,但**必须显式、可审计**。
|
|
704
|
+
- 门禁是**兜底**:提示词已先告知表决者要 `passed` 或 `blocked`,正常情况下不会触发。
|
|
705
|
+
|
|
706
|
+
### 31.3 门禁位置(唯一收口点)
|
|
707
|
+
|
|
708
|
+
`closeVerify(vs,isTrue)` 之前,即 `finalizeVerify()` 中全票真/假的分支里:
|
|
709
|
+
|
|
710
|
+
```js
|
|
711
|
+
const rec=formalOf(vs.targetId)
|
|
712
|
+
if(formalMode()==='require' && !formalGateOk(rec)) await deferForFormal(vs,allTrue)
|
|
713
|
+
else await closeVerify(vs,allTrue)
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
`deferForFormal` 写辩论录(结论为"未达成一致/未定论",**不**声称真/假)、回写来源卡的平均概率
|
|
717
|
+
(与普通未全票轮一致)、把对象加入 `formalTodos`、落盘 `State/formal.json`、重建
|
|
718
|
+
`Formal/TODO.md` 与 `Formal/Index.md`,并清空 `verifyState`;随后由 `finalizeVerify` 的
|
|
719
|
+
`doSchedule` 立即把团队送回正常工作(**绝不**把调度器卡在对象上)。
|
|
720
|
+
`writeVerifiedCard` 在模式非 `off` 时记录 `- 形式化: <状态>`(`Lean 通过(Verified/Lean/<id>.lean)`
|
|
721
|
+
或 `阻塞(<note>)`)。
|
|
722
|
+
|
|
723
|
+
### 31.4 路径布局
|
|
724
|
+
|
|
725
|
+
```
|
|
726
|
+
<VibeMath 根>/ ← 路径守卫的边界(不是项目根)
|
|
727
|
+
├─ Formal/ # 全局可复用 Lean 库(跨项目)
|
|
728
|
+
│ ├─ Lib/<name>.lean # 可复用定义/对象/假设(kind='def')
|
|
729
|
+
│ ├─ Lib/Index.md # 名称 → 文件 → 类别 → 摘要
|
|
730
|
+
│ ├─ Proved/<name>.lean # 已成立的命题/引理(kind='lemma')
|
|
731
|
+
│ └─ Proved/Index.md # 名称 → 文件 → 类别 → 陈述
|
|
732
|
+
└─ Projects/default/ # = frameworkRoot()
|
|
733
|
+
├─ Formal/
|
|
734
|
+
│ ├─ <对象id>.lean # 该对象的形式化工作文件
|
|
735
|
+
│ ├─ Index.md # 对象 → 状态 → 文件 → 归档证明 → 最近运行 → 难度判断
|
|
736
|
+
│ └─ TODO.md # require 模式下的「形式化待办」
|
|
737
|
+
└─ Verified/
|
|
738
|
+
├─ <原有定论卡片>
|
|
739
|
+
└─ Lean/<对象id>.lean # ★ 归档证明(与定论卡片同处 Verified/)
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
- 归档证明放 `Verified/Lean/<id>.lean`:一眼可见"这条结论的形式化证明在哪"。
|
|
743
|
+
- 可复用的东西放全局 `Formal/{Lib,Proved}`:跨项目复用是这套设计的核心收益。
|
|
744
|
+
- 文件 id 一律过既有的 `idSafe`(去分隔符/`..`),与既有路径穿越防护一致。
|
|
745
|
+
- `ensureDirs()` 创建项目侧 `Formal/`、`Verified/Lean/` **与全局** `Formal/Lib`、`Formal/Proved`。
|
|
746
|
+
- **路径守卫**:`normalizeAbsPath` + `leanAbsPath` 做**词法**归一(不动文件系统),边界是
|
|
747
|
+
**VibeMath 根**。因此 `../../Formal/Lib/x.lean` 这类"出项目但仍在 VibeMath 内"的路径是合法的
|
|
748
|
+
(全局库就在那儿),而爬升到 VibeMath 根**之上**、或任何无关绝对路径(`/etc/evil.lean`、
|
|
749
|
+
`C:\Windows\evil.lean`)一律拒绝。
|
|
750
|
+
|
|
751
|
+
### 31.5 三个工具(前缀 `vibe_v4_`)
|
|
752
|
+
|
|
753
|
+
| 工具 | 参数 | 行为 |
|
|
754
|
+
|---|---|---|
|
|
755
|
+
| `vibe_v4_lean_run` | `file`(必填), `target`, `timeout_ms` | 执行一个 `.lean`;返回 `{ok,exitCode,signal,ms,command,stdout,stderr,file,timedOut}` + `hint`。给了 `target` 就把运行记录写进该对象的 `formal` 记录 |
|
|
756
|
+
| `vibe_v4_lean_archive` | `kind`(必填) `'def'\|'lemma'\|'proof'\|'blocked'`, `name`, `target`, `content`, `from`, `note`, `run` | `def`/`lemma` → 全局 `Formal/Lib` / `Formal/Proved` 并重建索引;`proof` → `Formal/<target>.lean`,跑绿则另写 `Verified/Lean/<target>.lean` 并标 `passed`;`blocked` → 显式阻塞记录(`note` 必填) |
|
|
757
|
+
| `vibe_v4_lean_lib` | `refresh`(可选,`false` 时只读不重建) | 扫描并重建三处索引,返回可复用库清单与各对象形式化状态(供写新定义前查重) |
|
|
758
|
+
| `vibe_v4_prompts` | `which`, `member`, `target`, `stage` | 只读回显某个常驻**实际会读到**的提示词原文(`brainstorm\|normal\|heartbeat\|verify\|coreRules`)。"成员读到的文字就是产品":提示词必须可被审计,而不是只能靠工具返回值推断 |
|
|
759
|
+
|
|
760
|
+
### 31.6 `formal` 记录与状态迁移
|
|
761
|
+
|
|
762
|
+
```jsonc
|
|
763
|
+
{
|
|
764
|
+
"status": "none" | "attempted" | "passed" | "blocked",
|
|
765
|
+
"file": "Formal/p-1.lean",
|
|
766
|
+
"proof": "Verified/Lean/p-1.lean", // 仅 passed
|
|
767
|
+
"decision": "used" | "blocked",
|
|
768
|
+
"note": "…", // blocked 时必填
|
|
769
|
+
"run": { "at": 0, "ok": true, "exitCode": 0, "ms": 0, "stdoutTail": "", "stderrTail": "" },
|
|
770
|
+
"updatedAt": 0
|
|
771
|
+
}
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
| 事件 | 迁移 |
|
|
775
|
+
|---|---|
|
|
776
|
+
| `lean_run` 成功/失败 | → `attempted`(记录运行结果;`passed`/`blocked` 不被红运行降级) |
|
|
777
|
+
| `lean_archive{kind:'proof'}` + 该文件最近一次运行 `ok` | → `passed`,写 `Verified/Lean/<id>.lean` |
|
|
778
|
+
| `lean_archive{kind:'proof'}` + 红运行 | → `attempted`(**不**写 `Verified/Lean/`) |
|
|
779
|
+
| `lean_archive{kind:'blocked', note}` | → `blocked`(`note` 空 → 拒绝) |
|
|
780
|
+
| 回执里 `formal:{target, decision:'blocked', note}` | → `blocked`(`note` 空则仅记日志、不建记录) |
|
|
781
|
+
| 回执里 `formal:{target, decision:'used', file}` | → `attempted`(记录文件) |
|
|
782
|
+
|
|
783
|
+
**状态存储**:v4 没有会话日志投影,故 `formal` 记录**用自己的持久化机制**
|
|
784
|
+
`State/formal.json`(`{records:{<id>:…}, todo:[…]}`),由 `saveAll()` 一起写、`loadAll()` 一起读,
|
|
785
|
+
随 `resume` 存活(`formal-verify-v4` 第 5 节钉住"abort → resume 后 `passed` 仍在");
|
|
786
|
+
`start()` 开新一轮时清空(id 会复用,陈旧 `passed` 不得打开新 run 的门禁)。
|
|
787
|
+
|
|
788
|
+
### 31.7 错误码
|
|
789
|
+
|
|
790
|
+
| 码 | 何时 |
|
|
791
|
+
|---|---|
|
|
792
|
+
| `NO_SUBPROCESS` | 宿主没有 `subprocess` 服务(只记 `attempted`,绝不抛异常) |
|
|
793
|
+
| `LEAN_NOT_FOUND` | `resolveExecutable(leanCommand)` 失败(工具链未安装 → 优雅降级) |
|
|
794
|
+
| `LEAN_SPAWN_FAILED` | `spawn` 本身抛错 |
|
|
795
|
+
| `LEAN_RUN_FAILED` | `await handle.done` 抛错 |
|
|
796
|
+
| `LEAN_TIMEOUT` | 非零退出且耗时达到 `graceMs`(超时上限) |
|
|
797
|
+
| `LEAN_FAILED` | 其它非零退出(编译器输出原样返回 ~4KB 尾巴) |
|
|
798
|
+
| `V4_INVALID_ARGUMENT` | 缺 `file`/`kind`/`name`/`target`/`note`;非 `.lean`;越界路径;未知 `kind` |
|
|
799
|
+
| `V4_NOT_FOUND` | `.lean` 文件不存在(越界被拒 ≠ 不存在:两者码不同) |
|
|
800
|
+
| `V4_WRITE_FAILED` | 目标路径写不进去 |
|
|
801
|
+
|
|
802
|
+
**绝不抛异常到调度循环**:`leanRunFile` 把每一种失败都变成可读结果;`onResidentEnd` 里的
|
|
803
|
+
`applyFormalReply` 整体包在 try/catch 内(回执处理失败只记 `activityLog`,不影响本轮结算)。
|
|
804
|
+
|
|
805
|
+
### 31.8 提示词注入点
|
|
806
|
+
|
|
807
|
+
| 提示词 | 注入内容 | 条件 |
|
|
808
|
+
|---|---|---|
|
|
809
|
+
| `verifyPrompt` | `formalPromptBlock(target)` + 回执契约多一个 `"formal":{…}` 字段 | 模式非 `off` |
|
|
810
|
+
| `verifyPrompt`(对象已 `passed`) | "已有**通过的 Lean 形式化证明**(路径)…**你不需要重新检查推导**…**忠实性审查**" + "▸ 因此请把 verdict 用在**忠实性**上" | `formal.status === 'passed'` |
|
|
811
|
+
| `verifyPrompt`(`blocked`) | 阻塞原因 + "请复核这个判断是否成立" | `formal.status === 'blocked'` |
|
|
812
|
+
| `verifyPrompt`(`require`) | "**必须产出 Lean 形式化**,或必须给出显式阻塞原因…否则本次裁定不会生效(formal-required)" | `formalMode()==='require'` |
|
|
813
|
+
| `normalPrompt` / `heartbeatPrompt` | `formalWorkLine()` + 回执契约的 `formal` 字段 | 模式非 `off` |
|
|
814
|
+
| `coreRulesBrief`(压缩后重申) | `formalWorkLine()` | 模式非 `off` |
|
|
815
|
+
|
|
816
|
+
> 注:`formalPromptBlock` 的"`passed` 分支"是本功能的**核心**——它把表决者从"重做一遍推导"
|
|
817
|
+
> 转到"逐条核对 Lean 代码是否忠实于命题原文"。
|
|
818
|
+
|
|
819
|
+
### 31.9 索引格式
|
|
820
|
+
|
|
821
|
+
三份索引由框架维护(工具调用时增量更新,`vibe_v4_lean_lib` 会重建):
|
|
822
|
+
|
|
823
|
+
- `<项目>/Formal/Index.md`:对象 → 状态 → 形式化文件 → 归档证明 → 最近运行 → 难度判断/阻塞原因,
|
|
824
|
+
末尾附 `## 形式化待办(require 模式:定论被搁置)`。
|
|
825
|
+
- `<VibeMath 根>/Formal/Lib/Index.md`:名称 → 文件 → 类别 → 摘要。
|
|
826
|
+
- `<VibeMath 根>/Formal/Proved/Index.md`:名称 → 文件 → 类别 → 陈述。
|
|
827
|
+
|
|
828
|
+
`Lean 通过` / `阻塞(…)` 这两个字符串是**卡片契约**的一部分(`- 形式化: <状态>`),
|
|
829
|
+
`formal-verify-v4.test.mjs` 直接断言它们。
|
|
830
|
+
|
|
831
|
+
### 31.10 测试
|
|
832
|
+
|
|
833
|
+
`formal-verify-v4.test.mjs`(仓库根,144 条断言):
|
|
834
|
+
`off` 真无操作(含"提示词里无 Lean 文本"与"`off` 下照常写入 Verified/")、参数校验与运行时切换、
|
|
835
|
+
`encourage` 双提示词注入、三个工具的全部分支(绿/红/缺文件/路径穿越/非 `.lean`/缺工具链/
|
|
836
|
+
`def`/`lemma`/`proof`/`blocked`/索引重建)、`passed` 后切忠实性措辞、`require` 门禁的
|
|
837
|
+
真/假/补形式化/显式阻塞四条路径、回执 `formal` 通道、以及状态在 `resume` 后存活。
|
|
838
|
+
支持 `V4_PLUGIN` 环境变量指向变异副本(与 v5 的 `V5_PLUGIN` 约定一致),
|
|
839
|
+
供灵敏度审计证明每条不变式都能让本套件**变红**。
|
|
840
|
+
|
|
841
|
+
### 31.11 同批修复:`/v4` 斜杠命令的三个"口头表面"必须一致
|
|
842
|
+
|
|
843
|
+
Lean 这一批改动同时做了一次**静态提示词面**审计(`audit-persona-surface.test.mjs`),
|
|
844
|
+
它把"人设 / 命令 hint / usage 串 / 实际分支"四处当同一个契约来核对,于是抓到一个**复发**缺陷:
|
|
845
|
+
`/v4` 的失败提示 `usage` 里列着 `message`,但命令处理器**没有** `message` 分支
|
|
846
|
+
(`usage` 会自己把自己再列一遍,等于"告诉用户有个不存在的子命令")。
|
|
847
|
+
这与 §23 修过的 `/v4 set` 是**同一类**缺陷——当时只补了分支,没有留下"三处表面必须一致"的守卫,
|
|
848
|
+
所以它又发生了一次。现在:
|
|
849
|
+
|
|
850
|
+
- 补上 `message` 分支:`/v4 message <to|all> <content>` → 与 `vibe_v4_message` 同一语义
|
|
851
|
+
(`all` 或省略收件人 → `broadcast`;否则 `postMessage('facilitator', to, content)`;内容为空则返回用法)。
|
|
852
|
+
- `hint` / `usage` / persona 的 `/v4` 列表 / 实际分支**四处同步**;
|
|
853
|
+
- `audit-persona-surface.test.mjs` 新增断言(hint ⊆ 分支、分支 ⊆ hint(hint 用 `...` 表示非穷举时除外)、
|
|
854
|
+
`usage` 与分支集合**完全相等**、persona 的 `/vN` 列表与 hint 一致),
|
|
855
|
+
`audit-persona-sensitivity.mjs` 用变异副本证明这几条会变红。
|
|
856
|
+
|
|
857
|
+
### 31.12 同批修复:v4 人设漏掉的工具与参数
|
|
858
|
+
|
|
859
|
+
同一次审计还发现 persona(主代理收到的提示词)与注册表不一致——所有 e2e 套件都直接
|
|
860
|
+
`apply(ctx)`、**从不加载 YAML**,因此对这一层完全盲:
|
|
861
|
+
|
|
862
|
+
- persona 从未列出三个 `vibe_v4_lean_*` 工具(它们**无条件注册**);
|
|
863
|
+
- `vibe_v4_set {…}` 的参数表漏了 `formalVerify` / `leanCommand` / `leanArgs` / `leanTimeoutMs`,
|
|
864
|
+
于是这个开关**不可发现**(工具 schema 里有、prompt 里没有);
|
|
865
|
+
- persona 从未列出 `vibe_v4_prompts`——恰恰是"把某成员会收到的确切提示词读出来"的审计工具。
|
|
866
|
+
|
|
867
|
+
三处已补入 persona 的 `prefix` 与 `text` **两个块**,并由 `audit-persona-surface.test.mjs`
|
|
868
|
+
(双向一致性 + 未文档化工具显式快照 + `prefix`/`text` 逐行一致)长期守护。
|
|
869
|
+
|
|
870
|
+
### 31.13 忠实性缺陷 `defect`:形式化写错了 ≠ 命题为假(2.3.1)
|
|
871
|
+
|
|
872
|
+
首版提示词写的是"一致 → 1;发现任何偏离 → 0"。这条指令有一个致命后果:Lean 代码写的不是命题
|
|
873
|
+
想说的(写窄了/写宽了/换了对象/漏了条件)时,投票 0 的含义是"**该命题为假**"——框架会把
|
|
874
|
+
"形式化不合格"记成"命题被证伪",甚至在 v4 的**全组一致**规则下把命题写进 `Verified/` 标注**假**。
|
|
875
|
+
用来求真的机制反而**伪造出一个错误的否定结论**。
|
|
876
|
+
|
|
877
|
+
按契约 §4.1 改为独立的 `defect` 档:
|
|
878
|
+
|
|
879
|
+
- **表决者**:不得投 1 或 0;给一个严格介于 0 与 1 之间的值(记为弃权)并在 `reason` 里写清偏差,
|
|
880
|
+
同时用回执 `formal:{decision:'defect', note:'<具体偏差>'}` 记录(`note` 必填,缺则 `V4_INVALID_ARGUMENT`)。
|
|
881
|
+
- **框架**:把该对象**降级为 `attempted`**(无论此前是 `passed` 还是 `blocked`)、清空 `proof`、
|
|
882
|
+
撤回归档证明 `Verified/Lean/<id>.lean`(`subprocess` 可删则删,否则用"已撤回"说明覆盖)、
|
|
883
|
+
`note` 记入记录与 `Formal/TODO.md`、活动日志公告。
|
|
884
|
+
- **`require` 档**:降级后 `formalGateOk` 为假 → 本次裁定**不定论**(`deferForFormal`),
|
|
885
|
+
对象进「形式化待办」,修正形式化并重新跑通后再投票。
|
|
886
|
+
- **只有独立于这份 Lean 代码也能确定命题为假**时才投 0,并在 `reason` 里写清独立理由。
|
|
887
|
+
|
|
888
|
+
同批补齐的提示词硬要求(契约 §6):注入文本里的工具名**一律全称**(`vibe_v4_lean_*`;缩写
|
|
889
|
+
`lean_archive` 不是注册名);归档可复用定义/引理**前先跑通**(`run=true` 或先 `vibe_v4_lean_run`),
|
|
890
|
+
跑不通不许进 `Formal/Lib`/`Proved`;**工具链缺失**(`LEAN_NOT_FOUND`)时把代码归档并在 `note`
|
|
891
|
+
写明"宿主无 Lean 工具链"——这算显式阻塞原因,门禁据此放行,不会因为装不了 Lean 而卡死。
|
|
892
|
+
|
|
893
|
+
**测试**:`formal-verify-v4.test.mjs` 增至 **226 条断言**(含 `defect` 端到端:降级 + 撤回归档证明 +
|
|
894
|
+
进待办 + `require` 档不定论 + 缺 `note` 被拒;注入文本不得出现缩写工具名、不得出现"偏离 → 0"),
|
|
895
|
+
并新增随包发布的人工复核语料 `prompt-corpus-v4/formal-verify-v4.{json,md}`
|
|
896
|
+
(覆盖 off 无 Lean 文字、encourage、**require**、passed 忠实性分支、平时工作轮、回执契约;
|
|
897
|
+
工作区路径归一化为 `<WS>`、VibeMath 根为 `<VIBEMATH>`,可 diff、无本机路径)。
|
|
898
|
+
|
|
899
|
+
|
|
645
900
|
|
|
646
901
|
|
|
647
902
|
|
|
@@ -92,10 +92,28 @@
|
|
|
92
92
|
- vibe_v5_message {to|all, content} — relay a human message into the institute.
|
|
93
93
|
- vibe_v5_meeting {agenda, kind} — convene a meeting.
|
|
94
94
|
- vibe_v5_members — roster (office/employer/status/direction).
|
|
95
|
-
- vibe_v5_hire / vibe_v5_fire —
|
|
96
|
-
|
|
95
|
+
- vibe_v5_hire / vibe_v5_fire — temp workers: hire one (office, academician or a permanent researcher) / dismiss one for real.
|
|
96
|
+
- vibe_v5_add_researcher / vibe_v5_remove_researcher — OFFICE only: add or dismiss a PERMANENT researcher (the academician can only propose those).
|
|
97
|
+
- vibe_v5_lean_run / vibe_v5_lean_archive / vibe_v5_lean_lib — Lean formal
|
|
98
|
+
verification (execute / archive / list the reuse library). Members use them
|
|
99
|
+
too; they work in every mode.
|
|
100
|
+
A /v5 slash command mirrors these (configure|start|resume|pause|stop|status|report|members|message|meeting|hire|fire|add|remove|set).
|
|
101
|
+
|
|
102
|
+
LEAN FORMAL VERIFICATION (formalVerify, a tunable parameter):
|
|
103
|
+
- 'off' (default, no extra requirement) | 'encourage' (members decide by
|
|
104
|
+
implementation difficulty whether to formalize; a passing Lean run turns the
|
|
105
|
+
vote into a FIDELITY review of the Lean statements) | 'require' (same, plus a
|
|
106
|
+
gate: a true/false verdict is withheld as 未定论 until the object is Lean-passed
|
|
107
|
+
or carries an explicit, reasoned blocker record).
|
|
108
|
+
- Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean;
|
|
109
|
+
reusable definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
|
|
110
|
+
- The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
|
|
111
|
+
(e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
|
|
112
|
+
reported as LEAN_NOT_FOUND and still lets the code be written and archived.
|
|
113
|
+
- vibe_v5_status / vibe_v5_report show the mode, per-object formal status and the
|
|
114
|
+
formalization TODO. The framework never installs Lean and never judges fidelity.
|
|
97
115
|
|
|
98
|
-
TRUST RULE: only Verified/ (and library cards marked 已验证·真/假)
|
|
116
|
+
TRUST RULE: only Verified/ (and library cards marked 已验证·真/假) is
|
|
99
117
|
absolutely trustworthy. Everything else — unverified claims, Progress/,
|
|
100
118
|
unverified Methods/ assertions — is experiential reference.
|
|
101
119
|
|
|
@@ -166,8 +184,26 @@
|
|
|
166
184
|
- vibe_v5_message {to|all, content} — relay a human message into the institute.
|
|
167
185
|
- vibe_v5_meeting {agenda, kind} — convene a meeting.
|
|
168
186
|
- vibe_v5_members — roster (office/employer/status/direction).
|
|
169
|
-
- vibe_v5_hire / vibe_v5_fire —
|
|
170
|
-
|
|
187
|
+
- vibe_v5_hire / vibe_v5_fire — temp workers: hire one (office, academician or a permanent researcher) / dismiss one for real.
|
|
188
|
+
- vibe_v5_add_researcher / vibe_v5_remove_researcher — OFFICE only: add or dismiss a PERMANENT researcher (the academician can only propose those).
|
|
189
|
+
- vibe_v5_lean_run / vibe_v5_lean_archive / vibe_v5_lean_lib — Lean formal
|
|
190
|
+
verification (execute / archive / list the reuse library). Members use them
|
|
191
|
+
too; they work in every mode.
|
|
192
|
+
A /v5 slash command mirrors these (configure|start|resume|pause|stop|status|report|members|message|meeting|hire|fire|add|remove|set).
|
|
193
|
+
|
|
194
|
+
LEAN FORMAL VERIFICATION (formalVerify, a tunable parameter):
|
|
195
|
+
- 'off' (default, no extra requirement) | 'encourage' (members decide by
|
|
196
|
+
implementation difficulty whether to formalize; a passing Lean run turns the
|
|
197
|
+
vote into a FIDELITY review of the Lean statements) | 'require' (same, plus a
|
|
198
|
+
gate: a true/false verdict is withheld as 未定论 until the object is Lean-passed
|
|
199
|
+
or carries an explicit, reasoned blocker record).
|
|
200
|
+
- Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean;
|
|
201
|
+
reusable definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
|
|
202
|
+
- The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
|
|
203
|
+
(e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
|
|
204
|
+
reported as LEAN_NOT_FOUND and still lets the code be written and archived.
|
|
205
|
+
- vibe_v5_status / vibe_v5_report show the mode, per-object formal status and the
|
|
206
|
+
formalization TODO. The framework never installs Lean and never judges fidelity.
|
|
171
207
|
|
|
172
208
|
TRUST RULE: only Verified/ (and library cards marked 已验证·真/假) is
|
|
173
209
|
absolutely trustworthy. Everything else — unverified claims, Progress/,
|