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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help demo test lint ci clean bench-leakage bench-multi-negatives bench-baseline bench-hidden-active bench-cluster-split bench-expert-ablation bench-expert-ablation-500 bench-selectivity bench-feature-decomp bench-gate bench-easy-baseline bench-charge-matched bench-order-dependent bench-precision-at-k bench-per-family bench-simulation-ablation bench-simulation-ablation-within-amp simulation-gate bench-strategy-compare regenerate-all generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-pilot pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad external-consensus questionnaire gate-check ip-report benchmark-card wave0-5-gate-check wave0-5-novelty-audit wave0-5-novelty-audit-v2 wave0-5-panel wave0-5-evidence wave0-5-fill-external wave0-5b-generate wave0-5b-filter recalibration-engine recalibration-engine-dry-run validate-policy-version generate-synthetic-lab-results bump-policy-version generate-review-packet failed-candidate-report safe-publication-filter classify-negative-informativeness validate-rejection-events negative-result-dashboard calibration-audit calibration-audit-example calibration-overfit-check result-quality-filter synthetic-result-policy-check calibration-decision-checklist calibration-rollback-plan simulation-registry validate-simulation-result-schema simulation-baseline-check adapter-gate-check simulation-provenance simulation-ensemble-check simulation-ci-report simulation-deprecation-check simulation-scope-check simulation-evidence-packet artifact-version candidate-manifest artifact-changelog integration-check adapter-author-check license-check artifact-compat-check contribution-check adoption-scorecard release-gate-check decision-log release-request-check coi-check rotation-plan-check security-report-check citation-check roadmap-sync-check advisory-review-check annual-review-check selection-rationale-check batch-priority-check pilot-package-check calibration-intake-check uncertainty-report-check preprint-bundle-check reproducibility-manifest-check candidate-summary-card-check multi-candidate-comparison-check pipeline-decision-audit-check claim-to-evidence-check score-decomposition-check reviewer-briefing-check audit-chain-check pre-registration-check dataset-release-check
.PHONY: help demo test lint ci clean bench-leakage bench-multi-negatives bench-baseline bench-hidden-active bench-cluster-split bench-expert-ablation bench-expert-ablation-500 bench-selectivity bench-feature-decomp bench-gate bench-easy-baseline bench-charge-matched bench-order-dependent bench-precision-at-k bench-per-family bench-simulation-ablation bench-simulation-ablation-within-amp simulation-gate bench-strategy-compare regenerate-all generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-pilot pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad external-consensus questionnaire gate-check ip-report benchmark-card wave0-5-gate-check wave0-5-novelty-audit wave0-5-novelty-audit-v2 wave0-5-panel wave0-5-evidence wave0-5-fill-external wave0-5b-generate wave0-5b-filter recalibration-engine recalibration-engine-dry-run validate-policy-version generate-synthetic-lab-results bump-policy-version generate-review-packet failed-candidate-report safe-publication-filter classify-negative-informativeness validate-rejection-events negative-result-dashboard calibration-audit calibration-audit-example calibration-overfit-check result-quality-filter synthetic-result-policy-check calibration-decision-checklist calibration-rollback-plan simulation-registry validate-simulation-result-schema simulation-baseline-check adapter-gate-check simulation-provenance simulation-ensemble-check simulation-ci-report simulation-deprecation-check simulation-scope-check simulation-evidence-packet artifact-version candidate-manifest artifact-changelog integration-check adapter-author-check license-check artifact-compat-check contribution-check adoption-scorecard release-gate-check decision-log release-request-check coi-check rotation-plan-check security-report-check citation-check roadmap-sync-check advisory-review-check annual-review-check selection-rationale-check batch-priority-check pilot-package-check calibration-intake-check uncertainty-report-check preprint-bundle-check reproducibility-manifest-check candidate-summary-card-check multi-candidate-comparison-check pipeline-decision-audit-check claim-to-evidence-check score-decomposition-check reviewer-briefing-check audit-chain-check pre-registration-check hypothesis-outcome-check dataset-release-check

PYTHON := $(shell [ -f .venv/bin/python ] && echo .venv/bin/python || echo python3)
PYTEST := $(shell [ -f .venv/bin/pytest ] && echo .venv/bin/pytest || echo pytest)
Expand Down Expand Up @@ -951,6 +951,9 @@ audit-chain-check:
pre-registration-check:
openamp-foundry pre-registration-check --entry-json '{"registration_id":"PRE-001","batch_id":"BATCH-001","pipeline_version":"0.9.4","registration_date":"2026-07-10","primary_hypothesis":"Candidates selected by OpenAMP will show MIC values at least 2-fold lower than random length/charge-matched peptides in broth microdilution against E. coli ATCC 25922.","primary_outcome_metric":"mic_value","success_threshold":4.0,"baseline_comparators":["random_selection","charge_matched_random"],"candidate_ids":["AMP-001","AMP-002","AMP-003"],"assay_type":"mic_assay","statistical_test":"Mann-Whitney U test, two-sided, alpha=0.05","registered_by":"test@example.com","dry_lab_only":true}' --format text

hypothesis-outcome-check:
openamp-foundry hypothesis-outcome-check --entry-json '{"outcome_id":"HOR-001","registration_id":"PRE-001","batch_id":"BATCH-001","pipeline_version":"0.9.5","outcome_date":"2026-07-15","outcome_verdict":"confirmed","observed_metric_value":2.5,"success_threshold_met":true,"interpretation":"Selected candidates showed median MIC of 2.5 ug/mL, meeting the threshold. Random baseline showed 32 ug/mL. Hypothesis confirmed with strong signal vs random.","deviation_from_plan":"","recorded_by":"test@example.com","dry_lab_only":true}' --format text

dataset-release-check:
.venv/bin/openamp-foundry dataset-release-check \
--entry-json '{"release_id":"DSR-001","dataset_name":"OpenAMP Wave 0.5 Candidates","dataset_version":"1.0.0","release_date":"2026-07-09","license_identifier":"CC-BY-4.0","data_sources":["UniProt AMP database","APD3","in-house pipeline"],"contains_sequences":true,"contains_activity_data":false,"dual_use_assessed":true,"usage_policy_url":"https://openamp.example.org/data-policy","contact_email":"data@openamp.example.org","release_approved":true,"dry_lab_only":true}' \
Expand Down
59 changes: 59 additions & 0 deletions docs/evidence/HYPOTHESIS_OUTCOME_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Hypothesis Outcome Record Guide

## Purpose

A hypothesis outcome record documents whether a pre-registered hypothesis was
confirmed or refuted after experimental results are received. It links the
outcome to the pre-registration form, records the observed metric value,
and requires an explicit interpretation. This closes the HARKing-prevention
loop: the pre-registration (N1) commits to what will be tested; the outcome
record (N2) reports what was found, whether convenient or not.

## Schema Fields

| Field | Type | Description |
|---|---|---|
| outcome_id | str | Unique identifier (prefix "HOR-") |
| registration_id | str | Matching PRE- registration this outcome closes |
| batch_id | str | Batch that was tested |
| pipeline_version | str | Pipeline version used |
| outcome_date | str | ISO 8601 date results were recorded |
| outcome_verdict | str | Whether hypothesis was confirmed or refuted (see valid verdicts) |
| observed_metric_value | float | Actual observed value for the primary outcome metric |
| success_threshold_met | bool | Whether the pre-specified threshold was met |
| interpretation | str | Researcher's plain-language interpretation (max 500 chars) |
| deviation_from_plan | str | Any deviation from pre-registered plan (empty string if none) |
| recorded_by | str | Person or system that recorded this outcome |
| dry_lab_only | bool | False if real lab data; True if computational simulation only |

## Valid Outcome Verdicts

- `confirmed` — hypothesis was supported by observations
- `refuted` — hypothesis was not supported by observations
- `inconclusive` — results were ambiguous or experiment had quality issues
- `partially_confirmed` — hypothesis was supported for a subset of candidates

## Validation Rules

1. outcome_id must start with "HOR-"
2. registration_id must start with "PRE-"
3. outcome_verdict must be one of the valid verdicts
4. observed_metric_value must be finite (not NaN or Inf)
5. interpretation must not be empty and must not exceed 500 characters
6. recorded_by must not be empty

## Warning Conditions

- Verdict/threshold mismatch: success_threshold_met=True but outcome_verdict="refuted" → warn about inconsistency
- Verdict/threshold mismatch: success_threshold_met=False but outcome_verdict="confirmed" → warn about inconsistency
- No deviation documented: outcome_verdict is "inconclusive" but deviation_from_plan is empty → warn that deviations should be documented when results are inconclusive
- Short interpretation: interpretation < 50 chars → warn that interpretation may be underspecified

## Honest Use Boundary

A hypothesis outcome record is scientific evidence of what happened. A
"refuted" verdict is not a failure — it is information. Do not suppress,
reframe, or omit refuted outcomes. The value of pre-registration comes
entirely from honest reporting of all outcomes including inconvenient ones.
Selectively reporting confirmed outcomes while omitting refuted ones
defeats the entire purpose and should be treated as a protocol violation.
5 changes: 3 additions & 2 deletions docs/evidence/METRICS_CURRENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Machine-readable snapshot: `outputs/metrics_snapshot.json` regenerated with `mak
> **Purpose:** One authoritative table of current pipeline metrics. If any doc disagrees
> with this file, this file wins. Updated whenever benchmark/benchmark config changes.
>
> **Last updated:** 2026-07-10 (Phase N N1 — pre-registration form — v0.9.4)
> **New in v0.9.4:** Pre-registration form schema (N1 — Loop 133) — docs/evidence/PRE_REGISTRATION_GUIDE.md with purpose, schema fields table (13 fields: registration_id, batch_id, pipeline_version, registration_date, primary_hypothesis, primary_outcome_metric, success_threshold, baseline_comparators, candidate_ids, assay_type, statistical_test, registered_by, dry_lab_only), 6 valid primary outcome metrics, 5 valid assay types, 10 validation rules, 4 warning conditions, honest-use boundary. PreRegistrationEntry dataclass (13 fields), PreRegistrationResult dataclass (6 fields), validate_pre_registration() (10+ error checks: PRE- prefix, non-empty hypothesis<=500 chars, valid outcome metric, finite success_threshold, >=1 baseline_comparators, >=1 candidate_ids, valid assay_type, non-empty statistical_test<=200 chars, non-empty registered_by, dry_lab_only must be True; 4 warning conditions: no random baseline, large candidate set >20, short hypothesis <50 chars, placeholder statistical test TBD/N/A/NA/none), validate_pre_registration_dict() (12 required fields guard). CLI (openamp-foundry pre-registration-check) with --entry-json, --format text|json. make pre-registration-check target. 62 tests. Phase N (Pre-registration & Baseline Honesty) started with N1.
> **Last updated:** 2026-07-10 (Phase N N2 — hypothesis outcome record — v0.9.5)
> **New in v0.9.5:** Hypothesis outcome record schema (N2 — Loop 134) — docs/evidence/HYPOTHESIS_OUTCOME_GUIDE.md with purpose, schema fields table (12 fields: outcome_id, registration_id, batch_id, pipeline_version, outcome_date, outcome_verdict, observed_metric_value, success_threshold_met, interpretation, deviation_from_plan, recorded_by, dry_lab_only), 4 valid outcome verdicts (confirmed, refuted, inconclusive, partially_confirmed), 6 validation rules, 4 warning conditions (threshold/verdict inconsistency, inconclusive no deviation, short interpretation), honest-use boundary. HypothesisOutcomeEntry dataclass (12 fields), HypothesisOutcomeResult dataclass (7 fields), validate_hypothesis_outcome() (6+ error checks: HOR- prefix, PRE- prefix, valid verdict, finite metric, non-empty interpretation<=500, non-empty recorded_by; 4 warning conditions: threshold/verdict mismatch, inconclusive no deviation, short interpretation), validate_hypothesis_outcome_dict() (11 required fields guard). CLI (openamp-foundry hypothesis-outcome-check) with --entry-json, --format text|json. make hypothesis-outcome-check target. 48 tests. Phase N N2: the pre-registration loop is now closed — outcomes are recorded and matched to their commitments.
> > **New in v0.9.4:** Pre-registration form schema (N1 — Loop 133) — docs/evidence/PRE_REGISTRATION_GUIDE.md with purpose, schema fields table (13 fields: registration_id, batch_id, pipeline_version, registration_date, primary_hypothesis, primary_outcome_metric, success_threshold, baseline_comparators, candidate_ids, assay_type, statistical_test, registered_by, dry_lab_only), 6 valid primary outcome metrics, 5 valid assay types, 10 validation rules, 4 warning conditions, honest-use boundary. PreRegistrationEntry dataclass (13 fields), PreRegistrationResult dataclass (6 fields), validate_pre_registration() (10+ error checks: PRE- prefix, non-empty hypothesis<=500 chars, valid outcome metric, finite success_threshold, >=1 baseline_comparators, >=1 candidate_ids, valid assay_type, non-empty statistical_test<=200 chars, non-empty registered_by, dry_lab_only must be True; 4 warning conditions: no random baseline, large candidate set >20, short hypothesis <50 chars, placeholder statistical test TBD/N/A/NA/none), validate_pre_registration_dict() (12 required fields guard). CLI (openamp-foundry pre-registration-check) with --entry-json, --format text|json. make pre-registration-check target. 62 tests. Phase N (Pre-registration & Baseline Honesty) started with N1.
> > **New in v0.9.3:** Audit chain completeness checker (M5 — Loop 132) — docs/evidence/AUDIT_CHAIN_GUIDE.md with purpose, schema fields table (16 fields: chain_id, batch_id, pipeline_version, audit_date, 9 has_* bools, missing_links, auditor, dry_lab_only), 9 required chain links, validation rules (5), warning conditions (2: single auditor, future date), honest-use boundary. src/openamp_foundry/evidence/audit_chain_completeness.py with AuditChainEntry dataclass (16 fields: chain_id, batch_id, pipeline_version, audit_date, 9 has_* bools, missing_links list[str], auditor, dry_lab_only=True), AuditChainResult dataclass (7 fields: chain_id, batch_id, missing_link_count, passed, errors, warnings, dry_lab_only=True), CHAIN_LINK_FIELDS (9 entries), CHAIN_LINK_COUNT (9), AUDITOR_EMAIL_HINT ("@"), IMPLAUSIBLE_YEAR_THRESHOLD (2030), validate_audit_chain() (5+ error checks: ACH- prefix, non-empty auditor, dry_lab_only must be True, each false chain link errors, missing_links consistency; 2 warnings: no email, future date), validate_audit_chain_dict() (15 required fields guard). CLI (openamp-foundry audit-chain-check) with --entry-json, --format text|json. make audit-chain-check target. 39 tests. Phase M M5: the evidence chain is now machine-checkable end to end. Phase M (Audit Trail Infrastructure) is fully complete with M1-M5.
> **New in v0.9.1:** Score decomposition report schema (M3 — Loop 130) — docs/evidence/SCORE_DECOMPOSITION_GUIDE.md with purpose, schema fields table (12 fields), valid scoring methods (6), validation rules (9), warning conditions (4), honest-use boundary. src/openamp_foundry/evidence/score_decomposition_report.py with ScoreDecompositionEntry dataclass (12 fields: report_id, batch_id, candidate_id, pipeline_version, composite_score, component_scores, component_weights, scoring_method, score_range_min, score_range_max, reviewer, dry_lab_only=True), ScoreDecompositionResult dataclass (7 fields: report_id, batch_id, candidate_id, scoring_method, passed, errors, warnings, dry_lab_only=True), VALID_SCORING_METHODS (6: additive_weighted, geometric_mean, harmonic_mean, max_component, min_component, rank_aggregation), MINIMUM_COMPONENTS (2), WEIGHT_SUM_TOLERANCE (0.01), DOMINANT_WEIGHT_THRESHOLD (0.6), UNBALANCED_RATIO_THRESHOLD (5.0), MAX_COMPONENTS_WARNING (8), LOW_SCORE_FRACTION (0.2), validate_score_decomposition() (9 error checks: SDR- prefix, score_range_min<score_range_max, composite_score in range, >=2 components, weight keys match score keys, weights sum to ~1.0, valid scoring_method, non-empty reviewer, dry_lab_only must be True; 4 warning conditions: dominant component, unbalanced weights, many components, low composite score), validate_score_decomposition_dict() (11 required fields guard). CLI (openamp-foundry score-decomposition-check) with --entry-json, --format text|json. make score-decomposition-check target. Phase M M3: every composite score is now machine-decomposable into its named components for external audit.
> **New in v0.9.0:** Claim-to-evidence mapper schema (M2 — Loop 129) — docs/evidence/CLAIM_TO_EVIDENCE_GUIDE.md with purpose, schema fields table (10 fields), valid claim types (7), validation rules (7), warning conditions (4), honest-use boundary, CLI usage. src/openamp_foundry/evidence/claim_to_evidence_mapper.py with ClaimToEvidenceEntry dataclass (10 fields: mapping_id, batch_id, pipeline_version, claim_text, claim_type, supporting_artifact_ids, evidence_level, pre_specified, reviewer, dry_lab_only=True), ClaimToEvidenceResult dataclass (7 fields: mapping_id, batch_id, claim_type, passed, errors, warnings, dry_lab_only=True), VALID_CLAIM_TYPES (7: activity_prediction, calibration_statement, novelty_claim, performance_comparison, reproducibility_claim, safety_assessment, selection_rationale), VALID_EVIDENCE_LEVELS (6: 1-6), MAX_CLAIM_TEXT_LENGTH (500), LONG_CLAIM_TEXT_THRESHOLD (300), WEAK_EVIDENCE_THRESHOLD (2), validate_claim_to_evidence() (7 error checks: CEM- prefix, non-empty claim_text<=500 chars, valid claim_type, non-empty supporting_artifact_ids, valid evidence_level 1-6, non-empty reviewer, dry_lab_only must be True; 4 warning conditions: post-hoc, weak evidence, single artifact, long claim text), validate_claim_to_evidence_dict() (9 required fields guard). CLI (openamp-foundry claim-to-evidence-check) with --entry-json, --format text|json. make claim-to-evidence-check target. Phase M M2: every scientific claim is now machine-mapped to its supporting artifacts for external audit.
Expand Down
2 changes: 1 addition & 1 deletion docs/research/NEXT_100_PR_MAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Make experiment predictions falsifiable before results are observed. Guard again
| PR | Task | Why it matters | Review class |
|---:|---|---|---|
| N1 | Add pre-registration form schema (complete — Loop 133). | Records what will be tested and how before experiments run. | B |
| N2 | Add hypothesis outcome record schema. | Documents whether pre-registered hypotheses were confirmed or refuted. | B/D |
| N2 | Add hypothesis outcome record schema (complete — Loop 134). | Documents whether pre-registered hypotheses were confirmed or refuted. | B/D |
| N3 | Add baseline comparison manifest schema. | Machine-verifiable proof the model beats cheap baselines. | B |
| N4 | Add negative result record schema. | Ensures failed experiments are documented, not discarded. | B |
| N5 | Add experiment priority justification schema. | Documents why this batch was selected over alternatives. | B |
Expand Down
8 changes: 8 additions & 0 deletions docs/research/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Roadmap

### v0.9.5 — Phase N N2: Hypothesis Outcome Record
- Added `HypothesisOutcomeEntry` schema linking pre-registration to actual experimental outcomes
- Records confirmed/refuted/inconclusive/partially_confirmed verdicts with observed metric value
- Warns on threshold/verdict inconsistency and undocumented inconclusive deviations
- dry_lab_only=False supported (real lab data can be recorded)
- CLI: `openamp-foundry hypothesis-outcome-check`
- 48 tests; all passing

### v0.9.4 — Phase N N1: Pre-Registration Form (starts Phase N)
- Added `PreRegistrationEntry` schema for machine-verifiable experiment pre-commitment
- Records hypothesis, outcome metric, success threshold, and baseline comparators before results are observed
Expand Down
Loading
Loading