Skip to content

Temporal Reasoning

advanced

Temporal Granger causality: predict next patterns, get temporal graph, test causality, and find successors.

Temporal predict

POST/v1/memory/temporal/predict

Predict next patterns via temporal Granger causality.

queryarray[number]required

Current pattern embedding.

min_strengthnumberDefault: 0.5

Minimum causal strength to include (0.0–1.0).

200Response
{
  "predictions": [
    {
      "predicted_key": [
        0.23,
        -0.45,
        0.67,
        "..."
      ],
      "strength": 0.82,
      "lag": 1,
      "metadata": {
        "category": "science"
      }
    },
    {
      "predicted_key": [
        0.12,
        0.34,
        -0.56,
        "..."
      ],
      "strength": 0.65,
      "lag": 2,
      "metadata": null
    }
  ]
}

Temporal graph

GET/v1/memory/temporal/graph

Get the full temporal causal graph with all links and strengths.

200Response
{
  "links": [
    {
      "from_hash": 12345,
      "to_hash": 67890,
      "strength": 0.82,
      "lag": 1
    },
    {
      "from_hash": 67890,
      "to_hash": 11223,
      "strength": 0.65,
      "lag": 2
    }
  ],
  "n_patterns": 45,
  "min_strength_used": 0.3
}

Temporal test

POST/v1/memory/temporal/test

Test if A Granger-causes B with the best lag.

key_aarray[number]required

First pattern embedding.

key_barray[number]required

Second pattern embedding.

200Response
{
  "granger_causes": true,
  "best_lag": 1,
  "strength": 0.78,
  "p_value": 0.003
}

Temporal successors

POST/v1/memory/temporal/successors

Get all temporal successors of a pattern.

keyarray[number]required

Pattern embedding.

200Response
{
  "successors": [
    {
      "key": [
        0.23,
        -0.45,
        "..."
      ],
      "strength": 0.82,
      "lag": 1
    },
    {
      "key": [
        0.56,
        0.12,
        "..."
      ],
      "strength": 0.61,
      "lag": 3
    }
  ]
}

Prefetch status

GET/v1/memory/temporal/prefetch

Get prefetch cache status and hit rate.

200Response
{
  "cache_size": 128,
  "hit_rate": 0.73,
  "total_hits": 1456,
  "total_misses": 534,
  "prefetched_patterns": 42,
  "avg_latency_prefetched_ms": 1.2,
  "avg_latency_normal_ms": 8.5,
  "speedup_factor": 7.08
}

Next steps