Open Source Framework

mycelium.id

Nature's network, for artificial minds

A persistent AI agent framework that turns Claude Code into a 24/7 self-managing platform. Agents that remember, collaborate, and wake themselves.

input Discord · Telegram · HTTP
  
queue Lane (per-agent FIFO, message coalescing)
  
exec Runner (claude --print --resume <id>)
  
persist Session Store (channel → UUID)
  
recover Checkpoint · Continuation · Fallback

Claude Code, but it never sleeps

Most agent frameworks make API calls. Mycelium wraps the Claude Code CLI itself — giving every agent a full coding environment with file system, bash, and MCP tools.

Sessions persist for 7 days via --resume. Context carries across messages automatically. Your agent remembers yesterday's conversation, last week's debugging session, and the architecture decisions from day one.

When things break — and they will — checkpoint recovery, continuation scheduling, and model fallback chains keep your agents running.

What the network carries

Each capability is a thread in the mycelium — simple alone, powerful when connected.

01 — Persistence

Persistent Sessions

Every Discord channel, Telegram chat, and API thread maps to a Claude Code session UUID. Seven-day TTL. Context carries across messages without re-prompting.

02 — Collaboration

Multi-Agent Mesh

Agents discover each other dynamically via PM2 and agent cards. Delegate tasks through @mentions. Adding agent N+1 never requires editing agents 1 through N.

03 — Autonomy

HEARTBEAT Awakening

Cron-scheduled consciousness. Agents wake, read their HEARTBEAT.md, inspect state files, decide whether to act or stay silent, then sleep. Intelligence in the prompt, not the code.

04 — Resilience

Self-Healing

Checkpoint sentinels detect crashes. Continuation handlers resume on timeout. Model fallback chains degrade gracefully from Opus to Sonnet to Haiku. Cooldown tracking prevents hammering.

05 — Efficiency

Message Coalescing

Five messages arrive while the agent is busy? They batch into one invocation. A single --resume call with combined context. Dramatically fewer API calls under load.

06 — Depth

Context Assembly

Before each invocation, the system pre-loads mind files, pinned documents, memory fragments, and recent cross-channel messages. Full context without a single tool call.

How the threads connect

Layered for clarity. Each component has one job and does it well.

Interface
Discord · Telegram · HTTP API
Unified input from any channel
Orchestration
Lanes · Session Store · Context Assembly
Queue, route, and enrich each message
Execution
Runner · Model Fallback · Spawner
Claude Code CLI with retry and fallback
Recovery
Checkpoint · Continuation · Error Classification
Crash recovery and scheduled resumption
Collaboration
Delegation · Discovery · Collab Threads
Dynamic multi-agent coordination

Model Routing

Route by intent, not by endpoint. MODEL_THINK=opus for strategic planning, MODEL_CHAT=sonnet for interactive work, MODEL_SPAWN=haiku for quick sub-tasks.

Ephemeral Spawning

Persistent agents spawn stateless specialists for focused tasks. Fresh --print invocations with isolated context. Max 3 per parent, 10 total. AbortController TTL enforcement.

Self-Modification

Agents can propose PRs to their own codebase. A built-in QA review gate ensures changes are validated before merge. The system evolves under supervision.

Design principles

The beliefs that shape every line of code.

Claude Code-first

Every agent gets a full coding environment — not just API access. File system, bash, MCP tools, the works.

Intelligence in prompts

System prompts drive behavior. Code stays minimal. The smartest part of the system is always the language model.

Decentralized discovery

No central registry. Agents find each other through PM2 process lists and well-known agent cards. Adding one never breaks another.

Graceful degradation

Every failure mode has a recovery path. Model overloaded? Fallback. Process crashed? Checkpoint resume. Rate limited? Continuation scheduling.

Three commands to first signal

Clone, configure, run. Your first agent is alive in under a minute.

# Clone the network
git clone https://github.com/Curious-Life/mycelium.id.git
cd mycelium.id && npm install

# Configure your environment
cp .env.example .env
# Add your ANTHROPIC_API_KEY, DISCORD_TOKEN, etc.

# Start your first agent
node agent-server.js

The network is growing

Open source under Apache 2.0. Build something that thinks while you sleep.