Repository navigation
Description
graphify-out/memory/ cannot be excluded from the corpus — .graphifyignore is bypassed for it and there is no opt-out
Version: graphifyy 0.9.26
Environment: Python 3.12.13, Linux x86_64 (glibc 2.31)
Summary
Answers written by graphify save-result land in graphify-out/memory/*.md and are then re-detected as corpus document files on the next run. That feedback loop is deliberate and useful in general, but there is currently no way to turn it off — not via .graphifyignore, not via .gitignore, not via any environment variable.
The result is that a repo's graph starts absorbing its own Q&A output, and node counts grow for reasons unrelated to the codebase. For projects where the graph is meant to describe only the source tree, that's unwanted and currently unavoidable short of deleting the directory.
Why .graphifyignore doesn't reach it
graphify-out is in _SKIP_DIRS, but detect() re-adds the memory subdirectory as a second scan root and then explicitly exempts that tree from the ignore check:
# detect.py:1221-1225
# Always include graphify-out/memory/ - query results filed back into the graph
memory_dir = root / GRAPHIFY_OUT / "memory"
scan_paths = [root]
if memory_dir.exists():
scan_paths.append(memory_dir)
# detect.py:1249, 1260 — hidden/noise filtering skipped for the memory tree
in_memory_tree = memory_dir.exists() and str(scan_root).startswith(str(memory_dir))
if not in_memory_tree:
...
# detect.py:1317, 1322 — ignore patterns skipped for the memory tree
in_memory = memory_dir.exists() and str(p).startswith(str(memory_dir))
if not in_memory and _is_ignored(p, root, ignore_patterns, _cache=ignore_cache):
continueSo a user-authored pattern is matched against every path except the one they're trying to exclude. Writing graphify-out/memory/ into .graphifyignore silently does nothing, which is worse than an error — the config looks applied.
I also checked every GRAPHIFY_* environment variable the package reads (45 of them); none gates this.
Reproduce
cd <any repo with a built graph>
graphify query "something" # writes graphify-out/memory/query_*.md
printf 'graphify-out/memory/\n' > .graphifyignore
python -c "
from graphify.detect import detect
from pathlib import Path
d = detect(Path('.'))
print('total_files:', d['total_files'])
print('memory hits:', [f for c in d['files'] for f in d['files'][c] if 'graphify-out' in f])
"The memory files are still listed and still counted. Removing the directory is the only thing that changes the outcome — on a 69-file repo, total_files went 69 → 71 after two saved answers, and back to 69 only when graphify-out/memory/ was moved away (the inclusion is gated purely on memory_dir.exists()).
Requested behaviour
Any one of these would be enough:
- Honor
.graphifyignorefor the memory tree — apply_is_ignoredto it like every other path. Most discoverable, since users will reach for the ignore file first. - A CLI flag / env var, e.g.
--no-memory-corpus/GRAPHIFY_NO_MEMORY_CORPUS=1. - A config key in whatever per-project settings graphify already reads.
Option 1 seems most consistent with the rest of the ignore handling, and keeps the default (memory included) unchanged for everyone who wants the feedback loop.
Lower-priority note
Because the tree also bypasses the hidden/noise filtering at detect.py:1260, anything a user or tool drops into graphify-out/memory/ is picked up unconditionally. Scoping the exemption to query_*.md / path_query_*.md / explain_*.md — the files save-result actually writes — would tighten that without affecting the intended behaviour.
Activity
fix(detect): scope memory-tree ignore to .graphifyignore provenance (G…