Skip to main content

A self-healing knowledge graph memory layer for AI agents powered by Reinforcement Learning.

Project description

GraphCortex Logo

GraphCortex

The self-healing memory layer for AI agents.
A knowledge graph that autonomously cleans, merges, and optimizes itself—powered by reinforcement learning.

Quickstart  ·  How it works  ·  RL Training

GraphCortex Demo


The Problem

Most AI agent memory is passive. You store what goes in, return what's asked for, and watch it degrade silently over time. Run any autonomous agent long enough and you hit three walls:

  1. Fragmentation: Automated extraction creates duplicate or contradictory nodes.
  2. Context Rot: Stale information corrupts retrieval and confuses the LLM.
  3. Blind Spots: Standard vector search misses multi-hop structural relationships.

Enter GraphCortex

GraphCortex is a memory layer that doesn't just store information — it restructures itself.

Built on FalkorDB, it runs a swarm of concurrent agents that continuously curate, connect, and optimize your agent's knowledge graph in the background using Reinforcement Learning.

Core Features

  • 🧠 RL-Driven Curation (The Librarian): A background PyTorch policy loop observes the graph state and autonomously decides to add bridging concepts, boost confidence on weak nodes, or soft-delete stale ones.
  • A-Guided Retrieval (The Researcher):* Bypasses dense noise clusters using hybrid search (BM25 + Vector) combined with Structural Edge-Weighting. It penalizes weak connections and aggressively pursues high-value paths.
  • 🔄 Async Consolidation (The Summarizer): Automatically extracts entities and relationships from every interaction and wires them into a persistent episodic timeline.
  • 🛡️ Memory Immutability: Core factual properties are blocked from unauthorized modification at the environment level, ensuring graph structural integrity while metadata (heat, access counts) remains fluid.

Quickstart

GraphCortex deploys FalkorDB + the Swarm CLI. Works seamlessly on Mac (Apple Silicon/Intel), Linux, and Windows (WSL2).

git clone https://github.com/anonimity69/GraphCortex.git
cd GraphCortex

# Add your LLM provider key
cp .env.example .env

# Start the swarm
chmod +x setup.sh shutdown.sh
./setup.sh
Action Command
Start ./setup.sh
Stop ./shutdown.sh
Visualizer localhost:3000 (FalkorDB Browser)

The setup script handles port conflicts, waits for the DB to stabilize, and drops you straight into the interactive CLI.


Architecture Under the Hood

GraphCortex operates on a unified :Searchable graph schema to prevent node fragmentation across different memory episodes.

graph TD
    User([User]) <--> CLI[Swarm CLI]
    
    subgraph Swarm[GraphCortex Swarm]
        Researcher[Researcher]
        Summarizer[Summarizer]
        Librarian[Librarian]
    end
    
    CLI <--> Researcher
    Researcher --> RetrievalEngine[Retrieval Engine]
    RetrievalEngine --> AStar[A* Traversal]
    RetrievalEngine --> Inhibition[Lateral Inhibition]
    
    CLI --> Summarizer
    Summarizer --> Ingestion[Memory Ingestion]
    
    Librarian --> RL[RL Policy]
    RL --> GraphOps[Merge / Prune / Strengthen]
    
    subgraph Infra[Infrastructure]
        FalkorDB[(FalkorDB)]
        LLM[LLM API]
    end
    
    RetrievalEngine <--> FalkorDB
    Ingestion --> FalkorDB
    GraphOps --> FalkorDB
    Researcher <--> LLM
    Summarizer <--> LLM
    Librarian <--> LLM

CLI Commands

Manage your swarm directly from the terminal:

/data     # View graph + dataset stats
/train    # Run RL training (HotpotQA)
/curate   # Trigger librarian manually
/monitor  # View librarian metrics
/clear    # Start a new session
/exit     # Shutdown gracefully

Built for agents that need to think longer than one conversation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphcortex-0.2.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphcortex-0.2.0-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file graphcortex-0.2.0.tar.gz.

File metadata

  • Download URL: graphcortex-0.2.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for graphcortex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d64b507005817e44fc8d59174c33c211713213ffb1cc3be348170bbe7dbc0f90
MD5 3134f1d741b28f597ec8daae86c93879
BLAKE2b-256 424a283ee03c78dc89cbbef80a64677021cfb53e741b00205d7c9b27ed999ef4

See more details on using hashes here.

File details

Details for the file graphcortex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: graphcortex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for graphcortex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2ea67d5c7a9aa5946364ae8b7ad1606942173008d2898f49c17740d55b100b2
MD5 95b4ea51af12efca3b40834b55c64ab6
BLAKE2b-256 5d868060467dc1c0e35db39f735edfa51e998e82e41571100921ac332f961a65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page