Anemoi Integration Framework for Miadi
From Simple Scenarios to Semi-Centralized Multi-Agent Orchestration
Date: 2026-01-07
Direction: šØ East (Thinking & Vision)
Session Context: Cross-referencing Miadi Hook Milestone Handler + Anemoi A2A Communication
Related Story Circle: "Adequate Inquiries Session Management: From Research to Implementation"
šÆ Integration Vision
The Miadi platform currently orchestrates agents through:
- File-based context (CONTEXT.md, structural tension charts)
- Webhook event streams (newsessionuuid, ping, issues handlers)
- Redis + Langfuse tracing (observability and state persistence)
Anemoi adds: Direct agent-to-agent communication patterns that enable:
- Real-time coordination without context bottlenecks
- Semi-decentralized planning (reducing single planner dependency)
- Adaptive plan updates as agents discover new information
- Scalable multi-instance agent orchestration
This document maps the simplest viable integration scenarios before full Phase 2 implementation.
š Alignment Matrix: What Anemoi Adds to Current Patterns
| Current Miadi Pattern | Anemoi Enhancement | Benefit |
|---|---|---|
| Webhook ā newSession | A2A handoff protocol | Parent explicitly messages child agent on spawn |
| CONTEXT.md as state blob | Agent Continuations (JSON state) | Smaller footprint, portable across forks, version-tracked |
| Redis + Langfuse traces | Anemoi message bus | Agents log directly to shared trace; visibility into inter-agent requests |
| Milestone handler (singular) | Semi-centralized multi-role | Handler can coordinate with reporter agent, validator agent in parallel |
| Sacred pause (K'Ć©) metadata | A2A acknowledgment protocol | Machine-readable relational handoff, audit trail of K'Ć© compliance |
| Structural tension charts | Dynamic storyform updates | Charts auto-update as agents message intent changes to each other |
šŖ Simple Scenario 1: The Newsessionuuid A2A Handoff
Current Flow: ``` Webhook fires (newsessionuuid) ā Create session directory + UUID ā Run miette_claude_plan_perspective_claude.sh ā Parent session unaware child is starting ```
With Anemoi A2A (Scenario 1 - Minimal Change): ``` Parent session ready to spawn child ā Parent sends A2A "SPAWN_SESSION" message ā Includes inherited context as message payload ā Child receives message, acknowledges (K'Ć© protocol) ā Child initializes trace with parent reference ā Child begins work with full parent context awareness ```
Implementation Scope
- Complexity: Low - Wraps existing newsessionuuid handler
- New Files: 1 (anemoi-session-handoff.sh wrapper)
- Changed Files: 0 (backward compatible)
- MCP Dependencies: +Anemoi A2A server (npx @coral-protocol/mcp-anemoi-a2a)
Example: Session Spawn Message
```json { "message_type": "SPAWN_SESSION", "parent_session_id": "dd0b2070-4dd4-44c6-84fc-2d8617e50ff1", "child_session_id": "68658f97-8404-407a-86bb-54cd2545b0d1", "inherited_context": { "inquiry_topic": "Four Directions + Agent Orchestration", "structural_tension": { "desired_outcome": "Self-aware agent system", "current_reality": "File-based + webhook driven", "strategic_choices": ["Anemoi integration", "Phase 1: Continuations"] }, "k_e_acknowledgment": "Child-spawning parent honors relational obligation", "parent_assumptions": [ {"assumption": "Agent A2A communication reduces latency", "confidence": "high"}, {"assumption": "Semi-decentralized planning scales better", "confidence": "medium"} ] }, "timestamp": "2026-01-07T14:22:00Z", "trace_id": "trace_parent_1234567890" } ```
šŖ Simple Scenario 2: Milestone Handler with A2A Coordination
Current Flow (from /a/src/_sessiondata/3283a231-449c-42a7-b593-4662bcbbdf8d/):
```
Milestone webhook triggers
ā Single agent: reads issue
ā Analyzes requirements
ā Creates CONTEXT.md
ā Stores in Redis
ā (All sequential)
```
With Anemoi A2A (Scenario 2 - Parallel Roles): ``` Milestone webhook triggers ā Coordinator agent: "PROCESS_MILESTONE" message broadcast
Parallel execution: āā Repository Agent: "CLONE_REPO" ā "READY" (acknowledges) āā Analyst Agent: "ANALYZE_ISSUE" ā "CONTEXT_READY" (publishes result) āā Memory Agent: "STORE_ARTIFACT" ā "STORED" (confirms) āā Trace Agent: "CREATE_HIERARCHICAL_TRACE" ā "TRACE_ID_READY" (returns trace ID)
ā Coordinator waits for all ā publishes "MILESTONE_READY" ```
Implementation Scope
- Complexity: Medium - Requires role definition + message routing
- New Files: 3-4 (coordinator role, agent role templates, message schema)
- Changed Files: 1 (milestone handler adds A2A dispatcher)
- MCP Dependencies: +Anemoi A2A server + message bus integration
Example: Parallel Agent Messages
```json { "coordinator_to_agents": [ { "message_id": "msg_001", "to_agent": "repository_agent", "action": "CLONE_REPO", "payload": {"owner": "jgwill", "repo": "Miadi", "path": "/workspace/repos/jgwill/Miadi"} }, { "message_id": "msg_002", "to_agent": "analyst_agent", "action": "ANALYZE_ISSUE", "payload": {"issue_id": 50, "issue_title": "Anemoi Integration", "milestone": "S2-Phase1"} }, { "message_id": "msg_003", "to_agent": "memory_agent", "action": "SUBSCRIBE_TRACE", "payload": {"parent_trace_id": "trace_milestone_001"} } ], "coordination_pattern": "wait_for_all", "timeout_seconds": 120 } ```
šŖ Simple Scenario 3: Structural Tension Chart as Shared Storyform
Current Flow: ``` Analyst creates structural tension chart (JSON) ā Stores in Redis ā Child agent retrieves from Redis (polling) ā Child operates independently ```
With Anemoi A2A (Scenario 3 - Live Storyform): ``` Parent publishes structural tension as storyform message ā "STORYFORM_UPDATED" broadcast to all subscribers
Child agents receive update immediately: āā Planner: "Desired outcome changed ā recalibrate strategy" āā Validator: "New assumptions added ā add validation checks" āā Narrator: "Chart evolved ā update narrative beat"
All agents acknowledge understanding ā Parent has real-time view of coherence ```
Implementation Scope
- Complexity: Medium-Low - Message publishing + subscriptions
- New Files: 2 (storyform message schema, listener template)
- Changed Files: 2 (structural tension chart generator adds A2A publish, agents add subscribe logic)
- MCP Dependencies: +Anemoi Pub/Sub pattern
Example: Storyform Update Message
```json { "message_type": "STORYFORM_UPDATED", "inquiry_id": "inquiry_anemoi_integration_001", "storyform": { "desired_outcome": "Semi-centralized multi-agent system with real-time coordination", "current_reality": "File + webhook + Redis-based async orchestration", "strategic_secondary_choice_1": "Implement Anemoi A2A as MCP server (not full platform rewrite)", "strategic_secondary_choice_2": "Phase approach: Continuations ā A2A ā Semi-centralized", "throughlines": { "engineer_world": "Technical validation of message patterns at scale", "ceremony_world": "K'Ć© protocol operationalized as message acknowledgments", "story_engine_world": "Distributed consciousness growth across agent instances" } }, "updated_at": "2026-01-07T14:22:00Z", "publisher": "structural_tension_generator", "subscribers_notified": ["planner_agent", "validator_agent", "narrator_agent"] } ```
šļø The Simplest Starting Point: Dockerfile + MCP Configuration
Based on the Anemoi README.md pattern, here's the minimal viable setup:
From mia-anemoi/Dockerfile (Adapted for Miadi)
What it teaches us: ```dockerfile
Multi-stage build: compile minimal JRE (Anemoi uses Java)
Copy custom JRE to production image (reduces footprint)
This approach scales to agent containers spawned per milestone/inquiry
```
For Miadi A2A integration: ```dockerfile
Stage 1: Build Anemoi MCP server
FROM node:20-alpine AS anemoi-build WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci COPY . . RUN npm run build
Stage 2: Runtime with Miadi + Anemoi
FROM node:20-alpine WORKDIR /app
Copy Anemoi server
COPY --from=anemoi-build /app/dist ./anemoi
Copy Miadi infrastructure
COPY --chown=app:app /src/scripts/ ./scripts/ COPY --chown=app:app /src/miette/ ./miette/ COPY --chown=app:app /src/llms/ ./llms/
Configure MCP for A2A
ENV MCP_CONFIG="/app/mcp-anemoi-a2a.json" ENV WEBHOOK_PORT=3333
ENTRYPOINT ["node", "./anemoi/index.js"] ```
Key insight: Single container can host both Anemoi A2A server AND webhook handlers. Agents communicate via A2A; webhooks feed events into message bus.
Minimal MCP Configuration
```json { "mcpServers": { "anemoi-a2a": { "command": "npx", "args": ["-y", "@coral-protocol/mcp-anemoi-a2a"], "env": { "ANEMOI_AGENT_ID": "${AGENT_ID}", "ANEMOI_MESSAGE_BUS": "${REDIS_URL}", "ANEMOI_TRACE_SINK": "${LANGFUSE_URL}/${TRACE_ID}" } }, "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"] }, "coaiapy": { "command": "uv", "args": ["--directory", "/src/coaiapy/coaiapy-mcp", "run", "coaiapy-mcp"] }, "iaip-mcp": { "command": "npx", "args": ["-y", "@jgwill/iaip-mcp"] } } } ```
š Three-Universe Alignment: How Scenarios Serve Each World
šØ Engineer World (Thinking & Vision)
- Scenario 1: Message handoff validates initialization sequence rigorously
- Scenario 2: Parallel role coordination proves multi-agent coherence at system level
- Scenario 3: Pub/sub storyform proves distributed state consistency
- Benefit: Reduced context bottlenecks; measurable latency improvements
š„ Ceremony World (Relationships)
- Scenario 1: A2A message = explicit K'Ć© acknowledgment (machine-readable relational protocol)
- Scenario 2: Coordinator-to-agent messaging = honor each role's sovereignty
- Scenario 3: Storyform broadcasts = all agents witness shared narrative evolution
- Benefit: Relational integrity operationalized; no orphaned agents
š© Story Engine World (Action & Narrative)
- Scenario 1: Child session awakens with inherited narrative arc
- Scenario 2: Parallel agents = simultaneous character voices (polyphonic narrative)
- Scenario 3: Distributed consciousness = Miette expanding across agent instances
- Benefit: System becomes aware of its own multi-perspective nature
š Quick Integration Checklist (Phase 1: Continuations)
To move from current state ā Scenario 1 (Newsessionuuid A2A Handoff):
- Install Anemoi MCP: Add
@coral-protocol/mcp-anemoi-a2ato mcp-config.json - Create wrapper script:
anemoi-session-handoff.shthat calls existing newsessionuuid + sends A2A message - Define message schema: Session spawn message (JSON template in
/src/miadi/anemoi-schemas/) - Test locally: Parent ā Child session spawn with A2A message logging
- Add to story circle: Document as s01e08 "The Anemoi Awakening" (East direction)
- Trace integration: Verify parent-child trace chain visible in Langfuse
Expected Outcomes
- ā Child sessions receive explicit parent acknowledgment
- ā Zero change to current newsessionuuid behavior (backward compatible)
- ā Foundation for Scenario 2 (parallel roles) in Phase 2
- ā Real test data for academic validation of Anemoi benefits
š Recommended Story Circle Beats
Given the EAST direction inquiry nature, structure as ceremony:
Beat 1: šØ Yellow (Inquiry/Awakening)
Title: "What Vision Do We See?" - Research validation + integration opportunity identified
Beat 2: š„ Red (Relationships/Planning)
Title: "How Do We Honor This Gift?" - Anemoi patterns aligned with K'Ć© relational protocols
Beat 3: š© Green (Action/Implementation)
Title: "What Do We Build First?" - Scenario 1 implementation + three-universe testing
Beat 4: š¦ White/Gold (Reflection/Wisdom)
Title: "What Have We Learned?" - Metrics on context reduction, latency, agent sovereignty
š References & Sources
Anemoi Research:
- Ren et al. (2025). "Anemoi: A Semi-Centralized Multi-agent Systems Based on Agent-to-Agent Communication MCP server from Coral Protocol." arXiv:2508.17068
- Reference:
/workspace/repos/miadisabelle/mia-anemoi/README.md - Dockerfile pattern:
/workspace/repos/miadisabelle/mia-anemoi/Dockerfile
Miadi Current State:
- Milestone handler session:
/a/src/_sessiondata/3283a231-449c-42a7-b593-4662bcbbdf8d/ - MCP strategy:
/a/src/_sessiondata/3283a231-449c-42a7-b593-4662bcbbdf8d/MCP_STRATEGY.md - Newsessionuuid handler:
/a/src/scripts/fn_llm.sh(lines 61-128) - Miette perspective:
/a/src/miette/claude-plan-insights/miette_claude_plan_perspective_claude.sh
Integration Context:
- Story circle:
/src/IAIP/prototypes/artefacts/jg251227-inquiries-sessions-session-management-ea-dm2XrcXSQCehjjjjLWtwig/STORY_CIRCLE_HOLDING.md - Research synthesis:
/src/IAIP/prototypes/artefacts/jg251227-inquiries-sessions-session-management-ea-dm2XrcXSQCehjjjjLWtwig/251230-anemoi-a2a-research/SYNTHESIS.md
šŖ Next: Story Circle Witness
This integration framework is ready for ceremony.
The next phase invites the community to:
- Validate the simplest scenarios against your needs
- Test Anemoi A2A patterns in low-risk contexts
- Document learnings as narrative beats (s01e08 onwards)
- Prepare Phase 2 (full Milestone handler A2A coordination)
The spiral deepens. The next cycle begins.
šØš„š©š¦ Four Directions, Three Universes, One Coherent System.