CoolFace
Apppublic

barissozudogru/cortex-ai-primitives

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
App README

Cortex AI - cognitive primitives for LLM agents

Three live demos of the cognitive primitives that move an agent's context layer beyond a filing-cabinet store. Each tab is also exposed as an MCP tool so an LLM agent can call the same logic directly.

The algorithms are ported from cortex-ai, a proactive MCP-server context engine for macOS. The live system reads from a local SQLite database populated by connectors that watch calendar, screen, git, shell, and browser activity. This Space substitutes a curated synthetic dataset so the primitives can be exercised in a public sandbox.

What's in here

TabQuestion it answers
Forgetting curvesWhat does the user still remember, and when does each fact fall below useful recall?
Negative-space retrievalWhat entities historically co-occur with the current work frame but are absent right now?
Hippocampal consolidationCompress this stream of episodes into a smaller set of semantic capsules.

Why this matters for agents

A long-context window is not memory. Real cognitive memory has structure: it decays at predictable rates, it surfaces the most salient gap when reasoning about a familiar pattern, and it consolidates fine-grained moments into reusable abstractions during idle periods. An agent that treats its context as a flat lookup table inherits none of those properties.

Each primitive here is a deliberate slice of human cognition retargeted at machine context:

  • Forgetting curves prevent re-surfacing facts the user just saw, and identify staleness before retrieval quality drops. Anderson (1991) ACT-R activation, log-exposure stability per Wozniak/Anderson.
  • Negative-space retrieval turns absences into evidence. If JWT and refresh_token are active but CSRF is missing despite a 0.55 historical co-occurrence, the agent should ask why.
  • Consolidation mirrors hippocampal replay: episodic events get distilled into reusable semantic capsules so downstream retrieval reads a few capsules instead of thousands of raw events.

MCP usage

Add this Space to your MCP client config:

json
{
  "mcpServers": {
    "cortex-primitives": {
      "url": "https://barissozudogru-cortex-ai-primitives.hf.space/gradio_api/mcp/sse"
    }
  }
}

Three tools become available:

  • compute_forgetting(items, horizon_days) - project retention probability over a horizon for a list of items.
  • find_negative_space(active_entities, min_probability, min_significance, limit) - surface ranked ghost entities for a given work frame.
  • consolidate_episodes(episodes, distance_threshold) - cluster episodes into semantic capsules.

Cold start

This Space sleeps when idle. First request after a quiet period takes 30-60 seconds for the container to wake up. Subsequent requests are fast.

Citations

  • Anderson, J. R. (1991). The Adaptive Nature of Human Categorization. Psychological Review 98(3).
  • Luhn, H. P. (1958). The automatic creation of literature abstracts. IBM Journal of Research and Development 2(2).
  • Wozniak, P. A. (1990). Optimization of learning. Repetition spacing PhD foundation.
  • Ebbinghaus, H. (1885). Über das Gedächtnis. (English translation 1913, Teachers College Press.)
  • Agrawal, R. & Srikant, R. (1994). Fast algorithms for mining association rules. VLDB.

Related