coordinate-swarm
정보
이 스킬은 집단 지성 원리인 스티그머지와 쿼럼 센싱을 활용해 분산 시스템에서 탈중앙화 조정을 위한 패턴을 제공합니다. 이를 통해 자율 에이전트들이 중앙 제어 없이 공유 상태를 통해 자체 조정하는 시스템을 설계할 수 있습니다. 탄력적인 이벤트 기반 아키텍처를 구축하고 취약한 오케스트레이션을 창발적 조정으로 대체하는 데 활용하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/coordinate-swarmClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
Coordinate Swarm
Establish coordination across distributed agents using stigmergy (indirect communication through environment modification), local interaction rules, and quorum sensing — enabling coherent collective behavior without a central controller.
适用场景
- Designing distributed systems where no single node should be a coordination bottleneck
- Organizing teams or workflows that must self-coordinate without constant management oversight
- Building event-driven architectures where components communicate through shared state rather than direct messaging
- Scaling a process that works well with 3 agents but breaks down at 30
- Bootstrapping coordination patterns for a new swarm-style domain (see
forage-resources,build-consensus) - Replacing fragile centralized orchestration with resilient emergent coordination
输入
- 必需: Description of the agents (workers, services, team members) that need coordination
- 必需: The collective goal or desired emergent behavior
- 可选: Current coordination mechanism and its failure modes
- 可选: Number of agents (affects pattern selection — small swarms vs. large colonies)
- 可选: Latency tolerance (real-time vs. eventual coordination)
- 可选: Environmental constraints (shared state availability, communication bandwidth)
步骤
第 1 步:Identify the Coordination Problem Class
Classify the coordination challenge to select appropriate patterns.
- Map the current state: who are the agents, what do they do individually, where does coordination break down?
- Classify the problem:
- Foraging — agents search for and exploit distributed resources (see
forage-resources) - Consensus — agents must agree on a collective decision (see
build-consensus) - Construction — agents build or maintain a shared structure incrementally
- Defense — agents detect and respond to threats collectively (see
defend-colony) - Division of labor — agents must self-organize into specialized roles
- Foraging — agents search for and exploit distributed resources (see
- Identify the failure mode of current coordination:
- Single point of failure (centralized controller)
- Communication bottleneck (too many direct messages)
- Coherence loss (agents drift apart without feedback)
- Rigidity (cannot adapt to changing conditions)
预期结果: A clear classification of the coordination problem type and the specific failure mode to address. This determines which swarm patterns to apply.
失败处理: If the problem doesn't fit a single class, it may be a composite. Decompose into sub-problems and address each with the appropriate pattern. If agents are too heterogeneous for a single coordination model, consider layered coordination — homogeneous clusters coordinated via inter-cluster stigmergy.
第 2 步:Design Stigmergic Signals
Create the indirect communication channels through which agents influence each other's behavior.
- Define the shared environment (database, message queue, file system, physical space, shared board)
- Design signals that agents deposit into the environment:
- Trail signals: markers that accumulate along successful paths (like ant pheromones)
- Threshold signals: counters that trigger behavior changes when they cross thresholds
- Inhibition signals: markers that repel agents from exhausted areas
- Define signal properties:
- Decay rate: how quickly signals fade (prevents stale state from dominating)
- Reinforcement: how successful outcomes strengthen signals
- Visibility radius: how far a signal propagates
- Map signals to agent behaviors:
- When an agent detects signal X above threshold T, it performs action A
- When an agent completes action A successfully, it deposits signal Y
- When no signal is detected, the agent follows its default exploration behavior
Signal Design Template:
┌──────────────┬───────────────────┬──────────────┬────────────────────┐
│ Signal Name │ Deposited When │ Decay Rate │ Agent Response │
├──────────────┼───────────────────┼──────────────┼────────────────────┤
│ success-trail│ Task completed OK │ 50% per hour │ Follow toward │
│ busy-marker │ Agent starts task │ On completion│ Avoid / pick other │
│ help-signal │ Agent stuck >5min │ 25% per hour │ Assist if nearby │
│ danger-flag │ Error detected │ 10% per hour │ Retreat & report │
└──────────────┴───────────────────┴──────────────┴────────────────────┘
预期结果: A signal table mapping environmental markers to agent deposit conditions, decay rates, and response behaviors. Signals should be simple, composable, and independently meaningful.
失败处理: If signal design feels overly complex, reduce to two signals: one positive (success trail) and one negative (danger flag). Most coordination problems can be bootstrapped with attract/repel dynamics. Add nuance only after the basic system is functioning.
第 3 步:Define Local Interaction Rules
Specify the simple rules each agent follows, using only local information (their own state + nearby signals).
- Define the agent's perception radius (what can it sense?)
- Write 3-7 local rules in priority order:
- Rule 1 (safety): If danger-flag detected, move away
- Rule 2 (response): If help-signal detected and idle, move toward
- Rule 3 (exploitation): If success-trail detected, follow toward strongest signal
- Rule 4 (exploration): If no signals detected, move randomly with bias toward unexplored areas
- Rule 5 (deposit): After completing task, deposit success-trail at location
- Each rule must be:
- Local: depends only on what the individual agent can perceive
- Simple: expressible in one if-then statement
- Stateless (preferred): does not require the agent to remember past states
- Test rules mentally: if every agent follows these rules, does the desired collective behavior emerge?
预期结果: A prioritized rule set that each agent executes independently. When applied across the swarm, these local rules produce the target collective behavior (foraging, construction, defense, etc.).
失败处理: If mental simulation doesn't produce the desired emergent behavior, the rules likely need a feedback loop — agents must be able to observe the consequences of their collective actions. Add a signal that represents the collective state (e.g., "task completion rate") and a rule that adjusts behavior based on it.
第 4 步:Calibrate Quorum Sensing
Set thresholds that trigger collective state changes when enough agents agree.
- Identify decisions that require collective agreement (not just individual response):
- Switching from exploration to exploitation mode
- Committing to a new work site or abandoning an old one
- Escalating from normal to emergency response
- For each collective decision, define:
- Quorum threshold: number or percentage of agents that must signal agreement
- Sensing window: time period over which signals are counted
- Hysteresis: different thresholds for activation vs. deactivation (prevents oscillation)
- Implement quorum as signal accumulation:
- Each agent that favors the decision deposits a vote-signal
- When accumulated votes exceed the quorum threshold within the sensing window, the decision activates
- When votes drop below the deactivation threshold, the decision reverses
预期结果: Quorum thresholds that allow the swarm to make collective decisions without a leader. The hysteresis gap prevents rapid oscillation between states.
失败处理: If the swarm oscillates between states, widen the hysteresis gap (e.g., activate at 70%, deactivate at 30%). If the swarm never reaches quorum, lower the threshold or increase the sensing window. If decisions are too slow, reduce the sensing window — but beware of premature consensus.
第 5 步:Test and Tune Emergent Behavior
Validate that local rules produce the desired collective behavior, then tune parameters.
- Run a simulation or pilot with a small number of agents (5-10)
- Observe:
- Does the swarm converge on the intended behavior?
- How long does convergence take?
- What happens when conditions change mid-task?
- What happens when agents fail or are added?
- Tune parameters:
- Signal decay rate: too fast → no coordination memory; too slow → stale signals dominate
- Quorum threshold: too low → premature collective decisions; too high → paralysis
- Exploration-exploitation balance: too much exploration → inefficient; too much exploitation → local optima
- Stress test:
- Remove 30% of agents suddenly — does the swarm recover?
- Double the agent count — does the swarm still coordinate?
- Introduce conflicting signals — does the swarm resolve or deadlock?
预期结果: A tuned parameter set where the swarm self-organizes toward the target behavior, recovers from perturbations, and scales gracefully.
失败处理: If the swarm fails stress tests, the signal design is likely too tightly coupled. Simplify: reduce to fewer signals, increase decay rates (fresher information), and ensure agents have a robust default behavior when no signals are present. A swarm that does something reasonable with zero signals is more resilient than one that depends on signal availability.
验证清单
- Coordination problem is classified into a recognized pattern (foraging, consensus, construction, defense, division of labor)
- Stigmergic signal table is defined with deposit conditions, decay rates, and agent responses
- Local interaction rules are simple, local, and prioritized (3-7 rules)
- Quorum thresholds are set with hysteresis to prevent oscillation
- Small-scale test shows emergent behavior matching the collective goal
- Stress test (agent removal, addition, signal disruption) shows graceful degradation
常见问题
- Over-engineering signals: Starting with too many signal types creates confusion. Begin with 2 signals (attract/repel) and add only when proven necessary
- Centralized thinking in disguise: If your "local rule" requires an agent to know the global state, it's not local. Refactor until each rule depends only on what the agent can directly perceive
- Ignoring decay: Signals that never decay create fossilized coordination state. Every signal needs a half-life appropriate to the task's time scale
- Zero hysteresis: Quorum thresholds without a gap between activation and deactivation cause rapid state oscillation. Always set deactivation lower than activation
- Assuming homogeneity: If agents have different capabilities, a single rule set may not work. Consider role-differentiated rules (see
scale-colony)
相关技能
forage-resources— applies swarm coordination specifically to resource search and explore-exploit tradeoffsbuild-consensus— deep dive into distributed agreement mechanisms, extending the quorum sensing from this skilldefend-colony— collective defense patterns that build on the signal and rule framework herescale-colony— scaling strategies for when the swarm outgrows its initial coordination designadapt-architecture— morphic skill for transforming system architecture, complementary when swarm coordination triggers structural changedeploy-to-kubernetes— practical distributed system deployment where swarm coordination patterns applyplan-capacity— capacity planning informed by swarm scaling dynamicscoordinate-reasoning— AI self-application variant; maps stigmergic signals to context management with information decay rates and local protocols
GitHub 저장소
연관 스킬
content-collections
메타이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.
polymarket
메타이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.
creating-opencode-plugins
메타이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.
sglang
메타SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.
