extract_legacy_invariants
Called before rewriting a legacy Python file so the agent sees every slab inequality, rounding convention (ROUND_HALF_UP vs float), required ValueError contract, and volatile field.
{
"status": "OK",
"model": "gemini-2.5-flash",
"invariants": [
{
"id": "INV-01",
"category": "INPUT_VALIDATION",
"rule_description": "Reject qty <= 0 or None with ValueError"
},
{
"id": "INV-04",
"category": "BOUNDARY_SLAB",
"rule_description": "12% GST for subtotal <= 1000.00; 18% strictly above"
}
],
"volatile_fields": ["invoice_uuid", "generated_at"],
"adversarial_case_count": 42
}