dsh-math-modeling-agent 0.2.8 → 0.4.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/README.md CHANGED
@@ -71,6 +71,10 @@ NOT_CHECKED → DERIVED → EXECUTED → VERIFIED → INDEPENDENTLY_VERIFIED →
71
71
 
72
72
  工具只是产生证据的方式,可以替换,工作流不变。
73
73
 
74
+ 本插件保留原 GitHub 项目的核心行为:问题/附件探查、子问题顺序求解、Modeler → Analyzer → Correction 迭代、逐轮日志和可恢复运行;对应关系见 `skills/math-modeling-agent/references/original-project-parity.md`。
75
+
76
+ 数学计算后端扩展位于 `skills/math-modeling-agent/scripts/computation/`:它只负责探测可调用后端、生成能力快照和校验计算记录,不捆绑 Mathematica/SageMath 等外部引擎。
77
+
74
78
  - **Python** 可选(推荐):需要计算时在运行目录内创建隔离环境(数值计算、数据分析、优化、仿真、绘图、独立重算)
75
79
  - **Lean** 可选:形式化验证;不自动安装;**形式命题被证明 ≠ 现实主张被证明**
76
80
  - **Wolfram** 可选:符号计算、解析推导、恒等式验证
@@ -108,7 +112,7 @@ D3 方向/D4 裁决),`run-state.mjs gate` 在每次状态转移前强制校
108
112
  安装:
109
113
 
110
114
  ```bash
111
- dsh plugin --profile web add github:yohanchen1/MathModelingAgent#v0.2.8
115
+ dsh plugin --profile web add github:yohanchen1/MathModelingAgent#v0.4.1
112
116
  dsh --profile web --dump-config # 检查组合层(应看到 dsh-math-modeling-agent-skills 行)
113
117
  dsh web # 重启以加载插件
114
118
  ```
@@ -118,6 +122,17 @@ dsh web # 重启以加载插件
118
122
  不要用 `npm install` 代替,那会装到错误位置。如本机镜像源同步滞后,可显式走官方源:
119
123
  `dsh plugin --profile web add dsh-math-modeling-agent --registry=https://registry.npmjs.org/`)
120
124
 
125
+ 维护者在发布后应分别核对 GitHub 解包目录、npm tarball 解包目录和 profile
126
+ 安装目录:
127
+
128
+ ```bash
129
+ node skills/math-modeling-agent/scripts/distribution-parity.mjs <source-root> <candidate-root>
130
+ ```
131
+
132
+ 该命令比较 package.json `files` allowlist 内所有文件的 SHA-256;它不把 AI
133
+ 解题中的偶发失败当作分发失败。`dsh --profile web --dump-config` 用于检查组合,
134
+ 但新版 DSH 可能重写 profile 的空 `cordis.yml`,不是严格只读操作。
135
+
121
136
  开始建模——直接描述任务即可。每个环节都是人与 LLM 的深度信息交换:LLM 给出带依据链的
122
137
  完整分析(题面原句/数据证据/文献/显式判断标记),你纠正、补充背景或提供自己的参考文献,
123
138
  LLM 更新并展示差异。建模前必须先做文献调研(AI 检索原理与方法文献,你可增删),每个候选
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-math-modeling-agent",
3
- "version": "0.2.8",
3
+ "version": "0.4.1",
4
4
  "description": "Evidence-driven mathematical modeling and verification skills for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: math-modeling-agent
3
- description: This skill should be used when the user asks to "建立数学模型", "解决数学建模题", "继续上次建模", "寻找新的建模方向", "solve this modeling problem", or needs an evidence-backed mathematical model with computation, research, verification, per-attempt reports, and resumable state.
4
- whenToUse: Use for open-ended mathematical modeling, prediction, optimization, estimation, simulation, mechanism, decision, or multi-part contest problems; do not use for auditing an already completed artifact without changing it.
3
+ description: 当用户要求分析数学建模题、读取题目附件、建立预测/优化/估计/仿真模型、比较建模方向、执行数值验证、进行鲁棒性分析或继续已有建模项目时使用。
4
+ whenToUse: 用于开放式数学建模、预测、优化、估计、仿真、机制分析、决策和多小问竞赛题;已有成果的独立审计改用 math-modeling-audit,不在此处静默改写被审计成果。
5
5
  user-invocable: true
6
6
  ---
7
7
 
@@ -17,23 +17,23 @@ Accept problem text, attachments, or an existing run directory.
17
17
 
18
18
  Interaction model (references/interaction-protocol.md): execution details stay autonomous (file names, tool adapters, state fields), but every model-shaping decision is a DEEP three-beat exchange — LLM presents a complete analysis with its evidence chain, the user responds with substance (corrections, background, their own references), the LLM updates the artifact and shows the delta. Decision points: D0 six-section restatement / D1 routing once per task, D-R literature research before any candidate is built, D2 assumptions and D3 direction per subproblem, D2' on mid-subproblem discoveries, D4 verdict per round. Show the runlog digest in the chat after every round (references/report-contract.md); announce one status line before every transition; the user may interrupt at any time.
19
19
 
20
- Return a concise current status, supported claims, unresolved obligations, attempt delta, artifact path, and next action or final report.
20
+ Return a concise current status, supported claims, unresolved obligations, attempt delta, artifact path, and next action or final report. The legacy Modeler → Analyzer → Correction behavior mapping is recorded in `references/original-project-parity.md`.
21
21
 
22
22
  ## Default workflow
23
23
 
24
24
  1. Route the task to Fast, Standard, or High-Assurance using `references/problem-types.md`; ask D1 (task type + assurance mode).
25
- 2. Read available inputs before asking questions; apply the per-subproblem math grill in `references/math-grill.md`; show the D0 restatement and intake digest in the chat.
26
- 3. Create or validate run state with `scripts/run-state.mjs` and follow `references/state-recovery.md`. Gate EVERY transition: `run-state.mjs gate <dir> --to <status> --reason "..."`.
27
- 4. Profile inputs and build the subproblem DAG using `references/data-subproblems.md`.
28
- 5. Register assumptions (per subproblem), claims, and verification obligations from `references/claims-evidence.md`; ask D2 for the subproblem being started.
29
- 6. **Literature research (mandatory, before candidates)**: transition CLAIMS_REGISTERED → RESEARCH, search principles and methods by direction (never contest solutions), write `research/sources.jsonl`, attach a literature column to the candidate matrix, then ask D-R (user endorses/rejects/adds references) and move to CANDIDATES_READY.
30
- 7. Build a baseline and materially different candidates using `references/modeling-methodology.md`; ask D3 (candidate matrix).
31
- 8. Probe tools with `scripts/capability-probe.mjs`; create a run-local Python environment with `scripts/python-environment.mjs` only when computation is required. Announce the tool choice and fallback for the phase (references/tool-policy.md).
32
- 9. Execute, verify, critique, and revise according to `references/workflow.md` and `references/tool-policy.md`; ask D4 after each VERIFY.
25
+ 2. Literature research FIRST: transition TRIAGE RESEARCH, search principles and methods by direction (never contest solutions), write `research/sources.jsonl` + methods matrix, ask D-R (user endorses/rejects/adds).
26
+ 3. Show the D0 deep restatement six sections plus the question-dependency relation and ask D0; gate SCOPE_FROZEN (requires D0+D1+D-R).
27
+ 4. Panorama analysis + data profile (INPUT_PROFILED) with user interaction; global assumptions G-class confirmed via D2-G before CLAIMS_REGISTERED.
28
+ 5. Register claims and obligations; build the candidate matrix with literature column (CANDIDATES_READY) and ask D3.
29
+ 6. For EACH subproblem: subproblem analysis (reference the panorama, do not re-derive), S-class assumptions via D2-SPi, then ATTEMPT EXECUTE VERIFY subproblem robustness (plan→interact→run) D4 verdict REVISE or move to the next subproblem.
30
+ 7. Live documents: any discovery that shows an earlier phase was incomplete patches that phase incrementally (revision + stale), never re-running unaffected completed work.
31
+ 8. Backtracking depth follows the failure root cause (attempt/verify/direction/assumption/analysis/restatement/research), recorded in failed/issues.md.
32
+ 9. Probe tools with `scripts/capability-probe.mjs`; create a run-local Python environment with `scripts/python-environment.mjs` when computation is required; announce the tool choice and fallback.
33
33
  10. Dispatch subagents for parallel exploration, blind verification, and audits per `references/subagent-dispatch.md`.
34
- 11. Escalate evidence gaps or stalled directions through `references/research-breakthrough.md`; write wall memos and the failure ledger per `references/run-directory.md`.
35
- 12. Write only incremental attempt and terminal reports defined by `references/report-contract.md`; output the per-round runlog digest in the chat.
36
- 13. Before any terminal transition, run the cleanup gate (references/run-directory.md) and the robustness gate (a PASSED robustness-kind obligation, or scope.robustnessExempt with reason).
34
+ 11. Escalate evidence gaps through `references/research-breakthrough.md`; write wall memos and the failure ledger per `references/run-directory.md`.
35
+ 12. Write incremental attempt and terminal reports per `references/report-contract.md`; output the per-round runlog digest in the chat.
36
+ 13. Before any terminal transition: cleanup gate, ALL required robustness obligations PASS (or robustnessExempt), every subproblem DONE with dependencies satisfied, D4 for the current attempt, report.md present.
37
37
 
38
38
  ## Invariants
39
39
 
@@ -47,6 +47,19 @@ Return a concise current status, supported claims, unresolved obligations, attem
47
47
  - Continue only when a round closes an obligation, adds reproducible evidence, removes a blocker, tightens uncertainty, or refutes a candidate.
48
48
  - The run directory stays clean at every moment, and every failed path is preserved in its own folder (references/run-directory.md).
49
49
 
50
+ ## Computation tool extension
51
+
52
+ When a computation is required, first call the bundled backend probe:
53
+ `python scripts/computation/probe_backends.py`
54
+ (or the `.ps1` entrypoint when Python is unavailable). Choose only a backend
55
+ reported callable; record the primary route and fallback. Use
56
+ `scripts/computation/backend_inventory.py` with a run-local `--state-file`
57
+ when a persistent capability snapshot is needed. For reproducible/file or
58
+ high-assurance work, initialize and validate
59
+ `scripts/computation/computation_record.py`. These scripts discover and record
60
+ external backends; they are not mathematical engines and their successful
61
+ execution is not proof.
62
+
50
63
  ## Tool degradation
51
64
 
52
65
  Python is recommended but not required for installation. Lean and Wolfram are optional. If a required tool is unavailable, weaken the claim and report the missing obligation; never pretend execution or formal verification occurred.
@@ -6,7 +6,9 @@ Store claim ID, exact wording, type, scope/quantifiers, assumptions, risk, verif
6
6
 
7
7
  ## Assumption record (v2)
8
8
 
9
- Store id, statement, scope (subproblem ids or global), source category, risk, sensitivity plan, validation status, affected claims, status (active/revised/superseded), and revisionHistory [{at, reason, changedTo}]. Allowed source categories are problem, data, theory, verified literature, domain instruction, and modeling simplification.
9
+ Store id, statement, scope ('global' for whole-problem assumptions, or a subproblem id list), source category, risk, sensitivity plan, validation status, affected claims, status (active/revised/superseded), and revisionHistory [{at, reason, changedTo}]. Allowed source categories are problem, data, theory, verified literature, domain instruction, and modeling simplification.
10
+
11
+ Two classes: G-class (global, confirmed once in the panorama layer via D2-G) and S-class (per subproblem, confirmed via D2-SPi). Claims carry an `assumptions` field listing the assumption ids they depend on; when an assumption is revised, dependent claims are marked stale and must carry post-revision evidence before a terminal state (validate warns otherwise).
10
12
 
11
13
  Every assumption additionally carries a `basis` field — the evidence chain behind it: `problem-quote` (exact original wording), `data` (evidence id + statistic), `literature` (source id + excerpt location), or `llm-judgment` (explicitly flagged as the LLM's own inference, challengeable in D2).
12
14
 
@@ -31,7 +31,8 @@ until the user says "可以了". Mathematical modeling is a deep activity;
31
31
  | D0 问题重述 | intake complete | the six-section deep restatement below + open clarification questions | accept + no additions |
32
32
  | D1 路由 | TRIAGE | task type (prediction/optimization/explanation/proof/…) + assurance mode (Fast/Standard/High-Assurance) | auto-routing result |
33
33
  | D-R 文献研究 | CLAIMS_REGISTERED (before CANDIDATES_READY) | the literature list by direction (AI-found); user endorses / rejects / adds their own | accept list |
34
- | D2 假设确认 | **each subproblem starts** | the assumptions for THIS subproblem, each with statement + basis chain (problem quote / data evidence / literature / LLM-judgment marker) + risk + challengeable point | accept all |
34
+ | D2-G 全局假设确认 | CLAIMS_REGISTERED (全景层) | the GLOBAL assumptions that hold for the whole problem (geometry, data, physical mechanism, numerical basis) each with basis chain + risk | accept all |
35
+ | D2 子问题假设确认 | **each subproblem starts** | the assumptions for THIS subproblem only (S-class), each with statement + basis chain + risk | accept all |
35
36
  | D2' 新假设插问 | mid-subproblem discovery that changes model structure | the new assumption + its effect | record-and-continue |
36
37
  | D3 方向选择 | CANDIDATES_READY | candidate matrix with a literature column per direction; user picks or authorizes auto | baseline |
37
38
  | D4 结果裁决 | VERIFY done | verdict + evidence digest + key intermediate results (residual/constraint-violation distributions, figure paths) + failure details | verdict-implied |
@@ -49,6 +50,9 @@ until the user says "可以了". Mathematical modeling is a deep activity;
49
50
  5. **各子问题数学本质判定**:every sub-question of the problem — however
50
51
  many there are (one or ten) — is classified (fitting/optimization/
51
52
  geometric optics/simulation/…), with why.
53
+ 5.5 **问间依赖关系**:which sub-questions depend on which (models, data,
54
+ verified claims reused downstream) — the整体感 guarantee: later questions
55
+ REFERENCE earlier verified results instead of re-deriving them.
52
56
  6. **待澄清问题**:open questions inviting the user to add background,
53
57
  correct a reading, or supply their own references — never a yes/no list.
54
58
 
@@ -141,6 +145,14 @@ interruption opportunity after the first step.
141
145
  and every downstream claim/obligation that depended on the old assumption is
142
146
  marked `stale: true` with the revising assumption id (see claims-evidence.md).
143
147
 
148
+ ## Live documents (every phase can be refined later)
149
+
150
+ Every phase artifact is LIVE: problem-brief.md (restatement), analysisLog,
151
+ assumptions, sources.jsonl, methods.md, attempt reports. While solving,
152
+ anything discovered that shows an earlier phase was incomplete is patched
153
+ INCREMENTALLY — revision record + downstream stale marking — without
154
+ re-running completed unaffected work. This is the "解题中不断完善" rule.
155
+
144
156
  ## Rolling documents
145
157
 
146
158
  - Problem restatement: written once at intake (problem-brief.md); only
@@ -17,6 +17,14 @@ Ask one question at a time. Read the problem and attachments first. Ask only que
17
17
  10. 假设及依据;11. 任务类型(预测/优化/解释/证明/机制/决策);12. 误差/精度要求;
18
18
  13. 验证标准;14. 最终交付物;15. 风险与失败模式;16. 不适用字段(标注原因)。
19
19
 
20
+ ## Layered questioning (v0.3)
21
+
22
+ - **全景层**:global assumptions (G-class) are grilled once — geometry, data
23
+ quality, physical mechanism, numerical basis; recorded via D2-G before
24
+ CLAIMS_REGISTERED.
25
+ - **逐问层**:per-subproblem assumptions (S-class) are grilled when the
26
+ subproblem starts (D2-SPi) — only what is specific to this sub-question.
27
+
20
28
  ## Per-subproblem grilling (v2)
21
29
 
22
30
  - Grill **one subproblem at a time**. Never demand assumptions for Q2 while Q1 is unsolved.
@@ -0,0 +1,19 @@
1
+ # Original GitHub workflow parity
2
+
3
+ The DSH bundle is a faithful workflow migration of the original
4
+ MathModelingAgent project, not a replacement of its useful behavior.
5
+
6
+ | Original GitHub behavior | DSH realization |
7
+ |---|---|
8
+ | PDF/problem extraction in `code/agent.py` | intake D0 and the subproblem DAG |
9
+ | Excel attachment profiling in `code/data_analyzer.py` | INPUT_PROFILED and the run input manifest |
10
+ | sequential subproblem solving | dependency-ordered SPi loop |
11
+ | Modeler → Analyzer → Correction loop in `code/prompts.py` | explorer/modeler → verifier/analyzer → corrector/revise |
12
+ | per-round thinking and run logs | attempts/<n>/report.md, events.jsonl, and chat runlog digest |
13
+ | acceptance/rejection and stagnation control | D4 verdict, progress test, REVISE/FORK, and resumable non-SOLVED states |
14
+ | hash-based cache and resume | run-local artifacts, evidence links, and state recovery |
15
+
16
+ The migration deliberately replaces private chain-of-thought storage with
17
+ human-readable reasoning, evidence, and reproducible artifacts. The roles and
18
+ loop semantics remain; only the execution substrate changes from the legacy
19
+ Python CLI to DSH skills and state files.
@@ -24,6 +24,12 @@ Do not copy full prior solutions or private reasoning.
24
24
 
25
25
  State the frozen question, final scientific status, answer/recommendation, verified claims and evidence links, conditional/unresolved claims, assumptions and sensitivity, candidate comparison, data and parameter sources, validation, failure cases, limitations, reproducibility commands, and resume conditions when non-SOLVED.
26
26
 
27
+ 整体感 requirement (v0.3): the terminal report is ONE narrative, not a
28
+ concatenation of sub-question reports — it must show the question-dependency
29
+ chain (which model fed which), the shared global assumptions, and the
30
+ cross-sub-question consistency checks. A reader must be able to see the whole
31
+ problem as one connected argument.
32
+
27
33
  ## Chat display — the runlog digest (MUST output, v2.7)
28
34
 
29
35
  The following is shown DIRECTLY IN THE CHAT, not only on disk.
@@ -7,8 +7,9 @@ produce reports and evidence. Never let a subagent mutate run-state directly.
7
7
 
8
8
  | Class | Role (lineage) | When | Count |
9
9
  |---|---|---|---|
10
- | explorer | parallel candidate exploration (legacy Modeler) | CANDIDATES_READY, >= 2 independent directions | 1 per direction |
11
- | verifier | blind re-verification (legacy Analyzer/Correction) | before terminal: key numeric/feasibility claims | Standard: 1 per task; High-Assurance: 1 per claim |
10
+ | explorer | parallel candidate exploration (original Modeler lineage) | CANDIDATES_READY, >= 2 independent directions | 1 per direction |
11
+ | verifier | blind re-verification (original Analyzer lineage) | before terminal: key numeric/feasibility claims | Standard: 1 per task; High-Assurance: 1 per claim |
12
+ | corrector | apply accepted critique and produce the next attempt (original Correction lineage) | after a failed/conditional verdict | 1 per selected direction |
12
13
  | auditor | artifact-only audit (math-modeling-audit skill) | before SOLVED | High-Assurance: mandatory; else optional |
13
14
 
14
15
  ## Brief template (self-contained; subagents see no parent context)
@@ -22,6 +22,17 @@ e.g. "本阶段用 Python+OSQP 做约束优化;Wolfram 对本题非必需,
22
22
  The problem never silently depends on a single tool: every phase names its
23
23
  backend, its fallback, and the degradation path when the backend fails.
24
24
 
25
+ ## Computation backend extension
26
+
27
+ Before selecting an external computation backend, run
28
+ `scripts/computation/probe_backends.py` (or its PowerShell compatibility entry)
29
+ and use only the live capability result. Persist a backend snapshot with
30
+ `scripts/computation/backend_inventory.py` and an explicit run-local
31
+ `--state-file` when the phase needs a stable inventory. Use
32
+ `scripts/computation/computation_record.py` for reproducible/file or
33
+ high-assurance computation. A probe, inventory, or record validation does not
34
+ prove a mathematical claim.
35
+
25
36
  ## Python
26
37
 
27
38
  Use `scripts/python-environment.mjs`. Prefer uv, then an existing Python runtime plus venv. Keep the environment under the run directory. Install only required normalized PyPI package names; VCS URLs, local wheels, or arbitrary indexes require explicit user approval. Record lock, seed, command, workdir, timeout, stdout/stderr, exit code, and generated files.
@@ -8,21 +8,28 @@
8
8
 
9
9
  ## States
10
10
 
11
- TRIAGE → SCOPE_FROZEN → INPUT_PROFILED → CLAIMS_REGISTERED → CANDIDATES_READY → ATTEMPT → EXECUTE → VERIFY.
11
+ TRIAGE → RESEARCH → SCOPE_FROZEN → INPUT_PROFILED → CLAIMS_REGISTERED → CANDIDATES_READY → ATTEMPT → EXECUTE → VERIFY.
12
12
 
13
13
  VERIFY may move to REVISE, RESEARCH, FORK, an independent audit, or one terminal status:
14
14
  SOLVED, PARTIAL, CONDITIONAL, INCONCLUSIVE, REFUTED, INFEASIBLE, UNIDENTIFIABLE, BLOCKED, CANCELLED.
15
15
 
16
- ## Pre-modeling literature research (v2.6, mandatory)
16
+ ## Three-layer flow (v0.3)
17
17
 
18
- CLAIMS_REGISTERED → RESEARCH → CANDIDATES_READY. Before any candidate is
19
- built, run the D-R exchange (interaction-protocol.md): search principles and
20
- methods by direction, write research/sources.jsonl, attach a literature column
21
- to the candidate matrix. Every direction must be traceable to at least one
22
- source engineering background, methodology paper, textbook, or official
23
- documentation; a literature-free direction must be explicitly marked
18
+ - **全景层**(一次建立,贯穿全题):TRIAGE(读题+D1) → RESEARCH(文献+D-R,前置)SCOPE_FROZEN(D0 七段重述,含问间依赖) INPUT_PROFILED(全景分析+数据画像) → CLAIMS_REGISTERED(全局假设 G,D2-G) → CANDIDATES_READY(方法矩阵+D3)。
19
+ - **逐问层**(SPi 循环):子问题分析 → 子问题假设 Si(D2-SPi)→ ATTEMPT 建模求解 → VERIFY 该问验证 → 该问鲁棒性(扰动计划→交互→执行)→ D4 裁决 → REVISE(本问修订)或进入 SPi+1(reason: "SPi 完成,进入 SPi+1")。
20
+ - **收束层**:跨问联动检查(终态 gate 校验全部子问题 DONE + 依赖满足)→ 全题鲁棒性汇总 → 终态硬门 → SOLVED + final-report(整体叙事,非拼凑)。
21
+
22
+ ## Pre-modeling literature research (mandatory)
23
+
24
+ TRIAGE → RESEARCH → D-R → SCOPE_FROZEN. After the initial task triage and
25
+ before D0 restatement is frozen, run the D-R exchange
26
+ (interaction-protocol.md): search principles, engineering background, and
27
+ methods by direction; write research/sources.jsonl; attach a literature
28
+ column to the candidate matrix. Every direction must be traceable to at least
29
+ one source. A literature-free direction must be explicitly marked
24
30
  "原创方向" with its derivation basis. Never search for solutions to the
25
- specific contest problem.
31
+ specific contest problem. Mid-solve evidence gaps use a recorded
32
+ RESEARCH backtrack, not an implicit bypass of the initial research phase.
26
33
 
27
34
  ## Interaction gates (v2)
28
35
 
@@ -37,6 +44,22 @@ scope.robustnessExempt is set with a reason.
37
44
 
38
45
  - REVISE/RESEARCH reasons MUST reference a decisionStack entry id; the round
39
46
  returns to that decision point and tries the next option.
47
+ - Backtracking depth is chosen by the failure root cause (recorded in
48
+ failed/issues.md):
49
+
50
+ | Root cause | Depth | Action |
51
+ |---|---|---|
52
+ | IMPLEMENTATION / TOOL | attempt | fix and rerun, no backtrack |
53
+ | VALIDATION | verify | add obligations, re-verify |
54
+ | MODEL (wrong direction) | direction | switch candidate (wall memo) |
55
+ | assumption falsified | assumption | revise assumption (revisionHistory) → dependent claims stale → re-verify |
56
+ | analysis gap | analysis | update analysisLog → re-derive downstream |
57
+ | restatement misunderstanding | restatement | revise problem-brief (re-freeze) |
58
+ | RESEARCH_GAP | research | add sources, switch method |
59
+
60
+ Backtracking to assumption/analysis/restatement depth is a CONTENT revision
61
+ plus downstream re-verification — the state machine does not rewind; the
62
+ loop is expressed as REVISE cycles and event records.
40
63
  - FORK records its fork point; each failed branch writes a wall memo
41
64
  (run-directory.md) before the next branch starts. A wrong direction always
42
65
  returns to the fork point, never mid-branch.
@@ -0,0 +1,20 @@
1
+ # DSH computation tool extension
2
+
3
+ These entrypoints are adapted from the user-provided
4
+ `math-science-computation` toolkit. They are computation-support tools, not
5
+ mathematical engines: they discover callable external backends, persist a
6
+ local capability snapshot, and validate reproducible computation records.
7
+
8
+ ## Entrypoints
9
+
10
+ - `probe_backends.py` / `probe_backends.ps1`: read-only discovery of
11
+ Wolfram/Mathematica, primecount, SageMath, Python, and Python library
12
+ availability. External probes are bounded and return structured failures.
13
+ - `backend_inventory.py` / `backend_inventory.ps1`: read or refresh a
14
+ capability snapshot. Pass a run-local `--state-file`/`-StateFile`; do not
15
+ use an implicit shared machine-wide path.
16
+ - `computation_record.py`: initialize or validate a reproducibility record
17
+ for every probeable backend, including primecount.
18
+
19
+ The external backend remains responsible for the actual mathematical
20
+ calculation. A successful probe or record validation is not a proof.
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://local.codex.invalid/math-science-computation/backend-inventory.schema.json",
4
+ "title": "Math and science computation local backend inventory",
5
+ "type": "object",
6
+ "required": [
7
+ "inventory_schema_version",
8
+ "created_at_utc",
9
+ "updated_at_utc",
10
+ "local",
11
+ "mcp",
12
+ "invalidations"
13
+ ],
14
+ "properties": {
15
+ "inventory_schema_version": { "const": "1.0" },
16
+ "created_at_utc": { "type": "string", "format": "date-time" },
17
+ "updated_at_utc": { "type": "string", "format": "date-time" },
18
+ "local": {
19
+ "type": "object",
20
+ "required": ["schema_version", "probed_at_utc", "host", "mathematica", "primecount", "sagemath", "python"],
21
+ "properties": {
22
+ "schema_version": { "const": "1.0" },
23
+ "probed_at_utc": { "type": "string", "format": "date-time" },
24
+ "host": {
25
+ "type": "object",
26
+ "required": ["system", "architecture"],
27
+ "properties": {
28
+ "system": { "enum": ["Windows", "Darwin", "Linux"] },
29
+ "architecture": { "type": "string", "minLength": 1 }
30
+ },
31
+ "additionalProperties": true
32
+ },
33
+ "mathematica": { "type": "object" },
34
+ "primecount": { "type": "object" },
35
+ "sagemath": { "type": "object" },
36
+ "python": { "type": "object" }
37
+ },
38
+ "additionalProperties": true
39
+ },
40
+ "mcp": {
41
+ "type": "object",
42
+ "required": ["authority", "persisted_status", "required_action"],
43
+ "properties": {
44
+ "authority": { "const": "current_session_tool_discovery_and_call" },
45
+ "persisted_status": { "const": "historical_only" },
46
+ "required_action": { "type": "string" },
47
+ "mathematica": {
48
+ "type": "object",
49
+ "required": ["server_name", "protocol_version", "server_version", "wolfram_language_version", "observed_at_utc", "evidence"],
50
+ "properties": {
51
+ "server_name": { "type": "string", "minLength": 1 },
52
+ "protocol_version": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
53
+ "server_version": { "type": "string", "minLength": 1 },
54
+ "wolfram_language_version": { "type": "string", "minLength": 1 },
55
+ "observed_at_utc": { "type": "string", "format": "date-time" },
56
+ "evidence": { "const": "initialize_handshake_and_evaluator" }
57
+ },
58
+ "additionalProperties": false
59
+ }
60
+ },
61
+ "additionalProperties": false
62
+ },
63
+ "invalidations": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "object",
67
+ "required": ["backend", "reason", "recorded_at_utc"],
68
+ "properties": {
69
+ "backend": { "enum": ["mathematica", "primecount", "sagemath", "python"] },
70
+ "reason": { "enum": ["user_requested", "path_missing", "execution_failed", "version_mismatch"] },
71
+ "recorded_at_utc": { "type": "string", "format": "date-time" }
72
+ },
73
+ "additionalProperties": false
74
+ }
75
+ }
76
+ },
77
+ "additionalProperties": false
78
+ }