Repository navigation
dream(memory): #4137 wire delete-sync into AutoMemoryBridge.importFromAutoMemory() (evaluated, ACCEPT) - #4138
Conversation
…-synced removed/vanished source content importFromAutoMemory() diffed new content against AgentDB by content-hash to insert/skip, but never detected or deleted an entry whose source heading (or whole source file) was removed — deleted memory content stayed retrievable via semantic search indefinitely. Adds a per-source- file key diff (reusing the existing single bulk query, zero schema change) plus a second pass for files removed entirely from disk, each with a false-full-wipe guard. Evaluated: 7 new discriminating tests, baseline-fails/candidate-passes via stash isolation; full suite and tsc clean modulo pre-existing/unrelated flakes. Adversarial critique found and this session fixed forward the whole-file-removed gap and a vacuous test assertion before this commit. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
…ync change CI's leaf-package-publish audit caught this: @claude-flow/memory is a non-bundled leaf that resolves from the registry for the release train, so a publishable source change (auto-memory-bridge.ts) must bump the leaf's own version or the fix silently never reaches a release. Bumps the leaf's package.json, the CLI's exact pin (dependencies + optionalDependencies), and the matching pnpm-lock.yaml specifier. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
|
Review (group 1, not merging): tests reproduce. The 7 new delete-sync tests fail on 🤖 Generated with RuFlo |
…version collision with #4183 Review finding: the backend can be shared across multiple memory dirs (e.g. the SessionStart hook's main dir vs. a worktree dir from worktreeMemoryDir()). Without recording which memoryDir wrote an entry, importing one dir could see another dir's same-named file/heading as "gone" and delete it. Entries now carry metadata.memoryDir, and both delete-sync passes (per-heading diff and whole-file-removed) only consider entries whose memoryDir matches the importing bridge's own — legacy entries written before this field existed (no memoryDir at all) are therefore never delete-sync eligible. Two new discriminating tests cover cross-dir isolation and the legacy-entry case; all 9 existing delete-sync fixtures updated to carry memoryDir so they still exercise the intended "same dir" path rather than being silently excluded. Also bumps @claude-flow/memory to 3.0.6 (CLI pins + lockfile specifier) since #4183 independently claimed 3.0.5 for the same leaf — whichever of the two PRs lands second needs a version past the other's. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
|
Both addressed in 0368564:
🤖 Generated with RuFlo https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8 Co-Authored-By: RuFlo ruv@ruv.net Generated by Claude Code |
An earlier `pnpm install` run in this session (unrelated to this PR's own change) left pnpm-lock.yaml recording codex/security/shared at specifier 3.0.6 while v3/@claude-flow/cli/package.json still pins them at 3.0.5 — a mismatch that got swept into a prior commit by staging the whole lockfile file. `pnpm install --frozen-lockfile` (what CI runs) fails on that drift regardless of this PR's actual content. Reverted those three specifiers back to 3.0.5 to match package.json; the memory specifier bump to 3.0.6 (this PR's real change) is untouched. Verified locally: `pnpm install --frozen-lockfile` now succeeds. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
|
CI red (Windows 🤖 Generated with RuFlo https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8 Co-Authored-By: RuFlo ruv@ruv.net Generated by Claude Code |
# Conflicts: # docs/dream-cycle/LEDGER.md # v3/@claude-flow/cli/package.json
Swept into the previous merge commit by running the test suite to verify the merge; it's a fresh-run artifact (empty idToLabel/labelToId maps), not source. Added to .gitignore alongside the other *.rvf test-pollution exclusions in this package. Co-Authored-By: RuFlo <ruv@ruv.net>
|
Reviewed and rebased onto current Verified post-merge: the PR's own new test file ( Marking ready; will merge once CI is green. |
AutoMemoryBridge.importFromAutoMemory()'s delete-sync fix in this PR changed v3/@claude-flow/memory/src/auto-memory-bridge.ts without bumping the package version. @claude-flow/memory is not bundled into the release tarballs — it resolves from the registry — so publishing the three train packages without this bump would ship the old 3.0.6 copy and the fix would reach nobody (#3335, #3390). Will publish @claude-flow/memory@3.0.7 standalone once this merges. Co-Authored-By: RuFlo <ruv@ruv.net>
|
CI's |
…@3.0.7 761b838 bumped the leaf's own package.json version to 3.0.7 but left v3/@claude-flow/cli/package.json's exact pin (dependencies + optionalDependencies) and the matching pnpm-lock.yaml specifier at 3.0.6 — the leaf-package-publish audit catches this: an exact pin of "3.0.6" is not satisfied by workspace version 3.0.7, so a release would resolve to an older published copy than the source in this repo. Verified: audit script passes, `pnpm install --frozen-lockfile` succeeds. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
|
Caught the same CI failure (leaf-package-publish audit) right as 761b838 landed the same fix — ended up a race. That commit bumped the leaf's own 🤖 Generated with RuFlo https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8 Co-Authored-By: RuFlo ruv@ruv.net Generated by Claude Code |
|
New failure on 2e979aa, different check: This is a real tension between two guards at this exact stage, not something I can fix by pushing more version-string edits:
Both are correctly designed for what they each guard against (#3335/#3390 vs. #4303) but they can't both be green simultaneously for an unpublished leaf bump sitting in an open PR. Your own comment said the plan is to publish 🤖 Generated with RuFlo https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8 Co-Authored-By: RuFlo ruv@ruv.net Generated by Claude Code |
|
`@claude-flow/memory@3.0.7` is live and verified on npm:
The `audit-leaf-versions-published.mjs` failure on 2e979aa (expected until this landed) should now clear — re-ran that job. Watching the rest of CI through to merge. |
Minor release (new backward-compatible flags: Grok Build CLI host surface ruvnet#3512, memory list/search tag filter ruvnet#3526) bundled with a round of correctness fixes merged since 3.58.1: memory delete-sync (ruvnet#4138), real AgentDB HNSWIndex replacing the dead getController('hnsw') path with safe exact-search fallback (ruvnet#4249/ruvnet#4322), harness live-process reporting (ruvnet#3521), RaBitQ on-demand index build (ruvnet#4318/ruvnet#4319), metaharness ADR-152 cost-dimension and verdict-band fix (ruvnet#3520), swarm idle-agent heartbeat false-positive (ruvnet#4320), ephemeral-agent termination idempotency (ruvnet#4323), status/task_list field-mapping and total-count fixes (ruvnet#4321/ruvnet#4324). Also fixes the actual cause of broken images/links on npmjs.com/package/ruflo: `ruflo/package.json`'s `repository.directory: "ruflo"` field added an extra path layer on top of the README content (the root README.md, copied in verbatim by `prepublishOnly` at publish time, which is already written with repo-root-relative paths) — every relative image/link resolved to e.g. `raw/main/ruflo/ruflo/assets/...` instead of `raw/main/ruflo/assets/...`. Removed the `directory` field to match claude-flow's own (directory-less) repository entry. A prior PR (ruvnet#4325) fixed `ruflo/README.md`'s own relative paths for anyone browsing that file directly on GitHub, but that file is overwritten by the root README at publish time and was never the actual npm-rendered content. Published to npm: @claude-flow/cli@3.59.0, claude-flow@3.59.0, ruflo@3.59.0, and standalone @claude-flow/memory@3.0.8 (the ruvnet#4249 fix — not part of the 3-package train, published separately per its own leaf's npm presence). All three umbrella packages' latest/alpha/v3alpha dist-tags verified pointing at 3.59.0. Co-Authored-By: RuFlo <ruv@ruv.net>
1. Hypothesis
2. Candidate
v3/@claude-flow/memory/src/auto-memory-bridge.ts:importFromAutoMemory()now builds a per-source-filekey→idindex from the existing single bulk query (fetchExistingAutoMemoryIndex(), renamed fromfetchExistingContentHashes()), diffs it against each file's current parse, andbulkDelete()s stale ids — plus a second pass for files removed entirely from disk. Zero schema changes (metadata.sourceFile/heading/keyalready existed per entry). Mirrors the existing same-key eviction pattern inagentdb-adapter.ts'sbulkInsert()(2026-09-18).3. Evaluation Receipt
Vitest 4.1.8, deterministic, $0. 7 new discriminating tests in
auto-memory-bridge.test.ts. Stash-isolated (source reverted, tests kept): baseline fails all 7, candidate passes all 7. Full@claude-flow/memorysuite: baseline 606/607 (1 pre-existing chmod-under-root flake), candidate 611/614 (+7 new; same chmod flake + 2 CPU-contention-sensitive timing tests in untouched files, confirmed non-deterministic by not reproducing on a repeat baseline run).tsc --noEmit: 0 errors both ways.4. Baseline Comparison
Baseline: entries for a removed heading or a deleted source file persist in AgentDB's
auto-memorynamespace forever, retrievable via semantic search. Candidate: deleted within the nextimportFromAutoMemory()call.5. Darwin Lineage
Skipped — binary correctness/wiring fix, no continuous parameter for Darwin's fitness search. Same skip class as nearly every ACCEPT since 2026-08-18.
6. Flywheel Evidence
No
.claude-flow/flywheel/state exists in this repo. OBSERVATION (zero delete/bulkDelete calls pre-fix, confirmed by reading + grep) → MEASUREMENT (7 discriminating tests, stash-isolated) → INFERENCE (genuine SOTA gap at the orchestration/agent-memory layer, see issue §12) → DECISION: ACCEPT, scoped to delete-sync wiring only.7. Reward Hack Check
Independent adversarial critic reviewed the actual diff (not the design) against a 9-point checklist and ran the suite/tsc itself. Verdict CONFIRMED-WITH-CAVEATS: found a real, undisclosed gap (whole-file-removed-from-disk entries were a permanent orphan) — fixed forward in this PR, not just logged; found the try/catch didn't cover the parse step — widened; found a vacuous test assertion — fixed by pre-seeding the stale entry it was supposed to test for. One caveat disclosed, not fixed (the pre-existing 10k query-limit cap now also bounds delete-sync visibility — inherited, not introduced by this diff).
8. Security Review
Delete scope is bounded to
namespace === 'auto-memory'(unchanged query filter) and, within that, to entries the affected file previously wrote — confirmed by code tracing and a dedicated cross-file-isolation test.metadata.sourceFilecomes from real filenames under the same already-trustedreaddirSync(memoryDir)directory already consumed for content import; no new privilege boundary.9. Regression Analysis
No existing test modified or weakened (diff is a pure 109-line addition pre-critique, then further additions post-critique — zero deletions in the test file). No gold data touched. Full-suite failure set unchanged in kind (same 1-2 pre-existing environmental flakes, confirmed non-deterministic rather than caused by this diff).
10. ADR
Not created — scoped wiring/correctness fix, not an architectural decision (per the Dream Cycle's own ADR-creation criteria).
11. Research Gist
docs/dream-cycle/dream-gist-2026-10-13.md(this branch) — full SOTA report: competitor comparison (LangChain'sindex()cleanup="scoped_full"is the official reference blueprint; Zep/Graphiti's bi-temporal soft-invalidate is a credible alternative), 5 scored candidates, 5 ranked next steps.12. Issue
#4137 (full 15-section Dream Cycle report, including two SCAN findings on
pluginsandautomationnot implemented in this PR).13. Witness
14. Merge Policy
Human review required. Do not self-merge. Do not autonomously promote Flywheel state.
🤖 Generated with RuFlo
https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
Co-Authored-By: RuFlo ruv@ruv.net
Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
Generated by Claude Code