specweave 0.3.13 → 0.4.1
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/CLAUDE.md +506 -17
- package/README.md +100 -58
- package/bin/install-all.sh +9 -2
- package/bin/install-hooks.sh +57 -0
- package/bin/specweave.js +16 -0
- package/dist/adapters/adapter-base.d.ts +21 -0
- package/dist/adapters/adapter-base.d.ts.map +1 -1
- package/dist/adapters/adapter-base.js +28 -0
- package/dist/adapters/adapter-base.js.map +1 -1
- package/dist/adapters/adapter-interface.d.ts +41 -0
- package/dist/adapters/adapter-interface.d.ts.map +1 -1
- package/dist/adapters/claude/adapter.d.ts +36 -0
- package/dist/adapters/claude/adapter.d.ts.map +1 -1
- package/dist/adapters/claude/adapter.js +135 -0
- package/dist/adapters/claude/adapter.js.map +1 -1
- package/dist/adapters/copilot/adapter.d.ts +25 -0
- package/dist/adapters/copilot/adapter.d.ts.map +1 -1
- package/dist/adapters/copilot/adapter.js +112 -0
- package/dist/adapters/copilot/adapter.js.map +1 -1
- package/dist/adapters/cursor/adapter.d.ts +36 -0
- package/dist/adapters/cursor/adapter.d.ts.map +1 -1
- package/dist/adapters/cursor/adapter.js +140 -0
- package/dist/adapters/cursor/adapter.js.map +1 -1
- package/dist/adapters/generic/adapter.d.ts +25 -0
- package/dist/adapters/generic/adapter.d.ts.map +1 -1
- package/dist/adapters/generic/adapter.js +111 -0
- package/dist/adapters/generic/adapter.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +103 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/plugin.d.ts +37 -0
- package/dist/cli/commands/plugin.d.ts.map +1 -0
- package/dist/cli/commands/plugin.js +296 -0
- package/dist/cli/commands/plugin.js.map +1 -0
- package/dist/core/agent-model-manager.d.ts +52 -0
- package/dist/core/agent-model-manager.d.ts.map +1 -0
- package/dist/core/agent-model-manager.js +120 -0
- package/dist/core/agent-model-manager.js.map +1 -0
- package/dist/core/cost-tracker.d.ts +108 -0
- package/dist/core/cost-tracker.d.ts.map +1 -0
- package/dist/core/cost-tracker.js +281 -0
- package/dist/core/cost-tracker.js.map +1 -0
- package/dist/core/model-selector.d.ts +57 -0
- package/dist/core/model-selector.d.ts.map +1 -0
- package/dist/core/model-selector.js +115 -0
- package/dist/core/model-selector.js.map +1 -0
- package/dist/core/phase-detector.d.ts +62 -0
- package/dist/core/phase-detector.d.ts.map +1 -0
- package/dist/core/phase-detector.js +229 -0
- package/dist/core/phase-detector.js.map +1 -0
- package/dist/core/plugin-detector.d.ts +96 -0
- package/dist/core/plugin-detector.d.ts.map +1 -0
- package/dist/core/plugin-detector.js +349 -0
- package/dist/core/plugin-detector.js.map +1 -0
- package/dist/core/plugin-loader.d.ts +111 -0
- package/dist/core/plugin-loader.d.ts.map +1 -0
- package/dist/core/plugin-loader.js +319 -0
- package/dist/core/plugin-loader.js.map +1 -0
- package/dist/core/plugin-manager.d.ts +144 -0
- package/dist/core/plugin-manager.d.ts.map +1 -0
- package/dist/core/plugin-manager.js +393 -0
- package/dist/core/plugin-manager.js.map +1 -0
- package/dist/core/schemas/plugin-manifest.schema.json +253 -0
- package/dist/core/types/plugin.d.ts +252 -0
- package/dist/core/types/plugin.d.ts.map +1 -0
- package/dist/core/types/plugin.js +48 -0
- package/dist/core/types/plugin.js.map +1 -0
- package/dist/integrations/jira/jira-mapper.d.ts +2 -2
- package/dist/integrations/jira/jira-mapper.js +2 -2
- package/dist/types/cost-tracking.d.ts +43 -0
- package/dist/types/cost-tracking.d.ts.map +1 -0
- package/dist/types/cost-tracking.js +8 -0
- package/dist/types/cost-tracking.js.map +1 -0
- package/dist/types/model-selection.d.ts +53 -0
- package/dist/types/model-selection.d.ts.map +1 -0
- package/dist/types/model-selection.js +12 -0
- package/dist/types/model-selection.js.map +1 -0
- package/dist/utils/cost-reporter.d.ts +58 -0
- package/dist/utils/cost-reporter.d.ts.map +1 -0
- package/dist/utils/cost-reporter.js +224 -0
- package/dist/utils/cost-reporter.js.map +1 -0
- package/dist/utils/pricing-constants.d.ts +70 -0
- package/dist/utils/pricing-constants.d.ts.map +1 -0
- package/dist/utils/pricing-constants.js +71 -0
- package/dist/utils/pricing-constants.js.map +1 -0
- package/package.json +13 -9
- package/src/adapters/adapter-base.ts +33 -0
- package/src/adapters/adapter-interface.ts +46 -0
- package/src/adapters/claude/adapter.ts +164 -0
- package/src/adapters/copilot/adapter.ts +138 -0
- package/src/adapters/cursor/adapter.ts +170 -0
- package/src/adapters/generic/adapter.ts +137 -0
- package/src/agents/architect/AGENT.md +3 -0
- package/src/agents/code-reviewer.md +156 -0
- package/src/agents/data-scientist/AGENT.md +181 -0
- package/src/agents/database-optimizer/AGENT.md +147 -0
- package/src/agents/devops/AGENT.md +3 -0
- package/src/agents/diagrams-architect/AGENT.md +3 -0
- package/src/agents/docs-writer/AGENT.md +3 -0
- package/src/agents/kubernetes-architect/AGENT.md +142 -0
- package/src/agents/ml-engineer/AGENT.md +150 -0
- package/src/agents/mlops-engineer/AGENT.md +201 -0
- package/src/agents/network-engineer/AGENT.md +149 -0
- package/src/agents/observability-engineer/AGENT.md +213 -0
- package/src/agents/payment-integration/AGENT.md +35 -0
- package/src/agents/performance/AGENT.md +3 -0
- package/src/agents/performance-engineer/AGENT.md +153 -0
- package/src/agents/pm/AGENT.md +3 -0
- package/src/agents/qa-lead/AGENT.md +3 -0
- package/src/agents/security/AGENT.md +3 -0
- package/src/agents/sre/AGENT.md +3 -0
- package/src/agents/tdd-orchestrator/AGENT.md +169 -0
- package/src/agents/tech-lead/AGENT.md +3 -0
- package/src/commands/specweave.costs.md +261 -0
- package/src/commands/specweave.increment.md +48 -4
- package/src/commands/specweave.ml-pipeline.md +292 -0
- package/src/commands/specweave.monitor-setup.md +501 -0
- package/src/commands/specweave.slo-implement.md +1055 -0
- package/src/commands/specweave.sync-github.md +1 -1
- package/src/commands/specweave.tdd-cycle.md +199 -0
- package/src/commands/specweave.tdd-green.md +842 -0
- package/src/commands/specweave.tdd-red.md +135 -0
- package/src/commands/specweave.tdd-refactor.md +165 -0
- package/src/hooks/post-increment-plugin-detect.sh +142 -0
- package/src/hooks/post-task-completion.sh +53 -11
- package/src/hooks/pre-task-plugin-detect.sh +96 -0
- package/src/skills/SKILLS-INDEX.md +18 -10
- package/src/skills/billing-automation/SKILL.md +559 -0
- package/src/skills/distributed-tracing/SKILL.md +438 -0
- package/src/skills/e2e-playwright/README.md +1 -1
- package/src/skills/e2e-playwright/package.json +1 -1
- package/src/skills/gitops-workflow/SKILL.md +285 -0
- package/src/skills/gitops-workflow/references/argocd-setup.md +134 -0
- package/src/skills/gitops-workflow/references/sync-policies.md +131 -0
- package/src/skills/grafana-dashboards/SKILL.md +369 -0
- package/src/skills/helm-chart-scaffolding/SKILL.md +544 -0
- package/src/skills/helm-chart-scaffolding/assets/Chart.yaml.template +42 -0
- package/src/skills/helm-chart-scaffolding/assets/values.yaml.template +185 -0
- package/src/skills/helm-chart-scaffolding/references/chart-structure.md +500 -0
- package/src/skills/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
- package/src/skills/k8s-manifest-generator/SKILL.md +511 -0
- package/src/skills/k8s-manifest-generator/assets/configmap-template.yaml +296 -0
- package/src/skills/k8s-manifest-generator/assets/deployment-template.yaml +203 -0
- package/src/skills/k8s-manifest-generator/assets/service-template.yaml +171 -0
- package/src/skills/k8s-manifest-generator/references/deployment-spec.md +753 -0
- package/src/skills/k8s-manifest-generator/references/service-spec.md +724 -0
- package/src/skills/k8s-security-policies/SKILL.md +334 -0
- package/src/skills/k8s-security-policies/assets/network-policy-template.yaml +177 -0
- package/src/skills/k8s-security-policies/references/rbac-patterns.md +187 -0
- package/src/skills/ml-pipeline-workflow/SKILL.md +245 -0
- package/src/skills/paypal-integration/SKILL.md +467 -0
- package/src/skills/pci-compliance/SKILL.md +466 -0
- package/src/skills/prometheus-configuration/SKILL.md +392 -0
- package/src/skills/slo-implementation/SKILL.md +329 -0
- package/src/skills/stripe-integration/SKILL.md +442 -0
- package/src/skills/tdd-workflow/SKILL.md +378 -0
- package/src/templates/README.md.template +1 -1
- package/src/skills/bmad-method-expert/SKILL.md +0 -626
- package/src/skills/bmad-method-expert/scripts/analyze-project.js +0 -318
- package/src/skills/bmad-method-expert/scripts/check-setup.js +0 -208
- package/src/skills/bmad-method-expert/scripts/generate-template.js +0 -1149
- package/src/skills/bmad-method-expert/scripts/validate-documents.js +0 -340
- package/src/skills/context-optimizer/SKILL.md +0 -588
- package/src/skills/figma-designer/SKILL.md +0 -149
- package/src/skills/figma-implementer/SKILL.md +0 -148
- package/src/skills/figma-mcp-connector/SKILL.md +0 -136
- package/src/skills/figma-to-code/SKILL.md +0 -128
- package/src/skills/spec-kit-expert/SKILL.md +0 -1010
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specweave.costs
|
|
3
|
+
description: Display AI cost dashboard for current or specified increment with real-time savings tracking
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cost Dashboard Command
|
|
7
|
+
|
|
8
|
+
You are being invoked via the `/specweave.costs [incrementId]` command.
|
|
9
|
+
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
Display a comprehensive cost dashboard showing:
|
|
13
|
+
1. Token usage breakdown
|
|
14
|
+
2. Cost by model (Sonnet vs Haiku)
|
|
15
|
+
3. Cost by agent
|
|
16
|
+
4. Savings vs baseline (all-Sonnet)
|
|
17
|
+
5. Recent sessions
|
|
18
|
+
|
|
19
|
+
**Optional**: Export data to JSON/CSV format
|
|
20
|
+
|
|
21
|
+
## Implementation Steps
|
|
22
|
+
|
|
23
|
+
### 1. Parse Arguments
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
// Extract increment ID from command args
|
|
27
|
+
// If not provided, detect current increment from .specweave/increments/
|
|
28
|
+
// Look for increment with status 'in-progress' in metadata.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Load Cost Data
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { CostTracker } from '../core/cost-tracker';
|
|
35
|
+
import { CostReporter } from '../utils/cost-reporter';
|
|
36
|
+
import fs from 'fs-extra';
|
|
37
|
+
import path from 'path';
|
|
38
|
+
|
|
39
|
+
// Initialize cost tracker
|
|
40
|
+
const costTracker = new CostTracker({
|
|
41
|
+
logPath: '.specweave/logs/costs.json',
|
|
42
|
+
autoSave: true,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Load persisted cost data
|
|
46
|
+
await costTracker.loadFromDisk();
|
|
47
|
+
|
|
48
|
+
// Create reporter
|
|
49
|
+
const reporter = new CostReporter(costTracker);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3. Determine Increment ID
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// If user provided increment ID
|
|
56
|
+
const userProvidedId = args[0]; // e.g., "0003"
|
|
57
|
+
|
|
58
|
+
// Otherwise, detect current increment
|
|
59
|
+
const currentIncrement = await detectCurrentIncrement();
|
|
60
|
+
|
|
61
|
+
const incrementId = userProvidedId || currentIncrement || 'all';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 4. Generate Dashboard
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// Generate ASCII dashboard
|
|
68
|
+
const dashboard = reporter.generateDashboard(
|
|
69
|
+
incrementId === 'all' ? undefined : incrementId
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
// Display to user
|
|
73
|
+
console.log(dashboard);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 5. Offer Export Options
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// Ask user if they want to export
|
|
80
|
+
const wantsExport = await askUser('Would you like to export cost data?', {
|
|
81
|
+
options: ['JSON', 'CSV', 'Both', 'No'],
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (wantsExport !== 'No') {
|
|
85
|
+
const outputDir = incrementId === 'all'
|
|
86
|
+
? '.specweave/logs/reports'
|
|
87
|
+
: `.specweave/increments/${incrementId}/reports`;
|
|
88
|
+
|
|
89
|
+
await fs.ensureDir(outputDir);
|
|
90
|
+
|
|
91
|
+
if (wantsExport === 'JSON' || wantsExport === 'Both') {
|
|
92
|
+
const jsonPath = path.join(outputDir, 'cost-analysis.json');
|
|
93
|
+
await reporter.exportToJSON(incrementId, jsonPath);
|
|
94
|
+
console.log(`✅ Exported to ${jsonPath}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (wantsExport === 'CSV' || wantsExport === 'Both') {
|
|
98
|
+
const csvPath = path.join(outputDir, 'cost-history.csv');
|
|
99
|
+
await reporter.exportToCSV(incrementId, csvPath);
|
|
100
|
+
console.log(`✅ Exported to ${csvPath}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Helper Function: Detect Current Increment
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
async function detectCurrentIncrement(): Promise<string | null> {
|
|
109
|
+
const incrementsDir = '.specweave/increments';
|
|
110
|
+
|
|
111
|
+
if (!await fs.pathExists(incrementsDir)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const dirs = await fs.readdir(incrementsDir);
|
|
116
|
+
|
|
117
|
+
// Filter out _backlog and other special folders
|
|
118
|
+
const incrementDirs = dirs.filter(d => /^\d{4}-/.test(d));
|
|
119
|
+
|
|
120
|
+
// Check each for in-progress status
|
|
121
|
+
for (const dir of incrementDirs) {
|
|
122
|
+
const metadataPath = path.join(incrementsDir, dir, 'metadata.json');
|
|
123
|
+
|
|
124
|
+
if (await fs.pathExists(metadataPath)) {
|
|
125
|
+
const metadata = await fs.readJson(metadataPath);
|
|
126
|
+
if (metadata.status === 'in-progress') {
|
|
127
|
+
return dir.split('-')[0]; // Extract "0003" from "0003-intelligent-model-selection"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// If no in-progress, return most recent
|
|
133
|
+
return incrementDirs.length > 0
|
|
134
|
+
? incrementDirs[incrementDirs.length - 1].split('-')[0]
|
|
135
|
+
: null;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Output Examples
|
|
140
|
+
|
|
141
|
+
### Increment-Specific Dashboard
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
═══════════════════════════════════════════════════════════════
|
|
145
|
+
Cost Report: Increment 0003
|
|
146
|
+
═══════════════════════════════════════════════════════════════
|
|
147
|
+
|
|
148
|
+
SUMMARY
|
|
149
|
+
───────────────────────────────────────────────────────────────
|
|
150
|
+
Total Cost: $ 0.1234
|
|
151
|
+
Total Savings: $ 0.3456
|
|
152
|
+
Savings %: 73.7%
|
|
153
|
+
Total Tokens: 125,432
|
|
154
|
+
Sessions: 15
|
|
155
|
+
|
|
156
|
+
COST BY MODEL
|
|
157
|
+
───────────────────────────────────────────────────────────────
|
|
158
|
+
sonnet $ 0.0734 ( 59.4%)
|
|
159
|
+
haiku $ 0.0500 ( 40.6%)
|
|
160
|
+
|
|
161
|
+
COST BY AGENT
|
|
162
|
+
───────────────────────────────────────────────────────────────
|
|
163
|
+
pm $ 0.0500 ( 40.5%)
|
|
164
|
+
architect $ 0.0300 ( 24.3%)
|
|
165
|
+
frontend $ 0.0234 ( 19.0%)
|
|
166
|
+
devops $ 0.0150 ( 12.2%)
|
|
167
|
+
qa-lead $ 0.0050 ( 4.0%)
|
|
168
|
+
|
|
169
|
+
RECENT SESSIONS
|
|
170
|
+
───────────────────────────────────────────────────────────────
|
|
171
|
+
2025-10-31 14:32:15
|
|
172
|
+
Agent: pm Model: sonnet
|
|
173
|
+
Cost: $ 0.0150 Savings: $ 0.0350
|
|
174
|
+
|
|
175
|
+
2025-10-31 13:15:42
|
|
176
|
+
Agent: frontend Model: haiku
|
|
177
|
+
Cost: $ 0.0034 Savings: $ 0.0166
|
|
178
|
+
|
|
179
|
+
═══════════════════════════════════════════════════════════════
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Overall Dashboard (All Increments)
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
═══════════════════════════════════════════════════════════════
|
|
186
|
+
SpecWeave Cost Summary - All Increments
|
|
187
|
+
═══════════════════════════════════════════════════════════════
|
|
188
|
+
|
|
189
|
+
OVERALL SUMMARY
|
|
190
|
+
───────────────────────────────────────────────────────────────
|
|
191
|
+
Total Cost: $ 1.2345
|
|
192
|
+
Total Savings: $ 3.4567
|
|
193
|
+
Savings %: 73.7%
|
|
194
|
+
Total Sessions: 42
|
|
195
|
+
|
|
196
|
+
AGENT STATS
|
|
197
|
+
───────────────────────────────────────────────────────────────
|
|
198
|
+
Most Expensive: pm
|
|
199
|
+
Least Expensive: qa-lead
|
|
200
|
+
|
|
201
|
+
COST BY INCREMENT
|
|
202
|
+
───────────────────────────────────────────────────────────────
|
|
203
|
+
0001 $ 0.5000 (12 sessions)
|
|
204
|
+
0002 $ 0.4111 (15 sessions)
|
|
205
|
+
0003 $ 0.3234 (15 sessions)
|
|
206
|
+
|
|
207
|
+
═══════════════════════════════════════════════════════════════
|
|
208
|
+
|
|
209
|
+
💡 Tip: Use "/specweave.costs 0003" to see detailed report for increment 0003
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Error Handling
|
|
213
|
+
|
|
214
|
+
### No Cost Data
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
No cost data available for increment 0003.
|
|
218
|
+
|
|
219
|
+
This could mean:
|
|
220
|
+
- The increment hasn't been started yet
|
|
221
|
+
- Cost tracking is not enabled
|
|
222
|
+
- The cost log file is missing
|
|
223
|
+
|
|
224
|
+
Run /specweave.do to start executing tasks with cost tracking enabled.
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Invalid Increment ID
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
Increment 0099 not found.
|
|
231
|
+
|
|
232
|
+
Available increments:
|
|
233
|
+
- 0001-core-framework
|
|
234
|
+
- 0002-core-enhancements
|
|
235
|
+
- 0003-intelligent-model-selection
|
|
236
|
+
|
|
237
|
+
Use /specweave.costs without arguments to see all increments.
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Important Notes
|
|
241
|
+
|
|
242
|
+
1. **Cost Data Persistence**: Costs are persisted to `.specweave/logs/costs.json`
|
|
243
|
+
2. **Baseline Calculation**: Savings are calculated vs an all-Sonnet baseline
|
|
244
|
+
3. **Real-Time Updates**: Costs update after each agent invocation
|
|
245
|
+
4. **Export Formats**: JSON for machine parsing, CSV for spreadsheet import
|
|
246
|
+
5. **Privacy**: Cost data is local only, never sent to external services
|
|
247
|
+
|
|
248
|
+
## Related Commands
|
|
249
|
+
|
|
250
|
+
- `/specweave.do` - Execute tasks with cost tracking
|
|
251
|
+
- `/specweave.progress` - View progress with cost summary
|
|
252
|
+
- `/specweave.validate` - Validate increment (includes cost checks)
|
|
253
|
+
|
|
254
|
+
## Success Criteria
|
|
255
|
+
|
|
256
|
+
After running this command, the user should:
|
|
257
|
+
1. ✅ See a clear cost breakdown
|
|
258
|
+
2. ✅ Understand their savings vs baseline
|
|
259
|
+
3. ✅ Identify most expensive agents/models
|
|
260
|
+
4. ✅ Have option to export data
|
|
261
|
+
5. ✅ Feel confident about cost optimization
|
|
@@ -117,7 +117,51 @@ You are helping the user create a new SpecWeave increment with automatic closure
|
|
|
117
117
|
- "What's the short name?" (e.g., "user-authentication" for increment 003-user-authentication)
|
|
118
118
|
- "Priority? (P1/P2/P3)" (default: P1)
|
|
119
119
|
|
|
120
|
-
### Step 4:
|
|
120
|
+
### Step 4: Detect Suggested Plugins (T-019 - Plugin Auto-Detection)
|
|
121
|
+
|
|
122
|
+
**🔌 NEW IN v0.4.0**: Auto-detect plugins based on increment description
|
|
123
|
+
|
|
124
|
+
Before planning, analyze the feature description for plugin keywords and suggest relevant plugins:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Example feature descriptions and their plugin suggestions:
|
|
128
|
+
"Deploy to Kubernetes" → kubernetes plugin
|
|
129
|
+
"Add Stripe payments" → payment-processing plugin
|
|
130
|
+
"Create React dashboard" → frontend-stack plugin
|
|
131
|
+
"Build FastAPI backend" → backend-stack plugin
|
|
132
|
+
"Sync with GitHub issues" → github plugin
|
|
133
|
+
"Integrate with Jira" → jira plugin
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Detection Logic**:
|
|
137
|
+
1. Extract keywords from feature description
|
|
138
|
+
2. Match against plugin triggers (from manifest.json)
|
|
139
|
+
3. Check if plugin already enabled
|
|
140
|
+
4. Suggest new plugins only
|
|
141
|
+
|
|
142
|
+
**Output Format**:
|
|
143
|
+
```
|
|
144
|
+
💡 Plugin Detection
|
|
145
|
+
|
|
146
|
+
Analyzing feature: "Add authentication with NextJS and Stripe"
|
|
147
|
+
|
|
148
|
+
Suggested plugins:
|
|
149
|
+
✅ frontend-stack (NextJS detected)
|
|
150
|
+
✅ payment-processing (Stripe detected)
|
|
151
|
+
|
|
152
|
+
Would you like to enable these plugins? (Y/n)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**If user confirms**:
|
|
156
|
+
- Enable plugins via PluginManager
|
|
157
|
+
- Plugins become available for increment planning
|
|
158
|
+
- Skills/agents from plugins can be used immediately
|
|
159
|
+
|
|
160
|
+
**If user declines**:
|
|
161
|
+
- Continue without plugins
|
|
162
|
+
- User can enable later: `specweave plugin enable <name>`
|
|
163
|
+
|
|
164
|
+
### Step 5: Activate Increment Planning Workflow
|
|
121
165
|
|
|
122
166
|
**🚨 CRITICAL - YOU MUST USE THE SKILL TOOL:**
|
|
123
167
|
|
|
@@ -149,7 +193,7 @@ The increment-planner skill will:
|
|
|
149
193
|
- ✅ Quality gates enforced
|
|
150
194
|
- ❌ Direct file writing bypasses entire workflow
|
|
151
195
|
|
|
152
|
-
### Step
|
|
196
|
+
### Step 6: Skill Tool Invocation (MANDATORY)
|
|
153
197
|
|
|
154
198
|
**BEFORE PROCEEDING, USE THE SKILL TOOL:**
|
|
155
199
|
|
|
@@ -158,9 +202,9 @@ You must literally call the Skill tool like this:
|
|
|
158
202
|
Skill(command: "increment-planner")
|
|
159
203
|
```
|
|
160
204
|
|
|
161
|
-
Wait for the skill to complete. Do NOT continue to Step
|
|
205
|
+
Wait for the skill to complete. Do NOT continue to Step 7 until the increment-planner skill returns.
|
|
162
206
|
|
|
163
|
-
### Step
|
|
207
|
+
### Step 7: Alternative Approach (ONLY IF SKILL FAILS)
|
|
164
208
|
|
|
165
209
|
**Only use this if Skill tool is unavailable or fails:**
|
|
166
210
|
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Machine Learning Pipeline - Multi-Agent MLOps Orchestration
|
|
2
|
+
|
|
3
|
+
Design and implement a complete ML pipeline for: $ARGUMENTS
|
|
4
|
+
|
|
5
|
+
## Thinking
|
|
6
|
+
|
|
7
|
+
This workflow orchestrates multiple specialized agents to build a production-ready ML pipeline following modern MLOps best practices. The approach emphasizes:
|
|
8
|
+
|
|
9
|
+
- **Phase-based coordination**: Each phase builds upon previous outputs, with clear handoffs between agents
|
|
10
|
+
- **Modern tooling integration**: MLflow/W&B for experiments, Feast/Tecton for features, KServe/Seldon for serving
|
|
11
|
+
- **Production-first mindset**: Every component designed for scale, monitoring, and reliability
|
|
12
|
+
- **Reproducibility**: Version control for data, models, and infrastructure
|
|
13
|
+
- **Continuous improvement**: Automated retraining, A/B testing, and drift detection
|
|
14
|
+
|
|
15
|
+
The multi-agent approach ensures each aspect is handled by domain experts:
|
|
16
|
+
- Data engineers handle ingestion and quality
|
|
17
|
+
- Data scientists design features and experiments
|
|
18
|
+
- ML engineers implement training pipelines
|
|
19
|
+
- MLOps engineers handle production deployment
|
|
20
|
+
- Observability engineers ensure monitoring
|
|
21
|
+
|
|
22
|
+
## Phase 1: Data & Requirements Analysis
|
|
23
|
+
|
|
24
|
+
<Task>
|
|
25
|
+
subagent_type: data-engineer
|
|
26
|
+
prompt: |
|
|
27
|
+
Analyze and design data pipeline for ML system with requirements: $ARGUMENTS
|
|
28
|
+
|
|
29
|
+
Deliverables:
|
|
30
|
+
1. Data source audit and ingestion strategy:
|
|
31
|
+
- Source systems and connection patterns
|
|
32
|
+
- Schema validation using Pydantic/Great Expectations
|
|
33
|
+
- Data versioning with DVC or lakeFS
|
|
34
|
+
- Incremental loading and CDC strategies
|
|
35
|
+
|
|
36
|
+
2. Data quality framework:
|
|
37
|
+
- Profiling and statistics generation
|
|
38
|
+
- Anomaly detection rules
|
|
39
|
+
- Data lineage tracking
|
|
40
|
+
- Quality gates and SLAs
|
|
41
|
+
|
|
42
|
+
3. Storage architecture:
|
|
43
|
+
- Raw/processed/feature layers
|
|
44
|
+
- Partitioning strategy
|
|
45
|
+
- Retention policies
|
|
46
|
+
- Cost optimization
|
|
47
|
+
|
|
48
|
+
Provide implementation code for critical components and integration patterns.
|
|
49
|
+
</Task>
|
|
50
|
+
|
|
51
|
+
<Task>
|
|
52
|
+
subagent_type: data-scientist
|
|
53
|
+
prompt: |
|
|
54
|
+
Design feature engineering and model requirements for: $ARGUMENTS
|
|
55
|
+
Using data architecture from: {phase1.data-engineer.output}
|
|
56
|
+
|
|
57
|
+
Deliverables:
|
|
58
|
+
1. Feature engineering pipeline:
|
|
59
|
+
- Transformation specifications
|
|
60
|
+
- Feature store schema (Feast/Tecton)
|
|
61
|
+
- Statistical validation rules
|
|
62
|
+
- Handling strategies for missing data/outliers
|
|
63
|
+
|
|
64
|
+
2. Model requirements:
|
|
65
|
+
- Algorithm selection rationale
|
|
66
|
+
- Performance metrics and baselines
|
|
67
|
+
- Training data requirements
|
|
68
|
+
- Evaluation criteria and thresholds
|
|
69
|
+
|
|
70
|
+
3. Experiment design:
|
|
71
|
+
- Hypothesis and success metrics
|
|
72
|
+
- A/B testing methodology
|
|
73
|
+
- Sample size calculations
|
|
74
|
+
- Bias detection approach
|
|
75
|
+
|
|
76
|
+
Include feature transformation code and statistical validation logic.
|
|
77
|
+
</Task>
|
|
78
|
+
|
|
79
|
+
## Phase 2: Model Development & Training
|
|
80
|
+
|
|
81
|
+
<Task>
|
|
82
|
+
subagent_type: ml-engineer
|
|
83
|
+
prompt: |
|
|
84
|
+
Implement training pipeline based on requirements: {phase1.data-scientist.output}
|
|
85
|
+
Using data pipeline: {phase1.data-engineer.output}
|
|
86
|
+
|
|
87
|
+
Build comprehensive training system:
|
|
88
|
+
1. Training pipeline implementation:
|
|
89
|
+
- Modular training code with clear interfaces
|
|
90
|
+
- Hyperparameter optimization (Optuna/Ray Tune)
|
|
91
|
+
- Distributed training support (Horovod/PyTorch DDP)
|
|
92
|
+
- Cross-validation and ensemble strategies
|
|
93
|
+
|
|
94
|
+
2. Experiment tracking setup:
|
|
95
|
+
- MLflow/Weights & Biases integration
|
|
96
|
+
- Metric logging and visualization
|
|
97
|
+
- Artifact management (models, plots, data samples)
|
|
98
|
+
- Experiment comparison and analysis tools
|
|
99
|
+
|
|
100
|
+
3. Model registry integration:
|
|
101
|
+
- Version control and tagging strategy
|
|
102
|
+
- Model metadata and lineage
|
|
103
|
+
- Promotion workflows (dev -> staging -> prod)
|
|
104
|
+
- Rollback procedures
|
|
105
|
+
|
|
106
|
+
Provide complete training code with configuration management.
|
|
107
|
+
</Task>
|
|
108
|
+
|
|
109
|
+
<Task>
|
|
110
|
+
subagent_type: python-pro
|
|
111
|
+
prompt: |
|
|
112
|
+
Optimize and productionize ML code from: {phase2.ml-engineer.output}
|
|
113
|
+
|
|
114
|
+
Focus areas:
|
|
115
|
+
1. Code quality and structure:
|
|
116
|
+
- Refactor for production standards
|
|
117
|
+
- Add comprehensive error handling
|
|
118
|
+
- Implement proper logging with structured formats
|
|
119
|
+
- Create reusable components and utilities
|
|
120
|
+
|
|
121
|
+
2. Performance optimization:
|
|
122
|
+
- Profile and optimize bottlenecks
|
|
123
|
+
- Implement caching strategies
|
|
124
|
+
- Optimize data loading and preprocessing
|
|
125
|
+
- Memory management for large-scale training
|
|
126
|
+
|
|
127
|
+
3. Testing framework:
|
|
128
|
+
- Unit tests for data transformations
|
|
129
|
+
- Integration tests for pipeline components
|
|
130
|
+
- Model quality tests (invariance, directional)
|
|
131
|
+
- Performance regression tests
|
|
132
|
+
|
|
133
|
+
Deliver production-ready, maintainable code with full test coverage.
|
|
134
|
+
</Task>
|
|
135
|
+
|
|
136
|
+
## Phase 3: Production Deployment & Serving
|
|
137
|
+
|
|
138
|
+
<Task>
|
|
139
|
+
subagent_type: mlops-engineer
|
|
140
|
+
prompt: |
|
|
141
|
+
Design production deployment for models from: {phase2.ml-engineer.output}
|
|
142
|
+
With optimized code from: {phase2.python-pro.output}
|
|
143
|
+
|
|
144
|
+
Implementation requirements:
|
|
145
|
+
1. Model serving infrastructure:
|
|
146
|
+
- REST/gRPC APIs with FastAPI/TorchServe
|
|
147
|
+
- Batch prediction pipelines (Airflow/Kubeflow)
|
|
148
|
+
- Stream processing (Kafka/Kinesis integration)
|
|
149
|
+
- Model serving platforms (KServe/Seldon Core)
|
|
150
|
+
|
|
151
|
+
2. Deployment strategies:
|
|
152
|
+
- Blue-green deployments for zero downtime
|
|
153
|
+
- Canary releases with traffic splitting
|
|
154
|
+
- Shadow deployments for validation
|
|
155
|
+
- A/B testing infrastructure
|
|
156
|
+
|
|
157
|
+
3. CI/CD pipeline:
|
|
158
|
+
- GitHub Actions/GitLab CI workflows
|
|
159
|
+
- Automated testing gates
|
|
160
|
+
- Model validation before deployment
|
|
161
|
+
- ArgoCD for GitOps deployment
|
|
162
|
+
|
|
163
|
+
4. Infrastructure as Code:
|
|
164
|
+
- Terraform modules for cloud resources
|
|
165
|
+
- Helm charts for Kubernetes deployments
|
|
166
|
+
- Docker multi-stage builds for optimization
|
|
167
|
+
- Secret management with Vault/Secrets Manager
|
|
168
|
+
|
|
169
|
+
Provide complete deployment configuration and automation scripts.
|
|
170
|
+
</Task>
|
|
171
|
+
|
|
172
|
+
<Task>
|
|
173
|
+
subagent_type: kubernetes-architect
|
|
174
|
+
prompt: |
|
|
175
|
+
Design Kubernetes infrastructure for ML workloads from: {phase3.mlops-engineer.output}
|
|
176
|
+
|
|
177
|
+
Kubernetes-specific requirements:
|
|
178
|
+
1. Workload orchestration:
|
|
179
|
+
- Training job scheduling with Kubeflow
|
|
180
|
+
- GPU resource allocation and sharing
|
|
181
|
+
- Spot/preemptible instance integration
|
|
182
|
+
- Priority classes and resource quotas
|
|
183
|
+
|
|
184
|
+
2. Serving infrastructure:
|
|
185
|
+
- HPA/VPA for autoscaling
|
|
186
|
+
- KEDA for event-driven scaling
|
|
187
|
+
- Istio service mesh for traffic management
|
|
188
|
+
- Model caching and warm-up strategies
|
|
189
|
+
|
|
190
|
+
3. Storage and data access:
|
|
191
|
+
- PVC strategies for training data
|
|
192
|
+
- Model artifact storage with CSI drivers
|
|
193
|
+
- Distributed storage for feature stores
|
|
194
|
+
- Cache layers for inference optimization
|
|
195
|
+
|
|
196
|
+
Provide Kubernetes manifests and Helm charts for entire ML platform.
|
|
197
|
+
</Task>
|
|
198
|
+
|
|
199
|
+
## Phase 4: Monitoring & Continuous Improvement
|
|
200
|
+
|
|
201
|
+
<Task>
|
|
202
|
+
subagent_type: observability-engineer
|
|
203
|
+
prompt: |
|
|
204
|
+
Implement comprehensive monitoring for ML system deployed in: {phase3.mlops-engineer.output}
|
|
205
|
+
Using Kubernetes infrastructure: {phase3.kubernetes-architect.output}
|
|
206
|
+
|
|
207
|
+
Monitoring framework:
|
|
208
|
+
1. Model performance monitoring:
|
|
209
|
+
- Prediction accuracy tracking
|
|
210
|
+
- Latency and throughput metrics
|
|
211
|
+
- Feature importance shifts
|
|
212
|
+
- Business KPI correlation
|
|
213
|
+
|
|
214
|
+
2. Data and model drift detection:
|
|
215
|
+
- Statistical drift detection (KS test, PSI)
|
|
216
|
+
- Concept drift monitoring
|
|
217
|
+
- Feature distribution tracking
|
|
218
|
+
- Automated drift alerts and reports
|
|
219
|
+
|
|
220
|
+
3. System observability:
|
|
221
|
+
- Prometheus metrics for all components
|
|
222
|
+
- Grafana dashboards for visualization
|
|
223
|
+
- Distributed tracing with Jaeger/Zipkin
|
|
224
|
+
- Log aggregation with ELK/Loki
|
|
225
|
+
|
|
226
|
+
4. Alerting and automation:
|
|
227
|
+
- PagerDuty/Opsgenie integration
|
|
228
|
+
- Automated retraining triggers
|
|
229
|
+
- Performance degradation workflows
|
|
230
|
+
- Incident response runbooks
|
|
231
|
+
|
|
232
|
+
5. Cost tracking:
|
|
233
|
+
- Resource utilization metrics
|
|
234
|
+
- Cost allocation by model/experiment
|
|
235
|
+
- Optimization recommendations
|
|
236
|
+
- Budget alerts and controls
|
|
237
|
+
|
|
238
|
+
Deliver monitoring configuration, dashboards, and alert rules.
|
|
239
|
+
</Task>
|
|
240
|
+
|
|
241
|
+
## Configuration Options
|
|
242
|
+
|
|
243
|
+
- **experiment_tracking**: mlflow | wandb | neptune | clearml
|
|
244
|
+
- **feature_store**: feast | tecton | databricks | custom
|
|
245
|
+
- **serving_platform**: kserve | seldon | torchserve | triton
|
|
246
|
+
- **orchestration**: kubeflow | airflow | prefect | dagster
|
|
247
|
+
- **cloud_provider**: aws | azure | gcp | multi-cloud
|
|
248
|
+
- **deployment_mode**: realtime | batch | streaming | hybrid
|
|
249
|
+
- **monitoring_stack**: prometheus | datadog | newrelic | custom
|
|
250
|
+
|
|
251
|
+
## Success Criteria
|
|
252
|
+
|
|
253
|
+
1. **Data Pipeline Success**:
|
|
254
|
+
- < 0.1% data quality issues in production
|
|
255
|
+
- Automated data validation passing 99.9% of time
|
|
256
|
+
- Complete data lineage tracking
|
|
257
|
+
- Sub-second feature serving latency
|
|
258
|
+
|
|
259
|
+
2. **Model Performance**:
|
|
260
|
+
- Meeting or exceeding baseline metrics
|
|
261
|
+
- < 5% performance degradation before retraining
|
|
262
|
+
- Successful A/B tests with statistical significance
|
|
263
|
+
- No undetected model drift > 24 hours
|
|
264
|
+
|
|
265
|
+
3. **Operational Excellence**:
|
|
266
|
+
- 99.9% uptime for model serving
|
|
267
|
+
- < 200ms p99 inference latency
|
|
268
|
+
- Automated rollback within 5 minutes
|
|
269
|
+
- Complete observability with < 1 minute alert time
|
|
270
|
+
|
|
271
|
+
4. **Development Velocity**:
|
|
272
|
+
- < 1 hour from commit to production
|
|
273
|
+
- Parallel experiment execution
|
|
274
|
+
- Reproducible training runs
|
|
275
|
+
- Self-service model deployment
|
|
276
|
+
|
|
277
|
+
5. **Cost Efficiency**:
|
|
278
|
+
- < 20% infrastructure waste
|
|
279
|
+
- Optimized resource allocation
|
|
280
|
+
- Automatic scaling based on load
|
|
281
|
+
- Spot instance utilization > 60%
|
|
282
|
+
|
|
283
|
+
## Final Deliverables
|
|
284
|
+
|
|
285
|
+
Upon completion, the orchestrated pipeline will provide:
|
|
286
|
+
- End-to-end ML pipeline with full automation
|
|
287
|
+
- Comprehensive documentation and runbooks
|
|
288
|
+
- Production-ready infrastructure as code
|
|
289
|
+
- Complete monitoring and alerting system
|
|
290
|
+
- CI/CD pipelines for continuous improvement
|
|
291
|
+
- Cost optimization and scaling strategies
|
|
292
|
+
- Disaster recovery and rollback procedures
|