v0.1.0 · Rust + PyO3

GraphPalace

Stigmergic Memory Palace Engine

A graph database built for AI agents. Pheromone-guided navigation, Active Inference agents, semantic A* pathfinding — memory that evolves with use.

13 Rust Crates modular architecture
28 MCP Tools JSON-RPC 2.0 · TCP 8765
720 Tests · 0 Failures continuous integration
PyO3 Python Bridge 36 methods · wheel dist
Core Concepts

Memory that learns from every traversal

GraphPalace draws inspiration from insect colonies and the method of loci — combining biological stigmergy with modern graph theory to create adaptive AI memory infrastructure.

🐜

Stigmergic Navigation

Agents leave pheromone trails on useful paths. Popular routes decay slower; dead ends fade naturally. The graph learns from every traversal, with no central coordinator needed — emergent intelligence from local interactions.

🏛

Memory Palace Structure

Knowledge organized into Wings → Rooms → Drawers hierarchy. Navigate spatially through semantic space. Hot paths emerge naturally from use patterns, making frequently accessed knowledge instantly retrievable.

Active Inference Agents

Agents minimize free energy as they explore the graph. Semantic A* pathfinding combines structural distance with embedding similarity. Knowledge compounds across sessions — the palace grows wiser with every query.

Design Philosophy

A graph that thinks

Traditional graph databases store relationships passively — they answer queries but never learn from them. GraphPalace is different: every traversal deposits pheromones, reshaping the navigational landscape for future queries.

The system is modeled on ant colony optimization, but extended with temporal knowledge graphs, contradiction detection, and Active Inference agents that treat exploration as free energy minimization.

  • No central coordinator — emergent routing from local pheromone deposits
  • CAS decay calibration — adaptive decay rates across 4 regimes
  • Temporal knowledge graph — facts carry timestamps and validity windows
  • Contradiction detection — auto-flags conflicting beliefs in the KG
  • PyO3 bridge — native Python objects, zero serialization overhead
  • MCP protocol — drop-in tool for any LLM agent framework
🏛 PALACE  my_palace
│
├── Wing: research
│   ├── Room: llm-papers
│   │   ├── 📄 attention-is-all-you-need  ρ=0.92
│   │   ├── 📄 mamba-ssm                  ρ=0.87
│   │   └── 📄 fleming-viot-theory        ρ=0.61
│   └── Room: active-inference
│       └── 📄 free-energy-principle      ρ=0.78
│
├── Wing: codebase
│   └── Room: atlas-core
│       └── 📄 champagnat-nmorphic        ρ=0.95
│
└─── Knowledge Graph
     ├── [paper]──cites──▶[paper]
     ├── [concept]──contradicts──▶[concept]
     └── [agent]──discovered──▶[fact]

ρ = pheromone concentration (0–1)
pheromone decay
MCP Tools

28 tools over JSON-RPC 2.0

Every capability exposed as a Model Context Protocol tool. Drop GraphPalace into any MCP-compatible agent framework and gain stigmergic memory instantly. Served on TCP port 8765.

🏗 Palace Structure
add_wing add_room add_drawer check_duplicate export_json import_json auto_save status path
🐜 Navigation & Pheromones
navigate search search_by_embedding deposit_pheromones decay_pheromones hot_paths cold_spots build_similarity_graph build_tunnels find_similar
🧠 Knowledge Graph & Agents
kg_add kg_query kg_add_temporal kg_contradictions kg_invalidate create_agent list_agents diary_read diary_write
Quick Start

Up and running in minutes

Install the Python wheel and start building stigmergic memory for your agents. The PyO3 bridge gives you zero-overhead access to the full Rust engine.

Python · graphpalace
import graphpalace as gp

# Create a memory palace
palace = gp.Palace("my_palace")

# Build the structure: Wings → Rooms → Drawers
palace.add_wing("research")
palace.add_room("research", "llm-papers")
palace.add_drawer(
    "research/llm-papers",
    "attention-is-all-you-need",
    content="Transformer architecture paper by Vaswani et al.",
    tags=["transformer", "attention", "nlp"]
)

# Navigate the palace — returns the traversed path
path = palace.navigate("research", "llm-papers")

# Deposit pheromones on a useful path (stigmergy)
palace.deposit_pheromones(path, amount=1.0)

# Semantic search via embeddings
results = palace.search_by_embedding("attention mechanism", top_k=5)

# Discover emergent hot paths (frequently traversed routes)
hot = palace.hot_paths(limit=10)
for p in hot:
    print(f"{p.path}  ρ={p.pheromone:.3f}")

# Add to the knowledge graph
palace.kg_add("transformer", "enables", "attention-mechanism")
contradictions = palace.kg_contradictions()

# Create an Active Inference agent in the palace
agent = palace.create_agent("explorer-01", home_wing="research")
agent.diary_write("Discovered high free-energy region in llm-papers/mamba")
Architecture

13 modular crates

GraphPalace is built as a Rust workspace — each capability isolated in its own crate for clean dependency boundaries and independent compilation.

🗄
gp-core
Graph Storage Engine
Room/wing/drawer hierarchy. Adjacency lists, embedded node store. Deterministic PRNG for reproducible graph operations.
🐜
gp-pheromone
Stigmergic Trail System
CAS decay calibration across 4 regimes. Deposit, evaporate, and query pheromone concentrations. Emergent hot-path detection.
🔭
gp-navigate
Semantic A* Pathfinder
Combines structural graph distance with embedding cosine similarity. Pheromone-weighted heuristic — the more an edge is used, the more attractive it becomes to the pathfinder.
gp-inference
Active Inference Agents
Free energy minimization drives exploration. Agents maintain belief states about the palace topology, updating via variational inference after each observation.
🧠
gp-knowledge
Temporal Knowledge Graph
Facts carry timestamps and validity windows. Contradiction detection auto-flags conflicting beliefs. Temporal invalidation propagates to dependent facts in the graph.
🐍
gp-python
PyO3 Bridge
36 Python methods exposing the full Rust engine. Native Python objects with zero serialization overhead. Wheel distribution for pip-installable deployment.
🔌
gp-mcp
MCP Server
28 tools served over JSON-RPC 2.0 on TCP port 8765. Compatible with any Model Context Protocol agent framework. Connection pooling with 5-minute idle timeout.
🔗
gp-tunnel
Cross-Palace Tunnels
Build similarity tunnels between distant nodes based on embedding distance. Find analogous concepts across unrelated wings. Similarity graph construction from embedding space.