Documentation
Memory Policies
Dashboard

API Documentation

Scoped extraction policy layer for controlling what becomes memory, with default resolution, per-request overrides, and configurable quality thresholds.

Memory Policies
GETpoliciesPOSTpoliciesGET:idPATCH:idDELETE:idGETresolve

Overview

Memory Policies control what Mnexium is allowed to extract and save as memory whenlearn is enabled. They do not change recall ranking directly; they shape the memory set that exists over time.

project
scope
Baseline policy for the whole project.
subject
scope
Applies only when the request includes a matching subject_id.
chat
scope
Applies only when the request includes a matching chat_id.

Default resolution is scope-aware: active default policies are resolved in the order project → subject → chat. Policy text is concatenated in that order, and config is merged so later scopes override earlier keys.

Override resolution per request with mnx.memory_policy orx-mnx-memory-policy:true or omitted auto-resolves, false disables policy application, and a string selects one explicit policy ID.

Supported Config Keys

include_kinds
string[]
Allow only specific extracted memory kinds before persistence. Common values includefact, preference,context, note,event, and trait.
exclude_kinds
string[]
Block specific kinds even if the extractor proposes them.
confidence_min
number
Minimum extraction confidence from 0.0 to 1.0.
importance_min
number
Minimum importance score from 0 to 100.
max_memories_per_turn
number
Caps the number of memories persisted from one turn after filtering. Range: 1 to 50.
GET/api/v1/memory/policies

List memory policies for the current project.

Scope:memory_policies:read
scope
string
Optional filter: project, subject, or chat.
include_inactive
boolean
Include inactive policies when true.
Request
bash
curl -G "https://www.mnexium.com/api/v1/memory/policies" \
  -H "x-mnexium-key: $MNX_KEY" \
  --data-urlencode "scope=project"
Response
json
{
  "policies": [
    {
      "id": "mp_support_assistant",
      "name": "Support Assistant Default",
      "policy_text": "Extract stable preferences and durable support context. Skip greetings and transient phrasing.",
      "scope": "project",
      "scope_id": "",
      "is_active": 1,
      "is_default": 1,
      "priority": 100,
      "config": {
        "include_kinds": ["fact", "preference", "note"],
        "confidence_min": 0.72,
        "importance_min": 45,
        "max_memories_per_turn": 3
      }
    }
  ]
}
POST/api/v1/memory/policies

Create a new memory policy. Set is_default to have it participate in automatic scoped resolution.

Scope:memory_policies:write
namerequired
string
Display name for the policy.
policy_textrequired
string
Instruction text used by the extraction pipeline.
scope
string
One of: project, subject, chat. Default: project
scope_id
string
Required if scope is subject or chat.
id
string
Optional custom policy ID. If omitted, Mnexium generates an mp_... ID.
is_active
boolean
Whether this policy is active. Default: true
is_default
boolean
Marks this policy as the default for its exact scope + scope_id. Existing defaults at that same level are unset automatically.
priority
number
Lower values resolve earlier within the same scope. Default: 100
config
object
Optional filter config: include_kinds, exclude_kinds, confidence_min, importance_min, max_memories_per_turn.
metadata
object
Optional project-defined metadata.
Request
bash
curl -X POST "https://www.mnexium.com/api/v1/memory/policies" \
  -H "x-mnexium-key: $MNX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "mp_support_assistant",
    "name": "Support Assistant Default",
    "policy_text": "Extract stable customer preferences, known constraints, and standing instructions. Ignore pleasantries and one-off wording.",
    "scope": "project",
    "is_default": true,
    "priority": 100,
    "config": {
      "include_kinds": ["fact", "preference", "note"],
      "exclude_kinds": ["event"],
      "confidence_min": 0.72,
      "importance_min": 45,
      "max_memories_per_turn": 3
    },
    "metadata": { "team": "support" }
  }'
Response
json
{
  "ok": true,
  "policy": {
    "id": "mp_support_assistant",
    "projectId": "proj_123",
    "name": "Support Assistant Default",
    "scope": "project",
    "scopeId": ""
  }
}
GET/api/v1/memory/policies/:id

Fetch a single memory policy by ID.

Scope:memory_policies:read
idrequired
path
The memory policy ID.
Request
bash
curl "https://www.mnexium.com/api/v1/memory/policies/mp_support_assistant" \
  -H "x-mnexium-key: $MNX_KEY"
Response
json
{
  "policy": {
    "id": "mp_support_assistant",
    "name": "Support Assistant Default",
    "policy_text": "Extract stable customer preferences, known constraints, and standing instructions. Ignore pleasantries and one-off wording.",
    "scope": "project",
    "scope_id": "",
    "is_active": 1,
    "is_default": 1,
    "priority": 100,
    "config": { "include_kinds": ["fact", "preference", "note"] },
    "metadata": { "team": "support" }
  }
}
PATCH/api/v1/memory/policies/:id

Update a memory policy. Only provided fields are changed.

Scope:memory_policies:write
idrequired
path
The memory policy ID to update.
name
string
New display name.
policy_text
string
Replacement policy instructions.
scope
string
New scope: project, subject, or chat.
scope_id
string
Required when moving to subject or chat scope.
is_active
boolean
Enable or disable the policy.
is_default
boolean
Set or unset the default flag for this scope level.
priority
number
Lower resolves earlier within the same scope.
config
object
Replace the stored config object.
metadata
object
Replace the stored metadata object.
Request
bash
curl -X PATCH "https://www.mnexium.com/api/v1/memory/policies/mp_support_assistant" \
  -H "x-mnexium-key: $MNX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "policy_text": "Extract stable preferences and operational constraints. Avoid transient scheduling chatter.",
    "config": {
      "include_kinds": ["fact", "preference", "note"],
      "confidence_min": 0.8,
      "importance_min": 50,
      "max_memories_per_turn": 2
    }
  }'
Response
json
{
  "ok": true,
  "id": "mp_support_assistant",
  "projectId": "proj_123",
  "updated": true
}
DELETE/api/v1/memory/policies/:id

Soft-delete a memory policy. It becomes inactive and stops participating in resolution.

Scope:memory_policies:delete
idrequired
path
The memory policy ID to delete.
Request
bash
curl -X DELETE "https://www.mnexium.com/api/v1/memory/policies/mp_support_assistant" \
  -H "x-mnexium-key: $MNX_KEY"
Response
json
{
  "ok": true,
  "deleted": true
}
GET/api/v1/memory/policies/resolve

Preview which memory policies apply to a context, or fetch the combined effective text/config.

Scope:memory_policies:read
subject_id
string
Include subject-scoped policies for this subject.
chat_id
string
Include chat-scoped policies for this chat.
default_only
boolean
When true, only return policies marked as default. This matches request-time auto-resolution behavior.
combined
boolean
When true, return concatenated policy_text, merged config, and resolved policy_ids.
Request
bash
curl -G "https://www.mnexium.com/api/v1/memory/policies/resolve" \
  -H "x-mnexium-key: $MNX_KEY" \
  --data-urlencode "subject_id=user_123" \
  --data-urlencode "chat_id=550e8400-e29b-41d4-a716-446655440000" \
  --data-urlencode "default_only=true" \
  --data-urlencode "combined=true"
Response
json
// When combined=true:
{
  "policy_text": "Extract stable customer preferences.\n\nPrioritize support constraints for this user.\n\nKeep only current workflow notes for this chat.",
  "has_policy": true,
  "policy_ids": ["mp_project_default", "mp_subject_support", "mp_chat_triage"],
  "config": {
    "include_kinds": ["fact", "preference", "note"],
    "confidence_min": 0.8,
    "importance_min": 50,
    "max_memories_per_turn": 2
  }
}

// When combined=false:
{
  "policies": [
    { "id": "mp_project_default", "scope": "project", ... },
    { "id": "mp_subject_support", "scope": "subject", ... },
    { "id": "mp_chat_triage", "scope": "chat", ... }
  ],
  "count": 3
}

Request-Level Usage

Use request overrides when you need a one-off extraction mode without changing the stored defaults for the project, subject, or chat.

// Auto-resolve defaults for the current subject/chat context
"mnx": { "subject_id": "user_123", "chat_id": "550e8400-e29b-41d4-a716-446655440000", "learn": true }

// Force one explicit policy
"mnx": { "subject_id": "user_123", "learn": true, "memory_policy": "mp_support_assistant" }

// Disable policy application but keep learning enabled
"mnx": { "subject_id": "user_123", "learn": true, "memory_policy": false }

// Header fallback for provider-native SDKs
"x-mnx-memory-policy: mp_support_assistant"