HMX-A: Artifact Specification

Protocol: Hippocortex Memory Protocol (HMX)
Component: HMX-A (Artifacts)
Version: HMX-1.0
Status: Stable


1. Overview

An HMX Artifact is a compiled unit of reusable knowledge derived from one or more HMX Events. Artifacts represent the agent's distilled understanding: task procedures, failure recovery plans, decision policies, causal relationships, and strategic approaches.

Artifacts are:

  • Immutable — once created, an artifact is never modified. Updates produce new artifacts that supersede the old.
  • Evidence-backed — every artifact traces to the source events and memories from which it was compiled.
  • Deterministically hashable — the same inputs produce the same content hash, enabling deduplication and integrity verification.
  • Portable — JSON-serializable, language-agnostic, transferable between systems.

Relationship to Hippocortex Architecture

HMX Artifacts wrap and standardize the existing CompiledArtifact type hierarchy from @hippocortex/compiler. The internal types (TaskSchema, FailurePlaybook, DecisionPolicy, CausalPattern, StrategyTemplate) map directly to HMX Artifact types. The protocol adds standardized versioning, supersession chains, validity scoping, and deterministic hashing.


2. Artifact Structure

2.1 Required Fields

FieldTypeDescription
hmx_versionstringProtocol version ("HMX-1.0")
artifact_idstringGlobally unique artifact identifier (UUIDv7 recommended)
artifact_typestringType discriminator (see §3)
titlestringHuman-readable title
summarystringConcise description of what this artifact captures
contentobjectType-specific compiled knowledge (see §4)
confidencenumberConfidence score in [0.0, 1.0] based on evidence quality
statusstringLifecycle status (see §5)
source_eventsstring[]IDs of HMX Events this artifact was compiled from
source_memory_idsstring[]IDs of intermediate memory objects used in compilation
versionintegerArtifact version (starts at 1, increments on supersession)
created_atstringISO 8601 datetime
content_hashstringSHA-256 hash of deterministically serialized content
metadataobjectExtensible key-value metadata

2.2 Optional Fields

FieldTypeDescription
tenant_idstringTenant scope
agent_idstringAgent that compiled this artifact
superseded_bystringID of the artifact that supersedes this one
supersedesstringID of the artifact this one supersedes
validity_scopeobjectConditions under which this artifact is applicable (see §6)
tagsstring[]Categorization tags
observed_countintegerNumber of times the pattern was observed
success_ratenumberHistorical success rate [0.0, 1.0]
updated_atstringISO 8601 datetime of last metadata update

3. Artifact Types

Artifact TypeDescriptionMaps to CompiledArtifact
task_schemaReusable procedure for completing a category of tasksTaskSchema
failure_playbookFailure pattern with recovery and prevention strategiesFailurePlaybook
decision_policyRule for making decisions based on historical outcomesDecisionPolicy
causal_patternObserved cause → effect relationshipCausalPattern
strategy_templateReusable approach for achieving goalsStrategyTemplate

Custom artifact types MUST use a namespaced format: x-{vendor}-{type}.


4. Content Schemas

4.1 task_schema

{
  "steps": [
    {
      "order": 1,
      "description": "string",
      "tools_used": ["string"],
      "optional": false
    }
  ],
  "preconditions": ["string"],
  "postconditions": ["string"],
  "tools_used": ["string"],
  "estimated_complexity": "low" | "medium" | "high"
}

4.2 failure_playbook

{
  "failure_pattern": "string",
  "trigger_conditions": ["string"],
  "symptoms": ["string"],
  "recovery_steps": ["string"],
  "prevention_strategies": ["string"],
  "severity": "low" | "medium" | "high" | "critical"
}

4.3 decision_policy

{
  "condition": "string",
  "recommendation": "string",
  "alternatives": [
    {
      "description": "string",
      "outcome": "string",
      "chosen_count": 0,
      "success_rate": 0.0
    }
  ],
  "outcomes": [
    {
      "decision": "string",
      "outcome": "string",
      "positive": true,
      "source_memory_id": "string"
    }
  ],
  "scope": ["string"]
}

4.4 causal_pattern

{
  "cause": "string",
  "effect": "string",
  "direction": "forward" | "bidirectional",
  "strength": 0.0,
  "conditions": ["string"],
  "counterexamples": ["string"]
}

4.5 strategy_template

{
  "goal": "string",
  "phases": [
    {
      "order": 1,
      "name": "string",
      "description": "string",
      "tools_used": ["string"],
      "success_criteria": ["string"]
    }
  ],
  "applicability_conditions": ["string"],
  "estimated_complexity": "low" | "medium" | "high"
}

5. Lifecycle States

            ┌──────────┐
            │  draft    │ ← freshly extracted
            └────┬─────┘
                 │ validate
            ┌────▼─────┐
     ┌──────│  active   │──────┐
     │      └────┬─────┘      │
     │ archive   │ supersede  │ deprecate
     │      ┌────▼──────┐     │
     │      │ superseded │     │
     │      └───────────┘     │
┌────▼────┐              ┌────▼──────┐
│ archived │              │ deprecated │
└─────────┘              └───────────┘
StatusDescriptionRetrievable?
draftFreshly extracted, pending validationNo
activeValidated, available for retrieval and context assemblyYes
supersededReplaced by a newer versionNo (unless explicitly requested)
deprecatedSource evidence contradicted or decayedNo
archivedManually archived by operatorNo (unless explicitly requested)

State transitions:

  • draftactive (validation passes)
  • activesuperseded (new version compiled)
  • activedeprecated (source evidence invalidated)
  • activearchived (operator decision)
  • draftdeprecated (validation fails due to contradicted sources)

6. Validity Scope

The validity_scope field constrains when an artifact is applicable:

{
  "tenant_ids": ["string"],
  "agent_ids": ["string"],
  "tags": ["string"],
  "time_range": {
    "start": "ISO-8601",
    "end": "ISO-8601"
  },
  "conditions": ["string"]
}

All fields are optional. An empty validity_scope means the artifact is universally applicable within its tenant.


7. Supersession Chain

Artifacts form a linked list of versions via supersedes / superseded_by:

artifact-v1 (superseded_by: artifact-v2)
  └── artifact-v2 (supersedes: artifact-v1, superseded_by: artifact-v3)
        └── artifact-v3 (supersedes: artifact-v2) ← active

Rules:

  1. An artifact MUST NOT supersede itself
  2. An artifact MUST NOT create a cycle in the supersession chain
  3. When an artifact is superseded, its status MUST transition to superseded
  4. Only one artifact in a chain SHOULD have active status
  5. The chain is traversable in both directions via supersedes / superseded_by

8. Deterministic Hashing

The content_hash field enables deduplication and integrity verification.

Algorithm

  1. Extract the content field
  2. Serialize deterministically:
    • Sort object keys lexicographically (recursive)
    • Use consistent number formatting (no trailing zeros)
    • No whitespace
    • Null values preserved (not omitted)
  3. Compute SHA-256 of the UTF-8 encoded serialized string
  4. Encode as lowercase hexadecimal

Pseudocode

content_hash = hex(sha256(utf8(deterministicJson(artifact.content))))

Two artifacts with the same content_hash represent the same compiled knowledge, regardless of when or where they were compiled.


9. JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hippocortex.dev/schemas/hmx-1.0/artifact.json",
  "title": "HMX Artifact",
  "type": "object",
  "required": [
    "hmx_version",
    "artifact_id",
    "artifact_type",
    "title",
    "summary",
    "content",
    "confidence",
    "status",
    "source_events",
    "source_memory_ids",
    "version",
    "created_at",
    "content_hash",
    "metadata"
  ],
  "properties": {
    "hmx_version": { "type": "string", "pattern": "^HMX-\\d+\\.\\d+$" },
    "artifact_id": { "type": "string", "minLength": 1 },
    "artifact_type": {
      "type": "string",
      "enum": ["task_schema", "failure_playbook", "decision_policy", "causal_pattern", "strategy_template"]
    },
    "title": { "type": "string", "minLength": 1 },
    "summary": { "type": "string" },
    "content": { "type": "object" },
    "confidence": { "type": "number", "minimum": 0.0, "maximum": 1.0 },
    "status": {
      "type": "string",
      "enum": ["draft", "active", "superseded", "deprecated", "archived"]
    },
    "source_events": { "type": "array", "items": { "type": "string" } },
    "source_memory_ids": { "type": "array", "items": { "type": "string" } },
    "version": { "type": "integer", "minimum": 1 },
    "created_at": { "type": "string", "format": "date-time" },
    "content_hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "metadata": { "type": "object" },
    "tenant_id": { "type": "string" },
    "agent_id": { "type": "string" },
    "superseded_by": { "type": "string" },
    "supersedes": { "type": "string" },
    "validity_scope": { "type": "object" },
    "tags": { "type": "array", "items": { "type": "string" } },
    "observed_count": { "type": "integer", "minimum": 0 },
    "success_rate": { "type": "number", "minimum": 0.0, "maximum": 1.0 },
    "updated_at": { "type": "string", "format": "date-time" }
  },
  "additionalProperties": false
}

10. Example Artifacts

Task Schema

{
  "hmx_version": "HMX-1.0",
  "artifact_id": "019e5a3b-8000-7000-8000-000000000001",
  "artifact_type": "task_schema",
  "title": "Deploy to Kubernetes Staging",
  "summary": "Standard procedure for deploying applications to the Kubernetes staging environment",
  "content": {
    "steps": [
      { "order": 1, "description": "Validate deployment manifest", "tools_used": ["kubectl"], "optional": false },
      { "order": 2, "description": "Check namespace exists", "tools_used": ["kubectl"], "optional": false },
      { "order": 3, "description": "Apply manifests", "tools_used": ["kubectl"], "optional": false },
      { "order": 4, "description": "Verify rollout status", "tools_used": ["kubectl"], "optional": false },
      { "order": 5, "description": "Run smoke tests", "tools_used": ["curl", "jest"], "optional": true }
    ],
    "preconditions": ["kubeconfig configured", "namespace exists"],
    "postconditions": ["pods running", "health check passes"],
    "tools_used": ["kubectl", "curl", "jest"],
    "estimated_complexity": "medium"
  },
  "confidence": 0.85,
  "status": "active",
  "source_events": ["evt-001", "evt-002", "evt-003"],
  "source_memory_ids": ["mem-001", "mem-002"],
  "version": 2,
  "created_at": "2026-03-14T03:00:00.000Z",
  "content_hash": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
  "metadata": { "compiled_by": "compiler-v2.1" },
  "tenant_id": "tenant-acme",
  "supersedes": "019e5a3b-7fff-7000-8000-000000000001",
  "tags": ["kubernetes", "deployment", "staging"],
  "observed_count": 15,
  "success_rate": 0.87
}

Decision Policy

{
  "hmx_version": "HMX-1.0",
  "artifact_id": "019e5a3b-8000-7000-8000-000000000002",
  "artifact_type": "decision_policy",
  "title": "Database Migration Strategy Selection",
  "summary": "Policy for choosing between online and offline database migrations",
  "content": {
    "condition": "Database migration needed with table size > 1GB",
    "recommendation": "Use online migration with pt-online-schema-change",
    "alternatives": [
      {
        "description": "Direct ALTER TABLE",
        "outcome": "Causes downtime on large tables",
        "chosen_count": 3,
        "success_rate": 0.33
      }
    ],
    "outcomes": [
      {
        "decision": "online migration",
        "outcome": "zero-downtime schema change",
        "positive": true,
        "source_memory_id": "mem-010"
      }
    ],
    "scope": ["database", "migration"]
  },
  "confidence": 0.92,
  "status": "active",
  "source_events": ["evt-010", "evt-011", "evt-012"],
  "source_memory_ids": ["mem-010", "mem-011"],
  "version": 1,
  "created_at": "2026-03-13T10:00:00.000Z",
  "content_hash": "b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3",
  "metadata": {},
  "tags": ["database", "migration", "decision"]
}

11. CompiledArtifact Mapping

HMX Artifact FieldCompiledArtifact FieldNotes
artifact_ididDirect mapping
artifact_typetypeSame enum values
titletitleDirect mapping
summarysummaryDirect mapping
content(type-specific fields)Flattened into nested content object
confidenceconfidenceDirect mapping
statusstatusSame enum values
source_eventsevidenceRefsRenamed
source_memory_idssourceMemoryIdsDirect mapping
version(new)Explicit version counter
content_hash(new)Deterministic integrity hash
superseded_bysupersededByDirect mapping
tagstagsDirect mapping
metadatametadataDirect mapping

12. Size Constraints

  • Maximum artifact size: 512 KB (JSON serialized)
  • Maximum content size: 256 KB
  • Maximum source_events count: 10,000
  • Maximum tags count: 64