Files
wehub-resource-sync 23f7624596
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Has been cancelled
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Has been cancelled
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Has been cancelled
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Has been cancelled
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Has been cancelled
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Has been cancelled
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Has been cancelled
CI/CD Pipeline / Deploy & Release (push) Has been cancelled
CI/CD Pipeline / CI Status (push) Has been cancelled
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Has been cancelled
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Has been cancelled
🔍 Verification Pipeline / ⚡ Performance Verification (push) Has been cancelled
🔍 Verification Pipeline / 📊 Verification Report (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:02:19 +08:00
..

@claude-flow/teammate-plugin

Native TeammateTool integration plugin for Claude Flow. Bridges Claude Code v2.1.19+ multi-agent orchestration capabilities with Claude Flow's swarm system.

npm version License: MIT

Requirements

Requirement Minimum Version Recommended
Claude Code >= 2.1.19 Latest
Node.js >= 18.0.0 >= 20.0.0
npm >= 9.0.0 >= 10.0.0

IMPORTANT: This plugin requires Claude Code version 2.1.19 or higher. The TeammateTool functionality was introduced in this version and is not available in earlier releases.

Version Check

# Check your Claude Code version
claude --version

# Should output: 2.1.19 or higher

If your version is below 2.1.19, update Claude Code:

claude update

Installation

Install directly using Claude Code's plugin system:

# Install from npm registry
claude plugins install @claude-flow/teammate-plugin

# Or install from Claude Flow plugin registry (IPFS-backed)
claude plugins install teammate-plugin --registry claude-flow

Via npm

npm install @claude-flow/teammate-plugin

Or with pnpm:

pnpm add @claude-flow/teammate-plugin

Via Claude Flow CLI

# Install via claude-flow plugin manager
npx @claude-flow/cli@latest plugins install --name @claude-flow/teammate-plugin

# Or add to your claude-flow.config.json
npx @claude-flow/cli@latest config set plugins.teammate-plugin.enabled true

Verify Installation

# Check plugin is loaded
claude plugins list

# Or via claude-flow
npx @claude-flow/cli@latest plugins list

Quick Start

import { createTeammateBridge } from '@claude-flow/teammate-plugin';

// Initialize the bridge
const bridge = await createTeammateBridge();

// Check compatibility
const version = bridge.getVersionInfo();
console.log(`Claude Code: ${version.claudeCode}`);
console.log(`Compatible: ${version.compatible}`);

if (!version.compatible) {
  console.error('Please upgrade Claude Code to >= 2.1.19');
  process.exit(1);
}

// Create a team
const team = await bridge.spawnTeam({
  name: 'my-dev-team',
  topology: 'hierarchical',
  maxTeammates: 6,
  planModeRequired: true,
});

// Spawn teammates (returns AgentInput for Claude Code Task tool)
const coder = await bridge.spawnTeammate({
  name: 'coder-1',
  role: 'coder',
  prompt: 'Implement the authentication feature using JWT',
  teamName: 'my-dev-team',
  model: 'sonnet',
  allowedTools: ['Edit', 'Write', 'Read', 'Bash'],
});

// The agentInput can be passed to Claude Code's Task tool
const agentInput = bridge.buildAgentInput({
  name: 'tester-1',
  role: 'tester',
  prompt: 'Write tests for the authentication feature',
  teamName: 'my-dev-team',
  model: 'haiku',
});

console.log('Pass this to Task tool:', agentInput);

Features

Core Features (from TeammateTool)

Feature Description TeammateTool Operation
Team Management Create, discover, load teams spawnTeam, discoverTeams
Teammate Spawning Spawn agents with native support AgentInput schema
Join/Leave Workflow Request-approve-reject pattern requestJoin, approveJoin, rejectJoin
Messaging Direct and broadcast messages write, broadcast
Plan Approval Submit, vote, execute plans approvePlan, rejectPlan
Swarm Launch Launch multi-agent execution launchSwarm, teammateCount
Shutdown Graceful teammate termination requestShutdown, approveShutdown

Extended Features (Plugin Additions)

Feature Description
Delegation Delegate authority between teammates
Team Context Shared variables, permissions, environment
Permission Updates Dynamic permission changes mid-execution
Session Memory Persist teammate context across sessions
Remote Sync Push team to Claude.ai (experimental)
Transcript Sharing Share message history between teammates
Teleport Resume teams across terminal instances
Plan Control Pause, resume, modify plans mid-execution

API Reference

TeammateBridge

The main class for interacting with TeammateTool.

Initialization

import { createTeammateBridge, TeammateBridge } from '@claude-flow/teammate-plugin';

// Factory function (recommended)
const bridge = await createTeammateBridge({
  fallbackToMCP: true,  // Fallback to MCP if TeammateTool unavailable
  memory: {
    autoPersist: true,
    persistIntervalMs: 60000,
  },
});

// Or direct instantiation
const bridge = new TeammateBridge(config);
await bridge.initialize();

Team Management

// Create team
const team = await bridge.spawnTeam({
  name: 'my-team',
  topology: 'hierarchical',  // 'flat' | 'hierarchical' | 'mesh'
  maxTeammates: 8,
  planModeRequired: true,
  autoApproveJoin: true,
  delegationEnabled: true,
});

// Discover existing teams
const teams = await bridge.discoverTeams();
// ['team-1', 'team-2', ...]

// Load existing team
const existingTeam = await bridge.loadTeam('team-1');

// Get team state
const state = bridge.getTeamState('my-team');

Teammate Spawning

// Spawn teammate
const teammate = await bridge.spawnTeammate({
  name: 'coder-1',
  role: 'coder',
  prompt: 'Implement feature X',
  teamName: 'my-team',
  model: 'sonnet',  // 'sonnet' | 'opus' | 'haiku'
  allowedTools: ['Edit', 'Write', 'Read'],
  mode: 'default',  // 'default' | 'plan' | 'delegate' | etc.
});

// Build AgentInput for Task tool
const agentInput = bridge.buildAgentInput({
  name: 'reviewer-1',
  role: 'reviewer',
  prompt: 'Review code changes',
  teamName: 'my-team',
});
// Pass agentInput to Claude Code's Task tool

Messaging

// Send direct message
const message = await bridge.sendMessage(
  'my-team',
  'sender-id',
  'recipient-id',
  {
    type: 'task',
    payload: { action: 'implement', target: 'auth' },
    priority: 'high',
  }
);

// Broadcast to all teammates
await bridge.broadcast('my-team', 'coordinator-id', {
  type: 'status',
  payload: { phase: 'implementation' },
});

// Read mailbox
const messages = await bridge.readMailbox('my-team', 'teammate-id');

Plan Approval

// Submit plan
const plan = await bridge.submitPlan('my-team', {
  description: 'Implement authentication feature',
  proposedBy: 'coordinator-id',
  steps: [
    { order: 1, action: 'Create user model', tools: ['Edit'], assignee: 'coder-1' },
    { order: 2, action: 'Add JWT middleware', tools: ['Edit'], assignee: 'coder-1' },
    { order: 3, action: 'Write unit tests', tools: ['Edit'], assignee: 'tester-1' },
  ],
  requiredApprovals: 2,
});

// Approve plan
await bridge.approvePlan('my-team', plan.id, 'reviewer-id');

// Launch swarm (after approval)
const exitPlanInput = await bridge.launchSwarm('my-team', plan.id, 3);
// Pass exitPlanInput to ExitPlanMode tool

Delegation

// Delegate authority
const delegation = await bridge.delegateToTeammate(
  'my-team',
  'lead-id',
  'dev-id',
  ['approve_plan', 'spawn_teammate']
);

// Revoke delegation
await bridge.revokeDelegation('my-team', 'lead-id', 'dev-id');

Team Context

// Update context
await bridge.updateTeamContext('my-team', {
  sharedVariables: {
    apiEndpoint: 'https://api.example.com',
    version: '1.0.0',
  },
  inheritedPermissions: ['read', 'write'],
  environmentVariables: {
    NODE_ENV: 'development',
  },
});

// Get context
const context = bridge.getTeamContext('my-team');

Session Memory

// Save teammate memory
await bridge.saveTeammateMemory('my-team', 'teammate-id');

// Load teammate memory
const memory = await bridge.loadTeammateMemory('my-team', 'teammate-id');

// Share transcript
await bridge.shareTranscript('my-team', 'from-id', 'to-id', {
  start: 0,
  end: 10,
});

Teleport

// Check if teleport is possible
const { canTeleport, blockers } = await bridge.canTeleport('my-team', {
  workingDirectory: '/path/to/new/dir',
  gitBranch: 'feature/auth',
});

// Teleport team
if (canTeleport) {
  const result = await bridge.teleportTeam('my-team', {
    workingDirectory: '/path/to/new/dir',
    gitBranch: 'feature/auth',
  });
}

MCP Tools

The plugin provides 16 MCP tools for use with Claude Code's MCP server:

import { TEAMMATE_MCP_TOOLS, handleMCPTool } from '@claude-flow/teammate-plugin';

// List all tools
console.log(TEAMMATE_MCP_TOOLS.map(t => t.name));
// [
//   'teammate_spawn_team',
//   'teammate_discover_teams',
//   'teammate_spawn',
//   'teammate_send_message',
//   'teammate_broadcast',
//   'teammate_submit_plan',
//   'teammate_approve_plan',
//   'teammate_launch_swarm',
//   'teammate_delegate',
//   'teammate_update_context',
//   'teammate_save_memory',
//   'teammate_share_transcript',
//   'teammate_push_remote',
//   'teammate_teleport',
//   'teammate_get_status',
//   'teammate_cleanup',
// ]

// Handle tool call
const result = await handleMCPTool(bridge, 'teammate_spawn_team', {
  name: 'my-team',
  topology: 'hierarchical',
});

Events

The bridge emits events for all operations:

bridge.on('team:spawned', ({ team, config }) => {
  console.log(`Team ${team} created`);
});

bridge.on('teammate:spawned', ({ teammate, agentInput }) => {
  console.log(`Teammate ${teammate.name} spawned`);
});

bridge.on('plan:approved', ({ team, plan }) => {
  console.log(`Plan ${plan.id} approved`);
});

bridge.on('delegate:granted', ({ team, from, to, permissions }) => {
  console.log(`${from} delegated to ${to}: ${permissions.join(', ')}`);
});

bridge.on('teleport:completed', ({ team, result }) => {
  console.log(`Team ${team} teleported successfully`);
});

Error Handling

import { TeammateError, TeammateErrorCode } from '@claude-flow/teammate-plugin';

try {
  await bridge.launchSwarm('my-team', 'plan-id');
} catch (error) {
  if (error instanceof TeammateError) {
    switch (error.code) {
      case TeammateErrorCode.PLAN_NOT_APPROVED:
        console.log('Plan needs approval first');
        break;
      case TeammateErrorCode.TEAM_NOT_FOUND:
        console.log(`Team not found: ${error.teamName}`);
        break;
      case TeammateErrorCode.VERSION_INCOMPATIBLE:
        console.log('Claude Code version too old');
        break;
    }
  }
}

Configuration

import { createTeammateBridge, DEFAULT_PLUGIN_CONFIG } from '@claude-flow/teammate-plugin';

const bridge = await createTeammateBridge({
  autoInitialize: true,
  fallbackToMCP: true,

  recovery: {
    maxRetries: 3,
    retryDelayMs: 1000,
    exponentialBackoff: true,
    fallbackToMCP: true,
    autoCleanupOnError: true,
  },

  delegation: {
    maxDepth: 3,
    autoExpireMs: 3600000,  // 1 hour
    requireApproval: false,
  },

  remoteSync: {
    enabled: false,
    autoSync: false,
    syncInterval: 30000,
    preserveOnDisconnect: true,
  },

  teleport: {
    autoResume: true,
    gitAware: true,
    preserveMailbox: true,
    preserveMemory: true,
  },

  memory: {
    autoPersist: true,
    persistIntervalMs: 60000,
    maxSizeMb: 100,
  },

  mailbox: {
    pollingIntervalMs: 1000,
    maxMessages: 1000,
    retentionMs: 3600000,
  },
});

Integration with Claude Flow

import { createTeammateBridge } from '@claude-flow/teammate-plugin';
import { UnifiedSwarmCoordinator } from '@claude-flow/swarm';

// Create bridge
const bridge = await createTeammateBridge();

// Map Claude Flow topology to team config
const teamConfig = {
  name: 'cf-team',
  topology: 'hierarchical',  // Maps to Claude Flow's hierarchical
  maxTeammates: 8,
  planModeRequired: true,
};

// Create team
const team = await bridge.spawnTeam(teamConfig);

// Map Claude Flow agent types to teammate configs
const agentMapping = {
  'coder': { role: 'coder', tools: ['Edit', 'Write', 'Read', 'Bash'] },
  'tester': { role: 'tester', tools: ['Read', 'Bash', 'Glob'] },
  'reviewer': { role: 'reviewer', tools: ['Read', 'Grep', 'Glob'] },
  'architect': { role: 'architect', tools: ['Read', 'Glob', 'Grep'] },
};

// Spawn teammates with Claude Flow agent types
for (const [type, config] of Object.entries(agentMapping)) {
  await bridge.spawnTeammate({
    name: `${type}-1`,
    role: config.role,
    prompt: `You are a ${type}...`,
    teamName: 'cf-team',
    allowedTools: config.tools,
  });
}

File Structure

Teams are stored in ~/.claude/teams/:

~/.claude/teams/
├── my-team/
│   ├── config.json        # Team configuration
│   ├── state.json         # Team state (teammates, plans)
│   ├── remote.json        # Remote session info (if synced)
│   ├── mailbox/
│   │   ├── teammate-1.json
│   │   └── teammate-2.json
│   └── memory/
│       ├── teammate-1.json
│       └── teammate-2.json
└── other-team/
    └── ...

Environment Variables

The plugin uses these Claude Code environment variables:

CLAUDE_CODE_TEAM_NAME          # Current team context
CLAUDE_CODE_PLAN_MODE_REQUIRED # Require plan approval
CLAUDE_CODE_TMUX_SESSION       # tmux session name
CLAUDE_CODE_TMUX_PREFIX        # tmux prefix key
CLAUDE_CODE_TEAMMATE_COMMAND   # Custom spawn command

Troubleshooting

Plugin reports TeammateTool not available

const version = bridge.getVersionInfo();
if (!version.compatible) {
  console.log(`Claude Code version: ${version.claudeCode}`);
  console.log(`Required: >= 2.1.19`);
  console.log('Run: claude update');
}

Mailbox messages not received

Check that mailbox polling is running:

// Mailbox is polled automatically, but you can read manually
const messages = await bridge.readMailbox('my-team', 'teammate-id');

Plan approval stuck

Ensure enough teammates have voted:

const team = bridge.getTeamState('my-team');
const plan = team.activePlans.find(p => p.id === planId);

console.log(`Approvals: ${plan.approvals.length}/${plan.requiredApprovals}`);
console.log(`Rejections: ${plan.rejections.length}`);

Testing the Plugin

Run Unit Tests

cd v3/plugins/teammate-plugin

# Install dependencies
npm install

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

Verify Plugin Functionality

import { createTeammateBridge, TEAMMATE_MCP_TOOLS } from '@claude-flow/teammate-plugin';

async function verifyPlugin() {
  console.log('=== Plugin Verification ===\n');

  // 1. Check MCP tools are exported
  console.log(`✓ MCP Tools available: ${TEAMMATE_MCP_TOOLS.length}`);

  // 2. Initialize bridge
  const bridge = await createTeammateBridge();
  console.log('✓ Bridge initialized');

  // 3. Check version compatibility
  const version = bridge.getVersionInfo();
  console.log(`✓ Claude Code version: ${version.claudeCode || 'not detected'}`);
  console.log(`✓ Plugin version: ${version.plugin}`);
  console.log(`✓ Compatible: ${version.compatible}`);

  // 4. Test team creation (if compatible)
  if (version.compatible) {
    const team = await bridge.spawnTeam({ name: 'test-team' });
    console.log(`✓ Team created: ${team.name}`);

    // Cleanup
    await bridge.cleanup('test-team');
    console.log('✓ Cleanup successful');
  }

  console.log('\n=== All checks passed! ===');
}

verifyPlugin().catch(console.error);

Verify via CLI

# Check plugin is registered
npx @claude-flow/cli@latest plugins list | grep teammate

# Check plugin info
npx @claude-flow/cli@latest plugins info teammate-plugin

# Test MCP tools
npx @claude-flow/cli@latest mcp tools | grep teammate

Plugin Registry (IPFS)

This plugin is published to the Claude Flow Plugin Registry on IPFS for decentralized distribution.

Registry Entry

{
  "name": "teammate-plugin",
  "package": "@claude-flow/teammate-plugin",
  "version": "1.0.0-alpha.1",
  "description": "Native TeammateTool integration for Claude Code v2.1.19+",
  "author": "Claude Flow Team",
  "license": "MIT",
  "repository": "https://github.com/ruvnet/claude-flow",
  "keywords": ["claude-code", "teammate", "multi-agent", "swarm"],
  "requirements": {
    "claudeCode": ">=2.1.19",
    "node": ">=18.0.0"
  },
  "mcpTools": 21,
  "features": [
    "team-management",
    "teammate-spawning",
    "messaging",
    "plan-approval",
    "delegation",
    "remote-sync",
    "bmssp-optimization"
  ]
}

Install from Registry

# Install from IPFS-backed registry
npx @claude-flow/cli@latest plugins install teammate-plugin --registry ipfs

# Or specify registry CID directly
npx @claude-flow/cli@latest plugins install teammate-plugin --cid <registry-cid>

Verify Registry Integrity

# Check plugin hash matches registry
npx @claude-flow/cli@latest plugins verify teammate-plugin

# View registry metadata
npx @claude-flow/cli@latest plugins registry info

License

MIT