跳到主內容

Theme / v0.9.103

Graphify

Codebase 知識圖譜

基礎觀念

v0.9.100:節點識別碼(node ID)碰撞與 Claude 提示詞快取(prompt cache)

整理 Graphify v0.9.100 的大小寫節點識別碼(node ID)碰撞修正、抽取提示詞(prompt)格式同步、Claude 後端(backend)的系統提示詞(system prompt)快取(cache),以及多語言抽取、Windows 路徑與工具鏈修正。

概述

Graphify v0.9.100 於 2026-11-01 00:53:21 UTC 發布(台灣時間 2026-11-01 08:53)。release notes 共列 21 項變更,包含節點識別碼(node ID)、語言抽取、匯出、命令列介面(CLI)與大型語言模型(LLM)後端(backend)等修正。首項原文指出:

“Fix: ids a type and a function whose names differ only in case (Foo the class, foo the function) get distinct node ids instead of colliding (which dropped one node and minted a bogus self-loop) (#4904, #4908, thanks @bercedev).”

本課聚焦三條主線:大小寫碰撞與 id 描述同步、Claude 後端(backend)的提示詞快取(prompt cache),以及多語言抽取器(extractor)和 Windows 路徑等正確性修補。

大小寫不同的宣告不再共用 node id

修正前,名稱只有大小寫不同的 type 和 function 可能碰撞,例如 class Foo 與 function foo。碰撞會丟掉其中一個 node,並產生錯誤的 self-loop;v0.9.100 讓它們取得不同的 node id(#4904、#4908)。

這與 v0.9.92 已記錄的 id collision 脈絡相連,但本次 release notes 指向的是新的大小寫案例。另有一項抽取 prompt 修正:node-id 格式描述現在符合 ids.py 實際產生的形式——保留 word characters、保留非 ASCII 字母與數字,並將 ASCII 字母轉小寫;舊描述錯寫成只限 [a-z0-9_](#4432、#4799)。

Claude 後端(backend)的系統提示詞(system prompt)快取(cache)

Claude backend 現以 cache_control 快取穩定且大型的 system prompt,並把快取 tokens 計入 input_tokens(#4835、#4855、#4880)。如果 gateway 不接受 cache_control,可設定環境變數 GRAPHIFY_CLAUDE_PROMPT_CACHE=0 關閉這項快取。

解讀用量時要留意,官方明確說明 cached tokens 會計回 input_tokens;release notes 沒有提供快取命中率或成本節省數字,因此不能從這項變更推算具體節省幅度。這可與既有 LLM 層修正與用量記錄一起閱讀。

多語言 extractor 與跨檔解析

本版修正多個語言抽取器(extractor)的特定解析案例;以下是 release notes 明列的行為:

  • PHP(#4648、#4895):class-level initializer 中的 Scope::MEMBER(const value、property default、parameter 或 promoted-constructor default)會產生 references_constant edge;self::、static::、parent:: 會略過,未知 scope 不建立 stub。
  • R(#4902):setClass/setRefClass 以 contains= 宣告的 S4/R5 繼承會產生 inherits edge;此前只辨識 R6Class 的 inherit=。
  • Elixir(#4900):裸函式呼叫先解析到呼叫者自己的 module,再考慮其他 modules。
  • Dart(#4899):mixin 的 on A, B 會解析每個 superclass constraint,而非只解析第一個。
  • Fortran(#4897):derived type 的 extends(base) 會產生 inherits edge。
  • Scala(#2044、#4856):extension (x: T) def m scope 到 receiver type T,並建立指向 T 的 method edge,不再洩漏到 file scope。
  • Terraform(#4858、#4861):node 保留原始 scope;移動 cached project directory 後,id 不再從新路徑重新推導。
  • Java/Kotlin(#4874、#4879):當書寫的 FQN 唯一指向 sourced type 時,imports、extends/implements 與 member calls 可跨檔解析,也可在 Java 與 Kotlin 之間解析。

Windows linked worktree 的非 ASCII 路徑

git rev-parse 的輸出現在以 UTF-8 解碼,因此 Windows 上非 ASCII 路徑中的連結工作樹(linked worktree)可以正確解析,不再出現亂碼(mojibake,#4903)。這延續了本主題既有的 Windows 路徑修正脈絡;不同版本修復的是各自明列的路徑案例。

其餘修正摘要

  • JS/TS 效能(#4909、#4913):reference edges 依 source 建索引一次,import resolution 不再為每個 import 重新走訪所有 edges;輸出不變。
  • code-only graph(#4887):孤立節點問題原因改為 “possible missing edges”,不再提及不適用的 documentation gaps。
  • Skill 指引(#4829、#4906):說明何時值得建 graph,適用於所有產生的 hosts;保留使用者呼叫 /graphify 時照要求執行的規則。
  • PyAV 相依版本(#4842):video extra 限制為 av>=11,<19;PyAV 19 移除 faster-whisper 開啟音訊時無條件傳入的 metadata_errors 參數,而沒有上限的全新安裝在 Python 3.12+ 會無法轉錄。
  • 匯出平行關係(#4794):path/explain/wiki rendering 透過 edge_datas 列出兩個 nodes 間所有 parallel relations;raw --no-cluster 寫入會標記 graph 為 multigraph,讓平行 edges 在重新載入後保留。
  • 備份重試(#3769、#4834):不完整或失敗的 backup 回報為沒有 backup,並在下次執行重試,而非記錄為成功。
  • affected/query seed(#4792、#4797):graphify affected 與 query --seed 重用 explain resolver,支援相同的 path::Symbol 和 dotted reference 寫法;seed 歧義時以 exit code 3、找不到時以 exit code 4 非零結束。
  • Uninstall(#4782、#4789):graphify uninstall 移除所有平台的 user-scope skills(此前有 13 個遺留)與 kilo global command;graphify kilo uninstall 也移除 kilo skill 的 references/ sidecar。
  • 文件(#4873):supported-language count 更新為約 40(33 個 tree-sitter grammars 加 7 個 built-in parsers);Pass 3 改述為執行設定的 LLM backend,而非只寫 Claude。
隨堂測驗

v0.9.100 如何處理 class Foo 與 function foo 這種只差大小寫的宣告?

💡 想先看個提示?

重點是讓大小寫不同的宣告維持為不同節點。

動手檢查清單

升級 v0.9.100:動手檢查清單

逐項勾選,確認你已完成升級必要的步驟(進度會保存在此瀏覽器)

0 / 4

延伸閱讀