dsh-vibe-math 2.6.0 → 2.7.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.
Files changed (59) hide show
  1. package/README.en.md +161 -389
  2. package/README.md +161 -390
  3. package/cordis.patch.yml +62 -14
  4. package/docs/AUDIT-CHECKLIST.md +2 -2
  5. package/docs/final-paper.md +1 -0
  6. package/docs/formal-verification.md +184 -29
  7. package/docs/math-computation.md +163 -0
  8. package/docs/release-notes/RELEASE-NOTES-2.7.0.en.md +151 -0
  9. package/docs/release-notes/RELEASE-NOTES-2.7.0.md +115 -0
  10. package/docs/release-notes/RELEASE-NOTES-2.7.1.en.md +86 -0
  11. package/docs/release-notes/RELEASE-NOTES-2.7.1.md +86 -0
  12. package/docs/test-timing.md +24 -12
  13. package/installer.js +7 -4
  14. package/package.json +21 -3
  15. package/prompt-corpus-persona/persona-corpus.json +12 -12
  16. package/prompt-corpus-persona/persona-corpus.md +128 -32
  17. package/prompt-corpus-v2/formal-verify-v2.json +182 -92
  18. package/prompt-corpus-v2/formal-verify-v2.md +2379 -55
  19. package/prompt-corpus-v3/formal-verify-v3.json +215 -53
  20. package/prompt-corpus-v3/formal-verify-v3.md +2147 -22
  21. package/prompt-corpus-v4/formal-verify-v4.json +14 -14
  22. package/prompt-corpus-v4/formal-verify-v4.md +267 -14
  23. package/prompt-corpus-v5/prompt-corpus-v5.json +62 -62
  24. package/prompt-corpus-v5/prompt-corpus-v5.md +631 -3
  25. package/tests/audit-math-computation-contract.mjs +204 -0
  26. package/tests/audit-math-computation-parity.mjs +198 -0
  27. package/tests/audit-math-computation-sensitivity.mjs +231 -0
  28. package/tests/audit-persona-sensitivity.mjs +4 -4
  29. package/tests/audit-persona-surface.test.mjs +38 -10
  30. package/tests/audit-v5-integrity.mjs +14 -0
  31. package/tests/e2e-v5-round2.test.mjs +459 -2
  32. package/tests/formal-verify-v2.test.mjs +362 -8
  33. package/tests/formal-verify-v3.test.mjs +355 -6
  34. package/tests/formal-verify-v4.test.mjs +295 -6
  35. package/tests/formal-verify-v5.test.mjs +9 -1
  36. package/tests/helpers/math-computation-fake-seam.mjs +163 -0
  37. package/tests/math-computation-shared.test.mjs +806 -0
  38. package/tests/prompt-v5-integrity.test.mjs +5 -5
  39. package/vibe-math-v2/agent.cordis.yml +22 -8
  40. package/vibe-math-v2/math-computation.js +1279 -0
  41. package/vibe-math-v2/math-engines.js +197 -0
  42. package/vibe-math-v2/vibe-math-v2.js +853 -40
  43. package/vibe-math-v2//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
  44. package/vibe-math-v3/agent.cordis.yml +22 -8
  45. package/vibe-math-v3/math-computation.js +1279 -0
  46. package/vibe-math-v3/math-engines.js +197 -0
  47. package/vibe-math-v3/vibe-math-v3.js +844 -47
  48. package/vibe-math-v3//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
  49. package/vibe-math-v4/agent.cordis.yml +38 -6
  50. package/vibe-math-v4/math-computation.js +1279 -0
  51. package/vibe-math-v4/math-engines.js +197 -0
  52. package/vibe-math-v4/vibe-math-v4.js +816 -31
  53. package/vibe-math-v4//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
  54. package/vibe-math-v5/agent.cordis.yml +42 -6
  55. package/vibe-math-v5/math-computation.js +1279 -0
  56. package/vibe-math-v5/math-engines.js +197 -0
  57. package/vibe-math-v5/vibe-math-v5.js +1132 -37
  58. package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +83 -3
  59. package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +251 -0
package/cordis.patch.yml CHANGED
@@ -75,9 +75,16 @@
75
75
  - vibe_math_new_project / vibe_math_set_project / vibe_math_list_projects — per-project folders.
76
76
  - vibe_math_list_decisions / vibe_math_decide {id, action: approve|reject|override, verdict?} — resolve manual decisions.
77
77
  - vibe_math_list_agents / vibe_math_message_agent / vibe_math_interrupt_agent — inspect / steer / interrupt subagents.
78
- - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal
79
- verification (execute / archive / list the reuse library). The scheduler's child agents
80
- use them too; they work in every mode.
78
+ - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib / vibe_math_lean_read /
79
+ vibe_math_lean_job — Lean formal verification (execute / archive / list + read the reuse
80
+ library / inspect or wait for a background compile job). leanAsync=true (default) queues the
81
+ compile and returns a jobId; nothing counts as proved until that job settles ok (so "有把握"
82
+ is not the same as "已验证"). The scheduler's child agents use them too; they work in every
83
+ mode.
84
+
85
+ - math_computation {op: probe|run|receipt|install, engine, mode: code|file|expr, …} — 先 probe 预检引擎/包/许可,再调引擎计算并把脚本与输出归档成可复核回执;缺引擎/缺包只报告与给安装指引/计划;shell 兜底不算归档。
86
+ - 替代必须声明(诚实性):当替代方案改变了**精确性或结论强度**时(精确符号解 → 数值近似、闭式解 → 采样/求积、改了精度/容差/假设、换了算法类),结论里**必须写明**,不得读起来像得到了原本(精确/所要求的)结果;拿不到精确结果就直说。
87
+ - 归档→编辑→重跑:mode:'code' 的脚本原件在回执的 scriptPath(Computation/<id>/script.<ext>),你可以用普通文件工具打开并编辑它;编辑后用 mode:'file' 指向它重跑,会写出一份**新回执/新 attempt**(含新的 scriptHash)。**旧回执对修改后的代码无效**——报告里必须引用与当前代码哈希一致的那份回执;工具会在 scriptChanged / scriptChangedDuringRun 为 true 时显式告警。
81
88
 
82
89
  Final paper: strict termination writes Paper/<project>/{paper.md,paper.tex,paper.pdf,paper.meta.json,paper.log.md}
83
90
  automatically — a dedicated paper-writing child assembles the solved material (finalPaper=false disables only that
@@ -116,7 +123,7 @@
116
123
  explicit, reasoned blocker record; the scheduler is never wedged by it).
117
124
  - Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean; reusable
118
125
  definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
119
- - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
126
+ - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs / leanAsync / leanInitiative / leanSearchPaths / leanJobsMaxParallel are tunable as well
120
127
  (e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
121
128
  reported as LEAN_NOT_FOUND and still lets the code be written and archived.
122
129
  - vibe_math_status / vibe_math_report show the mode, the per-object formal status and the
@@ -359,9 +366,16 @@
359
366
  - vibe_math_new_project / vibe_math_set_project / vibe_math_list_projects — per-project folders.
360
367
  - vibe_math_list_decisions / vibe_math_decide {id, action: approve|reject|override, verdict?} — resolve manual decisions.
361
368
  - vibe_math_list_agents / vibe_math_message_agent / vibe_math_interrupt_agent — inspect / steer / interrupt subagents.
362
- - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal
363
- verification (execute / archive / list the reuse library). The scheduler's child agents
364
- use them too; they work in every mode.
369
+ - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib / vibe_math_lean_read /
370
+ vibe_math_lean_job — Lean formal verification (execute / archive / list + read the reuse
371
+ library / inspect or wait for a background compile job). leanAsync=true (default) queues the
372
+ compile and returns a jobId; nothing counts as proved until that job settles ok (so "有把握"
373
+ is not the same as "已验证"). The scheduler's child agents use them too; they work in every
374
+ mode.
375
+
376
+ - math_computation {op: probe|run|receipt|install, engine, mode: code|file|expr, …} — 先 probe 预检引擎/包/许可,再调引擎计算并把脚本与输出归档成可复核回执;缺引擎/缺包只报告与给安装指引/计划;shell 兜底不算归档。
377
+ - 替代必须声明(诚实性):当替代方案改变了**精确性或结论强度**时(精确符号解 → 数值近似、闭式解 → 采样/求积、改了精度/容差/假设、换了算法类),结论里**必须写明**,不得读起来像得到了原本(精确/所要求的)结果;拿不到精确结果就直说。
378
+ - 归档→编辑→重跑:mode:'code' 的脚本原件在回执的 scriptPath(Computation/<id>/script.<ext>),你可以用普通文件工具打开并编辑它;编辑后用 mode:'file' 指向它重跑,会写出一份**新回执/新 attempt**(含新的 scriptHash)。**旧回执对修改后的代码无效**——报告里必须引用与当前代码哈希一致的那份回执;工具会在 scriptChanged / scriptChangedDuringRun 为 true 时显式告警。
365
379
 
366
380
  A /vibe slash command mirrors the main controls (/vibe start [override]|resume [override]|pause|abort|status|report|mode
367
381
  <auto|manual>|setup|save|template [global|project]|add <id> <desc>|add-proposition <id> <概述>|list-propositions|methods|index|plan|lock|project [list|new <name>|<name>]|decisions|agents|paper [lang=zh|en] [format=both|md|tex] [force]).
@@ -389,7 +403,7 @@
389
403
  explicit, reasoned blocker record; the scheduler is never wedged by it).
390
404
  - Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean; reusable
391
405
  definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
392
- - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
406
+ - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs / leanAsync / leanInitiative / leanSearchPaths / leanJobsMaxParallel are tunable as well
393
407
  (e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
394
408
  reported as LEAN_NOT_FOUND and still lets the code be written and archived.
395
409
  - vibe_math_status / vibe_math_report show the mode, the per-object formal status and the
@@ -635,15 +649,22 @@
635
649
  Main controls (recommended flow: configure FIRST, then start):
636
650
  - vibe_v4_configure {project?, problem?, params?} — create/configure the project (name, problem, params) WITHOUT starting a run; set everything here first.
637
651
  - vibe_v4_start {problem?, residentCount?, seedDirections?} — begin the run (spawn residents, brainstorm). If problem was configured, omit it.
638
- - vibe_v4_set {residentCount, compactThreshold, compactAfterRounds, meetingKeepEvery, maxParallel, activityTimeoutMs, stallAutoMeetingMs, verdictMaxRounds, provider, model, residentPersona, toolAllow, toolDeny, formalVerify, leanCommand, leanArgs, leanTimeoutMs, finalPaper, paperFormat, paperLanguage, paperCompilePdf, paperEditor, paperLatexCommand} — tune params (persisted to the settings file). provider/model override the residents' LLM route (empty = they inherit YOUR model/provider); toolAllow/toolDeny are per-resident tool permissions (empty = they inherit all tools). stallAutoMeetingMs is the stalled-group auto-sync-meeting threshold (分级保活 B). formalVerify (off|encourage|require, default off) enables Lean formal verification; leanCommand/leanArgs/leanTimeoutMs configure the toolchain. The FINAL PAPER is tuned by finalPaper (true|false, default true), paperFormat (both|md|tex), paperLanguage (zh|en), paperCompilePdf (true|false), paperEditor (office|resident:<id>, default office = the human/assistant side finalises) and paperLatexCommand.
652
+ - vibe_v4_set {residentCount, compactThreshold, compactAfterRounds, meetingKeepEvery, maxParallel, activityTimeoutMs, stallAutoMeetingMs, verdictMaxRounds, provider, model, residentPersona, toolAllow, toolDeny, formalVerify, leanCommand, leanArgs, leanTimeoutMs, leanAsync, leanInitiative, leanSearchPaths, leanJobsMaxParallel, finalPaper, paperFormat, paperLanguage, paperCompilePdf, paperEditor, paperLatexCommand} — tune params (persisted to the settings file). provider/model override the residents' LLM route (empty = they inherit YOUR model/provider); toolAllow/toolDeny are per-resident tool permissions (empty = they inherit all tools). stallAutoMeetingMs is the stalled-group auto-sync-meeting threshold (分级保活 B). formalVerify (off|encourage|require, default off) enables Lean formal verification; leanCommand/leanArgs/leanTimeoutMs configure the toolchain; leanAsync (true|false, default true) queues each compile as a background job (the tool returns {async:{jobId,state}} and the result lands later), leanInitiative (off|normal|eager, default normal) says how PROACTIVE the group is while working (independent of what formalVerify requires at voting time), leanSearchPaths adds extra compiler search roots (injected BEFORE the automatic VibeMath root), and leanJobsMaxParallel (default 1) caps concurrent compiles. The FINAL PAPER is tuned by finalPaper (true|false, default true), paperFormat (both|md|tex), paperLanguage (zh|en), paperCompilePdf (true|false), paperEditor (office|resident:<id>, default office = the human/assistant side finalises) and paperLatexCommand.
639
653
  - vibe_v4_resume / vibe_v4_pause / vibe_v4_abort / vibe_v4_status / vibe_v4_report.
640
654
  - vibe_v4_message {to|all, content} — inject a message to a resident (human/assistant intervention).
641
655
  - vibe_v4_meeting {agenda} — force a meeting.
642
656
  - vibe_v4_add_member {direction?} / vibe_v4_remove_member {id} — add / close a resident.
643
657
  - vibe_v4_list_members — list residents.
644
- - vibe_v4_lean_run / vibe_v4_lean_archive / vibe_v4_lean_lib — Lean formal verification
645
- (execute / archive / list the reuse library). Residents use them too; they work in every mode.
658
+ - vibe_v4_lean_run / vibe_v4_lean_archive / vibe_v4_lean_lib / vibe_v4_lean_read / vibe_v4_lean_job
659
+ — Lean formal verification (execute or ENQUEUE / archive / list the reuse library + background jobs /
660
+ read one archived library file verbatim / check or wait for a background job). Residents use them
661
+ too; they work in every mode.
646
662
  - vibe_v4_formal_report — human-readable Lean formal-verification mirror (mode, Lean-passed
663
+ - math_computation {op: probe|run|receipt|install, engine, mode: code|file|expr, …} — 先 probe 预检引擎/包/许可,再调引擎计算并把脚本与输出归档成可复核回执;缺引擎/缺包只报告与给安装指引/计划;shell 兜底不算归档。
664
+ - 归档→编辑→重跑:mode:'code' 的脚本原件在回执的 scriptPath(Computation/<id>/script.<ext>),你可以用普通文件工具打开并编辑它;编辑后用 mode:'file' 指向它重跑,会写出一份**新回执/新 attempt**(含新的 scriptHash)。**旧回执对修改后的代码无效**——报告里必须引用与当前代码哈希一致的那份回执;工具会在 scriptChanged / scriptChangedDuringRun 为 true 时显式告警。
665
+ - Archive -> edit -> re-run: for mode:'code' the script original is at the receipt's scriptPath (Computation/<id>/script.<ext>) and you may open/edit it with your normal file tools; after editing, re-run it with mode:'file' to write a NEW receipt/attempt with a NEW scriptHash. **An old receipt is NOT evidence for edited code** - cite the receipt whose scriptHash matches the current code; the tool warns explicitly via scriptChanged / scriptChangedDuringRun.
666
+ - 替代必须声明(诚实性):当替代方案改变了**精确性或结论强度**时(精确符号解 → 数值近似、闭式解 → 采样/求积、改了精度/容差/假设、换了算法类),结论里**必须写明**,不得读起来像得到了原本(精确/所要求的)结果;拿不到精确结果就直说。
667
+ - Declare substitutions (honesty): when an alternative changes EXACTNESS or conclusion strength (exact symbolic solution -> numerical approximation, closed form -> sampling/quadrature, changed precision/tolerances/assumptions, a different algorithm class), the conclusion MUST say so explicitly and must not read as if the original (exact/requested) result had been obtained; if the exact result is unavailable, say so plainly.
647
668
  objects, recorded blockers, formalization TODO, library paths).
648
669
  - vibe_v4_prompts {which: brainstorm|normal|heartbeat|meeting|verify|coreRules, member?, target?, stage?} — read the exact prompt text a resident would receive (prompt auditing; prompt text is the product).
649
670
  A /v4 slash command mirrors the main controls (configure|start [problem]|resume|pause|abort|status|report|message <to|all> <content>|meeting|paper [lang=zh|en] [format=md|tex|both] [editor=office|resident:<id>] [force]|members|add|remove|set <k=v>...).
@@ -677,6 +698,15 @@
677
698
  explicit, reasoned blocker record; the run is never wedged by it).
678
699
  - Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean; reusable
679
700
  definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
701
+ - Reuse FIRST: call vibe_v4_lean_lib (and vibe_v4_lean_read for the verbatim text) BEFORE writing a new
702
+ definition; reuse an archived file with `import Formal.Lib.<name>` / `import Formal.Proved.<name>`
703
+ (the framework passes --search-path <VibeMath root>, so VibeMath is the module root).
704
+ - Choose WHAT to formalize with three criteria: (1) valuable or likely reusable, (2) rather key or
705
+ necessary, (3) you are confident in the statement — when you are NOT confident, record blocked
706
+ with the difficulty instead of hiding uncertainty behind a formalization.
707
+ - Compiles are BACKGROUND JOBS by default: a queued job is not a verification. An object only becomes
708
+ Lean-passed once its job settles green; the result is announced in the next prompt and visible via
709
+ vibe_v4_lean_lib.jobs / vibe_v4_lean_job (waitMs).
680
710
  - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
681
711
  (e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
682
712
  reported as LEAN_NOT_FOUND and still lets the code be written and archived.
@@ -962,9 +992,14 @@
962
992
  - vibe_v5_add_researcher / vibe_v5_remove_researcher — OFFICE only: add or dismiss a PERMANENT researcher (the academician can only propose those).
963
993
  - vibe_v5_paper {lang?, format?, editor?, force?} — write the FINAL PAPER: the permanent staff write their own parts, cross-review each other, then the editor finalises. lang/format/editor override this one paper only.
964
994
  - vibe_v5_finalize_paper {decision, note, conclusion?} — OFFICE only when paperEditor=office: consult the institute first (>=1 office message + >=1 meeting), then finalise and put the conclusion in note.
965
- - vibe_v5_lean_run / vibe_v5_lean_archive / vibe_v5_lean_lib — Lean formal
966
- verification (execute / archive / list the reuse library). Members use them
967
- too; they work in every mode.
995
+ - vibe_v5_lean_run / vibe_v5_lean_archive / vibe_v5_lean_lib / vibe_v5_lean_read / vibe_v5_lean_job — Lean formal
996
+ verification (execute / archive / list the reuse library / read an archived file
997
+ verbatim / watch the background compile queue). Members use them too; they work in every mode.
998
+ - math_computation {op: probe|run|receipt|install, engine, mode: code|file|expr, …} — 先 probe 预检引擎/包/许可,再调引擎计算并把脚本与输出归档成可复核回执;缺引擎/缺包只报告与给安装指引/计划;shell 兜底不算归档。
999
+ - 归档→编辑→重跑:mode:'code' 的脚本原件在回执的 scriptPath(Computation/<id>/script.<ext>),你可以用普通文件工具打开并编辑它;编辑后用 mode:'file' 指向它重跑,会写出一份**新回执/新 attempt**(含新的 scriptHash)。**旧回执对修改后的代码无效**——报告里必须引用与当前代码哈希一致的那份回执;工具会在 scriptChanged / scriptChangedDuringRun 为 true 时显式告警。
1000
+ - Archive -> edit -> re-run: for mode:'code' the script original is at the receipt's scriptPath (Computation/<id>/script.<ext>) and you may open/edit it with your normal file tools; after editing, re-run it with mode:'file' to write a NEW receipt/attempt with a NEW scriptHash. **An old receipt is NOT evidence for edited code** - cite the receipt whose scriptHash matches the current code; the tool warns explicitly via scriptChanged / scriptChangedDuringRun.
1001
+ - 替代必须声明(诚实性):当替代方案改变了**精确性或结论强度**时(精确符号解 → 数值近似、闭式解 → 采样/求积、改了精度/容差/假设、换了算法类),结论里**必须写明**,不得读起来像得到了原本(精确/所要求的)结果;拿不到精确结果就直说。
1002
+ - Declare substitutions (honesty): when an alternative changes EXACTNESS or conclusion strength (exact symbolic solution -> numerical approximation, closed form -> sampling/quadrature, changed precision/tolerances/assumptions, a different algorithm class), the conclusion MUST say so explicitly and must not read as if the original (exact/requested) result had been obtained; if the exact result is unavailable, say so plainly.
968
1003
  A /v5 slash command mirrors these (configure|start|resume|pause|stop|status|report|members|message|meeting|hire|fire|add|remove|set|paper).
969
1004
 
970
1005
  LEAN FORMAL VERIFICATION (formalVerify, a tunable parameter):
@@ -980,6 +1015,19 @@
980
1015
  reported as LEAN_NOT_FOUND, a host with no subprocess service as NO_SUBPROCESS
981
1016
  (on a timeout the process is terminated first), and in every one of those cases the
982
1017
  code can still be written down and archived.
1018
+ - Daily eagerness is a SEPARATE knob: leanInitiative 'off' (no daily drive) |
1019
+ 'normal' (default; the reminder rides with formalVerify) | 'eager' (push valuable
1020
+ small lemmas/propositions/definitions into the library even in ordinary rounds).
1021
+ - Reuse first: check vibe_v5_lean_lib BEFORE writing a definition, reuse archived
1022
+ content via `import Formal.Lib.<name>` / `import Formal.Proved.<name>` (the compile
1023
+ gets `--search-path <VibeMath root>`, preceded by any leanSearchPaths), or copy the
1024
+ exact text with vibe_v5_lean_read. Re-archiving identical content is de-duplicated.
1025
+ - Compiles are ASYNC by default (leanAsync=true, leanJobsMaxParallel default 1):
1026
+ vibe_v5_lean_run / vibe_v5_lean_archive enqueue and return at once; watch them with
1027
+ vibe_v5_lean_job {jobId, waitMs} or vibe_v5_lean_lib.jobs, and NEVER treat an object
1028
+ as passed before its job settles ok (exit 0, same content, same build context).
1029
+ - Only formalize what you are confident about; when unsure record kind='blocked' with a
1030
+ reason instead of dressing uncertainty up as a formalization.
983
1031
  - vibe_v5_status / vibe_v5_report show the mode, per-object formal status and the
984
1032
  formalization TODO. The framework never installs Lean and never judges fidelity.
985
1033
 
@@ -216,8 +216,8 @@ v2/v3/v4/v5 是**同构实现**(同一份契约、四份独立代码,刻意
216
216
  ② 建一个 `git worktree` 拿改动前的检出,同一套件在两种布局各跑一遍,归一化路径/临时目录/耗时后
217
217
  **逐行比对**(`_oneoff/layout-invariance.mjs`);③ 相对链接扫描 0 失效(`_oneoff/scan-links.mjs`)。
218
218
  - [ ] 讲"全套件 / 门禁 / 多少次全绿"时,是否区分了**随包发布面**与**仓库**?`package.json` 的 `files`
219
- 只发 `tests/` 的 **18 项**(其中 `.test.mjs` **10** 个),完整门禁(`node tests/run-tests.mjs`,
220
- Round B 起 **57 项 = 39 套件 + 18 探针/变体**)只在开发检出里成立。两边的清单见
219
+ 只发 `tests/` 的 **23 项**(其中 `.test.mjs` **11** 个),完整门禁(`node tests/run-tests.mjs`,
220
+ 当前 **65 项 = 44 套件 + 21 探针/变体**)只在开发检出里成立。两边的清单见
221
221
  `docs/test-timing.md` §1.1;发布物里的 runner 会把缺失/跳过项**打印出来**(不会静默少跑),
222
222
  所以"安装用户照文档跑得到全套件"这类说法必须避免。
223
223
  - [ ] **runner 本身也要跑一遍**:直接跑套件通过 ≠ 并行 runner 通过(2.3.13 就出现过
@@ -80,6 +80,7 @@
80
80
  | `paper.pdf` | 仅在编译器**真的跑通**时出现 |
81
81
  | `paper.meta.json` | 总是:参数、触发原因、运行 id、`finalizedAt`、编译状态与引擎、v5 的咨询计数等 |
82
82
  | `paper.log.md` | 总是:谁写了什么、谁提了什么意见、如何采纳(人读审计链) |
83
+ | `paper.lock.json` | 总是:该论文目录的**写锁**(持有者 / 时间 / 运行 id),并发的复写与重编译据此串行化(round-3 补记;README 的 final-paper 一节同样列出) |
83
84
 
84
85
  宿主 fs 只支持**文本写**(没有 `writeBytes`),所以 `paper.pdf` **只能由编译器子进程**在论文目录内产生,
85
86
  插件只做存在性校验,绝不自己写二进制,也**绝不覆盖已存在的 pdf**。
@@ -28,14 +28,22 @@
28
28
 
29
29
  | 参数 | 取值 | 默认 | 含义 |
30
30
  |---|---|---|---|
31
- | `formalVerify` | `'off'` \| `'encourage'` \| `'require'` | `'off'` | 三档开关,见 §2 |
31
+ | `formalVerify` | `'off'` \| `'encourage'` \| `'require'` | `'off'` | 三档开关,见 §2(**只**表示"验证时的要求强度") |
32
32
  | `leanCommand` | 字符串 | `'lean'` | 要执行的 Lean 可执行文件(例:`'lake'`) |
33
33
  | `leanArgs` | 字符串数组 | `[]` | 插在文件名之前的附加参数(例:`['env','lean']` 配合 `leanCommand='lake'`) |
34
- | `leanTimeoutMs` | 正整数 | `120000` | 单次 Lean 运行的超时上限 |
35
-
36
- - 非法值一律**回退到默认**(`formalVerify` 非三档之一 → `'off'`;`leanTimeoutMs` 非正 → 默认)。
37
- - 参数必须出现在该架构既有的参数体系里:`set_params` / `vibe_v4_set` / `vibe_v5_set`、
38
- 参数 schema(`*_setup` / `*_template`)、`status`/`report` 的可读参数表。
34
+ | `leanTimeoutMs` | 正整数 | `120000` | 单次 Lean 运行的超时上限(异步作业同样用它作单次预算) |
35
+ | `leanAsync` | 布尔 | `true` | `true` = 编译走**后台队列**(`lean_run` / `lean_archive{run:true}` 入队后立即返回 `{async:{jobId,state:'queued'}}`);`false` = **完全同步 await**(旧路径逐字保留)。只有 `settled(ok)` 才可能置 `passed`,见 §7.3 |
36
+ | `leanJobsMaxParallel` | 正整数 | `1` | 后台编译并发上限(默认 1 = 串行;调大即并行,v2/v3 把合法范围夹在 1–8) |
37
+ | `leanInitiative` | `'off'` \| `'normal'` \| `'eager'` | `'normal'` | **日常流程中的形式化主动性**:`off` 不主动(只在验证提示词里按 `formalVerify` 的要求做)/ `normal` 顺手把有价值且可能复用的东西形式化 / `eager` 更主动。**与 `formalVerify` 是两件事**:它不改变定论门禁 |
38
+ | `leanSearchPaths` | 字符串数组 | `[]` | 额外编译搜索根:先注入它们、再注入自动的 `<VibeMath 根>`(去重、保持用户给的顺序);`leanArgs` 里已显式给 `--search-path`/`-R`/`--root` 时**不注入任何东西**,见 §7.6 |
39
+
40
+ - 非法值一律**回退到默认**(`formalVerify` 非三档之一 → `'off'`;`leanInitiative` 非三档之一 → `'normal'`;
41
+ `leanTimeoutMs` 非正 → 默认;`leanJobsMaxParallel` < 1 → 1;`leanSearchPaths` 非数组 → `[]` 并去空串/去重)。
42
+ - **`leanAsync` 必须显式布尔归一化**:字符串 `'false'` 不得被当作真值放行(它是"关掉后台队列"的开关,
43
+ 错误归一化会让用户以为已同步执行、实际仍在排队)。
44
+ - 参数必须出现在该架构既有的参数体系里:v2/v3 的 `vibe_math_set_params`、v4 的 `vibe_v4_set`、v5 的 `vibe_v5_set`,
45
+ 以及各自的控制面(v2/v3:`vibe_math_setup` / `vibe_math_template` / `vibe_math_status`;v4:`vibe_v4_configure` / `vibe_v4_status`;
46
+ v5:`vibe_v5_configure` / `vibe_v5_status` —— **v4/v5 没有 `*_setup`/`*_template`**),外加 `status`/`report` 的可读参数表。
39
47
  - **模式是动态的**,可以在运行中切换:所有与模式相关的提示词文本都必须在**构造提示词的那一刻**
40
48
  由 `params.formalVerify` 现算,**不得**写进"入职时冻结"的人格/章程快照
41
49
  (否则切换模式后成员读到的仍是旧指令)。
@@ -46,15 +54,19 @@
46
54
 
47
55
  ### `off`(默认)—— 不额外进行任何要求
48
56
 
49
- - **成员提示词**(按模式动态注入的那部分)里**不出现**任何 Lean 相关内容;验证流程、门禁、归档全部不变,
57
+ - **成员提示词**里**不出现**任何 Lean 相关内容(**默认 `leanInitiative:'normal'` 时**);验证流程、门禁、归档全部不变,
50
58
  也不写入任何形式化状态。这是真正的"无操作",四套都有断言与探针守着。
59
+ - **两个轴必须分清(v5 统一口径)**:`formalVerify` 管**验证阶段**的要求强度,`leanInitiative` 管**日常日线**;
60
+ `formalVerify:'off'` 只关掉前者——如果用户显式设置 `leanInitiative:'eager'`,日线**仍然注入**("定论不额外要求,
61
+ 但日常鼓励形式化"是合法组合,见 §6.2 与 `tests/formal-verify-vN` 的 `off+eager` 探针)。`leanInitiative:'off'`
62
+ 则连日线都不注入:两种轴都关掉时,提示词里才真的一个字都不出现。
51
63
  - **回执通道在 `off` 档必须失效**:`formal` 字段本来就不在 `off` 档的回执契约里,所以一个残留/幻觉/被
52
64
  引用的 `formal` 回执**不得**创建形式化记录(否则 `off` 就不是无操作了)。四个架构都必须在这个入口
53
65
  上加 `formalOn()` 守卫。
54
- - 三个 Lean 工具**仍然注册且可用**(注册是静态的,与既有 `ctx.effect` 纪律一致);`off` 只是不主动
66
+ - 五个 Lean 工具(run / archive / lib / read / job)**仍然注册且可用**(注册是静态的,与既有 `ctx.effect` 纪律一致);`off` 只是不主动
55
67
  向成员宣讲它们。代理/人主动调用时照常工作——**工具调用是刻意行为,回执字段不是**,这条区别就是
56
68
  上一条守卫的理由。
57
- - **主代理的 persona 是静态的,不受档位影响**:它**必须始终**文档化这三个工具与四个参数
69
+ - **主代理的 persona 是静态的,不受档位影响**:它**必须始终**文档化这五个工具与八个参数
58
70
  (否则用户在 `off` 档根本发现不了这个开关,也就无法打开它)。"成员提示词里没有 Lean 文字"与
59
71
  "persona 里写着这个能力"**不矛盾**,两者都由测试守着(前者见各 `formal-verify-vN` 的 `off` 小节,
60
72
  后者见 `audit-persona-surface.test.mjs`)。
@@ -100,19 +112,24 @@
100
112
  <VibeMath 根>/
101
113
  ├─ Formal/ # 全局可复用 Lean 库(跨项目)
102
114
  │ ├─ Lib/<name>.lean # 可复用定义/对象/假设(def / structure / notation)
103
- │ ├─ Lib/Index.md # 名称 → 文件 → 类别 → 摘要
115
+ │ ├─ Lib/Index.md # 名称 → 文件 → 类别 → 依赖(import)→ 摘要
104
116
  │ ├─ Proved/<name>.lean # 已成立的 Lean 命题/引理(机器已核对)
105
117
  │ └─ Proved/Index.md # 名称 → 文件 → 陈述 → 依赖
106
118
  └─ Projects/<项目>/ # (v5 为 Projects/<项目>/Institutes/<所>/)
107
119
  ├─ Formal/
108
120
  │ ├─ <对象id>.lean # 该对象的形式化工作文件
109
121
  │ ├─ Index.md # 对象 → 状态 → 文件 → 归档证明 → 运行结果 → 难度判断
122
+ │ ├─ Jobs/<jobId>.json # 后台编译作业的镜像(崩溃恢复 + lean_lib.jobs 都读它)
110
123
  │ └─ TODO.md # require 模式下的「形式化待办」
111
124
  └─ Verified/
112
125
  ├─ <原有定论卡片>
113
126
  └─ Lean/<对象id>.lean # ★ 归档证明:该定论对象对应的形式化代码
114
127
  ```
115
128
 
129
+ - **`Formal/Jobs/<jobId>.json` 是异步队列的**唯一持久镜像**:内存队列是权威,但这个文件让崩溃/重启后
130
+ 的恢复、`<prefix>lean_lib` 的 `jobs` 字段与 `<prefix>lean_job` 三处看到同一份事实。作业终态为
131
+ `settled` / `failed` / `timeout` / `interrupted` 四者之一。
132
+
116
133
  - **归档证明放在 `Verified/Lean/<id>.lean`**:它和定论卡片同处 `Verified/`,
117
134
  一眼可见"这条结论的形式化证明在哪"。
118
135
  - **可复用的东西放全局 `Formal/Lib` 与 `Formal/Proved`**:跨项目复用是这套设计的核心收益。
@@ -185,7 +202,7 @@
185
202
 
186
203
  ---
187
204
 
188
- ## 5. 工具(每个架构三个,前缀各自不同)
205
+ ## 5. 工具(每个架构五个,前缀各自不同)
189
206
 
190
207
  前缀:v2/v3 → `vibe_math_`;v4 → `vibe_v4_`;v5 → `vibe_v5_`。
191
208
 
@@ -197,9 +214,11 @@
197
214
  | `target` | string | | 关联对象 id(给了就更新该对象的运行记录) |
198
215
  | `timeout_ms` | integer | | 覆盖 `leanTimeoutMs` |
199
216
 
200
- 返回:`{ok, exitCode, signal, ms, command, stdout, stderr, file}`;
201
- 找不到工具链返回 `{ok:false, code:'LEAN_NOT_FOUND', error}`;超时返回 `{ok:false, code:'LEAN_TIMEOUT'}`。
202
- **绝不抛异常到调度循环**——任何失败都要变成可读结果并记录。
217
+ - `leanAsync=false`(同步路径)返回:`{ok, exitCode, signal, ms, command, stdout, stderr, file}`;
218
+ 找不到工具链返回 `{ok:false, code:'LEAN_NOT_FOUND', error}`;超时返回 `{ok:false, code:'LEAN_TIMEOUT'}`。
219
+ - `leanAsync=true`(默认)**不编译**:入队后立即返回 `{ok:true, file, async:{jobId,state:'queued'}, hint}`,
220
+ 结果在下一轮提示的【形式化结果】行公告,或用 §5.5 的 `lean_job` / `lean_lib` 的 `jobs` 字段查询。
221
+ - **绝不抛异常到调度循环**——任何失败都要变成可读结果并记录。
203
222
 
204
223
  ### 5.2 `<prefix>lean_archive`
205
224
 
@@ -208,21 +227,57 @@
208
227
  | `kind` | 必填 | 行为 |
209
228
  |---|---|---|
210
229
  | `'def'` / `'lemma'` | `name`, `content` 或 `from` | 写入全局 `Formal/Lib/<name>.lean`(def)或 `Formal/Proved/<name>.lean`(lemma),重建对应 `Index.md`;可选 `run:true` 先跑一次再归档 |
211
- | `'proof'` | `target`, `content` 或 `from` | 写入 `Formal/<target>.lean`;若该文件最近一次运行 `ok`,同时写 `Verified/Lean/<target>.lean` 并把对象标为 `passed` |
230
+ | `'proof'` | `target`, `content` 或 `from` | 写入 `Formal/<target>.lean`;**只有 `settled(ok)`**(§7.3)才同时写 `Verified/Lean/<target>.lean` 并把对象标为 `passed`,否则记 `attempted` |
212
231
  | `'blocked'` | `target`, `note` | 记录显式难度判断/阻塞原因(`note` 空 → 拒绝),对象标为 `blocked` |
213
232
 
233
+ - **内容哈希去重**:同 `content`(规范化后哈希相同)且**构建上下文一致**的 `def`/`lemma`/`proof` 不再重写、
234
+ 不再重编译,直接返回 `{ok:true, deduped:true, …}`(对象已是 `passed` 时也返回 `passed`)。去重的判据与
235
+ §7.3 的 `settled(ok)` 同源;内容变了就正常走新作业。
236
+ - `leanAsync=true` 时 `run:true`(或 `kind='lemma'` 的隐式编译)同样**入队即返回**;文件已写、编译未完成,
237
+ 所以返回里明确要求"落地为通过之前不得把它当作可复用定义"。
238
+
214
239
  ### 5.3 `<prefix>lean_lib`
215
240
 
216
241
  无必填参数。**扫描并重建**三处索引(项目 `Formal/Index.md`、全局 `Lib/Index.md`、`Proved/Index.md`),
217
242
  返回可复用库清单(供代理写新定义前先查重、直接复用)。`refresh:false` 时只读不重建。
243
+ `leanAsync=true` 时额外返回 `async` 与 `jobs`(每个作业的 state/rel/target/attempts/路径),
244
+ 以及 `paths.searchPath`(框架注入的模块根)。
245
+
246
+ ### 5.4 `<prefix>lean_read`
247
+
248
+ 只读地取回**一个已归档** Lean 文件的原文(供"逐字复用"):
249
+
250
+ | 参数 | 类型 | 必填 | 说明 |
251
+ |---|---|---|---|
252
+ | `name` | string | ✅ | 归档文件名(可省略 `.lean`),经该架构的 id 安全化 |
253
+ | `kind` | `'auto'` \| `'lib'` \| `'proved'` | | 默认 `auto`(先 Lib 再 Proved) |
254
+
255
+ 返回 `{ok, name, file, kind, sha256, bytes, text, truncated}`;**只允许** `<VibeMath 根>/Formal/{Lib,Proved}`
256
+ 之内的文件(越界拒绝),正文上限 64KB(超出则 `truncated:true`)。这是"先查库再写新定义"的闭环:
257
+ `lean_lib` 告诉你有什么,`lean_read` 给你原文,然后 `import` 或逐字复制。
258
+
259
+ ### 5.5 `<prefix>lean_job`
260
+
261
+ 只读地查看后台编译作业:
262
+
263
+ | 参数 | 类型 | 必填 | 说明 |
264
+ |---|---|---|---|
265
+ | `jobId` | string | | 省略 = 本会话作业清单;给了 = 该作业的 state/exitCode/回执路径/归档路径 |
266
+ | `waitMs` | integer | | >0 时最多等这么多毫秒(轮询队列,**不阻塞心跳**),超时返回当前 state |
267
+
268
+ `leanAsync=false`(同步档)时它仍然可用(此时清单里只会有同步运行留下的记录),返回体里带
269
+ `async:false` 与 `maxParallel`,便于成员判断当前模式。**只有 `state='settled'` 且 `exitCode=0`
270
+ (且内容哈希/构建上下文一致)才算通过**;`queued`/`running` 一律还不算,`failed`/`timeout`/`interrupted`
271
+ 都不算。
218
272
 
219
273
  ---
220
274
 
221
275
  ## 6. 提示词注入(在构造提示词时现算)
222
276
 
223
277
  > **硬要求(四套一致,逐字级别的约束)**
224
- > 1. **工具名一律写全称**(`<prefix>lean_run` / `<prefix>lean_archive` / `<prefix>lean_lib`)。
225
- > 注入文本里**不得**出现 `lean_run` / `lean_archive` / `lean_lib` 这类缩写——那不是注册名,
278
+ > 1. **工具名一律写全称**(`<prefix>lean_run` / `<prefix>lean_archive` / `<prefix>lean_lib` /
279
+ > `<prefix>lean_read` / `<prefix>lean_job`)。
280
+ > 注入文本里**不得**出现 `lean_run` / `lean_archive` / `lean_lib` / `lean_read` / `lean_job` 这类缩写——那不是注册名,
226
281
  > 代理照抄会调用一个不存在的工具(工具自己返回的 `hint` 字段同样算注入文本)。
227
282
  > 2. **回执字段名必须与该架构真实契约一致**:v2/v3 的评审值字段是 `Result`,v4/v5 是 `verdict`。
228
283
  > 写错字段名 = 那一票被静默丢弃。
@@ -287,6 +342,15 @@
287
342
  归档前先跑通(<prefix>lean_run 或 lean_archive run=true):跑不通的定义不要进可复用库。
288
343
  ```
289
344
 
345
+ - **这段文字的档位由 `leanInitiative` 决定,不是 `formalVerify`**:`off` = 完全不出现(连日线都不注入);
346
+ `normal` = 上面的"顺手"档;`eager` = 追加"日常就主动把有价值的小引理/命题/定义形式化"。
347
+ `formalVerify` 只影响**验证提示词**的要求强度;两者可自由组合(例如 `formalVerify=off` +
348
+ `leanInitiative=eager` 表示"定论不额外要求,但日常鼓励形式化")——**注意:`eager` 在 `formalVerify=off`
349
+ 下也必须注入日线**,`off` 不许把主动性这条独立轴一起吞掉(v5 统一口径,四套都有 `off+eager` 探针)。
350
+ - 异步档(`leanAsync=true`)下这段还必须写清:归档返回的是**排队中的作业**,
351
+ **未落地为 `settled(ok)` 之前不得声称已通过、也不得转忠实性审查**;查进度用
352
+ `<prefix>lean_lib` 的 `jobs` 或 `<prefix>lean_job`,复用先 `<prefix>lean_read` 取原文。
353
+
290
354
  ### 6.3 回执契约
291
355
 
292
356
  非 `off` 模式时,在每轮回执契约里加入(**必须真的被框架解析并落库**——只把字段写进提示词而不实现
@@ -306,12 +370,78 @@
306
370
 
307
371
  ## 7. Run 语义(实现要点)
308
372
 
309
- - 用 `subprocess` 服务:`resolveExecutable(leanCommand)` → `spawn({argv:[exe,...leanArgs,file], cwd, stdio:{stdin:'ignore',stdout:{maxBytes},stderr:{maxBytes}}, graceMs})`
373
+ ### 7.1 调用与超时
374
+
375
+ - **父目录不必预建(round-3 记录)**:宿主的文本写会自动创建缺失的父目录(`dsh-fs-local/lib/index.js` 的 `writeFileAtomic` 先做 `mkdir(dirname(absolutePath), { recursive: true })`),因此 `Formal/Jobs/`、`Computation/<runId>/` 及其 `attempts/<n>/` 都可以"直接写";`ensureDirs()` 里的列举只为空项目可发现性。把"严格 fs 拒绝创建父目录"当作真实宿主行为来构造失败用例是**错误前提**。
376
+ - 用 `subprocess` 服务:`resolveExecutable(leanCommand)` → `spawn({argv, cwd, stdio:{stdin:'ignore',stdout:{maxBytes},stderr:{maxBytes}}, graceMs})`
310
377
  → `await handle.done` → `handle.collected.stdout?.readFrom(0).text`。
311
- - **必须**给 `cwd`(项目根或 `<VibeMath 根>`),并对超时调用 `handle.terminate()`。
378
+ - **必须**给 `cwd`(项目根或 `<VibeMath 根>`),并在超时时调用 `handle.terminate()`——
379
+ **不能只依赖 `graceMs`**:宿主不杀进程时,超时的编译会变成泄漏的孤儿进程。
312
380
  - 输出截断到 ~4KB 再入库(避免把巨大的编译器输出写进状态)。
313
381
  - 宿主没有 `subprocess` 服务 → 返回 `{ok:false, code:'NO_SUBPROCESS'}`,并只记录 `attempted`。
314
382
 
383
+ ### 7.2 同步路径(`leanAsync=false`)
384
+
385
+ 与旧版逐字一致:`await` 编译器返回,直接得到 exitCode/stdout/stderr,然后按 §7.3 判 `settled(ok)`。
386
+ 保留它是为了"我需要一个确定的答案再继续"的场景,以及给探针一个不依赖队列的对照路径。
387
+
388
+ ### 7.3 `settled(ok)`:唯一允许置 `passed` 的判据
389
+
390
+ 一次编译只有在**三件事同时成立**时才算"落地为通过":
391
+
392
+ 1. **进程退出码为 0**(`exitCode === 0`,且不是 `timeout`、不是 `interrupted`);
393
+ 2. **内容哈希未变**:编译期间该 `.lean` 文件没有被改写(同一次归档的内容哈希一致);
394
+ 3. **构建上下文未变**:引擎、`leanArgs`、搜索路径这一组"编译上下文"与入队时一致。
395
+
396
+ 只有 `settled(ok)` 可以:把对象标为 `passed`、写 `Verified/Lean/<id>.lean`、把引理并入可复用库。
397
+ **其它一切结果都停在 `attempted`**:`failed`(退出码非 0)、`timeout`、`interrupted`、
398
+ 以及哈希/上下文不匹配(此时结果**作废**并在 `note` 里写明 "file changed while compiling" /
399
+ "build context changed while compiling")。`require` 档的门禁据此判定——排队中或失败中的作业
400
+ **绝不能**让一条结论变成"已形式化"。
401
+
402
+ ### 7.4 后台队列(`leanAsync=true`,默认)
403
+
404
+ - 入队即返回:成员继续工作;每个作业在 `<项目>/Formal/Jobs/<jobId>.json` 有镜像。
405
+ - 并发上限 = `leanJobsMaxParallel`(默认 1 = 串行,资源占用可预期)。
406
+ - 落地时**一次性公告**给成员(注入到其下一轮提示的【形式化结果】行),并在群聊/活动日志留痕;
407
+ 随后由 §7.3 决定 `passed` 还是 `attempted`。
408
+ - **成员不得抢跑**:提示词明确写"作业落地为通过之前不得声称已通过或转忠实性审查"(§6.2)。
409
+
410
+ ### 7.5 卸载与中断(`dispose` / abort)
411
+
412
+ 插件 fiber 卸载、会话销毁或 abort 时:**终止每一个在跑的编译器进程**(`terminate()`),
413
+ 并把作业标为 `interrupted`、把对象停在 `attempted`——**绝不因为"进程已经不在"而当作通过**。
414
+ `interrupted` 的作业可以重跑(重跑会 `attempts+1`)。
415
+
416
+ ### 7.6 `--search-path` 注入(四套一致)
417
+
418
+ 编译器 argv 固定为:
419
+
420
+ ```
421
+ [exe, ...用户 leanArgs, --search-path <VibeMath 根>, <file>]
422
+ ```
423
+
424
+ - 自动根**只有一个**:`<VibeMath 根>`(`import Formal.Lib.<name>` 的模块根),插在
425
+ **用户参数之后、文件名之前**——`lake env lean` 因此自然变成 `lake env lean --search-path <root> <file>`。
426
+ - `leanSearchPaths` 非空时,**先注入用户给的路径(按给定顺序),再注入自动根**,整体去重。
427
+ - **用户显式给出搜索根就不注入**:`leanArgs` 里已有 `--search-path` / `-R` / `--root` 时完全尊重用户配置。
428
+ - **不使用环境变量**:宿主的 `spawn` 没有 env 槽位,所以"注入"只能是参数注入;
429
+ 也不依赖 `LEAN_PATH` 之类的约定。
430
+
431
+ ### 7.7 崩溃 / 重启恢复
432
+
433
+ 启动或 resume 时扫描 `<项目>/Formal/Jobs/*.json`(**在状态文件装好之后**,否则会写在未加载的
434
+ `formal` 记录上):
435
+
436
+ - `queued` → 重新入队;
437
+ - `running` + 文件哈希仍匹配 → 标 `interrupted`,并**重新入队**(`attempts+1`);
438
+ - `running` + 哈希不匹配 → 只标 `interrupted`(结果不可用,不重跑旧内容);
439
+ - `settled` 且**同一构建上下文** → 只补写那次已成立的结论(`resume` 路径);
440
+ 上下文已变则标 `interrupted` 并记 `build context changed`。
441
+
442
+ **恢复绝不"静默地"把对象验证掉**:任何不确定的情形都落到 `attempted`/`interrupted` + 明确 note,
443
+ 由代理决定是否重跑。
444
+
315
445
  ---
316
446
 
317
447
  ## 8. 门禁(`require`)的实现位置
@@ -350,27 +480,29 @@
350
480
 
351
481
  ### 9.2 `<VibeMath 根>/Formal/Lib/Index.md`
352
482
 
353
- **必需列**:`名称 | 文件 | 类别 | 摘要`。
483
+ **必需列**:`名称 | 文件 | 类别 | 依赖(import) | 摘要`。
354
484
  **可选列**:若该架构为库文件保留运行记录,可增加 `最近运行`(v3 就是这样做的,v2/v4/v5 没有);
355
485
  **没有记录就不许加这一列、更不许写假数据**——"说得出这个文件还编不编得过"是有价值的信息,
356
486
  但编一个不说实话的运行状态比没有更糟。
357
487
 
488
+ **依赖列由框架扫描该 `.lean` 的 `import` 行得到**(四套都写),这样索引一次回答
489
+ "有什么 / 叫什么 / 怎么导入":一个定义 import 了谁,决定了它能不能被逐字复用。
490
+
358
491
  ```markdown
359
492
  # 可复用 Lean 定义库(跨项目)
360
- | 名称 | 文件 | 类别 | 摘要 | 最近运行 | ← 最后一列可选
361
- |---|---|---|---|---|---|
362
- | ZMod5 | Lib/ZMod5.lean | def | 模 5 剩余类与基本引理 | ok |
493
+ | 名称 | 文件 | 类别 | 依赖(import) | 摘要 | 最近运行 | ← 最后一列可选
494
+ |---|---|---|---|---|---|---|
495
+ | ZMod5 | Lib/ZMod5.lean | def | Mathlib.Data.ZMod.Basic | 模 5 剩余类与基本引理 | ok |
363
496
  ```
364
497
 
365
498
  ### 9.3 `<VibeMath 根>/Formal/Proved/Index.md`
366
499
 
367
- **必需列**:`名称 | 文件 | 陈述`。
368
- **可选列**:`依赖`(仅当该架构记录依赖关系时)、`最近运行`(同上)、`类别`(v2/v4/v5 用它标注
369
- `lemma`;v3 不加,因为整张表都是引理)。
500
+ **必需列**:`名称 | 文件 | 陈述 | 依赖`(依赖同样由 `import` 行扫描得到,四套都写)。
501
+ **可选列**:`最近运行`、`类别`(v2/v4/v5 用它标注 `lemma`;v3 不加,因为整张表都是引理)。
370
502
 
371
503
  ```markdown
372
504
  # 已成立的 Lean 命题 / 引理(机器已核对,可跨项目复用)
373
- | 名称 | 文件 | 陈述 | 依赖 | 最近运行 | ← 后两列可选
505
+ | 名称 | 文件 | 陈述 | 依赖 | 最近运行 | ← 最后一列可选
374
506
  |---|---|---|---|---|---|
375
507
  | pell_sq_odd | Proved/pell_sq_odd.lean | … | ZMod5 | ok |
376
508
  ```
@@ -382,7 +514,10 @@
382
514
 
383
515
  ## 10. 测试要求(每个架构都要有)
384
516
 
385
- 1. **`off` 是无操作**:提示词里不出现 Lean 字样;验证流程与门禁行为与改动前一致。
517
+ 1. **`off` 是(验证阶段的)无操作**:`formalVerify:'off'` + 默认 `leanInitiative:'normal'` 时提示词里不出现
518
+ Lean 字样;验证流程与门禁行为与改动前一致。**主动性是独立轴**:显式 `leanInitiative:'eager'` 时,
519
+ `off` 档仍注入日线(且只注入日线——验证提示词里不得出现验证阶段的 Lean 文本),
520
+ `leanInitiative:'off'` 则连日线也不注入。
386
521
  2. **`encourage` 注入**:验证提示词含鼓励段落;平时工作提示词含"顺手形式化"段落;
387
522
  对象 `passed` 后,验证提示词切换为**忠实性审查**措辞。
388
523
  3. **`require` 门禁**:无形式化记录时"真"结论**不写入 Verified/**,而是 `undecided` +
@@ -394,7 +529,7 @@
394
529
  5. **参数**:非法值回退;可在运行中切换(切换后新提示词立刻反映新模式)。
395
530
  6. **灵敏度探针**(新增,放进 `audit-formal-sensitivity.mjs`):每条不变式都要有能让对应套件**变红**的变异,
396
531
  且探针必须真的启动套件、真的被套件读取、变异真的改变行为(见 `AUDIT-CHECKLIST.md` §2)。
397
- 7. **静态提示词面**(放进 `audit-persona-surface.test.mjs`,四个预设一起):三个 Lean 工具名与四个参数名
532
+ 7. **静态提示词面**(放进 `audit-persona-surface.test.mjs`,四个预设一起):五个 Lean 工具名与八个参数名
398
533
  必须出现在**该预设 persona 的 `prefix` 与 `text` 两个块**里,档位名(`'off'`/`'encourage'`/`'require'`)
399
534
  逐字出现,忠实性语义与 `Formal/Lib` / `Formal/Proved` / `Verified/Lean` 路径写清;
400
535
  反向:persona 里的每个 `vibe_*` 名字必须真的注册。`audit-persona-sensitivity.mjs` 用变异副本
@@ -419,6 +554,18 @@
419
554
  11. **提示词硬要求的探针**(放进 `audit-formal-sensitivity.mjs`):把注入文本里的工具名改成缩写
420
555
  (`lean_archive`)、删掉 `require` 档的要求段落、把忠实性分支改回"偏离 → 0"——三者都必须让
421
556
  对应套件**变红**。
557
+ 12. **异步队列**(四套都要):`leanAsync=true` 时 `lean_run` / `lean_archive{run:true}` **立即返回**
558
+ `async.jobId` 且不阻塞成员;作业在 `Formal/Jobs/<jobId>.json` 有镜像;落地后**恰好公告一次**
559
+ (【形式化结果】行);`leanAsync=false` 走同步路径并给出与旧版一致的返回体。
560
+ 13. **`settled(ok)` 判据**:只有 exit 0 + 内容哈希未变 + 构建上下文未变三者同时成立才置 `passed`
561
+ 并写 `Verified/Lean/<id>.lean`;编译期间文件被改写或上下文改变时,结果必须**作废**并停在
562
+ `attempted`(断言状态与 note)。排队中/失败/超时/中断**一律不得**让对象变成已形式化。
563
+ 14. **卸载与崩溃恢复**:dispose/abort 必须 `terminate()` 在跑的编译并标 `interrupted`(绝不 `passed`);
564
+ 恢复扫描 `Formal/Jobs/*.json`——`queued` 重入队、`running` 标记中断(哈希匹配则重入队、`attempts+1`)、
565
+ `settled` 只在**同一构建上下文**下补写结论。
566
+ 15. **去重与搜索路径注入**:同内容 + 同构建上下文再归档 → `deduped:true` 且不重写不重编译;
567
+ 编译器 argv 必须是 `[exe, ...用户 leanArgs, --search-path <VibeMath 根>, <file>]`,
568
+ 用户已显式给出搜索根时**不注入**,`leanSearchPaths` 先于自动根且去重。
422
569
 
423
570
  ---
424
571
 
@@ -431,3 +578,11 @@
431
578
  一档落库语义(§4.1)——**降级 + 待办 + 不定论**,而不是把它记成"命题为假"。
432
579
  - **不把 Lean 通过等同于"命题为真"**:`passed` 只表示"形式化代码通过内核检查",
433
580
  该代码是否忠实于命题仍需 m 票审查。这正是 §0 表格里"审查对象变化"的含义。
581
+ - **不注入环境变量**:宿主的 `spawn` 没有 env 槽位,"搜索路径"只能靠 argv 注入(§7.6)。
582
+ 因此也不依赖 `LEAN_PATH` 之类的约定——换宿主时行为不会因为环境差异而变。
583
+ - **异步队列不是持久任务系统**:队列是内存态 + `Formal/Jobs/*.json` 镜像,没有后台守护进程;
584
+ 进程消失时进行中的编译就是 `interrupted`,由恢复逻辑重入队或标记(§7.7)。
585
+ - **不做数学引擎的 argv 模板**:本版本**没有** Maple / MATLAB / Wolfram 的命令行模板,
586
+ 也没有 `mathEngineOverride` 参数(四套插件与本文件都不包含它们)。若将来加入这类外部引擎,
587
+ 其 argv 是**版本相关**的(同一命令在不同版本上参数不同),必须逐个标注 `VERIFY` 并保留一个显式的
588
+ 覆盖入口(如 `mathEngineOverride`)作为逃生门——**不得**把一个未经验证的模板写成"可用"。