{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://pi.local/schema/swarm_replay_preview.json", "title": "Pi swarm replay preview", "type": "object", "additionalProperties": false, "required": [ "schema", "generated_at_utc", "command", "trace", "replay", "policies", "recommendation", "output_paths", "guards" ], "properties": { "schema": { "const": "pi.swarm.replay_preview.v1" }, "generated_at_utc": { "type": "string", "format": "date-time" }, "command": { "type": "object", "additionalProperties": false, "required": [ "invocation", "cwd", "read_only_replay", "provider_calls", "live_mutations", "output_writes" ], "properties": { "invocation": { "const": "pi swarm-replay-preview" }, "cwd": { "type": "string", "minLength": 1 }, "read_only_replay": { "const": true }, "provider_calls": { "const": 0 }, "live_mutations": { "const": 0 }, "output_writes": { "type": "integer", "minimum": 0, "maximum": 2 } } }, "trace": { "type": "object", "additionalProperties": false, "required": [ "path", "schema", "trace_id", "generated_at", "source_count", "event_count", "first_event_id", "last_event_id", "redaction_status", "uncertainty_state" ], "properties": { "path": { "type": "string", "minLength": 1 }, "schema": { "const": "pi.swarm.replay_trace.v1" }, "trace_id": { "type": "string", "minLength": 1 }, "generated_at": { "type": "string" }, "source_count": { "type": "integer", "minimum": 0 }, "event_count": { "type": "integer", "minimum": 0 }, "first_event_id": { "type": [ "string", "null" ] }, "last_event_id": { "type": [ "string", "null" ] }, "redaction_status": { "type": "string", "minLength": 1 }, "uncertainty_state": { "type": "string", "minLength": 1 } } }, "replay": { "type": "object", "additionalProperties": false, "required": [ "schema", "replayed_event_count", "final_logical_clock", "snapshot_count", "diagnostic_count", "diagnostics", "final_state", "resource_saturation_points", "first_saturation_reasons" ], "properties": { "schema": { "const": "pi.swarm.replay_report.v1" }, "replayed_event_count": { "type": "integer", "minimum": 0 }, "final_logical_clock": { "type": "integer", "minimum": 0 }, "snapshot_count": { "type": "integer", "minimum": 0 }, "diagnostic_count": { "type": "integer", "minimum": 0 }, "diagnostics": { "type": "array", "items": { "$ref": "#/$defs/diagnostic" } }, "final_state": { "$ref": "#/$defs/final_state" }, "resource_saturation_points": { "type": "integer", "minimum": 0 }, "first_saturation_reasons": { "type": "array", "items": { "type": "string" } } } }, "policies": { "type": "object", "additionalProperties": false, "required": [ "schema", "requested_policy_ids", "evaluated_policy_ids", "decision_count", "comparison_count", "distinct_action_count", "score_spread", "comparisons" ], "properties": { "schema": { "const": "pi.swarm.policy_report.v1" }, "requested_policy_ids": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/policy_id" } }, "evaluated_policy_ids": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/policy_id" } }, "decision_count": { "type": "integer", "minimum": 0 }, "comparison_count": { "type": "integer", "minimum": 1 }, "distinct_action_count": { "type": "integer", "minimum": 0 }, "score_spread": { "type": [ "integer", "null" ], "minimum": 0 }, "comparisons": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/policy_summary" } } } }, "recommendation": { "anyOf": [ { "$ref": "#/$defs/policy_summary" }, { "type": "null" } ] }, "output_paths": { "type": "object", "additionalProperties": false, "required": [ "json", "text" ], "properties": { "json": { "type": [ "string", "null" ] }, "text": { "type": [ "string", "null" ] } } }, "guards": { "type": "object", "additionalProperties": false, "required": [ "read_only_replay", "no_live_mutation", "no_network_required", "output_artifacts_only", "runpack_not_source_of_truth" ], "properties": { "read_only_replay": { "const": true }, "no_live_mutation": { "const": true }, "no_network_required": { "const": true }, "output_artifacts_only": { "const": true }, "runpack_not_source_of_truth": { "const": true } } } }, "$defs": { "policy_id": { "type": "string", "enum": [ "conservative_manual", "existing_autopilot", "rch_fanout_limited", "stale_bead_reclaiming", "build_slot_protective" ] }, "policy_summary": { "type": "object", "additionalProperties": false, "required": [ "policy_id", "rank", "score", "confidence", "confidence_score", "throughput_actions", "validation_commands_deferred", "local_fallback_risk", "reservation_conflicts_avoided", "stale_work_reclaimed", "missing_data_claims", "rationale" ], "properties": { "policy_id": { "$ref": "#/$defs/policy_id" }, "rank": { "type": "integer", "minimum": 1 }, "score": { "type": "integer" }, "confidence": { "type": "string", "enum": [ "high", "medium", "low" ] }, "confidence_score": { "type": "integer", "minimum": 0, "maximum": 100 }, "throughput_actions": { "type": "integer", "minimum": 0 }, "validation_commands_deferred": { "type": "integer", "minimum": 0 }, "local_fallback_risk": { "type": "string", "minLength": 1 }, "reservation_conflicts_avoided": { "type": "integer", "minimum": 0 }, "stale_work_reclaimed": { "type": "integer", "minimum": 0 }, "missing_data_claims": { "type": "array", "items": { "type": "string", "minLength": 1 } }, "rationale": { "type": "array", "items": { "type": "string", "minLength": 1 } } } }, "diagnostic": { "type": "object", "additionalProperties": false, "required": [ "code", "severity", "event_id", "message" ], "properties": { "code": { "type": "string", "minLength": 1 }, "severity": { "type": "string", "minLength": 1 }, "event_id": { "type": [ "string", "null" ] }, "message": { "type": "string", "minLength": 1 } } }, "final_state": { "type": "object", "additionalProperties": false, "required": [ "bead_count", "agent_count", "active_reservation_count", "active_build_slot_count", "rch_job_count", "validation_gate_count", "runpack_recommendation_count", "operator_handoff_count", "reservation_conflict_count", "agent_mail_available", "missing_agent_mail_evidence", "dirty_worktree" ], "properties": { "bead_count": { "type": "integer", "minimum": 0 }, "agent_count": { "type": "integer", "minimum": 0 }, "active_reservation_count": { "type": "integer", "minimum": 0 }, "active_build_slot_count": { "type": "integer", "minimum": 0 }, "rch_job_count": { "type": "integer", "minimum": 0 }, "validation_gate_count": { "type": "integer", "minimum": 0 }, "runpack_recommendation_count": { "type": "integer", "minimum": 0 }, "operator_handoff_count": { "type": "integer", "minimum": 0 }, "reservation_conflict_count": { "type": "integer", "minimum": 0 }, "agent_mail_available": { "type": "boolean" }, "missing_agent_mail_evidence": { "type": "boolean" }, "dirty_worktree": { "type": [ "boolean", "null" ] } } } } }