Skip to content

feat: Add experimental physics workflow support (3 protocols + 1 agent)#255

Open
matt435 wants to merge 2 commits into
psi-oss:mainfrom
matt435:feat/experimental-workflows
Open

feat: Add experimental physics workflow support (3 protocols + 1 agent)#255
matt435 wants to merge 2 commits into
psi-oss:mainfrom
matt435:feat/experimental-workflows

Conversation

@matt435

@matt435 matt435 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

GPD currently has no first-class support for physical/laboratory experiments — all 57 existing protocols and 24 verification checks target theoretical derivations and numerical simulations. The gpd-experiment-designer agent is explicitly numerical-only. This PR adds the experimental physics foundation.

New protocols (3 files, 1,625 lines total):

  • experimental-data-reduction.md — Dead time correction (extending/non-extending models), pile-up rejection, background estimation & subtraction (sideband, MC, analytical), efficiency/acceptance corrections, calibration application, systematic propagation through the correction chain
  • instrument-systematic-budget.md — GUM-compliant Type A/B uncertainty classification, calibration traceability chains, drift monitoring via control charts, budget combination with correlations, dominant source identification
  • measurement-reproducibility.md — Run-to-run stability via Allan variance, operator dependence testing, environmental sensitivity characterization, cross-apparatus agreement via E_n number (ISO 13528), blind analysis protocols

New agent (1 file, 1,045 lines):

  • gpd-lab-designer.md — Designs physical measurement protocols, calibration plans, systematic uncertainty budgets, and reproducibility strategies. Produces LAB-DESIGN.md (parallel to experiment-designer's EXPERIMENT-DESIGN.md). Same authority model: coordination role, orchestrator commit, return_only state.

Registry updates (5 files):

  • protocol-domains.json: new "experimental_methods" domain category
  • config.py: MODEL_PROFILES entry for gpd-lab-designer
  • registry.py: category mapping for gpd-lab-designer
  • set-profile.md: agent count 24 → 25
  • test_config.py: agent count assertion updated

All protocols follow established conventions: YAML frontmatter with load_when triggers, structured steps with tables and equations, common LLM error patterns (8 per protocol, 24 total), worked examples showing wrong-then-correct approaches, and verification checklists.

Motivation

The experimental workflow gap is structural, not incidental. GPD assumes data arrives as static artifacts (CSV, published tables). Real experimental physics requires a pipeline from raw instrument data through corrections, calibration, and systematic budgeting. These protocols fill that gap and enable GPD to guide experimental data analysis with the same rigor it brings to derivations.

Test plan

  • All 284 test_registry.py + test_metadata_consistency.py tests pass
  • All 251 protocol MCP server tests pass
  • Full test suite: 9,593 passed, 3 pre-existing failures (latex compiler mock, runtime boundary, return contract — all reproduce on clean main)
  • Protocol frontmatter validates (load_when triggers, tier, context_cost)
  • Agent frontmatter validates (commit_authority, surface, role_family, artifact_write_authority, shared_state_authority)
  • Cross-references between protocols are correct
  • Agent references use {GPD_INSTALL_DIR} placeholders correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a lab-designer agent to guide full experimental design workflows (protocols, uncertainty budgets, reproducibility, cost/time estimates, and output checklists).
  • Documentation

    • Added protocols for experimental data reduction, instrument systematic budgets, and measurement reproducibility.
    • Updated protocol domain mappings to include the new references.
  • Tests

    • Updated test expectations and prompt-budget baselines to include the new agent.

GPD currently has no first-class support for physical/laboratory
experiments — all 57 protocols and 24 verification checks target
theoretical derivations and numerical simulations. This PR adds the
foundation for experimental physics workflows.

New protocols (src/gpd/specs/references/protocols/):
- experimental-data-reduction.md: dead time, pile-up, background
  subtraction, efficiency corrections, calibration application,
  systematic uncertainty propagation through correction chain
- instrument-systematic-budget.md: GUM-compliant Type A/B uncertainty
  classification, calibration traceability, drift monitoring, budget
  combination with correlations, control charts
- measurement-reproducibility.md: run-to-run stability via Allan
  variance, operator dependence testing, environmental sensitivity
  characterization, cross-apparatus E_n comparison, blind analysis

New agent (src/gpd/agents/):
- gpd-lab-designer.md: designs physical measurement protocols,
  calibration plans, systematic budgets, and reproducibility strategies.
  Produces LAB-DESIGN.md parallel to experiment-designer's
  EXPERIMENT-DESIGN.md. Same authority model (coordination role,
  orchestrator commit, return_only state).

Registry updates:
- protocol-domains.json: new "experimental_methods" domain category
- config.py MODEL_PROFILES: gpd-lab-designer tier assignments
- registry.py: gpd-lab-designer category mapping
- set-profile.md: agent count 24 → 25
- test_config.py: agent count assertion 24 → 25

All protocols follow established conventions: YAML frontmatter with
load_when triggers, structured steps, common LLM error patterns
(8 per protocol), worked examples with wrong/correct approaches,
and verification checklists.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A new lab-experiment design agent (gpd-lab-designer) is introduced with a 1045-line specification covering measurand identification, apparatus configuration, calibration planning, measurement protocols, GUM systematic uncertainty budgeting, reproducibility planning, cost/time estimation, and executor integration. Three new 500+-line reference protocol documents provide detailed procedural guidance for experimental data reduction, instrument systematic uncertainty budgeting, and measurement reproducibility. The agent is registered in configuration, categorized in the skill registry, and test coverage is updated to expect 25 agents instead of 24.

Changes

Lab Designer Agent and Supporting Protocols

Layer / File(s) Summary
Lab Designer Agent Specification
src/gpd/agents/gpd-lab-designer.md
Complete agent specification defining the lab-design role, data boundary protocol, and full LAB-DESIGN document generation workflow: measurand identification with signal-chain analysis, apparatus configuration with SNR feasibility checks, calibration planning with SI traceability and check-standards monitoring, measurement protocol authoring with procedure templates and repetition/sweep rules, GUM-style systematic uncertainty budgets (Type A/Type B classification, sensitivity coefficients, dominant-source identification), reproducibility planning (run-to-run checks, operator protocol, environmental monitoring), cost/time estimation with contingencies, executor integration steps, anti-patterns guidance, and failed experiment recovery procedures. Includes worked thermal-conductivity example and context-pressure management.
Experimental Data Reduction Protocol
src/gpd/specs/references/protocols/experimental-data-reduction.md
Seven-step reference for transforming raw detector data to physics results: raw data inspection with quality checks, dead-time and pile-up corrections with model selection, background estimation and subtraction, efficiency and acceptance corrections with unfolding criteria, calibration application with interpolation constraints and time-dependent drift handling, systematic uncertainty propagation through correction chains, and correct-order formula with reporting requirements. Includes worked gamma-ray counting example, common LLM error patterns, and verification checklist.
Instrument Systematic Budget Protocol
src/gpd/specs/references/protocols/instrument-systematic-budget.md
Seven-step reference for enumerating and combining systematic uncertainties using GUM terminology: Type A vs Type B identification with master checklist, experiment-type classification (spectroscopy, scattering, calorimetry, counting), quantification methods (calibration certificates, manufacturer specs, environmental sensitivity), correlation assessment with hidden-correlation sources and matrix construction, budget combination for correlated/uncorrelated cases with dominant-source criteria, calibration traceability with uncertainty accumulation and drift modeling, and mitigation/monitoring with control charts and Shewhart triggers. Includes UV-Vis spectroscopy worked example and verification checklist.
Measurement Reproducibility Protocol
src/gpd/specs/references/protocols/measurement-reproducibility.md
Six-step reference for validating reproducibility across internal consistency, run-to-run repeatability, operator dependence, environmental sensitivity, and cross-apparatus agreement: single-run consistency tests with drift monitoring and outlier detection (Chauvenet, Grubbs criteria), run-to-run chi-squared checks and Allan variance stability analysis, operator blind-analysis protocols, environmental sensitivity coefficients with correlation analysis, cross-apparatus ISO 13528 Eₙ proficiency testing and Birge ratio uncertainty inflation, and protocol documentation template. Includes four-point probe resistivity worked example with temperature correction and Allan variance interpretation, and verification checklist.
Agent Registration and Configuration
src/gpd/core/config.py, src/gpd/registry.py, src/gpd/specs/references/protocols/protocol-domains.json, src/gpd/specs/workflows/set-profile.md, tests/core/test_config.py, tests/core/test_agent_prompt_budget.py, tests/README.md, tests/repo_graph_contract.json
gpd-lab-designer is added to MODEL_PROFILES with tier assignments across all five model profiles, categorized under planning in the skill registry, registered in protocol-domains.json alongside the three supporting protocols, workflow documentation updated to reflect 25 agents (previously 24), prompt-budget constants and baselines updated and the agent added to lightweight shared-protocol allowlist, and repo-graph/test inventory counts updated.
sequenceDiagram
  participant User as Requester
  participant Agent as gpd-lab-designer
  participant Context as ContextLoader
  participant Design as DesignComposer
  participant CalPlan as CalibrationPlanner
  participant Protocol as MeasurementProtocol
  participant Budget as UncertaintyBudget
  participant Repro as ReproPlan
  participant Executor as Executor

  User->>Agent: request lab design
  Agent->>Context: load state, conventions, prior results
  Context->>Design: identify measurand & SNR feasibility
  Design->>CalPlan: specify calibration strategy & traceability
  CalPlan->>Protocol: author measurement protocol and sequencing
  Protocol->>Budget: build systematic uncertainty budget
  Budget->>Repro: define reproducibility checks and monitoring
  Repro->>Executor: emit LAB-DESIGN.md and gpd_return envelope
Loading

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • cmaloney111

"I nibble on protocols, tidy and bright,
Planning experiments from morning to night.
Measurands clear, budgets tallied with care,
Traces and checks in the documentation I share.
Hop—data to design—precision in sight!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: addition of experimental physics workflow support via 3 new protocols and 1 new agent.
Description check ✅ Passed The description covers all required template sections: What changed (detailed breakdown of 3 protocols and 1 agent), Why (motivation for experimental physics support), and Testing done (comprehensive test results).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (3)
src/gpd/specs/references/protocols/measurement-reproducibility.md (1)

66-68: ⚡ Quick win

Add fence languages for markdownlint compliance and stable parsing.

Unlabeled fenced blocks trigger MD040 across the document. Add explicit languages (text, yaml, or markdown) for all code blocks.

Also applies to: 118-120, 128-130, 203-205, 209-211, 229-231, 252-254, 280-282, 309-351, 378-384, 401-409, 414-419, 430-433, 437-439, 447-449, 451-459, 467-475, 483-496

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gpd/specs/references/protocols/measurement-reproducibility.md` around
lines 66 - 68, The markdown contains unlabeled fenced code blocks (example: the
block with "chi^2 = sum((x_i - x_bar)^2 / sigma_i^2)") which triggers MD040;
update every fenced block in this spec to include an explicit language tag
(e.g., ```text, ```markdown, ```yaml or ```math where appropriate) so the
parser/linter recognizes them—ensure you modify the chi^2 block and all other
fenced sections referenced in the review to use the correct language label for
their content.
src/gpd/specs/references/protocols/experimental-data-reduction.md (1)

100-102: ⚡ Quick win

Add language identifiers to fenced blocks.

These unlabeled fences trigger MD040 and reduce downstream tooling consistency. Tag math/calculation blocks as text (or latex where appropriate).

Also applies to: 130-132, 153-156, 183-185, 193-195, 251-254, 330-332, 412-416, 419-423, 430-434, 437-441, 447-450, 455-457, 460-462, 465-468, 472-474

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gpd/specs/references/protocols/experimental-data-reduction.md` around
lines 100 - 102, The Markdown contains unlabeled fenced code/math blocks (e.g.,
the formula block starting with "sigma(n_true) / n_true = ..." and the other
occurrences you listed) which trigger MD040; update each triple-backtick fence
to include a language identifier such as "text" or "latex" (e.g., change ``` to
```text or ```latex) for all instances referenced (lines 100-102, 130-132,
153-156, 183-185, 193-195, 251-254, 330-332, 412-416, 419-423, 430-434, 437-441,
447-450, 455-457, 460-462, 465-468, 472-474) so the math/calculation blocks are
explicitly labeled for downstream tooling.
src/gpd/agents/gpd-lab-designer.md (1)

112-114: ⚡ Quick win

Fix markdownlint violations to keep examples machine-safe and consistently rendered.

Multiple fenced blocks lack a language tag, and formula lines with * in prose/table cells can misrender as emphasis. Add code fence languages (text, yaml, markdown) and escape/format multiplication symbols in table content.

Also applies to: 166-168, 205-207, 238-249, 339-347, 357-359, 619-624, 663-683, 743-753

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gpd/agents/gpd-lab-designer.md` around lines 112 - 114, Several fenced
code blocks and table/prose cells are missing language tags and the asterisk (*)
in lines like "Physical quantity -> Transducer -> Signal conditioning ->
Digitization -> Recorded value" (and other ranges listed) can be misinterpreted
as emphasis; update each fenced block by adding an appropriate language tag
(e.g., ```text, ```yaml, or ```markdown) and escape or neutralize
multiplication/asterisk characters inside prose/table cells (either prefix with
a backslash \* or wrap the expression in inline code backticks) so markdownlint
no longer flags them — apply these fixes to the noted sections (112-114,
166-168, 205-207, 238-249, 339-347, 357-359, 619-624, 663-683, 743-753).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/gpd/agents/gpd-lab-designer.md`:
- Around line 962-989: The file defines two conflicting return formats (the
legacy top-level payload like status/design_file/... and the canonical
gpd_return envelope), which can break orchestrator parsing; remove or convert
the legacy block so the agent always returns only the canonical gpd_return
structure (use gpd_return as the sole top-level key), map legacy fields (status,
design_file, summary, key_decisions, warnings, reason, needed_from,
partial_design) into appropriate places inside gpd_return (e.g., summary →
gpd_return.summary, design_file → gpd_return.artifacts or
gpd_return.design_file, status → gpd_return.status, and blocked/failure details
into gpd_return.issues or gpd_return.next_actions), and update any examples/docs
in this file referencing LAB-DESIGN.md or the legacy schema to use the
gpd_return envelope and the <structured_returns>/gpd_return contract only.

In `@src/gpd/specs/references/protocols/experimental-data-reduction.md`:
- Around line 73-75: The dead-time labels and formulas are swapped; update the
table so "Non-extending" is paired with "non-paralyzable" and the formula n_true
= n_obs / (1 - n_obs × tau), and "Extending" is paired with "paralyzable" with a
note that a numerical (or Lambert W) solution is required (e.g., n_true =
-W(-n_obs × tau)/tau) instead of the current -ln(...) expression; change the
text for the rows containing "Non-extending (paralyzable)" and "Extending
(non-paralyzable)" to "Non-extending (non-paralyzable)" and "Extending
(paralyzable)" and update the corresponding formula cells and the "Numerical
solution required" note for the paralyzable case.

In `@src/gpd/specs/references/protocols/instrument-systematic-budget.md`:
- Line 499: The Markdown table row beginning "2. Wavelength cal: certificate
states U = ± 0.5 nm ..." is malformed due to extra pipe characters inside a cell
("| 0.00% (at peak; up to 0.5% on flank) | ∞ |") which breaks column alignment;
fix it by removing or escaping the internal pipes so the row has the same number
of columns as the header (e.g., replace the inner pipes with escaped pipes or
wrap the cell in code/backticks, or reformat the cell content to "0.00% (at
peak; up to 0.5% on flank); ∞"), and verify the row now aligns with the table
headers in the file's table row that starts with "2. Wavelength cal".
- Around line 477-499: The worked example shows conflicting values for Source 1
(Absorbance repeatability): keep only the corrected relative uncertainty (u_1 =
0.114%) throughout the document and remove or clearly mark as discarded the
earlier 0.48% draft value; specifically update the table row for "1. Absorbance
repeatability" to show 0.114% (and ν = 4), and edit the narrative lines that
recalculate u_1 (the paragraph referencing u_1/A and t-factor) so they present
the corrected computation only.

In `@src/gpd/specs/references/protocols/measurement-reproducibility.md`:
- Around line 258-263: The Markdown table in the E_n interpretation block is
broken because literal pipe characters in the expressions (e.g. |E_n| <= 1.0)
are being parsed as column delimiters; update the E_n table rows in
measurement-reproducibility.md (the rows containing the |E_n| expressions) by
escaping the pipes or enclosing the expressions in code spans/backticks so the
table columns render correctly while preserving the intended math text.

---

Nitpick comments:
In `@src/gpd/agents/gpd-lab-designer.md`:
- Around line 112-114: Several fenced code blocks and table/prose cells are
missing language tags and the asterisk (*) in lines like "Physical quantity ->
Transducer -> Signal conditioning -> Digitization -> Recorded value" (and other
ranges listed) can be misinterpreted as emphasis; update each fenced block by
adding an appropriate language tag (e.g., ```text, ```yaml, or ```markdown) and
escape or neutralize multiplication/asterisk characters inside prose/table cells
(either prefix with a backslash \* or wrap the expression in inline code
backticks) so markdownlint no longer flags them — apply these fixes to the noted
sections (112-114, 166-168, 205-207, 238-249, 339-347, 357-359, 619-624,
663-683, 743-753).

In `@src/gpd/specs/references/protocols/experimental-data-reduction.md`:
- Around line 100-102: The Markdown contains unlabeled fenced code/math blocks
(e.g., the formula block starting with "sigma(n_true) / n_true = ..." and the
other occurrences you listed) which trigger MD040; update each triple-backtick
fence to include a language identifier such as "text" or "latex" (e.g., change
``` to ```text or ```latex) for all instances referenced (lines 100-102,
130-132, 153-156, 183-185, 193-195, 251-254, 330-332, 412-416, 419-423, 430-434,
437-441, 447-450, 455-457, 460-462, 465-468, 472-474) so the math/calculation
blocks are explicitly labeled for downstream tooling.

In `@src/gpd/specs/references/protocols/measurement-reproducibility.md`:
- Around line 66-68: The markdown contains unlabeled fenced code blocks
(example: the block with "chi^2 = sum((x_i - x_bar)^2 / sigma_i^2)") which
triggers MD040; update every fenced block in this spec to include an explicit
language tag (e.g., ```text, ```markdown, ```yaml or ```math where appropriate)
so the parser/linter recognizes them—ensure you modify the chi^2 block and all
other fenced sections referenced in the review to use the correct language label
for their content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 49884397-05b1-4efd-9294-cf46ce291a40

📥 Commits

Reviewing files that changed from the base of the PR and between 0f41769 and 3a6c819.

📒 Files selected for processing (9)
  • src/gpd/agents/gpd-lab-designer.md
  • src/gpd/core/config.py
  • src/gpd/registry.py
  • src/gpd/specs/references/protocols/experimental-data-reduction.md
  • src/gpd/specs/references/protocols/instrument-systematic-budget.md
  • src/gpd/specs/references/protocols/measurement-reproducibility.md
  • src/gpd/specs/references/protocols/protocol-domains.json
  • src/gpd/specs/workflows/set-profile.md
  • tests/core/test_config.py

Comment thread src/gpd/agents/gpd-lab-designer.md Outdated
Comment on lines +73 to +75
| **Non-extending (paralyzable)** | n_true = n_obs / (1 - n_obs × tau) | Detector resets after fixed time tau regardless of new events (e.g., Geiger-Mueller counter, scaler with fixed dead time) |
| **Extending (non-paralyzable)** | n_true = -ln(1 - n_obs × tau) / tau | Each new event during dead time restarts the dead period (e.g., pulse-shaping amplifier, retriggerable electronics) |
| **Generalized** | Numerical solution required | Real detectors are often intermediate between the two extremes |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Dead-time model names and formulas are mismatched.

The table currently pairs the non-extending/non-paralyzable model with the wrong label/formula narrative. This can cause users (or agents) to apply the wrong correction at high rates and bias results materially.

Please correct model naming and equations so non-paralyzable vs paralyzable behavior is unambiguous.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gpd/specs/references/protocols/experimental-data-reduction.md` around
lines 73 - 75, The dead-time labels and formulas are swapped; update the table
so "Non-extending" is paired with "non-paralyzable" and the formula n_true =
n_obs / (1 - n_obs × tau), and "Extending" is paired with "paralyzable" with a
note that a numerical (or Lambert W) solution is required (e.g., n_true =
-W(-n_obs × tau)/tau) instead of the current -ln(...) expression; change the
text for the rows containing "Non-extending (paralyzable)" and "Extending
(non-paralyzable)" to "Non-extending (non-paralyzable)" and "Extending
(paralyzable)" and update the corresponding formula cells and the "Numerical
solution required" note for the paralyzable case.

Comment on lines +477 to +499
| Source | Affects | Type | Distribution | u_i (relative) |
|--------|---------|------|-------------|-----------------|
| 1. Absorbance repeatability | A | A | Gaussian (5 readings) | 0.48% |
| 2. Wavelength calibration | A (via ε(λ) slope) | B | Gaussian (certificate) | 0.20% |
| 3. Photometric accuracy | A | B | Rectangular (manufacturer) | 0.29% |
| 4. Detector nonlinearity | A | B | Rectangular (manufacturer) | 0.17% |
| 5. Stray light | A | B | Rectangular (manufacturer) | 0.15% |
| 6. Cuvette path length | l | B | Rectangular (manufacturer) | 0.058% |
| 7. Cuvette positioning reproducibility | l | A | Gaussian (10 repositionings) | 0.10% |
| 8. Solution concentration | c | B | Gaussian (gravimetric prep) | 0.50% |
| 9. Temperature coefficient of ε | ε | B | Rectangular (± 2 K × 0.1%/K) | 0.12% |
| 10. Blank subtraction (solvent absorbance) | A | A | Gaussian (3 blank readings) | 0.08% |

**Step 2: Quantification Details**

Source 1 (Repeatability): 5 readings: A = {0.624, 0.626, 0.623, 0.627, 0.625}. Mean = 0.625, s = 0.00158, u_1 = s/√5 = 0.00071 → 0.48/0.625 = 0.11% ... wait, let me recalculate: u_1/A = 0.00071/0.625 = 0.11%. But with t-factor for ν = 4: t_0.95 = 2.776, so this matters for coverage factor later.

Actually: u_1 = 0.00071 → relative = 0.114%. I listed 0.48% above using s rather than s/√N. Let me correct the table:

| Source | u_i (relative) | ν_i |
|--------|----------------|-----|
| 1. Absorbance repeatability | s/√5 = 0.114% | 4 |
| 2. Wavelength cal: certificate states U = ± 0.5 nm (k = 2), so u_λ = 0.25 nm. Near λ_max, dA/dλ ≈ 0. But measured at 520 nm, slope of spectrum gives dε/dλ ≈ −100 L/(mol·cm·nm) at the flank. If measuring exactly at peak, sensitivity is near zero. Assume we are at peak: c_2 × u_λ = 0.25 nm × |dε/dλ|/ε. At peak dε/dλ ≈ 0, so | 0.00% (at peak; up to 0.5% on flank) | ∞ |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Worked example contains contradictory uncertainty values before and after recalculation.

Line 479 lists Source 1 as 0.48%, then Line 494 corrects it to 0.114%. Keeping both versions in the canonical example makes extraction ambiguous for agents.

Keep only the corrected values in the final narrative/table, or clearly mark the earlier numbers as discarded draft values.

🧰 Tools
🪛 LanguageTool

[style] ~492-~492: To elevate your writing, try using an alternative expression here.
Context: ...ctor for ν = 4: t_0.95 = 2.776, so this matters for coverage factor later. Actually: u...

(MATTERS_RELEVANT)

🪛 markdownlint-cli2 (0.22.1)

[warning] 499-499: Table column count
Expected: 3; Actual: 5; Too many cells, extra data will be missing

(MD056, table-column-count)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gpd/specs/references/protocols/instrument-systematic-budget.md` around
lines 477 - 499, The worked example shows conflicting values for Source 1
(Absorbance repeatability): keep only the corrected relative uncertainty (u_1 =
0.114%) throughout the document and remove or clearly mark as discarded the
earlier 0.48% draft value; specifically update the table row for "1. Absorbance
repeatability" to show 0.114% (and ν = 4), and edit the narrative lines that
recalculate u_1 (the paragraph referencing u_1/A and t-factor) so they present
the corrected computation only.

| Source | u_i (relative) | ν_i |
|--------|----------------|-----|
| 1. Absorbance repeatability | s/√5 = 0.114% | 4 |
| 2. Wavelength cal: certificate states U = ± 0.5 nm (k = 2), so u_λ = 0.25 nm. Near λ_max, dA/dλ ≈ 0. But measured at 520 nm, slope of spectrum gives dε/dλ ≈ −100 L/(mol·cm·nm) at the flank. If measuring exactly at peak, sensitivity is near zero. Assume we are at peak: c_2 × u_λ = 0.25 nm × |dε/dλ|/ε. At peak dε/dλ ≈ 0, so | 0.00% (at peak; up to 0.5% on flank) | ∞ |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Malformed table row will render incorrectly (MD056).

Line 499 contains extra pipe delimiters in one cell, breaking column alignment and dropping content in some renderers.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 499-499: Table column count
Expected: 3; Actual: 5; Too many cells, extra data will be missing

(MD056, table-column-count)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gpd/specs/references/protocols/instrument-systematic-budget.md` at line
499, The Markdown table row beginning "2. Wavelength cal: certificate states U =
± 0.5 nm ..." is malformed due to extra pipe characters inside a cell ("| 0.00%
(at peak; up to 0.5% on flank) | ∞ |") which breaks column alignment; fix it by
removing or escaping the internal pipes so the row has the same number of
columns as the header (e.g., replace the inner pipes with escaped pipes or wrap
the cell in code/backticks, or reformat the cell content to "0.00% (at peak; up
to 0.5% on flank); ∞"), and verify the row now aligns with the table headers in
the file's table row that starts with "2. Wavelength cal".

Comment on lines +258 to +263
| E_n | Interpretation |
|-----|---------------|
| |E_n| <= 1.0 | Satisfactory — results agree within combined uncertainty |
| 1.0 < |E_n| <= 2.0 | Questionable — investigate possible systematics |
| |E_n| > 2.0 | Unsatisfactory — significant discrepancy requiring resolution |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Eₙ interpretation table is broken by unescaped | characters.

Rows like | |E_n| <= 1.0 | ... | create extra columns and render incorrectly. Escape pipes or wrap expressions in code spans.

Suggested fix
-| |E_n| <= 1.0 | Satisfactory — results agree within combined uncertainty |
-| 1.0 < |E_n| <= 2.0 | Questionable — investigate possible systematics |
-| |E_n| > 2.0 | Unsatisfactory — significant discrepancy requiring resolution |
+| \|E_n\| <= 1.0 | Satisfactory — results agree within combined uncertainty |
+| 1.0 < \|E_n\| <= 2.0 | Questionable — investigate possible systematics |
+| \|E_n\| > 2.0 | Unsatisfactory — significant discrepancy requiring resolution |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 260-260: Table column count
Expected: 2; Actual: 4; Too many cells, extra data will be missing

(MD056, table-column-count)


[warning] 261-261: Table column count
Expected: 2; Actual: 4; Too many cells, extra data will be missing

(MD056, table-column-count)


[warning] 262-262: Table column count
Expected: 2; Actual: 4; Too many cells, extra data will be missing

(MD056, table-column-count)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gpd/specs/references/protocols/measurement-reproducibility.md` around
lines 258 - 263, The Markdown table in the E_n interpretation block is broken
because literal pipe characters in the expressions (e.g. |E_n| <= 1.0) are being
parsed as column delimiters; update the E_n table rows in
measurement-reproducibility.md (the rows containing the |E_n| expressions) by
escaping the pipes or enclosing the expressions in code spans/backticks so the
table columns render correctly while preserving the intended math text.

@marcpickett1

Copy link
Copy Markdown
Collaborator

🤖 RoastBot: "Experimental physics." In a tool with no laboratory. Bold.

… tests

- Rewrite gpd-lab-designer.md: 64K chars → 18K chars to fit within
  PHASE5_MAX_AGENT_EXPANDED_CHARS (36,500) budget
- Add gpd-lab-designer to AGENT_BASELINES in test_agent_prompt_budget.py
- Update PHASE5_MAX_TOTAL_AGENT_EXPANDED_CHARS: 363K → 381K for new agent
- Add gpd-lab-designer to LIGHTWEIGHT_SHARED_PROTOCOL_AGENTS
- Run sync_repo_graph_contract.py to update repo_graph_contract.json
  and tests/README.md scope counts (agents: 24→25, references: 241→244)
- Add role_kits to agent frontmatter matching experiment-designer

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/core/test_agent_prompt_budget.py (1)

85-89: ⚡ Quick win

Extend boundary-contract assertions to include the new lab designer agent.

Since gpd-lab-designer is now in the lightweight shared-protocol cohort, consider adding it to the concise boundary-reference contract test (test_agents_reference_infrastructure_for_shared_boundary_protocols_without_copying_them) to keep this new prompt under the same anti-copy guardrails.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/core/test_agent_prompt_budget.py` around lines 85 - 89, The concise
boundary-reference contract test needs to include the new agent id
"gpd-lab-designer": update the assertion in
test_agents_reference_infrastructure_for_shared_boundary_protocols_without_copying_them
to add "gpd-lab-designer" to the expected/shared-protocol agents list (where
other ids like "gpd-literature-reviewer" and "gpd-planner" are asserted) so the
test enforces the anti-copy guardrails for the new lightweight shared-protocol
cohort.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/core/test_agent_prompt_budget.py`:
- Around line 85-89: The concise boundary-reference contract test needs to
include the new agent id "gpd-lab-designer": update the assertion in
test_agents_reference_infrastructure_for_shared_boundary_protocols_without_copying_them
to add "gpd-lab-designer" to the expected/shared-protocol agents list (where
other ids like "gpd-literature-reviewer" and "gpd-planner" are asserted) so the
test enforces the anti-copy guardrails for the new lightweight shared-protocol
cohort.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a64d8b8c-0564-4a54-9f20-5ed2dd724836

📥 Commits

Reviewing files that changed from the base of the PR and between 3a6c819 and fd8d406.

📒 Files selected for processing (4)
  • src/gpd/agents/gpd-lab-designer.md
  • tests/README.md
  • tests/core/test_agent_prompt_budget.py
  • tests/repo_graph_contract.json
✅ Files skipped from review due to trivial changes (1)
  • tests/repo_graph_contract.json


- Classify each source as Type A (evaluated by statistical analysis of observations) or Type B (evaluated by other means: certificates, manufacturer specs, theoretical arguments).
- Assess correlations between sources; build correlation matrix if non-diagonal.
- Combine using GUM framework: u_c^2 = sum_i (c_i * u_i)^2 + 2 * sum_{i<j} c_i * c_j * u_i * u_j * r_ij.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix markdownlint violations in the updated prompt text.

Line 157 uses * in plain math text and Line 208 opens an unlabeled fenced block; both are currently flagged by markdownlint (MD037/MD040).

Proposed doc-only patch
-- Combine using GUM framework: u_c^2 = sum_i (c_i * u_i)^2 + 2 * sum_{i<j} c_i * c_j * u_i * u_j * r_ij.
+- Combine using GUM framework: `u_c^2 = sum_i (c_i * u_i)^2 + 2 * sum_{i<j} c_i * c_j * u_i * u_j * r_ij`.
-```
+```md
 > **For gpd-executor:** This file contains measurement specifications, calibration plans, and systematic budgets. Use these when executing laboratory tasks in this phase.
</details>


Also applies to: 208-210

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 157-157: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

---

[warning] 157-157: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

---

[warning] 157-157: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

---

[warning] 157-157: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

---

[warning] 157-157: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

---

[warning] 157-157: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

</details>

</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants