Files
Profa 416c97ab39 feat(learning): implement Six Hats Tier 0-2 improvements and fix test flakiness
Tier 0 (Bug Fixes):
- Fix promotion threshold inconsistency (standardized on 3)
- Add embedding backfill script and ghost pattern health check
- Add FTS5 virtual table with hybrid vector/text search

Tier 1 (Quick Wins):
- Binary reward assignment (+1/-1/0) for outcome-based learning
- At-least-one learning guarantee per session
- Temporal decay on search results (30-day half-life)
- Configurable promotion activity window
- Enable coherence gate by default

Tier 2 (Medium Investments):
- Pre-compaction flush hook to prevent knowledge loss
- OPD remediation hints ("bad because X, fix by Y")
- Per-agent MCP tool scoping for security isolation
- Daily Markdown log tier for audit trail
- Proof-of-Quality CLI command with SHA-256 attestation
- Devil's advocate scoring fixes (FTS normalization, cap, decay, freshness)

Test Fixes:
- Fix queen governance flakiness in domain-handlers tests
- Fix cross-suite singleton contamination in handler-factory and e2e tests
- Fix mcp-server domain tool timeout and invocation failures

610 test files pass, 0 failures, 18,589 tests green.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:43:23 +00:00

34 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Backfill real all-MiniLM-L6-v2 embeddings for patterns missing them.
* Skips bench/test patterns. Uses @xenova/transformers ONNX inference.
*/
import { SQLitePatternStore } from '../dist/learning/sqlite-persistence.js';
const store = new SQLitePatternStore({ dbPath: '.agentic-qe/memory.db', useUnified: false });
await store.initialize();
console.log('[Backfill] Starting embedding backfill with all-MiniLM-L6-v2...');
const startTime = performance.now();
try {
const result = await store.backfillEmbeddings(32);
const elapsed = ((performance.now() - startTime) / 1000).toFixed(1);
console.log('\n[Backfill] === Results ===');
console.log(` Method: ${result.method}`);
console.log(` Processed: ${result.processed}`);
console.log(` Skipped: ${result.skipped}`);
console.log(` Errors: ${result.errors}`);
console.log(` Already had: ${result.alreadyHad}`);
console.log(` Duration: ${elapsed}s`);
store.close();
process.exit(result.errors > 0 ? 1 : 0);
} catch (e) {
console.error('[Backfill] Fatal error:', e);
store.close();
process.exit(2);
}