aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / crates / aienos-explain / docs / EXPLAIN_EVIDENCE_GRAPH_V1.md
| 1 | # Evidence graph contract `aien.explain.evidence-graph` v1 |
| 2 | |
| 3 | Language-neutral input of the explanation bridge. Any producer (Rust, C, Omega) |
| 4 | writes this JSON document; `aienos-explain` turns it into a grounded explanation |
| 5 | path. Field names, codes and meanings below are the contract; the Rust structs in |
| 6 | `src/contract.rs` are one implementation of it. |
| 7 | |
| 8 | ## Document |
| 9 | |
| 10 | | field | type | meaning | |
| 11 | |---|---|---| |
| 12 | | `format` | string | always `aien.explain.evidence-graph` | |
| 13 | | `version` | u16 | `1` | |
| 14 | | `producer` | string | who wrote it, e.g. `spark-rsi/explain` | |
| 15 | | `nodes` | array of node | at most 65536 | |
| 16 | | `truncated_at` | array of string | node ids whose parents the producer did not expand because of its own limits (optional) | |
| 17 | | `scope` | object | optional `{ "branch": id, "referenced": [ids] }`: records a reasoning branch referenced directly | |
| 18 | |
| 19 | ## Node |
| 20 | |
| 21 | | field | type | meaning | |
| 22 | |---|---|---| |
| 23 | | `id` | string | unique; namespaced by source, e.g. `cortex:<32 hex>`, `branch:<64 hex>`, `rsi:hypothesis:<id>` | |
| 24 | | `kind` | u16 | artifact kind code (below) | |
| 25 | | `status` | u8 | epistemic status code (below) | |
| 26 | | `statement` | string | the claim or record, as recorded by the source | |
| 27 | | `source` | object | `{ system, artifact, reference, digest? }`; `digest` is lowercase hex | |
| 28 | | `confidence_permille` | u16 0..=1000 | only where the source has the concept (optional) | |
| 29 | | `confidence_basis` | string | where that number came from, e.g. "declared, not measured" (optional) | |
| 30 | | `recorded_at_utc` | u64 | informational only; never used for ordering or linking (optional) | |
| 31 | | `parents` | array of `{ to, relation }` | at most 1024; explicit links only | |
| 32 | | `measurements` | array of `{ name, value, unit }` | `value` is a decimal string formatted by the producer | |
| 33 | | `missing` | array of `{ expected, reason }` | links the producer knows should exist but has no artifact for | |
| 34 | | `notes` | array of string | caveats from the producer | |
| 35 | |
| 36 | ## Codes |
| 37 | |
| 38 | Status (`status`), identical to aienos Cortex `EpistemicStatus` for 1..6: |
| 39 | 0 Unclassified, 1 DirectObservation, 2 VerifiedFact, 3 Inference, 4 Hypothesis, |
| 40 | 5 Contradiction, 6 OperatorDecision. Grounding statuses: 1, 2, 6. |
| 41 | |
| 42 | Kind (`kind`): 1 CortexRecord, 2 CapabilityMetric, 3 CapabilityAnalysis, |
| 43 | 4 Diagnostic, 5 Hypothesis, 6 Prediction, 7 Falsification, 8 EvaluationReceipt, |
| 44 | 9 PromotionState, 10 OperatorDecision, 11 AgentBranch, 12 Conclusion, 13 Alternative. |
| 45 | |
| 46 | Relation (`parents[].relation`), from the node to the parent: |
| 47 | 1 SupportedBy, 2 Evaluates, 3 PartOf, 4 Contradicts, 5 AlternativeTo, 6 References. |
| 48 | Only 1, 2, 3 and 6 are support and are walked. 4 and 5 are disclosed (conflicts, |
| 49 | alternatives) and never count as support. |
| 50 | References (6) is the weak form of support: the producer uses it when a link is |
| 51 | inferred from matching content rather than a recorded id, and should also declare |
| 52 | the missing recorded link in `missing`. |
| 53 | |
| 54 | Errors (stable numeric codes): 1 BadFormat, 2 UnsupportedVersion, 3 UnknownCode, |
| 55 | 4 DuplicateNodeId, 5 TargetNotFound, 6 GraphTooLarge, 7 StepOutOfRange, |
| 56 | 8 NotInBranchScope, 9 Journal, 10 InvalidLimits. |
| 57 | |
| 58 | ## Builder guarantees |
| 59 | |
| 60 | - Bounded: `max_depth` (default 32, cap 256) and `max_nodes` (default 256, cap 4096). |
| 61 | - Breadth-first walk from the target over support edges, parents in (relation, id) |
| 62 | order; grounding nodes end the walk. |
| 63 | - Loops are cut and reported (`Cycle`); unknown parents are reported |
| 64 | (`MissingParent`), never filled in; producer `missing` entries become `MissingLink`. |
| 65 | - A Contradicts edge is disclosed when either end is on the path, whatever the status |
| 66 | of the node carrying it (`ConflictingEvidence`). Contradicting nodes are never walked. |
| 67 | - Every visited node listed in `truncated_at` is reported as `Truncated`. |
| 68 | - Linear order: every step after the steps it rests on; ties by narrative role |
| 69 | (Observed, Analysis, Hypothesis, Prediction, Falsification, Evaluation, Decision, |
| 70 | Conclusion), then by id. The target is last. |
| 71 | - Deterministic: same document and limits give the same bundle and digest. |
| 72 | - The bundle has no field for prose or analogies and grants no authority. |
| 73 | |
| 74 | ## Versioning |
| 75 | |
| 76 | Any change to a field meaning or a code is a new `version`. Adding an optional field |
| 77 | with a default is allowed within v1 only if old readers can ignore it safely. |