{
  "canon_meta": {
    "canon_id": "devon-memory-architecture",
    "version": "1.0.0",
    "status": "ACTIVE",
    "model": "dynamic_partitioned_memory"
  },
  "memory_architecture": {
    "control_plane": {
      "required_components": [
        "memory_control_plane",
        "partition_registry",
        "memory_router",
        "memory_policy_engine",
        "retention_manager",
        "audit_writer"
      ],
      "primary_rule": "no_memory_write_without_resolved_scope"
    },
    "partition_classes": {
      "fixed_classes": [
        "global",
        "project",
        "run",
        "event",
        "artifact",
        "benchmark",
        "policy"
      ],
      "fixed_partition_count": false,
      "expansion_policy": "new partition classes may be added by canon version upgrade only"
    },
    "required_namespace_keys": [
      "project_id",
      "workspace_id",
      "run_id",
      "event_id",
      "artifact_id",
      "correlation_id"
    ],
    "routing_contract": {
      "required_write_context": [
        "writer_module",
        "scope_type",
        "scope_key",
        "project_id",
        "run_id",
        "event_id",
        "correlation_id",
        "memory_type",
        "retention_policy",
        "audit_required"
      ],
      "mandatory_behavior": [
        "reject_write_if_scope_unresolved",
        "reject_write_if_policy_forbids",
        "register_audit_event_on_write",
        "register_audit_event_on_read_if_required"
      ]
    },
    "partition_registry_contract": {
      "required_fields": [
        "memory_id",
        "memory_type",
        "scope_type",
        "scope_key",
        "owner_module",
        "backend_type",
        "read_policy",
        "write_policy",
        "retention_policy",
        "promotion_policy",
        "eviction_policy",
        "schema_version",
        "encryption_required",
        "audit_required",
        "status"
      ]
    },
    "backend_model": {
      "supported_backend_classes": [
        "structured_state",
        "vector_state",
        "cache_state",
        "artifact_state",
        "file_backed_state"
      ],
      "backend_selection_rule": "chosen_by_memory_type_and_policy"
    },
    "mandatory_policies": [
      "namespace_resolution_policy",
      "retention_policy",
      "eviction_policy",
      "read_policy",
      "write_policy",
      "audit_policy",
      "promotion_policy"
    ],
    "first_partitions_expected": [
      {
        "memory_id": "global-system",
        "scope_type": "global",
        "purpose": "global canon, policies, registry references"
      },
      {
        "memory_id": "project-devon",
        "scope_type": "project",
        "purpose": "Devon project architecture, decisions, contracts and promoted artifacts"
      },
      {
        "memory_id": "run-template",
        "scope_type": "run",
        "purpose": "execution-scoped decisions, plans, commands, outputs and errors"
      },
      {
        "memory_id": "event-template",
        "scope_type": "event",
        "purpose": "auditable events and correlations"
      },
      {
        "memory_id": "artifact-template",
        "scope_type": "artifact",
        "purpose": "files, specs, patches, configs and diffs"
      },
      {
        "memory_id": "benchmark-template",
        "scope_type": "benchmark",
        "purpose": "baselines, scores, regressions and promotion decisions"
      },
      {
        "memory_id": "policy-template",
        "scope_type": "policy",
        "purpose": "active rules, versions and exceptions"
      }
    ]
  },
  "status_rules": {
    "PASS": "router active, namespace rules loaded, audit path operational and write/read checks pass",
    "FAIL": "memory components exist but routing/validation/audit checks fail",
    "MISSING": "memory components or evidence do not exist observably"
  },
  "id": "memory_arch",
  "label": "Memory Canonical Architecture",
  "phase": "phase-08",
  "category": "memory_learning_reasoning",
  "status": "ACTIVE_DH_MIRROR",
  "purpose": "Define the governed architecture of DEVON-DEV memory before any remembered material can influence execution.",
  "function": "Separate governed memory from chat residue, cache, unscoped context and uncontrolled model state before memory can be used by retrieval, prompt assembly, reasoning or learning.",
  "technology_requirements": [
    {
      "technology": "Memory Service",
      "required_for": "Define the governed architecture of DEVON-DEV memory before any remembered material can influence execution.",
      "required_by_phase": "phase-08",
      "required_by_category": "memory_arch",
      "required_by_buckets": [
        "Prerequisites",
        "Installation",
        "Configuration",
        "Validation",
        "Observable Evidence",
        "Failure Modes & Recovery",
        "Completion & Promotion"
      ],
      "expected_version": "MISSING until Memory Service is implemented and connected to the Execution & Monitoring Panel",
      "validation_command": "MISSING until memory_arch can prove source, scope, status, evidence and decision linkage",
      "evidence_path": "/home/yeff/public_html/devon/canon/execution/state/dh_sources/memory_canonical_architecture.json",
      "status_source": "Documentation Hub + future Execution & Monitoring Panel",
      "blocking_if_missing": true,
      "failure_impact": "Without Memory Service, DEVON-DEV cannot prove which memory is safe to use."
    }
  ],
  "depends_on": [
    "sec",
    "memory_arch",
    "knowledge_ingestion",
    "knowledge_versioning",
    "memory_lifecycle",
    "learning_gov"
  ],
  "used_by": [
    "future_execution_monitoring_panel",
    "planning_reasoning",
    "tool_execution"
  ]
}
