dsh-math-modeling-agent 0.4.1 → 0.5.0
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 +247 -187
- package/package.json +34 -34
- package/skills/math-modeling-agent/SKILL.md +70 -69
- package/skills/math-modeling-agent/references/claims-evidence.md +53 -41
- package/skills/math-modeling-agent/references/interaction-protocol.md +165 -163
- package/skills/math-modeling-agent/references/report-contract.md +130 -122
- package/skills/math-modeling-agent/references/run-directory.md +65 -62
- package/skills/math-modeling-agent/references/verification-recipes.md +43 -0
- package/skills/math-modeling-agent/schemas/attempt.schema.json +89 -70
- package/skills/math-modeling-agent/schemas/evidence.schema.json +110 -0
- package/skills/math-modeling-agent/schemas/failure.schema.json +30 -0
- package/skills/math-modeling-agent/schemas/ledger.schema.json +88 -68
- package/skills/math-modeling-agent/schemas/run.schema.json +126 -102
- package/skills/math-modeling-agent/schemas/verification.schema.json +60 -0
- package/skills/math-modeling-agent/scripts/correction-lineage.mjs +78 -0
- package/skills/math-modeling-agent/scripts/evidence-store.mjs +349 -0
- package/skills/math-modeling-agent/scripts/failure-insights.mjs +79 -0
- package/skills/math-modeling-agent/scripts/input-snapshot.mjs +98 -0
- package/skills/math-modeling-agent/scripts/ledger-mutation.mjs +82 -0
- package/skills/math-modeling-agent/scripts/migration-v3.mjs +31 -0
- package/skills/math-modeling-agent/scripts/output-integrity.mjs +82 -0
- package/skills/math-modeling-agent/scripts/paper-evidence.mjs +45 -0
- package/skills/math-modeling-agent/scripts/report-contract.mjs +112 -0
- package/skills/math-modeling-agent/scripts/run-state.mjs +829 -707
- package/skills/math-modeling-agent/scripts/verification-recipes.mjs +52 -0
- package/skills/math-modeling-agent/scripts/verification-runner.mjs +8 -0
- package/skills/math-modeling-audit/SKILL.md +41 -41
- package/skills/math-modeling-audit/references/mcm-icm-final-judge.md +335 -331
- package/skills/math-modeling-audit/scripts/mcm-score.mjs +293 -218
- package/skills/math-modeling-audit/scripts/paper-final-review.mjs +40 -0
- package/skills/math-modeling-audit/scripts/project-initial-review.mjs +41 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const RECIPES = Object.freeze({
|
|
3
|
+
data: Object.freeze(['schema', 'ids', 'references', 'hash', 'independent-parser']),
|
|
4
|
+
numeric: Object.freeze(['recompute', 'domain', 'strict', 'tolerance', 'counterexample']),
|
|
5
|
+
feasibility: Object.freeze(['all-constraints', 'actual-output', 'strict-and-tolerance']),
|
|
6
|
+
optimization: Object.freeze(['objective-scope', 'coverage', 'initialization', 'local-global-label']),
|
|
7
|
+
simulation: Object.freeze(['baseline', 'bounds', 'sampling', 'independent-implementation']),
|
|
8
|
+
report: Object.freeze(['nine-sections', 'why-how-what-check', 'coverage', 'symbols', 'citations']),
|
|
9
|
+
reproducibility: Object.freeze(['snapshot', 'command', 'environment', 'hash', 'clean-rerun']),
|
|
10
|
+
'branch-coverage': Object.freeze(['candidate-enumeration', 'branch-switch']),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
function recipeFor(recipeId) {
|
|
14
|
+
const requiredChecks = RECIPES[recipeId]
|
|
15
|
+
if (!requiredChecks) throw new TypeError('unknown verification recipe: ' + recipeId)
|
|
16
|
+
return { id: recipeId, requiredChecks: [...requiredChecks] }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function nonIndependent(value) {
|
|
20
|
+
const text = [value?.independenceKey, value?.derivedFrom, value?.methodFamily].filter(Boolean).join(' ').toLowerCase()
|
|
21
|
+
return ['same summary', 'solver summary', 'deterministic result', 'same result', 'reprint'].some(marker => text.includes(marker))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function countIndependent(verifications) {
|
|
25
|
+
if (!Array.isArray(verifications)) throw new TypeError('verifications must be an array')
|
|
26
|
+
const keys = new Set()
|
|
27
|
+
const rejected = []
|
|
28
|
+
for (const [index, verification] of verifications.entries()) {
|
|
29
|
+
const key = typeof verification?.independenceKey === 'string' ? verification.independenceKey.trim() : ''
|
|
30
|
+
if (!key) { rejected.push({ index, reason: 'missing independenceKey' }); continue }
|
|
31
|
+
if (nonIndependent(verification)) { rejected.push({ index, reason: 'summary/deterministic/reprint provenance is not independent' }); continue }
|
|
32
|
+
if (keys.has(key)) { rejected.push({ index, reason: 'duplicate independenceKey' }); continue }
|
|
33
|
+
keys.add(key)
|
|
34
|
+
}
|
|
35
|
+
return { count: keys.size, keys: [...keys], rejected }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function runRecipe(recipeId, input = {}) {
|
|
39
|
+
const recipe = recipeFor(recipeId)
|
|
40
|
+
if (recipeId === 'branch-coverage') {
|
|
41
|
+
const declared = Number.isInteger(input.declaredCandidates) ? input.declaredCandidates : 0
|
|
42
|
+
const executed = new Set(Array.isArray(input.executedCandidates) ? input.executedCandidates : [])
|
|
43
|
+
if (declared > executed.size) throw new Error('branch-switch-not-tested')
|
|
44
|
+
}
|
|
45
|
+
const checks = input.checks ?? {}
|
|
46
|
+
const missing = recipe.requiredChecks.filter(check => !checks[check] || !['PASS', 'FAIL', 'INCONCLUSIVE'].includes(checks[check].verdict))
|
|
47
|
+
const failed = recipe.requiredChecks.filter(check => checks[check]?.verdict === 'FAIL')
|
|
48
|
+
const verdict = failed.length > 0 ? 'FAIL' : (missing.length > 0 ? 'INCONCLUSIVE' : 'PASS')
|
|
49
|
+
return { recipeId, verdict, missing, failed, checks }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { RECIPES, countIndependent, recipeFor, runRecipe }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export async function runWithBenchmark({ recipeId, expensive = false, benchmark, run }) {
|
|
3
|
+
if (typeof run !== 'function') throw new TypeError('run must be a function')
|
|
4
|
+
if (expensive && (!benchmark || benchmark.verdict !== 'PASS')) throw new Error('benchmark evidence is required before an expensive recipe')
|
|
5
|
+
const startedAt = Date.now()
|
|
6
|
+
const result = await run()
|
|
7
|
+
return { recipeId, benchmark: benchmark ?? null, result, elapsedMs: Date.now() - startedAt }
|
|
8
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: math-modeling-audit
|
|
3
|
-
description: This skill should be used when the user asks to "独立核验数学模型", "检查推导", "寻找反例", "审计建模报告", "按 MCM/ICM 终审框架打分", "verify this model", or needs an artifact-only adversarial audit of mathematical claims, data, code, results, citations, or a competition paper.
|
|
4
|
-
whenToUse: Use for existing artifacts and papers; do not take over open-ended model construction or silently rewrite the audited work.
|
|
5
|
-
user-invocable: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Math Modeling Audit
|
|
9
|
-
|
|
10
|
-
## Goal
|
|
11
|
-
|
|
12
|
-
Independently decide which claims in an existing artifact pass, fail, or remain inconclusive, and why.
|
|
13
|
-
|
|
14
|
-
## Interface
|
|
15
|
-
|
|
16
|
-
Accept a paper, model, derivation, code/result artifact, or MathModelingAgent run. Optionally accept the original problem, competition year/code, target claims, and assurance level.
|
|
17
|
-
|
|
18
|
-
Return per-claim verdicts, evidence levels, counterexamples, reproducibility findings, residual risk, and—only for MCM/ICM judging intent—the fixed final-panel report.
|
|
19
|
-
|
|
20
|
-
## Workflow
|
|
21
|
-
|
|
22
|
-
1. Freeze the artifact set and record review coverage.
|
|
23
|
-
2. Reconstruct claims, assumptions, obligations, and evidence without trusting the author’s summary.
|
|
24
|
-
3. Apply `references/verification-protocol.md` and `references/evidence-levels.md`.
|
|
25
|
-
4. Audit data, parameters, leakage, citations, and reproducibility with `references/data-citation-audit.md`.
|
|
26
|
-
5. Recompute applicable formulas and results through independent tools.
|
|
27
|
-
6. Seek boundary cases, counterexamples, alternative explanations, and simpler models.
|
|
28
|
-
7. Output PASS, FAIL, or INCONCLUSIVE per claim; do not silently repair the source.
|
|
29
|
-
8. For
|
|
30
|
-
|
|
31
|
-
## Invariants
|
|
32
|
-
|
|
33
|
-
- Paper prose and solver success are not verification artifacts.
|
|
34
|
-
- Missing evidence is reported, never supplied on the author’s behalf.
|
|
35
|
-
- Lean verifies the formal statement, not its natural-language fidelity or data pipeline.
|
|
36
|
-
- A score never feeds back into the solver’s SOLVED gate.
|
|
37
|
-
- Disqualification risk stops ordinary award scoring.
|
|
38
|
-
|
|
39
|
-
## Boundaries
|
|
40
|
-
|
|
41
|
-
Do not edit the audited artifact. Do not reward complexity or presentation without evidence. Do not load the large MCM/ICM rubric for generic audits.
|
|
1
|
+
---
|
|
2
|
+
name: math-modeling-audit
|
|
3
|
+
description: This skill should be used when the user asks to "独立核验数学模型", "检查推导", "寻找反例", "审计建模报告", "按 MCM/ICM 终审框架打分", "verify this model", or needs an artifact-only adversarial audit of mathematical claims, data, code, results, citations, or a competition paper.
|
|
4
|
+
whenToUse: Use for existing artifacts and papers; do not take over open-ended model construction or silently rewrite the audited work.
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Math Modeling Audit
|
|
9
|
+
|
|
10
|
+
## Goal
|
|
11
|
+
|
|
12
|
+
Independently decide which claims in an existing artifact pass, fail, or remain inconclusive, and why.
|
|
13
|
+
|
|
14
|
+
## Interface
|
|
15
|
+
|
|
16
|
+
Accept a paper, model, derivation, code/result artifact, or MathModelingAgent run. Optionally accept the original problem, competition year/code, target claims, and assurance level.
|
|
17
|
+
|
|
18
|
+
Return per-claim verdicts, evidence levels, counterexamples, reproducibility findings, residual risk, and—only for MCM/ICM judging intent—the fixed final-panel report.
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
1. Freeze the artifact set and record review coverage.
|
|
23
|
+
2. Reconstruct claims, assumptions, obligations, and evidence without trusting the author’s summary.
|
|
24
|
+
3. Apply `references/verification-protocol.md` and `references/evidence-levels.md`.
|
|
25
|
+
4. Audit data, parameters, leakage, citations, and reproducibility with `references/data-citation-audit.md`.
|
|
26
|
+
5. Recompute applicable formulas and results through independent tools.
|
|
27
|
+
6. Seek boundary cases, counterexamples, alternative explanations, and simpler models.
|
|
28
|
+
7. Output PASS, FAIL, or INCONCLUSIVE per claim; do not silently repair the source.
|
|
29
|
+
8. For project initial review, evaluate the current run and paper-evidence readiness. For complete-paper final review, freeze the manuscript and evidence graph, load references/mcm-icm-final-judge.md, validate arithmetic with scripts/mcm-score.mjs, and preserve its fourteen-section output. Findings can request a correction lineage but never mutate the audited parent.
|
|
30
|
+
|
|
31
|
+
## Invariants
|
|
32
|
+
|
|
33
|
+
- Paper prose and solver success are not verification artifacts.
|
|
34
|
+
- Missing evidence is reported, never supplied on the author’s behalf.
|
|
35
|
+
- Lean verifies the formal statement, not its natural-language fidelity or data pipeline.
|
|
36
|
+
- A score never feeds back into the solver’s SOLVED gate.
|
|
37
|
+
- Disqualification risk stops ordinary award scoring.
|
|
38
|
+
|
|
39
|
+
## Boundaries
|
|
40
|
+
|
|
41
|
+
Do not edit the audited artifact. Do not reward complexity or presentation without evidence. Do not load the large MCM/ICM rubric for generic audits.
|