# 10. Diagnostics and Agent Protocol ## 1. Goal Aji diagnostics are an API for automated repair, not only human-readable messages. ## 2. Stable codes Every verifier/compiler error has: - stable code; - stable machine kind; - structured fields; - optional human explanation; - optional non-binding repair candidates. Example: ```json { "code": "E2104", "kind": "memory.region_generation", "function": "decode", "value": "%17", "region": "%3", "expected_generation": 5, "found_generation": 4, "reset_instruction": 84, "use_instruction": 91 } ``` ## 3. Repair candidates The compiler may emit structured suggestions: ```json { "repair_candidates": [ {"kind": "move_reset_after_use"}, {"kind": "copy_value_before_reset"} ] } ``` Suggestions never modify semantics automatically. ## 4. ajid `ajid` is the long-running machine interface. Initial methods: ```text parse typecheck verify compile run test trace inspect explain benchmark ``` ## 5. Expected repair loop ```text agent patch ↓ ajid.verify ↓ structured errors ↓ agent repair ↓ ajid.test ↓ schedule exploration ↓ benchmark ``` ## 6. Verification report The toolchain should emit an audit artifact containing: - unsafe sites; - remaining runtime checks; - eliminated bounds checks; - ownership/borrow proof summaries; - capability requirements; - effect graph; - weak atomic sites; - lock-order findings; - contract status.