Skip to main content

POST /v1/deep-memory

Uses the full retrieval pipeline to answer a focused memory question.

Request body

{
  "user_id": "user-123",
  "query": "What testing framework does this user prefer?",
  "containers": [
    {
      "id": "thread-abc",
      "type": "thread"
    }
  ],
  "scope_level": "user_global_container",
  "read_mode": "deep",
  "budgets": {
    "max_output_tokens": 500,
    "max_candidate_memories": 40
  },
  "metadata": {
    "trace_id": "trace-003"
  }
}

Request fields

FieldTypeRequiredNotes
user_idstringYesUser identity whose memory should be searched.
querystringYesFocused memory question.
containersContainerHint[]NoOptional container hints used when scope_level includes container memory.
scope_leveluser | user_global | user_global_containerNoDefaults to user_global.
read_modesimple | balanced | deepNoDefaults to balanced, though deep is typical here.
budgetsRetrievalBudgetsNoDefaults to max_output_tokens=500 and max_candidate_memories=40 for this endpoint.
metadataRequestMetadataNoOptional host metadata.

ContainerHint

FieldTypeRequiredNotes
idstringYesContainer identifier.
typestring | nullNoInformational container type.

RetrievalBudgets

FieldTypeRequiredNotes
max_output_tokensintegerNoDefaults to 500. Range: 1-4000.
max_candidate_memoriesintegerNoDefaults to 40. Range: 1-200.

RequestMetadata

FieldTypeRequiredNotes
appstring | nullNoHost application name.
sourcestring | nullNoSource channel name.
modelstring | nullNoUpstream model identifier.
trace_idstring | nullNoTrace or correlation id.

Response

{
  "status": "ok",
  "answer": "Based on stored memory, the user prefers pytest over unittest.",
  "abstained": false,
  "abstained_reason": null,
  "used_memory_count": 1,
  "diagnostics": {
    "scope_applied": "user_global_container",
    "read_mode": "deep",
    "user_found": true,
    "candidate_count": 12,
    "used_memory_count": 1,
    "missing_containers": [],
    "source_breakdown": {
      "snapshot": 2,
      "vector": 5,
      "metadata": 4,
      "graph": 1
    },
    "evidence_strength": 0.82,
    "warnings": []
  },
  "evidence": [
    {
      "memory_id": "mem-123",
      "scope_type": "user",
      "bucket_id": null,
      "relevance": 0.88,
      "support": 0.91,
      "relation_refs": [],
      "entity_refs": []
    }
  ]
}

Notes

  • The endpoint must stay grounded in retrieved evidence.
  • If evidence is weak or conflicting, it may abstain.
  • evidence references the memories used to support the answer.
  • Public diagnostics are relevance-gated. If no relevant memory survives filtering, the endpoint abstains directly instead of exposing unrelated scoped memories.

Response field notes

FieldTypeAlways presentNotes
statusstringYesUsually ok, or not_found when the user does not exist.
answerstringYesGrounded answer, or a fallback abstention answer when evidence is insufficient.
abstainedbooleanYesWhether aCMF declined to answer confidently.
abstained_reasonstring | nullYesExplains abstention when present.
used_memory_countintegerYesNumber of memories actually used in the final answer.
diagnosticsRetrievalDiagnosticsYesRetrieval summary for the request.
evidenceEvidenceItem[]YesExplicit grounding evidence for the answer.