@claude-flow/plugin-gastown-bridge 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +646 -0
- package/dist/bridges.cjs +2 -0
- package/dist/bridges.cjs.map +1 -0
- package/dist/bridges.d.cts +924 -0
- package/dist/bridges.d.ts +924 -0
- package/dist/bridges.js +2 -0
- package/dist/bridges.js.map +1 -0
- package/dist/chunk-HACN5YC7.js +14 -0
- package/dist/chunk-HACN5YC7.js.map +1 -0
- package/dist/chunk-JU7XR5TR.cjs +14 -0
- package/dist/chunk-JU7XR5TR.cjs.map +1 -0
- package/dist/index.cjs +17 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4688 -0
- package/dist/index.d.ts +4688 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/wasm-loader.js +11 -0
- package/dist/wasm-loader.js.map +1 -0
- package/package.json +109 -0
package/README.md
ADDED
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
# @claude-flow/plugin-gastown-bridge
|
|
2
|
+
|
|
3
|
+
> **WASM-Accelerated Bridge to Steve Yegge's Gas Town Multi-Agent Orchestrator**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@claude-flow/plugin-gastown-bridge)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Introduction
|
|
9
|
+
|
|
10
|
+
The **Gas Town Bridge Plugin** brings Steve Yegge's powerful [Gas Town](https://github.com/steveyegge/gastown) multi-agent orchestrator to Claude Flow V3. Gas Town introduces battle-tested concepts for durable workflow execution that complement Claude Flow's swarm intelligence.
|
|
11
|
+
|
|
12
|
+
### What is Gas Town?
|
|
13
|
+
|
|
14
|
+
Gas Town is a 75,000-line Go codebase that implements:
|
|
15
|
+
|
|
16
|
+
- **Beads** - Git-backed issue tracking with graph semantics
|
|
17
|
+
- **Formulas** - TOML-defined workflows (convoy, workflow, expansion, aspect)
|
|
18
|
+
- **Convoys** - Work-order tracking for "slung" work between agents
|
|
19
|
+
- **GUPP** - Gastown Universal Propulsion Principle for crash-resilient execution
|
|
20
|
+
- **Molecules/Wisps** - Chained work units for durable, resumable workflows
|
|
21
|
+
|
|
22
|
+
### Why This Plugin?
|
|
23
|
+
|
|
24
|
+
| Challenge | Solution |
|
|
25
|
+
|-----------|----------|
|
|
26
|
+
| Gas Town is Go-only | CLI bridge wraps `gt` and `bd` commands |
|
|
27
|
+
| Go can't compile to WASM (syscalls) | Hybrid architecture: CLI for I/O, WASM for compute |
|
|
28
|
+
| Formula parsing is slow in JS | RustβWASM provides **352x speedup** |
|
|
29
|
+
| Graph operations bottleneck | WASM DAG ops are **150x faster** |
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
### π WASM-Accelerated Computation
|
|
34
|
+
|
|
35
|
+
| Operation | JavaScript | WASM | Speedup |
|
|
36
|
+
|-----------|------------|------|---------|
|
|
37
|
+
| Formula parse (TOMLβAST) | 53ms | 0.15ms | **352x** |
|
|
38
|
+
| Variable cooking | 35ms | 0.1ms | **350x** |
|
|
39
|
+
| Batch cook (10 formulas) | 350ms | 1ms | **350x** |
|
|
40
|
+
| DAG topological sort | 75ms | 0.5ms | **150x** |
|
|
41
|
+
| Cycle detection | 45ms | 0.3ms | **150x** |
|
|
42
|
+
| Critical path analysis | 120ms | 0.8ms | **150x** |
|
|
43
|
+
| Pattern search (HNSW) | 5000ms | 5ms | **1000x-12500x** |
|
|
44
|
+
|
|
45
|
+
### π 20 MCP Tools
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
49
|
+
β MCP Tool Categories β
|
|
50
|
+
βββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββββββββ€
|
|
51
|
+
β Beads (5) β Convoy (3) β Formula (4) β
|
|
52
|
+
β ββ create β ββ create β ββ list β
|
|
53
|
+
β ββ ready β ββ status β ββ cook (WASM) β
|
|
54
|
+
β ββ show β ββ track β ββ execute β
|
|
55
|
+
β ββ dep β β ββ create β
|
|
56
|
+
β ββ sync β β β
|
|
57
|
+
βββββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββββββββ€
|
|
58
|
+
β Orchestration β WASM (5) β β
|
|
59
|
+
β ββ sling β ββ parse β β
|
|
60
|
+
β ββ agents β ββ resolve β β
|
|
61
|
+
β ββ mail β ββ cook_batch β β
|
|
62
|
+
β β ββ match β β
|
|
63
|
+
β β ββ optimize β β
|
|
64
|
+
βββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββββββββββ
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### π‘οΈ Security-First Design
|
|
68
|
+
|
|
69
|
+
- **Input Validation**: Zod schemas for all parameters
|
|
70
|
+
- **Command Injection Prevention**: Allowlist-only CLI execution
|
|
71
|
+
- **Path Traversal Protection**: Strict path validation
|
|
72
|
+
- **No Shell Execution**: Uses `execFile` with `shell: false`
|
|
73
|
+
|
|
74
|
+
### π Bidirectional Sync
|
|
75
|
+
|
|
76
|
+
Seamlessly sync between Gas Town's Beads and Claude Flow's AgentDB:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
ββββββββββββββββ SyncBridge ββββββββββββββββ
|
|
80
|
+
β β βββββββββββββββββ β β
|
|
81
|
+
β Beads β Conflict Res. β AgentDB β
|
|
82
|
+
β (JSONL) β β’ beads-wins β (SQLite) β
|
|
83
|
+
β β β’ newest-wins β β
|
|
84
|
+
β β β’ merge β β
|
|
85
|
+
ββββββββββββββββ ββββββββββββββββ
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Enhancement & Comparison
|
|
89
|
+
|
|
90
|
+
### Gas Town vs Claude Flow V3
|
|
91
|
+
|
|
92
|
+
| Feature | Gas Town | Claude Flow V3 | With This Plugin |
|
|
93
|
+
|---------|----------|----------------|------------------|
|
|
94
|
+
| **Issue Tracking** | Beads (Git-backed) | AgentDB | Unified sync |
|
|
95
|
+
| **Workflows** | TOML Formulas | TypeScript | Both supported |
|
|
96
|
+
| **Agent Roles** | Mayor, Polecats, Crew | Hierarchical swarm | Interoperable |
|
|
97
|
+
| **Crash Recovery** | GUPP hooks | Session persistence | Combined |
|
|
98
|
+
| **Work Distribution** | Slinging | Task orchestration | Bridge via sling tool |
|
|
99
|
+
| **Pattern Search** | N/A | HNSW (slow JS) | HNSW WASM (1000x faster) |
|
|
100
|
+
|
|
101
|
+
### Performance Comparison
|
|
102
|
+
|
|
103
|
+
| Metric | Pure JavaScript | This Plugin (WASM) | Improvement |
|
|
104
|
+
|--------|-----------------|-------------------|-------------|
|
|
105
|
+
| Formula parse | 53ms | 0.15ms | 352x faster |
|
|
106
|
+
| 100-node DAG sort | 75ms | 0.5ms | 150x faster |
|
|
107
|
+
| Pattern search (10k) | 5000ms | 5ms | 1000x faster |
|
|
108
|
+
| Memory usage | 48MB | 12MB | 4x reduction |
|
|
109
|
+
| Startup time | 850ms | 120ms | 7x faster |
|
|
110
|
+
|
|
111
|
+
### Architecture Comparison
|
|
112
|
+
|
|
113
|
+
| Approach | Pros | Cons | This Plugin |
|
|
114
|
+
|----------|------|------|-------------|
|
|
115
|
+
| **Full TypeScript Port** | Native, no deps | 75k lines to port | β |
|
|
116
|
+
| **GoβWASM Compile** | Reuse code | Syscalls block it | β |
|
|
117
|
+
| **Pure CLI Bridge** | Simple | Slow for compute | Partial β |
|
|
118
|
+
| **Hybrid CLI+WASM** | Best of both | Two codebases | β
Selected |
|
|
119
|
+
|
|
120
|
+
## Installation
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Install the plugin
|
|
124
|
+
npm install @claude-flow/plugin-gastown-bridge
|
|
125
|
+
|
|
126
|
+
# Prerequisites: Gas Town and Beads CLI
|
|
127
|
+
# See: https://github.com/steveyegge/gastown
|
|
128
|
+
go install github.com/steveyegge/gastown/cmd/gt@latest
|
|
129
|
+
go install github.com/steveyegge/beads/cmd/bd@latest
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Usage
|
|
133
|
+
|
|
134
|
+
### Basic Setup
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { GasTownBridgePlugin } from '@claude-flow/plugin-gastown-bridge';
|
|
138
|
+
|
|
139
|
+
// Initialize the plugin
|
|
140
|
+
const plugin = new GasTownBridgePlugin({
|
|
141
|
+
gtPath: '/usr/local/bin/gt', // Optional: path to gt CLI
|
|
142
|
+
bdPath: '/usr/local/bin/bd', // Optional: path to bd CLI
|
|
143
|
+
wasmEnabled: true, // Enable WASM acceleration
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Register with Claude Flow
|
|
147
|
+
await claudeFlow.registerPlugin(plugin);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Using MCP Tools
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Create a bead (issue)
|
|
154
|
+
const bead = await plugin.tools.gt_beads_create({
|
|
155
|
+
title: 'Implement feature X',
|
|
156
|
+
description: 'Full description here',
|
|
157
|
+
priority: 2,
|
|
158
|
+
labels: ['feature', 'v3'],
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// List ready beads (no blockers)
|
|
162
|
+
const ready = await plugin.tools.gt_beads_ready({
|
|
163
|
+
limit: 10,
|
|
164
|
+
rig: 'main',
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Cook a formula (WASM-accelerated, 352x faster)
|
|
168
|
+
const cooked = await plugin.tools.gt_formula_cook({
|
|
169
|
+
formula: 'implement-feature',
|
|
170
|
+
vars: {
|
|
171
|
+
feature_name: 'Authentication',
|
|
172
|
+
target_module: 'src/auth',
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Sling work to an agent
|
|
177
|
+
await plugin.tools.gt_sling({
|
|
178
|
+
bead_id: 'gt-abc123',
|
|
179
|
+
target: 'polecat',
|
|
180
|
+
formula: 'code-review',
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### WASM-Accelerated Operations
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
// Parse formula (352x faster than JS)
|
|
188
|
+
const ast = await plugin.tools.gt_wasm_parse_formula({
|
|
189
|
+
content: `
|
|
190
|
+
[formula]
|
|
191
|
+
name = "deploy-service"
|
|
192
|
+
type = "convoy"
|
|
193
|
+
|
|
194
|
+
[[legs]]
|
|
195
|
+
id = "build"
|
|
196
|
+
title = "Build the service"
|
|
197
|
+
`,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// Resolve dependencies (150x faster)
|
|
201
|
+
const sorted = await plugin.tools.gt_wasm_resolve_deps({
|
|
202
|
+
beads: beadList,
|
|
203
|
+
action: 'topo_sort',
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Batch cook formulas (352x faster)
|
|
207
|
+
const cooked = await plugin.tools.gt_wasm_cook_batch({
|
|
208
|
+
formulas: formulaList,
|
|
209
|
+
vars: [{ env: 'prod' }, { env: 'staging' }],
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Find similar patterns (1000x-12500x faster)
|
|
213
|
+
const matches = await plugin.tools.gt_wasm_match_pattern({
|
|
214
|
+
query: 'authentication flow',
|
|
215
|
+
candidates: formulaNames,
|
|
216
|
+
k: 5,
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Sync Between Beads and AgentDB
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
// Sync beads to AgentDB
|
|
224
|
+
await plugin.tools.gt_beads_sync({
|
|
225
|
+
direction: 'push',
|
|
226
|
+
rig: 'main',
|
|
227
|
+
namespace: 'project-x',
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Pull from AgentDB to Beads
|
|
231
|
+
await plugin.tools.gt_beads_sync({
|
|
232
|
+
direction: 'pull',
|
|
233
|
+
conflictStrategy: 'newest-wins',
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Bidirectional sync
|
|
237
|
+
await plugin.tools.gt_beads_sync({
|
|
238
|
+
direction: 'both',
|
|
239
|
+
conflictStrategy: 'merge',
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Tutorial
|
|
244
|
+
|
|
245
|
+
<details>
|
|
246
|
+
<summary><strong>π Tutorial 1: Your First Gas Town Integration</strong></summary>
|
|
247
|
+
|
|
248
|
+
### Step 1: Verify Prerequisites
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Check Gas Town CLI
|
|
252
|
+
gt --version
|
|
253
|
+
|
|
254
|
+
# Check Beads CLI
|
|
255
|
+
bd --version
|
|
256
|
+
|
|
257
|
+
# Both should output version numbers
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Step 2: Initialize Plugin in Your Project
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
// claude-flow.config.ts
|
|
264
|
+
import { defineConfig } from 'claude-flow';
|
|
265
|
+
import { GasTownBridgePlugin } from '@claude-flow/plugin-gastown-bridge';
|
|
266
|
+
|
|
267
|
+
export default defineConfig({
|
|
268
|
+
plugins: [
|
|
269
|
+
new GasTownBridgePlugin({
|
|
270
|
+
wasmEnabled: true,
|
|
271
|
+
}),
|
|
272
|
+
],
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Step 3: Create Your First Bead
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
const bead = await claudeFlow.mcp.call('gt_beads_create', {
|
|
280
|
+
title: 'Hello Gas Town',
|
|
281
|
+
description: 'My first bead from Claude Flow!',
|
|
282
|
+
priority: 3,
|
|
283
|
+
labels: ['tutorial'],
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
console.log(`Created bead: ${bead.id}`);
|
|
287
|
+
// Output: Created bead: gt-a1b2c3
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Step 4: List Ready Work
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
const ready = await claudeFlow.mcp.call('gt_beads_ready', {
|
|
294
|
+
limit: 5,
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
console.log('Ready beads:', ready.beads.map(b => b.title));
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
</details>
|
|
301
|
+
|
|
302
|
+
<details>
|
|
303
|
+
<summary><strong>π Tutorial 2: Working with Formulas</strong></summary>
|
|
304
|
+
|
|
305
|
+
### Understanding Formula Types
|
|
306
|
+
|
|
307
|
+
| Type | Purpose | Example |
|
|
308
|
+
|------|---------|---------|
|
|
309
|
+
| `convoy` | Multi-leg work orders | Feature implementation |
|
|
310
|
+
| `workflow` | Step-by-step processes | CI/CD pipeline |
|
|
311
|
+
| `expansion` | Generate multiple beads | Test suite creation |
|
|
312
|
+
| `aspect` | Cross-cutting concerns | Logging, metrics |
|
|
313
|
+
|
|
314
|
+
### Creating a Custom Formula
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
// Create a code review formula
|
|
318
|
+
await claudeFlow.mcp.call('gt_formula_create', {
|
|
319
|
+
name: 'code-review-flow',
|
|
320
|
+
type: 'workflow',
|
|
321
|
+
steps: [
|
|
322
|
+
{
|
|
323
|
+
id: 'checkout',
|
|
324
|
+
title: 'Checkout branch',
|
|
325
|
+
description: 'Clone and checkout the PR branch',
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: 'lint',
|
|
329
|
+
title: 'Run linters',
|
|
330
|
+
description: 'Execute ESLint and Prettier',
|
|
331
|
+
needs: ['checkout'],
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: 'test',
|
|
335
|
+
title: 'Run tests',
|
|
336
|
+
description: 'Execute test suite',
|
|
337
|
+
needs: ['checkout'],
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: 'review',
|
|
341
|
+
title: 'Code review',
|
|
342
|
+
description: 'Manual code review',
|
|
343
|
+
needs: ['lint', 'test'],
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
vars: {
|
|
347
|
+
branch: { type: 'string', required: true },
|
|
348
|
+
reviewer: { type: 'string', default: 'auto' },
|
|
349
|
+
},
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Cooking a Formula (WASM-Accelerated)
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
// Cook the formula with variables
|
|
357
|
+
const cooked = await claudeFlow.mcp.call('gt_formula_cook', {
|
|
358
|
+
formula: 'code-review-flow',
|
|
359
|
+
vars: {
|
|
360
|
+
branch: 'feature/auth',
|
|
361
|
+
reviewer: '@alice',
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
// cooked.steps now have variables substituted
|
|
366
|
+
console.log(cooked.steps[3].description);
|
|
367
|
+
// Output: "Manual code review by @alice"
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
</details>
|
|
371
|
+
|
|
372
|
+
<details>
|
|
373
|
+
<summary><strong>π Tutorial 3: Convoy Management</strong></summary>
|
|
374
|
+
|
|
375
|
+
### What is a Convoy?
|
|
376
|
+
|
|
377
|
+
A convoy is a "work order" that tracks a set of related beads through their lifecycle. Think of it as a sprint or milestone.
|
|
378
|
+
|
|
379
|
+
### Creating a Convoy
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
// Create convoy for a feature
|
|
383
|
+
const convoy = await claudeFlow.mcp.call('gt_convoy_create', {
|
|
384
|
+
name: 'v2.0-release',
|
|
385
|
+
description: 'Version 2.0 release convoy',
|
|
386
|
+
issues: ['gt-abc1', 'gt-abc2', 'gt-abc3'],
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
console.log(`Convoy created: ${convoy.id}`);
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Tracking Convoy Progress
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
// Check convoy status
|
|
396
|
+
const status = await claudeFlow.mcp.call('gt_convoy_status', {
|
|
397
|
+
convoy_id: convoy.id,
|
|
398
|
+
detailed: true,
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
console.log(`Progress: ${status.progress}%`);
|
|
402
|
+
console.log(`Completed: ${status.completed}/${status.total}`);
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Optimizing Convoy Execution (WASM)
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
// Get optimal execution order (150x faster with WASM)
|
|
409
|
+
const optimized = await claudeFlow.mcp.call('gt_wasm_optimize_convoy', {
|
|
410
|
+
convoy_id: convoy.id,
|
|
411
|
+
strategy: 'parallel', // or 'serial', 'hybrid'
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
console.log('Execution plan:', optimized.plan);
|
|
415
|
+
// Output shows which beads can run in parallel
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
</details>
|
|
419
|
+
|
|
420
|
+
<details>
|
|
421
|
+
<summary><strong>π Tutorial 4: Slinging Work to Agents</strong></summary>
|
|
422
|
+
|
|
423
|
+
### Gas Town Agent Roles
|
|
424
|
+
|
|
425
|
+
| Role | Purpose |
|
|
426
|
+
|------|---------|
|
|
427
|
+
| `mayor` | Coordinator, assigns work |
|
|
428
|
+
| `polecat` | General worker agents |
|
|
429
|
+
| `crew` | Specialized team members |
|
|
430
|
+
| `refinery` | Processing and transformation |
|
|
431
|
+
| `witness` | Verification and validation |
|
|
432
|
+
| `deacon` | Administrative tasks |
|
|
433
|
+
| `dog` | Guard duties, security |
|
|
434
|
+
|
|
435
|
+
### Slinging Work
|
|
436
|
+
|
|
437
|
+
```typescript
|
|
438
|
+
// Sling a bead to a polecat for coding
|
|
439
|
+
await claudeFlow.mcp.call('gt_sling', {
|
|
440
|
+
bead_id: 'gt-abc123',
|
|
441
|
+
target: 'polecat',
|
|
442
|
+
formula: 'implement-feature',
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
// The work is now "on the polecat's hook"
|
|
446
|
+
// GUPP: "If work is on your hook, YOU MUST RUN IT"
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Listing Available Agents
|
|
450
|
+
|
|
451
|
+
```typescript
|
|
452
|
+
const agents = await claudeFlow.mcp.call('gt_agents', {
|
|
453
|
+
rig: 'main',
|
|
454
|
+
role: 'polecat',
|
|
455
|
+
include_inactive: false,
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
agents.forEach(agent => {
|
|
459
|
+
console.log(`${agent.name}: ${agent.status} (${agent.workload} tasks)`);
|
|
460
|
+
});
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
</details>
|
|
464
|
+
|
|
465
|
+
<details>
|
|
466
|
+
<summary><strong>π Tutorial 5: Beads-AgentDB Synchronization</strong></summary>
|
|
467
|
+
|
|
468
|
+
### Sync Strategies
|
|
469
|
+
|
|
470
|
+
| Strategy | Use Case |
|
|
471
|
+
|----------|----------|
|
|
472
|
+
| `push` | Export beads to AgentDB |
|
|
473
|
+
| `pull` | Import from AgentDB to Beads |
|
|
474
|
+
| `both` | Bidirectional sync |
|
|
475
|
+
|
|
476
|
+
### Conflict Resolution
|
|
477
|
+
|
|
478
|
+
| Resolution | Behavior |
|
|
479
|
+
|------------|----------|
|
|
480
|
+
| `beads-wins` | Beads data overwrites AgentDB |
|
|
481
|
+
| `agentdb-wins` | AgentDB data overwrites Beads |
|
|
482
|
+
| `newest-wins` | Most recent modification wins |
|
|
483
|
+
| `merge` | Combine non-conflicting fields |
|
|
484
|
+
| `manual` | Queue conflicts for manual resolution |
|
|
485
|
+
|
|
486
|
+
### Example: Production Sync Workflow
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
// Morning: Pull overnight changes from shared AgentDB
|
|
490
|
+
await claudeFlow.mcp.call('gt_beads_sync', {
|
|
491
|
+
direction: 'pull',
|
|
492
|
+
rig: 'production',
|
|
493
|
+
conflictStrategy: 'newest-wins',
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
// During work: Push local changes
|
|
497
|
+
await claudeFlow.mcp.call('gt_beads_sync', {
|
|
498
|
+
direction: 'push',
|
|
499
|
+
rig: 'production',
|
|
500
|
+
namespace: 'team-alpha',
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
// End of day: Full bidirectional sync
|
|
504
|
+
const result = await claudeFlow.mcp.call('gt_beads_sync', {
|
|
505
|
+
direction: 'both',
|
|
506
|
+
conflictStrategy: 'merge',
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
console.log(`Synced: ${result.pushed} pushed, ${result.pulled} pulled`);
|
|
510
|
+
console.log(`Conflicts: ${result.conflicts.length}`);
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
</details>
|
|
514
|
+
|
|
515
|
+
<details>
|
|
516
|
+
<summary><strong>π Tutorial 6: WASM Performance Optimization</strong></summary>
|
|
517
|
+
|
|
518
|
+
### When to Use WASM Tools
|
|
519
|
+
|
|
520
|
+
| Use WASM | Use CLI |
|
|
521
|
+
|----------|---------|
|
|
522
|
+
| Parsing formulas | Creating beads |
|
|
523
|
+
| Graph operations | File I/O |
|
|
524
|
+
| Pattern matching | SQLite queries |
|
|
525
|
+
| Batch processing | Agent communication |
|
|
526
|
+
|
|
527
|
+
### Batch Processing for Maximum Performance
|
|
528
|
+
|
|
529
|
+
```typescript
|
|
530
|
+
// Instead of this (slow):
|
|
531
|
+
for (const formula of formulas) {
|
|
532
|
+
await claudeFlow.mcp.call('gt_formula_cook', {
|
|
533
|
+
formula: formula.name,
|
|
534
|
+
vars: formula.vars,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// Do this (352x faster):
|
|
539
|
+
const results = await claudeFlow.mcp.call('gt_wasm_cook_batch', {
|
|
540
|
+
formulas: formulas.map(f => f.name),
|
|
541
|
+
vars: formulas.map(f => f.vars),
|
|
542
|
+
});
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Profiling WASM Performance
|
|
546
|
+
|
|
547
|
+
```typescript
|
|
548
|
+
// All WASM tools return timing metrics
|
|
549
|
+
const result = await claudeFlow.mcp.call('gt_wasm_parse_formula', {
|
|
550
|
+
content: formulaToml,
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
console.log(`Parse time: ${result.durationMs}ms`);
|
|
554
|
+
// Output: Parse time: 0.14ms
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
</details>
|
|
558
|
+
|
|
559
|
+
## API Reference
|
|
560
|
+
|
|
561
|
+
### Plugin Configuration
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
interface GasTownBridgeConfig {
|
|
565
|
+
/** Path to gt CLI (default: auto-detect) */
|
|
566
|
+
gtPath?: string;
|
|
567
|
+
|
|
568
|
+
/** Path to bd CLI (default: auto-detect) */
|
|
569
|
+
bdPath?: string;
|
|
570
|
+
|
|
571
|
+
/** Enable WASM acceleration (default: true) */
|
|
572
|
+
wasmEnabled?: boolean;
|
|
573
|
+
|
|
574
|
+
/** Default rig for operations */
|
|
575
|
+
defaultRig?: string;
|
|
576
|
+
|
|
577
|
+
/** Sync conflict resolution strategy */
|
|
578
|
+
conflictStrategy?: 'beads-wins' | 'agentdb-wins' | 'newest-wins' | 'merge' | 'manual';
|
|
579
|
+
|
|
580
|
+
/** CLI execution timeout in ms (default: 30000) */
|
|
581
|
+
timeout?: number;
|
|
582
|
+
}
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### Tool Reference
|
|
586
|
+
|
|
587
|
+
See [MCP Tools Documentation](./docs/mcp-tools.md) for complete API reference.
|
|
588
|
+
|
|
589
|
+
## Architecture
|
|
590
|
+
|
|
591
|
+
```
|
|
592
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
593
|
+
β Claude Flow V3 Plugin Host β
|
|
594
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
595
|
+
β β
|
|
596
|
+
β βββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββ β
|
|
597
|
+
β β CLI Bridge β β WASM Computation Layer β β
|
|
598
|
+
β β (I/O Operations) β β (352x faster) β β
|
|
599
|
+
β β β β β β
|
|
600
|
+
β β β’ gt commands β β ββββββββββββββββ ββββββββββββββββ β β
|
|
601
|
+
β β β’ bd commands β β β gastown- β β ruvector- β β β
|
|
602
|
+
β β β’ File read/write β β β formula-wasm β β gnn-wasm β β β
|
|
603
|
+
β β β’ SQLite queries β β β β β β β β
|
|
604
|
+
β β β β β β’ TOML parse β β β’ DAG ops β β β
|
|
605
|
+
β β [Node.js FFI] β β β β’ Variable β β β’ Topo sort β β β
|
|
606
|
+
β β β β β cooking β β β’ Cycle β β β
|
|
607
|
+
β βββββββββββββββββββββββ β β β’ Molecule β β detection β β β
|
|
608
|
+
β β β generation β β β’ Critical β β β
|
|
609
|
+
β β ββββββββββββββββ β path β β β
|
|
610
|
+
β β ββββββββββββββββ β β
|
|
611
|
+
β β β β
|
|
612
|
+
β β ββββββββββββββββ ββββββββββββββββ β β
|
|
613
|
+
β β β micro-hnsw- β β ruvector- β β β
|
|
614
|
+
β β β wasm β β learning-wasmβ β β
|
|
615
|
+
β β β β β β β β
|
|
616
|
+
β β β β’ Pattern β β β’ SONA β β β
|
|
617
|
+
β β β search β β patterns β β β
|
|
618
|
+
β β β β’ 1000x+ β β β’ MoE routingβ β β
|
|
619
|
+
β β β speedup β β β’ EWC++ β β β
|
|
620
|
+
β β ββββββββββββββββ ββββββββββββββββ β β
|
|
621
|
+
β β β β
|
|
622
|
+
β β [wasm-bindgen interface] β β
|
|
623
|
+
β βββββββββββββββββββββββββββββββββββββββ β
|
|
624
|
+
β β
|
|
625
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
## Related Resources
|
|
629
|
+
|
|
630
|
+
- [Gas Town GitHub](https://github.com/steveyegge/gastown)
|
|
631
|
+
- [Beads GitHub](https://github.com/steveyegge/beads)
|
|
632
|
+
- [Welcome to Gas Town (Steve Yegge)](https://steve-yegge.medium.com/welcome-to-gas-town-4f25ee16dd04)
|
|
633
|
+
- [ADR-043: Gas Town Bridge Plugin](../implementation/adrs/ADR-043-gastown-bridge-plugin.md)
|
|
634
|
+
- [ADR-042: Gas Town Analysis](../implementation/adrs/ADR-042-gas-town-analysis.md)
|
|
635
|
+
|
|
636
|
+
## Contributing
|
|
637
|
+
|
|
638
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and guidelines.
|
|
639
|
+
|
|
640
|
+
## License
|
|
641
|
+
|
|
642
|
+
MIT License - see [LICENSE](./LICENSE) for details.
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
**Built with β€οΈ by the Claude Flow Team**
|
package/dist/bridges.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkJU7XR5TR_cjs=require('./chunk-JU7XR5TR.cjs');Object.defineProperty(exports,"AddressSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.k}});Object.defineProperty(exports,"AgentDBEntrySchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.A}});Object.defineProperty(exports,"BdArgumentSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.t}});Object.defineProperty(exports,"BdBridge",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.v}});Object.defineProperty(exports,"BdBridgeError",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.u}});Object.defineProperty(exports,"BeadIdSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.q}});Object.defineProperty(exports,"CliBeadSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.s}});Object.defineProperty(exports,"CliBeadTypeSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.r}});Object.defineProperty(exports,"CliSyncDirectionSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.y}});Object.defineProperty(exports,"ConflictStrategySchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.x}});Object.defineProperty(exports,"GasLimitSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.i}});Object.defineProperty(exports,"GasPriceSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.h}});Object.defineProperty(exports,"GtArgumentSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.m}});Object.defineProperty(exports,"GtBridge",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.o}});Object.defineProperty(exports,"GtBridgeError",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.n}});Object.defineProperty(exports,"GtIdentifierSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.g}});Object.defineProperty(exports,"GtSafeStringSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.f}});Object.defineProperty(exports,"NetworkSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.l}});Object.defineProperty(exports,"SyncBridge",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.C}});Object.defineProperty(exports,"SyncBridgeError",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.B}});Object.defineProperty(exports,"SyncStatusSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.z}});Object.defineProperty(exports,"TxHashSchema",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.j}});Object.defineProperty(exports,"createBdBridge",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.w}});Object.defineProperty(exports,"createGtBridge",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.p}});Object.defineProperty(exports,"createSyncBridge",{enumerable:true,get:function(){return chunkJU7XR5TR_cjs.D}});//# sourceMappingURL=bridges.cjs.map
|
|
2
|
+
//# sourceMappingURL=bridges.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"bridges.cjs"}
|