[Feature]: out-of-tree graph store keyed by repository, shared across worktrees
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- git, python
- Lĩnh vực
- cli, developer-experience, tooling
Hướng nghiên cứu
Start with graphify/paths.py and the existing worktree-guard test in test_hooks.py, then trace how CLI commands resolve and write GRAPHIFY_OUT. For the first PR, use real git worktree fixtures to cover per-repository resolution, origin.json, the linked-worktree write guard, and graphify where. Later work should follow the skill and agent text in install.py and the proposed store list/prune commands.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem or use case
I'd like graphify to keep its graphs outside the repositories it indexes, in a per-user store. I want the graphs. What I don't want is graphify-out/ inside other people's repos, or a set of workarounds I have to maintain to keep it out.
On a typical day I clone about ten repositories and open around three git worktrees in each, one per agent task. Since graphify writes graphify-out/ into the checkout, every clone and every worktree needs its own handling:
- The output has to be ignored somewhere, and the repo's
.gitignoreisn't mine to edit. So it goes into.git/info/excludeor a global excludes file, without a trailing slash in case it's a symlink. - A fresh worktree has no graph, and rebuilding one per worktree costs time and LLM calls. Copying the primary checkout's graph in doesn't help: incremental extraction then treats the whole corpus as changed (#2654).
- A symlink from each worktree to the primary checkout's
graphify-outneeds apost-checkouthook ininit.templateDir. That hook doesn't fire in repos that set their owncore.hooksPath. Anupdatefrom the worktree also writes straight through the link into the primary graph. - An absolute
GRAPHIFY_OUTis one global value with no per-repo key. The skill ignores it anyway (#2571).
Each of these works on its own terms. Together they are a pile of glue per clone, just to read someone else's code with a graph.
Proposed solution
My proposal is an opt-in store mode. Graphs live in a per-user directory keyed by repository, nothing is written to the working tree, and one global setting turns it on. After that a new clone or worktree needs no preparation.
I read through v8 to check how much this touches. Most of it already works with an absolute GRAPHIFY_OUT, so the design is mostly about computing that value per repo:
- Resolution happens in
graphify/paths.pyat import time, and the first match wins. IfGRAPHIFY_OUTis set, nothing changes. If an in-treegraphify-out/already exists at the repo top, nothing changes either, so teams that commit their graph are not affected. If store mode is on, the result is<store>/<key>. Otherwise it staysgraphify-out. The resolved value is absolute and goes intoGRAPHIFY_OUT, so the modules that copy the constant at import keep working as they are. - Store mode is enabled with
GRAPHIFY_STORE=1or with{"store": true}in~/.graphify/config.json. The config file is there because git hooks run from GUI clients don't see the shell environment. The default location is~/.graphify/store/, next to the per-user state graphify already keeps, andGRAPHIFY_STORE_DIRoverrides it. - The key is the repo directory name plus a short hash of
git rev-parse --path-format=absolute --git-common-dir. That gives every linked worktree of a clone the same key. Outside git, the hash comes from the absolute cwd. Each entry also writes anorigin.jsonwith the common dir, the primary worktree path and the remote URL, for listing and pruning later. - Worktrees share the clone's graph read-only. Read commands, hook-guard and MCP work from any worktree. Write commands (
extract,update,watch,cluster-only) exit with a message pointing at the primary checkout. The existing worktree guard in the hooks already skips rebuilds there. Sincesource_filepaths are relative to the scan root, a graph built in the primary checkout resolves fine from a worktree. In store mode.graphify_rootis always written absolute. This would also cover the read-side fallback from #2064. - A new
graphify wherecommand prints the resolved output dir exactly as the process sees it. It is the only new CLI surface, and the skill uses it to find the graph. - The skill and the always-on text stop hardcoding the path. Each bash block starts with
GFY_OUT="$(graphify where 2>/dev/null || echo graphify-out)", and every literalgraphify-out/becomes"$GFY_OUT"/. Inline Python gets the path from an env var, never through string interpolation. In default modegraphify whereprintsgraphify-out, so current behaviour doesn't change. This overlaps with #1054 and #2720, and I'd rather work with those authors than open a competing change. graphify store listshows each entry with its origin, size and last write, and flags orphans whose clone is gone.graphify store pruneremoves orphans and is a dry run by default.- In store mode
hook installdoesn't write the.gitattributesmerge-driver line, since there is no in-tree graph to merge. Nothing else in the hooks changes.
I'd split the work into three PRs, each useful on its own:
- Resolution, the key,
origin.json, the write guard in linked worktrees, andgraphify where. Tests would use realgit worktree addfixtures, like the existing worktree-guard test intest_hooks.py. CLI, hooks and MCP users get the benefit from this one alone. - Skill fragments, always-on blocks and the agent text in
install.pyswitch tographify where, including the--blessrun and the sanctioned always-on edits. graphify store listandgraphify store prune.
A few things I'm not sure about:
- Should store mode stay opt-in, or become the default in some later major version?
- Is a shared read-only graph the right policy for worktrees? The alternative is an opt-in per-worktree graph keyed by
--git-dir, seeded from the clone's graph once #2654 is fixed. - Is
~/.graphify/store/a good default, or would you prefer$XDG_DATA_HOME/graphify/on Linux? I wouldn't put it under a cache dir, because the semantic pass costs money to rebuild.
Alternatives considered
graphify remote(#1751, #1752) moves the data out, but the repo still gets agraphify-outsymlink, a committed.graphify/config and a.gitignoreedit. That fits a team sharing one graph. It doesn't fit leaving someone else's repo untouched.- Making the skill honour
GRAPHIFY_OUT(#1054, #2720) is needed, and step 6 builds on it. It is still one global value with no per-repo key, though. - The worktree fallback in #2064 lets read commands use the primary checkout's graph. It covers part of step 4, but not the in-tree writes or the skill.
- #686 asked for worktree support earlier and got
GRAPHIFY_OUT, which leads back to the points above.
Area
CLI or installation
Are you willing to submit a PR?
Yes, I can work on this. If the design looks right to you, I'll start with the first PR, and I'm happy to change any part of it before that.
- Ngôn ngữ chính
- Python
- Star
- 124k
- Fork
- 11.9k
- Merge trung bình
- 2 giờ 35 phút
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Graphify-Labs/graphify
-
[Bug]: Generated git hooks break when CDPATH is exported (dash's cd prints the resolved dir), silently skipping every rebuildCó thể đã có người làm @HhH666-ux đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Graphify-Labs/graphify#4977 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
extract --out <dir>: semantic cache never saved, docs missing from manifest (relative source_file resolved against --out)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Graphify-Labs/graphify#4831 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)Có thể đã có người làm @Deepjyoti-Sarmah đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Graphify-Labs/graphify#4563 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncatesCó thể đã có người làm @bercedev đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Graphify-Labs/graphify#4546 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
--update runbook: graph.json backup instruction comes after the diff that needs it, so the graph diff never runsCó thể đã có người làm @sunildivakar96-cpu đã nhận 18 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Graphify-Labs/graphify#4539 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Graphify-Labs/graphify
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FinanceFlash/unvibecode#509 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
FAIRmat-NFDI/nomad-distro-dev#161 ·
-
bug v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
modelcontextprotocol/python-sdk#3821 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug severity:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Log-odds calibration uses upper middle score instead of median for even candidate setsCó thể đã có người làm @flysheep-ai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày