Menu

Multi-Agent Coordination

Coordinate multiple coding agents around one shared project reality. Snipara keeps the Project Brain; Companion acts as the engineering lead; Claude, Codex, Cursor, GPT, or custom agents execute scoped work and return receipts, evidence, and outcomes.

Concrete use case

Use Multi-Agent Coordination when several agents need to modify the same repository without overwriting each other, duplicating work, losing proof, or restarting from stale transcript state. Snipara gives them a shared operating layer: claims for ownership, htasks for scoped work, shared state for progress, and receipts for what actually happened.

Plan Requirements

Swarm count and agents per swarm follow the Project Intelligence platform limits. Real-time event coordination requires Team or Enterprise packaging. Htask queues, claims, and shared state are orchestrator-surface tools behind Snipara's lean default agent contract. Use snipara_help(query=...) for routed guidance, then snipara_help(list_all=true) or snipara-orchestrator when the workflow explicitly needs orchestration schemas.

Project Brain First

Agents do not collaborate because they chat. They collaborate because they share the same project reality: decisions, active work, ownership, impact, proof, and outcomes that survive across sessions and tools.

Project Brain

Decisions, impact, work, proof

Snipara keeps the operational state that every participant should trust before touching the repo.

Companion Lead

Plan, route, gate, hand off

Companion turns the brain into bounded worker contracts, proof gates, fallbacks, and candidate Brain updates.

Planner

Works in the assigned tool, then returns receipts and outcomes.

Coder

Works in the assigned tool, then returns receipts and outcomes.

Reviewer

Works in the assigned tool, then returns receipts and outcomes.

Feedback Loop

Receipts and outcomes flow back into the Project Brain so the next agent starts from a more reliable state instead of replaying old conversations.

This makes orchestration a consequence of Project Intelligence. Swarms, claims, shared state, and hierarchical tasks are the coordination mechanics; the Project Brain is the point of truth that keeps those mechanics from becoming another message thread.

What Snipara prevents

Two agents editing the same file or migration without a visible lease.
A stale worker continuing after context, scope, or ownership changed.
A task marked complete without tests, proof receipts, or outcome evidence.
Coordinator state disappearing after a transcript reset or model handoff.
Blocked work staying hidden because the blocker never propagated to the shared project state.

How it differs

Not only a planner graph

LangGraph-style planners can sequence work, but Snipara keeps the shared project state, claims, evidence, and durable handoff outside one model run.

Not only an agent crew

Crew-style role assignment is useful, but Snipara makes ownership, proof, stale workers, and collision risk inspectable before work is trusted.

Not only a task queue

Queues assign work; Snipara carries context authority, source links, proof requirements, receipts, and reviewable memory candidates with the work.

The Companion Engineering Lead Plan is intentionally advisory and fail-closed today. It can recommend supervised work packages, worker roles, scoped contracts, proof gates, fallback, replan triggers, and candidate Brain updates, but delegated execution still needs explicit approval, handoff receipts, and outcome evidence.

For a public proof example, see the Engineering Lead Plan replay: it shows recommended workers, proof gates, fallback, receipts, outcomes, and candidate Project Brain updates without claiming autonomous execution.

Canonical MCP Shape

The examples below use canonical snipara_* tool names and snake_case arguments. Legacy snipara_task_* queue aliases are not the canonical surface for new workflows; use snipara_htask_* for hierarchical work.

Overview

Multi-Agent Coordination gives the shared project reality executable coordination primitives:

  • Swarms - Groups of agents working toward a shared goal
  • Claim Leases - Prevent conflicts and recover when an agent drops
  • Shared State - Versioned key-value state across agents
  • Htasks - Hierarchical tasks with owners, evidence, policy, and audit
  • Presence and Capability Discovery - See who is online, stale, or suited for work
  • Event Timelines - Broadcast events plus persisted audit rows

Swarms

A swarm is a coordinated group of agents working together. Each swarm has an ID, shared state, membership and capability labels, and can coordinate through claims, htasks, and events.

Creating a Swarm

const swarm = await snipara_swarm_create({
  name: "auth-refactor",
  description: "Migrate authentication from sessions to JWT",
  max_agents: 5,
  reuse_existing: true
})

Joining a Swarm

Agents join with a stable agent_id. Use capabilities to make routing and operator review more useful.

await snipara_swarm_join({
  swarm_id: "swarm_abc123",
  agent_id: "worker-api",
  role: "worker",
  capabilities: ["backend", "tests"]
})

Swarm Roles

RoleDescriptionTypical Use
coordinatorPlans and assigns tasksSenior agent that decomposes work
workerExecutes assigned tasksAgents that write code, review, or test
observerRead-only accessMonitoring, logging

Listing Swarm Members

Inspect who is in the swarm, their role, advertised capabilities, and heartbeat health.

const members = await snipara_swarm_members({
  swarm_id: "swarm_abc123"
})

Leaving or Removing an Agent

Remove an agent when work is done or when a crashed worker needs cleanup. Leaving releases held claims and unassigns that agent's queued work.

await snipara_swarm_leave({
  swarm_id: "swarm_abc123",
  agent_id: "worker-api"
})

Resource Claims

Claims prevent multiple agents from modifying the same resource simultaneously. Use exclusive claims for surfaces where overlap should block other agents, such as migrations, deploy scripts, auth, billing, and schema work.

Claiming a Resource

const claim = await snipara_claim({
  swarm_id: "swarm_abc123",
  agent_id: "worker-api",
  resource_type: "file",
  resource_id: "src/auth/login.ts",
  timeout_seconds: 300
})
if (claim.success) {
  try {
    // Do the scoped work while the claim is active.
  } finally {
    await snipara_release({
      swarm_id: "swarm_abc123",
      agent_id: "worker-api",
      claim_id: claim.claim_id
    })
  }
}

Claim Parameters

ParameterDescription
swarm_idSwarm context for the claim
agent_idStable owner of the claim
resource_typeOne of file, function, module, component, or other
resource_idResource identifier such as a file path
timeout_secondsLease timeout in seconds; expired claims are reclaimable

Shared State

Shared state is a versioned key-value store. Use expected_version when a value needs optimistic locking, and snipara_state_poll when an agent needs efficient multi-key monitoring.

await snipara_state_set({
  swarm_id: "swarm_abc123",
  agent_id: "coordinator",
  key: "current_phase",
  value: { phase: "implementation" },
  expected_version: 2
})
const state = await snipara_state_get({
  swarm_id: "swarm_abc123",
  key: "current_phase"
})
const changed = await snipara_state_poll({
  swarm_id: "swarm_abc123",
  keys: ["current_phase", "files_processed", "blocked_count"],
  last_versions: { current_phase: 2, files_processed: 18 }
})

Hierarchical Tasks

Use canonical snipara_htask_* tools for N0-N3 work. Htasks carry owners, priorities, acceptance criteria, evidence requirements, runtime receipts, and audit trails.

Creating Work Items

const task = await snipara_htask_create({
  swarm_id: "swarm_abc123",
  level: "N3_TASK",
  title: "Create JWT utilities",
  description: "Add sign and verify functions",
  owner: "worker-api",
  priority: "P1",
  evidence_required: [
    { type: "test", description: "auth tests pass" }
  ],
  context_refs: ["src/auth/jwt.ts"]
})

Selecting Ready Work

const ready = await snipara_htask_recommend_batch({
  swarm_id: "swarm_abc123",
  owner: "worker-api",
  limit: 1,
  exclude_blocked: true,
  claim_for_agent: "worker-api"
})
const nextTask = ready.tasks?.[0]
if (nextTask) {
  await snipara_htask_complete({
    swarm_id: "swarm_abc123",
    task_id: nextTask.task_id,
    evidence: [
      { type: "test", description: "pnpm test passed" }
    ],
    result: { files_modified: ["src/auth/jwt.ts"] },
    learnings: ["JWT helpers now share one signer"],
    create_memory: true
  })
}

Task States

PENDING

Task created, waiting for execution

IN_PROGRESS

Owner is working on the task

COMPLETED

Evidence and result were recorded

BLOCKED

A blocker must be resolved before completion

Inspecting Progress

const tree = await snipara_htask_tree({
  swarm_id: "swarm_abc123",
  task_id: "feature_auth",
  max_depth: 4,
  include_completed: true
})
const metrics = await snipara_htask_metrics({
  swarm_id: "swarm_abc123",
  period_hours: 24
})
const audit = await snipara_htask_audit_trail({
  swarm_id: "swarm_abc123",
  task_id: "htask_abc123"
})
ToolUse Case
snipara_htask_create_featureCreate an N1 feature with standard implementation workstreams
snipara_htask_createCreate N0-N3 work items with owner, priority, evidence, and context refs
snipara_htask_recommend_batchPick the next unblocked N3 tasks for a worker or workstream
snipara_htask_completeComplete work with evidence and optional outcome memory creation
snipara_htask_treeInspect hierarchy, parent/child status, and blockers
snipara_htask_metricsReview throughput, aging, blocked work, and recovery ratios
snipara_htask_audit_trailRead task-level create, update, block, unblock, complete, and close events

Events

Broadcast events wake or inform live workers. snipara_swarm_events lets polling agents inspect broadcast events and htask audit rows without a Redis subscription.

await snipara_broadcast({
  swarm_id: "swarm_abc123",
  agent_id: "coordinator",
  event_type: "tasks_ready",
  payload: { count: 5 }
})
const recentEvents = await snipara_swarm_events({
  swarm_id: "swarm_abc123",
  event_type: "tasks_ready",
  since: new Date(Date.now() - 60 * 60 * 1000).toISOString(),
  limit: 20
})

Event Types

EventDescriptionUse Case
tasks_readyNew htasks are readyWake idle workers
coordination_readyCoordinator has prepared shared stateStart a delegated phase
phase_completeMajor milestone reachedCoordinate phase transitions
resource_releasedClaim was releasedAllow waiting agents to continue
customApplication-specificAny coordination need

Plan Limits

FeatureFreeProTeamEnterprise
Swarms1520Unlimited
Agents/Swarm251550
Real-time event coordination--YesYes

Best Practices

  • Start simple - Use shared state before adding htask queues.
  • Always release claims - Use try/finally when work holds a claim.
  • Set bounded TTLs - Prevent deadlocks from crashed agents.
  • Keep work scoped - Claims should protect concrete files, modules, or components.
  • Complete with evidence - Htask completion should include tests, diffs, proof receipts, or outcome notes.
  • Fail closed - Delegated execution still needs explicit approval, handoff receipts, and outcome evidence.

Next Steps