Skip to content
Closed
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
7 changes: 6 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
.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

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 @@ -890,3 +890,8 @@ selection-rationale-check:
.venv/bin/openamp-foundry selection-rationale-check \
--entry-json '{"selection_id":"SEL-2026-001","batch_id":"batch-2026-001","candidate_id":"OAMP-001","pipeline_version":"v0.7.9","selection_date":"2026-07-09","evidence_level":3,"baseline_comparison":"Scored above random baseline (AUROC 0.83) and charge-matched baseline (AUROC 0.71).","primary_criterion":"Top ensemble score with selectivity index > 2.","safety_flags_checked":["hemolysis_checked","toxicity_checked"],"reviewer":"maintainer-1"}'
@echo "Selection rationale check complete."

batch-priority-check:
.venv/bin/openamp-foundry batch-priority-check \
--entry-json '{"priority_id":"PRI-2026-001","batch_id":"batch-2026-001","candidate_id":"OAMP-001","pipeline_version":"v0.8.0","priority_rank":1,"priority_score":0.87,"evidence_level":3,"synthesis_complexity":"low","novelty_tier":"high","primary_rationale":"Top ensemble score with selectivity > 2, low synthesis risk."}'
@echo "Batch priority check complete."
53 changes: 53 additions & 0 deletions docs/evidence/BATCH_PRIORITY_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Batch Experiment Priority Guide

> **Scope:** Dry-lab only. No wet-lab or in-vivo claims.
> **Purpose:** Record the prioritization rationale for each candidate in a synthesis batch.
> When lab capacity is limited, external collaborators need a machine-validated priority
> ranking with explicit rationale, evidence level, and synthesis complexity.

---

## What Is a Batch Priority Entry?

A `BatchPriorityEntry` records, for a single candidate within a batch:

1. Its priority rank among all candidates (1 = highest priority).
2. A 0–1 priority score summarizing the evidence and selection signals.
3. The evidence level (1–6 from `PROOF_LADDER.md`) supporting the selection.
4. Synthesis complexity estimate (low/medium/high).
5. Novelty tier relative to known AMPs (high/medium/low).
6. The primary rationale for the ranking.
7. Any disqualifying concerns that were considered and weighed.

## Required Fields

| Field | Description |
|---|---|
| `priority_id` | Unique ID, must start with `PRI-` |
| `batch_id` | The batch this priority entry belongs to |
| `candidate_id` | The specific candidate |
| `pipeline_version` | Pipeline version used for scoring |
| `priority_rank` | Integer ≥ 1 (1 = highest priority) |
| `priority_score` | Float 0.0–1.0 |
| `evidence_level` | 1–6, must match `PROOF_LADDER.md` |
| `synthesis_complexity` | `low`, `medium`, or `high` |
| `novelty_tier` | `high`, `medium`, or `low` |
| `primary_rationale` | Non-empty explanation of ranking |
| `dry_lab_only` | Must be True |

## How to Validate

```bash
make batch-priority-check
```

or:

```bash
openamp-foundry batch-priority-check \
--entry-json '{\"priority_id\": \"PRI-2026-001\", ...}'
```

---

*This guide is machine-validated. See `src/openamp_foundry/evidence/batch_priority.py`.*
4 changes: 3 additions & 1 deletion docs/evidence/METRICS_CURRENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +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-09 (Phase K K1 — selection rationale schema — v0.7.9)
> **Last updated:** 2026-07-09 (Phase K K2 — batch experiment priority ranker — v0.8.0)
> **New in v0.8.0:** Batch experiment priority ranker (K2 — Loop 120) — docs/evidence/BATCH_PRIORITY_GUIDE.md with purpose, required field table (11 fields), how-to-validate instructions. src/openamp_foundry/evidence/batch_priority.py with BatchPriorityEntry dataclass (12 fields: priority_id, batch_id, candidate_id, pipeline_version, priority_rank, priority_score, evidence_level, synthesis_complexity, novelty_tier, primary_rationale, disqualifying_concerns, dry_lab_only), BatchPriorityResult dataclass (6 fields, dry_lab_only=True), VALID_SYNTHESIS_COMPLEXITIES (3: high, low, medium), VALID_NOVELTY_TIERS (3: high, low, medium), VALID_EVIDENCE_LEVELS (6: 1-6), validate_batch_priority() (11 checks: PRI- prefix, non-empty batch_id/candidate_id/pipeline_version, priority_rank>=1, priority_score 0.0-1.0, valid evidence_level, valid synthesis_complexity, valid novelty_tier, non-empty primary_rationale, dry_lab_only must be True; evidence_level<=2 warns, rank==1+high-complexity warns, priority_score<0.30 warns), validate_batch_priority_dict() (10 required fields guard). CLI (openamp-foundry batch-priority-check) with --entry-json, --format text|json. make batch-priority-check target. Phase K K2: synthesis wave ranking is now machine-validated.
>
> **New in v0.7.9:** Candidate selection rationale schema (K1 — Loop 119) — docs/evidence/SELECTION_RATIONALE_GUIDE.md with purpose, required field table (11 fields), evidence level table (6 levels from PROOF_LADDER.md), validation workflow. src/openamp_foundry/evidence/selection_rationale.py with SelectionRationaleEntry dataclass (11 fields: selection_id, batch_id, candidate_id, pipeline_version, selection_date, evidence_level, baseline_comparison, primary_criterion, safety_flags_checked, reviewer, dry_lab_only), SelectionRationaleResult dataclass (5 fields, dry_lab_only=True), VALID_EVIDENCE_LEVELS (6: 1-6), MINIMUM_SAFETY_FLAGS (1), validate_selection_rationale() (11 checks: SEL- prefix, non-empty batch_id/candidate_id/pipeline_version, YYYY-MM-DD date, valid evidence_level 1-6, non-empty baseline_comparison/primary_criterion, safety_flags_checked list with >=1 entry, non-empty reviewer, dry_lab_only must be True; evidence_level<=2 warns with synthesis caution), validate_selection_rationale_dict() (10 required fields guard). CLI (openamp-foundry selection-rationale-check) with --entry-json, --format text|json. make selection-rationale-check target. Phase K K1: every selection decision now has a machine-validated evidence trail.
>
> **New in v0.7.8:** Annual safety and benchmark review checklist (J10 — Loop 118) — docs/governance/ANNUAL_REVIEW_CHECKLIST.md with 5-section structured checklist (safety_policy: 6 checks including dual-use safeguards, dry_lab_only enforcement, toxicity filters; benchmark_thresholds: 6 checks including threshold loosening guard, easy-baseline requirement, deprecation check; calibration_status: 4 checks including recalibration gate and rollback plan; governance_decisions: 4 checks including COI disclosures and rotation plan; data_governance: 3 checks including proprietary data flag). src/openamp_foundry/governance/annual_review.py with AnnualReviewEntry dataclass (10 fields: review_id, year, section, reviewer, finding_count, action_items_count, status, notes, completion_date, dry_lab_only), AnnualReviewResult dataclass (6 fields: review_id, year, section, passed, errors, warnings, dry_lab_only=True), VALID_REVIEW_SECTIONS (5: benchmark_thresholds, calibration_status, data_governance, governance_decisions, safety_policy), VALID_ENTRY_STATUSES (5: completed, deferred, in_progress, not_applicable, pending), validate_annual_review_entry() (9 checks: ANN- prefix, 4-digit year, valid section, non-empty reviewer, non-negative finding_count, non-negative action_items_count, valid status, completed requires YYYY-MM-DD completion_date, dry_lab_only must be True; completed+no-notes warns, deferred warns, findings+no-action-items warns), validate_annual_review_dict() (7 required fields guard). CLI (openamp-foundry annual-review-check) with --entry-json, --format text|json. make annual-review-check target. Long-term trust: annual review entries are now machine-validated.
Expand Down
16 changes: 16 additions & 0 deletions docs/research/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Roadmap

## v0.8.0 — Loop 120: Phase K K2 — Batch Experiment Priority Ranker ✓ (2026-07-09)

`docs/evidence/BATCH_PRIORITY_GUIDE.md` with field table and validation workflow
for batch synthesis wave priority entries.

`src/openamp_foundry/evidence/batch_priority.py` with `BatchPriorityEntry`
dataclass (12 fields, dry_lab_only=True enforced), `BatchPriorityResult`
dataclass (6 fields), `VALID_SYNTHESIS_COMPLEXITIES` (3: high/low/medium),
`VALID_NOVELTY_TIERS` (3: high/low/medium), `VALID_EVIDENCE_LEVELS` (1–6),
`validate_batch_priority()` (11 checks, 3 warning conditions: low evidence,
top-rank+high-complexity, low score), `validate_batch_priority_dict()`
(10 required fields guard).
CLI: `openamp-foundry batch-priority-check`. `make batch-priority-check` target.
**v0.8.0 milestone** — synthesis wave ranking is now machine-validated with
explicit evidence level and complexity signals.

## v0.7.9 — Loop 119: Phase K K1 — Selection Rationale Schema ✓ (2026-07-09)

`docs/evidence/SELECTION_RATIONALE_GUIDE.md` documenting what selection rationale
Expand Down
34 changes: 34 additions & 0 deletions src/openamp_foundry/cli/commands/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -2851,3 +2851,37 @@ def _run_selection_rationale_check(args: argparse.Namespace) -> int:
print(" Selection rationale validated. Decision is auditable.")

return 0 if result.passed else 3


def _run_batch_priority_check(args: argparse.Namespace) -> int:
"""Validate a batch experiment priority entry."""
import json as _json
from openamp_foundry.evidence.batch_priority import validate_batch_priority_dict

try:
d = _json.loads(args.entry_json)
except _json.JSONDecodeError as exc:
print(_json.dumps({"status": "error", "error": f"Invalid JSON: {exc}"}))
return 2

if not isinstance(d, dict):
print(_json.dumps({"status": "error", "error": "--entry-json must be a JSON object"}))
return 2

result = validate_batch_priority_dict(d)
output_format = getattr(args, "format", "text")

if output_format == "json":
import dataclasses
print(_json.dumps(dataclasses.asdict(result), indent=2))
else:
status = "PASS" if result.passed else "FAIL"
print(f"Batch priority {result.priority_id} (candidate {result.candidate_id}, rank {result.priority_rank}): {status}")
for e in result.errors:
print(f" ERROR: {e}")
for w in result.warnings:
print(f" WARN: {w}")
if result.passed:
print(" Batch priority validated. Synthesis wave ranking is auditable.")

return 0 if result.passed else 3
23 changes: 22 additions & 1 deletion src/openamp_foundry/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from openamp_foundry.cli.commands.reports import _run_security_report_check
from openamp_foundry.cli.commands.reports import _run_citation_check
from openamp_foundry.cli.commands.reports import _run_roadmap_sync_check
from openamp_foundry.cli.commands.reports import _run_advisory_review_check, _run_annual_review_check, _run_selection_rationale_check
from openamp_foundry.cli.commands.reports import _run_advisory_review_check, _run_annual_review_check, _run_selection_rationale_check, _run_batch_priority_check

import argparse
import json
Expand Down Expand Up @@ -1999,6 +1999,24 @@ def build_parser() -> argparse.ArgumentParser:
help="Output format (default: text).",
)

# ── Batch priority check (Phase K K2) ────────────────────────────
bpc = sub.add_parser(
"batch-priority-check",
help=(
"Validate a batch experiment priority entry. Ranks candidates for "
"the next synthesis wave with evidence level and complexity. Dry-lab only."
),
)
bpc.add_argument(
"--entry-json", type=str, required=True,
help="JSON string of a BatchPriorityEntry dict (required).",
)
bpc.add_argument(
"--format", type=str, default="text",
choices=["text", "json"],
help="Output format (default: text).",
)

# ── Selection rationale check (Phase K K1) ───────────────────────
src2 = sub.add_parser(
"selection-rationale-check",
Expand Down Expand Up @@ -2307,6 +2325,9 @@ def main(argv: list[str] | None = None) -> int:
if args.command == "selection-rationale-check":
return _run_selection_rationale_check(args)

if args.command == "batch-priority-check":
return _run_batch_priority_check(args)

parser.error("unknown command")
return 2

Expand Down
Loading
Loading