Reproducible Analysis
In Academic Harness: the ledgers are native tools — analysis_run,
dataset_get, data_profile, repro_package — with state under
.dsh/analysis/, .dsh/data/, .dsh/repro/, and package output under
package/<slug>/. The tools record what ran; they never interpret the
science or claim the result is correct.
Use this skill before executing an analysis whose numbers might appear in a
report, manuscript, or decision. For one-off scratch computation with no
lasting claim, plain tooling is fine; the moment a result is reportable, move
it into the ledger.
Before the first run
- Profile the data.
data_profile path=… target=… split=… on each input.
Read the findings: split overlap and near-deterministic target association
are leakage risks to resolve before analysis, not automatic exclusions.
not_checked items (PHI, provenance) stay the author's responsibility.
- Acquire data with provenance.
dataset_get action=get doi=… to inspect
files/licenses, then download into data/<slug>/. Checksum mismatches are
recorded as verification_failed and the file is kept for inspection —
never quietly re-download until it matches. An unstated license is flagged;
do not assume one.
- Freeze the plan.
analysis_run action=plan with question, hypotheses,
inputs, outputs, methods, alpha, corrections, missing-data rules,
exclusions, stopping rules, software, and seed. Add task_rules when the
benchmark has constraints (no external data, a required file format, a
value that must stay fixed): a rule can carry a machine check over an
output path or wait for caller evidence. The plan is frozen at the first
run; changing it later requires new_version: true plus a reason, and
the old plan and runs stay.
Running
analysis_run action=run slug=primary kind=python \
command=["python3","analysis/main.py"] \
env={"ANALYSIS_SEED":"42"} timeout_ms=600000
command is an argv array — the tool never uses a shell. Quote-free tokens
are the point: no injection, no platform surprises.
- The environment is an allowlist plus your explicit
env; ambient secrets are
not forwarded, and explicit values are redacted from stored logs. Do not put
secrets in env anyway — logs are shared with readers of the package.
- Network is off by convention (
no_proxy=*), which is a guardrail, not a
firewall; network: true is recorded in the manifest.
- A nonzero exit or timeout is recorded, not hidden. Investigate it; do not
re-run until green and pretend the earlier attempts never happened.
kind: "notebook" executes via jupyter/papermill and stores the executed
notebook under the run. A copied notebook output is not evidence; the
manifest is.
Checking reported numbers
Declare the number you are going to report before the re-execution, and say
which reference it is:
analysis_run action=expect slug=primary expected_reference=reported \
expected=[{name:"AUROC",value:0.812,path:"results/metrics.json",
format:"json",key:"metrics.auroc",tolerance:0.001}]
analysis_run action=run slug=primary command=["python3","analysis/main.py"]
analysis_run action=verify_scores slug=primary
reference: reported is the paper/table number; reference: reproduced is a
baseline this session re-ran. Never mix them in one comparison.
verify_scores reads only outputs the run hashed. It writes
runs/<id>/repro_check.json with "reproduction": true|false|null and
reports not_checked when the run failed, timed out, used a different plan,
changed its entrypoint, or changed its interpreter — not a silent mismatch.
- Use
allow_environment_drift / allow_entrypoint_change only when you can
say why the change is irrelevant; the drift is still recorded.
- A match is evidence for the declared numbers, not for the science, other
metrics, or other datasets.
Compliance
analysis_run action=compliance checks the latest run against the plan's
frozen task_rules. A rule with a check is evaluated against a hashed output;
a rule without one needs evidence=[{rule_id, satisfied:true|false}]. The
verdict is violated, not_checked, or compliant. A violating run is
discarded, not refined: experiment_log excludes it from best and
dominance, and repro_package leaves it out of the build and deposit under
excluded_runs. A non-zero exit is not_checked, not a violation.
Before declaring expectations, run repo_audit action=probe on the code
repository. If it reports no benchmark-like entrypoint, verify_scores will
stay not_checked until one is documented; do not invent one.
Auditing
analysis_run action=diff run_id=… compares a run against the current plan
and input hashes — the "did anything actually change?" question.
diff run_id=a compare_run_id=b compares two runs field by field.
export format=markdown writes the run report (plan hash, command,
environment, hashes, log paths) with the standing caveat that it is
reproducibility evidence, not a guarantee.
Shipping
repro_package action=plan freezes the inventory (authors, analyses/run ids,
experiments, dataset slugs, code files, manuscript, license, funder), build
writes the package (manifest.json with SHA-256 per file, environment/,
generated Dockerfile, README with run order and data availability,
CITATION.cff, codemeta.json, ro-crate-metadata.json, checksums.sha256), and
verify re-hashes it. Data are referenced, not copied, unless
include_data: true. Warnings (missing license, failed run included, dataset
not copied) are surfaced in the build result — resolve or disclose them.
A run excluded by a compliance violation is omitted and listed under
excluded_runs with the violated rule ids; do not add it back by hand.
deposit is Zenodo-only: preview first, then confirm: true with the
unchanged preview_hash; it creates a draft and never publishes.
Rules
- Never edit
plan.jsonl, runs.jsonl, or a built package by hand.
- Never present a run's exit code 0 as scientific validity — it evidences that
the recorded command ran in the recorded environment.
- Never present
reproduction: true as scientific validity either: it is
evidence for the declared numbers, at the declared tolerance, in the declared
environment. A not_checked repro is not a pass.
- Never compare a number against the wrong reference: keep
reported and
reproduced baselines distinct.
- Never re-plan silently: a changed analysis is a new plan version with a
reason, and readers of the package see both.
analysis_run uses the host's existing permission model; it is not a
sandbox and not a privilege boundary.
1---2name: reproducible-analysis3description: Run analyses so their numbers can be audited later — freeze an analysis plan, execute through the `analysis_run` ledger (argv commands, hashed inputs/outputs, environment allowlist, redacted logs, hard timeouts), declare reported numbers and verify them against a re-execution (`repro_check.json`), check frozen task rules and exclude violating runs, diff runs against the plan, download datasets with provenance via `dataset_get`, profile local files with `data_profile`, and ship a reader-facing `repro_package` (manifest, environment, Dockerfile, CITATION.cff, RO-Crate). Use whenever a result may be reported, published, or revisited after this session.4allowed-tools: Read Write Edit Bash5license: MIT6metadata:7 source: https://skillmd.com/skills/raktim-mondol/reproducible-analysis8 version: "1.0"9 skill-author: Academic Harness10---1112# Reproducible Analysis1314> **In Academic Harness:** the ledgers are native tools — `analysis_run`,15> `dataset_get`, `data_profile`, `repro_package` — with state under16> `.dsh/analysis/`, `.dsh/data/`, `.dsh/repro/`, and package output under17> `package/<slug>/`. The tools record what ran; they never interpret the18> science or claim the result is correct.1920Use this skill before executing an analysis whose numbers might appear in a21report, manuscript, or decision. For one-off scratch computation with no22lasting claim, plain tooling is fine; the moment a result is reportable, move23it into the ledger.2425## Before the first run26271. **Profile the data.** `data_profile path=… target=… split=…` on each input.28 Read the findings: split overlap and near-deterministic target association29 are leakage *risks* to resolve before analysis, not automatic exclusions.30 `not_checked` items (PHI, provenance) stay the author's responsibility.312. **Acquire data with provenance.** `dataset_get action=get doi=…` to inspect32 files/licenses, then `download` into `data/<slug>/`. Checksum mismatches are33 recorded as `verification_failed` and the file is kept for inspection —34 never quietly re-download until it matches. An unstated license is flagged;35 do not assume one.363. **Freeze the plan.** `analysis_run action=plan` with question, hypotheses,37 inputs, outputs, methods, alpha, corrections, missing-data rules,38 exclusions, stopping rules, software, and seed. Add `task_rules` when the39 benchmark has constraints (no external data, a required file format, a40 value that must stay fixed): a rule can carry a machine `check` over an41 output path or wait for caller evidence. The plan is frozen at the first42 `run`; changing it later requires `new_version: true` plus a reason, and43 the old plan and runs stay.4445## Running4647```text48analysis_run action=run slug=primary kind=python \49 command=["python3","analysis/main.py"] \50 env={"ANALYSIS_SEED":"42"} timeout_ms=60000051```5253- `command` is an argv array — the tool never uses a shell. Quote-free tokens54 are the point: no injection, no platform surprises.55- The environment is an allowlist plus your explicit `env`; ambient secrets are56 not forwarded, and explicit values are redacted from stored logs. Do not put57 secrets in `env` anyway — logs are shared with readers of the package.58- Network is off by convention (`no_proxy=*`), which is a guardrail, not a59 firewall; `network: true` is recorded in the manifest.60- A nonzero exit or timeout is *recorded*, not hidden. Investigate it; do not61 re-run until green and pretend the earlier attempts never happened.62- `kind: "notebook"` executes via jupyter/papermill and stores the executed63 notebook under the run. A copied notebook output is not evidence; the64 manifest is.6566## Checking reported numbers6768Declare the number you are going to report **before** the re-execution, and say69which reference it is:7071```text72analysis_run action=expect slug=primary expected_reference=reported \73 expected=[{name:"AUROC",value:0.812,path:"results/metrics.json",74 format:"json",key:"metrics.auroc",tolerance:0.001}]75analysis_run action=run slug=primary command=["python3","analysis/main.py"]76analysis_run action=verify_scores slug=primary77```7879- `reference: reported` is the paper/table number; `reference: reproduced` is a80 baseline this session re-ran. Never mix them in one comparison.81- `verify_scores` reads only outputs the run hashed. It writes82 `runs/<id>/repro_check.json` with `"reproduction": true|false|null` and83 reports `not_checked` when the run failed, timed out, used a different plan,84 changed its entrypoint, or changed its interpreter — not a silent mismatch.85- Use `allow_environment_drift` / `allow_entrypoint_change` only when you can86 say why the change is irrelevant; the drift is still recorded.87- A match is evidence for the declared numbers, not for the science, other88 metrics, or other datasets.8990## Compliance9192`analysis_run action=compliance` checks the latest run against the plan's93frozen `task_rules`. A rule with a `check` is evaluated against a hashed output;94a rule without one needs `evidence=[{rule_id, satisfied:true|false}]`. The95verdict is `violated`, `not_checked`, or `compliant`. A violating run is96**discarded**, not refined: `experiment_log` excludes it from `best` and97`dominance`, and `repro_package` leaves it out of the build and deposit under98`excluded_runs`. A non-zero exit is `not_checked`, not a violation.99100Before declaring expectations, run `repo_audit action=probe` on the code101repository. If it reports no benchmark-like entrypoint, `verify_scores` will102stay `not_checked` until one is documented; do not invent one.103104## Auditing105106- `analysis_run action=diff run_id=…` compares a run against the current plan107 and input hashes — the "did anything actually change?" question.108- `diff run_id=a compare_run_id=b` compares two runs field by field.109- `export format=markdown` writes the run report (plan hash, command,110 environment, hashes, log paths) with the standing caveat that it is111 reproducibility evidence, not a guarantee.112113## Shipping114115`repro_package action=plan` freezes the inventory (authors, analyses/run ids,116experiments, dataset slugs, code files, manuscript, license, funder), `build`117writes the package (manifest.json with SHA-256 per file, environment/,118generated Dockerfile, README with run order and data availability,119CITATION.cff, codemeta.json, ro-crate-metadata.json, checksums.sha256), and120`verify` re-hashes it. Data are referenced, not copied, unless121`include_data: true`. Warnings (missing license, failed run included, dataset122not copied) are surfaced in the build result — resolve or disclose them.123A run excluded by a compliance violation is omitted and listed under124`excluded_runs` with the violated rule ids; do not add it back by hand.125`deposit` is Zenodo-only: preview first, then `confirm: true` with the126unchanged `preview_hash`; it creates a **draft** and never publishes.127128## Rules129130- Never edit `plan.jsonl`, `runs.jsonl`, or a built package by hand.131- Never present a run's exit code 0 as scientific validity — it evidences that132 the recorded command ran in the recorded environment.133- Never present `reproduction: true` as scientific validity either: it is134 evidence for the declared numbers, at the declared tolerance, in the declared135 environment. A `not_checked` repro is not a pass.136- Never compare a number against the wrong reference: keep `reported` and137 `reproduced` baselines distinct.138- Never re-plan silently: a changed analysis is a new plan version with a139 reason, and readers of the package see both.140- `analysis_run` uses the host's existing permission model; it is not a141 sandbox and not a privilege boundary.