[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=worktree_permission
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "patch artifact ref",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "artifact_ref",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": false
    },
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "boolean",
      "default_value": false,
      "description": "dry run flag",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "dry_run",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 4000,
    "token_cost_estimate": 64,
    "tool_call_cost_estimate": 1
  },
  "capability": "patch",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": false,
    "emits_evidence_ids": false,
    "emits_patch_ref": true,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": true,
    "plan_mode_allowed": true,
    "required_permissions": [
      "write",
      "worktree"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": true,
    "supports_resume": true
  },
  "description": "Mutating patch tool under worktree / snapshot / validator discipline.",
  "invocation_mode": "mutating",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator",
      "sandbox_rollback_bridge"
    ]
  },
  "outputs": [
    {
      "description": "workspace diff",
      "evidence_backwrite": false,
      "kind": "patch",
      "name": "workspace_diff",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": false
    },
    {
      "description": "patch receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "receipt",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "rolled_back",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "write",
      "worktree",
      "patch",
      "session"
    ],
    "blocks_on_conflict": true,
    "requires_clean_worktree": true,
    "requires_confirmation": true,
    "requires_evidence_before_trigger": true,
    "risk_band": "high",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "partial",
    "supports_rollback": true
  },
  "summary": "Apply a validated patch bundle to the workspace.",
  "tool_name": "apply_patch_bundle"
}
[/TOOL_SPEC]

[USER_QUERY]
Explain how apply_patch_bundle must obey worktree and permission boundaries.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=trigger
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "patch artifact ref",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "artifact_ref",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": false
    },
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "boolean",
      "default_value": false,
      "description": "dry run flag",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "dry_run",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 4000,
    "token_cost_estimate": 64,
    "tool_call_cost_estimate": 1
  },
  "capability": "patch",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": false,
    "emits_evidence_ids": false,
    "emits_patch_ref": true,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": true,
    "plan_mode_allowed": true,
    "required_permissions": [
      "write",
      "worktree"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": true,
    "supports_resume": true
  },
  "description": "Mutating patch tool under worktree / snapshot / validator discipline.",
  "invocation_mode": "mutating",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator",
      "sandbox_rollback_bridge"
    ]
  },
  "outputs": [
    {
      "description": "workspace diff",
      "evidence_backwrite": false,
      "kind": "patch",
      "name": "workspace_diff",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": false
    },
    {
      "description": "patch receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "receipt",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "rolled_back",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "write",
      "worktree",
      "patch",
      "session"
    ],
    "blocks_on_conflict": true,
    "requires_clean_worktree": true,
    "requires_confirmation": true,
    "requires_evidence_before_trigger": true,
    "risk_band": "high",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "partial",
    "supports_rollback": true
  },
  "summary": "Apply a validated patch bundle to the workspace.",
  "tool_name": "apply_patch_bundle"
}
[/TOOL_SPEC]

[USER_QUERY]
Choose between apply_patch_bundle and run_ci_validation; trigger apply_patch_bundle only if its capability, not the competing tool, matches the bounded task.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=arguments
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "patch artifact ref",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "artifact_ref",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": false
    },
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "boolean",
      "default_value": false,
      "description": "dry run flag",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "dry_run",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 4000,
    "token_cost_estimate": 64,
    "tool_call_cost_estimate": 1
  },
  "capability": "patch",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": false,
    "emits_evidence_ids": false,
    "emits_patch_ref": true,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": true,
    "plan_mode_allowed": true,
    "required_permissions": [
      "write",
      "worktree"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": true,
    "supports_resume": true
  },
  "description": "Mutating patch tool under worktree / snapshot / validator discipline.",
  "invocation_mode": "mutating",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator",
      "sandbox_rollback_bridge"
    ]
  },
  "outputs": [
    {
      "description": "workspace diff",
      "evidence_backwrite": false,
      "kind": "patch",
      "name": "workspace_diff",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": false
    },
    {
      "description": "patch receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "receipt",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "rolled_back",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "write",
      "worktree",
      "patch",
      "session"
    ],
    "blocks_on_conflict": true,
    "requires_clean_worktree": true,
    "requires_confirmation": true,
    "requires_evidence_before_trigger": true,
    "risk_band": "high",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "partial",
    "supports_rollback": true
  },
  "summary": "Apply a validated patch bundle to the workspace.",
  "tool_name": "apply_patch_bundle"
}
[/TOOL_SPEC]

[USER_QUERY]
Shape the exact bounded payload for apply_patch_bundle so the runtime validator accepts it on the first pass.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=precondition_gating
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "patch artifact ref",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "artifact_ref",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": false
    },
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "boolean",
      "default_value": false,
      "description": "dry run flag",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "dry_run",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 4000,
    "token_cost_estimate": 64,
    "tool_call_cost_estimate": 1
  },
  "capability": "patch",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": false,
    "emits_evidence_ids": false,
    "emits_patch_ref": true,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": true,
    "plan_mode_allowed": true,
    "required_permissions": [
      "write",
      "worktree"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": true,
    "supports_resume": true
  },
  "description": "Mutating patch tool under worktree / snapshot / validator discipline.",
  "invocation_mode": "mutating",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator",
      "sandbox_rollback_bridge"
    ]
  },
  "outputs": [
    {
      "description": "workspace diff",
      "evidence_backwrite": false,
      "kind": "patch",
      "name": "workspace_diff",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": false
    },
    {
      "description": "patch receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "receipt",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "rolled_back",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "write",
      "worktree",
      "patch",
      "session"
    ],
    "blocks_on_conflict": true,
    "requires_clean_worktree": true,
    "requires_confirmation": true,
    "requires_evidence_before_trigger": true,
    "risk_band": "high",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "partial",
    "supports_rollback": true
  },
  "summary": "Apply a validated patch bundle to the workspace.",
  "tool_name": "apply_patch_bundle"
}
[/TOOL_SPEC]

[USER_QUERY]
A caller wants apply_patch_bundle immediately, yet the validator envelope shows missing prerequisites; choose the bounded next step.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=receipt_validation
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "patch artifact ref",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "artifact_ref",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": false
    },
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "boolean",
      "default_value": false,
      "description": "dry run flag",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "dry_run",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 4000,
    "token_cost_estimate": 64,
    "tool_call_cost_estimate": 1
  },
  "capability": "patch",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": false,
    "emits_evidence_ids": false,
    "emits_patch_ref": true,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": true,
    "plan_mode_allowed": true,
    "required_permissions": [
      "write",
      "worktree"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": true,
    "supports_resume": true
  },
  "description": "Mutating patch tool under worktree / snapshot / validator discipline.",
  "invocation_mode": "mutating",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator",
      "sandbox_rollback_bridge"
    ]
  },
  "outputs": [
    {
      "description": "workspace diff",
      "evidence_backwrite": false,
      "kind": "patch",
      "name": "workspace_diff",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": false
    },
    {
      "description": "patch receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "receipt",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "rolled_back",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "write",
      "worktree",
      "patch",
      "session"
    ],
    "blocks_on_conflict": true,
    "requires_clean_worktree": true,
    "requires_confirmation": true,
    "requires_evidence_before_trigger": true,
    "risk_band": "high",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "partial",
    "supports_rollback": true
  },
  "summary": "Apply a validated patch bundle to the workspace.",
  "tool_name": "apply_patch_bundle"
}
[/TOOL_SPEC]

[USER_QUERY]
Emit the receipt fields that prove apply_patch_bundle, not run_ci_validation, actually ran under the bounded validator policy.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=harness_envelope
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "patch artifact ref",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "artifact_ref",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": false
    },
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "boolean",
      "default_value": false,
      "description": "dry run flag",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "dry_run",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 4000,
    "token_cost_estimate": 64,
    "tool_call_cost_estimate": 1
  },
  "capability": "patch",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": false,
    "emits_evidence_ids": false,
    "emits_patch_ref": true,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": true,
    "plan_mode_allowed": true,
    "required_permissions": [
      "write",
      "worktree"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": true,
    "supports_resume": true
  },
  "description": "Mutating patch tool under worktree / snapshot / validator discipline.",
  "invocation_mode": "mutating",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator",
      "sandbox_rollback_bridge"
    ]
  },
  "outputs": [
    {
      "description": "workspace diff",
      "evidence_backwrite": false,
      "kind": "patch",
      "name": "workspace_diff",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": false
    },
    {
      "description": "patch receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "receipt",
      "patch_relevant": true,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "rolled_back",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "write",
      "worktree",
      "patch",
      "session"
    ],
    "blocks_on_conflict": true,
    "requires_clean_worktree": true,
    "requires_confirmation": true,
    "requires_evidence_before_trigger": true,
    "risk_band": "high",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "partial",
    "supports_rollback": true
  },
  "summary": "Apply a validated patch bundle to the workspace.",
  "tool_name": "apply_patch_bundle"
}
[/TOOL_SPEC]

[USER_QUERY]
Treat apply_patch_bundle as one step inside the full VeriLoop harness; describe the obedient bounded behavior rather than general coding ability.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=precondition_gating
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
The user asks to run run_ci_validation but permissions, evidence, or worktree preconditions are incomplete.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=worktree_permission
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Explain how run_ci_validation must obey worktree and permission boundaries.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=trigger
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Given the bounded runtime contract, decide whether run_ci_validation is the legal next action instead of narration.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=arguments
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Produce a contract-compliant argument object for run_ci_validation with typed fields only.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=precondition_gating
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
A caller wants run_ci_validation immediately, yet the validator envelope shows missing prerequisites; choose the bounded next step.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=receipt_validation
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Return the expected receipt and validator-facing structure for run_ci_validation.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=harness_envelope
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
In a long-running harness loop, decide how run_ci_validation behaves under planner, validator, and runtime constraints.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=runtime_session
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
State the runtime references that must remain continuous before and after run_ci_validation.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=worktree_permission
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Constrain run_ci_validation so it respects workspace hygiene, permission gating, and bounded mutation policy.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=trigger
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
The agent is tempted to answer directly; determine if run_ci_validation must be triggered under the typed envelope.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=arguments
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Shape the exact bounded payload for run_ci_validation so the runtime validator accepts it on the first pass.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=precondition_gating
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Do not let run_ci_validation or apply_patch_bundle fire when the required preconditions are still missing; defer or repair instead.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=receipt_validation
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
After run_ci_validation finishes, format the execution and validation receipts so the harness can audit them deterministically.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=harness_envelope
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "string",
      "default_value": "pytest -q",
      "description": "test selector",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "test_selector",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 8000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Read-only validation tool under workspace / session discipline.",
  "invocation_mode": "executing",
  "metadata": {
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "execution receipt",
      "evidence_backwrite": false,
      "kind": "execution_receipt",
      "name": "execution_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "validate",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "worktree",
      "validate",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded CI/test validation and emit validator-compatible receipts.",
  "tool_name": "run_ci_validation"
}
[/TOOL_SPEC]

[USER_QUERY]
Treat run_ci_validation as one step inside the full VeriLoop harness; describe the obedient bounded behavior rather than general coding ability.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=self_check_loop
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "array",
      "default_value": [],
      "description": "paths to validate",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "entry_paths",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 6000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Self-check loop tool for code-after-generation verification and bounded repair routing.",
  "invocation_mode": "executing",
  "metadata": {
    "self_check_loop": true,
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "bounded failure explanation",
      "evidence_backwrite": false,
      "kind": "text",
      "name": "failure_report",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "validate",
      "worktree",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded self-check, diagnose the failed constraint, and prepare the next repair step.",
  "tool_name": "self_check_repair_loop"
}
[/TOOL_SPEC]

[USER_QUERY]
The model already wrote code; the harness now needs one bounded self-check-and-repair cycle before final submit.
[/USER_QUERY]


[HARNESS_ENVELOPE]
role=generator
runtime_protocol=true
typed_tool_contracts=true
validator_alignment=true
session_continuity=true
permission_alignment=true
worktree_discipline=true
repair_after_self_check=true
reverse_engineering_ready=true
rule=Do not emit free-form tool fantasies. Follow the typed tool contract exactly.
rule=If preconditions are not satisfied, defer, repair, or ask for the next bounded step.
rule=Validator receipts and runtime permissions outrank narration.
rule=If code is produced, the harness may still call a bounded self-check loop before final submit.
rule=When repository intent is unclear, reverse-engineering and repository inspection are valid bounded actions.
contract_focus=trigger
[/HARNESS_ENVELOPE]

[TOOL_SPEC]
{
  "arguments": [
    {
      "arg_type": "string",
      "default_value": null,
      "description": "workspace root",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "workspace_root",
      "nullable": false,
      "path_like": true,
      "repeated": false,
      "required": true,
      "sensitive": false,
      "workspace_scoped": true
    },
    {
      "arg_type": "array",
      "default_value": [],
      "description": "paths to validate",
      "enum_values": [],
      "examples": [],
      "location": "body",
      "name": "entry_paths",
      "nullable": false,
      "path_like": false,
      "repeated": false,
      "required": false,
      "sensitive": false,
      "workspace_scoped": false
    }
  ],
  "budget_hint": {
    "network_cost_estimate": 0,
    "sandbox_cost_estimate": 1,
    "step_cost_estimate": 1,
    "time_cost_estimate_ms": 6000,
    "token_cost_estimate": 96,
    "tool_call_cost_estimate": 1
  },
  "capability": "validator",
  "constraints": {
    "allowed_isolation_modes": [],
    "allowed_path_prefixes": [],
    "approval_modes": [],
    "auto_mode_allowed": true,
    "emits_evidence_ids": false,
    "emits_patch_ref": false,
    "emits_receipt": true,
    "emits_validation_receipt": true,
    "forbidden_path_prefixes": [],
    "mutates_workspace": false,
    "plan_mode_allowed": true,
    "required_permissions": [
      "execute",
      "validate"
    ],
    "required_task_statuses": [],
    "requires_worktree": true,
    "supports_compact_boundary": false,
    "supports_resume": true
  },
  "description": "Self-check loop tool for code-after-generation verification and bounded repair routing.",
  "invocation_mode": "executing",
  "metadata": {
    "self_check_loop": true,
    "validator_names": [
      "sandbox_result_validator"
    ]
  },
  "outputs": [
    {
      "description": "validator receipt",
      "evidence_backwrite": false,
      "kind": "validation_receipt",
      "name": "validator_receipt",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    },
    {
      "description": "bounded failure explanation",
      "evidence_backwrite": false,
      "kind": "text",
      "name": "failure_report",
      "patch_relevant": false,
      "reproducible": true,
      "required": true,
      "task_output_relevant": false,
      "validator_relevant": true
    }
  ],
  "phase": "repair",
  "receipt_policy": {
    "include_artifact_refs": true,
    "include_budget_charge": true,
    "include_evidence_ids": true,
    "include_patch_refs": true,
    "include_permission_decision": true,
    "include_raw_value": false,
    "include_task_output_refs": true,
    "include_validator_refs": true,
    "include_worktree_ref": true,
    "receipt_statuses": [
      "succeeded",
      "failed",
      "blocked"
    ]
  },
  "risk_profile": {
    "allowed_permissions": [
      "execute",
      "validate",
      "worktree",
      "session"
    ],
    "blocks_on_conflict": false,
    "requires_clean_worktree": false,
    "requires_confirmation": false,
    "requires_evidence_before_trigger": false,
    "risk_band": "medium",
    "sensitive_domains": [
      "workspace"
    ],
    "side_effect_level": "none",
    "supports_rollback": false
  },
  "summary": "Run bounded self-check, diagnose the failed constraint, and prepare the next repair step.",
  "tool_name": "self_check_repair_loop"
}
[/TOOL_SPEC]

[USER_QUERY]
Given the bounded runtime contract, decide whether self_check_repair_loop is the legal next action instead of narration.
[/USER_QUERY]