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 AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
- Write machine-readable results to standard output and concise diagnostics to standard error where practical.
- Add tests for numerical rules, invalid input, missing values, non-positive values, and exported files.
- Do not claim the skill is research-ready until scientific fixtures and end-to-end tests pass.
- Preserve the published v0.1.0 REE workflow. GeoSkills v0.2.0 may add only trace-element spider diagrams; defer TAS, Harker, and other diagram families to later reviewed versions.
- Preserve the published v0.3.0 REE, spider, Harker, and volcanic TAS workflows.
- Add post-v0.3.0 diagram families only through separate scientific review and validation; defer isotope and tectonic-discrimination diagrams until those workflows are explicitly reviewed.
- Require explicit volcanic applicability and composition-basis declarations before TAS plotting; never silently classify intrusive or otherwise out-of-scope samples.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

This file records the user-visible changes in each public GeoSkills release.

## v0.3.0 — 2026-07-30

The reviewed v0.2.0 spider-diagram milestone was not tagged separately; it is first published as part of this complete v0.3.0 release.

- Added validated primitive-mantle and N-MORB normalized trace-element spider diagrams.
- Added customizable multi-panel Harker variation diagrams with clean outward-rounded axes and shared group legends.
- Added guarded volcanic TAS classification with versioned Le Maitre/Le Bas boundaries, explicit composition-basis declarations, and boundary-review states.
- Added flat and unambiguous transposed CSV, TXT, and XLSX inspection for the new workflows.
- Added editable SVG/PDF, 600 dpi PNG/TIFF, plotted-data CSV, and machine-readable JSON export bundles.
- Preserved below-detection-limit values as missing and kept private inputs and generated outputs outside Git.
- Validated the complete release with 69 automated tests and Ubuntu/Windows CI on Python 3.11 and 3.12.

## v0.1.0 — 2026-07-28

- Published the first GeoSkills release for Sun and McDonough (1989) C1 chondrite-normalized REE patterns.
- Added local table inspection, deterministic normalization, submission-oriented exports, and scientific/privacy safeguards.
54 changes: 44 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

GeoSkills 是一个面向地质学与地球化学研究的本地 Agent Skill。

公开的 v0.1.0 只提供球粒陨石标准化 REE 配分图。
`feature/spider-diagram-v0.2` 分支是已完成人工审核的 v0.2.0 发布候选版:保留 REE,并新增原始地幔或 N-MORB 标准化微量元素蛛网图。TAS、Harker 和其他图解仍不在本版本范围内。
当前正式版本为 [v0.3.0](https://github.com/gronbow/GeoSkills/releases/tag/v0.3.0),包含球粒陨石标准化 REE 配分图、微量元素蛛网图、Harker 变化图,以及带适用性保护的火山岩 TAS 分类图。

## 当前可以做什么

Expand All @@ -14,34 +13,40 @@ GeoSkills 是一个面向地质学与地球化学研究的本地 Agent Skill。
- 使用 Sun & McDonough(1989)C1 球粒陨石值标准化 La–Lu;
- 使用 Sun & McDonough(1989)原始地幔、脚注明确修改的原始地幔或 N-MORB 值生成微量元素蛛网图;
- 对明确标为 wt% 的 `K2O`、`P2O5`、`TiO2` 作可追溯的元素 ppm 换算;
- 生成投稿尺寸的 REE 配分图或蛛网图,并输出 SVG、PDF、600 dpi TIFF、600 dpi PNG;
- 以 SiO2 或用户指定变量为横轴,一次生成一幅或多幅 Harker 变化图;
- 使用 SiO2 与 Na2O + K2O 绘制火山岩 TAS 图,并输出逐样品分类与边界复核状态;
- 生成投稿尺寸的 REE、蛛网图、Harker 或 TAS 图件,并输出 SVG、PDF、600 dpi TIFF、600 dpi PNG;
- 同步输出实际绘图数据 CSV 和机器可读的 JSON 运行报告;
- 可选择完整四边框,以及经过碰撞检查的图内图例;
- 全程在本地处理数据,绘图脚本不请求网络服务。

## 安装到 Codex

以下公开仓库的默认分支目前仍是经过审核的 v0.1.0 REE 版本;v0.2.0 蛛网图发布候选版通过功能分支和 Pull Request 接受合并检查
公开仓库的默认分支 `main` 包含经过审核和自动测试的正式 v0.3.0

```text
https://github.com/gronbow/GeoSkills
```

也可以手动把 `skills/geoskills` 文件夹复制到个人 Skill 目录:
也可以手动把 `skills/geoskills` 文件夹复制到 Codex 的个人 Skill 目录:

```text
%USERPROFILE%\.agents\skills\geoskills
%USERPROFILE%\.codex\skills\geoskills
```

如果设置了 `CODEX_HOME`,则复制到 `%CODEX_HOME%\skills\geoskills`。复制完成后,重新开启一个 Codex 任务即可使用。

## Windows 快速开始

在 PowerShell 中进入项目目录,安装依赖
需要 Python 3.11 或 3.12。先运行 `python --version` 确认版本,然后在 PowerShell 中进入项目目录并安装依赖

```powershell
py -m venv .venv
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements-dev.txt
```

如果系统只提供 Python Launcher,可以把第一条命令改为 `py -3.12 -m venv .venv`。

先检查示例数据:

```powershell
Expand Down Expand Up @@ -74,20 +79,46 @@ py -m venv .venv

默认方案为原文脚注推荐的 `pm-sm89-modified`;也可以明确选择 Table 1 印刷版 `pm-sm89` 或 `nmorb-sm89`。程序不会根据曲线形状替用户猜测标准化方案。

检查 Harker/TAS 所需的主量元素数据:

```powershell
.\.venv\Scripts\python.exe skills\geoskills\scripts\inspect_major_data.py skills\geoskills\examples\synthetic_major_element_data.csv
```

生成默认八面板 Harker 图:

```powershell
.\.venv\Scripts\python.exe skills\geoskills\scripts\plot_harker.py skills\geoskills\examples\synthetic_major_element_data.csv --x SiO2 --y TiO2,Al2O3,Fe2O3T,MgO,CaO,Na2O,K2O,P2O5 --output-dir outputs\harker_figure
```

`--x` 和 `--y` 都可以按数据列自定义。程序默认不画回归线,也不会把相关性直接解释为分离结晶或岩浆混合。
默认八面板会自动排成紧凑的 4 × 2 网格,并共用一个横轴标题;较长的分组图例会自动换行,避免超出图幅。

生成火山岩 TAS 图:

```powershell
.\.venv\Scripts\python.exe skills\geoskills\scripts\plot_tas.py skills\geoskills\examples\synthetic_major_element_data.csv --confirm-volcanic --composition-basis anhydrous-normalized --output-dir outputs\tas_figure
```

TAS 命令要求明确确认样品属于火山岩,并声明数据是无水归一化值还是原始报告值。程序不会把侵入岩、碳酸岩或其他不适用样品静默套入火山岩名称。

程序不会修改原始表格。重复使用同一输出名称时,只有显式加入 `--overwrite` 才会替换已有结果。

## 项目结构

```text
GeoSkills/
├── README.md
├── CHANGELOG.md
├── AGENTS.md
├── requirements-dev.txt
├── skills/
│ └── geoskills/
│ ├── SKILL.md
│ ├── agents/openai.yaml
│ ├── assets/normalization/
│ ├── assets/
│ │ ├── normalization/
│ │ └── classification/
│ ├── examples/
│ ├── references/
│ └── scripts/
Expand All @@ -100,12 +131,15 @@ GeoSkills/
- 缺失值和低于检出限状态保留为曲线断点;零和负数会阻止对数坐标绘图。
- 标准化表包含文献、DOI、表格位置、版本和核对记录。
- 原始地幔表保留文献 Table 1 的 Cs、Pb 数值,并明确提示原文脚注中的 modified 版本;程序不会静默混用。
- Harker 图只展示变量间的协变关系;默认不添加拟合线,也不从相关性单独推断岩浆过程。
- TAS 边界使用带文献与版本信息的本地资产。恰好位于边界上的样品标为 `review_required`,不会静默选择一侧。
- TAS 仅用于明确确认的火山岩;`as-reported` 结果标为初步分类,不能替代无水归一化后的专业判断。
- 图形可以展示富集程度、斜率和平行性,但不能单独证明岩浆源区、部分熔融、分离结晶或构造环境。
- `local_data/` 和 `outputs/` 已排除在 Git 之外;不要提交私人或未发表数据。

## 当前状态

GeoSkills v0.1.0 是仅包含 REE 配分图的公开测试版。v0.2.0 蛛网图发布候选版已通过全部 41 项自动测试、真实数据测试、导出审计和人工图形复核;远端 CI 与 Pull Request 合并完成后再作为稳定版本发布
GeoSkills v0.3.0 是当前正式版本。它整合了 v0.1.0 的 REE 工作流、经过审核的微量元素蛛网图,以及新增的 Harker 和火山岩 TAS 工作流。完整版本通过了 69 项自动测试、已发表数据的 Harker 验证、合成火山岩 TAS 验证、导出审计、人工图面复核,以及 Ubuntu/Windows 上 Python 3.11/3.12 的 GitHub Actions 检查。版本变化见 [CHANGELOG.md](CHANGELOG.md)

## 许可

Expand Down
48 changes: 39 additions & 9 deletions skills/geoskills/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
name: geoskills
description: "Inspect whole-rock geochemical tables and create validated, submission-oriented normalized element-pattern figures from CSV, TXT, or Excel data. Use GeoSkills for chondrite-normalized rare-earth-element patterns or primitive-mantle/N-MORB-normalized trace-element spider diagrams: identify sample, group, element, and supported oxide columns; verify units and invalid values; apply versioned Sun and McDonough (1989) references; export editable SVG/PDF plus 600 dpi TIFF/PNG and source data; or explain why a table cannot yet be plotted safely. Do not use the current version for TAS, Harker, isotope, discrimination, or other geochemical diagrams."
description: "Inspect whole-rock geochemical tables and create validated, submission-oriented REE patterns, trace-element spider diagrams, Harker variation diagrams, or volcanic TAS classification plots from CSV, TXT, or Excel data. Use GeoSkills to identify sample, group, element, and oxide columns; verify ppm or wt% units and invalid values; apply versioned Sun and McDonough (1989) references; require explicit TAS applicability declarations; export editable SVG/PDF plus 600 dpi TIFF/PNG and exact plotted data; or explain why a table cannot yet be plotted safely. Do not use the current version for isotope, tectonic-discrimination, or other diagram families."
---

# GeoSkills v0.2.0 release candidate
# GeoSkills v0.3.0

Create reproducible REE patterns and trace-element spider diagrams through deterministic local Python scripts. Use the language model to select and explain the workflow, never to calculate normalized ratios manually.
Create reproducible REE patterns, trace-element spider diagrams, Harker variation diagrams, and volcanic TAS plots through deterministic local Python scripts. Use the language model to select and explain the workflow, never to calculate normalized ratios or classification fields manually.

## Development status
## Release status

Treat v0.1.0 REE plotting as the stable published baseline. The v0.2.0 spider workflow is a reviewed release candidate: its scientific fixtures, real-data output, export QA, Skill validation, and user review have passed. Do not imply support for TAS, Harker, isotope, or discrimination diagrams.
Treat v0.3.0 as the current released workflow for REE patterns, trace-element spider diagrams, Harker variation diagrams, and guarded volcanic TAS classification. These workflows have passed scientific fixtures, real-data or synthetic-data validation as appropriate, export QA, Skill validation, cross-platform automated tests, and user review. Do not imply support for isotope or tectonic-discrimination diagrams.

## Route the request

- For chondrite-normalized La–Lu patterns, use the REE workflow.
- For multi-element primitive-mantle or N-MORB-normalized patterns, use the spider workflow.
- For one X variable against one or more oxides/elements, use the Harker workflow.
- For volcanic-rock classification by SiO2 and total alkalis, use the TAS workflow.
- Stop and clarify when the requested diagram, unit, reference composition, sample column, or group column is ambiguous.

## REE workflow
Expand All @@ -40,19 +42,42 @@ Use `--axes-frame full --legend-layout inside-auto` when a four-sided frame and

The spider plot defaults to a full frame, no background grid, and `inside-auto` legend placement. It exports editable SVG/PDF, 600 dpi LZW TIFF, 600 dpi PNG, exact normalized source data, and a machine-readable report from the same figure object.

## Harker workflow

1. Run `scripts/check_environment.py`.
2. Run `scripts/inspect_major_data.py INPUT`.
3. Confirm the worksheet, sample identifier, optional group, the X variable, requested Y variables, and each analyte's unit.
4. Run `scripts/plot_harker.py INPUT --x SiO2 --y TiO2,Al2O3,Fe2O3T,MgO,CaO,Na2O,K2O,P2O5 --output-dir OUTPUT_DIR`.
5. Inspect every panel at final size and return the SVG/PDF/TIFF/PNG, plotted-data CSV, and JSON report.

`SiO2` is the conventional default X variable. The user may select another validated analyte explicitly. Do not add regression lines or assign a petrogenetic process from correlation alone.

## TAS workflow

1. Run `scripts/check_environment.py`.
2. Run `scripts/inspect_major_data.py INPUT`.
3. Confirm that the samples are volcanic and ask whether values are already anhydrous-normalized or should be plotted as reported.
4. Run `scripts/plot_tas.py INPUT --confirm-volcanic --composition-basis anhydrous-normalized --output-dir OUTPUT_DIR`.
5. Inspect the final-size figure, classification CSV, boundary/outside statuses, warnings, and JSON report.

TAS uses `SiO2` versus `Na2O + K2O` in wt%. Never infer volcanic applicability from sample names. Do not use the volcanic fields for plutonic rocks, carbonatites, kimberlites, lamproites, or strongly altered compositions. Treat `as-reported` classifications as provisional and points on a boundary as `review_required`.

## Scientific guardrails

- Require confirmed ppm units for direct element concentrations.
- Require explicit wt% units for major oxides and ppm units for direct elemental concentrations.
- Preserve blanks and below-detection-limit states as missing observations. Never replace them with zero or an invented detection limit.
- Reject negative concentrations and duplicate analyte mappings. Permit true zero only on linear Harker/TAS axes.
- Convert only explicit `K2O`, `P2O5`, and `TiO2` wt% columns to K, P, and Ti ppm. Record the CIAAW/IUPAC atomic weights, formula, and factor used.
- Preserve blanks and below-detection-limit states as gaps. Never replace them with zero or an invented detection limit.
- Reject finite zero and negative values on logarithmic axes.
- Preserve the cited Sun and McDonough (1989) incompatibility order even when the user selects a subset.
- Use only the versioned local assets `PrimitiveMantle_SM89`, `PrimitiveMantleModified_SM89`, and `NMORB_SM89` for the spider draft.
- Use only the versioned local assets `PrimitiveMantle_SM89`, `PrimitiveMantleModified_SM89`, and `NMORB_SM89` for the spider workflow.
- Use the source footnote's modified primitive mantle as the spider default. Keep the printed and modified variants separate; do not silently replace Cs or Pb, and warn when an affected element is plotted with the printed variant.
- Set log limits from finite positive ratios, add a declared margin, round to clean decimal bounds without clipping, and show unity only when it lies inside the range.
- Use the versioned `TAS_LeMaitre2002_Volcanic_CombinedT` asset; keep `Trachyte/Trachydacite` and `Tephrite/Basanite` unresolved when normative information is absent.
- Round Harker limits outward to clean values without clipping data. Keep TAS at its declared fixed model limits so the field geometry is not distorted.
- Use colour plus line style for groups and sample symbols so colour is not the sole identifier.
- Keep user data local; plotting scripts must not make network requests.
- Describe enrichment, depletion, slopes, and visible anomalies conservatively. Do not assign a unique source, melting process, mineral control, alteration history, or tectonic setting from one normalized pattern.
- Describe enrichment, depletion, slopes, covariation, and visible anomalies conservatively. Do not assign a unique source, melting process, mineral control, alteration history, or tectonic setting from one plot.

## Related resources

Expand All @@ -67,6 +92,11 @@ The spider plot defaults to a full frame, no background grid, and `inside-auto`
| [assets/normalization/primitive-mantle-sm89.json](assets/normalization/primitive-mantle-sm89.json) | Audit primitive-mantle values and the Cs/Pb footnote |
| [assets/normalization/primitive-mantle-modified-sm89.json](assets/normalization/primitive-mantle-modified-sm89.json) | Audit the explicit footnote-modified Cs/Pb variant |
| [assets/normalization/nmorb-sm89.json](assets/normalization/nmorb-sm89.json) | Audit N-MORB values |
| [scripts/inspect_major_data.py](scripts/inspect_major_data.py) | Inspect major/trace analytes, units, missing states, and Harker/TAS readiness |
| [scripts/plot_harker.py](scripts/plot_harker.py) | Create customizable Harker grids |
| [scripts/plot_tas.py](scripts/plot_tas.py) | Create guarded volcanic TAS figures and classifications |
| [assets/classification/tas-lemaitre-2002.json](assets/classification/tas-lemaitre-2002.json) | Audit TAS fields, labels, applicability, and reference provenance |
| [references/data-contract.md](references/data-contract.md) | Audit the REE input contract |
| [references/scientific-method.md](references/scientific-method.md) | Audit the REE method |
| [references/spider-method.md](references/spider-method.md) | Audit spider input, normalization, conversion, plotting, and interpretation rules |
| [references/major-elements-and-tas.md](references/major-elements-and-tas.md) | Audit Harker/TAS input, plotting, classification, and interpretation rules |
4 changes: 2 additions & 2 deletions skills/geoskills/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface:
display_name: "GeoSkills"
short_description: "Create validated REE and trace-element pattern plots"
default_prompt: "Use $geoskills to inspect my geochemical table and create a validated REE or trace-element spider-plot figure bundle."
short_description: "Create validated REE, spider, Harker, and TAS plots"
default_prompt: "Use $geoskills to inspect my geochemical table and create a validated REE, trace-element spider, Harker, or volcanic TAS figure bundle."
Loading