Summary
On a fresh project, ak setup → ak dual run feature "<task>" cannot generate code due to two defects in ruflo's native SQLite memory substrate:
- Under npm 12,
ak setup installs ruflo without compiling the bundled better-sqlite3 native bindings (npm 12's allow-scripts blocks the install script). ruflo's native memory is non-functional, and ak status false-positives ✓ natives. - Once the bindings are present (npm ≤11, or npm 12 after a manual build),
ak dual run feature fails with a native-WAL-vs-WASM conflict at the first shared-memory write.
Happy to split into two issues if preferred — they're tightly coupled (Defect 2 is what users hit after working around Defect 1).
Environment
- agentic-kit (
ak) 4.0.0-alpha.21 · ruflo 3.32.9 · agentic-qe 3.13.1 - Verified across two clean local
ruflo installs: npm 10.9.4 / node 22 (bindings build) vs npm 12.0.1 / node 24 (bindings don't build).
Defect 1 — native better-sqlite3 bindings not built under npm 12
Clean local repro (no global mutation):
mkdir t &&cd t && npm init -y && npm install ruflo # under npm 12
find node_modules -name better_sqlite3.node | wc -l # -> 0# install log: "N packages had install scripts blocked because they are not covered by allowScripts"
Contrast under npm 10 (same steps): 3/3better_sqlite3.node built, no warning.
Impact:ruflo doctor → ✗ Memory Structural Integrity: better-sqlite3 failed to open: Could not locate the bindings file; ruflo status → Memory Backend: none, RuFlo V3 [STOPPED]. ak status still reports ✓ natives — a false positive, because it only inspects the agentdb copy of better-sqlite3 (which builds), not the @claude-flow/cli or @claude-flow/memory copies (which don't).
Expected:ak setup / ak sync builds and verifies all three better-sqlite3 instances (force the install scripts, or restore prebuilt binaries), and ak status's "natives" check load-tests the binding ruflo uses at runtime — not just the agentdb copy.
Defect 2 — ak dual run native↔WASM memory conflict (binding-present systems)
Repro (any system with working bindings, CLAUDE_FLOW_DB_PATH exported):
export CLAUDE_FLOW_DB_PATH="$PWD/.swarm/memory.db"
ak dual run feature "create a tiny hello package"
Fails at the first shared-memory write:
Error: … npx ruflo memory store --key task-context …
[ERROR] memory database has an active native WAL connection (found -wal/-shm sidecar files)
— refusing an unsafe sql.js whole-image write. Retry once the native writer completes,
or restore the native better-sqlite3 bridge.
at @claude-flow/codex/dist/dual-mode/orchestrator.js:267
Cause: the claude-flow-codex dual orchestrator opens a native better-sqlite3 WAL connection on memory.db, then shells out to npx ruflo memory store, which uses sql.js (WASM) — ruflo memory init advertises "sql.js (WASM SQLite)", and npx ruflo resolves to the global ruflo (verified: no fetch). WASM refuses to whole-image-write over an active native WAL. Reproduced with bindings built via prebuild-install (the same mechanism npm ≤11 uses), so this is not specific to a manual node-gyp build.
Expected: the orchestrator and the npx ruflo memory subprocess agree on one SQLite backend (native) — route memory store through the native bridge, or don't hold a native connection across the npx call.
Workaround (clears Defect 1; exposes Defect 2)
# Build each missing binding directly (npm rebuild is also blocked by allow-scripts):cd"$(npm root -g)/ruflo/node_modules/@claude-flow/cli/node_modules/better-sqlite3"&& npm run install
cd"$(npm root -g)/ruflo/node_modules/@claude-flow/memory/node_modules/better-sqlite3"&& npm run install
export CLAUDE_FLOW_DB_PATH="$PWD/.swarm/memory.db"
Impact
ak dual run feature cannot generate code out of the box under npm 12 (Defect 1), and on any binding-present system it then hits Defect 2. Under npm 12, ak status reports healthy while ruflo's memory substrate is non-functional, so the failure is hard to diagnose without running ruflo doctor.
Summary
On a fresh project,
ak setup→ak dual run feature "<task>"cannot generate code due to two defects in ruflo's native SQLite memory substrate:ak setupinstalls ruflo without compiling the bundledbetter-sqlite3native bindings (npm 12'sallow-scriptsblocks the install script). ruflo's native memory is non-functional, andak statusfalse-positives✓ natives.ak dual run featurefails with a native-WAL-vs-WASM conflict at the first shared-memory write.Happy to split into two issues if preferred — they're tightly coupled (Defect 2 is what users hit after working around Defect 1).
Environment
ak) 4.0.0-alpha.21 · ruflo 3.32.9 · agentic-qe 3.13.1rufloinstalls: npm 10.9.4 / node 22 (bindings build) vs npm 12.0.1 / node 24 (bindings don't build).Defect 1 — native
better-sqlite3bindings not built under npm 12Clean local repro (no global mutation):
Contrast under npm 10 (same steps):
3/3better_sqlite3.nodebuilt, no warning.Impact:
ruflo doctor→✗ Memory Structural Integrity: better-sqlite3 failed to open: Could not locate the bindings file;ruflo status→Memory Backend: none,RuFlo V3 [STOPPED].ak statusstill reports✓ natives— a false positive, because it only inspects theagentdbcopy of better-sqlite3 (which builds), not the@claude-flow/clior@claude-flow/memorycopies (which don't).Expected:
ak setup/ak syncbuilds and verifies all three better-sqlite3 instances (force the install scripts, or restore prebuilt binaries), andak status's "natives" check load-tests the binding ruflo uses at runtime — not just theagentdbcopy.Defect 2 —
ak dual runnative↔WASM memory conflict (binding-present systems)Repro (any system with working bindings,
CLAUDE_FLOW_DB_PATHexported):Fails at the first shared-memory write:
Cause: the
claude-flow-codexdual orchestrator opens a native better-sqlite3 WAL connection onmemory.db, then shells out tonpx ruflo memory store, which uses sql.js (WASM) —ruflo memory initadvertises "sql.js (WASM SQLite)", andnpx rufloresolves to the global ruflo (verified: no fetch). WASM refuses to whole-image-write over an active native WAL. Reproduced with bindings built viaprebuild-install(the same mechanism npm ≤11 uses), so this is not specific to a manualnode-gypbuild.Expected: the orchestrator and the
npx ruflo memorysubprocess agree on one SQLite backend (native) — routememory storethrough the native bridge, or don't hold a native connection across thenpxcall.Workaround (clears Defect 1; exposes Defect 2)
Impact
ak dual run featurecannot generate code out of the box under npm 12 (Defect 1), and on any binding-present system it then hits Defect 2. Under npm 12,ak statusreports healthy while ruflo's memory substrate is non-functional, so the failure is hard to diagnose without runningruflo doctor.