#
tokens: 49635/50000 120/168 files (page 1/5)
lines: off (toggle) GitHub
raw markdown copy
This is page 1 of 5. Use http://codebase.md/delorenj/mcp-server-trello?page={x} to view the full context.

# Directory Structure

```
├── .claude
│   ├── commands
│   │   ├── analysis
│   │   │   ├── bottleneck-detect.md
│   │   │   ├── COMMAND_COMPLIANCE_REPORT.md
│   │   │   ├── performance-bottlenecks.md
│   │   │   ├── performance-report.md
│   │   │   ├── README.md
│   │   │   ├── token-efficiency.md
│   │   │   └── token-usage.md
│   │   ├── automation
│   │   │   ├── auto-agent.md
│   │   │   ├── README.md
│   │   │   ├── self-healing.md
│   │   │   ├── session-memory.md
│   │   │   ├── smart-agents.md
│   │   │   ├── smart-spawn.md
│   │   │   └── workflow-select.md
│   │   ├── batchtools.md
│   │   ├── claude-flow-help.md
│   │   ├── claude-flow-memory.md
│   │   ├── claude-flow-swarm.md
│   │   ├── coordination
│   │   │   ├── agent-spawn.md
│   │   │   ├── init.md
│   │   │   ├── orchestrate.md
│   │   │   ├── README.md
│   │   │   ├── spawn.md
│   │   │   ├── swarm-init.md
│   │   │   └── task-orchestrate.md
│   │   ├── github
│   │   │   ├── code-review-swarm.md
│   │   │   ├── code-review.md
│   │   │   ├── github-modes.md
│   │   │   ├── github-swarm.md
│   │   │   ├── issue-tracker.md
│   │   │   ├── issue-triage.md
│   │   │   ├── multi-repo-swarm.md
│   │   │   ├── pr-enhance.md
│   │   │   ├── pr-manager.md
│   │   │   ├── project-board-sync.md
│   │   │   ├── README.md
│   │   │   ├── release-manager.md
│   │   │   ├── release-swarm.md
│   │   │   ├── repo-analyze.md
│   │   │   ├── repo-architect.md
│   │   │   ├── swarm-issue.md
│   │   │   ├── swarm-pr.md
│   │   │   ├── sync-coordinator.md
│   │   │   └── workflow-automation.md
│   │   ├── helpers
│   │   │   └── standard-checkpoint-hooks.sh
│   │   ├── hooks
│   │   │   ├── notification.md
│   │   │   ├── overview.md
│   │   │   ├── post-command.md
│   │   │   ├── post-edit.md
│   │   │   ├── post-task.md
│   │   │   ├── pre-command.md
│   │   │   ├── pre-edit.md
│   │   │   ├── pre-search.md
│   │   │   ├── pre-task.md
│   │   │   ├── README.md
│   │   │   ├── session-end.md
│   │   │   ├── session-restore.md
│   │   │   ├── session-start.md
│   │   │   └── setup.md
│   │   ├── monitoring
│   │   │   ├── agent-metrics.md
│   │   │   ├── agents.md
│   │   │   ├── README.md
│   │   │   ├── real-time-view.md
│   │   │   ├── status.md
│   │   │   └── swarm-monitor.md
│   │   ├── optimization
│   │   │   ├── auto-topology.md
│   │   │   ├── cache-manage.md
│   │   │   ├── parallel-execute.md
│   │   │   ├── parallel-execution.md
│   │   │   ├── README.md
│   │   │   └── topology-optimize.md
│   │   ├── performance.md
│   │   ├── sparc
│   │   │   ├── analyzer.md
│   │   │   ├── architect.md
│   │   │   ├── ask.md
│   │   │   ├── batch-executor.md
│   │   │   ├── code.md
│   │   │   ├── coder.md
│   │   │   ├── debug.md
│   │   │   ├── debugger.md
│   │   │   ├── designer.md
│   │   │   ├── devops.md
│   │   │   ├── docs-writer.md
│   │   │   ├── documenter.md
│   │   │   ├── innovator.md
│   │   │   ├── integration.md
│   │   │   ├── mcp.md
│   │   │   ├── memory-manager.md
│   │   │   ├── optimizer.md
│   │   │   ├── orchestrator.md
│   │   │   ├── post-deployment-monitoring-mode.md
│   │   │   ├── refinement-optimization-mode.md
│   │   │   ├── researcher.md
│   │   │   ├── reviewer.md
│   │   │   ├── security-review.md
│   │   │   ├── sparc-modes.md
│   │   │   ├── sparc.md
│   │   │   ├── spec-pseudocode.md
│   │   │   ├── supabase-admin.md
│   │   │   ├── swarm-coordinator.md
│   │   │   ├── tdd.md
│   │   │   ├── tester.md
│   │   │   ├── tutorial.md
│   │   │   └── workflow-manager.md
│   │   ├── swarm
│   │   │   ├── analysis.md
│   │   │   ├── development.md
│   │   │   ├── examples.md
│   │   │   ├── maintenance.md
│   │   │   ├── optimization.md
│   │   │   ├── research.md
│   │   │   └── testing.md
│   │   ├── training
│   │   │   ├── model-update.md
│   │   │   ├── neural-patterns.md
│   │   │   ├── neural-train.md
│   │   │   ├── pattern-learn.md
│   │   │   ├── README.md
│   │   │   └── specialization.md
│   │   └── workflows
│   │       ├── development.md
│   │       ├── README.md
│   │       ├── research.md
│   │       ├── workflow-create.md
│   │       ├── workflow-execute.md
│   │       └── workflow-export.md
│   ├── config.json
│   └── settings.json
├── .claude-flow
│   └── metrics
│       ├── agent-metrics.json
│       ├── performance.json
│       └── task-metrics.json
├── .dockerignore
├── .env.template
├── .eslintrc.json
├── .git-commit-message-generator-config.json
├── .github
│   ├── copilot-instructions.md
│   └── workflows
│       └── publish-registry.yml
├── .gitignore
├── .prettierrc
├── babel.config.js
├── bun.lock
├── CHANGELOG.md
├── CLAUDE.md
├── compose.yml
├── CONTRIBUTING.md
├── Dockerfile
├── docs
│   ├── HEALTH_MONITORING.md
│   ├── mcp-documentation.md
│   ├── progress.md
│   └── session
│       └── goal.md
├── example.env
├── examples
│   ├── javascript-examples.js
│   ├── python-examples.py
│   ├── README.md
│   ├── typescript-examples.ts
│   └── usage-examples.md
├── LICENSE
├── mise.toml
├── package-lock.json
├── package.json
├── README.md
├── server.json
├── server.json.bak
├── server.json.current
├── server.schema.json
├── smithery.yaml
├── src
│   ├── evals
│   │   └── evals.ts
│   ├── health
│   │   ├── health-endpoints.ts
│   │   └── health-monitor.ts
│   ├── index.ts
│   ├── index.ts.backup
│   ├── rate-limiter.ts
│   ├── trello-client.ts
│   ├── types.ts
│   └── validators.ts
├── trello-mcp-logo.avif
├── tsconfig.json
└── validate-server.mjs
```

# Files

--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------

```
{
  "semi": true,
  "trailingComma": "es5",
  "singleQuote": true,
  "printWidth": 100,
  "tabWidth": 2,
  "useTabs": false,
  "bracketSpacing": true,
  "arrowParens": "avoid",
  "endOfLine": "lf"
}

```

--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------

```
# Dependencies
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build output
build
dist
*.tsbuildinfo

# Environment variables
.env
.env.*
!.env.template

# Git
.git
.gitignore

# IDE
.idea
.vscode
*.swp
*.swo
*~

# Logs
logs
*.log

# Test coverage
coverage 
```

--------------------------------------------------------------------------------
/.env.template:
--------------------------------------------------------------------------------

```
# Trello API Configuration
# Get your API key from https://trello.com/app-key
TRELLO_API_KEY=your-api-key-here

# Generate your token using your API key
TRELLO_TOKEN=your-token-here

# Optional: Initial workspace ID (can be changed later using set_active_workspace)
# TRELLO_WORKSPACE_ID=your-workspace-id-here

```

--------------------------------------------------------------------------------
/.git-commit-message-generator-config.json:
--------------------------------------------------------------------------------

```json
{
  "AI": {
    "provider": "aws-bedrock",
    "model_id": "anthropic.claude-3-5-sonnet-20240620-v1:0",
    "user_prompt": "Generate a git commit message for the following changes: {diff}. Start with a high-level summary of the changes, then a short changelog breaking down the major changes. Output should contain ONLY the commit message. There should be no mention of a commit message in the output.",
    "system_prompt": "You are a helpful assistant tasked with generating accurate, concise idiomatic git commit messages"
  },
  "OpenAI": {},
  "AWS": {
    "profile_name": "delorenj"
  }
}

```

--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------

```json
{
  "env": {
    "es2021": true,
    "node": true,
    "jest": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module"
  },
  "plugins": ["@typescript-eslint", "prettier"],
  "rules": {
    "prettier/prettier": "error",
    "@typescript-eslint/explicit-function-return-type": "off",
    "@typescript-eslint/no-explicit-any": "warn",
    "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
    "no-console": ["error", { "allow": ["error", "warn"] }]
  },
  "ignorePatterns": ["build/", "node_modules/", "coverage/"]
}

```

--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------

```
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build output
build/
dist/
*.tsbuildinfo

# IDE and editor files
.idea/
.vscode/
*.swp
*.swo
*~

# Environment variables
.env
.env.local
.env.*.local

# Operating System
.DS_Store
Thumbs.db

# Test coverage
coverage/

# Logs
logs/
*.log


# Claude Flow generated files
.claude/settings.local.json
.mcp.json
claude-flow.config.json
.swarm/
.hive-mind/
memory/claude-flow-data.json
memory/sessions/*
!memory/sessions/README.md
memory/agents/*
!memory/agents/README.md
coordination/memory_bank/*
coordination/subtasks/*
coordination/orchestration/*
*.db
*.db-journal
*.db-wal
*.sqlite
*.sqlite-journal
*.sqlite-wal
claude-flow
claude-flow.bat
claude-flow.ps1
hive-mind-prompt-*.txt
validate-server.cjs
mcp-publisher
**/system-metrics.json

# MCP Registry tokens (secrets)
.mcpregistry_github_token
.mcpregistry_registry_token

```

--------------------------------------------------------------------------------
/.claude/commands/training/README.md:
--------------------------------------------------------------------------------

```markdown
# Training Commands

Commands for training operations in Claude Flow.

## Available Commands

- [neural-train](./neural-train.md)
- [pattern-learn](./pattern-learn.md)
- [model-update](./model-update.md)

```

--------------------------------------------------------------------------------
/.claude/commands/automation/README.md:
--------------------------------------------------------------------------------

```markdown
# Automation Commands

Commands for automation operations in Claude Flow.

## Available Commands

- [auto-agent](./auto-agent.md)
- [smart-spawn](./smart-spawn.md)
- [workflow-select](./workflow-select.md)

```

--------------------------------------------------------------------------------
/.claude/commands/coordination/README.md:
--------------------------------------------------------------------------------

```markdown
# Coordination Commands

Commands for coordination operations in Claude Flow.

## Available Commands

- [swarm-init](./swarm-init.md)
- [agent-spawn](./agent-spawn.md)
- [task-orchestrate](./task-orchestrate.md)

```

--------------------------------------------------------------------------------
/.claude/commands/monitoring/README.md:
--------------------------------------------------------------------------------

```markdown
# Monitoring Commands

Commands for monitoring operations in Claude Flow.

## Available Commands

- [swarm-monitor](./swarm-monitor.md)
- [agent-metrics](./agent-metrics.md)
- [real-time-view](./real-time-view.md)

```

--------------------------------------------------------------------------------
/.claude/commands/analysis/README.md:
--------------------------------------------------------------------------------

```markdown
# Analysis Commands

Commands for analysis operations in Claude Flow.

## Available Commands

- [bottleneck-detect](./bottleneck-detect.md)
- [token-usage](./token-usage.md)
- [performance-report](./performance-report.md)

```

--------------------------------------------------------------------------------
/.claude/commands/workflows/README.md:
--------------------------------------------------------------------------------

```markdown
# Workflows Commands

Commands for workflows operations in Claude Flow.

## Available Commands

- [workflow-create](./workflow-create.md)
- [workflow-execute](./workflow-execute.md)
- [workflow-export](./workflow-export.md)

```

--------------------------------------------------------------------------------
/.claude/commands/optimization/README.md:
--------------------------------------------------------------------------------

```markdown
# Optimization Commands

Commands for optimization operations in Claude Flow.

## Available Commands

- [topology-optimize](./topology-optimize.md)
- [parallel-execute](./parallel-execute.md)
- [cache-manage](./cache-manage.md)

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/README.md:
--------------------------------------------------------------------------------

```markdown
# Hooks Commands

Commands for hooks operations in Claude Flow.

## Available Commands

- [pre-task](./pre-task.md)
- [post-task](./post-task.md)
- [pre-edit](./pre-edit.md)
- [post-edit](./post-edit.md)
- [session-end](./session-end.md)

```

--------------------------------------------------------------------------------
/.claude/commands/github/README.md:
--------------------------------------------------------------------------------

```markdown
# Github Commands

Commands for github operations in Claude Flow.

## Available Commands

- [github-swarm](./github-swarm.md)
- [repo-analyze](./repo-analyze.md)
- [pr-enhance](./pr-enhance.md)
- [issue-triage](./issue-triage.md)
- [code-review](./code-review.md)

```

--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------

```markdown
# MCP Server Trello - Examples

This directory contains comprehensive examples demonstrating how to use the MCP Server Trello in various scenarios and programming languages.

## 📚 Available Examples

### 1. [Usage Examples](./usage-examples.md)
Comprehensive guide with practical examples covering:
- Initial setup and configuration
- Board and workspace management
- Card management workflows
- List operations
- Checklist management
- Comments and collaboration
- File and image attachments
- Advanced workflows (Sprint planning, Daily standup, etc.)
- Real-world scenarios

### 2. [JavaScript Examples](./javascript-examples.js)
Node.js/JavaScript implementation examples featuring:
- Sprint Management System
- Bug Tracking System
- Release Management
- Daily Standup Assistant
- Complete working classes ready to use

### 3. [Python Examples](./python-examples.py)
Python implementation examples including:
- Task Priority System
- Kanban Board Automation
- Retrospective Management
- Project Analytics Dashboard
- Type-safe implementations with dataclasses

### 4. [TypeScript Examples](./typescript-examples.ts)
TypeScript examples with full type safety:
- Agile Board Manager
- Automation Rules Engine
- Time Tracking System
- Template System
- Complete type definitions and interfaces

## 🚀 Quick Start

### Prerequisites

1. **Set up MCP Server Trello**:
   ```bash
   npm install -g @delorenj/mcp-server-trello
   ```

2. **Configure your environment**:
   ```bash
   export TRELLO_API_KEY="your-api-key"
   export TRELLO_TOKEN="your-token"
   ```

3. **Get your Trello credentials**:
   - API Key: https://trello.com/app-key
   - Token: Generate using your API key

### Using the Examples

#### JavaScript/Node.js
```javascript
const { TrelloMCPClient, SprintManager } = require('./javascript-examples');

const client = new TrelloMCPClient();
const sprintManager = new SprintManager(client);

// Initialize a new sprint
await sprintManager.initializeSprint(23, '2025-01-22', '2025-02-05');
```

#### Python
```python
from python_examples import TrelloMCPClient, TaskManager, Priority, Task

client = TrelloMCPClient()
task_manager = TaskManager(client)

# Create a high-priority task
task = Task(
    name="Critical Bug Fix",
    description="Fix production issue",
    priority=Priority.CRITICAL
)
await task_manager.create_task(task)
```

#### TypeScript
```typescript
import { TrelloMCPClient, AgileBoard, UserStory } from './typescript-examples';

const client = new TrelloMCPClient();
const board = new AgileBoard(client);

// Create a user story
const story: UserStory = {
    title: 'New Feature',
    description: 'Implement new feature',
    acceptanceCriteria: ['AC1', 'AC2'],
    priority: 'high'
};
await board.createUserStory(story);
```

## 📖 Example Categories

### Project Management
- Sprint Planning and Management
- Agile Board Workflows
- Kanban Board Automation
- Release Management
- Retrospective Management

### Task Management
- Priority-based Task Systems
- Bug Tracking Workflows
- User Story Management
- Time Tracking
- Task Templates

### Automation
- Automation Rules Engine
- Workflow Automation
- Status Updates
- Notification Systems
- Card Movement Rules

### Analytics & Reporting
- Sprint Velocity Tracking
- Burndown Charts
- Project Health Metrics
- Team Performance Analytics
- Cycle Time Analysis

### Integration Examples
- AI Image Generation (with Ideogram)
- CI/CD Pipeline Integration
- GitHub Integration Patterns
- Slack Notifications
- Custom Webhook Handlers

## 🏗️ Architecture Patterns

### Client Wrapper Pattern
All examples use a client wrapper pattern for cleaner code:
```javascript
class TrelloMCPClient {
    async callTool(toolName, args) {
        // MCP tool invocation
    }
}
```

### Manager Classes
Organize functionality into logical manager classes:
- `SprintManager` - Sprint-specific operations
- `BugTracker` - Bug management workflows
- `ReleaseManager` - Release coordination
- `TaskManager` - General task operations

### Type Safety (TypeScript)
Full type definitions for all Trello entities:
```typescript
interface TrelloCard {
    id: string;
    name: string;
    // ... complete type definition
}
```

## 🔧 Common Patterns

### Error Handling
```javascript
try {
    const card = await client.addCardToList({...});
} catch (error) {
    if (error.message.includes('rate limit')) {
        // Handle rate limiting
    } else if (error.message.includes('unauthorized')) {
        // Handle auth errors
    }
}
```

### Batch Operations
```javascript
// Process multiple cards efficiently
const cards = await client.getCardsByListId(listId);
const updates = cards.map(card => updateCard(card));
await Promise.all(updates);
```

### Template Usage
```javascript
// Use templates for consistent card creation
const template = templateManager.getTemplate('bug-report');
const card = await templateManager.createFromTemplate(
    'bug-report',
    listId,
    customValues
);
```

## 🎯 Best Practices

1. **Always specify boardId** when working with multiple boards
2. **Use templates** for consistent card creation
3. **Implement retry logic** for rate limit handling
4. **Cache frequently accessed data** (lists, labels, etc.)
5. **Use batch operations** when possible
6. **Add meaningful comments** for collaboration
7. **Structure descriptions** with markdown
8. **Set appropriate due dates** based on priority
9. **Archive completed items** to keep boards clean
10. **Monitor API usage** to stay within limits

## 📊 Performance Considerations

- **Rate Limits**: 300 requests/10s per API key, 100 requests/10s per token
- **Batch Operations**: Group related operations to minimize API calls
- **Caching**: Cache board structure (lists, labels) to reduce lookups
- **Pagination**: Use limit parameters for large data sets
- **Async Operations**: Use Promise.all() for parallel operations

## 🔗 Related Resources

- [MCP Server Trello Documentation](../README.md)
- [Trello API Documentation](https://developer.atlassian.com/cloud/trello/rest/)
- [MCP Protocol Documentation](https://modelcontextprotocol.io/)
- [Trello Power-Ups](https://trello.com/power-ups)

## 💡 Contributing

Have a great example to share? Contributions are welcome! Please:
1. Follow the existing example structure
2. Include comprehensive comments
3. Provide error handling
4. Add to this README
5. Test your examples

## 📝 License

These examples are part of the MCP Server Trello project and are licensed under the MIT License.
```

--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------

```markdown
# MCP Server Trello

[![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/27359682-7632-4ba7-981d-7dfecadf1c4b)
[![MCP Registry](https://img.shields.io/badge/MCP-Registry-blue)](https://registry.modelcontextprotocol.io/servers/io.github.delorenj/mcp-server-trello)
[![npm version](https://badge.fury.io/js/%40delorenj%2Fmcp-server-trello.svg)](https://badge.fury.io/js/%40delorenj%2Fmcp-server-trello)

<a href="https://glama.ai/mcp/servers/klqkamy7wt"><img width="380" height="200" src="https://glama.ai/mcp/servers/klqkamy7wt/badge" alt="Server Trello MCP server" /></a>

A Model Context Protocol (MCP) server that provides tools for interacting with Trello boards. This server enables seamless integration with Trello's API while handling rate limiting, type safety, and error handling automatically.

## 🎉 New in v1.5.0: Now Powered by Bun! ⚡

**This project is now powered by Bun!** 🚀 We've migrated the entire project to the Bun runtime, resulting in a 2.8-4.4x performance boost. All existing `npx`, `pnpx`, and `npm` commands will **continue to work perfectly**.

### ✨ New in This Release:

  - 🚀 **Performance Boost**: Enjoy a faster, more responsive server.
  -  BUN **Bun-Powered**: The project now runs on the lightning-fast Bun runtime.
  - 📖 **Comprehensive Examples**: A new `examples` directory with detailed implementations in JavaScript, Python, and TypeScript.

**Plus:** Modern MCP SDK architecture, enhanced type safety, and comprehensive documentation!

## Changelog

For a detailed list of changes, please refer to the [CHANGELOG.md](CHANGELOG.md) file.

## Features

  - **Full Trello Board Integration**: Interact with cards, lists, and board activities
  - **🆕 Complete Card Data Extraction**: Fetch all card details including checklists, attachments, labels, members, and comments
  - **💬 Comment Management**: Add, update, delete, and retrieve comments on cards
  - **File Attachments**: Attach any type of file to cards (PDFs, documents, videos, images, etc.) from URLs
  - **Built-in Rate Limiting**: Respects Trello's API limits (300 requests/10s per API key, 100 requests/10s per token)
  - **Type-Safe Implementation**: Written in TypeScript with comprehensive type definitions
  - **Input Validation**: Robust validation for all API inputs
  - **Error Handling**: Graceful error handling with informative messages
  - **Dynamic Board Selection**: Switch between boards and workspaces without restarting
  - **Markdown Formatting**: Export card data in human-readable markdown format

## Installation

### 🚀 Install from MCP Registry (Recommended)

The MCP Server Trello is now available in the official MCP Registry\! MCP clients can automatically discover and install this server.

For clients that support the MCP Registry:

1.  Search for "mcp-server-trello" or "io.github.delorenj/mcp-server-trello"
2.  Install directly from the registry
3.  Configure with your Trello credentials

### 🚀 Quick Start with Bun (Fastest)

If you have [Bun](https://bun.sh) installed, using `bunx` is the fastest way to run the server:

```json
{
  "mcpServers": {
    "trello": {
      "command": "bunx",
      "args": ["@delorenj/mcp-server-trello"],
      "env": {
        "TRELLO_API_KEY": "your-api-key",
        "TRELLO_TOKEN": "your-token"
      }
    }
  }
}
```

### Quick Start with npx / pnpx / bunx

You can still use `npx` or `pnpx`. This doesn't require a global install and will work just fine, though `bunx` (above) is faster.

```json
{
  "mcpServers": {
    "trello": {
      "command": "bunx",
      "args": ["@delorenj/mcp-server-trello"],
      "env": {
        "TRELLO_API_KEY": "your-api-key",
        "TRELLO_TOKEN": "your-token"
      }
    }
  }
}
```

Or if you're using mise, you can explicitly execute `bunx` with `mise exec`:

```json
{
  "mcpServers": {
    "trello": {
      "command": "mise",
      "args": ["x", "--", "bunx", "@delorenj/mcp-server-trello"],
      "env": {
        "TRELLO_API_KEY": "your-api-key",
        "TRELLO_TOKEN": "your-token"
      }
    }
  }
}
```

To connect a Trello workspace, you'll need to manually retrieve a `TRELLO_TOKEN` once per workspace. After setting up your Trello Power-Up, visit the following URL:

```
https://trello.com/1/authorize?expiration=never&name=YOUR_APP_NAME&scope=read,write&response_type=token&key=YOUR_API_KEY
```

Replace:

  * `YOUR_APP_NAME` with a name for your application (e.g., "My Trello Integration"). This name is shown to the user on the Trello authorization screen.
  * `YOUR_API_KEY` with the API key for your Trello Power-Up

This will generate the token required for integration.

> [\!NOTE]
> The `expiration=never` parameter creates a token that does not expire. For enhanced security, consider using `expiration=30days` and renewing the token periodically if your setup allows for it.

#### Don't have Bun?

The simplest way to get `bun` (and thus `bunx`) is through [mise](https://mise.jdx.dev/):

```bash
# Install mise (if you don't have it)
curl https://mise.run | sh

# Install bun and make the @latest version your system default
mise use bun@latest -g

# Or just run `mise install` from the project directory to install Bun locally
cd /path/to/mcp-server-trello
mise install
```

### Installing via npm

If you prefer using `npm` directly:

```bash
npm install -g @delorenj/mcp-server-trello
```

*(A fast alternative is `bun add -g @delorenj/mcp-server-trello`)*

Then use `npx mcp-server-trello` as the command in your MCP configuration.

### Installing via Smithery

To install Trello Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@delorenj/mcp-server-trello):

```bash
# Using bunx (recommended)
bunx -y @smithery/cli install @delorenj/mcp-server-trello --client claude

# Using npx
npx -y @smithery/cli install @delorenj/mcp-server-trello --client claude
```

### Docker Installation

For containerized environments:

1.  Clone the repository:

<!-- end list -->

```bash
git clone https://github.com/delorenj/mcp-server-trello
cd mcp-server-trello
```

2.  Copy the environment template and fill in your Trello credentials:

<!-- end list -->

```bash
cp .env.template .env
```

3.  Build and run with Docker Compose:

<!-- end list -->

```bash
docker compose up --build
```

## Configuration

### Environment Variables

The server can be configured using environment variables. Create a `.env` file in the root directory with the following variables:

```env
# Required: Your Trello API credentials
TRELLO_API_KEY=your-api-key
TRELLO_TOKEN=your-token

# Optional (Deprecated): Default board ID (can be changed later using set_active_board)
TRELLO_BOARD_ID=your-board-id

# Optional: Initial workspace ID (can be changed later using set_active_workspace)
TRELLO_WORKSPACE_ID=your-workspace-id
```

You can get these values from:

  - API Key: [https://trello.com/app-key](https://trello.com/app-key)
  - Token: Generate using your API key
  - Board ID (optional, deprecated): Found in the board URL (e.g., [suspicious link removed])
  - Workspace ID: Found in workspace settings or using `list_workspaces` tool

### Board and Workspace Management

Starting with version 0.3.0, the MCP server supports multiple ways to work with boards:

1.  **Multi-board support**: All methods now accept an optional `boardId` parameter
       - Omit `TRELLO_BOARD_ID` and provide `boardId` in each API call
       - Set `TRELLO_BOARD_ID` as default and optionally override with `boardId` parameter

2.  **Dynamic board selection**: Use workspace management tools
       - The `TRELLO_BOARD_ID` in your `.env` file is used as the initial/default board ID
       - You can change the active board at any time using the `set_active_board` tool
       - The selected board persists between server restarts (stored in `~/.trello-mcp/config.json`)
       - Similarly, you can set and persist an active workspace using `set_active_workspace`

This allows you to work with multiple boards and workspaces without restarting the server.

#### Example Workflow

1.  Start by listing available boards:

<!-- end list -->

```typescript
{
  name: 'list_boards',
  arguments: {}
}
```

2.  Set your active board:

<!-- end list -->

```typescript
{
  name: 'set_active_board',
  arguments: {
    boardId: "abc123"  // ID from list_boards response
  }
}
```

3.  List workspaces if needed:

<!-- end list -->

```typescript
{
  name: 'list_workspaces',
  arguments: {}
}
```

4.  Set active workspace if needed:

<!-- end list -->

```typescript
{
  name: 'set_active_workspace',
  arguments: {
    workspaceId: "xyz789"  // ID from list_workspaces response
  }
}
```

5.  Check current active board info:

<!-- end list -->

```typescript
{
  name: 'get_active_board_info',
  arguments: {}
}
```

## Date Format Guidelines

When working with dates in the Trello MCP server, please note the different format requirements:

  - **Due Date (`dueDate`)**: Accepts full ISO 8601 format with time (e.g., `2023-12-31T12:00:00Z`)
  - **Start Date (`start`)**: Accepts date only in YYYY-MM-DD format (e.g., `2025-08-05`)

This distinction follows Trello's API conventions where start dates are day-based markers while due dates can include specific times.

## Available Tools

### Checklist Management Tools 🆕

#### get\_checklist\_items

Get all items from a checklist by name.

```typescript
{
  name: 'get_checklist_items',
  arguments: {
    name: string,        // Name of the checklist to retrieve items from
    boardId?: string     // Optional: ID of the board (uses default if not provided)
  }
}
```

#### add\_checklist\_item

Add a new item to an existing checklist.

```typescript
{
  name: 'add_checklist_item',
  arguments: {
    text: string,           // Text content of the checklist item
    checkListName: string,  // Name of the checklist to add the item to
    boardId?: string        // Optional: ID of the board (uses default if not provided)
  }
}
```

#### find\_checklist\_items\_by\_description

Search for checklist items containing specific text.

```typescript
{
nbsp; name: 'find_checklist_items_by_description',
  arguments: {
    description: string,  // Text to search for in checklist item descriptions
    boardId?: string      // Optional: ID of the board (uses default if not provided)
nbsp; }
}
```

#### get\_acceptance\_criteria

Get all items from the "Acceptance Criteria" checklist.

```typescript
{
  name: 'get_acceptance_criteria',
  arguments: {
    boardId?: string  // Optional: ID of the board (uses default if not provided)
  }
}
```

#### get\_checklist\_by\_name

Get a complete checklist with all items and completion percentage.

```typescript
{
  name: 'get_checklist_by_name',
  arguments: {
    name: string,     // Name of the checklist to retrieve
    boardId?: string  // Optional: ID of the board (uses default if not provided)
  }
}
```

**Returns:** `CheckList` object with:

  - `id`: Checklist identifier
  - `name`: Checklist name
  - `items`: Array of `CheckListItem` objects
  - `percentComplete`: Completion percentage (0-100)

### get\_card 🆕

Get comprehensive details of a specific Trello card with human-level parity.

```typescript
{
  name: 'get_card',
  arguments: {
    cardId: string,          // ID of the Trello card (short ID like 'FdhbArbK' or full ID)
    includeMarkdown?: boolean // Return formatted markdown instead of JSON (default: false)
  }
}
```

**Returns:** Complete card data including:

  - ✅ Checklists with item states and assignments
  - 📎 Attachments with previews and metadata
  - 🏷️ Labels with names and colors
  - 👥 Assigned members
  - 💬 Comments and activity
  - 📊 Statistics (badges)
  - 🎨 Cover images
  - 📍 Board and list context

### get\_cards\_by\_list\_id

Fetch all cards from a specific list.

```typescript
{
  name: 'get_cards_by_list_id',
  arguments: {
    boardId?: string, // Optional: ID of the board (uses default if not provided)
    listId: string    // ID of the Trello list
  }
}
```

### get\_lists

Retrieve all lists from a board.

```typescript
{
  name: 'get_lists',
  arguments: {
    boardId?: string  // Optional: ID of the board (uses default if not provided)
  }
}
```

### get\_recent\_activity

Fetch recent activity on a board.

```typescript
{
  name: 'get_recent_activity',
  arguments: {
    boardId?: string, // Optional: ID of the board (uses default if not provided)
    limit?: number    // Optional: Number of activities to fetch (default: 10)
  }
}
```

### add\_card\_to\_list

Add a new card to a specified list.

```typescript
{
  name: 'add_card_to_list',
  arguments: {
    boardId?: string,     // Optional: ID of the board (uses default if not provided)
    listId: string,       // ID of the list to add the card to
    name: string,         // Name of the card
    description?: string, // Optional: Description of the card
  mbs; dueDate?: string,     // Optional: Due date (ISO 8601 format with time)
    start?: string,       // Optional: Start date (YYYY-MM-DD format, date only)
    labels?: string[]     // Optional: Array of label IDs
  }
}
```

### update\_card\_details

Update an existing card's details.

```typescript
{
  name: 'update_card_details',
  arguments: {
    boardId?: string,     // Optional: ID of the board (uses default if not provided)
    cardId: string,       // ID of the card to update
    name?: string,        // Optional: New name for the card
    description?: string, // Optional: New description
    dueDate?: string,     // Optional: New due date (ISO 8601 format with time)
    start?: string,       // Optional: New start date (YYYY-MM-DD format, date only)
    dueComplete?: boolean,// Optional: Mark the due date as complete (true) or incomplete (false)
    labels?: string[]     // Optional: New array of label IDs
  }
}
```

### archive\_card

Send a card to the archive.

```typescript
{
  name: 'archive_card',
  arguments: {
    boardId?: string, // Optional: ID of the board (uses default if not provided)
    cardId: string    // ID of the card to archive
  }
}
```

### add\_list\_to\_board

Add a new list to a board.

```typescript
{
nbsp; name: 'add_list_to_board',
  arguments: {
    boardId?: string, // Optional: ID of the board (uses default if not provided)
    name: string      // Name of the new list
  }
}
```

### archive\_list

Send a list to the archive.

```typescript
{
  name: 'archive_list',
  arguments: {
    boardId?: string, // Optional: ID of the board (uses default if not provided)
    listId: string    // ID of the list to archive
  }
}
```

### get\_my\_cards

Fetch all cards assigned to the current user.

```typescript
{
  name: 'get_my_cards',
  arguments: {}
}
```

### move\_card

Move a card to a different list.

```typescript
{
  name: 'move_card',
  arguments: {
    boardId?: string,  // Optional: ID of the target board (uses default if not provided)
s;   cardId: string,    // ID of the card to move
    listId: string     // ID of the target list
  }
}
```

### attach\_image\_to\_card

Attach an image to a card directly from a URL.

```typescript
{
  name: 'attach_image_to_card',
  arguments: {
    boardId?: string, // Optional: ID of the board (uses default if not provided)
    cardId: string,  nbsp; // ID of the card to attach the image to
    imageUrl: string, // URL of the image to attach
    name?: string     // Optional: Name for the attachment (defaults to "Image Attachment")
  }
}
```

### attach\_file\_to\_card

Attach any type of file to a card from a URL or a local file path (e.g., `file:///path/to/your/file.pdf`).

```typescript
{
  name: 'attach_file_to_card',
nbsp; arguments: {
    boardId?: string,  // Optional: ID of the board (uses default if not provided)
    cardId: string,s;   // ID of the card to attach the file to
    fileUrl: string,   // URL or local file path (using the file:// protocol) of the file to attach
    name?: string,     // Optional: Name for the attachment (defaults to the file name for local files)
    mimeType?: string  // Optional: MIME type (e.g., "application/pdf", "text/plain", "video/mp4")
  }
}
```

### Comment Management Tools

#### add\_comment

Add a comment to a Trello card.

```typescript
{
  name: 'add_comment',
  arguments: {
    cardId: string,  // ID of the card to comment on
    text: string     // The text of the comment to add
  }
}
```

#### update\_comment

Update an existing comment on a card.

```typescript
{
  name: 'update_comment',
  arguments: {
    commentId: string,  // ID of the comment to change
    text: string        // The new text of the comment
  }
}
```

#### delete\_comment

Delete a comment from a card.

```typescript
{
  name: 'delete_comment',
  arguments: {
    commentId: string  // ID of the comment to delete
  }
}
```

#### get\_card\_comments

Retrieve all comments from a specific card without fetching all card data.

```typescript
{
  name: 'get_card_comments',
  arguments: {
    cardId: string,  // ID of the card to get comments from
    limit?: number   // Optional: Maximum number of comments to retrieve (default: 100)
  }
}
```


### list\_boards

List all boards the user has access to.

```typescript
{
  name: 'list_boards',
  arguments: {}
}
```

### set\_active\_board

Set the active board for future operations.

```typescript
{
  name: 'set_active_board',
  arguments: {
    boardId: string  // ID of the board to set as active
  }
}
```

### list\_workspaces

List all workspaces the user has access to.

```typescript
{
s; name: 'list_workspaces',
  arguments: {}
}
```

### set\_active\_workspace

Set the active workspace for future operations.

```typescript
{
  name: 'set_active_workspace',
  arguments: {
    workspaceId: string  // ID of the workspace to set as active
  }
}
```

### list\_boards\_in\_workspace

List all boards in a specific workspace.

```typescript
{
  name: 'list_boards_in_workspace',
  arguments: {
    workspaceId: string  // ID of the workspace to list boards from
  }
}
```

### get\_active\_board\_info

Get information about the currently active board.

```typescript
{
s; name: 'get_active_board_info',
  arguments: {}
}
```

## Integration Examples

### 🎨 Pairing with Ideogram MCP Server

The Trello MCP server pairs beautifully with [@flowluap/ideogram-mcp-server](https://github.com/flowluap/ideogram-mcp-server) for AI-powered visual content creation. Generate images with Ideogram and attach them directly to your Trello cards\!

#### Example Workflow

1.  **Generate an image with Ideogram:**

<!-- end list -->

```typescript
// Using ideogram-mcp-server
{
  name: 'generate_image',
  arguments: {
    prompt: "A futuristic dashboard design with neon accents",
    aspect_ratio: "16:9"
  }
}
// Returns: { image_url: "https://..." }
```

2.  **Attach the generated image to a Trello card:**

<!-- end list -->

```typescript
// Using trello-mcp-server
{
  name: 'attach_image_to_card',
  arguments: {
    cardId: "your-card-id",
    imageUrl: "https://...", // URL from Ideogram
    name: "Dashboard Mockup v1"
  }
}
```

#### Setting up both servers

Add both servers to your Claude Desktop configuration. Use `bunx` for the fastest startup.

```json
{
  "mcpServers": {
    "trello": {
      "command": "bunx",
      "args": ["@delorenj/mcp-server-trello"],
nbsp;   "env": {
        "TRELLO_API_KEY": "your-trello-api-key",
        "TRELLO_TOKEN": "your-trello-token"
      }
    },
    "ideogram": {
      "command": "bunx",
      "args": ["@flowluap/ideogram-mcp-server"],
      "env": {
        "IDEOGRAM_API_KEY": "your-ideogram-api-key"
      }
    }
  }
}
```

Now you can seamlessly create visual content and organize it in Trello, all within Claude\!

## Rate Limiting

The server implements a token bucket algorithm for rate limiting to comply with Trello's API limits:

  - 300 requests per 10 seconds per API key
  - 100 requests per 10 seconds per token

Rate limiting is handled automatically, and requests will be queued if limits are reached.

## Error Handling

The server provides detailed error messages for various scenarios:

  - Invalid input parameters
  - Rate limit exceeded
  - API authentication errors
  - Network issues
  - Invalid board/list/card IDs

## Development

### Prerequisites

  - [Bun](https://bun.sh) (v1.0.0 or higher)

### Setup

1.  Clone the repository

<!-- end list -->

```bash
git clone https://github.com/delorenj/mcp-server-trello
cd mcp-server-trello
```

2.  Install dependencies

<!-- end list -->

```bash
bun install
```

3.  Build the project

<!-- end list -->

```bash
bun run build
```

## Running tests

To run the tests, run the following command:

```bash
bun test
```

## Running evals

The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the `bunx` command. Full documentation can be found [here](https://www.mcpevals.io/docs).

```bash
OPENAI_API_KEY=your-key bunx mcp-eval src/evals/evals.ts src/index.ts
```

## Contributing

Contributions are welcome\!

## License

This project is licensed under the MIT License - see the [LICENSE](https://www.google.com/search?q=LICENSE) file for details.

## Acknowledgments

  - Built with the [Model Context Protocol SDK](https://github.com/modelcontextprotocol/typescript-sdk)
  - Uses the [Trello REST API](https://developer.atlassian.com/cloud/trello/rest/)

```

--------------------------------------------------------------------------------
/.claude/commands/monitoring/agents.md:
--------------------------------------------------------------------------------

```markdown
# List Active Patterns

## 🎯 Key Principle
**This tool coordinates Claude Code's actions. It does NOT write code or create content.**

## MCP Tool Usage in Claude Code

**Tool:** `mcp__claude-flow__agent_list`

## Parameters
```json
{
  "swarmId": "current"
}
```

## Description
View all active cognitive patterns and their current focus areas

## Details
Filters:
- **all**: Show all defined patterns
- **active**: Currently engaged patterns
- **idle**: Available but unused patterns
- **busy**: Patterns actively coordinating tasks

## Example Usage

**In Claude Code:**
1. List all agents: Use tool `mcp__claude-flow__agent_list`
2. Get specific agent metrics: Use tool `mcp__claude-flow__agent_metrics` with parameters `{"agentId": "coder-123"}`
3. Monitor agent performance: Use tool `mcp__claude-flow__swarm_monitor` with parameters `{"interval": 2000}`

## Important Reminders
- ✅ This tool provides coordination and structure
- ✅ Claude Code performs all actual implementation
- ❌ The tool does NOT write code
- ❌ The tool does NOT access files directly
- ❌ The tool does NOT execute commands

## See Also
- Main documentation: /CLAUDE.md
- Other commands in this category
- Workflow examples in /workflows/

```

--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------

```markdown
# Contributing to MCP Trello Server

We love your input! We want to make contributing to MCP Trello Server as easy and transparent as possible, whether it's:

- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer

## We Develop with Github
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.

## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html)
Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. Issue that pull request!

## Any contributions you make will be under the MIT Software License
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.

## Report bugs using Github's [issue tracker](https://github.com/modelcontextprotocol/server-trello/issues)
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/modelcontextprotocol/server-trello/issues/new); it's that easy!

## Write bug reports with detail, background, and sample code

**Great Bug Reports** tend to have:

- A quick summary and/or background
- Steps to reproduce
  - Be specific!
  - Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

## Use a Consistent Coding Style

* Use TypeScript for all new code
* 2 spaces for indentation rather than tabs
* You can try running `npm run lint` for style unification

## License
By contributing, you agree that your contributions will be licensed under its MIT License.

```

--------------------------------------------------------------------------------
/CLAUDE.md:
--------------------------------------------------------------------------------

```markdown
# Claude Code Configuration - SPARC Development Environment

## 🚨 CRITICAL: CONCURRENT EXECUTION & FILE MANAGEMENT

**ABSOLUTE RULES**:
1. ALL operations MUST be concurrent/parallel in a single message
2. **NEVER save working files, text/mds and tests to the root folder**
3. ALWAYS organize files in appropriate subdirectories

### ⚡ GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"

**MANDATORY PATTERNS:**
- **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
- **Task tool**: ALWAYS spawn ALL agents in ONE message with full instructions
- **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
- **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
- **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message

### 📁 File Organization Rules

**NEVER save to root folder. Use these directories:**
- `/src` - Source code files
- `/tests` - Test files
- `/docs` - Documentation and markdown files
- `/config` - Configuration files
- `/scripts` - Utility scripts
- `/examples` - Example code

## Project Overview

This project uses SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology with Claude-Flow orchestration for systematic Test-Driven Development.

## SPARC Commands

### Core Commands
- `npx claude-flow sparc modes` - List available modes
- `npx claude-flow sparc run <mode> "<task>"` - Execute specific mode
- `npx claude-flow sparc tdd "<feature>"` - Run complete TDD workflow
- `npx claude-flow sparc info <mode>` - Get mode details

### Batchtools Commands
- `npx claude-flow sparc batch <modes> "<task>"` - Parallel execution
- `npx claude-flow sparc pipeline "<task>"` - Full pipeline processing
- `npx claude-flow sparc concurrent <mode> "<tasks-file>"` - Multi-task processing

### Build Commands
- `npm run build` - Build project
- `npm run test` - Run tests
- `npm run lint` - Linting
- `npm run typecheck` - Type checking

## SPARC Workflow Phases

1. **Specification** - Requirements analysis (`sparc run spec-pseudocode`)
2. **Pseudocode** - Algorithm design (`sparc run spec-pseudocode`)
3. **Architecture** - System design (`sparc run architect`)
4. **Refinement** - TDD implementation (`sparc tdd`)
5. **Completion** - Integration (`sparc run integration`)

## Code Style & Best Practices

- **Modular Design**: Files under 500 lines
- **Environment Safety**: Never hardcode secrets
- **Test-First**: Write tests before implementation
- **Clean Architecture**: Separate concerns
- **Documentation**: Keep updated

## 🚀 Available Agents (54 Total)

### Core Development
`coder`, `reviewer`, `tester`, `planner`, `researcher`

### Swarm Coordination
`hierarchical-coordinator`, `mesh-coordinator`, `adaptive-coordinator`, `collective-intelligence-coordinator`, `swarm-memory-manager`

### Consensus & Distributed
`byzantine-coordinator`, `raft-manager`, `gossip-coordinator`, `consensus-builder`, `crdt-synchronizer`, `quorum-manager`, `security-manager`

### Performance & Optimization
`perf-analyzer`, `performance-benchmarker`, `task-orchestrator`, `memory-coordinator`, `smart-agent`

### GitHub & Repository
`github-modes`, `pr-manager`, `code-review-swarm`, `issue-tracker`, `release-manager`, `workflow-automation`, `project-board-sync`, `repo-architect`, `multi-repo-swarm`

### SPARC Methodology
`sparc-coord`, `sparc-coder`, `specification`, `pseudocode`, `architecture`, `refinement`

### Specialized Development
`backend-dev`, `mobile-dev`, `ml-developer`, `cicd-engineer`, `api-docs`, `system-architect`, `code-analyzer`, `base-template-generator`

### Testing & Validation
`tdd-london-swarm`, `production-validator`

### Migration & Planning
`migration-planner`, `swarm-init`

## 🎯 Claude Code vs MCP Tools

### Claude Code Handles ALL:
- File operations (Read, Write, Edit, MultiEdit, Glob, Grep)
- Code generation and programming
- Bash commands and system operations
- Implementation work
- Project navigation and analysis
- TodoWrite and task management
- Git operations
- Package management
- Testing and debugging

### MCP Tools ONLY:
- Coordination and planning
- Memory management
- Neural features
- Performance tracking
- Swarm orchestration
- GitHub integration

**KEY**: MCP coordinates, Claude Code executes.

## 🚀 Quick Setup

```bash
# Add Claude Flow MCP server
claude mcp add claude-flow npx claude-flow@alpha mcp start
```

## MCP Tool Categories

### Coordination
`swarm_init`, `agent_spawn`, `task_orchestrate`

### Monitoring
`swarm_status`, `agent_list`, `agent_metrics`, `task_status`, `task_results`

### Memory & Neural
`memory_usage`, `neural_status`, `neural_train`, `neural_patterns`

### GitHub Integration
`github_swarm`, `repo_analyze`, `pr_enhance`, `issue_triage`, `code_review`

### System
`benchmark_run`, `features_detect`, `swarm_monitor`

## 📋 Agent Coordination Protocol

### Every Agent MUST:

**1️⃣ BEFORE Work:**
```bash
npx claude-flow@alpha hooks pre-task --description "[task]"
npx claude-flow@alpha hooks session-restore --session-id "swarm-[id]"
```

**2️⃣ DURING Work:**
```bash
npx claude-flow@alpha hooks post-edit --file "[file]" --memory-key "swarm/[agent]/[step]"
npx claude-flow@alpha hooks notify --message "[what was done]"
```

**3️⃣ AFTER Work:**
```bash
npx claude-flow@alpha hooks post-task --task-id "[task]"
npx claude-flow@alpha hooks session-end --export-metrics true
```

## 🎯 Concurrent Execution Examples

### ✅ CORRECT (Single Message):
```javascript
[BatchTool]:
  // Initialize swarm
  mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 6 }
  mcp__claude-flow__agent_spawn { type: "researcher" }
  mcp__claude-flow__agent_spawn { type: "coder" }
  mcp__claude-flow__agent_spawn { type: "tester" }
  
  // Spawn agents with Task tool
  Task("Research agent: Analyze requirements...")
  Task("Coder agent: Implement features...")
  Task("Tester agent: Create test suite...")
  
  // Batch todos
  TodoWrite { todos: [
    {id: "1", content: "Research", status: "in_progress", priority: "high"},
    {id: "2", content: "Design", status: "pending", priority: "high"},
    {id: "3", content: "Implement", status: "pending", priority: "high"},
    {id: "4", content: "Test", status: "pending", priority: "medium"},
    {id: "5", content: "Document", status: "pending", priority: "low"}
  ]}
  
  // File operations
  Bash "mkdir -p app/{src,tests,docs}"
  Write "app/src/index.js"
  Write "app/tests/index.test.js"
  Write "app/docs/README.md"
```

### ❌ WRONG (Multiple Messages):
```javascript
Message 1: mcp__claude-flow__swarm_init
Message 2: Task("agent 1")
Message 3: TodoWrite { todos: [single todo] }
Message 4: Write "file.js"
// This breaks parallel coordination!
```

## Performance Benefits

- **84.8% SWE-Bench solve rate**
- **32.3% token reduction**
- **2.8-4.4x speed improvement**
- **27+ neural models**

## Hooks Integration

### Pre-Operation
- Auto-assign agents by file type
- Validate commands for safety
- Prepare resources automatically
- Optimize topology by complexity
- Cache searches

### Post-Operation
- Auto-format code
- Train neural patterns
- Update memory
- Analyze performance
- Track token usage

### Session Management
- Generate summaries
- Persist state
- Track metrics
- Restore context
- Export workflows

## Advanced Features (v2.0.0)

- 🚀 Automatic Topology Selection
- ⚡ Parallel Execution (2.8-4.4x speed)
- 🧠 Neural Training
- 📊 Bottleneck Analysis
- 🤖 Smart Auto-Spawning
- 🛡️ Self-Healing Workflows
- 💾 Cross-Session Memory
- 🔗 GitHub Integration

## Integration Tips

1. Start with basic swarm init
2. Scale agents gradually
3. Use memory for context
4. Monitor progress regularly
5. Train patterns from success
6. Enable hooks automation
7. Use GitHub tools first

## Support

- Documentation: https://github.com/ruvnet/claude-flow
- Issues: https://github.com/ruvnet/claude-flow/issues

---

Remember: **Claude Flow coordinates, Claude Code creates!**
```

--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------

```javascript

```

--------------------------------------------------------------------------------
/server.schema.json:
--------------------------------------------------------------------------------

```json

```

--------------------------------------------------------------------------------
/.claude-flow/metrics/agent-metrics.json:
--------------------------------------------------------------------------------

```json
{}
```

--------------------------------------------------------------------------------
/mise.toml:
--------------------------------------------------------------------------------

```toml
[tools]
node = "latest"
pnpm = "latest"

```

--------------------------------------------------------------------------------
/.claude-flow/metrics/performance.json:
--------------------------------------------------------------------------------

```json
{
  "startTime": 1756696906489,
  "totalTasks": 2,
  "successfulTasks": 2,
  "failedTasks": 0,
  "totalAgents": 0,
  "activeAgents": 0,
  "neuralEvents": 0
}
```

--------------------------------------------------------------------------------
/.claude-flow/metrics/task-metrics.json:
--------------------------------------------------------------------------------

```json
[
  {
    "id": "cmd-hive-mind-1758703427581",
    "type": "hive-mind",
    "success": true,
    "duration": 47.82606199999999,
    "timestamp": 1758703427629,
    "metadata": {}
  }
]
```

--------------------------------------------------------------------------------
/compose.yml:
--------------------------------------------------------------------------------

```yaml
services:
  mcp-server-trello:
    container_name: mcp-server-trello
    build: .
    environment:
      TRELLO_API_KEY: ${TRELLO_API_KEY}
      TRELLO_TOKEN: ${TRELLO_TOKEN}
    restart: 'no'


```

--------------------------------------------------------------------------------
/docs/session/goal.md:
--------------------------------------------------------------------------------

```markdown
# Goal

Help me thoroughly test this server's functionality.

## Requirements

- [x] Test `get_cards_by_list_id` tool
- [x] Test `get_lists` tool
- [ ] Test `get_recent_activity` tool
- [ ] Test `add_card_to_list` tool
- [ ] Test `update_card_details` tool
- [ ] Test `archive_card` tool
- [ ] Test `add_list_to_board` tool
- [ ] Test `archive_list` tool
- [ ] Test `get_my_cards` tool
```

--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------

```json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ES2020",
    "moduleResolution": "node",
    "outDir": "./build",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "declaration": true,
    "sourceMap": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "build"]
}
```

--------------------------------------------------------------------------------
/.claude/commands/monitoring/swarm-monitor.md:
--------------------------------------------------------------------------------

```markdown
# swarm-monitor

Real-time swarm monitoring.

## Usage
```bash
npx claude-flow swarm monitor [options]
```

## Options
- `--interval <ms>` - Update interval
- `--metrics` - Show detailed metrics
- `--export` - Export monitoring data

## Examples
```bash
# Start monitoring
npx claude-flow swarm monitor

# Custom interval
npx claude-flow swarm monitor --interval 5000

# With metrics
npx claude-flow swarm monitor --metrics
```

```

--------------------------------------------------------------------------------
/.claude/commands/monitoring/agent-metrics.md:
--------------------------------------------------------------------------------

```markdown
# agent-metrics

View agent performance metrics.

## Usage
```bash
npx claude-flow agent metrics [options]
```

## Options
- `--agent-id <id>` - Specific agent
- `--period <time>` - Time period
- `--format <type>` - Output format

## Examples
```bash
# All agents metrics
npx claude-flow agent metrics

# Specific agent
npx claude-flow agent metrics --agent-id agent-001

# Last hour
npx claude-flow agent metrics --period 1h
```

```

--------------------------------------------------------------------------------
/example.env:
--------------------------------------------------------------------------------

```
# If your board is `https://trello.com/b/7aABC123A/myorg`
# replace `/myorg` with `.json` like this:
#
# https://trello.com/b/7aABC123A.json`
#
# The first field (`:id`) in the rendered json block is the board id
TRELLO_BOARD_ID=<YOUR-BOARD-ID>

TRELLO_API_KEY=<YOUR-API-KEY> # https://trello.com/app-key
TRELLO_TOKEN=<YOUR-APP-TOKEN> # https://trello.com/1/authorize?expiration=never&name=YOUR_TRELLO_WORKSPACE&scope=read,write&response_type=token&key=YOUR_API_KEY

```

--------------------------------------------------------------------------------
/.claude/commands/workflows/workflow-create.md:
--------------------------------------------------------------------------------

```markdown
# workflow-create

Create reusable workflow templates.

## Usage
```bash
npx claude-flow workflow create [options]
```

## Options
- `--name <name>` - Workflow name
- `--from-history` - Create from history
- `--interactive` - Interactive creation

## Examples
```bash
# Create workflow
npx claude-flow workflow create --name "deploy-api"

# From history
npx claude-flow workflow create --name "test-suite" --from-history

# Interactive mode
npx claude-flow workflow create --interactive
```

```

--------------------------------------------------------------------------------
/.claude/commands/training/neural-train.md:
--------------------------------------------------------------------------------

```markdown
# neural-train

Train neural patterns from operations.

## Usage
```bash
npx claude-flow training neural-train [options]
```

## Options
- `--data <source>` - Training data source
- `--model <name>` - Target model
- `--epochs <n>` - Training epochs

## Examples
```bash
# Train from recent ops
npx claude-flow training neural-train --data recent

# Specific model
npx claude-flow training neural-train --model task-predictor

# Custom epochs
npx claude-flow training neural-train --epochs 100
```

```

--------------------------------------------------------------------------------
/.claude/commands/monitoring/real-time-view.md:
--------------------------------------------------------------------------------

```markdown
# real-time-view

Real-time view of swarm activity.

## Usage
```bash
npx claude-flow monitoring real-time-view [options]
```

## Options
- `--filter <type>` - Filter view
- `--highlight <pattern>` - Highlight pattern
- `--tail <n>` - Show last N events

## Examples
```bash
# Start real-time view
npx claude-flow monitoring real-time-view

# Filter errors
npx claude-flow monitoring real-time-view --filter errors

# Highlight pattern
npx claude-flow monitoring real-time-view --highlight "API"
```

```

--------------------------------------------------------------------------------
/.claude/commands/training/pattern-learn.md:
--------------------------------------------------------------------------------

```markdown
# pattern-learn

Learn patterns from successful operations.

## Usage
```bash
npx claude-flow training pattern-learn [options]
```

## Options
- `--source <type>` - Pattern source
- `--threshold <score>` - Success threshold
- `--save <name>` - Save pattern set

## Examples
```bash
# Learn from all ops
npx claude-flow training pattern-learn

# High success only
npx claude-flow training pattern-learn --threshold 0.9

# Save patterns
npx claude-flow training pattern-learn --save optimal-patterns
```

```

--------------------------------------------------------------------------------
/.claude/commands/training/model-update.md:
--------------------------------------------------------------------------------

```markdown
# model-update

Update neural models with new data.

## Usage
```bash
npx claude-flow training model-update [options]
```

## Options
- `--model <name>` - Model to update
- `--incremental` - Incremental update
- `--validate` - Validate after update

## Examples
```bash
# Update all models
npx claude-flow training model-update

# Specific model
npx claude-flow training model-update --model agent-selector

# Incremental with validation
npx claude-flow training model-update --incremental --validate
```

```

--------------------------------------------------------------------------------
/.claude/commands/workflows/workflow-execute.md:
--------------------------------------------------------------------------------

```markdown
# workflow-execute

Execute saved workflows.

## Usage
```bash
npx claude-flow workflow execute [options]
```

## Options
- `--name <name>` - Workflow name
- `--params <json>` - Workflow parameters
- `--dry-run` - Preview execution

## Examples
```bash
# Execute workflow
npx claude-flow workflow execute --name "deploy-api"

# With parameters
npx claude-flow workflow execute --name "test-suite" --params '{"env": "staging"}'

# Dry run
npx claude-flow workflow execute --name "deploy-api" --dry-run
```

```

--------------------------------------------------------------------------------
/.claude/commands/workflows/workflow-export.md:
--------------------------------------------------------------------------------

```markdown
# workflow-export

Export workflows for sharing.

## Usage
```bash
npx claude-flow workflow export [options]
```

## Options
- `--name <name>` - Workflow to export
- `--format <type>` - Export format
- `--include-history` - Include execution history

## Examples
```bash
# Export workflow
npx claude-flow workflow export --name "deploy-api"

# As YAML
npx claude-flow workflow export --name "test-suite" --format yaml

# With history
npx claude-flow workflow export --name "deploy-api" --include-history
```

```

--------------------------------------------------------------------------------
/.claude/commands/optimization/cache-manage.md:
--------------------------------------------------------------------------------

```markdown
# cache-manage

Manage operation cache for performance.

## Usage
```bash
npx claude-flow optimization cache-manage [options]
```

## Options
- `--action <type>` - Action (view, clear, optimize)
- `--max-size <mb>` - Maximum cache size
- `--ttl <seconds>` - Time to live

## Examples
```bash
# View cache stats
npx claude-flow optimization cache-manage --action view

# Clear cache
npx claude-flow optimization cache-manage --action clear

# Set limits
npx claude-flow optimization cache-manage --max-size 100 --ttl 3600
```

```

--------------------------------------------------------------------------------
/.claude/commands/automation/smart-spawn.md:
--------------------------------------------------------------------------------

```markdown
# smart-spawn

Intelligently spawn agents based on workload analysis.

## Usage
```bash
npx claude-flow automation smart-spawn [options]
```

## Options
- `--analyze` - Analyze before spawning
- `--threshold <n>` - Spawn threshold
- `--topology <type>` - Preferred topology

## Examples
```bash
# Smart spawn with analysis
npx claude-flow automation smart-spawn --analyze

# Set spawn threshold
npx claude-flow automation smart-spawn --threshold 5

# Force topology
npx claude-flow automation smart-spawn --topology hierarchical
```

```

--------------------------------------------------------------------------------
/.claude/commands/github/pr-enhance.md:
--------------------------------------------------------------------------------

```markdown
# pr-enhance

AI-powered pull request enhancements.

## Usage
```bash
npx claude-flow github pr-enhance [options]
```

## Options
- `--pr-number <n>` - Pull request number
- `--add-tests` - Add missing tests
- `--improve-docs` - Improve documentation
- `--check-security` - Security review

## Examples
```bash
# Enhance PR
npx claude-flow github pr-enhance --pr-number 123

# Add tests
npx claude-flow github pr-enhance --pr-number 123 --add-tests

# Full enhancement
npx claude-flow github pr-enhance --pr-number 123 --add-tests --improve-docs
```

```

--------------------------------------------------------------------------------
/.claude/commands/github/code-review.md:
--------------------------------------------------------------------------------

```markdown
# code-review

Automated code review with swarm intelligence.

## Usage
```bash
npx claude-flow github code-review [options]
```

## Options
- `--pr-number <n>` - Pull request to review
- `--focus <areas>` - Review focus (security, performance, style)
- `--suggest-fixes` - Suggest code fixes

## Examples
```bash
# Review PR
npx claude-flow github code-review --pr-number 456

# Security focus
npx claude-flow github code-review --pr-number 456 --focus security

# With fix suggestions
npx claude-flow github code-review --pr-number 456 --suggest-fixes
```

```

--------------------------------------------------------------------------------
/.claude/commands/analysis/token-usage.md:
--------------------------------------------------------------------------------

```markdown
# token-usage

Analyze token usage patterns and optimize for efficiency.

## Usage
```bash
npx claude-flow analysis token-usage [options]
```

## Options
- `--period <time>` - Analysis period (1h, 24h, 7d, 30d)
- `--by-agent` - Break down by agent
- `--by-operation` - Break down by operation type

## Examples
```bash
# Last 24 hours token usage
npx claude-flow analysis token-usage --period 24h

# By agent breakdown
npx claude-flow analysis token-usage --by-agent

# Export detailed report
npx claude-flow analysis token-usage --period 7d --export tokens.csv
```

```

--------------------------------------------------------------------------------
/.claude/commands/optimization/topology-optimize.md:
--------------------------------------------------------------------------------

```markdown
# topology-optimize

Optimize swarm topology for current workload.

## Usage
```bash
npx claude-flow optimization topology-optimize [options]
```

## Options
- `--analyze-first` - Analyze before optimizing
- `--target <metric>` - Optimization target
- `--apply` - Apply optimizations

## Examples
```bash
# Analyze and suggest
npx claude-flow optimization topology-optimize --analyze-first

# Optimize for speed
npx claude-flow optimization topology-optimize --target speed

# Apply changes
npx claude-flow optimization topology-optimize --target efficiency --apply
```

```

--------------------------------------------------------------------------------
/.claude/commands/coordination/agent-spawn.md:
--------------------------------------------------------------------------------

```markdown
# agent-spawn

Spawn a new agent in the current swarm.

## Usage
```bash
npx claude-flow agent spawn [options]
```

## Options
- `--type <type>` - Agent type (coder, researcher, analyst, tester, coordinator)
- `--name <name>` - Custom agent name
- `--skills <list>` - Specific skills (comma-separated)

## Examples
```bash
# Spawn coder agent
npx claude-flow agent spawn --type coder

# With custom name
npx claude-flow agent spawn --type researcher --name "API Expert"

# With specific skills
npx claude-flow agent spawn --type coder --skills "python,fastapi,testing"
```

```

--------------------------------------------------------------------------------
/.claude/commands/github/issue-triage.md:
--------------------------------------------------------------------------------

```markdown
# issue-triage

Intelligent issue classification and triage.

## Usage
```bash
npx claude-flow github issue-triage [options]
```

## Options
- `--repository <owner/repo>` - Target repository
- `--auto-label` - Automatically apply labels
- `--assign` - Auto-assign to team members

## Examples
```bash
# Triage issues
npx claude-flow github issue-triage --repository myorg/myrepo

# With auto-labeling
npx claude-flow github issue-triage --repository myorg/myrepo --auto-label

# Full automation
npx claude-flow github issue-triage --repository myorg/myrepo --auto-label --assign
```

```

--------------------------------------------------------------------------------
/.claude/commands/optimization/parallel-execute.md:
--------------------------------------------------------------------------------

```markdown
# parallel-execute

Execute tasks in parallel for maximum efficiency.

## Usage
```bash
npx claude-flow optimization parallel-execute [options]
```

## Options
- `--tasks <file>` - Task list file
- `--max-parallel <n>` - Maximum parallel tasks
- `--strategy <type>` - Execution strategy

## Examples
```bash
# Execute task list
npx claude-flow optimization parallel-execute --tasks tasks.json

# Limit parallelism
npx claude-flow optimization parallel-execute --tasks tasks.json --max-parallel 5

# Custom strategy
npx claude-flow optimization parallel-execute --strategy adaptive
```

```

--------------------------------------------------------------------------------
/.claude/config.json:
--------------------------------------------------------------------------------

```json
{
  "version": "1.0",
  "sparc": {
    "enabled": true,
    "modes": [
      "orchestrator",
      "coder",
      "researcher",
      "tdd",
      "architect",
      "reviewer",
      "debugger",
      "tester",
      "analyzer",
      "optimizer",
      "documenter",
      "designer",
      "innovator",
      "swarm-coordinator",
      "memory-manager",
      "batch-executor",
      "workflow-manager"
    ]
  },
  "swarm": {
    "enabled": true,
    "strategies": [
      "research",
      "development",
      "analysis",
      "testing",
      "optimization",
      "maintenance"
    ]
  }
}
```

--------------------------------------------------------------------------------
/.claude/commands/github/repo-analyze.md:
--------------------------------------------------------------------------------

```markdown
# repo-analyze

Deep analysis of GitHub repository with AI insights.

## Usage
```bash
npx claude-flow github repo-analyze [options]
```

## Options
- `--repository <owner/repo>` - Repository to analyze
- `--deep` - Enable deep analysis
- `--include <areas>` - Include specific areas (issues, prs, code, commits)

## Examples
```bash
# Basic analysis
npx claude-flow github repo-analyze --repository myorg/myrepo

# Deep analysis
npx claude-flow github repo-analyze --repository myorg/myrepo --deep

# Specific areas
npx claude-flow github repo-analyze --repository myorg/myrepo --include issues,prs
```

```

--------------------------------------------------------------------------------
/.claude/commands/automation/workflow-select.md:
--------------------------------------------------------------------------------

```markdown
# workflow-select

Automatically select optimal workflow based on task type.

## Usage
```bash
npx claude-flow automation workflow-select [options]
```

## Options
- `--task <description>` - Task description
- `--constraints <list>` - Workflow constraints
- `--preview` - Preview without executing

## Examples
```bash
# Select workflow for task
npx claude-flow automation workflow-select --task "Deploy to production"

# With constraints
npx claude-flow automation workflow-select --constraints "no-downtime,rollback"

# Preview mode
npx claude-flow automation workflow-select --task "Database migration" --preview
```

```

--------------------------------------------------------------------------------
/.claude/commands/analysis/performance-report.md:
--------------------------------------------------------------------------------

```markdown
# performance-report

Generate comprehensive performance reports for swarm operations.

## Usage
```bash
npx claude-flow analysis performance-report [options]
```

## Options
- `--format <type>` - Report format (json, html, markdown)
- `--include-metrics` - Include detailed metrics
- `--compare <id>` - Compare with previous swarm

## Examples
```bash
# Generate HTML report
npx claude-flow analysis performance-report --format html

# Compare swarms
npx claude-flow analysis performance-report --compare swarm-123

# Full metrics report
npx claude-flow analysis performance-report --include-metrics --format markdown
```

```

--------------------------------------------------------------------------------
/.claude/commands/coordination/task-orchestrate.md:
--------------------------------------------------------------------------------

```markdown
# task-orchestrate

Orchestrate complex tasks across the swarm.

## Usage
```bash
npx claude-flow task orchestrate [options]
```

## Options
- `--task <description>` - Task description
- `--strategy <type>` - Orchestration strategy
- `--priority <level>` - Task priority (low, medium, high, critical)

## Examples
```bash
# Orchestrate development task
npx claude-flow task orchestrate --task "Implement user authentication"

# High priority task
npx claude-flow task orchestrate --task "Fix production bug" --priority critical

# With specific strategy
npx claude-flow task orchestrate --task "Refactor codebase" --strategy parallel
```

```

--------------------------------------------------------------------------------
/smithery.yaml:
--------------------------------------------------------------------------------

```yaml
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml

startCommand:
  type: stdio
  configSchema:
    # JSON Schema defining the configuration options for the MCP.
    type: object
    required:
      - trelloApiKey
      - trelloToken
      - trelloBoardId
    properties:
      trelloApiKey:
        type: string
        description: The API key for the Trello server.
      trelloToken:
        type: string
        description: The token for authenticating with Trello.
      trelloBoardId:
        type: string
        description: The ID of the Trello board to interact with.
  commandFunction:
    # A function that produces the CLI command to start the MCP on stdio.
    |-
    (config) => ({command:'node',args:['build/index.js'],env:{TRELLO_API_KEY:config.trelloApiKey,TRELLO_TOKEN:config.trelloToken,TRELLO_BOARD_ID:config.trelloBoardId}})
```

--------------------------------------------------------------------------------
/.github/workflows/publish-registry.yml:
--------------------------------------------------------------------------------

```yaml
name: Publish to MCP Registry

on:
  release:
    types: [published]
  push:
    branches: [main]
    paths: ['server.json', 'package.json']

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Bun
        uses: oven-sh/setup-bun@v2
        with:
          bun-version: latest

      - name: Install dependencies
        run: bun install

      - name: Build project
        run: bun run build

      - name: Build latest mcp-publisher
        run: |
          git clone https://github.com/modelcontextprotocol/registry.git /tmp/registry
          cd /tmp/registry
          make publisher
          cp bin/mcp-publisher $GITHUB_WORKSPACE/

      - name: Authenticate with GitHub OIDC
        run: ./mcp-publisher login github-oidc

      - name: Publish to MCP Registry
        run: ./mcp-publisher publish

```

--------------------------------------------------------------------------------
/.claude/commands/analysis/token-efficiency.md:
--------------------------------------------------------------------------------

```markdown
# Token Usage Optimization

## Purpose
Reduce token consumption while maintaining quality through intelligent coordination.

## Optimization Strategies

### 1. Smart Caching
- Search results cached for 5 minutes
- File content cached during session
- Pattern recognition reduces redundant searches

### 2. Efficient Coordination
- Agents share context automatically
- Avoid duplicate file reads
- Batch related operations

### 3. Measurement & Tracking

```bash
# Check token savings after session
Tool: mcp__claude-flow__token_usage
Parameters: {"operation": "session", "timeframe": "24h"}

# Result shows:
{
  "metrics": {
    "tokensSaved": 15420,
    "operations": 45,
    "efficiency": "343 tokens/operation"
  }
}
```

## Best Practices
1. **Use Task tool** for complex searches
2. **Enable caching** in pre-search hooks
3. **Batch operations** when possible
4. **Review session summaries** for insights

## Token Reduction Results
- 📉 32.3% average token reduction
- 🎯 More focused operations
- 🔄 Intelligent result reuse
- 📊 Cumulative improvements
```

--------------------------------------------------------------------------------
/.claude/commands/sparc/tester.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Tester Mode

## Purpose
Comprehensive testing with parallel execution capabilities.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "tester",
  task_description: "full regression suite",
  options: {
    parallel: true,
    coverage: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run tester "full regression suite"

# For alpha features
npx claude-flow@alpha sparc run tester "full regression suite"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run tester "full regression suite"
```

## Core Capabilities
- Test planning
- Test execution
- Bug detection
- Coverage analysis
- Report generation

## Test Types
- Unit tests
- Integration tests
- E2E tests
- Performance tests
- Security tests

## Parallel Features
- Concurrent test runs
- Distributed testing
- Load testing
- Cross-browser testing
- Multi-environment validation

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/tdd.md:
--------------------------------------------------------------------------------

```markdown
# SPARC TDD Mode

## Purpose
Test-driven development with TodoWrite planning and comprehensive testing.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "tdd",
  task_description: "shopping cart feature",
  options: {
    coverage_target: 90,
    test_framework: "jest"
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run tdd "shopping cart feature"

# For alpha features
npx claude-flow@alpha sparc run tdd "shopping cart feature"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run tdd "shopping cart feature"
```

## Core Capabilities
- Test-first development
- Red-green-refactor cycle
- Test suite design
- Coverage optimization
- Continuous testing

## TDD Workflow
1. Write failing tests
2. Implement minimum code
3. Make tests pass
4. Refactor code
5. Repeat cycle

## Testing Strategies
- Unit testing
- Integration testing
- End-to-end testing
- Performance testing
- Security testing

```

--------------------------------------------------------------------------------
/server.json:
--------------------------------------------------------------------------------

```json
{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-16/server.schema.json",
  "name": "io.github.delorenj/mcp-server-trello",
  "description": "MCP server for Trello boards with rate limiting, type safety, and comprehensive API integration.",
  "status": "active",
  "websiteUrl": "https://delorenj.github.io/mcp-server-trello",
  "repository": {
    "url": "https://github.com/delorenj/mcp-server-trello",
    "source": "github"
  },
  "version": "1.5.6",
  "packages": [
    {
      "registryType": "npm",
      "registryBaseUrl": "https://registry.npmjs.org",
      "identifier": "@delorenj/mcp-server-trello",
      "version": "1.5.6",
      "transport": {
        "type": "stdio"
      },
      "environmentVariables": [
        {
          "name": "TRELLO_API_KEY",
          "description": "Your Trello API key",
          "isRequired": true,
          "format": "string",
          "isSecret": true
        },
        {
          "name": "TRELLO_TOKEN",
          "description": "Your Trello token",
          "isRequired": true,
          "format": "string",
          "isSecret": true
        }
      ]
    }
  ]
}

```

--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------

```dockerfile
# Use official Bun image as builder
FROM oven/bun:1-alpine AS builder
LABEL org.opencontainers.image.source=https://github.com/delorenj/mcp-server-trello

# Set the working directory to /app
WORKDIR /app

# Install build dependencies
RUN apk add --no-cache python3 make g++

# Copy package files first to leverage Docker cache
COPY package.json bun.lock ./

# Install all dependencies (including dev dependencies)
RUN bun install --frozen

# Copy the rest of the code
COPY . .

# Build TypeScript
RUN bun run build

# Use official Bun image for runtime
FROM oven/bun:1-alpine AS release

# Set the working directory to /app
WORKDIR /app

# Copy only the necessary files from builder
COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json ./
COPY --from=builder /app/bun.lock ./

# Install only production dependencies without running scripts
RUN bun install --production --frozen

# The environment variables should be passed at runtime, not baked into the image
# They can be provided via docker run -e or docker compose environment section
ENV NODE_ENV=production

# Run the MCP server using Bun
CMD ["bun", "build/index.js"]

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/designer.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Designer Mode

## Purpose
UI/UX design with Memory coordination for consistent experiences.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "designer",
  task_description: "create dashboard UI",
  options: {
    design_system: true,
    responsive: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run designer "create dashboard UI"

# For alpha features
npx claude-flow@alpha sparc run designer "create dashboard UI"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run designer "create dashboard UI"
```

## Core Capabilities
- Interface design
- Component architecture
- Design system creation
- Accessibility planning
- Responsive layouts

## Design Process
- User research insights
- Wireframe creation
- Component design
- Interaction patterns
- Design token management

## Memory Coordination
- Store design decisions
- Share component specs
- Maintain consistency
- Track design evolution

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/workflow-manager.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Workflow Manager Mode

## Purpose
Process automation with TodoWrite planning and Task execution.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "workflow-manager",
  task_description: "automate deployment",
  options: {
    pipeline: "ci-cd",
    rollback_enabled: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run workflow-manager "automate deployment"

# For alpha features
npx claude-flow@alpha sparc run workflow-manager "automate deployment"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run workflow-manager "automate deployment"
```

## Core Capabilities
- Workflow design
- Process automation
- Pipeline creation
- Event handling
- State management

## Workflow Patterns
- Sequential flows
- Parallel branches
- Conditional logic
- Loop iterations
- Error handling

## Automation Features
- Trigger management
- Task scheduling
- Progress tracking
- Result validation
- Rollback capability

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/reviewer.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Reviewer Mode

## Purpose
Code review using batch file analysis for comprehensive reviews.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "reviewer",
  task_description: "review pull request #123",
  options: {
    security_check: true,
    performance_check: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run reviewer "review pull request #123"

# For alpha features
npx claude-flow@alpha sparc run reviewer "review pull request #123"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run reviewer "review pull request #123"
```

## Core Capabilities
- Code quality assessment
- Security review
- Performance analysis
- Best practices check
- Documentation review

## Review Criteria
- Code correctness
- Design patterns
- Error handling
- Test coverage
- Maintainability

## Batch Analysis
- Parallel file review
- Pattern detection
- Dependency checking
- Consistency validation
- Automated reporting

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/documenter.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Documenter Mode

## Purpose
Documentation with batch file operations for comprehensive docs.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "documenter",
  task_description: "create API documentation",
  options: {
    format: "markdown",
    include_examples: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run documenter "create API documentation"

# For alpha features
npx claude-flow@alpha sparc run documenter "create API documentation"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run documenter "create API documentation"
```

## Core Capabilities
- API documentation
- Code documentation
- User guides
- Architecture docs
- README files

## Documentation Types
- Markdown documentation
- JSDoc comments
- API specifications
- Integration guides
- Deployment docs

## Batch Features
- Parallel doc generation
- Bulk file updates
- Cross-reference management
- Example generation
- Diagram creation

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/coder.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Coder Mode

## Purpose
Autonomous code generation with batch file operations.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "coder",
  task_description: "implement user authentication",
  options: {
    test_driven: true,
    parallel_edits: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run coder "implement user authentication"

# For alpha features
npx claude-flow@alpha sparc run coder "implement user authentication"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run coder "implement user authentication"
```

## Core Capabilities
- Feature implementation
- Code refactoring
- Bug fixes
- API development
- Algorithm implementation

## Batch Operations
- Parallel file creation
- Concurrent code modifications
- Batch import updates
- Test file generation
- Documentation updates

## Code Quality
- ES2022 standards
- Type safety with TypeScript
- Comprehensive error handling
- Performance optimization
- Security best practices

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/swarm-coordinator.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Swarm Coordinator Mode

## Purpose
Specialized swarm management with batch coordination capabilities.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "swarm-coordinator",
  task_description: "manage development swarm",
  options: {
    topology: "hierarchical",
    max_agents: 10
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run swarm-coordinator "manage development swarm"

# For alpha features
npx claude-flow@alpha sparc run swarm-coordinator "manage development swarm"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run swarm-coordinator "manage development swarm"
```

## Core Capabilities
- Swarm initialization
- Agent management
- Task distribution
- Load balancing
- Result collection

## Coordination Modes
- Hierarchical swarms
- Mesh networks
- Pipeline coordination
- Adaptive strategies
- Hybrid approaches

## Management Features
- Dynamic scaling
- Resource optimization
- Failure recovery
- Performance monitoring
- Quality assurance

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/debugger.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Debugger Mode

## Purpose
Systematic debugging with TodoWrite and Memory integration.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "debugger",
  task_description: "fix authentication issues",
  options: {
    verbose: true,
    trace: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run debugger "fix authentication issues"

# For alpha features
npx claude-flow@alpha sparc run debugger "fix authentication issues"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run debugger "fix authentication issues"
```

## Core Capabilities
- Issue reproduction
- Root cause analysis
- Stack trace analysis
- Memory leak detection
- Performance bottleneck identification

## Debugging Workflow
1. Create debugging plan with TodoWrite
2. Systematic issue investigation
3. Store findings in Memory
4. Track fix progress
5. Verify resolution

## Tools Integration
- Error log analysis
- Breakpoint simulation
- Variable inspection
- Call stack tracing
- Memory profiling

```

--------------------------------------------------------------------------------
/.claude/commands/optimization/parallel-execution.md:
--------------------------------------------------------------------------------

```markdown
# Parallel Task Execution

## Purpose
Execute independent subtasks in parallel for maximum efficiency.

## Coordination Strategy

### 1. Task Decomposition
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {
  "task": "Build complete REST API with auth, CRUD operations, and tests",
  "strategy": "parallel",
  "maxAgents": 8
}
```

### 2. Parallel Workflows
The system automatically:
- Identifies independent components
- Assigns specialized agents
- Executes in parallel where possible
- Synchronizes at dependency points

### 3. Example Breakdown
For the REST API task:
- **Agent 1 (Architect)**: Design API structure
- **Agent 2-3 (Coders)**: Implement auth & CRUD in parallel
- **Agent 4 (Tester)**: Write tests as features complete
- **Agent 5 (Documenter)**: Update docs continuously

## CLI Usage
```bash
# Execute parallel tasks via CLI
npx claude-flow parallel "Build REST API" --max-agents 8
```

## Performance Gains
- 🚀 2.8-4.4x faster execution
- 💪 Optimal CPU utilization
- 🔄 Automatic load balancing
- 📈 Linear scalability with agents

## Monitoring
```
Tool: mcp__claude-flow__swarm_monitor
Parameters: {"interval": 1000, "swarmId": "current"}
```

Watch real-time parallel execution progress!
```

--------------------------------------------------------------------------------
/.claude/commands/sparc/optimizer.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Optimizer Mode

## Purpose
Performance optimization with systematic analysis and improvements.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "optimizer",
  task_description: "optimize application performance",
  options: {
    profile: true,
    benchmark: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run optimizer "optimize application performance"

# For alpha features
npx claude-flow@alpha sparc run optimizer "optimize application performance"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run optimizer "optimize application performance"
```

## Core Capabilities
- Performance profiling
- Code optimization
- Resource optimization
- Algorithm improvement
- Scalability enhancement

## Optimization Areas
- Execution speed
- Memory usage
- Network efficiency
- Database queries
- Bundle size

## Systematic Approach
1. Baseline measurement
2. Bottleneck identification
3. Optimization implementation
4. Impact verification
5. Continuous monitoring

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/batch-executor.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Batch Executor Mode

## Purpose
Parallel task execution specialist using batch operations.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "batch-executor",
  task_description: "process multiple files",
  options: {
    parallel: true,
    batch_size: 10
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run batch-executor "process multiple files"

# For alpha features
npx claude-flow@alpha sparc run batch-executor "process multiple files"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run batch-executor "process multiple files"
```

## Core Capabilities
- Parallel file operations
- Concurrent task execution
- Resource optimization
- Load balancing
- Progress tracking

## Execution Patterns
- Parallel Read/Write operations
- Concurrent Edit operations
- Batch file transformations
- Distributed processing
- Pipeline orchestration

## Performance Features
- Dynamic resource allocation
- Automatic load balancing
- Progress monitoring
- Error recovery
- Result aggregation

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/innovator.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Innovator Mode

## Purpose
Creative problem solving with WebSearch and Memory integration.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "innovator",
  task_description: "innovative solutions for scaling",
  options: {
    research_depth: "comprehensive",
    creativity_level: "high"
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run innovator "innovative solutions for scaling"

# For alpha features
npx claude-flow@alpha sparc run innovator "innovative solutions for scaling"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run innovator "innovative solutions for scaling"
```

## Core Capabilities
- Creative ideation
- Solution brainstorming
- Technology exploration
- Pattern innovation
- Proof of concept

## Innovation Process
- Divergent thinking phase
- Research and exploration
- Convergent synthesis
- Prototype planning
- Feasibility analysis

## Knowledge Sources
- WebSearch for trends
- Memory for context
- Cross-domain insights
- Pattern recognition
- Analogical reasoning

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/researcher.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Researcher Mode

## Purpose
Deep research with parallel WebSearch/WebFetch and Memory coordination.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "researcher",
  task_description: "research AI trends 2024",
  options: {
    depth: "comprehensive",
    sources: ["academic", "industry", "news"]
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run researcher "research AI trends 2024"

# For alpha features
npx claude-flow@alpha sparc run researcher "research AI trends 2024"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run researcher "research AI trends 2024"
```

## Core Capabilities
- Information gathering
- Source evaluation
- Trend analysis
- Competitive research
- Technology assessment

## Research Methods
- Parallel web searches
- Academic paper analysis
- Industry report synthesis
- Expert opinion gathering
- Data compilation

## Memory Integration
- Store research findings
- Build knowledge graphs
- Track information sources
- Cross-reference insights
- Maintain research history

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/analyzer.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Analyzer Mode

## Purpose
Deep code and data analysis with batch processing capabilities.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "analyzer",
  task_description: "analyze codebase performance",
  options: {
    parallel: true,
    detailed: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run analyzer "analyze codebase performance"

# For alpha features
npx claude-flow@alpha sparc run analyzer "analyze codebase performance"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run analyzer "analyze codebase performance"
```

## Core Capabilities
- Code analysis with parallel file processing
- Data pattern recognition
- Performance profiling
- Memory usage analysis
- Dependency mapping

## Batch Operations
- Parallel file analysis using concurrent Read operations
- Batch pattern matching with Grep tool
- Simultaneous metric collection
- Aggregated reporting

## Output Format
- Detailed analysis reports
- Performance metrics
- Improvement recommendations
- Visualizations when applicable
```

--------------------------------------------------------------------------------
/.claude/commands/sparc/memory-manager.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Memory Manager Mode

## Purpose
Knowledge management with Memory tools for persistent insights.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "memory-manager",
  task_description: "organize project knowledge",
  options: {
    namespace: "project",
    auto_organize: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run memory-manager "organize project knowledge"

# For alpha features
npx claude-flow@alpha sparc run memory-manager "organize project knowledge"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run memory-manager "organize project knowledge"
```

## Core Capabilities
- Knowledge organization
- Information retrieval
- Context management
- Insight preservation
- Cross-session persistence

## Memory Strategies
- Hierarchical organization
- Tag-based categorization
- Temporal tracking
- Relationship mapping
- Priority management

## Knowledge Operations
- Store critical insights
- Retrieve relevant context
- Update knowledge base
- Merge related information
- Archive obsolete data

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/architect.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Architect Mode

## Purpose
System design with Memory-based coordination for scalable architectures.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "architect",
  task_description: "design microservices architecture",
  options: {
    detailed: true,
    memory_enabled: true
  }
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run architect "design microservices architecture"

# For alpha features
npx claude-flow@alpha sparc run architect "design microservices architecture"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run architect "design microservices architecture"
```

## Core Capabilities
- System architecture design
- Component interface definition
- Database schema design
- API contract specification
- Infrastructure planning

## Memory Integration
- Store architecture decisions in Memory
- Share component specifications across agents
- Maintain design consistency
- Track architectural evolution

## Design Patterns
- Microservices
- Event-driven architecture
- Domain-driven design
- Hexagonal architecture
- CQRS and Event Sourcing

```

--------------------------------------------------------------------------------
/.claude/commands/analysis/performance-bottlenecks.md:
--------------------------------------------------------------------------------

```markdown
# Performance Bottleneck Analysis

## Purpose
Identify and resolve performance bottlenecks in your development workflow.

## Automated Analysis

### 1. Real-time Detection
The post-task hook automatically analyzes:
- Execution time vs. complexity
- Agent utilization rates
- Resource constraints
- Operation patterns

### 2. Common Bottlenecks

**Time Bottlenecks:**
- Tasks taking > 5 minutes
- Sequential operations that could parallelize
- Redundant file operations

**Coordination Bottlenecks:**
- Single agent for complex tasks
- Unbalanced agent workloads
- Poor topology selection

**Resource Bottlenecks:**
- High operation count (> 100)
- Memory constraints
- I/O limitations

### 3. Improvement Suggestions

```
Tool: mcp__claude-flow__task_results
Parameters: {"taskId": "task-123", "format": "detailed"}

Result includes:
{
  "bottlenecks": [
    {
      "type": "coordination",
      "severity": "high",
      "description": "Single agent used for complex task",
      "recommendation": "Spawn specialized agents for parallel work"
    }
  ],
  "improvements": [
    {
      "area": "execution_time",
      "suggestion": "Use parallel task execution",
      "expectedImprovement": "30-50% time reduction"
    }
  ]
}
```

## Continuous Optimization
The system learns from each task to prevent future bottlenecks!
```

--------------------------------------------------------------------------------
/.claude/commands/monitoring/status.md:
--------------------------------------------------------------------------------

```markdown
# Check Coordination Status

## 🎯 Key Principle
**This tool coordinates Claude Code's actions. It does NOT write code or create content.**

## MCP Tool Usage in Claude Code

**Tool:** `mcp__claude-flow__swarm_status`

## Parameters
```json
{
  "swarmId": "current"
}
```

## Description
Monitor the effectiveness of current coordination patterns

## Details
Shows:
- Active coordination topologies
- Current cognitive patterns in use
- Task breakdown and progress
- Resource utilization for coordination
- Overall system health

## Example Usage

**In Claude Code:**
1. Check swarm status: Use tool `mcp__claude-flow__swarm_status`
2. Monitor in real-time: Use tool `mcp__claude-flow__swarm_monitor` with parameters `{"interval": 1000}`
3. Get agent metrics: Use tool `mcp__claude-flow__agent_metrics` with parameters `{"agentId": "agent-123"}`
4. Health check: Use tool `mcp__claude-flow__health_check` with parameters `{"components": ["swarm", "memory", "neural"]}`

## Important Reminders
- ✅ This tool provides coordination and structure
- ✅ Claude Code performs all actual implementation
- ❌ The tool does NOT write code
- ❌ The tool does NOT access files directly
- ❌ The tool does NOT execute commands

## See Also
- Main documentation: /CLAUDE.md
- Other commands in this category
- Workflow examples in /workflows/

```

--------------------------------------------------------------------------------
/.claude/commands/training/specialization.md:
--------------------------------------------------------------------------------

```markdown
# Agent Specialization Training

## Purpose
Train agents to become experts in specific domains for better performance.

## Specialization Areas

### 1. By File Type
Agents automatically specialize based on file extensions:
- **.js/.ts**: Modern JavaScript patterns
- **.py**: Pythonic idioms
- **.go**: Go best practices
- **.rs**: Rust safety patterns

### 2. By Task Type
```
Tool: mcp__claude-flow__agent_spawn
Parameters: {
  "type": "coder",
  "capabilities": ["react", "typescript", "testing"],
  "name": "React Specialist"
}
```

### 3. Training Process
The system trains through:
- Successful edit operations
- Code review patterns
- Error fix approaches
- Performance optimizations

### 4. Specialization Benefits
```
# Check agent specializations
Tool: mcp__claude-flow__agent_list
Parameters: {"swarmId": "current"}

Result shows expertise levels:
{
  "agents": [
    {
      "id": "coder-123",
      "specializations": {
        "javascript": 0.95,
        "react": 0.88,
        "testing": 0.82
      }
    }
  ]
}
```

## Continuous Improvement
Agents share learnings across sessions for cumulative expertise!

## CLI Usage
```bash
# Train agent specialization via CLI
npx claude-flow train agent --type coder --capabilities "react,typescript"

# Check specializations
npx claude-flow agent list --specializations
```
```

--------------------------------------------------------------------------------
/.claude/commands/coordination/orchestrate.md:
--------------------------------------------------------------------------------

```markdown
# Coordinate Task Execution

## 🎯 Key Principle
**This tool coordinates Claude Code's actions. It does NOT write code or create content.**

## MCP Tool Usage in Claude Code

**Tool:** `mcp__claude-flow__task_orchestrate`

## Parameters
```json
{"task": "Implement authentication system", "strategy": "parallel", "priority": "high"}
```

## Description
Break down and coordinate complex tasks for systematic execution by Claude Code

## Details
Orchestration strategies:
- **parallel**: Claude Code works on independent components simultaneously
- **sequential**: Step-by-step execution for dependent tasks
- **adaptive**: Dynamically adjusts based on task complexity

The orchestrator creates a plan that Claude Code follows using its native tools.

## Example Usage

**In Claude Code:**
1. Use the tool: `mcp__claude-flow__task_orchestrate`
2. With parameters: `{"task": "Implement authentication system", "strategy": "parallel", "priority": "high"}`
3. Claude Code then executes the coordinated plan using its native tools

## Important Reminders
- ✅ This tool provides coordination and structure
- ✅ Claude Code performs all actual implementation
- ❌ The tool does NOT write code
- ❌ The tool does NOT access files directly
- ❌ The tool does NOT execute commands

## See Also
- Main documentation: /claude.md
- Other commands in this category
- Workflow examples in /workflows/

```

--------------------------------------------------------------------------------
/.claude/commands/coordination/init.md:
--------------------------------------------------------------------------------

```markdown
# Initialize Coordination Framework

## 🎯 Key Principle
**This tool coordinates Claude Code's actions. It does NOT write code or create content.**

## MCP Tool Usage in Claude Code

**Tool:** `mcp__claude-flow__swarm_init`

## Parameters
```json
{"topology": "mesh", "maxAgents": 5, "strategy": "balanced"}
```

## Description
Set up a coordination topology to guide Claude Code's approach to complex tasks

## Details
This tool creates a coordination framework that helps Claude Code:
- Break down complex problems systematically
- Approach tasks from multiple perspectives
- Maintain consistency across large projects
- Work more efficiently through structured coordination

Remember: This does NOT create actual coding agents. It creates a coordination pattern for Claude Code to follow.

## Example Usage

**In Claude Code:**
1. Use the tool: `mcp__claude-flow__swarm_init`
2. With parameters: `{"topology": "mesh", "maxAgents": 5, "strategy": "balanced"}`
3. Claude Code then executes the coordinated plan using its native tools

## Important Reminders
- ✅ This tool provides coordination and structure
- ✅ Claude Code performs all actual implementation
- ❌ The tool does NOT write code
- ❌ The tool does NOT access files directly
- ❌ The tool does NOT execute commands

## See Also
- Main documentation: /claude.md
- Other commands in this category
- Workflow examples in /workflows/

```

--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------

```json
{
  "name": "@delorenj/mcp-server-trello",
  "mcpName": "io.github.delorenj/mcp-server-trello",
  "version": "1.6.2",
  "description": "An MCP server for Trello boards, powered by Bun for maximum performance.",
  "keywords": [
    "mcp",
    "trello",
    "bun",
    "automation",
    "productivity",
    "model-context-protocol",
    "api",
    "integration",
    "typescript",
    "board-management",
    "task-management",
    "kanban"
  ],
  "author": "Jarad DeLorenzo",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/delorenj/mcp-server-trello/issues"
  },
  "homepage": "https://github.com/delorenj/mcp-server-trello#readme",
  "dependencies": {
    "@modelcontextprotocol/sdk": "^1.0.4",
    "axios": "^1.6.2",
    "form-data": "^4.0.4",
    "mcp-evals": "^1.0.18",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@ai-sdk/openai": "^1.3.23",
    "bun-types": "latest",
    "@typescript-eslint/eslint-plugin": "^6.12.0",
    "@typescript-eslint/parser": "^6.12.0",
    "eslint": "^8.54.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-prettier": "^5.0.1",
    "prettier": "^3.1.0",
    "terser": "^5.24.0",
    "typescript": "^5.3.2"
  },
  "files": [
    "build/**/*"
  ],
  "bin": {
    "mcp-server-trello": "./build/index.js"
  },
  "type": "module",
  "engines": {
    "bun": ">=1.0.0"
  },
  "publishConfig": {
    "access": "public"
  },
  "scripts": {
    "build": "bunx tsc"
  }
}

```

--------------------------------------------------------------------------------
/.claude/commands/coordination/spawn.md:
--------------------------------------------------------------------------------

```markdown
# Create Cognitive Patterns

## 🎯 Key Principle
**This tool coordinates Claude Code's actions. It does NOT write code or create content.**

## MCP Tool Usage in Claude Code

**Tool:** `mcp__claude-flow__agent_spawn`

## Parameters
```json
{"type": "researcher", "name": "Literature Analysis", "capabilities": ["deep-analysis"]}
```

## Description
Define cognitive patterns that represent different approaches Claude Code can take

## Details
Agent types represent thinking patterns, not actual coders:
- **researcher**: Systematic exploration approach
- **coder**: Implementation-focused thinking
- **analyst**: Data-driven decision making
- **architect**: Big-picture system design
- **reviewer**: Quality and consistency checking

These patterns guide how Claude Code approaches different aspects of your task.

## Example Usage

**In Claude Code:**
1. Use the tool: `mcp__claude-flow__agent_spawn`
2. With parameters: `{"type": "researcher", "name": "Literature Analysis", "capabilities": ["deep-analysis"]}`
3. Claude Code then executes the coordinated plan using its native tools

## Important Reminders
- ✅ This tool provides coordination and structure
- ✅ Claude Code performs all actual implementation
- ❌ The tool does NOT write code
- ❌ The tool does NOT access files directly
- ❌ The tool does NOT execute commands

## See Also
- Main documentation: /claude.md
- Other commands in this category
- Workflow examples in /workflows/

```

--------------------------------------------------------------------------------
/validate-server.mjs:
--------------------------------------------------------------------------------

```
#!/usr/bin/env node

/**
 * Validates server.json against basic MCP Registry requirements
 * Used in CI/CD pipeline before publishing
 */

import { readFileSync } from 'fs';

try {
  const serverJson = readFileSync('server.json', 'utf8');
  const parsed = JSON.parse(serverJson);
  
  console.log('✅ server.json is valid JSON');
  console.log('Server name:', parsed.name);
  console.log('Version:', parsed.version);
  console.log('Description:', parsed.description);
  console.log('Package identifier:', parsed.packages?.[0]?.identifier);
  console.log('Environment variables:', parsed.packages?.[0]?.environment_variables?.length || 0);
  
  // Basic validation checks
  if (!parsed.name || !parsed.name.startsWith('io.github.delorenj/')) {
    console.error('❌ Invalid name format. Must start with io.github.delorenj/');
    process.exit(1);
  }
  
  if (!parsed.packages || parsed.packages.length === 0) {
    console.error('❌ Missing packages array');
    process.exit(1);
  }
  
  const npmPackage = parsed.packages.find(p => p.registry_type === 'npm');
  if (!npmPackage) {
    console.error('❌ Missing npm package definition');
    process.exit(1);
  }
  
  if (npmPackage.identifier !== '@delorenj/mcp-server-trello') {
    console.error('❌ Package identifier mismatch');
    process.exit(1);
  }
  
  console.log('✅ All basic validations passed');
  
} catch (error) {
  console.error('❌ server.json validation failed:', error.message);
  process.exit(1);
}
```

--------------------------------------------------------------------------------
/.claude/commands/training/neural-patterns.md:
--------------------------------------------------------------------------------

```markdown
# Neural Pattern Training

## Purpose
Continuously improve coordination through neural network learning.

## How Training Works

### 1. Automatic Learning
Every successful operation trains the neural networks:
- Edit patterns for different file types
- Search strategies that find results faster
- Task decomposition approaches
- Agent coordination patterns

### 2. Manual Training
```
Tool: mcp__claude-flow__neural_train
Parameters: {
  "pattern_type": "coordination",
  "training_data": "successful task patterns",
  "epochs": 50
}
```

### 3. Pattern Types

**Cognitive Patterns:**
- Convergent: Focused problem-solving
- Divergent: Creative exploration
- Lateral: Alternative approaches
- Systems: Holistic thinking
- Critical: Analytical evaluation
- Abstract: High-level design

### 4. Improvement Tracking
```
Tool: mcp__claude-flow__neural_status
Result: {
  "patterns": {
    "convergent": 0.92,
    "divergent": 0.87,
    "lateral": 0.85
  },
  "improvement": "5.3% since last session",
  "confidence": 0.89
}
```

## Pattern Analysis
```
Tool: mcp__claude-flow__neural_patterns
Parameters: {
  "action": "analyze",
  "operation": "recent_edits"
}
```

## Benefits
- 🧠 Learns your coding style
- 📈 Improves with each use
- 🎯 Better task predictions
- ⚡ Faster coordination

## CLI Usage
```bash
# Train neural patterns via CLI
npx claude-flow neural train --type coordination --epochs 50

# Check neural status
npx claude-flow neural status

# Analyze patterns
npx claude-flow neural patterns --analyze
```
```

--------------------------------------------------------------------------------
/.claude/commands/optimization/auto-topology.md:
--------------------------------------------------------------------------------

```markdown
# Automatic Topology Selection

## Purpose
Automatically select the optimal swarm topology based on task complexity analysis.

## How It Works

### 1. Task Analysis
The system analyzes your task description to determine:
- Complexity level (simple/medium/complex)
- Required agent types
- Estimated duration
- Resource requirements

### 2. Topology Selection
Based on analysis, it selects:
- **Star**: For simple, centralized tasks
- **Mesh**: For medium complexity with flexibility needs
- **Hierarchical**: For complex tasks requiring structure
- **Ring**: For sequential processing workflows

### 3. Example Usage

**Simple Task:**
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {"task": "Fix typo in README.md"}
Result: Automatically uses star topology with single agent
```

**Complex Task:**
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {"task": "Refactor authentication system with JWT, add tests, update documentation"}
Result: Automatically uses hierarchical topology with architect, coder, and tester agents
```

## Benefits
- 🎯 Optimal performance for each task type
- 🤖 Automatic agent assignment
- ⚡ Reduced setup time
- 📊 Better resource utilization

## Hook Configuration
The pre-task hook automatically handles topology selection:
```json
{
  "command": "npx claude-flow hook pre-task --optimize-topology"
}
```

## Direct Optimization
```
Tool: mcp__claude-flow__topology_optimize
Parameters: {"swarmId": "current"}
```

## CLI Usage
```bash
# Auto-optimize topology via CLI
npx claude-flow optimize topology
```
```

--------------------------------------------------------------------------------
/.claude/commands/automation/smart-agents.md:
--------------------------------------------------------------------------------

```markdown
# Smart Agent Auto-Spawning

## Purpose
Automatically spawn the right agents at the right time without manual intervention.

## Auto-Spawning Triggers

### 1. File Type Detection
When editing files, agents auto-spawn:
- **JavaScript/TypeScript**: Coder agent
- **Markdown**: Researcher agent
- **JSON/YAML**: Analyst agent
- **Multiple files**: Coordinator agent

### 2. Task Complexity
```
Simple task: "Fix typo"
→ Single coordinator agent

Complex task: "Implement OAuth with Google"
→ Architect + Coder + Tester + Researcher
```

### 3. Dynamic Scaling
The system monitors workload and spawns additional agents when:
- Task queue grows
- Complexity increases
- Parallel opportunities exist

**Status Monitoring:**
```javascript
// Check swarm health
mcp__claude-flow__swarm_status({
  "swarmId": "current"
})

// Monitor agent performance
mcp__claude-flow__agent_metrics({
  "agentId": "agent-123"
})
```

## Configuration

### MCP Tool Integration
Uses Claude Flow MCP tools for agent coordination:
```javascript
// Initialize swarm with appropriate topology
mcp__claude-flow__swarm_init({
  "topology": "mesh",
  "maxAgents": 8,
  "strategy": "auto"
})

// Spawn agents based on file type
mcp__claude-flow__agent_spawn({
  "type": "coder",
  "name": "JavaScript Handler",
  "capabilities": ["javascript", "typescript"]
})
```

### Fallback Configuration
If MCP tools are unavailable:
```bash
npx claude-flow hook pre-task --auto-spawn-agents
```

## Benefits
- 🤖 Zero manual agent management
- 🎯 Perfect agent selection
- 📈 Dynamic scaling
- 💾 Resource efficiency
```

--------------------------------------------------------------------------------
/.claude/commands/hooks/overview.md:
--------------------------------------------------------------------------------

```markdown
# Claude Code Hooks for claude-flow

## Purpose
Automatically coordinate, format, and learn from Claude Code operations using hooks.

## Available Hooks

### Pre-Operation Hooks
- **pre-edit**: Validate and assign agents before file modifications
- **pre-bash**: Check command safety and resource requirements
- **pre-task**: Auto-spawn agents for complex tasks

### Post-Operation Hooks
- **post-edit**: Auto-format code and train neural patterns
- **post-bash**: Log execution and update metrics
- **post-search**: Cache results and improve search patterns

### MCP Integration Hooks
- **mcp-initialized**: Persist swarm configuration
- **agent-spawned**: Update agent roster
- **task-orchestrated**: Monitor task progress
- **neural-trained**: Save pattern improvements

### Session Hooks
- **notify**: Custom notifications with swarm status
- **session-end**: Generate summary and save state
- **session-restore**: Load previous session state

## Configuration
Hooks are configured in `.claude/settings.json`:

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "^(Write|Edit|MultiEdit)$",
        "hooks": [{
          "type": "command",
          "command": "npx claude-flow hook pre-edit --file '${tool.params.file_path}'"
        }]
      }
    ]
  }
}
```

## Benefits
- 🤖 Automatic agent assignment based on file type
- 🎨 Consistent code formatting
- 🧠 Continuous neural pattern improvement
- 💾 Cross-session memory persistence
- 📊 Performance metrics tracking

## See Also
- [Pre-Edit Hook](./pre-edit.md)
- [Post-Edit Hook](./post-edit.md)
- [Session End Hook](./session-end.md)
```

--------------------------------------------------------------------------------
/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md:
--------------------------------------------------------------------------------

```markdown
# Analysis Commands Compliance Report

## Overview
Reviewed all command files in `.claude/commands/analysis/` directory to ensure proper usage of:
- `mcp__claude-flow__*` tools (preferred)
- `npx claude-flow` commands (as fallback)
- No direct implementation calls

## Files Reviewed

### 1. token-efficiency.md
**Status**: ✅ Updated
**Changes Made**:
- Replaced `npx ruv-swarm hook session-end --export-metrics` with proper MCP tool call
- Updated to: `Tool: mcp__claude-flow__token_usage` with appropriate parameters
- Maintained result format and context

**Before**:
```bash
npx ruv-swarm hook session-end --export-metrics
```

**After**:
```
Tool: mcp__claude-flow__token_usage
Parameters: {"operation": "session", "timeframe": "24h"}
```

### 2. performance-bottlenecks.md
**Status**: ✅ Compliant (No changes needed)
**Reason**: Already uses proper `mcp__claude-flow__task_results` tool format

## Summary

- **Total files reviewed**: 2
- **Files updated**: 1
- **Files already compliant**: 1
- **Compliance rate after updates**: 100%

## Compliance Patterns Enforced

1. **MCP Tool Usage**: All direct tool calls now use `mcp__claude-flow__*` format
2. **Parameter Format**: JSON parameters properly structured
3. **Command Context**: Preserved original functionality and expected results
4. **Documentation**: Maintained clarity and examples

## Recommendations

1. All analysis commands now follow the proper pattern
2. No direct bash commands or implementation calls remain
3. Token usage analysis properly integrated with MCP tools
4. Performance analysis already using correct tool format

The analysis directory is now fully compliant with the Claude Flow command standards.
```

--------------------------------------------------------------------------------
/.claude/commands/workflows/research.md:
--------------------------------------------------------------------------------

```markdown
# Research Workflow Coordination

## Purpose
Coordinate Claude Code's research activities for comprehensive, systematic exploration.

## Step-by-Step Coordination

### 1. Initialize Research Framework
```
Tool: mcp__claude-flow__swarm_init
Parameters: {"topology": "mesh", "maxAgents": 5, "strategy": "balanced"}
```
Creates a mesh topology for comprehensive exploration from multiple angles.

### 2. Define Research Perspectives
```
Tool: mcp__claude-flow__agent_spawn
Parameters: {"type": "researcher", "name": "Literature Review"}
```
```
Tool: mcp__claude-flow__agent_spawn  
Parameters: {"type": "analyst", "name": "Data Analysis"}
```
Sets up different analytical approaches for Claude Code to use.

### 3. Execute Coordinated Research
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {
  "task": "Research modern web frameworks performance",
  "strategy": "adaptive",
  "priority": "medium"
}
```

### 4. Store Research Findings
```
Tool: mcp__claude-flow__memory_usage
Parameters: {
  "action": "store",
  "key": "research_findings",
  "value": "framework performance analysis results",
  "namespace": "research"
}
```

## What Claude Code Actually Does
1. Uses **WebSearch** tool for finding resources
2. Uses **Read** tool for analyzing documentation
3. Uses **Task** tool for parallel exploration
4. Synthesizes findings using coordination patterns
5. Stores insights in memory for future reference

Remember: The swarm coordinates HOW Claude Code researches, not WHAT it finds.

## CLI Usage
```bash
# Start research workflow via CLI
npx claude-flow workflow research "modern web frameworks"

# Export research workflow
npx claude-flow workflow export research --format json
```
```

--------------------------------------------------------------------------------
/.claude/commands/automation/session-memory.md:
--------------------------------------------------------------------------------

```markdown
# Cross-Session Memory

## Purpose
Maintain context and learnings across Claude Code sessions for continuous improvement.

## Memory Features

### 1. Automatic State Persistence
At session end, automatically saves:
- Active agents and specializations
- Task history and patterns
- Performance metrics
- Neural network weights
- Knowledge base updates

### 2. Session Restoration
```javascript
// Using MCP tools for memory operations
mcp__claude-flow__memory_usage({
  "action": "retrieve",
  "key": "session-state",
  "namespace": "sessions"
})

// Restore swarm state
mcp__claude-flow__context_restore({
  "snapshotId": "sess-123"
})
```

**Fallback with npx:**
```bash
npx claude-flow hook session-restore --session-id "sess-123"
```

### 3. Memory Types

**Project Memory:**
- File relationships
- Common edit patterns
- Testing approaches
- Build configurations

**Agent Memory:**
- Specialization levels
- Task success rates
- Optimization strategies
- Error patterns

**Performance Memory:**
- Bottleneck history
- Optimization results
- Token usage patterns
- Efficiency trends

### 4. Privacy & Control
```javascript
// List memory contents
mcp__claude-flow__memory_usage({
  "action": "list",
  "namespace": "sessions"
})

// Delete specific memory
mcp__claude-flow__memory_usage({
  "action": "delete",
  "key": "session-123",
  "namespace": "sessions"
})

// Backup memory
mcp__claude-flow__memory_backup({
  "path": "./backups/memory-backup.json"
})
```

**Manual control:**
```bash
# View stored memory
ls .claude-flow/memory/

# Disable memory
export CLAUDE_FLOW_MEMORY_PERSIST=false
```

## Benefits
- 🧠 Contextual awareness
- 📈 Cumulative learning
- ⚡ Faster task completion
- 🎯 Personalized optimization
```

--------------------------------------------------------------------------------
/.claude/commands/hooks/setup.md:
--------------------------------------------------------------------------------

```markdown
# Setting Up ruv-swarm Hooks

## Quick Start

### 1. Initialize with Hooks
```bash
npx claude-flow init --hooks
```

This automatically creates:
- `.claude/settings.json` with hook configurations
- Hook command documentation
- Default hook handlers

### 2. Test Hook Functionality
```bash
# Test pre-edit hook
npx claude-flow hook pre-edit --file test.js

# Test session summary
npx claude-flow hook session-end --summary
```

### 3. Customize Hooks

Edit `.claude/settings.json` to customize:

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "^Write$",
        "hooks": [{
          "type": "command",
          "command": "npx claude-flow hook pre-write --file '${tool.params.file_path}'"
        }]
      }
    ]
  }
}
```

## Hook Response Format

Hooks return JSON with:
- `continue`: Whether to proceed (true/false)
- `reason`: Explanation for decision
- `metadata`: Additional context

Example blocking response:
```json
{
  "continue": false,
  "reason": "Protected file - manual review required",
  "metadata": {
    "file": ".env.production",
    "protection_level": "high"
  }
}
```

## Performance Tips
- Keep hooks lightweight (< 100ms)
- Use caching for repeated operations
- Batch related operations
- Run non-critical hooks asynchronously

## Debugging Hooks
```bash
# Enable debug output
export CLAUDE_FLOW_DEBUG=true

# Test specific hook
npx claude-flow hook pre-edit --file app.js --debug
```

## Common Patterns

### Auto-Format on Save
Already configured by default for common file types.

### Protected File Detection
```json
{
  "matcher": "^(Write|Edit)$",
  "hooks": [{
    "type": "command",
    "command": "npx claude-flow hook check-protected --file '${tool.params.file_path}'"
  }]
}
```

### Automatic Testing
```json
{
  "matcher": "^Write$",
  "hooks": [{
    "type": "command",
    "command": "test -f '${tool.params.file_path%.js}.test.js' && npm test '${tool.params.file_path%.js}.test.js'"
  }]
}
```
```

--------------------------------------------------------------------------------
/.claude/commands/swarm/development.md:
--------------------------------------------------------------------------------

```markdown
# Development Swarm Strategy

## Purpose
Coordinated development through specialized agent teams.

## Activation

### Using MCP Tools
```javascript
// Initialize development swarm
mcp__claude-flow__swarm_init({
  "topology": "hierarchical",
  "maxAgents": 8,
  "strategy": "balanced"
})

// Orchestrate development task
mcp__claude-flow__task_orchestrate({
  "task": "build feature X",
  "strategy": "parallel",
  "priority": "high"
})
```

### Using CLI (Fallback)
`npx claude-flow swarm "build feature X" --strategy development`

## Agent Roles

### Agent Spawning with MCP
```javascript
// Spawn development agents
mcp__claude-flow__agent_spawn({
  "type": "architect",
  "name": "System Designer",
  "capabilities": ["system-design", "api-design"]
})

mcp__claude-flow__agent_spawn({
  "type": "coder",
  "name": "Frontend Developer",
  "capabilities": ["react", "typescript", "ui"]
})

mcp__claude-flow__agent_spawn({
  "type": "coder",
  "name": "Backend Developer",
  "capabilities": ["nodejs", "api", "database"]
})

mcp__claude-flow__agent_spawn({
  "type": "specialist",
  "name": "Database Expert",
  "capabilities": ["sql", "nosql", "optimization"]
})

mcp__claude-flow__agent_spawn({
  "type": "tester",
  "name": "Integration Tester",
  "capabilities": ["integration", "e2e", "api-testing"]
})
```

## Best Practices
- Use hierarchical mode for large projects
- Enable parallel execution
- Implement continuous testing
- Monitor swarm health regularly

## Status Monitoring
```javascript
// Check swarm status
mcp__claude-flow__swarm_status({
  "swarmId": "development-swarm"
})

// Monitor agent performance
mcp__claude-flow__agent_metrics({
  "agentId": "architect-001"
})

// Real-time monitoring
mcp__claude-flow__swarm_monitor({
  "swarmId": "development-swarm",
  "interval": 5000
})
```

## Error Handling
```javascript
// Enable fault tolerance
mcp__claude-flow__daa_fault_tolerance({
  "agentId": "all",
  "strategy": "auto-recovery"
})
```

```

--------------------------------------------------------------------------------
/.claude/commands/swarm/analysis.md:
--------------------------------------------------------------------------------

```markdown
# Analysis Swarm Strategy

## Purpose
Comprehensive analysis through distributed agent coordination.

## Activation

### Using MCP Tools
```javascript
// Initialize analysis swarm
mcp__claude-flow__swarm_init({
  "topology": "mesh",
  "maxAgents": 6,
  "strategy": "adaptive"
})

// Orchestrate analysis task
mcp__claude-flow__task_orchestrate({
  "task": "analyze system performance",
  "strategy": "parallel",
  "priority": "medium"
})
```

### Using CLI (Fallback)
`npx claude-flow swarm "analyze system performance" --strategy analysis`

## Agent Roles

### Agent Spawning with MCP
```javascript
// Spawn analysis agents
mcp__claude-flow__agent_spawn({
  "type": "analyst",
  "name": "Data Collector",
  "capabilities": ["metrics", "logging", "monitoring"]
})

mcp__claude-flow__agent_spawn({
  "type": "analyst",
  "name": "Pattern Analyzer",
  "capabilities": ["pattern-recognition", "anomaly-detection"]
})

mcp__claude-flow__agent_spawn({
  "type": "documenter",
  "name": "Report Generator",
  "capabilities": ["reporting", "visualization"]
})

mcp__claude-flow__agent_spawn({
  "type": "coordinator",
  "name": "Insight Synthesizer",
  "capabilities": ["synthesis", "correlation"]
})
```

## Coordination Modes
- Mesh: For exploratory analysis
- Pipeline: For sequential processing
- Hierarchical: For complex systems

## Analysis Operations
```javascript
// Run performance analysis
mcp__claude-flow__performance_report({
  "format": "detailed",
  "timeframe": "24h"
})

// Identify bottlenecks
mcp__claude-flow__bottleneck_analyze({
  "component": "api",
  "metrics": ["response-time", "throughput"]
})

// Pattern recognition
mcp__claude-flow__pattern_recognize({
  "data": performanceData,
  "patterns": ["anomaly", "trend", "cycle"]
})
```

## Status Monitoring
```javascript
// Monitor analysis progress
mcp__claude-flow__task_status({
  "taskId": "analysis-task-001"
})

// Get analysis results
mcp__claude-flow__task_results({
  "taskId": "analysis-task-001"
})
```

```

--------------------------------------------------------------------------------
/.claude/commands/workflows/development.md:
--------------------------------------------------------------------------------

```markdown
# Development Workflow Coordination

## Purpose
Structure Claude Code's approach to complex development tasks for maximum efficiency.

## Step-by-Step Coordination

### 1. Initialize Development Framework
```
Tool: mcp__claude-flow__swarm_init
Parameters: {"topology": "hierarchical", "maxAgents": 8, "strategy": "specialized"}
```
Creates hierarchical structure for organized, top-down development.

### 2. Define Development Perspectives
```
Tool: mcp__claude-flow__agent_spawn
Parameters: {
  "type": "architect",
  "name": "System Design",
  "capabilities": ["api-design", "database-schema"]
}
```
```
Tool: mcp__claude-flow__agent_spawn
Parameters: {
  "type": "coder",
  "name": "Implementation Focus",
  "capabilities": ["nodejs", "typescript", "express"]
}
```
```
Tool: mcp__claude-flow__agent_spawn
Parameters: {
  "type": "tester",
  "name": "Quality Assurance",
  "capabilities": ["unit-testing", "integration-testing"]
}
```
Sets up architectural and implementation thinking patterns.

### 3. Coordinate Implementation
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {
  "task": "Build REST API with authentication",
  "strategy": "parallel",
  "priority": "high",
  "dependencies": ["database setup", "auth system"]
}
```

### 4. Monitor Progress
```
Tool: mcp__claude-flow__task_status
Parameters: {"taskId": "api-build-task-123"}
```

## What Claude Code Actually Does
1. Uses **Write** tool to create new files
2. Uses **Edit/MultiEdit** tools for code modifications
3. Uses **Bash** tool for testing and building
4. Uses **TodoWrite** tool for task tracking
5. Follows coordination patterns for systematic implementation

Remember: All code is written by Claude Code using its native tools!

## CLI Usage
```bash
# Start development workflow via CLI
npx claude-flow workflow dev "REST API with auth"

# Create custom workflow
npx claude-flow workflow create --name "api-dev" --steps "design,implement,test,deploy"

# Execute saved workflow
npx claude-flow workflow execute api-dev
```
```

--------------------------------------------------------------------------------
/.claude/commands/coordination/swarm-init.md:
--------------------------------------------------------------------------------

```markdown
# swarm init

Initialize a Claude Flow swarm with specified topology and configuration.

## Usage

```bash
npx claude-flow swarm init [options]
```

## Options

- `--topology, -t <type>` - Swarm topology: mesh, hierarchical, ring, star (default: hierarchical)
- `--max-agents, -m <number>` - Maximum number of agents (default: 8)
- `--strategy, -s <type>` - Execution strategy: balanced, parallel, sequential (default: parallel)
- `--auto-spawn` - Automatically spawn agents based on task complexity
- `--memory` - Enable cross-session memory persistence
- `--github` - Enable GitHub integration features

## Examples

### Basic initialization

```bash
npx claude-flow swarm init
```

### Mesh topology for research

```bash
npx claude-flow swarm init --topology mesh --max-agents 5 --strategy balanced
```

### Hierarchical for development

```bash
npx claude-flow swarm init --topology hierarchical --max-agents 10 --strategy parallel --auto-spawn
```

### GitHub-focused swarm

```bash
npx claude-flow swarm init --topology star --github --memory
```

## Topologies

### Mesh

- All agents connect to all others
- Best for: Research, exploration, brainstorming
- Communication: High overhead, maximum information sharing

### Hierarchical

- Tree structure with clear command chain
- Best for: Development, structured tasks, large projects
- Communication: Efficient, clear responsibilities

### Ring

- Agents connect in a circle
- Best for: Pipeline processing, sequential workflows
- Communication: Low overhead, ordered processing

### Star

- Central coordinator with satellite agents
- Best for: Simple tasks, centralized control
- Communication: Minimal overhead, clear coordination

## Integration with Claude Code

Once initialized, use MCP tools in Claude Code:

```javascript
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 8 }
```

## See Also

- `agent spawn` - Create swarm agents
- `task orchestrate` - Coordinate task execution
- `swarm status` - Check swarm state
- `swarm monitor` - Real-time monitoring

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/pre-search.md:
--------------------------------------------------------------------------------

```markdown
# hook pre-search

Optimize search operations with caching and intelligent filtering.

## Usage

```bash
npx claude-flow hook pre-search [options]
```

## Options

- `--query, -q <text>` - Search query to optimize
- `--cache-results` - Cache search results (default: true)
- `--suggest-filters` - Suggest search filters
- `--check-memory` - Check memory for answers
- `--expand-query` - Expand search terms

## Examples

### Basic pre-search hook

```bash
npx claude-flow hook pre-search --query "authentication implementation"
```

### With caching

```bash
npx claude-flow hook pre-search -q "React hooks usage" --cache-results
```

### Memory check first

```bash
npx claude-flow hook pre-search -q "previous bug fixes" --check-memory
```

### Query expansion

```bash
npx claude-flow hook pre-search -q "auth" --expand-query --suggest-filters
```

## Features

### Result Caching

- Stores search results
- Enables instant retrieval
- Reduces redundant searches
- Updates intelligently

### Filter Suggestions

- File type filters
- Directory scoping
- Time-based filtering
- Pattern matching

### Memory Checking

- Searches stored knowledge
- Finds previous results
- Avoids repetition
- Speeds up retrieval

### Query Expansion

- Adds synonyms
- Includes related terms
- Handles abbreviations
- Improves coverage

## Integration

This hook is automatically called by Claude Code when:

- Using Grep tool
- Using Glob tool
- Searching codebase
- Finding patterns

Manual usage in agents:

```bash
# Before searching
npx claude-flow hook pre-search --query "your search" --cache-results --check-memory
```

## Output

Returns JSON with:

```json
{
  "query": "authentication implementation",
  "cached": true,
  "cacheHit": false,
  "memoryResults": 3,
  "expandedQuery": "(auth|authentication|login|oauth) (impl|implementation|code)",
  "suggestedFilters": ["*.js", "*.ts", "src/**"],
  "estimatedFiles": 45
}
```

## See Also

- `Grep` - Content search tool
- `Glob` - File pattern tool
- `memory search` - Memory queries
- `cache manage` - Cache operations

```

--------------------------------------------------------------------------------
/.claude/commands/automation/self-healing.md:
--------------------------------------------------------------------------------

```markdown
# Self-Healing Workflows

## Purpose
Automatically detect and recover from errors without interrupting your flow.

## Self-Healing Features

### 1. Error Detection
Monitors for:
- Failed commands
- Syntax errors
- Missing dependencies
- Broken tests

### 2. Automatic Recovery

**Missing Dependencies:**
```
Error: Cannot find module 'express'
→ Automatically runs: npm install express
→ Retries original command
```

**Syntax Errors:**
```
Error: Unexpected token
→ Analyzes error location
→ Suggests fix through analyzer agent
→ Applies fix with confirmation
```

**Test Failures:**
```
Test failed: "user authentication"
→ Spawns debugger agent
→ Analyzes failure cause
→ Implements fix
→ Re-runs tests
```

### 3. Learning from Failures
Each recovery improves future prevention:
- Patterns saved to knowledge base
- Similar errors prevented proactively
- Recovery strategies optimized

**Pattern Storage:**
```javascript
// Store error patterns
mcp__claude-flow__memory_usage({
  "action": "store",
  "key": "error-pattern-" + Date.now(),
  "value": JSON.stringify(errorData),
  "namespace": "error-patterns",
  "ttl": 2592000 // 30 days
})

// Analyze patterns
mcp__claude-flow__neural_patterns({
  "action": "analyze",
  "operation": "error-recovery",
  "outcome": "success"
})
```

## Self-Healing Integration

### MCP Tool Coordination
```javascript
// Initialize self-healing swarm
mcp__claude-flow__swarm_init({
  "topology": "star",
  "maxAgents": 4,
  "strategy": "adaptive"
})

// Spawn recovery agents
mcp__claude-flow__agent_spawn({
  "type": "monitor",
  "name": "Error Monitor",
  "capabilities": ["error-detection", "recovery"]
})

// Orchestrate recovery
mcp__claude-flow__task_orchestrate({
  "task": "recover from error",
  "strategy": "sequential",
  "priority": "critical"
})
```

### Fallback Hook Configuration
```json
{
  "PostToolUse": [{
    "matcher": "^Bash$",
    "command": "npx claude-flow hook post-bash --exit-code '${tool.result.exitCode}' --auto-recover"
  }]
}
```

## Benefits
- 🛡️ Resilient workflows
- 🔄 Automatic recovery
- 📚 Learns from errors
- ⏱️ Saves debugging time
```

--------------------------------------------------------------------------------
/.claude/commands/swarm/maintenance.md:
--------------------------------------------------------------------------------

```markdown
# Maintenance Swarm Strategy

## Purpose
System maintenance and updates through coordinated agents.

## Activation

### Using MCP Tools
```javascript
// Initialize maintenance swarm
mcp__claude-flow__swarm_init({
  "topology": "star",
  "maxAgents": 5,
  "strategy": "sequential"
})

// Orchestrate maintenance task
mcp__claude-flow__task_orchestrate({
  "task": "update dependencies",
  "strategy": "sequential",
  "priority": "medium",
  "dependencies": ["backup", "test", "update", "verify"]
})
```

### Using CLI (Fallback)
`npx claude-flow swarm "update dependencies" --strategy maintenance`

## Agent Roles

### Agent Spawning with MCP
```javascript
// Spawn maintenance agents
mcp__claude-flow__agent_spawn({
  "type": "analyst",
  "name": "Dependency Analyzer",
  "capabilities": ["dependency-analysis", "version-management"]
})

mcp__claude-flow__agent_spawn({
  "type": "monitor",
  "name": "Security Scanner",
  "capabilities": ["security", "vulnerability-scan"]
})

mcp__claude-flow__agent_spawn({
  "type": "tester",
  "name": "Test Runner",
  "capabilities": ["testing", "validation"]
})

mcp__claude-flow__agent_spawn({
  "type": "documenter",
  "name": "Documentation Updater",
  "capabilities": ["documentation", "changelog"]
})
```

## Safety Features

### Backup and Recovery
```javascript
// Create system backup
mcp__claude-flow__backup_create({
  "components": ["code", "config", "dependencies"],
  "destination": "./backups/maintenance-" + Date.now()
})

// Create state snapshot
mcp__claude-flow__state_snapshot({
  "name": "pre-maintenance-" + Date.now()
})

// Enable fault tolerance
mcp__claude-flow__daa_fault_tolerance({
  "agentId": "all",
  "strategy": "checkpoint-recovery"
})
```

### Security Scanning
```javascript
// Run security scan
mcp__claude-flow__security_scan({
  "target": "./",
  "depth": "comprehensive"
})
```

### Monitoring
```javascript
// Health check before/after
mcp__claude-flow__health_check({
  "components": ["dependencies", "tests", "build"]
})

// Monitor maintenance progress
mcp__claude-flow__swarm_monitor({
  "swarmId": "maintenance-swarm",
  "interval": 3000
})
```

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/notification.md:
--------------------------------------------------------------------------------

```markdown
# hook notification

Send coordination notifications and track important decisions.

## Usage

```bash
npx claude-flow hook notification [options]
```

## Options

- `--message, -m <text>` - Notification message
- `--level, -l <level>` - Message level (info/warning/error/success)
- `--telemetry` - Include in telemetry (default: true)
- `--broadcast` - Broadcast to all agents
- `--memory-store` - Store in memory

## Examples

### Basic notification

```bash
npx claude-flow hook notification --message "Completed authentication module"
```

### Warning notification

```bash
npx claude-flow hook notification -m "Potential security issue found" -l warning
```

### Broadcast to swarm

```bash
npx claude-flow hook notification -m "API refactoring started" --broadcast
```

### Decision tracking

```bash
npx claude-flow hook notification -m "Chose JWT over sessions for auth" --memory-store
```

## Features

### Message Levels

- **info** - General information
- **warning** - Important notices
- **error** - Error conditions
- **success** - Completion notices

### Telemetry Integration

- Tracks key events
- Records decisions
- Monitors progress
- Enables analytics

### Agent Broadcasting

- Notifies all agents
- Ensures coordination
- Shares context
- Prevents conflicts

### Memory Storage

- Persists decisions
- Creates audit trail
- Enables learning
- Maintains history

## Integration

This hook is used by agents for:

- Sharing progress updates
- Recording decisions
- Warning about issues
- Coordinating actions

Manual usage in agents:

```bash
# For coordination
npx claude-flow hook notification --message "Starting database migration" --broadcast --memory-store
```

## Output

Returns JSON with:

```json
{
  "message": "Completed authentication module",
  "level": "success",
  "timestamp": 1234567890,
  "telemetryRecorded": true,
  "broadcasted": false,
  "memoryKey": "notifications/success/auth-complete",
  "recipients": ["coordinator", "tester"],
  "acknowledged": true
}
```

## See Also

- `agent list` - View active agents
- `memory usage` - Memory storage
- `swarm monitor` - Real-time monitoring
- `telemetry` - Analytics tracking

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/post-command.md:
--------------------------------------------------------------------------------

```markdown
# hook post-command

Execute post-command processing including output analysis and state updates.

## Usage

```bash
npx claude-flow hook post-command [options]
```

## Options

- `--command, -c <cmd>` - Command that was executed
- `--exit-code, -e <code>` - Command exit code
- `--analyze-output` - Analyze command output (default: true)
- `--update-cache` - Update command cache
- `--track-metrics` - Track performance metrics

## Examples

### Basic post-command hook

```bash
npx claude-flow hook post-command --command "npm test" --exit-code 0
```

### With output analysis

```bash
npx claude-flow hook post-command -c "git status" -e 0 --analyze-output
```

### Cache update

```bash
npx claude-flow hook post-command -c "npm list" -e 0 --update-cache
```

### Performance tracking

```bash
npx claude-flow hook post-command -c "build.sh" -e 0 --track-metrics
```

## Features

### Output Analysis

- Parses command output
- Extracts key information
- Identifies errors/warnings
- Summarizes results

### Cache Management

- Stores command results
- Enables fast re-execution
- Tracks output changes
- Reduces redundant runs

### Metric Tracking

- Records execution time
- Monitors resource usage
- Tracks success rates
- Identifies bottlenecks

### State Updates

- Updates project state
- Refreshes file indexes
- Syncs dependencies
- Maintains consistency

## Integration

This hook is automatically called by Claude Code when:

- After Bash tool execution
- Following shell commands
- Post build/test operations
- After system changes

Manual usage in agents:

```bash
# After running commands
npx claude-flow hook post-command --command "npm build" --exit-code 0 --analyze-output
```

## Output

Returns JSON with:

```json
{
  "command": "npm test",
  "exitCode": 0,
  "duration": 45230,
  "outputSummary": "All 42 tests passed",
  "cached": true,
  "metrics": {
    "cpuUsage": "45%",
    "memoryPeak": "256MB"
  },
  "stateChanges": ["test-results.json updated"],
  "warnings": []
}
```

## See Also

- `hook pre-command` - Pre-command validation
- `Bash` - Command execution tool
- `cache manage` - Cache operations
- `metrics collect` - Performance data

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/session-end.md:
--------------------------------------------------------------------------------

```markdown
# hook session-end

Cleanup and persist session state before ending work.

## Usage

```bash
npx claude-flow hook session-end [options]
```

## Options

- `--session-id, -s <id>` - Session identifier to end
- `--save-state` - Save current session state (default: true)
- `--export-metrics` - Export session metrics
- `--generate-summary` - Create session summary
- `--cleanup-temp` - Remove temporary files

## Examples

### Basic session end

```bash
npx claude-flow hook session-end --session-id "dev-session-2024"
```

### With full export

```bash
npx claude-flow hook session-end -s "feature-auth" --export-metrics --generate-summary
```

### Quick close

```bash
npx claude-flow hook session-end -s "quick-fix" --save-state false --cleanup-temp
```

### Complete persistence

```bash
npx claude-flow hook session-end -s "major-refactor" --save-state --export-metrics --generate-summary
```

## Features

### State Persistence

- Saves current context
- Stores open files
- Preserves task progress
- Maintains decisions

### Metric Export

- Session duration
- Commands executed
- Files modified
- Tokens consumed
- Performance data

### Summary Generation

- Work accomplished
- Key decisions made
- Problems solved
- Next steps identified

### Cleanup Operations

- Removes temp files
- Clears caches
- Frees resources
- Optimizes storage

## Integration

This hook is automatically called by Claude Code when:

- Ending a conversation
- Closing work session
- Before shutdown
- Switching contexts

Manual usage in agents:

```bash
# At session end
npx claude-flow hook session-end --session-id "your-session" --generate-summary
```

## Output

Returns JSON with:

```json
{
  "sessionId": "dev-session-2024",
  "duration": 7200000,
  "saved": true,
  "metrics": {
    "commandsRun": 145,
    "filesModified": 23,
    "tokensUsed": 85000,
    "tasksCompleted": 8
  },
  "summaryPath": "/sessions/dev-session-2024-summary.md",
  "cleanedUp": true,
  "nextSession": "dev-session-2025"
}
```

## See Also

- `hook session-start` - Session initialization
- `hook session-restore` - Session restoration
- `performance report` - Detailed metrics
- `memory backup` - State backup

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/session-restore.md:
--------------------------------------------------------------------------------

```markdown
# hook session-restore

Restore a previous session's context and state.

## Usage

```bash
npx claude-flow hook session-restore [options]
```

## Options

- `--session-id, -s <id>` - Session ID to restore
- `--load-memory` - Load session memories (default: true)
- `--restore-files` - Reopen previous files
- `--resume-tasks` - Continue incomplete tasks
- `--merge-context` - Merge with current context

## Examples

### Basic session restore

```bash
npx claude-flow hook session-restore --session-id "dev-session-2024"
```

### Full restoration

```bash
npx claude-flow hook session-restore -s "feature-auth" --load-memory --restore-files --resume-tasks
```

### Selective restore

```bash
npx claude-flow hook session-restore -s "bug-fix-123" --load-memory --resume-tasks
```

### Context merging

```bash
npx claude-flow hook session-restore -s "refactor-api" --merge-context
```

## Features

### Memory Loading

- Retrieves stored decisions
- Loads implementation notes
- Restores agent configs
- Recovers context

### File Restoration

- Lists previously open files
- Suggests file reopening
- Maintains edit history
- Preserves cursor positions

### Task Resumption

- Shows incomplete tasks
- Restores task progress
- Loads task dependencies
- Continues workflows

### Context Merging

- Combines sessions
- Merges memories
- Unifies task lists
- Prevents conflicts

## Integration

This hook is automatically called by Claude Code when:

- Resuming previous work
- After unexpected shutdown
- Loading saved sessions
- Switching between projects

Manual usage in agents:

```bash
# To restore context
npx claude-flow hook session-restore --session-id "previous-session" --load-memory
```

## Output

Returns JSON with:

```json
{
  "sessionId": "dev-session-2024",
  "restored": true,
  "memories": 25,
  "files": ["src/auth/login.js", "src/api/users.js"],
  "tasks": {
    "incomplete": 3,
    "completed": 12
  },
  "context": {
    "project": "auth-system",
    "branch": "feature/oauth"
  },
  "warnings": []
}
```

## See Also

- `hook session-start` - New session setup
- `hook session-end` - Session cleanup
- `memory usage` - Memory operations
- `task status` - Task checking

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/pre-edit.md:
--------------------------------------------------------------------------------

```markdown
# hook pre-edit

Execute pre-edit validations and agent assignment before file modifications.

## Usage

```bash
npx claude-flow hook pre-edit [options]
```

## Options

- `--file, -f <path>` - File path to be edited
- `--auto-assign-agent` - Automatically assign best agent (default: true)
- `--validate-syntax` - Pre-validate syntax before edit
- `--check-conflicts` - Check for merge conflicts
- `--backup-file` - Create backup before editing

## Examples

### Basic pre-edit hook

```bash
npx claude-flow hook pre-edit --file "src/auth/login.js"
```

### With validation

```bash
npx claude-flow hook pre-edit -f "config/database.js" --validate-syntax
```

### Manual agent assignment

```bash
npx claude-flow hook pre-edit -f "api/users.ts" --auto-assign-agent false
```

### Safe editing with backup

```bash
npx claude-flow hook pre-edit -f "production.env" --backup-file --check-conflicts
```

## Features

### Auto Agent Assignment

- Analyzes file type and content
- Assigns specialist agents
- TypeScript → TypeScript expert
- Database → Data specialist
- Tests → QA engineer

### Syntax Validation

- Pre-checks syntax validity
- Identifies potential errors
- Suggests corrections
- Prevents broken code

### Conflict Detection

- Checks for git conflicts
- Identifies concurrent edits
- Warns about stale files
- Suggests merge strategies

### File Backup

- Creates safety backups
- Enables quick rollback
- Tracks edit history
- Preserves originals

## Integration

This hook is automatically called by Claude Code when:

- Using Edit or MultiEdit tools
- Before file modifications
- During refactoring operations
- When updating critical files

Manual usage in agents:

```bash
# Before editing files
npx claude-flow hook pre-edit --file "path/to/file.js" --validate-syntax
```

## Output

Returns JSON with:

```json
{
  "continue": true,
  "file": "src/auth/login.js",
  "assignedAgent": "auth-specialist",
  "syntaxValid": true,
  "conflicts": false,
  "backupPath": ".backups/login.js.bak",
  "warnings": []
}
```

## See Also

- `hook post-edit` - Post-edit processing
- `Edit` - File editing tool
- `MultiEdit` - Multiple edits tool
- `agent spawn` - Manual agent creation

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/session-start.md:
--------------------------------------------------------------------------------

```markdown
# hook session-start

Initialize a new work session with context loading and environment setup.

## Usage

```bash
npx claude-flow hook session-start [options]
```

## Options

- `--session-id, -s <id>` - Unique session identifier
- `--restore-context` - Restore previous session context (default: true)
- `--load-preferences` - Load user preferences
- `--init-swarm` - Initialize swarm automatically
- `--telemetry` - Enable session telemetry

## Examples

### Basic session start

```bash
npx claude-flow hook session-start --session-id "dev-session-2024"
```

### With full restoration

```bash
npx claude-flow hook session-start -s "feature-auth" --restore-context --load-preferences
```

### Auto swarm initialization

```bash
npx claude-flow hook session-start -s "bug-fix-789" --init-swarm
```

### Telemetry enabled

```bash
npx claude-flow hook session-start -s "performance-opt" --telemetry
```

## Features

### Context Restoration

- Loads previous session state
- Restores open files
- Recovers task progress
- Maintains continuity

### Preference Loading

- User configuration
- Editor settings
- Tool preferences
- Custom shortcuts

### Swarm Initialization

- Auto-detects project type
- Spawns relevant agents
- Configures topology
- Prepares coordination

### Telemetry Setup

- Tracks session metrics
- Monitors performance
- Records patterns
- Enables analytics

## Integration

This hook is automatically called by Claude Code when:

- Starting a new conversation
- Beginning work session
- After Claude Code restart
- Switching projects

Manual usage in agents:

```bash
# At session start
npx claude-flow hook session-start --session-id "your-session" --restore-context
```

## Output

Returns JSON with:

```json
{
  "sessionId": "dev-session-2024",
  "restored": true,
  "previousSession": "dev-session-2023",
  "contextLoaded": {
    "files": 5,
    "tasks": 3,
    "memories": 12
  },
  "swarmInitialized": true,
  "topology": "hierarchical",
  "agentsReady": 6,
  "telemetryEnabled": true
}
```

## See Also

- `hook session-end` - Session cleanup
- `hook session-restore` - Manual restoration
- `swarm init` - Swarm initialization
- `memory usage` - Memory management

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/pre-task.md:
--------------------------------------------------------------------------------

```markdown
# hook pre-task

Execute pre-task preparations and context loading.

## Usage

```bash
npx claude-flow hook pre-task [options]
```

## Options

- `--description, -d <text>` - Task description for context
- `--auto-spawn-agents` - Automatically spawn required agents (default: true)
- `--load-memory` - Load relevant memory from previous sessions
- `--optimize-topology` - Select optimal swarm topology
- `--estimate-complexity` - Analyze task complexity

## Examples

### Basic pre-task hook

```bash
npx claude-flow hook pre-task --description "Implement user authentication"
```

### With memory loading

```bash
npx claude-flow hook pre-task -d "Continue API development" --load-memory
```

### Manual agent control

```bash
npx claude-flow hook pre-task -d "Debug issue #123" --auto-spawn-agents false
```

### Full optimization

```bash
npx claude-flow hook pre-task -d "Refactor codebase" --optimize-topology --estimate-complexity
```

## Features

### Auto Agent Assignment

- Analyzes task requirements
- Determines needed agent types
- Spawns agents automatically
- Configures agent parameters

### Memory Loading

- Retrieves relevant past decisions
- Loads previous task contexts
- Restores agent configurations
- Maintains continuity

### Topology Optimization

- Analyzes task structure
- Selects best swarm topology
- Configures communication patterns
- Optimizes for performance

### Complexity Estimation

- Evaluates task difficulty
- Estimates time requirements
- Suggests agent count
- Identifies dependencies

## Integration

This hook is automatically called by Claude Code when:

- Starting a new task
- Resuming work after a break
- Switching between projects
- Beginning complex operations

Manual usage in agents:

```bash
# In agent coordination
npx claude-flow hook pre-task --description "Your task here"
```

## Output

Returns JSON with:

```json
{
  "continue": true,
  "topology": "hierarchical",
  "agentsSpawned": 5,
  "complexity": "medium",
  "estimatedMinutes": 30,
  "memoryLoaded": true
}
```

## See Also

- `hook post-task` - Post-task cleanup
- `agent spawn` - Manual agent creation
- `memory usage` - Memory management
- `swarm init` - Swarm initialization

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/pre-command.md:
--------------------------------------------------------------------------------

```markdown
# hook pre-command

Execute pre-command validations and safety checks before running shell commands.

## Usage

```bash
npx claude-flow hook pre-command [options]
```

## Options

- `--command, -c <cmd>` - Command to be executed
- `--validate-safety` - Check command safety (default: true)
- `--check-permissions` - Verify execution permissions
- `--estimate-duration` - Estimate command runtime
- `--dry-run` - Preview without executing

## Examples

### Basic pre-command hook

```bash
npx claude-flow hook pre-command --command "npm install express"
```

### Safety validation

```bash
npx claude-flow hook pre-command -c "rm -rf node_modules" --validate-safety
```

### Permission check

```bash
npx claude-flow hook pre-command -c "sudo apt update" --check-permissions
```

### Dry run preview

```bash
npx claude-flow hook pre-command -c "git push origin main" --dry-run
```

## Features

### Safety Validation

- Detects dangerous commands
- Warns about destructive operations
- Checks for sudo/admin usage
- Validates command syntax

### Permission Checking

- Verifies execution rights
- Checks directory access
- Validates file permissions
- Ensures proper context

### Duration Estimation

- Predicts execution time
- Warns about long operations
- Suggests timeouts
- Tracks historical data

### Dry Run Mode

- Shows command effects
- Lists files affected
- Previews changes
- No actual execution

## Integration

This hook is automatically called by Claude Code when:

- Using Bash tool
- Running shell commands
- Executing npm/pip/cargo commands
- System operations

Manual usage in agents:

```bash
# Before running commands
npx claude-flow hook pre-command --command "your command here" --validate-safety
```

## Output

Returns JSON with:

```json
{
  "continue": true,
  "command": "npm install express",
  "safe": true,
  "estimatedDuration": 15000,
  "warnings": [],
  "permissions": "user",
  "affectedFiles": ["package.json", "package-lock.json"],
  "dryRunOutput": "Would install 50 packages"
}
```

## See Also

- `hook post-command` - Post-command processing
- `Bash` - Command execution tool
- `terminal execute` - Terminal operations
- `security scan` - Security validation

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/post-task.md:
--------------------------------------------------------------------------------

```markdown
# hook post-task

Execute post-task cleanup, performance analysis, and memory storage.

## Usage

```bash
npx claude-flow hook post-task [options]
```

## Options

- `--task-id, -t <id>` - Task identifier for tracking
- `--analyze-performance` - Generate performance metrics (default: true)
- `--store-decisions` - Save task decisions to memory
- `--export-learnings` - Export neural pattern learnings
- `--generate-report` - Create task completion report

## Examples

### Basic post-task hook

```bash
npx claude-flow hook post-task --task-id "auth-implementation"
```

### With full analysis

```bash
npx claude-flow hook post-task -t "api-refactor" --analyze-performance --generate-report
```

### Memory storage

```bash
npx claude-flow hook post-task -t "bug-fix-123" --store-decisions --export-learnings
```

### Quick cleanup

```bash
npx claude-flow hook post-task -t "minor-update" --analyze-performance false
```

## Features

### Performance Analysis

- Measures execution time
- Tracks token usage
- Identifies bottlenecks
- Suggests optimizations

### Decision Storage

- Saves key decisions made
- Records implementation choices
- Stores error resolutions
- Maintains knowledge base

### Neural Learning

- Exports successful patterns
- Updates coordination models
- Improves future performance
- Trains on task outcomes

### Report Generation

- Creates completion summary
- Documents changes made
- Lists files modified
- Tracks metrics achieved

## Integration

This hook is automatically called by Claude Code when:

- Completing a task
- Switching to a new task
- Ending a work session
- After major milestones

Manual usage in agents:

```bash
# In agent coordination
npx claude-flow hook post-task --task-id "your-task-id" --analyze-performance true
```

## Output

Returns JSON with:

```json
{
  "taskId": "auth-implementation",
  "duration": 1800000,
  "tokensUsed": 45000,
  "filesModified": 12,
  "performanceScore": 0.92,
  "learningsExported": true,
  "reportPath": "/reports/task-auth-implementation.md"
}
```

## See Also

- `hook pre-task` - Pre-task setup
- `performance report` - Detailed metrics
- `memory usage` - Memory management
- `neural patterns` - Pattern analysis

```

--------------------------------------------------------------------------------
/.claude/commands/hooks/post-edit.md:
--------------------------------------------------------------------------------

```markdown
# hook post-edit

Execute post-edit processing including formatting, validation, and memory updates.

## Usage

```bash
npx claude-flow hook post-edit [options]
```

## Options

- `--file, -f <path>` - File path that was edited
- `--auto-format` - Automatically format code (default: true)
- `--memory-key, -m <key>` - Store edit context in memory
- `--train-patterns` - Train neural patterns from edit
- `--validate-output` - Validate edited file

## Examples

### Basic post-edit hook

```bash
npx claude-flow hook post-edit --file "src/components/Button.jsx"
```

### With memory storage

```bash
npx claude-flow hook post-edit -f "api/auth.js" --memory-key "auth/login-implementation"
```

### Format and validate

```bash
npx claude-flow hook post-edit -f "config/webpack.js" --auto-format --validate-output
```

### Neural training

```bash
npx claude-flow hook post-edit -f "utils/helpers.ts" --train-patterns --memory-key "utils/refactor"
```

## Features

### Auto Formatting

- Language-specific formatters
- Prettier for JS/TS/JSON
- Black for Python
- gofmt for Go
- Maintains consistency

### Memory Storage

- Saves edit context
- Records decisions made
- Tracks implementation details
- Enables knowledge sharing

### Pattern Training

- Learns from successful edits
- Improves future suggestions
- Adapts to coding style
- Enhances coordination

### Output Validation

- Checks syntax correctness
- Runs linting rules
- Validates formatting
- Ensures quality

## Integration

This hook is automatically called by Claude Code when:

- After Edit tool completes
- Following MultiEdit operations
- During file saves
- After code generation

Manual usage in agents:

```bash
# After editing files
npx claude-flow hook post-edit --file "path/to/edited.js" --memory-key "feature/step1"
```

## Output

Returns JSON with:

```json
{
  "file": "src/components/Button.jsx",
  "formatted": true,
  "formatterUsed": "prettier",
  "lintPassed": true,
  "memorySaved": "component/button-refactor",
  "patternsTrained": 3,
  "warnings": [],
  "stats": {
    "linesChanged": 45,
    "charactersAdded": 234
  }
}
```

## See Also

- `hook pre-edit` - Pre-edit preparation
- `Edit` - File editing tool
- `memory usage` - Memory management
- `neural train` - Pattern training

```

--------------------------------------------------------------------------------
/.claude/commands/swarm/optimization.md:
--------------------------------------------------------------------------------

```markdown
# Optimization Swarm Strategy

## Purpose
Performance optimization through specialized analysis.

## Activation

### Using MCP Tools
```javascript
// Initialize optimization swarm
mcp__claude-flow__swarm_init({
  "topology": "mesh",
  "maxAgents": 6,
  "strategy": "adaptive"
})

// Orchestrate optimization task
mcp__claude-flow__task_orchestrate({
  "task": "optimize performance",
  "strategy": "parallel",
  "priority": "high"
})
```

### Using CLI (Fallback)
`npx claude-flow swarm "optimize performance" --strategy optimization`

## Agent Roles

### Agent Spawning with MCP
```javascript
// Spawn optimization agents
mcp__claude-flow__agent_spawn({
  "type": "optimizer",
  "name": "Performance Profiler",
  "capabilities": ["profiling", "bottleneck-detection"]
})

mcp__claude-flow__agent_spawn({
  "type": "analyst",
  "name": "Memory Analyzer",
  "capabilities": ["memory-analysis", "leak-detection"]
})

mcp__claude-flow__agent_spawn({
  "type": "optimizer",
  "name": "Code Optimizer",
  "capabilities": ["code-optimization", "refactoring"]
})

mcp__claude-flow__agent_spawn({
  "type": "tester",
  "name": "Benchmark Runner",
  "capabilities": ["benchmarking", "performance-testing"]
})
```

## Optimization Areas

### Performance Analysis
```javascript
// Analyze bottlenecks
mcp__claude-flow__bottleneck_analyze({
  "component": "all",
  "metrics": ["cpu", "memory", "io", "network"]
})

// Run benchmarks
mcp__claude-flow__benchmark_run({
  "suite": "performance"
})

// WASM optimization
mcp__claude-flow__wasm_optimize({
  "operation": "simd-acceleration"
})
```

### Optimization Operations
```javascript
// Optimize topology
mcp__claude-flow__topology_optimize({
  "swarmId": "optimization-swarm"
})

// DAA optimization
mcp__claude-flow__daa_optimization({
  "target": "performance",
  "metrics": ["speed", "memory", "efficiency"]
})

// Load balancing
mcp__claude-flow__load_balance({
  "swarmId": "optimization-swarm",
  "tasks": optimizationTasks
})
```

### Monitoring and Reporting
```javascript
// Performance report
mcp__claude-flow__performance_report({
  "format": "detailed",
  "timeframe": "7d"
})

// Trend analysis
mcp__claude-flow__trend_analysis({
  "metric": "performance",
  "period": "30d"
})

// Cost analysis
mcp__claude-flow__cost_analysis({
  "timeframe": "30d"
})
```

```

--------------------------------------------------------------------------------
/.claude/commands/github/github-swarm.md:
--------------------------------------------------------------------------------

```markdown
# github swarm

Create a specialized swarm for GitHub repository management.

## Usage

```bash
npx claude-flow github swarm [options]
```

## Options

- `--repository, -r <owner/repo>` - Target GitHub repository
- `--agents, -a <number>` - Number of specialized agents (default: 5)
- `--focus, -f <type>` - Focus area: maintenance, development, review, triage
- `--auto-pr` - Enable automatic pull request enhancements
- `--issue-labels` - Auto-categorize and label issues
- `--code-review` - Enable AI-powered code reviews

## Examples

### Basic GitHub swarm

```bash
npx claude-flow github swarm --repository owner/repo
```

### Maintenance-focused swarm

```bash
npx claude-flow github swarm -r owner/repo -f maintenance --issue-labels
```

### Development swarm with PR automation

```bash
npx claude-flow github swarm -r owner/repo -f development --auto-pr --code-review
```

### Full-featured triage swarm

```bash
npx claude-flow github swarm -r owner/repo -a 8 -f triage --issue-labels --auto-pr
```

## Agent Types

### Issue Triager

- Analyzes and categorizes issues
- Suggests labels and priorities
- Identifies duplicates and related issues

### PR Reviewer

- Reviews code changes
- Suggests improvements
- Checks for best practices

### Documentation Agent

- Updates README files
- Creates API documentation
- Maintains changelog

### Test Agent

- Identifies missing tests
- Suggests test cases
- Validates test coverage

### Security Agent

- Scans for vulnerabilities
- Reviews dependencies
- Suggests security improvements

## Workflows

### Issue Triage Workflow

1. Scan all open issues
2. Categorize by type and priority
3. Apply appropriate labels
4. Suggest assignees
5. Link related issues

### PR Enhancement Workflow

1. Analyze PR changes
2. Suggest missing tests
3. Improve documentation
4. Format code consistently
5. Add helpful comments

### Repository Health Check

1. Analyze code quality metrics
2. Review dependency status
3. Check test coverage
4. Assess documentation completeness
5. Generate health report

## Integration with Claude Code

Use in Claude Code with MCP tools:

```javascript
mcp__claude-flow__github_swarm {
  repository: "owner/repo",
  agents: 6,
  focus: "maintenance"
}
```

## See Also

- `repo analyze` - Deep repository analysis
- `pr enhance` - Enhance pull requests
- `issue triage` - Intelligent issue management
- `code review` - Automated reviews

```

--------------------------------------------------------------------------------
/.claude/commands/automation/auto-agent.md:
--------------------------------------------------------------------------------

```markdown
# auto agent

Automatically spawn and manage agents based on task requirements.

## Usage

```bash
npx claude-flow auto agent [options]
```

## Options

- `--task, -t <description>` - Task description for agent analysis
- `--max-agents, -m <number>` - Maximum agents to spawn (default: auto)
- `--min-agents <number>` - Minimum agents required (default: 1)
- `--strategy, -s <type>` - Selection strategy: optimal, minimal, balanced
- `--no-spawn` - Analyze only, don't spawn agents

## Examples

### Basic auto-spawning

```bash
npx claude-flow auto agent --task "Build a REST API with authentication"
```

### Constrained spawning

```bash
npx claude-flow auto agent -t "Debug performance issue" --max-agents 3
```

### Analysis only

```bash
npx claude-flow auto agent -t "Refactor codebase" --no-spawn
```

### Minimal strategy

```bash
npx claude-flow auto agent -t "Fix bug in login" -s minimal
```

## How It Works

1. **Task Analysis**

   - Parses task description
   - Identifies required skills
   - Estimates complexity
   - Determines parallelization opportunities

2. **Agent Selection**

   - Matches skills to agent types
   - Considers task dependencies
   - Optimizes for efficiency
   - Respects constraints

3. **Topology Selection**

   - Chooses optimal swarm structure
   - Configures communication patterns
   - Sets up coordination rules
   - Enables monitoring

4. **Automatic Spawning**
   - Creates selected agents
   - Assigns specific roles
   - Distributes subtasks
   - Initiates coordination

## Agent Types Selected

- **Architect**: System design, architecture decisions
- **Coder**: Implementation, code generation
- **Tester**: Test creation, quality assurance
- **Analyst**: Performance, optimization
- **Researcher**: Documentation, best practices
- **Coordinator**: Task management, progress tracking

## Strategies

### Optimal

- Maximum efficiency
- May spawn more agents
- Best for complex tasks
- Highest resource usage

### Minimal

- Minimum viable agents
- Conservative approach
- Good for simple tasks
- Lowest resource usage

### Balanced

- Middle ground
- Adaptive to complexity
- Default strategy
- Good performance/resource ratio

## Integration with Claude Code

```javascript
// In Claude Code after auto-spawning
mcp__claude-flow__auto_agent {
  task: "Build authentication system",
  strategy: "balanced",
  maxAgents: 6
}
```

## See Also

- `agent spawn` - Manual agent creation
- `swarm init` - Initialize swarm manually
- `smart spawn` - Intelligent agent spawning
- `workflow select` - Choose predefined workflows

```

--------------------------------------------------------------------------------
/src/rate-limiter.ts:
--------------------------------------------------------------------------------

```typescript
import { RateLimiter } from './types.js';

export class TokenBucketRateLimiter implements RateLimiter {
  private tokens: number;
  private lastRefill: number;
  private readonly maxTokens: number;
  private readonly refillRate: number; // tokens per millisecond
  private readonly refillInterval: number; // milliseconds

  constructor(maxRequests: number, windowMs: number) {
    this.maxTokens = maxRequests;
    this.tokens = maxRequests;
    this.lastRefill = Date.now();
    this.refillInterval = windowMs;
    this.refillRate = maxRequests / windowMs;
  }

  private refillTokens(): void {
    const now = Date.now();
    const timePassed = now - this.lastRefill;
    const newTokens = timePassed * this.refillRate;
    this.tokens = Math.min(this.maxTokens, this.tokens + newTokens);
    this.lastRefill = now;
  }

  canMakeRequest(): boolean {
    this.refillTokens();
    if (this.tokens >= 1) {
      this.tokens -= 1;
      return true;
    }
    return false;
  }

  async waitForAvailableToken(): Promise<void> {
    return new Promise(resolve => {
      const check = () => {
        if (this.canMakeRequest()) {
          resolve();
        } else {
          // Calculate time until next token is available
          const tokensNeeded = 1 - this.tokens;
          const msToWait = (tokensNeeded / this.refillRate) * 1000;
          setTimeout(check, Math.min(msToWait, 100)); // Check at most every 100ms
        }
      };
      check();
    });
  }
}

// Create rate limiters based on Trello's limits
export const createTrelloRateLimiters = () => {
  const apiKeyLimiter = new TokenBucketRateLimiter(300, 10000); // 300 requests per 10 seconds
  const tokenLimiter = new TokenBucketRateLimiter(100, 10000); // 100 requests per 10 seconds

  return {
    apiKeyLimiter,
    tokenLimiter,
    /**
     * Checks if a request can be made without hitting rate limits.
     * This is useful for pre-checking before attempting a request,
     * allowing for more graceful handling of rate limits without blocking.
     *
     * @returns {boolean} True if both API key and token limiters have available tokens
     */
    canMakeRequest(): boolean {
      return apiKeyLimiter.canMakeRequest() && tokenLimiter.canMakeRequest();
    },
    /**
     * Waits until tokens are available for both API key and token limiters.
     * This method blocks execution until rate limits allow the request to proceed.
     * Used by the axios interceptor to ensure all requests respect Trello's rate limits.
     *
     * @returns {Promise<void>} Resolves when tokens are available
     */
    async waitForAvailableToken(): Promise<void> {
      await Promise.all([
        apiKeyLimiter.waitForAvailableToken(),
        tokenLimiter.waitForAvailableToken(),
      ]);
    },
  };
};

```

--------------------------------------------------------------------------------
/.claude/commands/swarm/testing.md:
--------------------------------------------------------------------------------

```markdown
# Testing Swarm Strategy

## Purpose
Comprehensive testing through distributed execution.

## Activation

### Using MCP Tools
```javascript
// Initialize testing swarm
mcp__claude-flow__swarm_init({
  "topology": "star",
  "maxAgents": 7,
  "strategy": "parallel"
})

// Orchestrate testing task
mcp__claude-flow__task_orchestrate({
  "task": "test application",
  "strategy": "parallel",
  "priority": "high"
})
```

### Using CLI (Fallback)
`npx claude-flow swarm "test application" --strategy testing`

## Agent Roles

### Agent Spawning with MCP
```javascript
// Spawn testing agents
mcp__claude-flow__agent_spawn({
  "type": "tester",
  "name": "Unit Tester",
  "capabilities": ["unit-testing", "mocking", "coverage"]
})

mcp__claude-flow__agent_spawn({
  "type": "tester",
  "name": "Integration Tester",
  "capabilities": ["integration", "api-testing", "contract-testing"]
})

mcp__claude-flow__agent_spawn({
  "type": "tester",
  "name": "E2E Tester",
  "capabilities": ["e2e", "ui-testing", "user-flows"]
})

mcp__claude-flow__agent_spawn({
  "type": "tester",
  "name": "Performance Tester",
  "capabilities": ["load-testing", "stress-testing", "benchmarking"]
})

mcp__claude-flow__agent_spawn({
  "type": "monitor",
  "name": "Security Tester",
  "capabilities": ["security-testing", "penetration-testing", "vulnerability-scanning"]
})
```

## Test Coverage

### Coverage Analysis
```javascript
// Quality assessment
mcp__claude-flow__quality_assess({
  "target": "test-coverage",
  "criteria": ["line-coverage", "branch-coverage", "function-coverage"]
})

// Edge case detection
mcp__claude-flow__pattern_recognize({
  "data": testScenarios,
  "patterns": ["edge-case", "boundary-condition", "error-path"]
})
```

### Test Execution
```javascript
// Parallel test execution
mcp__claude-flow__parallel_execute({
  "tasks": [
    { "id": "unit-tests", "command": "npm run test:unit" },
    { "id": "integration-tests", "command": "npm run test:integration" },
    { "id": "e2e-tests", "command": "npm run test:e2e" }
  ]
})

// Batch processing for test suites
mcp__claude-flow__batch_process({
  "items": testSuites,
  "operation": "execute-test-suite"
})
```

### Performance Testing
```javascript
// Run performance benchmarks
mcp__claude-flow__benchmark_run({
  "suite": "performance-tests"
})

// Security scanning
mcp__claude-flow__security_scan({
  "target": "application",
  "depth": "comprehensive"
})
```

### Monitoring and Reporting
```javascript
// Monitor test execution
mcp__claude-flow__swarm_monitor({
  "swarmId": "testing-swarm",
  "interval": 2000
})

// Generate test report
mcp__claude-flow__performance_report({
  "format": "detailed",
  "timeframe": "current-run"
})

// Get test results
mcp__claude-flow__task_results({
  "taskId": "test-execution-001"
})
```

```

--------------------------------------------------------------------------------
/.claude/commands/performance.md:
--------------------------------------------------------------------------------

```markdown
---
name: performance
description: Monitor and optimize system performance with batchtools
---

# 📊 Performance Monitoring & Optimization

Real-time performance monitoring and optimization tools for Claude-Flow operations.

## Performance Metrics

### System Metrics
- **CPU Usage**: Multi-core utilization during parallel operations
- **Memory Usage**: RAM consumption and optimization
- **I/O Throughput**: Disk and network operation efficiency
- **Task Queue**: Operation queue depth and processing speed

### Batchtools Metrics
- **Parallel Efficiency**: Speedup ratio from concurrent processing
- **Batch Optimization**: Grouping effectiveness and resource utilization
- **Error Rates**: Success/failure rates for parallel operations
- **Resource Contention**: Conflicts and bottlenecks in concurrent operations

## Monitoring Commands

### Real-time Monitoring
```bash
# Monitor all system performance
./claude-flow performance monitor --real-time --all

# Focus on parallel operations
./claude-flow performance monitor --parallel --batchtools

# Monitor specific components
./claude-flow performance monitor --focus sparc --concurrent
```

### Performance Analysis
```bash
# Generate performance report
./claude-flow performance report --detailed --timeframe 24h

# Analyze batch operation efficiency
./claude-flow performance analyze --batchtools --optimization

# Compare performance across different modes
./claude-flow performance compare --modes architect,code,tdd
```

## Optimization Recommendations

### Automatic Optimization
- **Smart Batching**: Automatically group related operations
- **Dynamic Scaling**: Adjust concurrency based on system resources
- **Resource Allocation**: Optimize memory and CPU usage
- **Cache Management**: Intelligent caching for repeated operations

### Manual Tuning
- **Batch Size**: Adjust batch sizes based on operation type
- **Concurrency Limits**: Set optimal parallel operation limits
- **Resource Limits**: Configure memory and CPU constraints
- **Timeout Settings**: Optimize timeouts for parallel operations

## Performance Tuning

### Configuration Optimization
```json
{
  "performance": {
    "batchtools": {
      "maxConcurrent": 10,
      "batchSize": 20,
      "enableOptimization": true,
      "smartBatching": true
    },
    "monitoring": {
      "realTimeMetrics": true,
      "performanceLogging": true,
      "resourceAlerts": true
    }
  }
}
```

### Best Practices
- Monitor performance during development and production
- Use real-time metrics to identify bottlenecks
- Adjust concurrency based on system capabilities
- Implement performance alerts for critical thresholds
- Regular performance analysis and optimization

For comprehensive performance guides, see: https://github.com/ruvnet/claude-code-flow/docs/performance.md

```

--------------------------------------------------------------------------------
/docs/progress.md:
--------------------------------------------------------------------------------

```markdown
# MCP Server Trello - Progress Report

## Current Implementation Status

### Core Infrastructure
- ✅ Basic MCP server setup with proper initialization and error handling
- ✅ TypeScript implementation with comprehensive type definitions
- ✅ Environment variable configuration for API key, token, and board ID
- ✅ Stdio transport implementation for MCP communication

### Rate Limiting
- ✅ Token bucket algorithm implementation
- ✅ Separate rate limiters for API key (300/10s) and token (100/10s)
- ✅ Automatic request queuing when limits are reached
- ✅ Graceful handling of rate limit errors with automatic retry

### API Client
- ✅ Axios-based Trello API client
- ✅ Automatic error handling and retries
- ✅ Base URL and authentication configuration
- ✅ Rate limiting interceptor integration

### Input Validation
- ✅ Comprehensive validation for all tool inputs
- ✅ Type checking for strings, numbers, and arrays
- ✅ Required field validation
- ✅ Custom error messages for validation failures

### Implemented Tools
1. Board Management:
   - ✅ get_lists: Retrieve all lists from board
   - ✅ add_list_to_board: Create new list
   - ✅ archive_list: Archive existing list
   - ✅ get_recent_activity: Fetch board activity

2. Card Operations:
   - ✅ get_cards_by_list_id: Fetch cards in a list
   - ✅ add_card_to_list: Create new card
   - ✅ update_card_details: Modify existing card
   - ✅ archive_card: Archive card
   - ✅ get_my_cards: Fetch user's assigned cards

### Type Definitions
- ✅ TrelloConfig: Server configuration interface
- ✅ TrelloCard: Card data structure
- ✅ TrelloList: List data structure
- ✅ TrelloAction: Activity data structure
- ✅ TrelloLabel: Label data structure
- ✅ TrelloMember: Member data structure
- ✅ RateLimiter: Rate limiting interface

## Next Steps

### Potential Enhancements
1. Additional Card Features:
   - Add comment support
   - Add attachment handling
   - Add checklist management
   - Add member assignment capabilities

2. Label Management:
   - Create labels
   - Edit labels
   - Delete labels
   - Get available labels

3. Board Features:
   - Board customization options
   - Custom field support
   - Power-up integration

4. Enhanced Error Handling:
   - More detailed error messages
   - Better network error recovery
   - Offline mode support

5. Performance Optimizations:
   - Request batching
   - Response caching
   - Parallel request handling

6. Testing:
   - Unit tests
   - Integration tests
   - End-to-end tests
   - Mock API responses

### Documentation Needs
1. API Documentation:
   - Detailed tool descriptions
   - Example usage for each tool
   - Error handling guide
   - Rate limiting explanation

2. Setup Guide:
   - Installation instructions
   - Configuration details
   - Environment variable setup
   - Troubleshooting guide

3. Contributing Guide:
   - Development setup
   - Code style guide
   - Pull request process
   - Testing requirements

```

--------------------------------------------------------------------------------
/.claude/commands/swarm/research.md:
--------------------------------------------------------------------------------

```markdown
# Research Swarm Strategy

## Purpose
Deep research through parallel information gathering.

## Activation

### Using MCP Tools
```javascript
// Initialize research swarm
mcp__claude-flow__swarm_init({
  "topology": "mesh",
  "maxAgents": 6,
  "strategy": "adaptive"
})

// Orchestrate research task
mcp__claude-flow__task_orchestrate({
  "task": "research topic X",
  "strategy": "parallel",
  "priority": "medium"
})
```

### Using CLI (Fallback)
`npx claude-flow swarm "research topic X" --strategy research`

## Agent Roles

### Agent Spawning with MCP
```javascript
// Spawn research agents
mcp__claude-flow__agent_spawn({
  "type": "researcher",
  "name": "Web Researcher",
  "capabilities": ["web-search", "content-extraction", "source-validation"]
})

mcp__claude-flow__agent_spawn({
  "type": "researcher",
  "name": "Academic Researcher",
  "capabilities": ["paper-analysis", "citation-tracking", "literature-review"]
})

mcp__claude-flow__agent_spawn({
  "type": "analyst",
  "name": "Data Analyst",
  "capabilities": ["data-processing", "statistical-analysis", "visualization"]
})

mcp__claude-flow__agent_spawn({
  "type": "documenter",
  "name": "Report Writer",
  "capabilities": ["synthesis", "technical-writing", "formatting"]
})
```

## Research Methods

### Information Gathering
```javascript
// Parallel information collection
mcp__claude-flow__parallel_execute({
  "tasks": [
    { "id": "web-search", "command": "search recent publications" },
    { "id": "academic-search", "command": "search academic databases" },
    { "id": "data-collection", "command": "gather relevant datasets" }
  ]
})

// Store research findings
mcp__claude-flow__memory_usage({
  "action": "store",
  "key": "research-findings-" + Date.now(),
  "value": JSON.stringify(findings),
  "namespace": "research",
  "ttl": 604800 // 7 days
})
```

### Analysis and Validation
```javascript
// Pattern recognition in findings
mcp__claude-flow__pattern_recognize({
  "data": researchData,
  "patterns": ["trend", "correlation", "outlier"]
})

// Cognitive analysis
mcp__claude-flow__cognitive_analyze({
  "behavior": "research-synthesis"
})

// Cross-reference validation
mcp__claude-flow__quality_assess({
  "target": "research-sources",
  "criteria": ["credibility", "relevance", "recency"]
})
```

### Knowledge Management
```javascript
// Search existing knowledge
mcp__claude-flow__memory_search({
  "pattern": "topic X",
  "namespace": "research",
  "limit": 20
})

// Create knowledge connections
mcp__claude-flow__neural_patterns({
  "action": "learn",
  "operation": "knowledge-graph",
  "metadata": {
    "topic": "X",
    "connections": relatedTopics
  }
})
```

### Reporting
```javascript
// Generate research report
mcp__claude-flow__workflow_execute({
  "workflowId": "research-report-generation",
  "params": {
    "findings": findings,
    "format": "comprehensive"
  }
})

// Monitor progress
mcp__claude-flow__swarm_status({
  "swarmId": "research-swarm"
})
```

```

--------------------------------------------------------------------------------
/src/evals/evals.ts:
--------------------------------------------------------------------------------

```typescript
//evals.ts

import { EvalConfig } from 'mcp-evals';
import { openai } from '@ai-sdk/openai';
import { grade, EvalFunction } from 'mcp-evals';

const get_cards_by_list_idEval: EvalFunction = {
  name: 'get_cards_by_list_id Tool Evaluation',
  description: 'Evaluates the get_cards_by_list_id tool functionality',
  run: async () => {
    const result = await grade(
      openai('gpt-4'),
      'Can you fetch all cards from the Trello list with ID abc123?'
    );
    return JSON.parse(result);
  },
};

const get_listsEval: EvalFunction = {
  name: 'get_lists Tool Evaluation',
  description: 'Evaluates the get_lists tool by retrieving all lists from a specified board',
  run: async () => {
    const result = await grade(
      openai('gpt-4'),
      'Please retrieve all lists from the board with ID 12345 and provide their names.'
    );
    return JSON.parse(result);
  },
};

const get_recent_activityEvalFunction: EvalFunction = {
  name: 'get_recent_activity Tool Evaluation',
  description: 'Evaluates the ability to fetch recent activity on the Trello board',
  run: async () => {
    const result = await grade(
      openai('gpt-4'),
      'Fetch the recent activity on the Trello board, limit it to 5 items'
    );
    return JSON.parse(result);
  },
};

const add_card_to_listEval: EvalFunction = {
  name: 'add_card_to_listEval',
  description: 'Evaluates the add_card_to_list tool',
  run: async () => {
    const result = await grade(
      openai('gpt-4'),
      "Please add a new card named 'Demo Card' to the list with ID 'abc123', with a description of 'This is a test card', due date '2023-12-31T12:00:00Z', start date '2025-08-05', and a label 'priority'."
    );
    return JSON.parse(result);
  },
};

const update_card_detailsEval: EvalFunction = {
  name: 'update_card_details Evaluation',
  description: 'Evaluates the update_card_details tool functionality',
  run: async () => {
    const result = await grade(
      openai('gpt-4'),
      "Please update the card with ID 'abc123' to have the name 'Updated Card Name', the description 'New description for the card', a due date of '2024-01-01T10:00:00Z', start date '2025-08-05', and labels ['priority','review']."
    );
    return JSON.parse(result);
  },
};

const mark_card_completeEval: EvalFunction = {
  name: 'mark_card_complete Evaluation',
  description: 'Evaluates the ability to mark a card as complete using dueComplete',
  run: async () => {
    const result = await grade(
      openai('gpt-4'),
      "Please mark the card with ID 'xyz789' as complete by setting dueComplete to true."
    );
    return JSON.parse(result);
  },
};

const config: EvalConfig = {
  model: openai('gpt-4'),
  evals: [
    get_cards_by_list_idEval,
    get_listsEval,
    get_recent_activityEvalFunction,
    add_card_to_listEval,
    update_card_detailsEval,
    mark_card_completeEval,
  ],
};

export default config;

export const evals = [
  get_cards_by_list_idEval,
  get_listsEval,
  get_recent_activityEvalFunction,
  add_card_to_listEval,
  update_card_detailsEval,
  mark_card_completeEval,
];

```

--------------------------------------------------------------------------------
/.claude/commands/sparc/orchestrator.md:
--------------------------------------------------------------------------------

```markdown
# SPARC Orchestrator Mode

## Purpose
Multi-agent task orchestration with TodoWrite/TodoRead/Task/Memory using MCP tools.

## Activation

### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
  mode: "orchestrator",
  task_description: "coordinate feature development"
}
```

### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run orchestrator "coordinate feature development"

# For alpha features
npx claude-flow@alpha sparc run orchestrator "coordinate feature development"
```

### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run orchestrator "coordinate feature development"
```

## Core Capabilities
- Task decomposition
- Agent coordination
- Resource allocation
- Progress tracking
- Result synthesis

## Integration Examples

### Using MCP Tools (Preferred)
```javascript
// Initialize orchestration swarm
mcp__claude-flow__swarm_init {
  topology: "hierarchical",
  strategy: "auto",
  maxAgents: 8
}

// Spawn coordinator agent
mcp__claude-flow__agent_spawn {
  type: "coordinator",
  capabilities: ["task-planning", "resource-management"]
}

// Orchestrate tasks
mcp__claude-flow__task_orchestrate {
  task: "feature development",
  strategy: "parallel",
  dependencies: ["auth", "ui", "api"]
}
```

### Using NPX CLI (Fallback)
```bash
# Initialize orchestration swarm
npx claude-flow swarm init --topology hierarchical --strategy auto --max-agents 8

# Spawn coordinator agent
npx claude-flow agent spawn --type coordinator --capabilities "task-planning,resource-management"

# Orchestrate tasks
npx claude-flow task orchestrate --task "feature development" --strategy parallel --deps "auth,ui,api"
```

## Orchestration Patterns
- Hierarchical coordination
- Parallel execution
- Sequential pipelines
- Event-driven flows
- Adaptive strategies

## Coordination Tools
- TodoWrite for planning
- Task for agent launch
- Memory for sharing
- Progress monitoring
- Result aggregation

## Workflow Example

### Using MCP Tools (Preferred)
```javascript
// 1. Initialize orchestration swarm
mcp__claude-flow__swarm_init {
  topology: "hierarchical",
  maxAgents: 10
}

// 2. Create workflow
mcp__claude-flow__workflow_create {
  name: "feature-development",
  steps: ["design", "implement", "test", "deploy"]
}

// 3. Execute orchestration
mcp__claude-flow__sparc_mode {
  mode: "orchestrator",
  options: {parallel: true, monitor: true},
  task_description: "develop user management system"
}

// 4. Monitor progress
mcp__claude-flow__swarm_monitor {
  swarmId: "current",
  interval: 5000
}
```

### Using NPX CLI (Fallback)
```bash
# 1. Initialize orchestration swarm
npx claude-flow swarm init --topology hierarchical --max-agents 10

# 2. Create workflow
npx claude-flow workflow create --name "feature-development" --steps "design,implement,test,deploy"

# 3. Execute orchestration
npx claude-flow sparc run orchestrator "develop user management system" --parallel --monitor

# 4. Monitor progress
npx claude-flow swarm monitor --interval 5000
```
```

--------------------------------------------------------------------------------
/.claude/commands/analysis/bottleneck-detect.md:
--------------------------------------------------------------------------------

```markdown
# bottleneck detect

Analyze performance bottlenecks in swarm operations and suggest optimizations.

## Usage

```bash
npx claude-flow bottleneck detect [options]
```

## Options

- `--swarm-id, -s <id>` - Analyze specific swarm (default: current)
- `--time-range, -t <range>` - Analysis period: 1h, 24h, 7d, all (default: 1h)
- `--threshold <percent>` - Bottleneck threshold percentage (default: 20)
- `--export, -e <file>` - Export analysis to file
- `--fix` - Apply automatic optimizations

## Examples

### Basic bottleneck detection

```bash
npx claude-flow bottleneck detect
```

### Analyze specific swarm

```bash
npx claude-flow bottleneck detect --swarm-id swarm-123
```

### Last 24 hours with export

```bash
npx claude-flow bottleneck detect -t 24h -e bottlenecks.json
```

### Auto-fix detected issues

```bash
npx claude-flow bottleneck detect --fix --threshold 15
```

## Metrics Analyzed

### Communication Bottlenecks

- Message queue delays
- Agent response times
- Coordination overhead
- Memory access patterns

### Processing Bottlenecks

- Task completion times
- Agent utilization rates
- Parallel execution efficiency
- Resource contention

### Memory Bottlenecks

- Cache hit rates
- Memory access patterns
- Storage I/O performance
- Neural pattern loading

### Network Bottlenecks

- API call latency
- MCP communication delays
- External service timeouts
- Concurrent request limits

## Output Format

```
🔍 Bottleneck Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 Summary
├── Time Range: Last 1 hour
├── Agents Analyzed: 6
├── Tasks Processed: 42
└── Critical Issues: 2

🚨 Critical Bottlenecks
1. Agent Communication (35% impact)
   └── coordinator → coder-1 messages delayed by 2.3s avg

2. Memory Access (28% impact)
   └── Neural pattern loading taking 1.8s per access

⚠️ Warning Bottlenecks
1. Task Queue (18% impact)
   └── 5 tasks waiting > 10s for assignment

💡 Recommendations
1. Switch to hierarchical topology (est. 40% improvement)
2. Enable memory caching (est. 25% improvement)
3. Increase agent concurrency to 8 (est. 20% improvement)

✅ Quick Fixes Available
Run with --fix to apply:
- Enable smart caching
- Optimize message routing
- Adjust agent priorities
```

## Automatic Fixes

When using `--fix`, the following optimizations may be applied:

1. **Topology Optimization**

   - Switch to more efficient topology
   - Adjust communication patterns
   - Reduce coordination overhead

2. **Caching Enhancement**

   - Enable memory caching
   - Optimize cache strategies
   - Preload common patterns

3. **Concurrency Tuning**

   - Adjust agent counts
   - Optimize parallel execution
   - Balance workload distribution

4. **Priority Adjustment**
   - Reorder task queues
   - Prioritize critical paths
   - Reduce wait times

## Performance Impact

Typical improvements after bottleneck resolution:

- **Communication**: 30-50% faster message delivery
- **Processing**: 20-40% reduced task completion time
- **Memory**: 40-60% fewer cache misses
- **Overall**: 25-45% performance improvement

## Integration with Claude Code

```javascript
// Check for bottlenecks in Claude Code
mcp__claude-flow__bottleneck_detect {
  timeRange: "1h",
  threshold: 20,
  autoFix: false
}
```

## See Also

- `performance report` - Detailed performance analysis
- `token usage` - Token optimization analysis
- `swarm monitor` - Real-time monitoring
- `cache manage` - Cache optimization

```

--------------------------------------------------------------------------------
/.claude/commands/swarm/examples.md:
--------------------------------------------------------------------------------

```markdown
# Examples Swarm Strategy

## Common Swarm Patterns

### Research Swarm

#### Using MCP Tools
```javascript
// Initialize research swarm
mcp__claude-flow__swarm_init({
  "topology": "mesh",
  "maxAgents": 6,
  "strategy": "adaptive"
})

// Spawn research agents
mcp__claude-flow__agent_spawn({
  "type": "researcher",
  "name": "AI Trends Researcher",
  "capabilities": ["web-search", "analysis", "synthesis"]
})

// Orchestrate research
mcp__claude-flow__task_orchestrate({
  "task": "research AI trends",
  "strategy": "parallel",
  "priority": "medium"
})

// Monitor progress
mcp__claude-flow__swarm_status({
  "swarmId": "research-swarm"
})
```

#### Using CLI (Fallback)
```bash
npx claude-flow swarm "research AI trends" \
  --strategy research \
  --mode distributed \
  --max-agents 6 \
  --parallel
```

### Development Swarm

#### Using MCP Tools
```javascript
// Initialize development swarm
mcp__claude-flow__swarm_init({
  "topology": "hierarchical",
  "maxAgents": 8,
  "strategy": "balanced"
})

// Spawn development team
const devAgents = [
  { type: "architect", name: "API Designer" },
  { type: "coder", name: "Backend Developer" },
  { type: "tester", name: "API Tester" },
  { type: "documenter", name: "API Documenter" }
]

devAgents.forEach(agent => {
  mcp__claude-flow__agent_spawn({
    "type": agent.type,
    "name": agent.name,
    "swarmId": "dev-swarm"
  })
})

// Orchestrate development
mcp__claude-flow__task_orchestrate({
  "task": "build REST API",
  "strategy": "sequential",
  "dependencies": ["design", "implement", "test", "document"]
})

// Enable monitoring
mcp__claude-flow__swarm_monitor({
  "swarmId": "dev-swarm",
  "interval": 5000
})
```

#### Using CLI (Fallback)
```bash
npx claude-flow swarm "build REST API" \
  --strategy development \
  --mode hierarchical \
  --monitor \
  --output sqlite
```

### Analysis Swarm

#### Using MCP Tools
```javascript
// Initialize analysis swarm
mcp__claude-flow__swarm_init({
  "topology": "mesh",
  "maxAgents": 5,
  "strategy": "adaptive"
})

// Spawn analysis agents
mcp__claude-flow__agent_spawn({
  "type": "analyst",
  "name": "Code Analyzer",
  "capabilities": ["static-analysis", "complexity-analysis"]
})

mcp__claude-flow__agent_spawn({
  "type": "analyst",
  "name": "Security Analyzer",
  "capabilities": ["security-scan", "vulnerability-detection"]
})

// Parallel analysis execution
mcp__claude-flow__parallel_execute({
  "tasks": [
    { "id": "analyze-code", "command": "analyze codebase structure" },
    { "id": "analyze-security", "command": "scan for vulnerabilities" },
    { "id": "analyze-performance", "command": "identify bottlenecks" }
  ]
})

// Generate comprehensive report
mcp__claude-flow__performance_report({
  "format": "detailed",
  "timeframe": "current"
})
```

#### Using CLI (Fallback)
```bash
npx claude-flow swarm "analyze codebase" \
  --strategy analysis \
  --mode mesh \
  --parallel \
  --timeout 300
```

## Error Handling Examples

```javascript
// Setup fault tolerance
mcp__claude-flow__daa_fault_tolerance({
  "agentId": "all",
  "strategy": "auto-recovery"
})

// Handle errors gracefully
try {
  await mcp__claude-flow__task_orchestrate({
    "task": "complex operation",
    "strategy": "parallel"
  })
} catch (error) {
  // Check swarm health
  const status = await mcp__claude-flow__swarm_status({})
  
  // Log error patterns
  await mcp__claude-flow__error_analysis({
    "logs": [error.message]
  })
}
```

```
Page 1/5FirstPrevNextLast