Skip to content

cosmotron_mcp.reviewer_tools

build_review_evidence

build_review_evidence(session_dir: str, required_plots: list[str] | None = None) -> str

Pre-compute all deterministic artefact checks for the Reviewer.

Returns a text EVIDENCE block containing
  • Per-artefact inspection (cls bandpower count, ell range, Cl sign/finiteness, map nside, SACC data-vector length and covariance shape)
  • Knox covariance cross-check verdict per bin
  • Deterministic output-validation gate (validate_outputs)
  • Plots present in plots/ vs required_plots

The Reviewer calls this FIRST, then emits REVIEW: PASS/FAIL based solely on the numbers in this block — it never calls tools itself.

Parameters:

Name Type Description Default
session_dir str

Session directory to build evidence for.

required
required_plots list[str] | None

Plot names expected to exist; defaults to the session's required_plots from session_context.json.

None

Returns:

Type Description
str

The formatted EVIDENCE text block.

Source code in cosmotron_mcp/server.py
@mcp.tool()
@sync_budget_guard
def build_review_evidence(
    session_dir: str,
    required_plots: list[str] | None = None,
) -> str:
    """Pre-compute all deterministic artefact checks for the Reviewer.

    Returns a text EVIDENCE block containing:
      - Per-artefact inspection (cls bandpower count, ell range, Cl sign/finiteness,
        map nside, SACC data-vector length and covariance shape)
      - Knox covariance cross-check verdict per bin
      - Deterministic output-validation gate (validate_outputs)
      - Plots present in plots/ vs required_plots

    The Reviewer calls this FIRST, then emits REVIEW: PASS/FAIL based solely
    on the numbers in this block — it never calls tools itself.

    Args:
        session_dir: Session directory to build evidence for.
        required_plots: Plot names expected to exist; defaults to the
            session's `required_plots` from `session_context.json`.

    Returns:
        The formatted EVIDENCE text block.
    """
    return _build_review_evidence(session_dir, required_plots=required_plots)

list_session_plots

list_session_plots(session_dir: str) -> list[dict]

List a session's result plots + what each SHOULD show.

For each plots/*.png: {name, path, kind, expectation}. Used by the advisory @plot_reviewer (vision) agent — it reads each PNG and checks it against expectation. Deterministic: only enumerates + tags by filename; the visual judgement lives in the agent. NOT a PASS/FAIL gate.

NOTE — sanctioned exception to the repo-relative-paths convention: path is ABSOLUTE, because the consumer loads the PNG directly (an image-read call needs a real filesystem path, not one relative to an unknown cwd). Do not persist this path into plan.json or a dispatch message — pass it straight to the image-reading step and discard it.

Parameters:

Name Type Description Default
session_dir str

Session directory to list plots for.

required

Returns:

Type Description
list[dict]

A list of {name, path, kind, expectation}, one per plots/*.png.

Source code in cosmotron_mcp/server.py
@mcp.tool()
@sync_budget_guard
def list_session_plots(session_dir: str) -> list[dict]:
    """List a session's result plots + what each SHOULD show.

    For each `plots/*.png`: `{name, path, kind, expectation}`. Used by the
    advisory `@plot_reviewer` (vision) agent — it reads each PNG and checks it
    against `expectation`. Deterministic: only enumerates + tags by filename; the
    visual judgement lives in the agent. NOT a PASS/FAIL gate.

    NOTE — sanctioned exception to the repo-relative-paths convention: `path`
    is ABSOLUTE, because the consumer loads the PNG directly (an image-read
    call needs a real filesystem path, not one relative to an unknown cwd).
    Do not persist this path into `plan.json` or a dispatch message — pass it
    straight to the image-reading step and discard it.

    Args:
        session_dir: Session directory to list plots for.

    Returns:
        A list of ``{name, path, kind, expectation}``, one per `plots/*.png`.
    """
    return _list_session_plots(session_dir)