π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
checkpoint: File edit:
rUv2e8cc2ecbcae
diff --git a/v3/@claude-flow/swarm/src/shared/events.ts b/v3/@claude-flow/swarm/src/shared/events.tsindex 0eba811def..1c7f2962f9 100644--- a/v3/@claude-flow/swarm/src/shared/events.ts+++ b/v3/@claude-flow/swarm/src/shared/events.ts@@ -232,12 +232,12 @@ export function agentErrorEvent(agentId: AgentId, error: Error): SwarmEvent {}// Task Events-export function taskCreatedEvent(taskId: string, type: string, title: string): SwarmEvent {- return createEvent('task:created', 'swarm', { taskId, type, title });+export function taskCreatedEvent(taskId: string, spec: { type: string; title: string }): SwarmEvent {+ return createEvent('task:created', 'swarm', { taskId, type: spec.type, title: spec.title });}-export function taskQueuedEvent(taskId: string, priority: string): SwarmEvent {- return createEvent('task:queued', 'swarm', { taskId, priority });+export function taskQueuedEvent(taskId: string, position: number): SwarmEvent {+ return createEvent('task:queued', 'swarm', { taskId, position });}export function taskAssignedEvent(taskId: string, agentId: AgentId): SwarmEvent {@@ -260,17 +260,17 @@ export function taskFailedEvent(taskId: string, error: Error): SwarmEvent {});}-export function taskBlockedEvent(taskId: string, blockedBy: string[]): SwarmEvent {- return createEvent('task:blocked', 'swarm', { taskId, blockedBy });+export function taskBlockedEvent(taskId: string, reason: string, blockingTask: string): SwarmEvent {+ return createEvent('task:blocked', 'swarm', { taskId, reason, blockingTask });}// Swarm Events-export function swarmInitializedEvent(config: unknown): SwarmEvent {- return createEvent('swarm:initialized', 'swarm', { config });+export function swarmInitializedEvent(source: string, config: unknown): SwarmEvent {+ return createEvent('swarm:initialized', source, { config });}-export function swarmPhaseChangedEvent(previousPhase: string, newPhase: string): SwarmEvent {- return createEvent('swarm:phase-changed', 'swarm', { previousPhase, newPhase });+export function swarmPhaseChangedEvent(source: string, previousPhase: string, newPhase: string): SwarmEvent {+ return createEvent('swarm:phase-changed', source, { previousPhase, newPhase });}export function swarmMilestoneReachedEvent(milestoneId: string, name: string): SwarmEvent {diff --git a/v3/docs/adr/ADR-011-llm-provider-system.md b/v3/docs/adr/ADR-011-llm-provider-system.mdnew file mode 100644index 0000000000..da915db161--- /dev/null+++ b/v3/docs/adr/ADR-011-llm-provider-system.md@@ -0,0 +1,156 @@+# ADR-011: LLM Provider System++## Status+Accepted++## Date+2026-01-05++## Context++V3 needs a unified LLM provider system that:+1. Supports multiple LLM providers (Anthropic, OpenAI, Google, Cohere, Ollama)+2. Provides cost tracking and optimization+3. Enables intelligent load balancing and failover+4. Integrates with the hooks system for caching and learning++V2 has concrete provider implementations in `v2/src/providers/` that need to be modernized for V3.++## Decision++### 1. Create `@claude-flow/providers` Package++A dedicated package for LLM provider implementations:++```+v3/@claude-flow/providers/+βββ src/+β βββ types.ts # Unified type definitions+β βββ base-provider.ts # Abstract base class+β βββ anthropic-provider.ts # Claude models+β βββ openai-provider.ts # GPT models+β βββ google-provider.ts # Gemini models+β βββ cohere-provider.ts # Command models+β βββ ollama-provider.ts # Local models+β βββ provider-manager.ts # Orchestration layer+β βββ index.ts # Public exports+βββ package.json+βββ tsconfig.json+```++### 2. Provider Interface++All providers implement a unified interface:++```typescript+interface ILLMProvider {+ readonly name: LLMProvider;+ readonly capabilities: ProviderCapabilities;++ initialize(): Promise<void>;+ complete(request: LLMRequest): Promise<LLMResponse>;+ streamComplete(request: LLMRequest): AsyncIterable<LLMStreamEvent>;++ healthCheck(): Promise<HealthCheckResult>;+ estimateCost(request: LLMRequest): Promise<CostEstimate>;+ destroy(): void;+}+```++### 3. Provider Manager Features++- **Load Balancing**: Round-robin, latency-based, cost-based strategies+- **Failover**: Automatic fallback to alternative providers+- **Circuit Breaker**: Protection against cascading failures+- **Cost Tracking**: Per-request and aggregate cost monitoring+- **Caching**: LRU cache with TTL for repeated requests++### 4. LLM Hooks Integration++Add LLM-specific hooks to `@claude-flow/hooks`:++```typescript+// Pre-LLM hooks+- Request caching lookup+- Provider-specific optimizations+- Cost constraint validation++// Post-LLM hooks+- Response caching+- Pattern learning+- Cost tracking+- Performance metrics+```++### 5. Updated Model Support++Include latest models:++**Anthropic (Claude):**+- claude-3-5-sonnet-20241022+- claude-3-opus-20240229+- claude-3-sonnet-20240229+- claude-3-haiku-20240307++**OpenAI:**+- gpt-4o (latest)+- gpt-4o-mini+- gpt-4-turbo+- o1-preview+- o1-mini++**Google:**+- gemini-2.0-flash+- gemini-1.5-pro+- gemini-1.5-flash++**Cohere:**+- command-r-plus+- command-r+- command-light++**Ollama (Local):**+- llama3.2+- mistral+- codellama+- phi-4++## Consequences++### Positive+- Unified interface simplifies multi-provider usage+- Cost optimization can save 85%+ with intelligent routing+- Circuit breaker prevents cascading failures+- Hook integration enables learning from LLM interactions+- Local model support via Ollama reduces API costs++### Negative+- Additional package to maintain+- Provider API changes require updates+- Testing requires API mocks++### Neutral+- Integration with existing `@claude-flow/integration` multi-model-router+- Can coexist with agentic-flow's provider system++## Implementation Notes++### Phase 1: Core Implementation+1. Create package structure+2. Implement base provider and types+3. Implement Anthropic and OpenAI providers++### Phase 2: Extended Providers+4. Implement Google, Cohere, Ollama providers+5. Implement provider manager++### Phase 3: Hooks Integration+6. Add LLM hooks to @claude-flow/hooks+7. Integration testing++## References++- V2 Provider System: `v2/src/providers/`+- V3 Multi-Model Router: `v3/@claude-flow/integration/src/multi-model-router.ts`+- ADR-001: agentic-flow Integration+- ADR-006: Unified Memory Service