tachibot-mcp 2.0.2
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/.env.example +260 -0
- package/CHANGELOG.md +54 -0
- package/CODE_OF_CONDUCT.md +56 -0
- package/CONTRIBUTING.md +54 -0
- package/Dockerfile +36 -0
- package/LICENSE +644 -0
- package/README.md +201 -0
- package/SECURITY.md +95 -0
- package/dist/personality/komaai-expressions.js +12 -0
- package/dist/profiles/balanced.json +33 -0
- package/dist/profiles/code_focus.json +33 -0
- package/dist/profiles/full.json +33 -0
- package/dist/profiles/minimal.json +33 -0
- package/dist/profiles/research_power.json +33 -0
- package/dist/scripts/build-profiles.js +46 -0
- package/dist/src/application/services/focus/FocusModeRegistry.js +46 -0
- package/dist/src/application/services/focus/FocusTool.service.js +109 -0
- package/dist/src/application/services/focus/ModeRegistry.js +46 -0
- package/dist/src/application/services/focus/modes/focus-deep.mode.js +27 -0
- package/dist/src/application/services/focus/modes/status.mode.js +50 -0
- package/dist/src/application/services/focus/modes/tachibot-status.mode.js +50 -0
- package/dist/src/collaborative-orchestrator.js +391 -0
- package/dist/src/config/model-constants.js +188 -0
- package/dist/src/config/model-defaults.js +57 -0
- package/dist/src/config/model-preferences.js +382 -0
- package/dist/src/config/timeout-config.js +130 -0
- package/dist/src/config.js +173 -0
- package/dist/src/domain/interfaces/IFocusMode.js +5 -0
- package/dist/src/domain/interfaces/IProvider.js +6 -0
- package/dist/src/domain/interfaces/ITool.js +5 -0
- package/dist/src/focus-deep.js +245 -0
- package/dist/src/infrastructure/ascii/art/robots.ascii.js +16 -0
- package/dist/src/mcp-client.js +90 -0
- package/dist/src/memory/index.js +17 -0
- package/dist/src/memory/memory-config.js +135 -0
- package/dist/src/memory/memory-interface.js +174 -0
- package/dist/src/memory/memory-manager.js +383 -0
- package/dist/src/memory/providers/devlog-provider.js +385 -0
- package/dist/src/memory/providers/hybrid-provider.js +399 -0
- package/dist/src/memory/providers/local-provider.js +388 -0
- package/dist/src/memory/providers/mem0-provider.js +337 -0
- package/dist/src/modes/architect.js +477 -0
- package/dist/src/modes/auditor.js +362 -0
- package/dist/src/modes/challenger.js +841 -0
- package/dist/src/modes/code-reviewer.js +382 -0
- package/dist/src/modes/commit-guardian.js +424 -0
- package/dist/src/modes/documentation-writer.js +572 -0
- package/dist/src/modes/scout.js +587 -0
- package/dist/src/modes/shared/helpers/challenger-helpers.js +454 -0
- package/dist/src/modes/shared/helpers/index.js +17 -0
- package/dist/src/modes/shared/helpers/scout-helpers.js +270 -0
- package/dist/src/modes/shared/helpers/verifier-helpers.js +332 -0
- package/dist/src/modes/test-architect.js +767 -0
- package/dist/src/modes/verifier.js +378 -0
- package/dist/src/monitoring/performance-monitor.js +435 -0
- package/dist/src/optimization/batch-executor.js +121 -0
- package/dist/src/optimization/context-pruner.js +196 -0
- package/dist/src/optimization/cost-monitor.js +338 -0
- package/dist/src/optimization/index.js +65 -0
- package/dist/src/optimization/model-router.js +264 -0
- package/dist/src/optimization/result-cache.js +114 -0
- package/dist/src/optimization/token-optimizer.js +257 -0
- package/dist/src/optimization/token-tracker.js +118 -0
- package/dist/src/orchestrator-instructions.js +128 -0
- package/dist/src/orchestrator-lite.js +139 -0
- package/dist/src/orchestrator.js +191 -0
- package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionEngine.js +1 -0
- package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionStrategy.js +5 -0
- package/dist/src/orchestrators/collaborative/interfaces/IVisualizationRenderer.js +1 -0
- package/dist/src/orchestrators/collaborative/registries/ModelProviderRegistry.js +95 -0
- package/dist/src/orchestrators/collaborative/registries/ToolAdapterRegistry.js +64 -0
- package/dist/src/orchestrators/collaborative/services/tool-execution/ToolExecutionService.js +502 -0
- package/dist/src/orchestrators/collaborative/services/visualization/VisualizationService.js +206 -0
- package/dist/src/orchestrators/collaborative/types/session-types.js +5 -0
- package/dist/src/profiles/balanced.js +37 -0
- package/dist/src/profiles/code_focus.js +37 -0
- package/dist/src/profiles/debug_intensive.js +59 -0
- package/dist/src/profiles/full.js +37 -0
- package/dist/src/profiles/minimal.js +37 -0
- package/dist/src/profiles/research_code.js +59 -0
- package/dist/src/profiles/research_power.js +37 -0
- package/dist/src/profiles/types.js +5 -0
- package/dist/src/profiles/workflow_builder.js +53 -0
- package/dist/src/prompt-engineer-lite.js +78 -0
- package/dist/src/prompt-engineer.js +399 -0
- package/dist/src/reasoning-chain.js +508 -0
- package/dist/src/sequential-thinking.js +291 -0
- package/dist/src/server-diagnostic.js +74 -0
- package/dist/src/server-raw.js +158 -0
- package/dist/src/server-simple.js +58 -0
- package/dist/src/server.js +514 -0
- package/dist/src/session/session-logger.js +617 -0
- package/dist/src/session/session-manager.js +571 -0
- package/dist/src/session/session-tools.js +400 -0
- package/dist/src/tools/advanced-modes.js +200 -0
- package/dist/src/tools/claude-integration.js +356 -0
- package/dist/src/tools/consolidated/ai-router.js +174 -0
- package/dist/src/tools/consolidated/ai-tool.js +48 -0
- package/dist/src/tools/consolidated/brainstorm-tool.js +87 -0
- package/dist/src/tools/consolidated/environment-detector.js +80 -0
- package/dist/src/tools/consolidated/index.js +50 -0
- package/dist/src/tools/consolidated/search-tool.js +110 -0
- package/dist/src/tools/consolidated/workflow-tool.js +238 -0
- package/dist/src/tools/gemini-tools.js +329 -0
- package/dist/src/tools/grok-enhanced.js +376 -0
- package/dist/src/tools/grok-tools.js +299 -0
- package/dist/src/tools/lmstudio-tools.js +223 -0
- package/dist/src/tools/openai-tools.js +498 -0
- package/dist/src/tools/openrouter-tools.js +317 -0
- package/dist/src/tools/optimized-wrapper.js +204 -0
- package/dist/src/tools/perplexity-tools.js +294 -0
- package/dist/src/tools/pingpong-tool.js +343 -0
- package/dist/src/tools/qwen-wrapper.js +74 -0
- package/dist/src/tools/tool-router.js +444 -0
- package/dist/src/tools/unified-ai-provider.js +260 -0
- package/dist/src/tools/workflow-runner.js +425 -0
- package/dist/src/tools/workflow-validator-tool.js +107 -0
- package/dist/src/types.js +23 -0
- package/dist/src/utils/input-validator.js +130 -0
- package/dist/src/utils/model-router.js +91 -0
- package/dist/src/utils/progress-stream.js +255 -0
- package/dist/src/utils/provider-router.js +88 -0
- package/dist/src/utils/smart-api-client.js +146 -0
- package/dist/src/utils/table-builder.js +218 -0
- package/dist/src/utils/timestamp-formatter.js +134 -0
- package/dist/src/utils/tool-compressor.js +257 -0
- package/dist/src/utils/tool-config.js +201 -0
- package/dist/src/validators/dependency-graph-validator.js +147 -0
- package/dist/src/validators/interpolation-validator.js +222 -0
- package/dist/src/validators/output-usage-validator.js +151 -0
- package/dist/src/validators/syntax-validator.js +102 -0
- package/dist/src/validators/tool-registry-validator.js +123 -0
- package/dist/src/validators/tool-types.js +97 -0
- package/dist/src/validators/types.js +8 -0
- package/dist/src/validators/workflow-validator.js +134 -0
- package/dist/src/visualizer-lite.js +42 -0
- package/dist/src/visualizer.js +179 -0
- package/dist/src/workflows/circuit-breaker.js +199 -0
- package/dist/src/workflows/custom-workflows.js +451 -0
- package/dist/src/workflows/engine/AutoSynthesizer.js +97 -0
- package/dist/src/workflows/engine/StepParameterResolver.js +74 -0
- package/dist/src/workflows/engine/VariableInterpolator.js +123 -0
- package/dist/src/workflows/engine/WorkflowDiscovery.js +125 -0
- package/dist/src/workflows/engine/WorkflowExecutionEngine.js +485 -0
- package/dist/src/workflows/engine/WorkflowExecutor.js +113 -0
- package/dist/src/workflows/engine/WorkflowFileManager.js +244 -0
- package/dist/src/workflows/engine/WorkflowHelpers.js +114 -0
- package/dist/src/workflows/engine/WorkflowOutputFormatter.js +83 -0
- package/dist/src/workflows/engine/events/WorkflowEventBus.js +132 -0
- package/dist/src/workflows/engine/events/interfaces/IEventBus.js +5 -0
- package/dist/src/workflows/engine/handlers/ErrorRecoveryHandler.js +162 -0
- package/dist/src/workflows/engine/handlers/PromptEnhancementHandler.js +115 -0
- package/dist/src/workflows/engine/handlers/SessionPersistenceHandler.js +167 -0
- package/dist/src/workflows/engine/handlers/StepExecutionHandler.js +231 -0
- package/dist/src/workflows/engine/handlers/ToolInvocationHandler.js +46 -0
- package/dist/src/workflows/engine/interfaces/IAutoSynthesizer.js +5 -0
- package/dist/src/workflows/engine/interfaces/IStepParameterResolver.js +5 -0
- package/dist/src/workflows/engine/interfaces/IVariableInterpolator.js +5 -0
- package/dist/src/workflows/engine/interfaces/IWorkflowDiscovery.js +4 -0
- package/dist/src/workflows/engine/interfaces/IWorkflowFileManager.js +5 -0
- package/dist/src/workflows/engine/interfaces/IWorkflowOutputFormatter.js +5 -0
- package/dist/src/workflows/engine/state/WorkflowStateMachine.js +194 -0
- package/dist/src/workflows/engine/state/interfaces/IStateMachine.js +17 -0
- package/dist/src/workflows/fallback-strategies.js +373 -0
- package/dist/src/workflows/message-queue.js +455 -0
- package/dist/src/workflows/model-router.js +189 -0
- package/dist/src/workflows/orchestrator-examples.js +174 -0
- package/dist/src/workflows/orchestrator-integration.js +200 -0
- package/dist/src/workflows/self-healing.js +524 -0
- package/dist/src/workflows/tool-mapper.js +407 -0
- package/dist/src/workflows/tool-orchestrator.js +796 -0
- package/dist/src/workflows/workflow-engine.js +573 -0
- package/dist/src/workflows/workflow-parser.js +283 -0
- package/dist/src/workflows/workflow-types.js +95 -0
- package/dist/src/workflows.js +568 -0
- package/dist/test-workflow-file-output.js +93 -0
- package/docs/API_KEYS.md +570 -0
- package/docs/CLAUDE_CODE_SETUP.md +181 -0
- package/docs/CLAUDE_DESKTOP_MANUAL.md +127 -0
- package/docs/CONFIGURATION.md +745 -0
- package/docs/FOCUS_MODES.md +240 -0
- package/docs/INSTALLATION_BOTH.md +145 -0
- package/docs/TERMS.md +352 -0
- package/docs/TOOLS_REFERENCE.md +1622 -0
- package/docs/TOOL_PARAMETERS.md +496 -0
- package/docs/TOOL_PROFILES.md +236 -0
- package/docs/WORKFLOWS.md +987 -0
- package/docs/WORKFLOW_OUTPUT.md +198 -0
- package/docs/WORKFLOW_PROGRESS_TRACKING.md +305 -0
- package/docs/workflows/design-brainstorm.md +335 -0
- package/package.json +97 -0
- package/profiles/balanced.json +37 -0
- package/profiles/code_focus.json +37 -0
- package/profiles/debug_intensive.json +34 -0
- package/profiles/full.json +37 -0
- package/profiles/minimal.json +37 -0
- package/profiles/research_power.json +37 -0
- package/profiles/workflow_builder.json +37 -0
- package/smithery.yaml +66 -0
- package/start.sh +8 -0
- package/tools.config.json +81 -0
- package/tsconfig.json +18 -0
- package/workflows/accessibility-code-audit.yaml +92 -0
- package/workflows/code-architecture-review.yaml +202 -0
- package/workflows/code-review.yaml +142 -0
- package/workflows/core/iterative-problem-solver.yaml +283 -0
- package/workflows/creative-brainstorm-yaml.yaml +215 -0
- package/workflows/pingpong.yaml +141 -0
- package/workflows/system/README.md +412 -0
- package/workflows/system/challenger.yaml +175 -0
- package/workflows/system/scout.yaml +164 -0
- package/workflows/system/verifier.yaml +133 -0
- package/workflows/ultra-creative-brainstorm.yaml +318 -0
- package/workflows/ux-research-flow.yaml +92 -0
|
@@ -0,0 +1,987 @@
|
|
|
1
|
+
# Workflow System
|
|
2
|
+
|
|
3
|
+
Build complex multi-step AI orchestrations with YAML/JSON. Chain unlimited tools, pass outputs between steps, and create powerful automated reasoning processes.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [What are Workflows?](#what-are-workflows)
|
|
8
|
+
- [Is This Just Agent Chaining?](#is-this-just-agent-chaining)
|
|
9
|
+
- [Complete Workflow Schema](#complete-workflow-schema)
|
|
10
|
+
- [Basic Workflow Structure](#basic-workflow-structure)
|
|
11
|
+
- [Variable Interpolation](#variable-interpolation)
|
|
12
|
+
- [Parallel Execution](#parallel-execution)
|
|
13
|
+
- [Advanced Features](#advanced-features)
|
|
14
|
+
- [Token Limits & Cost Control](#token-limits--cost-control)
|
|
15
|
+
- [Conditional Execution](#conditional-execution)
|
|
16
|
+
- [Global Variables](#global-variables)
|
|
17
|
+
- [Auto-Synthesis (MCP Token Limit Protection)](#auto-synthesis-mcp-token-limit-protection)
|
|
18
|
+
- [Example Workflow Patterns](#example-workflow-patterns)
|
|
19
|
+
- [Real-Time Verification](#real-time-verification)
|
|
20
|
+
- [Workflow Management Tools](#workflow-management-tools)
|
|
21
|
+
- [Best Practices](#best-practices)
|
|
22
|
+
|
|
23
|
+
## What are Workflows?
|
|
24
|
+
|
|
25
|
+
Workflows let you chain multiple AI tools together into automated sequences. Each step can use outputs from previous steps, run in parallel, or branch conditionally. Think of them as recipes for collective intelligence.
|
|
26
|
+
|
|
27
|
+
## Is This Just Agent Chaining?
|
|
28
|
+
|
|
29
|
+
**No, it's MORE sophisticated than simple chaining.** Here's the difference:
|
|
30
|
+
|
|
31
|
+
### Simple Agent Chaining (Basic)
|
|
32
|
+
```
|
|
33
|
+
Step 1 → Step 2 → Step 3 → Step 4
|
|
34
|
+
|
|
35
|
+
One after another, linear flow.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### TachiBot Swarm (Advanced)
|
|
39
|
+
```
|
|
40
|
+
Step 1: [Model A, Model B, Model C, Model D] ← PARALLEL
|
|
41
|
+
↓ ↓ ↓ ↓
|
|
42
|
+
Step 2: Synchronize all outputs
|
|
43
|
+
↓
|
|
44
|
+
Step 3: Deep collaborative reasoning (5 rounds)
|
|
45
|
+
↓
|
|
46
|
+
Step 4: Adversarial debate (3 rounds)
|
|
47
|
+
↓
|
|
48
|
+
Step 5: Final synthesis
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Key Differences
|
|
52
|
+
|
|
53
|
+
- **Parallel execution** - 4 models run simultaneously, not sequentially
|
|
54
|
+
- **Multi-round debates** - Models argue and refine for N rounds
|
|
55
|
+
- **Different modes** - Collaborative vs Debate vs Deep-reasoning
|
|
56
|
+
- **Synchronization** - Combines outputs intelligently, not just concatenation
|
|
57
|
+
- **Adversarial verification** - Models challenge each other's outputs
|
|
58
|
+
|
|
59
|
+
**Simple chaining:** A→B→C→D (sequential, one model per step)
|
|
60
|
+
**TachiBot:** [A,B,C,D in parallel] → Sync → Debate(5 rounds) → Challenge(3 rounds) → Synthesize
|
|
61
|
+
|
|
62
|
+
## Complete Workflow Schema
|
|
63
|
+
|
|
64
|
+
### Workflow Configuration
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
interface WorkflowConfig {
|
|
68
|
+
name: string; // Workflow identifier (required)
|
|
69
|
+
description?: string; // Human-readable description
|
|
70
|
+
version?: string; // Workflow version
|
|
71
|
+
|
|
72
|
+
steps: WorkflowStep[]; // Array of workflow steps (required)
|
|
73
|
+
|
|
74
|
+
// Optional settings
|
|
75
|
+
settings?: {
|
|
76
|
+
optimization?: {
|
|
77
|
+
enabled?: boolean; // Enable optimizations
|
|
78
|
+
cacheResults?: boolean; // Cache identical requests
|
|
79
|
+
compressPrompts?: boolean; // Compress long prompts
|
|
80
|
+
smartRouting?: boolean; // Automatic model selection
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
autoSynthesis?: {
|
|
84
|
+
enabled?: boolean; // Enable auto-synthesis (default: true)
|
|
85
|
+
tokenThreshold?: number; // Trigger at N tokens (default: 20000)
|
|
86
|
+
checkpointInterval?: number; // Checkpoint every N tokens (default: 10000)
|
|
87
|
+
synthesisTool?: string; // Tool for synthesis (default: 'gemini_analyze_text')
|
|
88
|
+
synthesisMaxTokens?: number; // Max tokens for synthesis (default: 6000)
|
|
89
|
+
maxRetries?: number; // Retry synthesis on failure (default: 3)
|
|
90
|
+
logLevel?: 'silent' | 'error' | 'warn' | 'info' | 'debug'; // Logging verbosity (default: 'info')
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Optional global variables
|
|
95
|
+
variables?: Record<string, any>;
|
|
96
|
+
|
|
97
|
+
// Optional output configuration
|
|
98
|
+
output?: {
|
|
99
|
+
format?: "detailed" | "summary";
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Workflow Step Configuration
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
interface WorkflowStep {
|
|
108
|
+
// Basic step configuration
|
|
109
|
+
name?: string; // Step name/identifier
|
|
110
|
+
description?: string; // Step description
|
|
111
|
+
|
|
112
|
+
// Execution modes (choose ONE)
|
|
113
|
+
|
|
114
|
+
// Option 1: Single tool execution
|
|
115
|
+
tool?: string; // Tool name to execute
|
|
116
|
+
params?: Record<string, any>; // Tool parameters (legacy)
|
|
117
|
+
input?: Record<string, any>; // Tool parameters (preferred)
|
|
118
|
+
output?: string | OutputConfig; // Output variable name or config
|
|
119
|
+
|
|
120
|
+
// Option 2: Parallel execution with multiple tools
|
|
121
|
+
parallel?: boolean; // Enable parallel execution
|
|
122
|
+
tools?: ParallelTool[]; // Array of tools to run in parallel
|
|
123
|
+
|
|
124
|
+
// Optional configuration
|
|
125
|
+
maxTokens?: number; // Token limit for this step
|
|
126
|
+
condition?: string; // JavaScript condition to evaluate
|
|
127
|
+
skip?: boolean; // Skip this step if true
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface OutputConfig {
|
|
131
|
+
variable: string; // Variable name to store output
|
|
132
|
+
transform?: string; // Optional transformation function
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface ParallelTool {
|
|
136
|
+
name: string; // Tool name (required)
|
|
137
|
+
input: Record<string, any>; // Tool parameters (required)
|
|
138
|
+
output: {
|
|
139
|
+
variable: string; // Output variable name (required)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Variable Interpolation
|
|
145
|
+
|
|
146
|
+
Use `${variable_name}` in any string parameter to reference previous outputs:
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
steps:
|
|
150
|
+
- tool: perplexity_research
|
|
151
|
+
params:
|
|
152
|
+
topic: "REST API security"
|
|
153
|
+
output: research_findings
|
|
154
|
+
|
|
155
|
+
- tool: grok_reason
|
|
156
|
+
params:
|
|
157
|
+
problem: "Based on ${research_findings}, design secure API"
|
|
158
|
+
output: design
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Basic Workflow Structure
|
|
162
|
+
|
|
163
|
+
Create workflows in YAML or JSON format:
|
|
164
|
+
|
|
165
|
+
### YAML Example
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
name: my-workflow
|
|
169
|
+
description: What this workflow does
|
|
170
|
+
version: "1.0"
|
|
171
|
+
|
|
172
|
+
settings:
|
|
173
|
+
optimization:
|
|
174
|
+
enabled: true
|
|
175
|
+
|
|
176
|
+
steps:
|
|
177
|
+
- tool: tool_name
|
|
178
|
+
input:
|
|
179
|
+
param1: value1
|
|
180
|
+
param2: value2
|
|
181
|
+
output:
|
|
182
|
+
variable: variable_name
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### JSON Example
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"name": "my-workflow",
|
|
190
|
+
"description": "What this workflow does",
|
|
191
|
+
"version": "1.0",
|
|
192
|
+
"settings": {
|
|
193
|
+
"optimization": {
|
|
194
|
+
"enabled": true
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"steps": [
|
|
198
|
+
{
|
|
199
|
+
"tool": "tool_name",
|
|
200
|
+
"input": {
|
|
201
|
+
"param1": "value1"
|
|
202
|
+
},
|
|
203
|
+
"output": {
|
|
204
|
+
"variable": "variable_name"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Parallel Execution
|
|
212
|
+
|
|
213
|
+
TachiBot supports explicit parallel execution. Steps marked with `parallel: true` run simultaneously, dramatically reducing execution time.
|
|
214
|
+
|
|
215
|
+
### Method 1: Group Parallel Steps (Recommended)
|
|
216
|
+
|
|
217
|
+
Use a single step with `parallel: true` and multiple `tools`:
|
|
218
|
+
|
|
219
|
+
```yaml
|
|
220
|
+
steps:
|
|
221
|
+
# All 4 models run at the same time
|
|
222
|
+
- name: diverse-sensing
|
|
223
|
+
description: "Parallel intelligence gathering"
|
|
224
|
+
parallel: true
|
|
225
|
+
tools:
|
|
226
|
+
- name: gemini_brainstorm
|
|
227
|
+
input:
|
|
228
|
+
prompt: "Creative perspective on: ${query}"
|
|
229
|
+
output:
|
|
230
|
+
variable: gemini_insights
|
|
231
|
+
|
|
232
|
+
- name: openai_brainstorm
|
|
233
|
+
input:
|
|
234
|
+
problem: "${query}"
|
|
235
|
+
style: "systematic"
|
|
236
|
+
output:
|
|
237
|
+
variable: openai_analysis
|
|
238
|
+
|
|
239
|
+
- name: perplexity_ask
|
|
240
|
+
input:
|
|
241
|
+
query: "${query}"
|
|
242
|
+
output:
|
|
243
|
+
variable: perplexity_facts
|
|
244
|
+
|
|
245
|
+
- name: grok_search
|
|
246
|
+
input:
|
|
247
|
+
query: "${query}"
|
|
248
|
+
recency: "week"
|
|
249
|
+
output:
|
|
250
|
+
variable: grok_data
|
|
251
|
+
|
|
252
|
+
# This step waits for all parallel steps to complete
|
|
253
|
+
- name: synchronize
|
|
254
|
+
tool: think
|
|
255
|
+
input:
|
|
256
|
+
thought: "Combine: ${gemini_insights}, ${openai_analysis}, ${perplexity_facts}, ${grok_data}"
|
|
257
|
+
output:
|
|
258
|
+
variable: synchronized_result
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Method 2: Individual Parallel Steps
|
|
262
|
+
|
|
263
|
+
Mark individual steps with `parallel: true`. All consecutive parallel steps run together:
|
|
264
|
+
|
|
265
|
+
```yaml
|
|
266
|
+
steps:
|
|
267
|
+
# These 3 steps run in parallel (all have parallel: true)
|
|
268
|
+
- tool: gemini_brainstorm
|
|
269
|
+
params:
|
|
270
|
+
prompt: "Analyze ${query}"
|
|
271
|
+
output: gemini_result
|
|
272
|
+
parallel: true
|
|
273
|
+
|
|
274
|
+
- tool: grok_search
|
|
275
|
+
params:
|
|
276
|
+
query: "${query}"
|
|
277
|
+
output: grok_result
|
|
278
|
+
parallel: true
|
|
279
|
+
|
|
280
|
+
- tool: perplexity_ask
|
|
281
|
+
params:
|
|
282
|
+
query: "${query}"
|
|
283
|
+
output: perplexity_result
|
|
284
|
+
parallel: true
|
|
285
|
+
|
|
286
|
+
# This step waits for all parallel steps above
|
|
287
|
+
- tool: think
|
|
288
|
+
params:
|
|
289
|
+
thought: "Synthesize: ${gemini_result}, ${grok_result}, ${perplexity_result}"
|
|
290
|
+
output: final_result
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### How Parallel Execution Works
|
|
294
|
+
|
|
295
|
+
- **Automatic batching** - The workflow engine batches consecutive `parallel: true` steps
|
|
296
|
+
- **Wait for completion** - The next non-parallel step waits for all parallel steps to finish
|
|
297
|
+
- **Variable access** - Each parallel step outputs to its own variable, accessible in later steps
|
|
298
|
+
- **Error handling** - If one parallel step fails, others continue; errors are collected
|
|
299
|
+
- **Performance gain** - 4 parallel steps take ~1x time instead of 4x sequential time
|
|
300
|
+
|
|
301
|
+
**Performance Example:**
|
|
302
|
+
- **Sequential:** 4 models × 5 seconds each = 20 seconds total
|
|
303
|
+
- **Parallel:** 4 models running simultaneously = ~5 seconds total
|
|
304
|
+
|
|
305
|
+
## Advanced Features
|
|
306
|
+
|
|
307
|
+
### Token Limits & Cost Control
|
|
308
|
+
|
|
309
|
+
**Important:** TachiBot workflows do NOT track or enforce dollar-based cost limits. Cost control is achieved through **token limits only**.
|
|
310
|
+
|
|
311
|
+
Control API costs by limiting token usage per step:
|
|
312
|
+
|
|
313
|
+
```yaml
|
|
314
|
+
settings:
|
|
315
|
+
optimization:
|
|
316
|
+
enabled: true
|
|
317
|
+
cacheResults: true # Reuse results to avoid duplicate API calls
|
|
318
|
+
smartRouting: true # Auto-select cheapest capable model
|
|
319
|
+
|
|
320
|
+
steps:
|
|
321
|
+
- tool: openai_brainstorm
|
|
322
|
+
input:
|
|
323
|
+
problem: "${query}"
|
|
324
|
+
maxTokens: 500 # Limit output to 500 tokens per step
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Why token limits instead of cost limits?**
|
|
328
|
+
- Each API provider charges different rates per model
|
|
329
|
+
- Token limits directly control API call size
|
|
330
|
+
- Model selection (`smartRouting`) automatically picks cheaper models when possible
|
|
331
|
+
- Caching reduces redundant API calls
|
|
332
|
+
|
|
333
|
+
### Conditional Execution
|
|
334
|
+
|
|
335
|
+
Skip steps based on conditions:
|
|
336
|
+
|
|
337
|
+
```yaml
|
|
338
|
+
steps:
|
|
339
|
+
- name: security-check
|
|
340
|
+
tool: gemini_analyze_code
|
|
341
|
+
input:
|
|
342
|
+
code: "${input}"
|
|
343
|
+
focus: security
|
|
344
|
+
output:
|
|
345
|
+
variable: security_issues
|
|
346
|
+
condition: "${input.includes('password')}" # Only run if code contains "password"
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Global Variables
|
|
350
|
+
|
|
351
|
+
Define reusable variables:
|
|
352
|
+
|
|
353
|
+
```yaml
|
|
354
|
+
variables:
|
|
355
|
+
severity_threshold: "medium"
|
|
356
|
+
language: "auto-detect"
|
|
357
|
+
|
|
358
|
+
steps:
|
|
359
|
+
- tool: gemini_analyze_code
|
|
360
|
+
input:
|
|
361
|
+
code: "${input}"
|
|
362
|
+
language: "${language}" # References global variable
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Auto-Synthesis (MCP Token Limit Protection)
|
|
366
|
+
|
|
367
|
+
**Problem:** Workflows with large outputs can exceed the 25,000 token MCP response limit, causing failures.
|
|
368
|
+
|
|
369
|
+
**Solution:** Auto-synthesis automatically generates an executive summary when:
|
|
370
|
+
- Total accumulated tokens exceed threshold (default: 20,000)
|
|
371
|
+
- Any step uses `saveToFile: true` (indicating large outputs)
|
|
372
|
+
- Workflow completes without an existing synthesis step
|
|
373
|
+
|
|
374
|
+
**How it works:**
|
|
375
|
+
1. **Detection**: After each step, checks if synthesis should trigger
|
|
376
|
+
2. **Generation**: Creates synthesis step using `gemini_analyze_text` (2M token context)
|
|
377
|
+
3. **Execution**: Summarizes all previous outputs into <2000 words
|
|
378
|
+
4. **Result**: Returns concise summary to Claude Code, full outputs saved to files
|
|
379
|
+
|
|
380
|
+
**Configuration:**
|
|
381
|
+
|
|
382
|
+
```yaml
|
|
383
|
+
name: my-large-workflow
|
|
384
|
+
settings:
|
|
385
|
+
autoSynthesis:
|
|
386
|
+
enabled: true # Default: true (auto-enabled)
|
|
387
|
+
tokenThreshold: 20000 # Trigger at 20k tokens (default)
|
|
388
|
+
synthesisTool: gemini_analyze_text # Tool for synthesis (default)
|
|
389
|
+
synthesisMaxTokens: 6000 # Max tokens for summary (default)
|
|
390
|
+
maxRetries: 3 # Retry on failure (default)
|
|
391
|
+
logLevel: info # silent|error|warn|info|debug
|
|
392
|
+
checkpointInterval: 10000 # Save checkpoint every 10k tokens
|
|
393
|
+
|
|
394
|
+
steps:
|
|
395
|
+
- name: deep-analysis
|
|
396
|
+
tool: perplexity_research
|
|
397
|
+
saveToFile: true # Triggers auto-synthesis
|
|
398
|
+
input:
|
|
399
|
+
topic: "${query}"
|
|
400
|
+
depth: deep
|
|
401
|
+
output:
|
|
402
|
+
variable: research
|
|
403
|
+
|
|
404
|
+
- name: detailed-reasoning
|
|
405
|
+
tool: grok_reason
|
|
406
|
+
saveToFile: true
|
|
407
|
+
input:
|
|
408
|
+
problem: "${research}"
|
|
409
|
+
output:
|
|
410
|
+
variable: reasoning
|
|
411
|
+
|
|
412
|
+
# Auto-synthesis step automatically added here!
|
|
413
|
+
# - name: auto-synthesis
|
|
414
|
+
# tool: gemini_analyze_text
|
|
415
|
+
# input:
|
|
416
|
+
# text: "${research}\n\n${reasoning}"
|
|
417
|
+
# task: "Synthesize into executive summary..."
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**Output:**
|
|
421
|
+
|
|
422
|
+
```
|
|
423
|
+
✅ STEP 1/2 COMPLETE: deep-analysis
|
|
424
|
+
[Full 50k token output...]
|
|
425
|
+
|
|
426
|
+
✅ STEP 2/2 COMPLETE: detailed-reasoning
|
|
427
|
+
[Full 40k token output...]
|
|
428
|
+
|
|
429
|
+
🤖 Auto-synthesis triggered (90000 tokens accumulated)
|
|
430
|
+
Threshold: 20000 tokens
|
|
431
|
+
Tool: gemini_analyze_text
|
|
432
|
+
|
|
433
|
+
📊 Generating executive summary...
|
|
434
|
+
Steps to synthesize: 2
|
|
435
|
+
Variables available: 2
|
|
436
|
+
|
|
437
|
+
✅ AUTO-SYNTHESIS COMPLETE
|
|
438
|
+
================================================================================
|
|
439
|
+
## Executive Summary
|
|
440
|
+
|
|
441
|
+
**Key Findings:**
|
|
442
|
+
1. [Concise finding 1]
|
|
443
|
+
2. [Concise finding 2]
|
|
444
|
+
3. [Concise finding 3]
|
|
445
|
+
|
|
446
|
+
**Recommended Next Steps:**
|
|
447
|
+
- [Action item 1]
|
|
448
|
+
- [Action item 2]
|
|
449
|
+
|
|
450
|
+
Note: Full outputs saved to workflow-output/my-large-workflow/2025-11-07-Thu-15-30-a1b2c3/
|
|
451
|
+
Files:
|
|
452
|
+
- deep-analysis.md (50k tokens)
|
|
453
|
+
- detailed-reasoning.md (40k tokens)
|
|
454
|
+
|
|
455
|
+
Use Read tool on saved files for full detailed analysis.
|
|
456
|
+
================================================================================
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Benefits:**
|
|
460
|
+
- ✅ **Prevents failures**: No more 25k token MCP limit errors
|
|
461
|
+
- ✅ **Automatic**: No manual synthesis steps needed
|
|
462
|
+
- ✅ **Transparent**: Full outputs saved to disk, summary returned
|
|
463
|
+
- ✅ **Fault-tolerant**: Checkpoints every 10k tokens, retry on failure
|
|
464
|
+
- ✅ **Configurable**: Disable or customize via settings
|
|
465
|
+
|
|
466
|
+
**Disabling Auto-Synthesis:**
|
|
467
|
+
|
|
468
|
+
```yaml
|
|
469
|
+
settings:
|
|
470
|
+
autoSynthesis:
|
|
471
|
+
enabled: false # Disable if workflow already has manual synthesis
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
**When to disable:**
|
|
475
|
+
- Workflow already has final synthesis step
|
|
476
|
+
- All steps produce <5k tokens each
|
|
477
|
+
- You need full outputs in MCP response (risky for large workflows)
|
|
478
|
+
|
|
479
|
+
## Example Workflow Patterns
|
|
480
|
+
|
|
481
|
+
### Pattern 1: Sequential Research Pipeline
|
|
482
|
+
|
|
483
|
+
Research → Reason → Verify → Synthesize
|
|
484
|
+
|
|
485
|
+
```yaml
|
|
486
|
+
name: research-pipeline
|
|
487
|
+
description: Deep research with verification
|
|
488
|
+
|
|
489
|
+
steps:
|
|
490
|
+
# Step 1: Initial research
|
|
491
|
+
- tool: perplexity_research
|
|
492
|
+
params:
|
|
493
|
+
topic: "Kubernetes security best practices"
|
|
494
|
+
depth: "deep"
|
|
495
|
+
output: research_results
|
|
496
|
+
|
|
497
|
+
# Step 2: Reasoning on research
|
|
498
|
+
- tool: grok_reason
|
|
499
|
+
params:
|
|
500
|
+
problem: "Based on ${research_results}, what are the top 5 priorities?"
|
|
501
|
+
approach: "systematic"
|
|
502
|
+
output: priorities
|
|
503
|
+
|
|
504
|
+
# Step 3: Verify with multiple sources
|
|
505
|
+
- tool: verifier
|
|
506
|
+
params:
|
|
507
|
+
query: "Verify these priorities: ${priorities}"
|
|
508
|
+
variant: "fact_check"
|
|
509
|
+
includeSources: true
|
|
510
|
+
output: verified_priorities
|
|
511
|
+
|
|
512
|
+
# Step 4: Final synthesis
|
|
513
|
+
- tool: think
|
|
514
|
+
params:
|
|
515
|
+
thought: "Synthesize ${research_results}, ${priorities}, ${verified_priorities} into actionable recommendations"
|
|
516
|
+
output: final_recommendations
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
### Pattern 2: Parallel Intelligence Gathering
|
|
520
|
+
|
|
521
|
+
Multiple models run simultaneously for diverse perspectives:
|
|
522
|
+
|
|
523
|
+
```yaml
|
|
524
|
+
name: parallel-analysis
|
|
525
|
+
description: Gather insights from multiple sources in parallel
|
|
526
|
+
|
|
527
|
+
steps:
|
|
528
|
+
# All 4 tools run simultaneously
|
|
529
|
+
- name: diverse-sensing
|
|
530
|
+
description: "Multi-source intelligence gathering"
|
|
531
|
+
parallel: true
|
|
532
|
+
tools:
|
|
533
|
+
- name: perplexity_ask
|
|
534
|
+
input:
|
|
535
|
+
query: "Latest GraphQL trends 2025"
|
|
536
|
+
searchRecency: "month"
|
|
537
|
+
searchDomain: "general"
|
|
538
|
+
output:
|
|
539
|
+
variable: perplexity_trends
|
|
540
|
+
|
|
541
|
+
- name: grok_search
|
|
542
|
+
input:
|
|
543
|
+
query: "GraphQL best practices 2025"
|
|
544
|
+
recency: "week"
|
|
545
|
+
max_search_results: 20
|
|
546
|
+
sources:
|
|
547
|
+
- type: "web"
|
|
548
|
+
allowed_websites: ["github.com", "stackoverflow.com", "graphql.org"]
|
|
549
|
+
output:
|
|
550
|
+
variable: grok_code_insights
|
|
551
|
+
|
|
552
|
+
- name: gemini_analyze_text
|
|
553
|
+
input:
|
|
554
|
+
text: "GraphQL vs REST in 2025"
|
|
555
|
+
type: "general"
|
|
556
|
+
output:
|
|
557
|
+
variable: gemini_comparison
|
|
558
|
+
|
|
559
|
+
- name: openai_brainstorm
|
|
560
|
+
input:
|
|
561
|
+
problem: "GraphQL architecture patterns"
|
|
562
|
+
style: "systematic"
|
|
563
|
+
quantity: 5
|
|
564
|
+
model: "gpt-5-mini"
|
|
565
|
+
output:
|
|
566
|
+
variable: openai_patterns
|
|
567
|
+
|
|
568
|
+
# Synchronization step (waits for all parallel steps)
|
|
569
|
+
- tool: think
|
|
570
|
+
params:
|
|
571
|
+
thought: "Combine insights from: ${perplexity_trends}, ${grok_code_insights}, ${gemini_comparison}, ${openai_patterns}"
|
|
572
|
+
output: unified_analysis
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Pattern 3: Adversarial Debate & Challenge
|
|
576
|
+
|
|
577
|
+
Models debate and challenge each other to improve quality:
|
|
578
|
+
|
|
579
|
+
```yaml
|
|
580
|
+
name: debate-workflow
|
|
581
|
+
description: Multi-round debate for robust conclusions
|
|
582
|
+
|
|
583
|
+
steps:
|
|
584
|
+
# Step 1: Initial proposal
|
|
585
|
+
- tool: openai_brainstorm
|
|
586
|
+
params:
|
|
587
|
+
problem: "Design a distributed caching system"
|
|
588
|
+
style: "innovative"
|
|
589
|
+
quantity: 3
|
|
590
|
+
model: "gpt-5-mini"
|
|
591
|
+
output: initial_design
|
|
592
|
+
|
|
593
|
+
# Step 2: Challenge the design
|
|
594
|
+
- tool: challenger
|
|
595
|
+
params:
|
|
596
|
+
context: "Challenge this caching design: ${initial_design}"
|
|
597
|
+
thoroughness: "standard"
|
|
598
|
+
output: challenges
|
|
599
|
+
|
|
600
|
+
# Step 3: Collaborative refinement
|
|
601
|
+
- tool: focus
|
|
602
|
+
params:
|
|
603
|
+
query: "Improve the design considering these challenges: ${challenges}"
|
|
604
|
+
mode: "architecture-debate"
|
|
605
|
+
domain: "backend"
|
|
606
|
+
models: ["gpt-5-mini", "gemini-2.5-pro", "grok-4"]
|
|
607
|
+
rounds: 5
|
|
608
|
+
pingPongStyle: "debate"
|
|
609
|
+
temperature: 0.7
|
|
610
|
+
output: refined_design
|
|
611
|
+
|
|
612
|
+
# Step 4: Final verification
|
|
613
|
+
- tool: verifier
|
|
614
|
+
params:
|
|
615
|
+
query: "Verify this refined design addresses the challenges: ${refined_design}"
|
|
616
|
+
variant: "code_verify"
|
|
617
|
+
models: ["gpt-5-mini", "gemini-2.5-pro"]
|
|
618
|
+
output: final_verdict
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
### Pattern 4: Code Analysis & Generation
|
|
622
|
+
|
|
623
|
+
Analyze requirements, generate code, review, and optimize:
|
|
624
|
+
|
|
625
|
+
```yaml
|
|
626
|
+
name: code-pipeline
|
|
627
|
+
description: Full code generation and review pipeline
|
|
628
|
+
|
|
629
|
+
steps:
|
|
630
|
+
# Step 1: Research best practices
|
|
631
|
+
- tool: scout
|
|
632
|
+
params:
|
|
633
|
+
query: "FastAPI authentication middleware best practices"
|
|
634
|
+
variant: "code_scout"
|
|
635
|
+
searchProvider: "both"
|
|
636
|
+
output: best_practices
|
|
637
|
+
|
|
638
|
+
# Step 2: Generate code
|
|
639
|
+
- tool: qwen_coder
|
|
640
|
+
params:
|
|
641
|
+
task: "generate"
|
|
642
|
+
language: "python"
|
|
643
|
+
requirements: "Create FastAPI auth middleware based on: ${best_practices}"
|
|
644
|
+
output: generated_code
|
|
645
|
+
|
|
646
|
+
# Step 3: Parallel code review
|
|
647
|
+
- parallel: true
|
|
648
|
+
tools:
|
|
649
|
+
- name: gemini_analyze_code
|
|
650
|
+
input:
|
|
651
|
+
code: "${generated_code}"
|
|
652
|
+
focus: "security"
|
|
653
|
+
output:
|
|
654
|
+
variable: security_review
|
|
655
|
+
|
|
656
|
+
- name: gemini_analyze_code
|
|
657
|
+
input:
|
|
658
|
+
code: "${generated_code}"
|
|
659
|
+
focus: "performance"
|
|
660
|
+
output:
|
|
661
|
+
variable: performance_review
|
|
662
|
+
|
|
663
|
+
# Step 4: Optimize based on reviews
|
|
664
|
+
- tool: qwen_coder
|
|
665
|
+
params:
|
|
666
|
+
task: "optimize"
|
|
667
|
+
code: "${generated_code}"
|
|
668
|
+
requirements: "Address security (${security_review}) and performance (${performance_review}) issues"
|
|
669
|
+
output: optimized_code
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
### Pattern 5: Swarm Intelligence (Complete Example)
|
|
673
|
+
|
|
674
|
+
The ultimate example combining all features:
|
|
675
|
+
|
|
676
|
+
```yaml
|
|
677
|
+
name: swarm-think
|
|
678
|
+
description: Tachikoma-style swarm intelligence with diverse sensing, synchronization, and synthesis
|
|
679
|
+
|
|
680
|
+
steps:
|
|
681
|
+
# Step 1: Diverse Sensing (parallel perspectives)
|
|
682
|
+
- tool: gemini_brainstorm
|
|
683
|
+
params:
|
|
684
|
+
prompt: "${query} - provide creative perspective"
|
|
685
|
+
maxRounds: 1
|
|
686
|
+
output: gemini_perspective
|
|
687
|
+
|
|
688
|
+
- tool: openai_brainstorm
|
|
689
|
+
params:
|
|
690
|
+
problem: "${query}"
|
|
691
|
+
style: "systematic"
|
|
692
|
+
quantity: 3
|
|
693
|
+
model: "gpt-5-mini"
|
|
694
|
+
output: gpt_perspective
|
|
695
|
+
|
|
696
|
+
- tool: perplexity_ask
|
|
697
|
+
params:
|
|
698
|
+
query: "${query}"
|
|
699
|
+
searchDomain: "general"
|
|
700
|
+
output: perplexity_facts
|
|
701
|
+
|
|
702
|
+
- tool: qwen_coder
|
|
703
|
+
params:
|
|
704
|
+
task: "explain"
|
|
705
|
+
requirements: "${query} - provide technical analysis"
|
|
706
|
+
output: qwen_technical
|
|
707
|
+
|
|
708
|
+
# Step 2: Synchronization
|
|
709
|
+
- tool: think
|
|
710
|
+
params:
|
|
711
|
+
thought: "Synchronizing perspectives: Gemini=${gemini_perspective}, GPT=${gpt_perspective}, Perplexity=${perplexity_facts}, Qwen=${qwen_technical}. Extract common patterns and unique insights."
|
|
712
|
+
output: sync_analysis
|
|
713
|
+
|
|
714
|
+
# Step 3: Real-time Data Enhancement
|
|
715
|
+
- tool: grok_search
|
|
716
|
+
params:
|
|
717
|
+
query: "${query} latest information"
|
|
718
|
+
recency: "week"
|
|
719
|
+
output: latest_data
|
|
720
|
+
|
|
721
|
+
# Step 4: Deep Processing (collaborative reasoning)
|
|
722
|
+
- tool: focus
|
|
723
|
+
params:
|
|
724
|
+
query: "Based on synchronized analysis (${sync_analysis}) and latest data (${latest_data}), provide comprehensive answer to: ${query}"
|
|
725
|
+
mode: "deep-reasoning"
|
|
726
|
+
models: ["gpt-5-mini", "gemini-2.5-pro", "perplexity"]
|
|
727
|
+
rounds: 5
|
|
728
|
+
pingPongStyle: "collaborative"
|
|
729
|
+
output: deep_analysis
|
|
730
|
+
|
|
731
|
+
# Step 5: Adversarial Challenge (debate mode)
|
|
732
|
+
- tool: focus
|
|
733
|
+
params:
|
|
734
|
+
query: "Challenge and improve this analysis: ${deep_analysis}"
|
|
735
|
+
mode: "architecture-debate"
|
|
736
|
+
models: ["gpt-5-mini", "gemini-2.5-pro", "grok-4"]
|
|
737
|
+
rounds: 3
|
|
738
|
+
pingPongStyle: "debate"
|
|
739
|
+
output: challenged_analysis
|
|
740
|
+
|
|
741
|
+
# Step 6: Final Synthesis
|
|
742
|
+
- tool: think
|
|
743
|
+
params:
|
|
744
|
+
thought: |
|
|
745
|
+
FINAL SYNTHESIS:
|
|
746
|
+
|
|
747
|
+
Original perspectives:
|
|
748
|
+
- Gemini: ${gemini_perspective}
|
|
749
|
+
- GPT: ${gpt_perspective}
|
|
750
|
+
- Perplexity: ${perplexity_facts}
|
|
751
|
+
- Qwen: ${qwen_technical}
|
|
752
|
+
|
|
753
|
+
Latest data: ${latest_data}
|
|
754
|
+
|
|
755
|
+
Deep analysis: ${deep_analysis}
|
|
756
|
+
|
|
757
|
+
Challenged analysis: ${challenged_analysis}
|
|
758
|
+
|
|
759
|
+
Combine all perspectives with confidence levels and final recommendation.
|
|
760
|
+
output: final_answer
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
## Real-Time Verification
|
|
764
|
+
|
|
765
|
+
TachiBot workflows can verify outputs against real-time information using Perplexity or Grok live search. This prevents hallucinations by grounding AI responses in actual, up-to-date data.
|
|
766
|
+
|
|
767
|
+
### Why Perplexity & Grok for Live Search?
|
|
768
|
+
|
|
769
|
+
TachiBot uses Perplexity and Grok for real-time verification because they provide **explicit, parameterized recency filters**:
|
|
770
|
+
|
|
771
|
+
- **Perplexity AI:** Supports structured recency filters ("day," "week," "month," "year") and precise publication date ranges via both UI and API
|
|
772
|
+
- **Grok:** Offers "Deep Search" and "Deeper Search" modes with recency-focused filtering, emphasizing latest/trending information
|
|
773
|
+
- **Gemini:** Supports time-based filtering through prompts (e.g., "last 6 months") but lacks explicit API parameters
|
|
774
|
+
- **Claude:** No explicit recency filter UI/API - relies on prompt instructions only
|
|
775
|
+
- **ChatGPT/OpenAI:** No documented recency filter parameters - prompt engineering can guide but not enforce strict date constraints
|
|
776
|
+
|
|
777
|
+
**Bottom line:** Perplexity and Grok provide reliable, programmatic control over search recency, making them ideal for fact-checking workflows that require up-to-date information.
|
|
778
|
+
|
|
779
|
+
### Verification Pattern
|
|
780
|
+
|
|
781
|
+
```yaml
|
|
782
|
+
steps:
|
|
783
|
+
# Step 1: Models generate initial analysis
|
|
784
|
+
- tool: openai_brainstorm
|
|
785
|
+
params:
|
|
786
|
+
problem: "Best practices for API authentication in 2025"
|
|
787
|
+
output: initial_ideas
|
|
788
|
+
|
|
789
|
+
# Step 2: Verify with real-time web search (Perplexity)
|
|
790
|
+
- tool: perplexity_ask
|
|
791
|
+
params:
|
|
792
|
+
query: "API authentication best practices 2025"
|
|
793
|
+
searchRecency: "month"
|
|
794
|
+
searchDomain: "general"
|
|
795
|
+
output: current_facts
|
|
796
|
+
|
|
797
|
+
# Step 3: Verify with live web search (Grok)
|
|
798
|
+
- tool: grok_search
|
|
799
|
+
params:
|
|
800
|
+
query: "API security recommendations 2025"
|
|
801
|
+
recency: "week"
|
|
802
|
+
max_search_results: 20
|
|
803
|
+
output: latest_trends
|
|
804
|
+
|
|
805
|
+
# Step 4: Compare initial ideas against verified facts
|
|
806
|
+
- tool: verifier
|
|
807
|
+
params:
|
|
808
|
+
query: "Verify these ideas (${initial_ideas}) against current facts (${current_facts}) and trends (${latest_trends})"
|
|
809
|
+
variant: "fact_check"
|
|
810
|
+
output: verified_recommendations
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
### Why This Matters
|
|
814
|
+
|
|
815
|
+
- **Prevents hallucinations** - Models can't make up outdated information
|
|
816
|
+
- **Real-time accuracy** - Get information from the past week, day, or hour
|
|
817
|
+
- **Cross-verification** - Compare multiple search sources (Perplexity + Grok)
|
|
818
|
+
- **Fact-checking** - Use `verifier` tool to validate claims against search results
|
|
819
|
+
- **Recency filters** - Perplexity and Grok both support time-based filtering
|
|
820
|
+
|
|
821
|
+
**Best Practice:** For critical decisions, use this pattern: **Generate → Search → Verify → Synthesize**. Models brainstorm ideas, live search provides facts, verifier checks accuracy, then final synthesis combines both.
|
|
822
|
+
|
|
823
|
+
## Workflow Management Tools
|
|
824
|
+
|
|
825
|
+
### 1. `workflow` - Execute a workflow
|
|
826
|
+
|
|
827
|
+
Execute a workflow from config:
|
|
828
|
+
|
|
829
|
+
```typescript
|
|
830
|
+
workflow({
|
|
831
|
+
name: string; // Workflow name to execute (REQUIRED)
|
|
832
|
+
query: string; // The query/context for the workflow (REQUIRED)
|
|
833
|
+
projectPath?: string; // Path to project for custom workflows
|
|
834
|
+
})
|
|
835
|
+
|
|
836
|
+
// Example
|
|
837
|
+
workflow({
|
|
838
|
+
name: "swarm-think",
|
|
839
|
+
query: "What are the security implications of GraphQL?"
|
|
840
|
+
})
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
### 2. `list_workflows` - List available workflows
|
|
844
|
+
|
|
845
|
+
List all available workflows:
|
|
846
|
+
|
|
847
|
+
```typescript
|
|
848
|
+
list_workflows({
|
|
849
|
+
projectPath?: string; // Path to project for custom workflows
|
|
850
|
+
})
|
|
851
|
+
|
|
852
|
+
// Example
|
|
853
|
+
list_workflows() // Lists all built-in workflows
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
### 3. `create_workflow` - Create a custom workflow
|
|
857
|
+
|
|
858
|
+
Create a workflow from template or custom YAML/JSON:
|
|
859
|
+
|
|
860
|
+
```typescript
|
|
861
|
+
create_workflow({
|
|
862
|
+
name: string; // Name for the new workflow (REQUIRED)
|
|
863
|
+
type: "code-review" // Type of workflow (REQUIRED)
|
|
864
|
+
| "brainstorm"
|
|
865
|
+
| "debug"
|
|
866
|
+
| "research"
|
|
867
|
+
| "custom";
|
|
868
|
+
steps?: string; // Custom steps as YAML or JSON
|
|
869
|
+
})
|
|
870
|
+
|
|
871
|
+
// Example: Create from template
|
|
872
|
+
create_workflow({
|
|
873
|
+
name: "my-api-review",
|
|
874
|
+
type: "code-review"
|
|
875
|
+
})
|
|
876
|
+
|
|
877
|
+
// Example: Create custom workflow
|
|
878
|
+
create_workflow({
|
|
879
|
+
name: "my-research-flow",
|
|
880
|
+
type: "custom",
|
|
881
|
+
steps: `
|
|
882
|
+
steps:
|
|
883
|
+
- tool: perplexity_research
|
|
884
|
+
params:
|
|
885
|
+
topic: "\${query}"
|
|
886
|
+
output: research
|
|
887
|
+
- tool: think
|
|
888
|
+
params:
|
|
889
|
+
thought: "Summarize: \${research}"
|
|
890
|
+
output: summary
|
|
891
|
+
`
|
|
892
|
+
})
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### 4. `visualize_workflow` - Show workflow structure
|
|
896
|
+
|
|
897
|
+
Visualize the structure of a workflow:
|
|
898
|
+
|
|
899
|
+
```typescript
|
|
900
|
+
visualize_workflow({
|
|
901
|
+
name: string; // Workflow name to visualize (REQUIRED)
|
|
902
|
+
})
|
|
903
|
+
|
|
904
|
+
// Example
|
|
905
|
+
visualize_workflow({
|
|
906
|
+
name: "swarm-think"
|
|
907
|
+
})
|
|
908
|
+
|
|
909
|
+
// Returns ASCII diagram showing:
|
|
910
|
+
// - All steps in order
|
|
911
|
+
// - Parallel execution groups
|
|
912
|
+
// - Variable dependencies
|
|
913
|
+
// - Tool usage
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
### Running Workflows (CLI)
|
|
917
|
+
|
|
918
|
+
```bash
|
|
919
|
+
# Run a workflow with a query
|
|
920
|
+
tachibot workflow run swarm-think "What are best practices for microservices?"
|
|
921
|
+
|
|
922
|
+
# List available workflows
|
|
923
|
+
tachibot workflow list
|
|
924
|
+
|
|
925
|
+
# Create custom workflow from template
|
|
926
|
+
tachibot workflow create my-workflow --type brainstorm
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
## Best Practices
|
|
930
|
+
|
|
931
|
+
### Workflow Design
|
|
932
|
+
|
|
933
|
+
1. **Start with diverse perspectives** - Use multiple models in parallel
|
|
934
|
+
2. **Add synchronization steps** - Combine insights intelligently
|
|
935
|
+
3. **Include challenge/debate steps** - Improve quality through adversarial testing
|
|
936
|
+
4. **End with synthesis** - Create final recommendations
|
|
937
|
+
5. **Name variables clearly** - Use `research_findings` not `r1`
|
|
938
|
+
6. **Use parallel execution** - When inputs don't depend on each other
|
|
939
|
+
|
|
940
|
+
### Performance Optimization
|
|
941
|
+
|
|
942
|
+
1. **Parallel over sequential** - Run independent steps simultaneously
|
|
943
|
+
2. **Enable caching** - Reuse identical requests
|
|
944
|
+
3. **Set token limits** - Control costs per step
|
|
945
|
+
4. **Use smart routing** - Let TachiBot choose the cheapest capable model
|
|
946
|
+
|
|
947
|
+
### Error Handling
|
|
948
|
+
|
|
949
|
+
1. **Use conditional execution** - Skip steps when appropriate
|
|
950
|
+
2. **Set `failOnError: false`** - Continue workflow on non-critical failures
|
|
951
|
+
3. **Add verification steps** - Validate outputs with `verifier` tool
|
|
952
|
+
|
|
953
|
+
### Cost Management
|
|
954
|
+
|
|
955
|
+
**Note:** TachiBot workflows do NOT enforce dollar-based cost limits. Control costs through token limits and smart model selection.
|
|
956
|
+
|
|
957
|
+
1. **Set maxTokens per step** - Limit output tokens to control API costs
|
|
958
|
+
2. **Use appropriate models** - Don't use GPT-5 for simple tasks, enable `smartRouting`
|
|
959
|
+
3. **Enable optimizations** - Caching reduces duplicate API calls
|
|
960
|
+
4. **Monitor token usage** - Track token consumption per step to estimate costs
|
|
961
|
+
|
|
962
|
+
## Where to Store Workflows
|
|
963
|
+
|
|
964
|
+
TachiBot auto-discovers workflows from:
|
|
965
|
+
|
|
966
|
+
- `workflows/` - **Recommended default** (plain folder)
|
|
967
|
+
- `.tachi/workflows/` - Alternative hidden config location
|
|
968
|
+
|
|
969
|
+
Create your workflow files in either location and TachiBot instantly recognizes them. No boilerplate, no complex setup.
|
|
970
|
+
|
|
971
|
+
## Next Steps
|
|
972
|
+
|
|
973
|
+
- [Complete Tools Reference](TOOLS_REFERENCE.md) - All available tools with schemas
|
|
974
|
+
- [Configuration Guide](CONFIGURATION.md) - Environment variables and settings
|
|
975
|
+
- [API Keys Setup](API_KEYS.md) - Get API keys for providers
|
|
976
|
+
- [Tool Profiles](../TOOL_PROFILES.md) - Token-optimized tool profiles
|
|
977
|
+
|
|
978
|
+
## Real-World Workflow Examples
|
|
979
|
+
|
|
980
|
+
The `workflows/` directory contains production-ready examples:
|
|
981
|
+
|
|
982
|
+
- **`code-review.yaml`** - Multi-perspective code review
|
|
983
|
+
- **`brainstorm.json`** - Creative brainstorming with research
|
|
984
|
+
- **`debug-helper.yaml`** - Debug assistance workflow
|
|
985
|
+
- **`test-search-tools.yaml`** - Search tools demo with Grok live search
|
|
986
|
+
|
|
987
|
+
Use these as starting points for your custom workflows!
|