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


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).

pip install graphcortex

Or, to run from source with the CLI Swarm:

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.2.tar.gz (34.3 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.2-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: graphcortex-0.2.2.tar.gz
  • Upload date:
  • Size: 34.3 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.2.tar.gz
Algorithm Hash digest
SHA256 6d720c615d249d51d5d2a99ef0f6c92b4b36a7274968678772f7f8376e0888d7
MD5 efd9e97ec22c1f760eb717307b76d90f
BLAKE2b-256 5630402fa0ac242cec4d17cff710eb864c3cd8b13534a319ef8ecc5303f0e536

See more details on using hashes here.

File details

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

File metadata

  • Download URL: graphcortex-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 40.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 17fb0560134d1bcf3a3a187ff9ca126d28a9d508d1aa69c117f8f6fb9fd9ea05
MD5 3a8dd199521cc374b4ad08b4a6d24922
BLAKE2b-256 b81665ceb2279bd92cba9280a5b1bccb1d8fe9b9c7fdabea14a4ae03ec4ccd4b

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