eidetic-engine 0.15.2

Durable, local-first, explainable memory for coding agents.
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://eidetic-engine/schemas/ee.pack.v2.json",
  "title": "ee.pack.v2",
  "description": "Full canonical ee pack response envelope. The outer schema uses ee.response.v2; this schema pins the command-specific context-pack payload. The soft-deprecated ee context alias emits the same data.command value (pack) and adds a deprecated_alias degradation.",
  "type": "object",
  "required": ["schema", "success", "data", "degraded"],
  "additionalProperties": false,
  "properties": {
    "schema": {"type": "string", "const": "ee.response.v2"},
    "success": {"type": "boolean"},
    "fields": {"type": "string"},
    "data": {
      "type": "object",
      "required": ["command", "embed_backend", "request", "rerank", "pack", "degraded"],
      "additionalProperties": false,
      "properties": {
        "command": {"type": "string", "const": "pack"},
        "embed_backend": {"type": "string", "enum": ["neural_local", "hash_fallback"]},
        "request": {
          "type": "object",
          "required": [
            "query",
            "profile",
            "maxTokens",
            "candidatePool",
            "memoryScope",
            "strictScope",
            "sections"
          ],
          "additionalProperties": false,
          "properties": {
            "query": {"type": "string"},
            "profile": {"type": "string"},
            "maxTokens": {"type": "integer"},
            "candidatePool": {"type": "integer"},
            "maxResults": {"type": "integer", "minimum": 0},
            "memoryScope": {"type": "string"},
            "strictScope": {"type": "boolean"},
            "sections": {"type": "array", "items": {"type": "string"}}
          }
        },
        "scopeStats": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
        "rerank": {"$ref": "#/$defs/rerankPosture"},
        "consensus": {"type": "array", "items": {"$ref": "#/$defs/jsonValue"}},
        "conflicts": {"type": "array", "items": {"$ref": "#/$defs/jsonValue"}},
        "pagination": {
          "type": "object",
          "required": ["offset", "limit", "total", "hasMore", "nextCursor"],
          "additionalProperties": false,
          "properties": {
            "offset": {"type": "integer", "minimum": 0},
            "limit": {"type": "integer", "minimum": 0},
            "total": {"type": "integer", "minimum": 0},
            "hasMore": {"type": "boolean"},
            "nextCursor": {"type": ["string", "null"]}
          }
        },
        "pack": {
          "type": "object",
          "required": [
            "schema",
            "query",
            "budget",
            "items",
            "skipped",
            "skippedTotal",
            "provenanceFooter",
            "selectionAudit",
            "quality",
            "advisoryBanner"
          ],
          "additionalProperties": false,
          "properties": {
            "schema": {"type": "string", "const": "ee.pack.v2"},
            "query": {"type": "string"},
            "text": {"type": "string"},
            "meta": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "slo": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "budget": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "hash": {"type": ["string", "null"]},
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "rank",
                  "section",
                  "content",
                  "estimatedTokens",
                  "scores",
                  "why",
                  "provenance",
                  "trust"
                ],
                "oneOf": [
                  {"required": ["memoryId"]},
                  {
                    "required": [
                      "entityKind",
                      "evidenceSpanId",
                      "entityRevision",
                      "sessionId",
                      "startLine",
                      "endLine"
                    ],
                    "properties": {
                      "entityKind": {"const": "evidence_span"}
                    }
                  }
                ],
                "additionalProperties": false,
                "properties": {
                  "rank": {"type": "integer"},
                  "memoryId": {"type": "string"},
                  "entityKind": {"type": "string", "const": "evidence_span"},
                  "evidenceSpanId": {"type": "string", "pattern": "^ev_"},
                  "entityRevision": {"type": "string", "pattern": "^blake3:[0-9a-f]{64}$"},
                  "sessionId": {"type": "string"},
                  "startLine": {"type": "integer", "minimum": 1},
                  "endLine": {"type": "integer", "minimum": 1},
                  "section": {"type": "string"},
                  "content": {"type": "string"},
                  "contentRedacted": {"type": "boolean"},
                  "estimatedTokens": {"type": "integer"},
                  "scores": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
                  "why": {"type": "string"},
                  "provenance": {"type": "array", "items": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}}},
                  "freshnessFacets": {"type": "array", "items": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}}},
                  "redactions": {"type": "array", "items": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}}},
                  "trust": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
                  "selection": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "scoreBreakdown": {"$ref": "#/$defs/pprScoreBreakdown"}
                    }
                  },
                  "diversityKey": {"type": ["string", "null"]},
                  "selectedIn": {"type": "string"},
                  "lifecycle": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
                  "tokenCost": {"type": "integer"},
                  "feasible": {"type": "boolean"},
                  "coveredFeatures": {"type": "array", "items": {"type": "string"}},
                  "sourceIndex": {"type": "integer"}
                }
              }
            },
            "skipped": {"type": "array", "items": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}}},
            "skippedTotal": {"type": "integer"},
            "provenanceFooter": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "selectionAudit": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "coordination": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "mesh": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "packDna": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "agentProfile": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "deprecation": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "selectionCertificate": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "quality": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}},
            "advisoryBanner": {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}}
          }
        },
        "redaction": {"$ref": "#/$defs/redaction"},
        "degraded": {"type": "array", "items": {"$ref": "#/$defs/degradation"}}
      }
    },
    "degraded": {"type": "array", "items": {"$ref": "#/$defs/degradation"}}
  },
  "field_presets": {
    "minimal": ["command", "embed_backend", "query", "hash"],
    "summary": ["command", "embed_backend", "request", "pack", "budget", "quality", "pagination", "degraded"],
    "standard": ["command", "embed_backend", "request", "pack", "items", "pagination", "degraded"],
    "full": ["*"]
  },
  "$defs": {
    "degradation": {
      "type": "object",
      "required": ["code", "severity", "message"],
      "additionalProperties": false,
      "properties": {
        "code": {"type": "string"},
        "severity": {"type": "string", "enum": ["info", "low", "warning", "medium", "high", "critical"]},
        "message": {"type": "string"},
        "repair": {"type": ["string", "null"]},
        "repairKind": {
          "type": "string",
          "enum": ["actionable", "template", "placeholder", "unknown", "empty"]
        },
        "sources": {"type": "array", "items": {"type": "string"}},
        "details": {
          "type": "object",
          "additionalProperties": {"$ref": "#/$defs/jsonValue"}
        }
      }
    },
    "redaction": {
      "type": "object",
      "required": ["level_applied", "level_source", "fields_redacted", "patterns_matched"],
      "additionalProperties": false,
      "properties": {
        "level_applied": {"type": "string"},
        "level_source": {"type": "string"},
        "fields_redacted": {"type": "array", "items": {"type": "string"}},
        "patterns_matched": {"type": "array", "items": {"type": "string"}}
      }
    },
    "rerankPosture": {
      "type": "object",
      "required": [
        "schema",
        "mode",
        "configured",
        "topK",
        "rerankScoreCount",
        "scoreKind",
        "available",
        "degradedCode",
        "advisory",
        "advisorySummary"
      ],
      "additionalProperties": false,
      "properties": {
        "schema": {"type": "string", "const": "ee.rerank_posture.v1"},
        "mode": {"type": "string", "enum": ["reranked", "fusion_only", "fusion_only_degraded"]},
        "configured": {"type": "string", "enum": ["auto", "off"]},
        "topK": {"type": "integer", "minimum": 1},
        "rerankScoreCount": {"type": "integer", "minimum": 0},
        "scoreKind": {"type": "string", "enum": ["rrf_fused", "reranked"]},
        "available": {"type": "boolean"},
        "degradedCode": {"enum": ["rerank_model_unavailable", null]},
        "advisory": {
          "oneOf": [
            {"type": "null"},
            {"$ref": "#/$defs/permanentRerankAdvisory"},
            {"$ref": "#/$defs/transientRerankAdvisory"}
          ]
        },
        "advisorySummary": {"$ref": "#/$defs/rerankAdvisorySummary"}
      }
    },
    "permanentRerankAdvisory": {
      "type": "object",
      "required": ["code", "severity", "permanent", "message", "repair", "resolution"],
      "additionalProperties": false,
      "properties": {
        "code": {"type": "string", "const": "rerank_model_unavailable"},
        "severity": {"type": "string", "enum": ["info", "low", "warning", "medium", "high", "critical"]},
        "permanent": {"type": "boolean", "const": true},
        "message": {"type": "string", "minLength": 1},
        "repair": {"type": "null"},
        "resolution": {"type": "string", "const": "automatic_repair_unavailable"}
      }
    },
    "transientRerankAdvisory": {
      "type": "object",
      "required": ["code", "severity", "permanent", "message", "repair", "resolution"],
      "additionalProperties": false,
      "properties": {
        "code": {"type": "string", "const": "rerank_model_unavailable"},
        "severity": {"type": "string", "enum": ["info", "low", "warning", "medium", "high", "critical"]},
        "permanent": {"type": "boolean", "const": false},
        "message": {"type": "string", "minLength": 1},
        "repair": {"type": ["string", "null"]},
        "resolution": {"type": "string", "const": "retry_or_inspect_local_registry"}
      }
    },
    "rerankAdvisorySummary": {
      "type": "object",
      "required": [
        "scope",
        "permanent",
        "distinctCount",
        "emittedCount",
        "suppressedCount",
        "sessionOccurrenceCount",
        "sessionSuppressedCount"
      ],
      "additionalProperties": false,
      "properties": {
        "scope": {"type": "string", "enum": ["invocation", "process", "response"]},
        "permanent": {"type": ["boolean", "null"]},
        "distinctCount": {"type": "integer", "minimum": 0},
        "emittedCount": {"type": "integer", "minimum": 0},
        "suppressedCount": {"type": "integer", "minimum": 0},
        "sessionOccurrenceCount": {"type": "integer", "minimum": 0},
        "sessionSuppressedCount": {"type": "integer", "minimum": 0}
      }
    },
    "jsonValue": {
      "oneOf": [
        {"type": "null"},
        {"type": "boolean"},
        {"type": "number"},
        {"type": "string"},
        {"type": "array", "items": {"$ref": "#/$defs/jsonValue"}},
        {"type": "object", "additionalProperties": {"$ref": "#/$defs/jsonValue"}}
      ]
    },
    "pprScoreBreakdown": {
      "type": "object",
      "required": ["textScore", "pprScore", "combinedScore"],
      "additionalProperties": false,
      "properties": {
        "textScore": {"type": "number", "minimum": 0.0, "maximum": 1.0},
        "pprScore": {"type": "number", "minimum": 0.0, "maximum": 1.0},
        "combinedScore": {"type": "number", "minimum": 0.0, "maximum": 1.0}
      }
    }
  }
}