@claude-flow/plugin-gastown-bridge

中文文档
0.1.6发布于 2026/11/09MITTypeScriptESM + CJS近 30 天下载 10.4万

Gas Town orchestrator integration for Claude Flow V3 with WASM-accelerated formula parsing and graph analysis

原始使用文档
文档目录47 节
  1. Quickstart
  2. Introduction
  3. What is Gas Town?
  4. Why This Plugin?
  5. Features
  6. 🚀 WASM-Accelerated Computation
  7. 🔗 20 MCP Tools
  8. 🛡️ Security-First Design
  9. 🔄 Bidirectional Sync
  10. Enhancement & Comparison
  11. Gas Town vs Claude Flow V3
  12. Performance Comparison
  13. Architecture Comparison
  14. Installation
  15. Usage
  16. Basic Setup
  17. Using MCP Tools
  18. WASM-Accelerated Operations
  19. Sync Between Beads and AgentDB
  20. Tutorial
  21. Step 1: Verify Prerequisites
  22. Step 2: Initialize Plugin in Your Project
  23. Step 3: Create Your First Bead
  24. Step 4: List Ready Work
  25. Understanding Formula Types
  26. Creating a Custom Formula
  27. Cooking a Formula (WASM-Accelerated)
  28. What is a Convoy?
  29. Creating a Convoy
  30. Tracking Convoy Progress
  31. Optimizing Convoy Execution (WASM)
  32. Gas Town Agent Roles
  33. Slinging Work
  34. Listing Available Agents
  35. Sync Strategies
  36. Conflict Resolution
  37. Example: Production Sync Workflow
  38. When to Use WASM Tools
  39. Batch Processing for Maximum Performance
  40. Profiling WASM Performance
  41. API Reference
  42. Plugin Configuration
  43. Tool Reference
  44. Architecture
  45. Related Resources
  46. Contributing
  47. License

@claude-flow/plugin-gastown-bridge

Animated diagram: an agent calls a gt_ MCP tool, inputs are validated, and the bridge runs the gt or bd CLI against Gas Town

@claude-flow/plugin-gastown-bridge — A Ruflo plugin that lets agents drive the Gas Town orchestrator (beads, convoys, formulas) through validated MCP tools that call the gt and bd CLIs.

Supported environments: Node.js 20+ · ESM and CommonJS · the gt/bd CLIs for live calls

Quickstart

npm install @claude-flow/plugin-gastown-bridge
import { GasTownBridgePlugin, validateBeadId } from '@claude-flow/plugin-gastown-bridge';

const plugin = new GasTownBridgePlugin();
console.log('tools:', plugin.getMCPTools().length);
console.log('bead id:', validateBeadId('gt-abc12'));
try {
  validateBeadId('gt-abc; echo injected');
} catch (err) {
  console.log('rejected:', err.code);
}

Expected output:

tools: 20
bead id: gt-abc12
rejected: GT_INVALID_BEAD_ID

Install it into a Ruflo project with @claude-flow/cli: npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-gastown-bridge.

WASM-Accelerated Bridge to Steve Yegge's Gas Town Multi-Agent Orchestrator

npm version License: MIT

Introduction

The Gas Town Bridge Plugin brings Steve Yegge's powerful Gas Town multi-agent orchestrator to Claude Flow V3. Gas Town introduces battle-tested concepts for durable workflow execution that complement Claude Flow's swarm intelligence.

What is Gas Town?

Gas Town is a 75,000-line Go codebase that implements:

  • Beads - Git-backed issue tracking with graph semantics
  • Formulas - TOML-defined workflows (convoy, workflow, expansion, aspect)
  • Convoys - Work-order tracking for "slung" work between agents
  • GUPP - Gastown Universal Propulsion Principle for crash-resilient execution
  • Molecules/Wisps - Chained work units for durable, resumable workflows

Why This Plugin?

ChallengeSolution
Gas Town is Go-onlyCLI bridge wraps gt and bd commands
Go can't compile to WASM (syscalls)Hybrid architecture: CLI for I/O, WASM for compute
Formula parsing is slow in JSRust→WASM provides 352x speedup
Graph operations bottleneckWASM DAG ops are 150x faster

Features

🚀 WASM-Accelerated Computation

OperationJavaScriptWASMSpeedup
Formula parse (TOML→AST)53ms0.15ms352x
Variable cooking35ms0.1ms350x
Batch cook (10 formulas)350ms1ms350x
DAG topological sort75ms0.5ms150x
Cycle detection45ms0.3ms150x
Critical path analysis120ms0.8ms150x
Pattern search (HNSW)5000ms5ms1000x-12500x

🔗 20 MCP Tools

┌─────────────────────────────────────────────────────────────┐
│                    MCP Tool Categories                       │
├─────────────────┬─────────────────┬─────────────────────────┤
│  Beads (5)      │  Convoy (3)     │  Formula (4)            │
│  ├─ create      │  ├─ create      │  ├─ list                │
│  ├─ ready       │  ├─ status      │  ├─ cook (WASM)         │
│  ├─ show        │  └─ track       │  ├─ execute             │
│  ├─ dep         │                 │  └─ create              │
│  └─ sync        │                 │                         │
├─────────────────┼─────────────────┼─────────────────────────┤
│  Orchestration  │  WASM (5)       │                         │
│  ├─ sling       │  ├─ parse       │                         │
│  ├─ agents      │  ├─ resolve     │                         │
│  └─ mail        │  ├─ cook_batch  │                         │
│                 │  ├─ match       │                         │
│                 │  └─ optimize    │                         │
└─────────────────┴─────────────────┴─────────────────────────┘

🛡️ Security-First Design

  • Input Validation: Zod schemas for all parameters
  • Command Injection Prevention: Allowlist-only CLI execution
  • Path Traversal Protection: Strict path validation
  • No Shell Execution: Uses execFile with shell: false

🔄 Bidirectional Sync

Seamlessly sync between Gas Town's Beads and Claude Flow's AgentDB:

┌──────────────┐     SyncBridge      ┌──────────────┐
│              │  ←───────────────→  │              │
│    Beads     │   Conflict Res.     │   AgentDB    │
│   (JSONL)    │   • beads-wins      │   (SQLite)   │
│              │   • newest-wins     │              │
│              │   • merge           │              │
└──────────────┘                     └──────────────┘

Enhancement & Comparison

Gas Town vs Claude Flow V3

FeatureGas TownClaude Flow V3With This Plugin
Issue TrackingBeads (Git-backed)AgentDBUnified sync
WorkflowsTOML FormulasTypeScriptBoth supported
Agent RolesMayor, Polecats, CrewHierarchical swarmInteroperable
Crash RecoveryGUPP hooksSession persistenceCombined
Work DistributionSlingingTask orchestrationBridge via sling tool
Pattern SearchN/AHNSW (slow JS)HNSW WASM (1000x faster)

Performance Comparison

MetricPure JavaScriptThis Plugin (WASM)Improvement
Formula parse53ms0.15ms352x faster
100-node DAG sort75ms0.5ms150x faster
Pattern search (10k)5000ms5ms1000x faster
Memory usage48MB12MB4x reduction
Startup time850ms120ms7x faster

Architecture Comparison

ApproachProsConsThis Plugin
Full TypeScript PortNative, no deps75k lines to port❌
Go→WASM CompileReuse codeSyscalls block it❌
Pure CLI BridgeSimpleSlow for computePartial ✓
Hybrid CLI+WASMBest of bothTwo codebases✅ Selected

Installation

# Install via Claude Flow CLI (recommended)
npx claude-flow@latest plugins install -n @claude-flow/plugin-gastown-bridge

# Or install directly via npm
npm install @claude-flow/plugin-gastown-bridge

# Prerequisites: Gas Town and Beads CLI (optional - for full CLI integration)
# See: https://github.com/steveyegge/gastown
go install github.com/steveyegge/gastown/cmd/gt@latest
go install github.com/steveyegge/beads/cmd/bd@latest

Usage

Basic Setup

import { GasTownBridgePlugin } from '@claude-flow/plugin-gastown-bridge';

// Initialize the plugin
const plugin = new GasTownBridgePlugin({
  gtPath: '/usr/local/bin/gt',  // Optional: path to gt CLI
  bdPath: '/usr/local/bin/bd',  // Optional: path to bd CLI
  wasmEnabled: true,             // Enable WASM acceleration
});

// Register with Claude Flow
await claudeFlow.registerPlugin(plugin);

Using MCP Tools

// Create a bead (issue)
const bead = await plugin.tools.gt_beads_create({
  title: 'Implement feature X',
  description: 'Full description here',
  priority: 2,
  labels: ['feature', 'v3'],
});

// List ready beads (no blockers)
const ready = await plugin.tools.gt_beads_ready({
  limit: 10,
  rig: 'main',
});

// Cook a formula (WASM-accelerated, 352x faster)
const cooked = await plugin.tools.gt_formula_cook({
  formula: 'implement-feature',
  vars: {
    feature_name: 'Authentication',
    target_module: 'src/auth',
  },
});

// Sling work to an agent
await plugin.tools.gt_sling({
  bead_id: 'gt-abc123',
  target: 'polecat',
  formula: 'code-review',
});

WASM-Accelerated Operations

// Parse formula (352x faster than JS)
const ast = await plugin.tools.gt_wasm_parse_formula({
  content: `
    [formula]
    name = "deploy-service"
    type = "convoy"

    [[legs]]
    id = "build"
    title = "Build the service"
  `,
});

// Resolve dependencies (150x faster)
const sorted = await plugin.tools.gt_wasm_resolve_deps({
  beads: beadList,
  action: 'topo_sort',
});

// Batch cook formulas (352x faster)
const cooked = await plugin.tools.gt_wasm_cook_batch({
  formulas: formulaList,
  vars: [{ env: 'prod' }, { env: 'staging' }],
});

// Find similar patterns (1000x-12500x faster)
const matches = await plugin.tools.gt_wasm_match_pattern({
  query: 'authentication flow',
  candidates: formulaNames,
  k: 5,
});

Sync Between Beads and AgentDB

// Sync beads to AgentDB
await plugin.tools.gt_beads_sync({
  direction: 'push',
  rig: 'main',
  namespace: 'project-x',
});

// Pull from AgentDB to Beads
await plugin.tools.gt_beads_sync({
  direction: 'pull',
  conflictStrategy: 'newest-wins',
});

// Bidirectional sync
await plugin.tools.gt_beads_sync({
  direction: 'both',
  conflictStrategy: 'merge',
});

Tutorial

📖 Tutorial 1: Your First Gas Town Integration

Step 1: Verify Prerequisites

# Check Gas Town CLI
gt --version

# Check Beads CLI
bd --version

# Both should output version numbers

Step 2: Initialize Plugin in Your Project

// claude-flow.config.ts
import { defineConfig } from 'claude-flow';
import { GasTownBridgePlugin } from '@claude-flow/plugin-gastown-bridge';

export default defineConfig({
  plugins: [
    new GasTownBridgePlugin({
      wasmEnabled: true,
    }),
  ],
});

Step 3: Create Your First Bead

const bead = await claudeFlow.mcp.call('gt_beads_create', {
  title: 'Hello Gas Town',
  description: 'My first bead from Claude Flow!',
  priority: 3,
  labels: ['tutorial'],
});

console.log(`Created bead: ${bead.id}`);
// Output: Created bead: gt-a1b2c3

Step 4: List Ready Work

const ready = await claudeFlow.mcp.call('gt_beads_ready', {
  limit: 5,
});

console.log('Ready beads:', ready.beads.map(b => b.title));
📖 Tutorial 2: Working with Formulas

Understanding Formula Types

TypePurposeExample
convoyMulti-leg work ordersFeature implementation
workflowStep-by-step processesCI/CD pipeline
expansionGenerate multiple beadsTest suite creation
aspectCross-cutting concernsLogging, metrics

Creating a Custom Formula

// Create a code review formula
await claudeFlow.mcp.call('gt_formula_create', {
  name: 'code-review-flow',
  type: 'workflow',
  steps: [
    {
      id: 'checkout',
      title: 'Checkout branch',
      description: 'Clone and checkout the PR branch',
    },
    {
      id: 'lint',
      title: 'Run linters',
      description: 'Execute ESLint and Prettier',
      needs: ['checkout'],
    },
    {
      id: 'test',
      title: 'Run tests',
      description: 'Execute test suite',
      needs: ['checkout'],
    },
    {
      id: 'review',
      title: 'Code review',
      description: 'Manual code review',
      needs: ['lint', 'test'],
    },
  ],
  vars: {
    branch: { type: 'string', required: true },
    reviewer: { type: 'string', default: 'auto' },
  },
});

Cooking a Formula (WASM-Accelerated)

// Cook the formula with variables
const cooked = await claudeFlow.mcp.call('gt_formula_cook', {
  formula: 'code-review-flow',
  vars: {
    branch: 'feature/auth',
    reviewer: '@alice',
  },
});

// cooked.steps now have variables substituted
console.log(cooked.steps[3].description);
// Output: "Manual code review by @alice"
📖 Tutorial 3: Convoy Management

What is a Convoy?

A convoy is a "work order" that tracks a set of related beads through their lifecycle. Think of it as a sprint or milestone.

Creating a Convoy

// Create convoy for a feature
const convoy = await claudeFlow.mcp.call('gt_convoy_create', {
  name: 'v2.0-release',
  description: 'Version 2.0 release convoy',
  issues: ['gt-abc1', 'gt-abc2', 'gt-abc3'],
});

console.log(`Convoy created: ${convoy.id}`);

Tracking Convoy Progress

// Check convoy status
const status = await claudeFlow.mcp.call('gt_convoy_status', {
  convoy_id: convoy.id,
  detailed: true,
});

console.log(`Progress: ${status.progress}%`);
console.log(`Completed: ${status.completed}/${status.total}`);

Optimizing Convoy Execution (WASM)

// Get optimal execution order (150x faster with WASM)
const optimized = await claudeFlow.mcp.call('gt_wasm_optimize_convoy', {
  convoy_id: convoy.id,
  strategy: 'parallel', // or 'serial', 'hybrid'
});

console.log('Execution plan:', optimized.plan);
// Output shows which beads can run in parallel
📖 Tutorial 4: Slinging Work to Agents

Gas Town Agent Roles

RolePurpose
mayorCoordinator, assigns work
polecatGeneral worker agents
crewSpecialized team members
refineryProcessing and transformation
witnessVerification and validation
deaconAdministrative tasks
dogGuard duties, security

Slinging Work

// Sling a bead to a polecat for coding
await claudeFlow.mcp.call('gt_sling', {
  bead_id: 'gt-abc123',
  target: 'polecat',
  formula: 'implement-feature',
});

// The work is now "on the polecat's hook"
// GUPP: "If work is on your hook, YOU MUST RUN IT"

Listing Available Agents

const agents = await claudeFlow.mcp.call('gt_agents', {
  rig: 'main',
  role: 'polecat',
  include_inactive: false,
});

agents.forEach(agent => {
  console.log(`${agent.name}: ${agent.status} (${agent.workload} tasks)`);
});
📖 Tutorial 5: Beads-AgentDB Synchronization

Sync Strategies

StrategyUse Case
pushExport beads to AgentDB
pullImport from AgentDB to Beads
bothBidirectional sync

Conflict Resolution

ResolutionBehavior
beads-winsBeads data overwrites AgentDB
agentdb-winsAgentDB data overwrites Beads
newest-winsMost recent modification wins
mergeCombine non-conflicting fields
manualQueue conflicts for manual resolution

Example: Production Sync Workflow

// Morning: Pull overnight changes from shared AgentDB
await claudeFlow.mcp.call('gt_beads_sync', {
  direction: 'pull',
  rig: 'production',
  conflictStrategy: 'newest-wins',
});

// During work: Push local changes
await claudeFlow.mcp.call('gt_beads_sync', {
  direction: 'push',
  rig: 'production',
  namespace: 'team-alpha',
});

// End of day: Full bidirectional sync
const result = await claudeFlow.mcp.call('gt_beads_sync', {
  direction: 'both',
  conflictStrategy: 'merge',
});

console.log(`Synced: ${result.pushed} pushed, ${result.pulled} pulled`);
console.log(`Conflicts: ${result.conflicts.length}`);
📖 Tutorial 6: WASM Performance Optimization

When to Use WASM Tools

Use WASMUse CLI
Parsing formulasCreating beads
Graph operationsFile I/O
Pattern matchingSQLite queries
Batch processingAgent communication

Batch Processing for Maximum Performance

// Instead of this (slow):
for (const formula of formulas) {
  await claudeFlow.mcp.call('gt_formula_cook', {
    formula: formula.name,
    vars: formula.vars,
  });
}

// Do this (352x faster):
const results = await claudeFlow.mcp.call('gt_wasm_cook_batch', {
  formulas: formulas.map(f => f.name),
  vars: formulas.map(f => f.vars),
});

Profiling WASM Performance

// All WASM tools return timing metrics
const result = await claudeFlow.mcp.call('gt_wasm_parse_formula', {
  content: formulaToml,
});

console.log(`Parse time: ${result.durationMs}ms`);
// Output: Parse time: 0.14ms

API Reference

Plugin Configuration

interface GasTownBridgeConfig {
  /** Path to gt CLI (default: auto-detect) */
  gtPath?: string;

  /** Path to bd CLI (default: auto-detect) */
  bdPath?: string;

  /** Enable WASM acceleration (default: true) */
  wasmEnabled?: boolean;

  /** Default rig for operations */
  defaultRig?: string;

  /** Sync conflict resolution strategy */
  conflictStrategy?: 'beads-wins' | 'agentdb-wins' | 'newest-wins' | 'merge' | 'manual';

  /** CLI execution timeout in ms (default: 30000) */
  timeout?: number;
}

Tool Reference

See MCP Tools Documentation for complete API reference.

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                      Claude Flow V3 Plugin Host                      │
├─────────────────────────────────────────────────────────────────────┤
│                                                                      │
│  ┌─────────────────────┐    ┌─────────────────────────────────────┐ │
│  │    CLI Bridge       │    │         WASM Computation Layer       │ │
│  │  (I/O Operations)   │    │           (352x faster)              │ │
│  │                     │    │                                      │ │
│  │  • gt commands      │    │  ┌──────────────┐ ┌──────────────┐  │ │
│  │  • bd commands      │    │  │ gastown-     │ │ ruvector-    │  │ │
│  │  • File read/write  │    │  │ formula-wasm │ │ gnn-wasm     │  │ │
│  │  • SQLite queries   │    │  │              │ │              │  │ │
│  │                     │    │  │ • TOML parse │ │ • DAG ops    │  │ │
│  │  [Node.js FFI]      │    │  │ • Variable   │ │ • Topo sort  │  │ │
│  │                     │    │  │   cooking    │ │ • Cycle      │  │ │
│  └─────────────────────┘    │  │ • Molecule   │ │   detection  │  │ │
│                             │  │   generation │ │ • Critical   │  │ │
│                             │  └──────────────┘ │   path       │  │ │
│                             │                   └──────────────┘  │ │
│                             │                                      │ │
│                             │  ┌──────────────┐ ┌──────────────┐  │ │
│                             │  │ micro-hnsw-  │ │ ruvector-    │  │ │
│                             │  │ wasm         │ │ learning-wasm│  │ │
│                             │  │              │ │              │  │ │
│                             │  │ • Pattern    │ │ • SONA       │  │ │
│                             │  │   search     │ │   patterns   │  │ │
│                             │  │ • 1000x+     │ │ • MoE routing│  │ │
│                             │  │   speedup    │ │ • EWC++      │  │ │
│                             │  └──────────────┘ └──────────────┘  │ │
│                             │                                      │ │
│                             │  [wasm-bindgen interface]            │ │
│                             └─────────────────────────────────────┘ │
│                                                                      │
└─────────────────────────────────────────────────────────────────────┘

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT License - see LICENSE for details.


Built with ❤️ by the Claude Flow Team


Built by rUv · ruv.io · Source

版本与发布记录

@claude-flow/plugin-gastown-bridge 共发布 7 个版本,首次发布于 2026/01/24;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.1.6latest2026/11/09今天
0.1.52026/11/063 天前
0.1.42026/05/125 个月前
0.1.32026/02/148 个月前
0.1.22026/02/029 个月前
0.1.12026/01/249 个月前

关于 @claude-flow/plugin-gastown-bridge 的常见问题

@claude-flow/plugin-gastown-bridge 是什么?

Gas Town orchestrator integration for Claude Flow V3 with WASM-accelerated formula parsing and graph analysis

如何安装 @claude-flow/plugin-gastown-bridge?

在项目目录运行 npm install @claude-flow/plugin-gastown-bridge,或使用 pnpm add / yarn add / bun add。

@claude-flow/plugin-gastown-bridge 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@claude-flow/plugin-gastown-bridge 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@claude-flow/plugin-gastown-bridge 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@claude-flow/plugin-gastown-bridge 可以商用吗?

@claude-flow/plugin-gastown-bridge 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@claude-flow/plugin-gastown-bridge 的下载量有多少?

根据 npm 官方下载统计,@claude-flow/plugin-gastown-bridge 在 2026/10/10 – 2026/11/08 这 30 天内被下载 103,502 次,日均约 3,450 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@claude-flow/plugin-gastown-bridge 还在维护吗?

最新版本 0.1.6 发布于 2026/11/09(今天);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/01/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。