Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[简体中文](README.md) | **English**

This overview and the workspace-start, continuing-research and bounded FLAC3D script-review guides have Chinese and English versions. Other guides remain mostly in English; some examples are in Chinese.
This overview and the workspace-start, continuing-research, bounded FLAC3D script-review and existing-CSV result-comparison guides have Chinese and English versions. Other guides remain mostly in English; some examples are in Chinese.

A filesystem-native workspace and optional research kernel for Agent-assisted
mining research. Start with a small Markdown workspace, then enable durable
Expand All @@ -20,6 +20,7 @@ offline examples use the Python standard library.
- [Compare literature for one question](docs/LITERATURE_COMPARISON.md): compare selected papers and optional documentation with page citations and explicit missing information.
- [FLAC3D review workflow](docs/FLAC3D_FIRST_TASK.md): identify inputs and version, check applicable official sources, and save findings for continuation.
- [Bounded FLAC3D script review](docs/FLAC3D_SCRIPT_REVIEW.md): capture selected lines and a file hash, bind read official passages, and save cited findings; the first command family is `zone cmodel assign`.
- [Compare existing CSV results](docs/RESULT_COMPARISON.md): capture declared units and conditions, compare explicitly selected points, link saved research context and recover a derived report.

Give your Agent the question and material locations, for example:
"比较这两篇文献已读部分的试验条件和方法,结合对应版本官方说明,记录依据、缺口和下一步建议。"
Expand Down Expand Up @@ -127,6 +128,7 @@ an independent review.

## Current capabilities

- Read-only result CSV captures and bounded two-case comparisons preserve raw values, physical line locators, declared quantity/units/conditions and quality diagnostics. Compute signed deltas at selected point IDs, associate historical script/documentation context and recover reports; see the [result comparison guide](docs/RESULT_COMPARISON.md).
- Recoverable FLAC3D excerpt reviews with selected lines, file hashes, version-matched official passages and authored findings; optionally compare a selected current file read-only. This does not execute scripts or certify model correctness; see the [script review guide](docs/FLAC3D_SCRIPT_REVIEW.md).
- Continued source review under one ResearchQuestion, retaining prior task and
judgment revisions, with read-only progress and regenerable Markdown reports;
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**简体中文** | [English](README.en.md)

本介绍页以及“建立轻量工作区”“持续研究”和“FLAC3D 局部脚本审阅”指南均可切换中英文。其余指南目前主要为英文,部分示例使用中文。
本介绍页以及“建立轻量工作区”“持续研究”“FLAC3D 局部脚本审阅”和“已有CSV结果比较”指南均可切换中英文。其余指南目前主要为英文,部分示例使用中文。

一个基于本地文件的轻量工作区与可选研究内核,用于协助 Agent 开展矿业研究。
先用少量 Markdown 文件组织项目;需要时,再启用持久研究记录和领域工作流。
Expand All @@ -19,6 +19,7 @@
- [围绕问题比较文献](docs/LITERATURE_COMPARISON.md):按选定维度比较论文与可选软件说明,保留页码引用和缺失信息。
- [FLAC3D 核查工作流](docs/FLAC3D_FIRST_TASK.md):定位输入、确认软件版本、查阅适用的官方说明,并保存可接续的核查结果。
- [FLAC3D 局部脚本审阅](docs/FLAC3D_SCRIPT_REVIEW.zh-CN.md):捕获选定行和文件哈希,关联已读官方段落,保存带行号与引用的发现;首批关注 `zone cmodel assign`。
- [已有CSV结果比较](docs/RESULT_COMPARISON.zh-CN.md):保存已导出结果的来源、单位与工况,按选定测点比较两组数值,关联已有研究并恢复报告。

可以直接告诉 Agent 你的问题和材料位置,例如:

Expand Down Expand Up @@ -105,6 +106,7 @@ Agent 通过 CLI 或公开 Python API 调用内核;模型、宿主应用与用

## 当前能力

- 已有CSV结果的只读捕获与两组有限比较:保留原值、物理行号、单位/指标/工况声明与质量诊断,按选定测点计算有符号差值,关联历史脚本/文档背景并生成可恢复报告;见[结果比较指南](docs/RESULT_COMPARISON.zh-CN.md)。
- 可持久恢复的 FLAC3D 局部脚本审阅:记录选定行、文件哈希、匹配版本的官方段落与人工撰写的发现,按需只读比较当前文件是否变化;不执行脚本或认证模型正确性,见[审阅指南](docs/FLAC3D_SCRIPT_REVIEW.zh-CN.md)。
- 在同一个 ResearchQuestion 下接续资料研究,保留历史任务和判断修订,提供只读进度恢复及可重建的 Markdown 报告;见[持续研究指南](docs/CONTINUING_RESEARCH.zh-CN.md)。
- 简短恢复视图区分待分析任务与继承的历史判断,可展开准确历史版本,并为兼容的资料研究任务提供进展和报告入口。
Expand Down
76 changes: 76 additions & 0 deletions docs/RESULT_COMPARISON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Read and compare existing CSV results

[简体中文](RESULT_COMPARISON.zh-CN.md) | **English** · [Home](../README.en.md)

Capture an existing result export, retain its source hash and declared metadata, compare explicitly selected point IDs, and recover the same comparison in another session. Enable research records only when needed. Original files remain in place.

The user chooses the question, selected points and next work. The Agent reads existing project evidence and records missing information without inventing units or asking the user to repeat settled decisions.

## Format and interpretation

The first format is one case and quantity per comma-separated CSV, with exactly two headers, `point_id,value`, in either column order:

```csv
point_id,value
P1,-12.5
P2,-8.0
P3,
```

Limits: 2 MiB per file, 2,000 data records, and 100 explicitly selected points per comparison. Strict decoding defaults to `utf-8-sig`, including UTF-8 BOM support; select another known encoding explicitly. Invalid CSV structure or headers are rejected. Missing, invalid, nonfinite and duplicate-point values retain diagnostics; they are not filled with zero or silently deduplicated. Other export layouts need a separately documented conversion copy, retaining the original source.

Record quantity, units, column meanings, point definitions and case conditions alongside the capture. These are caller declarations, not proof of the software, export process or solver state. Numeric deltas are **candidate − baseline**, aligned by selected `point_id`, independently of row order. Unknown or mismatched quantity/unit labels and unavailable, missing or ambiguous values prevent the affected deltas. No implicit unit conversion, improvement percentage or engineering interpretation is supplied. Differences and uncertainty in conditions or point definitions remain gaps.

## Agent procedure

Run from the repository. Keep inputs and generated records in the selected project. Skip enabling if already enabled:

```powershell
$projectRoot = 'D:\replace-with-user-chosen\existing-study'
python -B -X utf8 mining_kernel.py enable-research --project-root $projectRoot --project-id study-01
```

Prepare a JSON metadata file for each export:

```json
{
"case_id": "baseline",
"quantity": "displacement_y",
"unit": "mm",
"column_meanings": {"point_id": "Selected monitoring-point identifier", "value": "Displacement with the declared sign convention"},
"point_basis": "Shared point definitions established in the project record",
"conditions": {"stage": "User-confirmed construction stage", "coordinate_frame": "User-confirmed coordinates and sign convention"},
"origin": "provided_export"
}
```

These are examples, not project facts. Unknown fields may be `null` or omitted; `case_id` is required. Authored teaching data require `origin: synthetic` and `--task-context synthetic` and cannot support production comparison.

```powershell
python -B -X utf8 mining_kernel.py result-import --project-root $projectRoot --task-id baseline-read-01 --question "Record the existing baseline displacement export" --csv exports/baseline.csv --metadata-file 'D:\replace-with-user-chosen\baseline-metadata.json'
python -B -X utf8 mining_kernel.py result-import --project-root $projectRoot --task-id candidate-read-01 --question "Record the existing candidate displacement export" --csv exports/candidate.csv --metadata-file 'D:\replace-with-user-chosen\candidate-metadata.json'
```

The receipt identifies the comparable capture Asset. Paths may be project-relative or explicitly selected external absolute paths; external Host paths are not automatically published in persisted records. Capture preserves the whole-file hash, raw selected values, physical line locators and diagnostics, allowing historical recovery without reopening the source.

```powershell
$baselineAsset = '<baseline capture Asset ID>'
$candidateAsset = '<candidate capture Asset ID>'
python -B -X utf8 mining_kernel.py result-compare --project-root $projectRoot --task-id displacement-compare-01 --question "What are the numeric differences at the selected points?" --baseline-asset-ref $baselineAsset --candidate-asset-ref $candidateAsset --point P1 --point P2 --point P3 --comparability-note "Compare only selected labels; recorded conditions and gaps still apply" --related-task '<existing script-review task ID>' --next-action "The user chooses whether to investigate conditions or more points"
python -B -X utf8 mining_kernel.py result-report --project-root $projectRoot --task-id displacement-compare-01 --output reports/displacement-comparison.md
```

Omit or repeat `--related-task` to associate selected script reviews, documentation readings or other research tasks. The report preserves their exact historical revisions, task contexts and documentation trust classes; production comparison rejects synthetic related tasks. Association does not prove that the CSV was generated by that script. Solver provenance requires separate evidence. This workflow starts no solver and creates no Run or engineering Verification.

## Recover and inspect changes

```powershell
python -B -X utf8 mining_kernel.py result-progress --project-root $projectRoot --task-id displacement-compare-01
python -B -X utf8 mining_kernel.py result-report --project-root $projectRoot --task-id displacement-compare-01
```

Default recovery reads saved captures, judgments, gaps and next actions without reopening CSV, scripts or manuals. To compare current files explicitly, supply a JSON object mapping capture Asset IDs to current paths through `result-progress --source-paths-file`. Unchecked, unchanged, changed, missing and read-error states remain distinct.

Identical task requests replay saved records. New source versions, metadata or selected scope require new task IDs and preserve prior comparisons. Successful processing can still produce an `INSUFFICIENT` judgment. Write the task ID, agreed question, report path and pending decisions into `START.md`. Reports are derived views; the writer protects entries, registered materials and unrelated existing files.

The [offline synthetic example](../examples/result_comparison/README.md) demonstrates reordered point rows, missing data, linked script/documentation context and fresh-process recovery. Its authored tables are not real simulation results.
82 changes: 82 additions & 0 deletions docs/RESULT_COMPARISON.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 已有CSV结果的只读接入与比较

**简体中文** | [English](RESULT_COMPARISON.md) · [首页](../README.md)

这个入口读取已有导出的结果表,保存来源版本与阅读范围,按选定测点比较两组数值,并让后续会话恢复同一份比较。它复用可选研究记录,原文件留在原位。

可以直接告诉 Agent:

> 比较这两份位移导出表中的 P1、P2 和 P3,记录单位、工况、差值与缺失信息,并关联已有脚本审阅。保存报告,下次继续。

用户决定问题、选取范围和后续行动。Agent 从已有材料与用户已确认的信息补齐说明;未知信息保留为缺口,不要求用户重复填表,也不能自行猜单位。

## 当前格式与解释范围

首版是一份文件对应一个工况、一个指标的逗号分隔CSV,恰有 `point_id,value` 两列,列顺序可交换。例如:

```csv
point_id,value
P1,-12.5
P2,-8.0
P3,
```

每个文件最多2 MiB、2,000条数据记录;每次明确比较最多100个测点。默认严格按 `utf-8-sig` 读取,接受UTF-8 BOM;确知其他编码时显式指定。表头、列数或CSV结构不符合时拒绝导入;空值、非法数值、非有限值和重复测点保留诊断,不自动填零或去重。若原软件导出格式不同,需要另行保留有来源说明的转换副本,本入口不会改写原表。

单位、指标、列含义、测点依据与工况说明随导入记录保存。它们是调用方的声明,不能证明软件版本、导出过程或模型状态已经核实。

差值固定为 **对照工况值 − 基准工况值**,按选定 `point_id` 对齐,与行排序无关。指标或单位未知、标签不一致,以及测点缺失、重复或数值不可用时,相应差值不能成立。首版不自动换算单位、不计算改善率,也不从正负差值推断支护效果。工况或测点依据的差异与未知仍须出现在缺口中。

## Agent 操作步骤

从仓库运行命令,把材料和生成记录留在用户自己的项目中。已有研究记录时跳过启用步骤:

```powershell
$projectRoot = 'D:\replace-with-user-chosen\existing-study'
python -B -X utf8 mining_kernel.py enable-research --project-root $projectRoot --project-id study-01
```

为每份表准备小型JSON说明文件,例如基准工况:

```json
{
"case_id": "baseline",
"quantity": "displacement_y",
"unit": "mm",
"column_meanings": {"point_id": "用户选定的监测点标识", "value": "按所述方向记录的位移"},
"point_basis": "两组数据使用相同的监测点定义;依据见项目记录",
"conditions": {"stage": "用户已确认的施工阶段", "coordinate_frame": "用户已确认的坐标与正负约定"},
"origin": "provided_export"
}
```

这里只展示格式,不能把示例中的声明照搬为项目事实。未知字段用 `null` 或省略;`case_id` 必须明确。匿名编写的教学数据用 `origin: synthetic` 和 `--task-context synthetic`,不能混入生产比较。

```powershell
python -B -X utf8 mining_kernel.py result-import --project-root $projectRoot --task-id baseline-read-01 --question "记录基准工况已导出的位移表" --csv exports/baseline.csv --metadata-file 'D:\replace-with-user-chosen\baseline-metadata.json'
python -B -X utf8 mining_kernel.py result-import --project-root $projectRoot --task-id candidate-read-01 --question "记录对照工况已导出的位移表" --csv exports/candidate.csv --metadata-file 'D:\replace-with-user-chosen\candidate-metadata.json'
```

回执返回可比较的捕获Asset ID。文件可以使用项目相对路径或用户明确提供的外部绝对路径;持久记录不自动暴露外部宿主路径。保存完整文件哈希、所选两列的原值、物理行号和诊断,恢复时不依赖原表仍然存在。

```powershell
$baselineAsset = '<基准导入回执的捕获 Asset ID>'
$candidateAsset = '<对照导入回执的捕获 Asset ID>'
python -B -X utf8 mining_kernel.py result-compare --project-root $projectRoot --task-id displacement-compare-01 --question "指定测点的两组位移数值相差多少?" --baseline-asset-ref $baselineAsset --candidate-asset-ref $candidateAsset --point P1 --point P2 --point P3 --comparability-note "仅比较用户指定标签;物理可比条件仍以记录和缺口为准" --related-task '<已有脚本审阅任务 ID>' --next-action "由用户决定是否补查工况或增加其他测点"
python -B -X utf8 mining_kernel.py result-report --project-root $projectRoot --task-id displacement-compare-01 --output reports/displacement-comparison.md
```

`--related-task` 可省略或重复使用,关联已有脚本审阅、文档阅读或研究任务。报告保留关联时的准确版本、任务上下文与文档来源类别;生产比较拒绝关联合成任务。**背景关联不能证明CSV由该脚本计算得到**。已有求解器运行的真实性与结果来源需要另有证据。本流程不启动求解器,不创建Run或工程Verification。

## 恢复与来源变化

```powershell
python -B -X utf8 mining_kernel.py result-progress --project-root $projectRoot --task-id displacement-compare-01
python -B -X utf8 mining_kernel.py result-report --project-root $projectRoot --task-id displacement-compare-01
```

默认恢复历史捕获、判断、缺口和后续建议,不重读CSV、脚本或文档。若需比较当前文件,明确提供一个JSON映射文件(捕获Asset ID → 当前文件路径),再给 `result-progress` 传 `--source-paths-file`。未检查、未变、已变、缺失或读取失败分别报告,不能以恢复成功代替文件未变。

相同任务和参数只重放已存记录;新的文件版本、说明或比较范围使用新的任务ID,保留旧结果。命令成功表示处理或记录完成,判断仍可能为 `INSUFFICIENT`。在项目 `START.md` 简短写回问题、任务ID、报告位置和待决定事项,避免重复保存整份结果。报告是可重建的派生文件,写入器保护项目入口、登记材料和其他已有手写文件。

没有现成结果时,可以运行[离线匿名合成示例](../examples/result_comparison/README.md),查看乱序测点、缺失数据、脚本/文档背景和跨会话恢复如何保存。它不能作为真实模拟结果。
28 changes: 28 additions & 0 deletions examples/result_comparison/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 离线匿名CSV结果比较示例

[中文指南](../../docs/RESULT_COMPARISON.zh-CN.md) · [English guide](../../docs/RESULT_COMPARISON.md)

This standard-library example uses authored CSV values and synthetic script/documentation context. It aligns selected point IDs, retains missing data and recovers a report in a fresh process. No data were produced by a solver, and the associated script does not establish CSV provenance.

示例先复用已有合成脚本审阅,再创建两份匿名编写的结果表。对照表的测点顺序不同,并故意缺少P3;只选P1、P2、P3,不能把P4自动纳入比较,也不能把缺失值填零。

| 测点 | 基准值 | 对照值 | 对照值 − 基准值 |
|---|---:|---:|---:|
| P1 | -12.5 | -10.0 | 2.5 |
| P2 | -8.0 | -7.0 | 1.0 |
| P3 | 空值 | 缺少该测点 | 不足,不计算 |

单位标签为编写的 `mm`,工况也为合成说明。差值只演示算术,不能据此推断支护改善或工程适用性。

从仓库根目录运行,选择仓库外的新目录或空目录:

```powershell
$exampleRoot = 'D:\replace-with-user-chosen\csv-result-demo'
python -S -B -X utf8 examples/result_comparison/demo.py $exampleRoot
python -S -B -X utf8 mining_kernel.py result-progress --project-root $exampleRoot --task-id synthetic-result-comparison
python -S -B -X utf8 mining_kernel.py result-report --project-root $exampleRoot --task-id synthetic-result-comparison
```

生成的项目入口记录任务ID与报告链接;报告位于 `reports/result-comparison.md`,关联此前合成脚本与文档的历史版本。恢复命令从记录读取,默认不重新打开源CSV。

演示生成器拒绝覆盖非空目录。已有演示用恢复或报告命令继续查看;真实项目按指南读取已导出的CSV,不把这些教学数据换成生产证据。
Loading
Loading