π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
chore(memory): #2061 ADR-125 Phase 7 β RuVector boundary cleanup + no-stray-db CI smoke
ruv7dd4b525294b
diff --git a/scripts/smoke-memory-no-stray-db.mjs b/scripts/smoke-memory-no-stray-db.mjsnew file mode 100755index 0000000000..59d040827d--- /dev/null+++ b/scripts/smoke-memory-no-stray-db.mjs@@ -0,0 +1,100 @@+#!/usr/bin/env node+/**+ * Smoke: ADR-125 Phase 7 β no stray DB artifacts after `npm test` in @claude-flow/memory.+ *+ * The agentdb / @ruvector/rvf native bindings have a habit of writing+ * `ruvector.db` (and friends) to whatever cwd they're invoked from. ADR-125+ * Phase 7 wipes the artifacts via `vitest.setup.ts`; this smoke is the+ * behavioural guard that verifies the wipe actually works.+ *+ * Strategy:+ * 1. cd v3/@claude-flow/memory+ * 2. record `git status --porcelain .` as a baseline (untracked files that+ * already exist do not count against us β we are checking the DELTA).+ * 3. run `npm test`+ * 4. record `git status --porcelain .` again+ * 5. fail if any *.db / *.rvf / *.redb / *.lock file appears in the new+ * status that wasn't there before.+ *+ * Exit codes:+ * 0 β clean+ * 1 β stray DB file detected (or test run failed)+ *+ * Usage:+ * node scripts/smoke-memory-no-stray-db.mjs+ */++import { execFileSync, spawnSync } from 'node:child_process';+import { dirname, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';++const __dirname = dirname(fileURLToPath(import.meta.url));+const REPO_ROOT = resolve(__dirname, '..');+const PKG_DIR = resolve(REPO_ROOT, 'v3/@claude-flow/memory');++const FORBIDDEN_SUFFIXES = ['.db', '.db-journal', '.db-wal', '.rvf', '.redb'];++function gitStatusFiles() {+ const out = execFileSync('git', ['status', '--porcelain', PKG_DIR], {+ cwd: REPO_ROOT,+ encoding: 'utf8',+ });+ return out+ .split('\n')+ .filter((line) => line.trim().length > 0)+ .map((line) => line.slice(3)) // strip the two-char status + space+ .map((p) => p.trim());+}++function forbidden(files) {+ return files.filter((f) =>+ FORBIDDEN_SUFFIXES.some((suffix) => f.endsWith(suffix))+ );+}++console.log('[smoke] ADR-125 Phase 7 β no-stray-db check starting');+console.log('[smoke] package dir: ' + PKG_DIR);++const baseline = new Set(gitStatusFiles());+console.log('[smoke] baseline status entries: ' + baseline.size);+const baselineLeaks = forbidden([...baseline]);+if (baselineLeaks.length > 0) {+ console.warn(+ '[smoke] WARNING: baseline already contains DB-like artifacts (will be ignored for delta check):'+ );+ for (const f of baselineLeaks) console.warn(' ' + f);+}++console.log('[smoke] running `npm test` in package...');+const testRun = spawnSync('npm', ['test'], {+ cwd: PKG_DIR,+ stdio: 'inherit',+});+if (testRun.status !== 0) {+ console.error('[smoke] FAIL: `npm test` exited with status ' + testRun.status);+ process.exit(1);+}++const after = gitStatusFiles();+const newEntries = after.filter((f) => !baseline.has(f));+const newLeaks = forbidden(newEntries);++console.log('[smoke] status entries after test: ' + after.length);+console.log('[smoke] net-new entries: ' + newEntries.length);++if (newLeaks.length > 0) {+ console.error('[smoke] FAIL: stray DB-like artifacts created by test run:');+ for (const f of newLeaks) console.error(' ' + f);+ console.error('');+ console.error(+ '[smoke] vitest.setup.ts (ADR-125 Phase 7) is supposed to wipe these.'+ );+ console.error(+ '[smoke] If a new artifact type appeared, add its name/suffix to ' ++ 'KNOWN_LEAK_FILES or LEAK_SUFFIXES in vitest.setup.ts.'+ );+ process.exit(1);+}++console.log('[smoke] PASS: no stray DB artifacts after `npm test`');+process.exit(0);diff --git a/v3/@claude-flow/memory/.gitignore b/v3/@claude-flow/memory/.gitignorenew file mode 100644index 0000000000..bf106f213a--- /dev/null+++ b/v3/@claude-flow/memory/.gitignore@@ -0,0 +1,30 @@+# ADR-125 Phase 7 β package-local gitignore.+#+# `*.db` / `*.rvf` / `*.redb` are already ignored at the repo root, but+# we re-state them here so the package is self-contained and contributors+# editing inside the package directory get the same behaviour.++# Test pollution from agentdb / @ruvector/rvf β these files are written+# to the package root at runtime and must not be committed.+ruvector.db+*.db+*.db-journal+*.db-wal+*.rvf+*.rvf.lock+*.redb++# Build output (mirrors root .gitignore)+dist/+tsconfig.tsbuildinfo++# Test artifacts+test-*.db+test-*.rvf+test-*.json+tests/.tmp/+benchmarks/longmemeval/results/*.json+benchmarks/longmemeval/results/*.md++# Node modules (defensive β should never appear here in a workspace)+node_modules/diff --git a/v3/@claude-flow/memory/vitest.config.ts b/v3/@claude-flow/memory/vitest.config.tsindex 4334a06f28..358a28a61e 100644--- a/v3/@claude-flow/memory/vitest.config.ts+++ b/v3/@claude-flow/memory/vitest.config.ts@@ -9,5 +9,8 @@ export default defineConfig({hookTimeout: 10000,globals: false,typecheck: { enabled: false },+ // ADR-125 Phase 7 β wipe ruvector.db / *.rvf / *.redb stray artifacts+ // before and after each test run so no DB file leaks into git status.+ setupFiles: ['./vitest.setup.ts'],},});diff --git a/v3/@claude-flow/memory/vitest.setup.ts b/v3/@claude-flow/memory/vitest.setup.tsnew file mode 100644index 0000000000..f7ff2bdc4a--- /dev/null+++ b/v3/@claude-flow/memory/vitest.setup.ts@@ -0,0 +1,81 @@+/**+ * Vitest global setup β ADR-125 Phase 7 (RuVector boundary cleanup).+ *+ * The agentdb / @ruvector/rvf native bindings write a `ruvector.db` redb file+ * to the package's cwd as a side-effect of any code path that touches the+ * vector store. The file is test pollution β it has no source reference in+ * `src/**` and recreates itself on demand. This setup file wipes it before+ * and after the test run so each fresh test session starts from a known state+ * and CI smokes do not see stray DB files in `git status` after `npm test`.+ *+ * Wired into `vitest.config.ts` via `setupFiles: ['./vitest.setup.ts']`.+ *+ * @see ../../docs/adr/ADR-125-memory-consolidation.md Phase 7.+ */++import { afterAll, beforeAll } from 'vitest';+import { existsSync, unlinkSync, readdirSync } from 'node:fs';+import { dirname, join, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';++const __dirname = dirname(fileURLToPath(import.meta.url));++/**+ * Files that are known to leak into the package root from test code or from+ * the native bindings. Extend this list if a new artifact appears.+ */+const KNOWN_LEAK_FILES = [+ 'ruvector.db',+ 'ruvector.db-journal',+ 'ruvector.db-wal',+ 'test-database-provider.db',+ 'test-database-provider.rvf',+ 'agentdb.rvf.lock',+];++/**+ * Glob-ish suffixes that should be wiped on cleanup. We are deliberately+ * conservative β only files matching exact suffixes are removed, and only+ * from the package root (not recursively).+ */+const LEAK_SUFFIXES = ['.db', '.rvf', '.redb', '.db-journal', '.db-wal'];++function cleanupRoot(): void {+ const root = resolve(__dirname);+ try {+ const entries = readdirSync(root);+ for (const entry of entries) {+ if (KNOWN_LEAK_FILES.includes(entry)) {+ try {+ unlinkSync(join(root, entry));+ } catch {+ // Best-effort cleanup; ignore if the file vanished between readdir+ // and unlink.+ }+ continue;+ }+ // Suffix-based cleanup for stray test artifacts (test-*.db, *.rvf, etc.).+ // Excludes node_modules / dist / src / benchmarks / docs.+ if (+ LEAK_SUFFIXES.some((suffix) => entry.endsWith(suffix)) &&+ !entry.startsWith('.')+ ) {+ try {+ unlinkSync(join(root, entry));+ } catch {+ // ignore+ }+ }+ }+ } catch {+ // readdir can fail in unusual CI sandboxes; treat as no-op.+ }+}++beforeAll(() => {+ cleanupRoot();+});++afterAll(() => {+ cleanupRoot();+});