Skip to main content

Cortex

The Cortex is Novyx's autonomous memory maintenance engine. It consolidates duplicate memories, reinforces frequently-recalled ones, decays stale memories, and generates AI-powered insights. You can configure each behavior independently and trigger cycles manually or let them run on schedule.

Base URL: https://novyx-ram-api.fly.dev

Tier: Pro+ (Insights require Enterprise)

Backend: Requires Postgres


Run Cortex Cycle

POST /v1/cortex/run

Trigger a manual Cortex cycle. Runs consolidation, reinforcement, and decay in sequence, then generates insights if enabled.

  • Consolidation: Merges memories above the similarity threshold (default 90%)
  • Reinforcement: Boosts importance of frequently-recalled memories
  • Decay: Reduces importance of old, unused memories past the decay age
  • Insights: Generates synthetic memories from detected patterns (Enterprise only)

Response fields

FieldTypeDescription
consolidatednumberDuplicate memories merged
boostednumberMemories with boosted importance
decayednumberMemories with reduced importance
insights_generatednumberNew insight memories created

Examples

from novyx import Novyx

nx = Novyx(api_key="nram_your_key")

result = nx.cortex_run()
print(f"Consolidated: {result['consolidated']}")
print(f"Boosted: {result['boosted']}")
print(f"Decayed: {result['decayed']}")
print(f"Insights: {result['insights_generated']}")

Response

{
"consolidated": 3,
"boosted": 12,
"decayed": 5,
"insights_generated": 2
}

Errors

StatusCodeCause
403FEATURE_NOT_AVAILABLERequires Pro+ plan
501REQUIRES_POSTGRESPostgres backend required

Get Cortex Status

GET /v1/cortex/status

Get the current Cortex status including whether it's enabled, the last run timestamp, and run statistics.

Response fields

FieldTypeDescription
enabledbooleanWhether Cortex is enabled
last_run_atstring | nullLast run timestamp (ISO 8601)
run_statsobjectOperation counts from last run
configobjectCurrent Cortex configuration (see below)

Examples

status = nx.cortex_status()
print(f"Enabled: {status['enabled']}")
print(f"Last run: {status['last_run_at']}")

Response

{
"enabled": true,
"last_run_at": "2026-03-09T06:00:00Z",
"run_stats": {
"consolidated": 3,
"boosted": 12,
"decayed": 5,
"insights_generated": 0
},
"config": {
"tenant_id": "tenant_abc123",
"enabled": true,
"consolidation_enabled": true,
"consolidation_threshold": 0.90,
"reinforcement_enabled": true,
"decay_enabled": true,
"decay_age_days": 30,
"insight_generation_enabled": false,
"last_run_at": "2026-03-09T06:00:00Z",
"run_stats": {}
}
}

Errors

StatusCodeCause
403FEATURE_NOT_AVAILABLERequires Pro+ plan
501REQUIRES_POSTGRESPostgres backend required

Get Cortex Config

GET /v1/cortex/config

Retrieve the current Cortex configuration.

Response fields

FieldTypeDescription
tenant_idstringYour tenant ID
enabledbooleanWhether Cortex is enabled
consolidation_enabledbooleanMerge duplicate memories
consolidation_thresholdnumberSimilarity threshold for merging (0.5–1.0)
reinforcement_enabledbooleanBoost frequently-recalled memories
decay_enabledbooleanDecay old, unused memories
decay_age_daysnumberDays before decay kicks in (1–365)
insight_generation_enabledbooleanGenerate AI insights (Enterprise only)
last_run_atstring | nullLast run timestamp
run_statsobjectLast run statistics

Examples

config = nx.cortex_config()
print(f"Consolidation threshold: {config['consolidation_threshold']}")
print(f"Decay after: {config['decay_age_days']} days")

Response

{
"tenant_id": "tenant_abc123",
"enabled": true,
"consolidation_enabled": true,
"consolidation_threshold": 0.90,
"reinforcement_enabled": true,
"decay_enabled": true,
"decay_age_days": 30,
"insight_generation_enabled": false,
"last_run_at": "2026-03-09T06:00:00Z",
"run_stats": {}
}

Errors

StatusCodeCause
403FEATURE_NOT_AVAILABLERequires Pro+ plan
501REQUIRES_POSTGRESPostgres backend required

Update Cortex Config

PATCH /v1/cortex/config

Update Cortex configuration. Send only the fields you want to change.

Request body

ParameterTypeRequiredDefaultDescription
enabledbooleanNoEnable or disable Cortex
consolidation_enabledbooleanNoEnable/disable consolidation
consolidation_thresholdnumberNoSimilarity threshold (0.5–1.0)
reinforcement_enabledbooleanNoEnable/disable reinforcement
decay_enabledbooleanNoEnable/disable decay
decay_age_daysnumberNoDays before decay (1–365)
insight_generation_enabledbooleanNoEnable insights (Enterprise only)

Examples

# Lower the consolidation threshold
updated = nx.update_cortex_config(
consolidation_threshold=0.85,
decay_age_days=14,
)

# Disable decay
updated = nx.update_cortex_config(decay_enabled=False)

Errors

StatusCodeCause
403FEATURE_NOT_AVAILABLERequires Pro+ plan or Enterprise for insights
501REQUIRES_POSTGRESPostgres backend required

List Insights

GET /v1/cortex/insights

List AI-generated insight memories created by the Cortex. These are synthetic memories derived from patterns detected across your memory store.

Enterprise only

Insight generation requires an Enterprise plan. Enable it via PATCH /v1/cortex/config.

Query parameters

ParameterTypeRequiredDefaultDescription
limitnumberNo20Max results (1–100)
offsetnumberNo0Pagination offset

Response fields

FieldTypeDescription
insightsarrayArray of insight memory objects
totalnumberTotal insight count

Each insight includes:

FieldTypeDescription
uuidstringInsight memory identifier
observationstringGenerated insight text
tagsstring[]Auto-generated tags
importancenumberAssigned importance score
created_atstringGeneration timestamp

Examples

insights = nx.cortex_insights(limit=10)
for insight in insights["insights"]:
print(f"[{insight['importance']}] {insight['observation']}")

Response

{
"insights": [
{
"uuid": "urn:uuid:i1a2b3c4-d5e6-7890-abcd-ef1234567890",
"observation": "User consistently prefers dark themes across all applications and adjusts font sizes for readability",
"tags": ["insight", "preferences", "ui"],
"importance": 7,
"created_at": "2026-03-09T06:00:00Z"
}
],
"total": 5
}

Errors

StatusCodeCause
403FEATURE_NOT_AVAILABLERequires Enterprise plan
501REQUIRES_POSTGRESPostgres backend required