Protocol Spec · v0.1

Accountable Intelligence Graph

What blockchain is to Web3, AIG is to Web7. A DAG of cryptographically signed agent events.

What is AIG?

A graph whose nodes are signed events in an agent's life and whose edges are cryptographic causation. Every node is one of four types:

  • Intent — signed declaration of desired outcome by a principal
  • Delegation — signed assignment of intent to an agent (+budget, policy)
  • Inference — agent's action + ZK-ML proof of model and weights used
  • Outcome — signed attestation of result + settlement trigger

Every edge carries a DID signature. The whole graph is tamper-evident and traversable from any root intent.

Why Graph, Not Chain?

A blockchain is a linear sequence of transactions sharing global state. An agent's work is branching, parallel, recursive: one intent spawns many delegations; each spawns sub-agents; each produces inference artifacts; all converge on an outcome.

Forcing this into a chain loses the structure. A DAG preserves it:

  • Parallel agents = parallel vertices
  • Sub-delegation = forward edges
  • Convergence = merge points
  • Replay = topological walk from root
Intent
  └── Delegation (Prime → Agent A)
        ├── Inference (Agent A)
        │     └── Outcome (Agent A → Alice)
        └── Sub-Delegation (Agent A → Agent B)
              ├── Inference (Agent B)
              └── Outcome (Agent B → Alice)

Node Types

Intent Node

{
  "type":        "intent",
  "id":          "aig:550e8400...",
  "principal":   "did:w7:alice",
  "goal": {
    "action": "file_tax_q1",
    "params": { "quarter": "2026-Q1" }
  },
  "constraints": { "deadline": "2026-04-30", "budget": "50 USD" },
  "sig":         "ed25519:...",
  "ts":          1713600000
}

Delegation Node

{
  "type":    "delegation",
  "id":      "aig:6ba7b810...",
  "parent":  "aig:550e8400...",  // → intent
  "from":    "did:w7:prime/main",
  "to":      "did:w7:skill/tax-filing",
  "policy":  { "maxBudget": "50 USD", "jurisdiction": "IN" },
  "sig":     "ed25519:...",
  "ts":      1713600010
}

Inference Node

{
  "type":       "inference",
  "id":         "aig:c56a4180...",
  "parent":     "aig:6ba7b810...",  // → delegation
  "model":      "did:w7:model/tax-v3@sha256:abc123",
  "input_hash": "0x1a2b3c...",
  "output":     { "draft_url": "..." },
  "zk_proof":   "0xdeadbeef...",     // ZK-ML proof of inference
  "agent_sig":  "ed25519:...",
  "ts":         1713600020
}

Outcome Node

{
  "type":      "outcome",
  "id":        "aig:d62f0a3c...",
  "parent":    "aig:c56a4180...",   // → inference
  "agent":     "did:w7:skill/tax-filing",
  "principal": "did:w7:alice",
  "result":    { "ok": true, "filed_at": "2026-04-15" },
  "sig":       "ed25519:...",
  "ts":        1713600030
}

Edges & Causation

Every node's parent field is the ID of its causal predecessor. This creates an immutable, verifiable chain of causation from any outcome back to the originating intent.

The lineage check in PoO verifies this chain is unbroken: outcome.parent === inference.id.

How AIG Enables Accountability

🔁

Reproducibility

Any outcome can be replayed from the root intent. KYRx record/replay + ZK-ML proofs ensure deterministic verification.

🎯

Blame assignment

Failed outcome → walk the edges → find which inference node failed proof or policy. Exact agent identified in O(log n).

Reputation source

Attested outcomes feed the reputation ledger. The AIG is the authoritative source of truth for agent track record.

📋

Compliance export

Auditors receive a signed subgraph export, not a log hairball. Cryptographically verifiable by any third party.

Storage Model

TierWhatWhere
HotActive graph, recent nodesIn-process (KYRx region) + QuantumOS cluster state
WarmHistorical nodes, search indexInfravault + Vigil timeline DB
Cold / canonicalMerkle commitmentL0 anchor (Merkle root of subgraph) + DA layer for blobs
💡
Only commitments go on L0. The graph itself is off-chain but verifiable against L0 Merkle roots. This keeps L0 lightweight while keeping the full graph auditable.

AIG vs Related Concepts

BlockchainIPFS DAGActivity graph (SIEM)AIG
Signed eventspartial
ZK-proof of AI inference
Outcome settlement
Reputation feedback
Auditable by regulatorhard
Parallel agents

Using AIG in Apps

You don't build AIG nodes by hand. Prime does it for you. Your app emits intents; AIG materialises as a side-effect of Prime execution.

import { createIntent, createDelegation, createInference, createOutcome, anchor }
  from "kynetra-prime/core/web7";

// 1. Express intent — AIG root node created automatically
const intent = createIntent({
  from: "did:w7:alice",
  to: "skill:tax-filing",
  intent: { action: "file_quarterly", params: { quarter: "2026-Q1" } },
  settle: { rail: "amp-escrow", amount: { amount: "50", currency: "USD" } },
});

// 2. Prime delegates — delegation node added with parent=intent.id
const delegation = createDelegation(prime.id, intent, agent.id);

// 3. Agent executes — inference node added with parent=delegation.id
const inference = createInference(agent.id, delegation, {
  model: "did:w7:model/tax-v3@sha256:abc", inputHash, outputHash,
});

// 4. Outcome attested — outcome node added with parent=inference.id
const outcome = createOutcome(agent.id, "did:w7:alice", inference.id, { ok: true });

// 5. Commit subgraph to L0 — returns Merkle root
const { merkleRoot } = anchor(intent.id);

Querying the Graph

The AIG class ships three primary query methods. All return plain arrays of AIGNode objects — no reactive wrappers, no hidden fetches.

lineage(id) — trace ancestors

BFS upward from any node. Returns every ancestor node up to the root intent. Use this to answer: "who authorised this outcome and how did we get here?"

import { getAIG } from "@hyperbridge/forge/aig";

const graph = getAIG();

// outcomeId came from the settled AMP envelope
const ancestors = graph.lineage("aig-outcome-1713600030-x9k2");

console.log(ancestors.map(n => `${n.type}  ${n.id}`));
// outcome   aig-outcome-1713600030-x9k2
// inference aig-inference-1713600020-m4p7
// delegation aig-delegation-1713600010-r3q1
// intent    aig-intent-1713600000-a8z5

// Find the originating principal
const root = ancestors.find(n => n.type === "intent");
console.log(root.payload.principal); // "did:w7:alice"

walk(rootId) — traverse descendants

BFS forward from any node. Returns the full subgraph rooted there. Use this to answer: "what did this intent produce?" — useful for generating audit exports or computing aggregate outcomes.

import { getAIG } from "@hyperbridge/forge/aig";

const graph = getAIG();

const subgraph = graph.walk("aig-intent-1713600000-a8z5");

// Group by node type to summarise the run
const summary = Object.groupBy(subgraph, n => n.type);
console.log({
  intents:     summary.intent?.length    ?? 0,  // 1
  delegations: summary.delegation?.length ?? 0,  // 2  (sub-agent spawned)
  inferences:  summary.inference?.length  ?? 0,  // 2
  outcomes:    summary.outcome?.length    ?? 0,   // 2
});

// Check every outcome succeeded
const failed = (summary.outcome ?? []).filter(n => !n.payload.ok);
if (failed.length) console.error("Failed outcomes:", failed.map(n => n.id));

anchor(rootId) — commit to L0

Walks the subgraph, sorts node IDs deterministically, computes a FNV Merkle root, and appends the commitment to the anchor log. The returned merkleRoot is the value written to the L0 smart contract.

import { getAIG } from "@hyperbridge/forge/aig";

const graph = getAIG();

const commitment = graph.anchor("aig-intent-1713600000-a8z5");
console.log(commitment);
// {
//   merkleRoot: "3f8a2c1d",
//   nodeIds:    ["aig-delegation-...", "aig-inference-...", "aig-intent-...", "aig-outcome-..."],
//   ts:         1713600035000,
//   rootId:     "aig-intent-1713600000-a8z5"
// }

// Later: verify any node is in the commitment
const check = graph.verify("aig-outcome-1713600030-x9k2", commitment.merkleRoot);
console.log(check); // { ok: true, reason: "ok" }

Fluent builder for tests and scripts

AIGBuilder chains node creation without manually threading IDs. Each call auto-sets parent to the previous node.

import { AIG, AIGBuilder } from "@hyperbridge/forge/aig";

const graph = new AIG();
const result = new AIGBuilder(graph)
  .intent({ principal: "did:w7:alice", action: "file_tax_q1" })
  .delegation({ from: "did:w7:prime/main", to: "did:w7:skill/tax-filing" })
  .inference({ model: "did:w7:model/tax-v3@sha256:abc123", inputHash: "0x1a2b" })
  .outcome({ ok: true, filed_at: "2026-04-15" })
  .anchor();

console.log(graph.size());           // 4
console.log(result.merkleRoot);       // "a1b2c3d4"
console.log(graph.roots().length);   // 1  (the intent node)
console.log(graph.leaves().length);  // 1  (the outcome node)

Filtering & inspection

Beyond the three traversal primitives, the AIG class exposes cheap filters and a Merkle inclusion proof. None of these touch the network — they iterate the in-memory node map.

import { getAIG } from "@hyperbridge/forge/aig";

const graph = getAIG();

// Filter by node type or authoring DID
const allOutcomes = graph.byType("outcome");        // AIGNode[]
const alicesNodes = graph.byAuthor("did:w7:alice");    // AIGNode[]

// Shortest paths from an intent to every descendant — Map<id, string[]>
const paths = graph.shortestPaths("aig-intent-1713600000-a8z5");
console.log(paths.get("aig-outcome-1713600030-x9k2"));
// ["aig-intent-...", "aig-delegation-...", "aig-inference-...", "aig-outcome-..."]

// One-line health snapshot of the whole graph
console.log(graph.stats());
// { nodes: 7, edges: 0, anchors: 1, added: 7, removed: 0, roots: 1, leaves: 2 }

// Merkle inclusion proof for an anchored node (null if not anchored)
const { merkleRoot } = graph.anchor("aig-intent-1713600000-a8z5");
const proof = graph.proof("aig-outcome-1713600030-x9k2", merkleRoot);
console.log(graph.verify("aig-outcome-1713600030-x9k2", merkleRoot).ok); // true

Graph analytics

For audit dashboards and anomaly detection, AIG ships standalone analytics functions that operate over a graph instance. They are pure — pass a graph, get plain data structures back.

import {
  getAIG, degreeCentrality, betweennessCentrality,
  egoNetwork, connectedComponents, temporalSlice,
} from "@hyperbridge/forge/aig";

const graph = getAIG();

// In/out degree per node — Map<id, { inDegree, outDegree, degree }>
const deg = degreeCentrality(graph);
// Which delegation node fans out to the most sub-agents?
const hub = [...deg.entries()].sort((a, b) => b[1].outDegree - a[1].outDegree)[0];

// Brandes betweenness — Map<id, number> (normalized). High score = chokepoint.
const between = betweennessCentrality(graph);

// Ego network: a node + its neighbours out to `depth` hops
const { center, nodes, edges } = egoNetwork(graph, hub[0], 2);

// Weakly-connected components — Array<string[]>. One run per intent root.
const runs = connectedComponents(graph);
console.log(`${runs.length} independent agent runs in this graph`);

// Slice the graph to a time window for incident forensics
const window = temporalSlice(graph, Date.parse("2026-04-15T00:00:00Z"), Date.now());
console.log(`${window.nodes.length} nodes created in the window`);

All of the above run against the in-memory graph; for graphs larger than memory, serialize() the relevant subgraph (from walk()) and replay it into a fresh AIG instance before analysing.