Skip to main content

Cortex

Cortex is an experimental memory-maintenance surface. In the current backend it is disabled by default unless NOVYX_ENABLE_EXPERIMENTAL=1 is set. Core marks it experimental because autonomous insights are template-based and consolidation/decay behavior is not covered by an end-to-end production test.

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

Availability: Experimental and off by default. Requires NOVYX_ENABLE_EXPERIMENTAL=1 before tier checks apply. Cortex features are Pro+ when enabled; insights require Enterprise.

Backend: Requires Postgres


Run Cortex Cycle

POST /v1/cortex/run

Trigger a manual Cortex cycle when the experimental router is enabled. The response reports consolidation, reinforcement, decay, and insight counters from the run.

  • 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: Returns template-based synthetic memory insights when enabled (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
403novyx_ram.v1.experimental.disabledCortex is disabled unless NOVYX_ENABLE_EXPERIMENTAL=1
403FEATURE_NOT_AVAILABLERequires Pro+ plan
501REQUIRES_POSTGRESPostgres backend required

Get Cortex Status

GET /v1/cortex/status

Get Cortex status, including whether the tenant-level Cortex config is enabled, the last run timestamp, and run statistics. The endpoint itself is still blocked unless experimental features are enabled.

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
403novyx_ram.v1.experimental.disabledCortex is disabled unless NOVYX_ENABLE_EXPERIMENTAL=1
403FEATURE_NOT_AVAILABLERequires Pro+ plan
501REQUIRES_POSTGRESPostgres backend required

Get Cortex Config

GET /v1/cortex/config

Retrieve the current Cortex configuration when the experimental router is enabled.

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
403novyx_ram.v1.experimental.disabledCortex is disabled unless NOVYX_ENABLE_EXPERIMENTAL=1
403FEATURE_NOT_AVAILABLERequires Pro+ plan
501REQUIRES_POSTGRESPostgres backend required

Update Cortex Config

PATCH /v1/cortex/config

Update Cortex configuration when the experimental router is enabled. 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
403novyx_ram.v1.experimental.disabledCortex is disabled unless NOVYX_ENABLE_EXPERIMENTAL=1
403FEATURE_NOT_AVAILABLERequires Pro+ plan or Enterprise for insights
501REQUIRES_POSTGRESPostgres backend required

List Insights

GET /v1/cortex/insights

List synthetic insight memories created by Cortex when the experimental router is enabled. Treat these as memory-maintenance hints, not autonomous production recommendations.

Enterprise only

Insight generation requires Enterprise after experimental features are enabled. Enable the tenant config 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
403novyx_ram.v1.experimental.disabledCortex is disabled unless NOVYX_ENABLE_EXPERIMENTAL=1
403FEATURE_NOT_AVAILABLERequires Enterprise plan
501REQUIRES_POSTGRESPostgres backend required