Skip to content

feat(dream): flag memories derived from a dead source - #1503

Open
skakri wants to merge 1 commit into
mainfrom
feat/dream-dead-source
Open

skakri wants to merge 1 commit into
mainfrom
feat/dream-dead-source

Conversation

@skakri

@skakri skakri commented Sep 25, 2026

Copy link
Copy Markdown
Member

Fixes #1444.

A memory derived from another stays live after its source is withdrawn, and nothing says so. dream now reports it as a deterministic dependent_of_dead_source finding, ranked with stale_reference.

Behavior

  • Scope. Every live memory in the active repo that reaches a dead memory along derived_from edges is reported, directly or through other derived memories.
  • Dead means obsolete, rejected, or anchored only to code that is gone (every binding anchor_status = 'gone'). Unanchored Task/Concept nodes are never dead by bindings.
  • Suspect, never retired. Nothing is changed automatically, in line with truth-maintenance semantics. The finding names the dead source, the first memory on the chain when the link is indirect, and a live memory that supersedes the source when one exists.
  • Self-clearing. The kind is evaluated on every run, so the finding resolves once the source stands again, the edge is removed, or the dependent is retired.
  • Stable claims. The evidence names memories by id only, so renaming one does not re-open a dismissed finding. A new successor does, since that is new information.

Deliberate choices

  • Edges are read by target_anchor, not target_node_id. target_anchor is the target's globally unique node id on every path (local add, sync drain, consolidation). The sync drain leaves target_node_id unset for this device to resolve, so filtering on it would hide every synced edge.
  • A target missing from this store is unknown, never dead. Local memories are retired, not deleted. The rows that vanish in production are the sync drain's: a quarantined peer update, an edge that arrived before its target, a target consolidation left behind. Those are memories still alive elsewhere, and a reviewer must not be told to act on them.
  • A rewrite is not a dependent. A memory recorded as both derived_from and supersedes its source is its replacement, not a dependent left standing on it.
  • Chains stop at the repo boundary. The walk follows edges owned by the active repo. A target in another repo is judged by its own status, but its own edges are not followed.
  • "All bindings gone" reads the stored anchor_status, the same checkout-scoped verdict stale_reference and memory_doctor use.

Tests

schema_bootstrap_tests/repo_memory/dead_source_findings.rs covers:

  • a direct dependent, and transitive propagation that names the root;
  • the successor pointer;
  • restoring the source clears the finding;
  • a source anchored only to gone code;
  • a derived_from cycle terminates and flags nothing;
  • a synced edge with no resolved target is still followed, to its real source;
  • a missing target flags nothing;
  • renaming the source keeps a dismissal;
  • a rewrite that supersedes its source is not flagged.

Each test fails under a mutation of the code it guards. Cross-repo chains are not covered by a test yet.

The dream-review skill (both copies), docs/mcp-tools.md and the MCP dream description describe the new kind.

@github-actions

Copy link
Copy Markdown
Contributor

SCIP oracle — resolution report

Heuristic→compiler edge resolution per corpus. Δ compares resolved-after to the main baseline (only when the corpus profile + tool version match).

corpus tool edges resolved (heuristic → compiler) precision recall monikers Δ vs main
c-libuv scip-clang 12691 33.5% → 45.0% 96.0% 55.3% 661 +0.0pp
cpp-yaml scip-clang 7686 42.0% → 67.8% 82.0% 41.1% 1049 +0.0pp
py-django scip-python 12882 30.3% → 73.8% 93.6% 83.4% 3701 +0.0pp
py-rich scip-python 8383 27.8% → 92.4% 94.6% 81.3% 1196 +0.0pp
rust-time rust-analyzer 9907 37.8% → 59.1% 81.2% 83.6% 574 +0.0pp
ts-rxjs scip-typescript 6533 43.7% → 94.9% 86.2% 76.8% 631 +0.0pp

resolved = Exact/Syntactic + compiler upgrades + resolved-external, over edge candidates with a callee range. precision/recall are the oracle eval metrics.

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectrag-rat
Branchfeat/dream-dead-source
Testbedhetzner-bigmem

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkEstimated Cyclescycles x 1e6Instructionsinstructions x 1e6L1 Hitshits x 1e6LL Hitshits x 1e6RAM Hitshits x 1e3Total read+writereads/writes x 1e6
rag_pipeline::pipeline::index cargo_resolver:resolver_config()📈 view plot
⚠️ NO THRESHOLD
1,900.50 x 1e6📈 view plot
⚠️ NO THRESHOLD
1,189.06 x 1e6📈 view plot
⚠️ NO THRESHOLD
1,662.94 x 1e6📈 view plot
⚠️ NO THRESHOLD
38.33 x 1e6📈 view plot
⚠️ NO THRESHOLD
1,311.60 x 1e3📈 view plot
⚠️ NO THRESHOLD
1,702.58 x 1e6
rag_pipeline::pipeline::query_cold cargo_resolver:resolver_built_config()📈 view plot
⚠️ NO THRESHOLD
307.07 x 1e6📈 view plot
⚠️ NO THRESHOLD
204.01 x 1e6📈 view plot
⚠️ NO THRESHOLD
290.51 x 1e6📈 view plot
⚠️ NO THRESHOLD
3.06 x 1e6📈 view plot
⚠️ NO THRESHOLD
35.66 x 1e3📈 view plot
⚠️ NO THRESHOLD
293.61 x 1e6
rag_pipeline::pipeline::query_warm cargo_resolver:resolver_index()📈 view plot
⚠️ NO THRESHOLD
278.77 x 1e6📈 view plot
⚠️ NO THRESHOLD
184.84 x 1e6📈 view plot
⚠️ NO THRESHOLD
263.81 x 1e6📈 view plot
⚠️ NO THRESHOLD
2.76 x 1e6📈 view plot
⚠️ NO THRESHOLD
33.77 x 1e3📈 view plot
⚠️ NO THRESHOLD
266.60 x 1e6
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectrag-rat
Branchfeat/dream-dead-source
Testbedhetzner-bigmem
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
seconds (s)
(Result Δ%)
Upper Boundary
seconds (s)
(Limit %)
index_time/full_rebuild_cargo📈 view plot
🚷 view threshold
5.68 s
(-7.41%)Baseline: 6.14 s
7.17 s
(79.22%)
🐰 View full continuous benchmarking report in Bencher

@codecov

codecov Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 5 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ootstrap_tests/repo_memory/dead_source_findings.rs 97.84% 3 Missing ⚠️
crates/rag-rat-dream/src/dead_sources.rs 98.19% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dream: flag memories derived from an obsolete or gone source memory

1 participant