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.
GraphPalace draws inspiration from insect colonies and the method of loci — combining biological stigmergy with modern graph theory to create adaptive AI memory infrastructure.
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.
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.
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.
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.
🏛 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)
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.
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.
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")
GraphPalace is built as a Rust workspace — each capability isolated in its own crate for clean dependency boundaries and independent compilation.