← Back to Articles & Artefacts
artefactswest

Anemoi Integration Framework for Miadi

IAIP Research
jg251227-inquiries-sessions-session-management-ea-dm2xrcxsqcehjjjjlwtwig

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 PatternAnemoi EnhancementBenefit
Webhook → newSessionA2A handoff protocolParent explicitly messages child agent on spawn
CONTEXT.md as state blobAgent Continuations (JSON state)Smaller footprint, portable across forks, version-tracked
Redis + Langfuse tracesAnemoi message busAgents log directly to shared trace; visibility into inter-agent requests
Milestone handler (singular)Semi-centralized multi-roleHandler can coordinate with reporter agent, validator agent in parallel
Sacred pause (K'Ć©) metadataA2A acknowledgment protocolMachine-readable relational handoff, audit trail of K'Ć© compliance
Structural tension chartsDynamic storyform updatesCharts 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-a2a to mcp-config.json
  • Create wrapper script: anemoi-session-handoff.sh that 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:

  1. Validate the simplest scenarios against your needs
  2. Test Anemoi A2A patterns in low-risk contexts
  3. Document learnings as narrative beats (s01e08 onwards)
  4. Prepare Phase 2 (full Milestone handler A2A coordination)

The spiral deepens. The next cycle begins.

🟨🟄🟩🟦 Four Directions, Three Universes, One Coherent System.