agentic-qe 3.7.17 → 3.7.19
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/skills/iterative-loop/SKILL.md +371 -0
- package/.claude/skills/skills-manifest.json +36 -8
- package/.claude/skills/validation-pipeline/SKILL.md +164 -0
- package/.claude/skills/validation-pipeline/evals/validation-pipeline.yaml +544 -0
- package/.claude/skills/validation-pipeline/schemas/output.json +193 -0
- package/.claude/skills/validation-pipeline/scripts/validate-config.json +34 -0
- package/CHANGELOG.md +7 -0
- package/README.md +5 -3
- package/assets/skills/skills-manifest.json +17 -1
- package/assets/skills/validation-pipeline/SKILL.md +164 -0
- package/assets/skills/validation-pipeline/evals/validation-pipeline.yaml +544 -0
- package/assets/skills/validation-pipeline/schemas/output.json +193 -0
- package/assets/skills/validation-pipeline/scripts/validate-config.json +34 -0
- package/dist/cli/bundle.js +29 -20
- package/dist/context/compiler.js +4 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +2 -0
- package/dist/context/sources/defect-source.d.ts +17 -0
- package/dist/context/sources/defect-source.js +102 -0
- package/dist/context/sources/index.d.ts +2 -0
- package/dist/context/sources/index.js +2 -0
- package/dist/context/sources/requirements-source.d.ts +17 -0
- package/dist/context/sources/requirements-source.js +119 -0
- package/dist/coordination/task-executor.js +7 -1
- package/dist/coordination/yaml-pipeline-loader.d.ts +32 -0
- package/dist/coordination/yaml-pipeline-loader.js +389 -0
- package/dist/coordination/yaml-pipeline-registry.d.ts +61 -0
- package/dist/coordination/yaml-pipeline-registry.js +143 -0
- package/dist/init/agents-installer.js +15 -8
- package/dist/init/phases/09-assets.js +15 -10
- package/dist/mcp/bundle.js +8670 -1244
- package/dist/mcp/entry.js +21 -0
- package/dist/mcp/handlers/domain-handler-configs.js +11 -0
- package/dist/mcp/handlers/index.d.ts +2 -0
- package/dist/mcp/handlers/index.js +4 -0
- package/dist/mcp/handlers/pipeline-handlers.d.ts +75 -0
- package/dist/mcp/handlers/pipeline-handlers.js +208 -0
- package/dist/mcp/handlers/validation-pipeline-handler.d.ts +53 -0
- package/dist/mcp/handlers/validation-pipeline-handler.js +118 -0
- package/dist/mcp/protocol-server.js +167 -1
- package/dist/mcp/server.js +75 -1
- package/dist/workers/daemon.js +3 -2
- package/dist/workers/index.d.ts +6 -0
- package/dist/workers/index.js +6 -0
- package/dist/workers/workers/heartbeat-scheduler.d.ts +45 -0
- package/dist/workers/workers/heartbeat-scheduler.js +312 -0
- package/dist/workers/workers/index.d.ts +2 -1
- package/dist/workers/workers/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Heartbeat Scheduler Worker
|
|
3
|
+
* Imp-10: Token-Free Heartbeat Scheduling
|
|
4
|
+
*
|
|
5
|
+
* Lightweight background worker performing SQL-only maintenance
|
|
6
|
+
* every 30 minutes with ZERO LLM token usage:
|
|
7
|
+
* - Pattern promotion checks
|
|
8
|
+
* - Stale pattern detection
|
|
9
|
+
* - Confidence decay application
|
|
10
|
+
* - Experience buffer monitoring
|
|
11
|
+
* - Daily Markdown log entries
|
|
12
|
+
*/
|
|
13
|
+
import { BaseWorker } from '../base-worker.js';
|
|
14
|
+
import { createPatternLifecycleManager, } from '../../learning/pattern-lifecycle.js';
|
|
15
|
+
import { getUnifiedMemory } from '../../kernel/unified-memory.js';
|
|
16
|
+
import { DailyLogger } from '../../learning/daily-log.js';
|
|
17
|
+
import { toErrorMessage } from '../../shared/error-utils.js';
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Configuration
|
|
20
|
+
// ============================================================================
|
|
21
|
+
const CONFIG = {
|
|
22
|
+
id: 'heartbeat-scheduler',
|
|
23
|
+
name: 'Heartbeat Scheduler',
|
|
24
|
+
description: 'Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring',
|
|
25
|
+
intervalMs: 30 * 60 * 1000, // 30 minutes
|
|
26
|
+
priority: 'normal',
|
|
27
|
+
targetDomains: ['learning-optimization'],
|
|
28
|
+
enabled: true,
|
|
29
|
+
timeoutMs: 60000, // 1 minute max (SQL only, should be fast)
|
|
30
|
+
retryCount: 1,
|
|
31
|
+
retryDelayMs: 5000,
|
|
32
|
+
};
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Worker Implementation
|
|
35
|
+
// ============================================================================
|
|
36
|
+
export class HeartbeatSchedulerWorker extends BaseWorker {
|
|
37
|
+
lifecycleManager = null;
|
|
38
|
+
dailyLogger;
|
|
39
|
+
lastRunTimestamp = 0;
|
|
40
|
+
constructor() {
|
|
41
|
+
super(CONFIG);
|
|
42
|
+
this.dailyLogger = new DailyLogger();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Initialize or retrieve the PatternLifecycleManager.
|
|
46
|
+
* Returns null when unified memory is unavailable (graceful degradation).
|
|
47
|
+
*/
|
|
48
|
+
async getLifecycleManager() {
|
|
49
|
+
if (this.lifecycleManager) {
|
|
50
|
+
return this.lifecycleManager;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const unifiedMemory = getUnifiedMemory();
|
|
54
|
+
await unifiedMemory.initialize();
|
|
55
|
+
const db = unifiedMemory.getDatabase();
|
|
56
|
+
this.lifecycleManager = createPatternLifecycleManager(db, {
|
|
57
|
+
promotionRewardThreshold: 0.7,
|
|
58
|
+
promotionMinOccurrences: 2,
|
|
59
|
+
promotionMinSuccessRate: 0.7,
|
|
60
|
+
deprecationFailureThreshold: 3,
|
|
61
|
+
staleDaysThreshold: 30,
|
|
62
|
+
confidenceDecayRate: 0.01,
|
|
63
|
+
minActiveConfidence: 0.3,
|
|
64
|
+
});
|
|
65
|
+
return this.lifecycleManager;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Query pending experience count from the database.
|
|
73
|
+
* Returns 0 if table or query fails.
|
|
74
|
+
*/
|
|
75
|
+
getPendingExperienceCount() {
|
|
76
|
+
try {
|
|
77
|
+
const unifiedMemory = getUnifiedMemory();
|
|
78
|
+
const db = unifiedMemory.getDatabase();
|
|
79
|
+
const row = db
|
|
80
|
+
.prepare(`SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')`)
|
|
81
|
+
.get();
|
|
82
|
+
return row?.pending ?? 0;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// ============================================================================
|
|
89
|
+
// Core Execution
|
|
90
|
+
// ============================================================================
|
|
91
|
+
async doExecute(context) {
|
|
92
|
+
const startTime = Date.now();
|
|
93
|
+
context.logger.info('Heartbeat scheduler running (token-free maintenance)');
|
|
94
|
+
const findings = [];
|
|
95
|
+
const recommendations = [];
|
|
96
|
+
const lifecycleManager = await this.getLifecycleManager();
|
|
97
|
+
// Graceful degradation: no database available
|
|
98
|
+
if (!lifecycleManager) {
|
|
99
|
+
context.logger.warn('Unified memory unavailable — returning zero-metric heartbeat');
|
|
100
|
+
return this.createResult(Date.now() - startTime, {
|
|
101
|
+
itemsAnalyzed: 0,
|
|
102
|
+
issuesFound: 0,
|
|
103
|
+
healthScore: 50,
|
|
104
|
+
trend: 'stable',
|
|
105
|
+
domainMetrics: {
|
|
106
|
+
promoted: 0,
|
|
107
|
+
deprecated: 0,
|
|
108
|
+
decayed: 0,
|
|
109
|
+
stalePatterns: 0,
|
|
110
|
+
pendingExperiences: 0,
|
|
111
|
+
avgConfidence: 0,
|
|
112
|
+
avgSuccessRate: 0,
|
|
113
|
+
},
|
|
114
|
+
}, [], []);
|
|
115
|
+
}
|
|
116
|
+
// --- 1. Pattern Promotion ---
|
|
117
|
+
let promoted = 0;
|
|
118
|
+
let promotionChecked = 0;
|
|
119
|
+
try {
|
|
120
|
+
const promotionResult = lifecycleManager.promoteEligiblePatterns();
|
|
121
|
+
promoted = promotionResult.promoted;
|
|
122
|
+
promotionChecked = promotionResult.checked;
|
|
123
|
+
if (promoted > 0) {
|
|
124
|
+
findings.push({
|
|
125
|
+
type: 'heartbeat-promotion',
|
|
126
|
+
severity: 'info',
|
|
127
|
+
domain: 'learning-optimization',
|
|
128
|
+
title: 'Patterns Promoted',
|
|
129
|
+
description: `${promoted} of ${promotionChecked} short-term patterns promoted to long-term`,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
context.logger.warn('Pattern promotion failed', {
|
|
135
|
+
error: toErrorMessage(error),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
// --- 2. Stale Pattern Detection ---
|
|
139
|
+
let deprecated = 0;
|
|
140
|
+
let deprecationChecked = 0;
|
|
141
|
+
try {
|
|
142
|
+
const deprecationResult = lifecycleManager.deprecateStalePatterns();
|
|
143
|
+
deprecated = deprecationResult.deprecated;
|
|
144
|
+
deprecationChecked = deprecationResult.checked;
|
|
145
|
+
if (deprecated > 0) {
|
|
146
|
+
findings.push({
|
|
147
|
+
type: 'heartbeat-deprecation',
|
|
148
|
+
severity: 'low',
|
|
149
|
+
domain: 'learning-optimization',
|
|
150
|
+
title: 'Stale Patterns Deprecated',
|
|
151
|
+
description: `${deprecated} of ${deprecationChecked} patterns deprecated (stale, failed, or low confidence)`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
context.logger.warn('Stale pattern detection failed', {
|
|
157
|
+
error: toErrorMessage(error),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// --- 3. Confidence Decay ---
|
|
161
|
+
let decayed = 0;
|
|
162
|
+
try {
|
|
163
|
+
const daysSinceLastRun = this.lastRunTimestamp > 0
|
|
164
|
+
? (Date.now() - this.lastRunTimestamp) / (1000 * 60 * 60 * 24)
|
|
165
|
+
: 1;
|
|
166
|
+
const decayResult = lifecycleManager.applyConfidenceDecay(Math.min(daysSinceLastRun, 7));
|
|
167
|
+
decayed = decayResult.decayed;
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
context.logger.warn('Confidence decay failed', {
|
|
171
|
+
error: toErrorMessage(error),
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
// --- 4. Experience Buffer Status ---
|
|
175
|
+
const pendingExperiences = this.getPendingExperienceCount();
|
|
176
|
+
// --- 5. Pattern Health Summary ---
|
|
177
|
+
let stats = {
|
|
178
|
+
totalPatterns: 0,
|
|
179
|
+
activePatterns: 0,
|
|
180
|
+
deprecatedPatterns: 0,
|
|
181
|
+
promotedPatterns: 0,
|
|
182
|
+
shortTermPatterns: 0,
|
|
183
|
+
longTermPatterns: 0,
|
|
184
|
+
avgConfidence: 0,
|
|
185
|
+
avgSuccessRate: 0,
|
|
186
|
+
patternsNearDeprecation: 0,
|
|
187
|
+
};
|
|
188
|
+
try {
|
|
189
|
+
stats = lifecycleManager.getStats();
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
context.logger.warn('Stats retrieval failed', {
|
|
193
|
+
error: toErrorMessage(error),
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
// --- 6. Daily Log Entry ---
|
|
197
|
+
try {
|
|
198
|
+
this.dailyLogger.log({
|
|
199
|
+
timestamp: new Date(),
|
|
200
|
+
type: 'pattern-promoted',
|
|
201
|
+
summary: `Heartbeat: ${promoted} promoted, ${deprecated} deprecated, ` +
|
|
202
|
+
`${decayed} decayed, ${pendingExperiences} pending exp, ` +
|
|
203
|
+
`${stats.activePatterns} active patterns (avg conf: ${stats.avgConfidence.toFixed(2)})`,
|
|
204
|
+
details: {
|
|
205
|
+
promoted,
|
|
206
|
+
deprecated,
|
|
207
|
+
decayed,
|
|
208
|
+
pendingExperiences,
|
|
209
|
+
totalPatterns: stats.totalPatterns,
|
|
210
|
+
activePatterns: stats.activePatterns,
|
|
211
|
+
avgConfidence: stats.avgConfidence,
|
|
212
|
+
avgSuccessRate: stats.avgSuccessRate,
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
this.dailyLogger.flush();
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
context.logger.warn('Daily log write failed', {
|
|
219
|
+
error: toErrorMessage(error),
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
// Update last run timestamp for next decay calculation
|
|
223
|
+
this.lastRunTimestamp = Date.now();
|
|
224
|
+
// --- Recommendations ---
|
|
225
|
+
if (stats.activePatterns > 0 &&
|
|
226
|
+
stats.patternsNearDeprecation / stats.activePatterns > 0.5) {
|
|
227
|
+
recommendations.push({
|
|
228
|
+
priority: 'p2',
|
|
229
|
+
domain: 'learning-optimization',
|
|
230
|
+
action: 'Review At-Risk Patterns',
|
|
231
|
+
description: `${stats.patternsNearDeprecation} of ${stats.activePatterns} active patterns are near deprecation. Manual review recommended.`,
|
|
232
|
+
estimatedImpact: 'medium',
|
|
233
|
+
effort: 'low',
|
|
234
|
+
autoFixable: false,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
// --- Health Score Calculation ---
|
|
238
|
+
const healthScore = this.calculateHealthScore(stats, promoted, deprecated);
|
|
239
|
+
// --- Trend ---
|
|
240
|
+
const trend = this.determineTrend(promoted, deprecated, stats.activePatterns);
|
|
241
|
+
const totalChecked = Math.max(promotionChecked, deprecationChecked);
|
|
242
|
+
const issuesFound = promoted + deprecated + stats.patternsNearDeprecation;
|
|
243
|
+
context.logger.info('Heartbeat complete', {
|
|
244
|
+
promoted,
|
|
245
|
+
deprecated,
|
|
246
|
+
decayed,
|
|
247
|
+
pendingExperiences,
|
|
248
|
+
healthScore,
|
|
249
|
+
});
|
|
250
|
+
return this.createResult(Date.now() - startTime, {
|
|
251
|
+
itemsAnalyzed: totalChecked,
|
|
252
|
+
issuesFound,
|
|
253
|
+
healthScore,
|
|
254
|
+
trend,
|
|
255
|
+
domainMetrics: {
|
|
256
|
+
promoted,
|
|
257
|
+
deprecated,
|
|
258
|
+
decayed,
|
|
259
|
+
stalePatterns: stats.patternsNearDeprecation,
|
|
260
|
+
pendingExperiences,
|
|
261
|
+
avgConfidence: Number(stats.avgConfidence.toFixed(3)),
|
|
262
|
+
avgSuccessRate: Number(stats.avgSuccessRate.toFixed(3)),
|
|
263
|
+
},
|
|
264
|
+
}, findings, recommendations);
|
|
265
|
+
}
|
|
266
|
+
// ============================================================================
|
|
267
|
+
// Helpers
|
|
268
|
+
// ============================================================================
|
|
269
|
+
/**
|
|
270
|
+
* Calculate a 0-100 health score from lifecycle stats.
|
|
271
|
+
*
|
|
272
|
+
* - Base: 70
|
|
273
|
+
* - Bonus for promotions (active learning)
|
|
274
|
+
* - Penalty for high deprecation rate
|
|
275
|
+
* - Penalty for low average confidence
|
|
276
|
+
*/
|
|
277
|
+
calculateHealthScore(stats, promoted, deprecated) {
|
|
278
|
+
let score = 70;
|
|
279
|
+
// Promotion bonus (max +15)
|
|
280
|
+
score += Math.min(15, promoted * 5);
|
|
281
|
+
// Confidence bonus/penalty (max +/-15)
|
|
282
|
+
if (stats.avgConfidence > 0) {
|
|
283
|
+
score += Math.round((stats.avgConfidence - 0.5) * 30);
|
|
284
|
+
}
|
|
285
|
+
// Deprecation penalty
|
|
286
|
+
if (stats.activePatterns > 0) {
|
|
287
|
+
const deprecationRate = deprecated / stats.activePatterns;
|
|
288
|
+
score -= Math.round(deprecationRate * 20);
|
|
289
|
+
}
|
|
290
|
+
// Near-deprecation penalty
|
|
291
|
+
if (stats.activePatterns > 0) {
|
|
292
|
+
const atRiskRate = stats.patternsNearDeprecation / stats.activePatterns;
|
|
293
|
+
if (atRiskRate > 0.5) {
|
|
294
|
+
score -= 10;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return Math.max(0, Math.min(100, Math.round(score)));
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Determine the trend direction.
|
|
301
|
+
*/
|
|
302
|
+
determineTrend(promoted, deprecated, activePatterns) {
|
|
303
|
+
if (activePatterns === 0)
|
|
304
|
+
return 'stable';
|
|
305
|
+
if (promoted > deprecated)
|
|
306
|
+
return 'improving';
|
|
307
|
+
if (deprecated > promoted && deprecated / activePatterns > 0.1)
|
|
308
|
+
return 'degrading';
|
|
309
|
+
return 'stable';
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=heartbeat-scheduler.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agentic QE v3 - Worker Exports
|
|
3
3
|
* ADR-014: Background Workers for QE Monitoring
|
|
4
4
|
*
|
|
5
|
-
* Exports all
|
|
5
|
+
* Exports all 12 QE-specific background workers.
|
|
6
6
|
*/
|
|
7
7
|
export { TestHealthWorker } from './test-health.js';
|
|
8
8
|
export { CoverageTrackerWorker } from './coverage-tracker.js';
|
|
@@ -15,4 +15,5 @@ export { RegressionMonitorWorker } from './regression-monitor.js';
|
|
|
15
15
|
export { PerformanceBaselineWorker } from './performance-baseline.js';
|
|
16
16
|
export { ComplianceCheckerWorker } from './compliance-checker.js';
|
|
17
17
|
export { CloudSyncWorker } from './cloud-sync.js';
|
|
18
|
+
export { HeartbeatSchedulerWorker } from './heartbeat-scheduler.js';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agentic QE v3 - Worker Exports
|
|
3
3
|
* ADR-014: Background Workers for QE Monitoring
|
|
4
4
|
*
|
|
5
|
-
* Exports all
|
|
5
|
+
* Exports all 12 QE-specific background workers.
|
|
6
6
|
*/
|
|
7
7
|
export { TestHealthWorker } from './test-health.js';
|
|
8
8
|
export { CoverageTrackerWorker } from './coverage-tracker.js';
|
|
@@ -15,4 +15,5 @@ export { RegressionMonitorWorker } from './regression-monitor.js';
|
|
|
15
15
|
export { PerformanceBaselineWorker } from './performance-baseline.js';
|
|
16
16
|
export { ComplianceCheckerWorker } from './compliance-checker.js';
|
|
17
17
|
export { CloudSyncWorker } from './cloud-sync.js';
|
|
18
|
+
export { HeartbeatSchedulerWorker } from './heartbeat-scheduler.js';
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-qe",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.19",
|
|
4
4
|
"description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|