HMP-0005_03

Источник: HMP-0005_03.md

HyperCortex Mesh Protocol (HMP 5.0.8) - модульное представление


3. Container model

This section defines the universal HMP Container, used for all forms of data exchange within the Mesh — including goals, diary entries, reputation updates, consensus votes, and protocol messages.
The specification below corresponds to HMP Container Specification v1.2, fully integrated into HMP v5.0 for consistency and self-containment.

3.1 Purpose

This document defines the universal HMP Container format, used for transmitting and storing all types of data within the HyperCortex Mesh Protocol (HMP) network. Containers act as a standardized wrapper for messages, goals, reputation records, consensus votes, workflow entries, and other entities.

The unified container structure provides:

  • Standardized data exchange between agents;
  • Extensibility without modifying the core protocol;
  • Cryptographic signing and integrity verification;
  • Independent storage and routing of semantic units;
  • Support for compression and payload encryption.

3.2 General structure

{
  "hmp_container": {
    /* === container header === */
    "head": {
      "version": "1.2",
      "class": "goal",
      "subclass": "research_hypothesis",
      "class_version": "1.0",
      "class_id": "goal-v1.0",
      "schema": "https://mesh.hypercortex.ai/schemas/container-v1.2.json",
      "timestamp": "2025-10-10T15:32:00Z",
      "tags": ["research", "collaboration"],
      "ttl": "2025-11-10T00:00:00Z",
      "container_did": "did:hmp:container:abc123",
      "sender_did": "did:hmp:agent123",
      "public_key": "BASE58(...)",
      "recipient": ["did:hmp:agent456"],
      "key_recipient": "BASE58(...)",
      "broadcast": false,
      "network": "",
      "encryption_algo": "x25519-chacha20poly1305",
      "sig_algo": "ed25519",
      "signature": "BASE64URL(...)",
      "compression": "zstd",
      "payload_type": "encrypted+zstd+json",
      "payload_hash": "sha256:abcd...",
      "confidence": 0.84,
      "magnet_uri": "magnet:?xt=urn:sha256:abcd1234..."
    },
    /* === cognitive metadata === */
    "meta": {
      /* e.g. provenance, references, context, confidence sources, `abstraction` and `axes` sections */
    },
    /* === semantic payload === */
    "payload": {
      /* Content depends on class */
    },
    /* === section with links to other containers === */
    "related": {
      "previous_version": ["did:hmp:container:abc122"],
      "in_reply_to": ["did:hmp:container:msg-77"],
      "see_also": ["did:hmp:container:ctx-31", "did:hmp:container:goal-953"],
      "depends_on": ["did:hmp:container:goal-953"],
      "extends": ["did:hmp:container:proto-01"],
      "contradicts": ["did:hmp:container:ethics-22"]
    }
  },
  /* === container backlink block === */
  "referenced-by": {
    "links": [
      { "type": "depends_on", "target": "did:hmp:container:abc123" }
    ],
    "peer_did": "did:hmp:agent456",
    "public_key": "BASE58(...)",
    "sig_algo": "ed25519",
    "signature": "BASE64URL(...)",
    "referenced-by_hash": "sha256:abcd..."
  },
  /* === block of evaluations and additions for the container === */
  "evaluations": {
    "evaluations_hash": "sha256:efgh...",
    "items": [
      { "value": -0.4, "type": "oppose", "target": "did:hmp:container:reason789", "timestamp": "2025-10-17T14:00:00Z", "agent_did": "did:hmp:agent:B", "sig_algo": "ed25519", "signature": "BASE64URL(...)" }
    ]
  }
}

Agents MAY include non-standard fields in head, meta or payload; unrecognized fields MUST be safely ignored during deserialization and propagation.

Fields defined as head.* in Sections 3.3 and 3.4 MUST appear exclusively within the head object and MUST NOT be relocated outside of it.

Signature MUST be computed over the canonical serialized form of hmp_container (excluding signature itself).

Note: For readability, most examples in this specification show only the head and payload sections (often in a truncated version). Full containers may additionally include meta, related, evaluations, and referenced-by blocks.


3.3 Required fields

Field Type Description
head object The section containing the container's header.
head.version string Version of the container specification. Defines the structural and semantic standard used (e.g., "1.2").
head.class string Type of content (goal, reputation, knowledge_node, ethics_case, protocol_goal, etc.). Determines the schema for the payload.
head.class_version string Version of the specific container class.
head.class_id string Unique identifier of the class (usually formatted as <class>_v<class_version>).
head.container_did string Decentralized identifier (DID) of the container itself (e.g., did:hmp:container:abc123).
head.schema string Reference to the JSON Schema used to validate this container.
head.sender_did string DID identifier of the sending agent.
head.timestamp datetime Time of container creation (ISO 8601 extended format, UTC, e.g. "2025-11-04T10:15:00Z").
head.payload_hash string Hash of the serialized payload representation (sha256:<digest>). The hash is computed over the payload exactly as transmitted (including optional compression and/or encryption) and is used for integrity verification.
head.sig_algo string Digital signature algorithm (default: ed25519).
head.signature string Digital signature of the container body.
head.payload_type string Type of payload data (json, binary, mixed).
payload object Core content of the container. The structure depends on the class and its schema definition.

3.4 Optional fields

Field Type Description
head.recipient array(string) One or more recipient DIDs.
head.key_recipient string Encrypted symmetric session key. The key is encrypted using the recipient’s public key and may be transmitted openly alongside the container.
head.group_recipient array(object) Multi-recipient hybrid-encryption envelopes. See section 3.19.
head.broadcast bool Broadcast flag. If true, the recipient field is ignored.
head.tags array(string) Thematic or contextual tags for the container.
head.confidence float Optional numeric field (0.0–1.0) indicating the agent’s subjective certainty regarding the payload’s reliability.
head.ttl datetime Expiration time. Containers are not propagated after expiration.
head.public_key string Sender’s public key, if not globally resolvable via DID.
head.compression string Compression algorithm used for the payload (zstd, gzip).
head.magnet_uri string Magnet link pointing to the original or mirrored container.
head.network string Specifies the local propagation scope of the container: "localhost", "lan:\<subnet>". An empty string ("") indicates Internet/global propagation. If set, broadcast is automatically considered false.
head.subclass string Optional subtype or specialization of the container’s class. Enables agents to differentiate more specific container families (e.g. "goal.research_hypothesis", "quant.semantic_node"). Inherits schema from the parent class.
head.encryption_algo string Algorithm used for payload encryption.
related object A general-purpose object describing direct relationships to other containers. All fields inside related are arrays of DIDs, supporting multiple links per relation type and open-ended semantic extension by agents. The following fields illustrate common link types but do not represent an exhaustive list.
related.previous_version array(string) One or more container DIDs this container supersedes. Enables version branching and merging.
related.in_reply_to array(string) DIDs of containers this one replies to. Used for multi-source reasoning or discussion threads.
related.see_also array(string) References to related or contextual containers.
related.depends_on array(string) References to containers this one logically depends on.
related.extends array(string) References to containers that this one extends.
related.contradicts array(string) References to containers that this one contradicts.
referenced-by object Unsigned field generated locally by the agent based on received references. Contains a list of container DIDs that refer to this container. May be extended over time, thus requiring verification; used for local navigation.
evaluations object Optional field describing aggregated evaluations or reactions of other agents toward this container. Used for distributed reputation and interpretability. May evolve independently of the container’s core data.
meta object Cognitive metadata block providing contextual, provenance, and coordinate information about the container. Includes creation context, sources, abstraction hierarchy (meta.abstraction), and cognitive-space coordinates (meta.axes).
meta.abstraction object Describes the hierarchical position of the container within a cognitive or semantic model (e.g. the Knowledge Genome’s L1–L5 structure). Defines which abstraction layers the container belongs to and their relationships.
meta.axes object Defines the coordinate position of the container within a cognitive space. Each key represents a semantic axis (e.g., axis-logos), and its value defines the container’s coordinate on that axis.

Absent fields MUST NOT be serialized as null unless explicitly required by the schema.

💡 Note: Both referenced-by and evaluations are virtual, locally extended blocks. They are not included in the cryptographically signed portion of the container (hmp_container), allowing agents to maintain and exchange additional contextual or social metadata without modifying the original, immutable container structure.


3.5 Payload structure (payload)

🧩 This section defines a recommended documentation format for describing the payload fields of new or custom container classes.
It serves as a template for class specifications (e.g., in extensions or protocol updates) and is not a mandatory storage format.
Each container’s payload is stored as a regular JSON object, and this section only standardizes how its structure should be documented.


The payload contains the semantic or operational data of the container.
It MUST be a valid JSON object whose structure and meaning are determined by the container’s class.

Each container class (e.g. goal, reputation, workflow_entry) defines its own schema and validation rules.
Custom or experimental classes SHOULD document their payloads using the following template:

* key: field name
  type: value type (string | number | boolean | object | array)
  description: short purpose of the field
  required: true/false
  example: example value

Example:

* key: "title"
  type: "string"
  required: true
  description: "Name of the goal"
  example: "Improve local agent discovery"

* key: "priority"
  type: "number"
  required: false
  description: "Importance or relevance score of the goal"
  example: 0.82

* key: "dependencies"
  type: "array"
  required: false
  description: "List of other goal container IDs this one depends on"
  example: ["goal-953", "goal-960"]

💡 Note:
The structure of payload is validated against the schema defined in the schema field of the container.
Agents must be able to parse and process only those classes they explicitly support; unknown but valid containers are still preserved and propagated in store-and-forward mode.


3.6 Cognitive meta-structures (meta)

The meta section defines the cognitive identity of a container — its provenance, reasoning origin, and semantic coordinates within both the hierarchical abstraction tree and the cognitive space (axes model).

It combines three layers of information:

  1. Provenance context — who/what created the container and from which sources.
  2. Abstraction mapping — how the container is positioned within the layered structure of knowledge.
  3. Cognitive coordinates — where the container is located in the multidimensional semantic space.

Example

"meta": {
  "created_by": "PRIEST",
  "agents_class": "Knowledge Genome",
  "interpretation": "Derived from L3 technical analysis",
  "workflow_entry": "did:hmp:container:workflow-4fbd1c",
  "sources": [
    { "type": "container", "id": "did:hmp:container:fact-3abc2e", "credibility": 0.87, "weight": 0.6 },
    { "type": "resource", "id": "doi:10.48550/arXiv.2410.0123", "credibility": 0.83, "weight": 0.3 },
    { "type": "isbn", "id": "isbn 978-3-16-148410-0", "credibility": 0.92, "weight": 0.1 }
  ],
  "abstraction": {
    "agents_class": "Knowledge Genome",
    "path": {
      "L1": "did:hmp:container:abstraction-40af1c",
      "L2": "did:hmp:container:abstraction-a7f0b3",
      "L3": "did:hmp:container:abstraction-c91e0a"
    }
  },
  "axes": {
    "agents_class": "Knowledge Genome",
    "did:hmp:container:axis-40aa1c": 742,
    "did:hmp:container:axis-40ab1c": 512,
    "did:hmp:container:axis-43aa1c": 322,
    "did:hmp:container:axis-40aa3d": 142,
    "did:hmp:container:axis-40aa4f": 12,
    "did:hmp:container:axis-45aa5f": 54,
    "did:hmp:container:axis-45fb5f": 321
  }
}

Field Type Description
created_by string Indicates the role or origin of the container creator (e.g. "PRIEST", "AGENT", "SYSTEM").
agents_class string Declares which cognitive framework or agent class generated this container (e.g. "Knowledge Genome").
sources array(object) Provenance list describing the containers or resources contributing to this container. Each includes { "type": string, "id": string, "credibility": float, "weight": float }.
interpretation string Human-readable summary of how this container was derived or interpreted.
workflow_entry string DID of a workflow_entry describing the reasoning process that led to creation.
abstraction object Describes the container’s position in a hierarchical (tree-like) cognitive model. The number of levels (L1, L2, …) is not fixed and may vary by framework.
axes object Defines the container’s coordinates within the cognitive space. Each key is a reference to an axis container, and each value represents a position along that axis.

Structure: meta.abstraction

The abstraction block specifies the hierarchical context in which the container resides. It reflects the logical or conceptual ancestry within the agent’s internal knowledge structure.

Structure:

"abstraction": {
  "agents_class": "Knowledge Genome",
  "path": {
    "L1": "did:hmp:container:abstraction-40af1c",
    "L2": "did:hmp:container:abstraction-a7f0b3",
    "L3": "did:hmp:container:abstraction-c91e0a"
  }
}
Field Type Description
agents_class string Framework defining the abstraction hierarchy (e.g. "Knowledge Genome").
path object Mapping of levels (L1, L2, L3, …) to abstraction-layer containers (abstraction). The number of levels is variable and not limited to L5.

💡 Interpretation: Each level represents a conceptual refinement or implementation of the previous one. The topmost level (L1) usually contains fundamental principles, while deeper levels describe progressively more concrete instantiations.


Structure: meta.axes

The axes block defines the spatial or semantic coordinates of the container in the cognitive space — a multi-dimensional system used to represent conceptual relations numerically or topologically.

Structure:

"axes": {
  "agents_class": "Knowledge Genome",
  "did:hmp:container:axis-40aa1c": 742,
  "did:hmp:container:axis-40ab1c": 512,
  "did:hmp:container:axis-43aa1c": 322
}
Field Type Description
agents_class string Framework defining the coordinate system (e.g. "Knowledge Genome").
<axis_did> number Coordinate value on the given axis. Axes are referenced by their container DIDs (e.g., axis-logos, axis-chronos).

💡 Interpretation: Each axis defines an independent semantic dimension. Together, they form a vector representation of the container’s cognitive “position” — enabling reasoning based on semantic proximity, clustering, or gradient-based knowledge inference.


Cognitive Interpretation

  • meta.abstraction — defines a tree-like structure that anchors the container in hierarchical reasoning.
  • meta.axes — defines a spatial structure that positions the container in a semantic coordinate space.
  • Together, they form the Cognitive Signature, enabling agents to:

    • perform semantic proximity and relevance search,
    • infer hierarchical relationships,
    • align reasoning contexts across frameworks (e.g. between Knowledge Genomes of different agents).

Notes

  • Both meta.abstraction and meta.axes may include agents_class if different from the parent meta.
  • Updates to referenced containers (e.g. abstraction or axes) do not alter existing containers automatically — agents must periodically verify linked versions and synchronize updates.
  • Agents are encouraged to cache and periodically refresh cognitive maps to maintain coherence.
  • The combination of meta.abstraction and meta.axes defines a full Cognitive Position Vector — the unique, reproducible semantic coordinates of a container within the Mesh.

3.7 Container signature

  1. The digital signature applies to the canonical JSON representation of the entire hmp_container object, excluding the signature field itself.

This ensures that all metadata, relations, and payload hashes are cryptographically bound and cannot be modified without invalidating the signature.

  1. The canonical representation (canonical_json(hmp_container)) must be computed deterministically according to the following rules:

    • All object keys are sorted lexicographically (ascending order, Unicode code point order).
    • Objects and arrays are serialized in standard JSON form without extra whitespace or indentation.
    • Array order MUST be preserved and treated as significant.
    • Strings are encoded in UTF-8 with escaped control characters.
    • Numeric values are serialized in plain JSON numeric format (no leading zeros, fixed . decimal separator).
    • The signature field itself is omitted during signing and verification.
    • The result is a byte sequence identical across implementations.
  2. The default digital signature algorithm is Ed25519. Alternative algorithms may be used if declared explicitly in the sig_algo field.

  3. If the container includes a public_key field, signature verification may be performed locally, without consulting a global DID registry.

  4. Upon receiving a container, an agent must verify that the provided public key matches the registered key associated with the sender’s DID to prevent key substitution attacks.

    • If the sender’s DID–key mapping is unknown, the agent should query neighboring peers to confirm the association (sender_did → public_key).

🔐 Note: Signature validation applies only to the canonical form of the hmp_container and does not cover dynamically generated or external fields such as referenced-by or evaluations. This allows agents to augment the local knowledge graph without altering the immutable container core.


3.8 Compression (compression)

  1. The compression field specifies the algorithm used to compress the container’s payload. Supported algorithms include zstd, gzip, or others declared in the HMP registry.

  2. Compression is performed before computing the payload_hash and generating the signature. This ensures that both the hash and signature refer to the compressed representation of the payload.

  3. For verification, the payload must be decompressed first, after which the hash is recalculated and compared against the stored payload_hash.

⚙️ Implementation note: Agents must advertise supported compression algorithms during the handshake phase Unsupported containers should still be stored and relayed unmodified in “store & forward” mode.


3.9 Encryption (encryption_algo)

  1. When the recipient field is present, the container may use hybrid encryption, providing confidentiality of the payload while preserving verifiable metadata.

  2. The encryption algorithm is specified in encryption_algo. Recommended values:

    • x25519-chacha20poly1305
    • rsa-oaep-sha256
  3. Container encryption process:

    1. Construct the payload.
    2. Apply compression (compression, if specified).
    3. Generate a random symmetric session key.
    4. Encrypt the compressed payload using the symmetric key.
    5. Encrypt the symmetric key with the recipient’s public key and store the resulting hybrid-encryption envelope in key_recipient.
    6. Compute payload_hash over the final serialized payload representation (i.e. after optional compression and encryption).
    7. Sign the container (the entire hmp_container structure except for the signature field itself).
  4. Verification of the container is performed on the transmitted representation of the payload and does not require decryption.

  5. Relevant fields:

Field Type Description
encryption_algo string Algorithm used for payload encryption.
key_recipient string Symmetric session key encrypted with the recipient’s public key (hybrid-encryption envelope).
payload_type string Recommended prefix encrypted+ (e.g., encrypted+zstd+json).
  1. Recipient fields:

  2. When recipient is used, exactly one recipient MUST be specified.

  3. For encrypted delivery to multiple recipients, the group_recipient mechanism (see 3.19) MUST be used.

⚙️ Note: Agents may forward encrypted containers even if they cannot decrypt them, preserving store-and-forward propagation behavior.


3.10 Container Verification

Before performing any semantic interpretation, reasoning, execution, or trust evaluation, implementations MUST validate the structural integrity of the container.

Containers that fail structural validation MUST be rejected and MUST NOT be passed to any reasoning or LLM-based subsystem.

The verification procedure SHOULD follow this order:

  1. Validate structural compliance with the base container schema, including the presence of all required fields.

  2. Validate timestamp (MUST NOT be in the future beyond acceptable clock skew).

  3. If ttl is set — mark the container as expired after its expiration time. Expired containers MAY be stored for archival purposes but MUST NOT participate in consensus or active workflows.

  4. Compute sha256(payload) and compare it with the stored payload_hash.

  5. Verify the digital signature using sig_algo (default: Ed25519).

  6. Validate the container class (class) against a known or registered schema.

    • For compatibility: if an agent does not recognize the class, but the container passes the base container schema, it MUST still store and forward the container.
  7. Optionally, periodically query for containers referencing the current one as previous_version to detect potential updates or forks.

  8. When multiple versions exist, the valid version is the one that has received confirmation from a majority of trusted nodes (consensus at DHT level).


3.11 Container as a universal message

Any container can serve as a context (in_reply_to) for another container. This enables a unified structural model for discussions, votes, messages, hypotheses, arguments, and other forms of cognitive exchange.

Chains of in_reply_to form a dialectical reasoning tree, where each branch represents an evolution of thought — a clarification, counterpoint, or refinement of a previous idea. This makes HMP discussions and consensus processes inherently non-linear, self-referential, and evolving.

In essence, all interactions between agents in HMP are represented as an interconnected web of containers, collectively forming a cognitive graph of reasoning.


3.12 Versioning and lineage

Containers in HMP support semantic evolution through the field related.previous_version. This mechanism preserves the continuity and traceability of meaning across updates and revisions.

  • A descendant container is considered authentic if it is signed by the same DID as the author of its previous_version.
  • If the author or signature differs, the descendant may still be accepted as legitimate when a sufficient portion of trusted peers acknowledge it as a valid continuation.
    (The precise quorum threshold is determined by the agent’s local policy or the Mesh Consensus Protocol.)
  • Agents are required to retain at least one previous version of each container for compatibility and integrity verification.
  • A single container may have multiple descendants (alternative branches) that diverge by time, authorship, or interpretation.
    In such scenarios, branch priority or relevance is determined via local heuristics or consensus mechanisms.
  • Divergent descendants are treated as semantic forks — parallel evolutions of a shared idea within the distributed cognitive graph.

Versioning in HMP thus reflects not only data persistence, but also the evolution of ideas across agents and time.


3.13 TTL and validity

The ttl field defines the validity period of a container (for example, for DISCOVERY messages).
If ttl is absent, the container is considered valid until a newer version appears, in which the current container is referenced as previous_version.

After expiration, the container remains archived but is not subject to retransmission in the active network.


3.14 Extensibility

  • The addition of new fields is allowed as long as they do not conflict with existing field names.
  • Containers of newer versions must remain readable by nodes supporting older versions.
  • When new container classes (class) are introduced, they should be registered in the public schema registry (/schemas/container-types/).
  • For containers describing protocol specifications, it is recommended to use the protocol_ prefix, followed by the domain of application (e.g., protocol_goal, protocol_reputation, protocol_mesh_handshake, etc.).

3.15.1 Purpose

The related field is designed to describe direct relationships between containers — both logical and communicative. It allows an agent or network node to understand the context of origin, dependencies, and semantic links of a container without relying on external indexes.

3.15.2 Structure

"related": {
  "previous_version": "did:hmp:container:abc122",
  "in_reply_to": ["did:hmp:container:msg-77"],
  "see_also": ["did:hmp:container:ctx-31", "did:hmp:container:goal-953"],
  "depends_on": ["did:hmp:container:goal-953"],
  "extends": ["did:hmp:container:proto-01"],
  "contradicts": ["did:hmp:container:ethics-22"]
}

The related field is an object where:

  • the key defines the type of relationship (e.g., depends_on, extends, see_also);
  • the value represents one or more container identifiers (DIDs).

All relationships are considered direct — meaning they originate from the current container toward others.


Link Type Meaning
previous_version Points to the previous version of this container.
in_reply_to Indicates a response to the referenced containers.
see_also Refers to related or contextual containers.
depends_on Depends on the contents of the referenced container (e.g., goal or data).
extends Expands or refines the referenced container.
contradicts Provides a refutation, objection, or alternative viewpoint.

Additional custom link types may be used beyond those listed in the table, provided that:

  • they follow the same general syntax (string or array[string]);
  • they may optionally include a namespace for disambiguation:

json "related": { "hmp:depends_on": ["did:hmp:container:goal-953"], "opencog:extends": ["did:oc:concept:122"] }

  • their meaning is consistently interpretable by agents within the specific network or application context.

3.15.5 Example

"related": {
  "previous_version": "did:hmp:container:abc122",
  "depends_on": ["did:hmp:container:goal-953"],
  "extends": ["did:hmp:container:proto-01"],
  "see_also": ["did:hmp:container:ctx-31", "did:hmp:container:goal-953"]
}

⚙️ The related field is not intended to store reverse links — see referenced-by.


Each container may include an auxiliary signed block called referenced-by, indicating which other containers refer to it.
This block is not part of the original container payload and can be generated, transmitted, and verified independently.

3.16.1 General principles

  • Detached and updatable — referenced-by is maintained as a separate signed structure associated with the container.
  • Generated by agents — created or updated locally by an agent during analysis of references (in_reply_to, see_also, relations, etc.) found in other containers.
  • Signed by the reporting agent — the agent producing the block signs its content to confirm the observed backlinks.
  • Verifiable by peers — other agents may validate the links, check the signature, and reconcile differences based on their own data.
  • Does not modify the original container — referenced-by is an external computed attribute and does not affect the integrity of the original container.

Data type: object, consisting of verifiable backlinks and metadata.
Example:

"referenced-by": {
  "links": [
    { "type": "depends_on", "target": "did:hmp:container:abc123" },
    { "type": "see_also", "target": "did:hmp:container:def456" }
  ],
  "peer_did": "did:hmp:agent456",
  "public_key": "BASE58(...)",
  "sig_algo": "ed25519",
  "signature": "BASE64URL(...)",
  "referenced-by_hash": "sha256:abcd..."
}

The referenced-by block is a cryptographically verifiable statement describing which containers are known to reference the current one. The block’s content may differ between peers, reflecting local knowledge and network coverage.

Note: Future extensions may introduce alternative, more compact representations of referenced-by.links to improve merge efficiency and reduce verbosity.

3.16.2 Structure definition

Field Type Description
links array\<object> List of backlinks; each object includes a type (semantic relation) and a target (referencing container DID).
peer_did string DID of the agent that generated and signed the block.
public_key string Public key corresponding to the signing key.
sig_algo string Signature algorithm (e.g., ed25519).
signature string Base64URL-encoded signature of the canonical serialized links section (or referenced-by_hash).
referenced-by_hash string SHA-256 checksum of the canonicalized links; used to verify integrity before signature validation.

Recommendation: referenced-by_hash = sha256(canonical_json(links)) This allows agents to efficiently compare or cache referenced-by states without re-verifying signatures.

3.16.3 Operation principle

  1. The agent receives or updates container [C1].
  2. It analyzes other known containers [C2..Cn] that reference [C1] through their relations field.
  3. A local referenced-by block is formed:
"referenced-by": {
  "links": [
    { "type": "in_reply_to", "target": "did:hmp:container:C2" },
    { "type": "depends_on", "target": "did:hmp:container:C3" }
  ],
  "peer_did": "did:hmp:agentA",
  ...
}
  1. The block is serialized canonically, hashed (referenced-by_hash), and signed with the agent’s key.

  2. When receiving other versions of the block (from different peers), the agent may:

    • merge verified backlinks;
    • remove invalid or outdated entries;
    • update its own signed version.
  3. If inconsistencies are detected (e.g., a backlink claims a relation that does not exist), the agent may:

    • reject or locally remove that link;
    • optionally notify the source peer to review the data.

3.16.4 Example

Agent reported backlinks for [C1]
A (did:hmp:agentA) [C2], [C3]
B (did:hmp:agentB) [C4], [C5]
C (did:hmp:agentC) [C6], [C7]

Agent D aggregates and verifies them:

"referenced-by": {
  "links": [
    { "type": "depends_on", "target": "did:hmp:container:C2" },
    { "type": "depends_on", "target": "did:hmp:container:C3" },
    { "type": "see_also", "target": "did:hmp:container:C4" },
    { "type": "see_also", "target": "did:hmp:container:C5" },
    { "type": "in_reply_to", "target": "did:hmp:container:C6" }
  ],
  "peer_did": "did:hmp:agentD",
  "sig_algo": "ed25519",
  "signature": "BASE64URL(...)",
  "referenced-by_hash": "sha256:..."
}

If container [C7] does not actually reference [C1], it is excluded before signing.

3.16.5 Usage

  • Enables reconstruction of discussion graphs, dependency networks, and update chains.
  • Supports cross-agent validation of reference structures.
  • Accelerates discovery of related containers without full history queries.
  • Facilitates consensus analysis and branch visualization.
  • The agent periodically recomputes and re-signs the referenced-by block using local or peer-provided data.

3.17 Evaluations

The evaluations field is optional and represents aggregated reactions from other agents to the given container. Each evaluation is created by an agent as a signed record referencing a justification container (target), in which the agent explains their position (argument, addition, or alternative).

The evaluations_hash is used to verify the integrity of the list without requiring full retransmission upon every update.

"evaluations": {
  "evaluations_hash": "sha256:efgh...",
  "items": [
    {
      "value": -0.4,
      "type": "oppose",
      "target": "did:hmp:container:reason789",
      "timestamp": "2025-10-17T14:00:00Z",
      "agent_did": "did:hmp:agent:B",
      "sig_algo": "ed25519",
      "signature": "BASE64URL(...)"
    }
  ]
}

Field description

Field Type Description
evaluations_hash string Hash of the evaluation list. Used to detect differences during sync.
items array List of signed evaluations.

Structure of items[]

Field Type Description
value number (-1.0 … +1.0) Numeric expression of the agent’s attitude toward the container.
type string Type of evaluation (see table below).
target string (container DID) Reference to the justification container (argument, addition, or alternative).
timestamp string (ISO 8601) Time when the evaluation was created.
agent_did string Identifier of the agent who created the evaluation.
sig_algo string Signature algorithm (e.g., ed25519).
signature string Digital signature confirming the authenticity of the evaluation.

The signature is calculated over the concatenated string:

value + ", " + type + ", " + target + ", " + timestamp + ", " + agent_did

using the algorithm specified in sig_algo.


Minimal set of type values

Value Meaning
support Agreement or positive evaluation.
oppose Disagreement or negative evaluation.
extend Non-contradictory addition to the container.
replace Suggestion of an alternative version.
comment Neutral note or clarification.

Agents may define their own custom types if they are reasonably interpretable by others (e.g., revise, clarify).


Synchronization principles

  1. Each evaluation is signed individually by an agent, and one agent can have only one active evaluation per container.
  2. If an agent changes their opinion, they issue a new record with a later timestamp.
  3. Evaluation blocks can be propagated in the network similarly to the referenced-by block. They are bound to a container but may also be transmitted independently, if the target container is already present at the recipient.
  4. When an agent receives a new evaluation block, it compares the evaluations_hash with its local version. If the hashes differ, this indicates a divergence in evaluation state, which may trigger re-synchronization or a request for the updated block from peers.

Note

The evaluations field is not mandatory — it is added at the agent’s discretion when feedback or evaluations have been collected from the Mesh network. Thus, a container may exist independently of others’ opinions, but agents may include aggregated perception data to represent how the container is viewed across the network.


3.18 Usage of network and broadcast fields

The network field is introduced to control container propagation in both local and global environments.
It allows restricting the delivery scope of a container and defines which transmission methods should be used by the agent.

3.18.1 General Rules

  • If the network field is not empty, the container is intended for a local environment (e.g., "localhost", "lan:<subnet>") and is not automatically broadcast to the global Mesh.
    Local transmission to a specific recipient within the same network is allowed, including encrypted delivery.
    If broadcast is true, the container is visible to all nodes in that local segment.

  • If the network field is empty (""), the container can be broadcast to the global Mesh using standard DID addressing and routing mechanisms.

3.18.2 Possible values of network

Value Description
"" The container is allowed to propagate within the global Mesh.
"localhost" The container is intended only for agents running on the same host.
"lan:192.168.0.0/24" The container is intended for agents within the specified local subnet.

⚠️ Note:
When a container is restricted by the network field (e.g., localhost or lan:*), agents distribute it using local discovery mechanisms — such as IPC, UDP broadcast, multicast, or direct TCP connections.
This is necessary because DID addresses of other agents in the local network may not yet be known.

3.18.3 Examples

  1. Global Mesh Delivery:
"head": {
  "broadcast": true,
  "network": "",
  "recipient": []
}

The container can propagate across the entire Mesh without restrictions.

  1. Local Host:
"head": {
  "broadcast": false,
  "network": "localhost",
  "recipient": []
}

The container is delivered only to other agents running on the same host using local communication channels.

  1. LAN Subnet:
"head": {
  "broadcast": true,
  "network": "lan:192.168.0.0/24",
  "recipient": []
}

The container is intended for agents within the 192.168.0.0/24 subnet. Delivery is performed via local networking mechanisms (UDP discovery, broadcast/multicast).

3.18.4 Specifics

  • The network field defines the scope of the container, while broadcast determines whether broadcasting is allowed within that scope.
  • When needed, an agent may create multiple containers for different subnets if it operates with several LAN interfaces or in isolated network segments.
  • Containers intended for local networks remain structurally compatible with the global Mesh infrastructure, but their delivery is restricted to local channels.
  • Although the mechanism was initially designed for local node discovery and synchronization, it can also be used for private communication within home or corporate environments, ensuring that containers do not leave the local network and are not transmitted to the Internet.

3.19 Multi-recipient encrypted containers (group_recipient)

To enable encrypted delivery to multiple recipients, HMP containers MAY include the optional field:

"group_recipient": [
  {
    "recipient": "did:hmp:agent456",
    "key_recipient": "BASE58(...)"
  },
  {
    "recipient": "did:hmp:agent457",
    "key_recipient": "BASE58(...)"
  }
]

Semantics:

  1. A single symmetric key is generated for the payload.
  2. For each listed recipient, this symmetric key is encrypted with that recipient’s public key and placed in key_recipient.
  3. All recipients receive the SAME encrypted payload and decode it independently using their individual key envelopes.

Rules:

  • group_recipient MUST NOT be used together with the head.recipient and head.key_recipient fields.
  • The header remains public; only the payload is encrypted.
  • The container is signed once by the sender — no shared signing keys are required.
  • Nodes SHOULD deliver the container to every DID listed in group_recipient.

This mechanism provides efficient multicast-style encrypted messaging, fully compatible with the existing container structure and hybrid encryption scheme.

Комментарии

Популярные сообщения из этого блога

Habr_Distributed-Cognition

HMP-0005

CHANGELOG