Repository navigation
fix(graph): count edges by both endpoints and expose cross-layer bleed - #183
Merged
Merged
Conversation
`epi_edges` has no layer column, so the three readers derived an edge's layer three ways: `count_edges` by the source node, `memory_graph_edges` by both endpoints, `get_neighbors` by the target. The 2026-11-02 layer migration created cross-layer edges, turning a documented divergence into a live one: on Hermes the agent counter reported 45 291 edges while the tool could list 19 786. `count_edges` now counts total/live/dead only for edges with BOTH endpoints in the layer, matching what the reader returns, and scopes `user_id` on both ends like the reader does. The bleed is not hidden: `cross_layer` counts edges with exactly one endpoint in the layer, symmetrically, so the same edge is visible from both sides. `memory_stats` and the dashboard carry the new field. Also drops an absolute operator home path from a comment and replaces the stale "today no such edge exists" claim in the docstring with the measured contract.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что
epi_edgesне хранит слой, и три ридера выводили его тремя способами:count_edgesпо источнику,memory_graph_edgesпо обоим концам,get_neighborsпо цели. Миграция слоёв 2026-11-02 создала кросс-слойные рёбра и превратила задокументированное расхождение в живое.count_edgestotalcross_layerСходится: 19 786 + 25 505 (agent→user) = 45 291; входящих user→agent 7 485 — ровно «лишние» в user-счётчике.
Контракт
total/live/dead— только рёбра с обоими концами в слое, т.е. то, что реально перечисляетmemory_graph_edges;user_idтеперь на обоих концах, как в тулзе (без этогоcount_edges("default")в Mimocode agent давал 1 781 против 646 читаемых);cross_layer— рёбра с одним концом в слое, симметрично: одна и та же утечка видна с обеих сторон;total == live + deadсохраняется, ребро с отсутствующим концом не входит никуда.StatsResult.graph_edges_cross_layer+ проброс вmemory_statsи dashboard. Смысл существующих полей не менялся.Попутно: абсолютный операторский путь вырезан из комментария (
shared/archived_memories.py); в трекнутых файлах/home/murat— 0. Устаревшее «Today no such edge exists» в докстринге заменено измеренным контрактом.Вне объёма
get_neighbors(target-only) не трогал — отдельная находка, меняет recall-расширение. Исторические кросс-слойные рёбра не перекладывал.Проверка
Spec:
.compose-локальный2026-11-02-cross-layer-edge-count.md.