Files
aji/docs/spec/10-diagnostics-and-agent-protocol.md
T
dev 17a55a7fef Initial import: Aji 0.1 draft spec and Zig scaffolding
Draft specification, RFCs, reference registries and examples, plus the
reference-implementation skeleton: build.zig, diagnostic envelope with
error-code registry synced to docs, aji CLI, conformance runner with seed
tests, CI and contributor docs.
2026-10-04 11:59:13 +03:00

98 lines
1.4 KiB
Markdown

# 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.