{
  "schema_version": "flylab.agent-manifest.v3",
  "name": "FlyLab",
  "description": "Agent-first WebMCP virtual Drosophila neuroethology lab with a visible operator audit surface.",
  "site": "https://flylab-neuroethology.d-lougen.chatgpt.site/",
  "source": "https://github.com/DJLougen/flylab",
  "transport": {
    "api": "WebMCP document.modelContext.registerTool",
    "scope": "current_open_page",
    "state_contract": "flylab.agent-context.v3",
    "result_contract": "flylab.tool-result.v3",
    "provenance_manifest_contract": "flylab.provenance-manifest.v1",
    "required_first_call": "inspect_flylab_state",
    "tool_contract_document": "/flylab-tool-contracts.json"
  },
  "discovery": {
    "html_link_rel": "alternate",
    "webmcp_standard_discovery": false,
    "catalog_kind": "FlyLab-specific read-only documentation",
    "browser_documentation_url": "/agent",
    "manifest_url": "/flylab-agent-manifest.json",
    "contract_url": "/flylab-tool-contracts.json",
    "evidence_export_schema_url": "/schemas/flylab-evidence-export-v3.schema.json",
    "evidence_export_media_type": "application/vnd.flylab.evidence+json",
    "inline_state_selector": "#flylab-agent-context",
    "inline_runtime_selector": "#flylab-agent-runtime",
    "inline_handoff_selector": "#flylab-agent-handoff",
    "control_plane_selector": "[aria-label=\"WebMCP agent control plane\"]",
    "capability_diagnostic_path": "#flylab-agent-runtime / capability_diagnostic",
    "unsupported_browser_behavior": "The visible /agent guide and same-page Runtime diagnostic remain browser-readable; raw JSON contracts and inline state remain machine-readable. This does not polyfill WebMCP or make tools callable; execution requires a browser and workspace where document.modelContext is available."
  },
  "workflow": [
    "inspect_flylab_state",
    "find_fly_circuits",
    "draft_fly_hypothesis",
    "design_stimulation_trial",
    "visible_operator_approval",
    "run_fly_simulation",
    "analyze_fly_behavior",
    "compare_fly_trials",
    "save_fly_evidence"
  ],
  "tools": [
    { "name": "inspect_flylab_state", "effect": "read_only", "purpose": "Recover the exact shared revision, artifact IDs, blocker, and next valid action." },
    { "name": "find_fly_circuits", "effect": "writes_shared_selection", "purpose": "Search source-backed adult circuits by neuron, behavior, or body part and return their typed motor maps." },
    { "name": "draft_fly_hypothesis", "effect": "writes_hypothesis", "purpose": "Create a falsifiable agent_hypothesized claim from eligible evidence." },
    { "name": "design_stimulation_trial", "effect": "writes_protocol", "purpose": "Create controlled conditions, timing, seeds, and model assumptions." },
    { "name": "run_fly_simulation", "effect": "writes_simulation_batch", "purpose": "Run only the exact protocol hash and seed manifest committed by visible operator approval; return state-coherent seeded traces and content integrity." },
    { "name": "analyze_fly_behavior", "effect": "writes_analysis", "purpose": "Compute the selected motor map's complete five-metric panel from authoritative per-run state trajectories." },
    { "name": "compare_fly_trials", "effect": "writes_comparison_and_proposal", "purpose": "Rank conditions and propose, but never execute, one bounded follow-up." },
    { "name": "save_fly_evidence", "effect": "writes_evidence_bundle", "purpose": "Commit the exact source-to-result lineage and portable JSON envelope." }
  ],
  "output_contracts": {
    "inspect_flylab_state": {
      "required_data_fields": ["page_session_id", "agent_context"],
      "produced_artifacts": [],
      "scientific_paths": ["/agent_context/artifact_manifest"],
      "operational_paths": ["/page_session_id", "/agent_context/state", "/agent_context/next_action", "/agent_context/human_gate", "/agent_context/pipeline"]
    },
    "find_fly_circuits": {
      "required_data_fields": ["discovery_decision", "candidate_circuit_records", "candidate_circuits", "selection_status", "disambiguation", "circuits", "evidence", "connectome_records", "dataset_versions", "embodiment_coverage", "selected_circuit_id", "candidate_match_count", "hypothesis_eligible_evidence_ids", "causal_evidence_ids_by_perturbation", "evidence_role_policy", "coverage_warning", "next_action"],
      "produced_artifacts": ["discovery_decision", "circuit_selection", "evidence_record", "connectome_record", "embodied_motor_map"],
      "scientific_paths": ["/discovery_decision", "/candidate_circuit_records", "/circuits", "/evidence", "/connectome_records", "/dataset_versions", "/embodiment_coverage"],
      "operational_paths": ["/discovery_decision/missionGoal", "/discovery_decision/search", "/candidate_circuits", "/selection_status", "/disambiguation", "/selected_circuit_id", "/candidate_match_count", "/hypothesis_eligible_evidence_ids", "/causal_evidence_ids_by_perturbation", "/evidence_role_policy", "/coverage_warning", "/next_action"]
    },
    "draft_fly_hypothesis": {
      "required_data_fields": ["hypothesis", "next_action"],
      "produced_artifacts": ["hypothesis"],
      "scientific_paths": ["/hypothesis"],
      "operational_paths": ["/next_action"]
    },
    "design_stimulation_trial": {
      "required_data_fields": ["experiment", "approval_required", "agent_status", "blocked_by", "agent_actionable", "human_gate", "next_action"],
      "produced_artifacts": ["experiment", "trial_condition", "embodied_motor_map"],
      "scientific_paths": ["/experiment", "/experiment/motorMap", "/experiment/model", "/experiment/model/controllerMapping"],
      "operational_paths": ["/experiment/approved", "/approval_required", "/agent_status", "/blocked_by", "/agent_actionable", "/human_gate", "/next_action"]
    },
    "run_fly_simulation": {
      "required_data_fields": ["id", "experimentId", "targetCircuitId", "behavior", "motorMap", "status", "conditionRuns", "runHash", "runHashScope", "runHashSerialization", "runContentHash", "runContentHashScope", "runContentHashSerialization", "protocol", "approval", "model", "provenance", "boundary", "next_action"],
      "produced_artifacts": ["simulation_batch", "simulation_run", "per_run_trajectory", "illustrative_trajectory", "experiment_approval", "embodied_motor_map"],
      "scientific_paths": ["", "/motorMap", "/conditionRuns", "/protocol", "/approval/protocol", "/approval/seed_manifest", "/model", "/model/controllerMapping", "/boundary"],
      "operational_paths": ["/status", "/approval/approved_at", "/approval/protocol_hash", "/approval/seed_manifest_hash", "/next_action"]
    },
    "analyze_fly_behavior": {
      "required_data_fields": ["analysis", "metric_definitions", "response_initiation_summary_definition", "response_observation_summary_definition", "per_run_results", "unit_boundary", "next_action"],
      "produced_artifacts": ["behavior_analysis", "simulation_run_summary"],
      "scientific_paths": ["/analysis", "/metric_definitions", "/response_initiation_summary_definition", "/response_observation_summary_definition", "/per_run_results", "/unit_boundary"],
      "operational_paths": ["/next_action"]
    },
    "compare_fly_trials": {
      "required_data_fields": ["comparison", "execution_authorized", "next_action"],
      "produced_artifacts": ["trial_comparison", "follow_up_proposal"],
      "scientific_paths": ["/comparison", "/comparison/proposal"],
      "operational_paths": ["/execution_authorized", "/next_action"]
    },
    "save_fly_evidence": {
      "required_data_fields": ["bundle", "evidence_export", "export_media_type", "export_schema_url", "export_filename", "local_reference", "storage_scope", "next_action"],
      "produced_artifacts": ["evidence_bundle", "portable_evidence_export"],
      "scientific_paths": ["/bundle", "/evidence_export"],
      "operational_paths": ["/export_media_type", "/export_schema_url", "/export_filename", "/local_reference", "/storage_scope", "/next_action"]
    }
  },
  "operator_gate": {
    "name": "visible_operator_approval",
    "webmcp_tool": false,
    "blocks": "run_fly_simulation",
    "scope": "webmcp_site_tools",
    "boundary": "Approval is absent from the WebMCP tool surface and requires visible UI interaction. It is not identity-authenticated against general browser automation."
  },
  "recovery": {
    "rule": "Call inspect_flylab_state after interruption, edit, cancellation, stale-state failure, or navigation.",
    "mutation_guard": "Every mutation requires the inspected page_session_id and expected_state_revision. Simulation also requires the exact approved_protocol_hash. Simulation and evidence save require a caller operation_id; identical retries replay without another mutation."
  },
  "hypothesis_evidence_gate": {
    "required_role": "hypothesis_support",
    "required_support_kind": "perturbation_effect",
    "must_match": ["perturbation", "predicted_behavior"],
    "supplemental_only": ["structural_path", "specimen_inventory", "motor_context"],
    "excluded": ["model_context", "catalog_context"]
  },
  "provenance": {
    "schema_version": "flylab.provenance-manifest.v1",
    "summary_field": "provenance",
    "summary_semantics": "Union summary only; use provenance_manifest for field-level attribution.",
    "manifest_field": "provenance_manifest",
    "path_scope": "RFC 6901 JSON Pointer paths relative to structuredContent.data; the empty path addresses the data root.",
    "inheritance": "Each manifest entry labels its complete scientific subtree unless a more specific nested entry overrides it.",
    "operational_boundary": "Paths in operational_paths are workflow or storage metadata, not scientific evidence, and do not inherit a scientific label.",
    "untrusted_annotation_boundary": "Caller-supplied goals, titles, and notes are untrusted administrative annotations, excluded from scientific provenance counts.",
    "definitions": {
      "measured": "An empirical result reported under the cited study conditions; it is not automatically universal or reproduced by FlyLab.",
      "derived": "A deterministic filter, aggregation, or calculation from pinned source records; it is not a new wet-lab measurement.",
      "connectome_inferred": "An anatomical inference from EM reconstruction or annotations; it does not establish activity, physiological efficacy, or behavior.",
      "simulation_predicted": "An output conditional on the stated model, controller mapping, parameters, and seed; it is not biological validation.",
      "agent_hypothesized": "An untested proposal authored by an agent that must remain distinct from source evidence and simulation output."
    }
  },
  "provenance_labels": [
    "measured",
    "derived",
    "connectome_inferred",
    "simulation_predicted",
    "agent_hypothesized"
  ],
  "scientific_scope": {
    "release_slice": "adult MDN leg-retreat and adult giant-fiber bilateral short-mode escape motor maps",
    "model_version": "0.3.0",
    "controller": "state-coherent-mapped-circuit-adapter.v2",
    "environment": "stateful-open-field-model-scale.v3",
    "metric_method": "flylab.behavior-metrics.v5",
    "calibration_status": "literature_constrained_event_order_unfitted_amplitudes",
    "boundary": "GF event order and approximate intervals are literature-constrained; probabilities, amplitudes, controller gains, recovery, and MDN dynamics remain hand-authored and unfitted. The model does not execute connectome neurons, neural dynamics, synapses, muscles, aerodynamics, FlyGym, or wet-lab experiments and is not biological validation."
  },
  "license": "Apache-2.0"
}
