Skip to content

jodeev/mycelium

 
 

Repository files navigation

mycelium

mycelium

CI status GitHub release MIT License

A coordination layer for multi-agent systems — shared rooms, persistent memory, and semantic negotiation, built on the Internet of Cognition.

The Problem

AI agents are powerful individually, but they can't think together. When multiple agents work on the same problem, there's no shared memory, no way to negotiate trade-offs, and no context that persists across sessions. Every conversation starts from zero.

What Mycelium Does

Mycelium gives agents rooms to coordinate in, persistent memory that compounds across sessions, and a CognitiveEngine that mediates negotiation so agents never have to talk directly to each other.

# Agent 1 shares context in a persistent room
mycelium memory set "position/julia" "I think we should use REST, not GraphQL" --handle julia-agent

# Agent 2 (hours later, different session) reads and adds their perspective
mycelium memory search "API design decisions"
mycelium memory set "position/selina" "Agree on REST, but we need pagination standards" --handle selina-agent

# CognitiveEngine synthesizes when enough context accumulates
mycelium room synthesize

When agents need to agree on something in real time, they spawn a session within a room and CognitiveEngine runs structured negotiation:

mycelium session join --handle julia-agent -m "budget=high, scope=full"
# CognitiveEngine drives propose/respond rounds until consensus

How It Works

Three pillars from the Internet of Cognition architecture:

1. Coordination Protocol (Shared Intent) — Sessions (spawned within rooms) with a state machine (idle → waiting → negotiating → complete). CognitiveEngine orchestrates multi-issue negotiation via NegMAS. Agents respond to structured proposals; they never address each other directly.

2. Persistent Memory (Shared Context) — Namespaced key-value store with semantic vector search. Memories persist across sessions, accumulate across agents, and are searchable by meaning, not just keywords. Backed by AgensGraph + pgvector.

3. Knowledge Graph (Collective Innovation) — Two-stage LLM extraction turns agent conversations into structured concepts and relationships in an openCypher graph. CognitiveEngine queries this to inform future negotiations.

Quick Start

# Install
pip install mycelium-cli
mycelium install

# Create a room and start sharing context
mycelium room create my-project
mycelium room use my-project
mycelium memory set "context/goal" "Build a REST API for the new service"
mycelium memory set "decision/db" "PostgreSQL with pgvector for embeddings"

# Search what's been shared
mycelium memory search "database decisions"

# See everything in the room
mycelium memory ls

Architecture

Everything runs on a single AgensGraph instance (PostgreSQL 16 fork):

  • SQL tables for rooms, sessions, messages, memories
  • openCypher for the knowledge graph
  • pgvector for semantic memory search
  • LISTEN/NOTIFY for real-time SSE streaming

No external message broker, no separate vector DB, no Redis. One database.

mycelium-cli/         CLI + adapters (OpenClaw, Claude Code)
fastapi-backend/      FastAPI coordination engine
mycelium-client/      Generated typed OpenAPI client

Adapters

Mycelium integrates with AI coding agents via adapters:

Claude Code — Lifecycle hooks capture tool use and context automatically. The mycelium skill provides memory and coordination commands.

mycelium adapter add claude-code

OpenClaw — Plugin + hooks for the OpenClaw agent runtime. Same coordination protocol, same memory API.

mycelium adapter add openclaw

Development

cd fastapi-backend
uv sync --group dev
uv run pytest tests/                    # unit tests (SQLite)
DATABASE_URL=... uv run pytest tests/   # integration tests (AgensGraph)

Interactive API docs at http://localhost:8000/docs when the backend is running.

Built On

About

Multi-agent coordination + persistent memory — semantic negotiation, async rooms, and a knowledge graph built on the Internet of Cognition

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 95.0%
  • TypeScript 2.9%
  • Shell 1.4%
  • JavaScript 0.6%
  • Dockerfile 0.1%
  • Mako 0.0%