指令用途
graphify install 系列(含 graphify <platform> install)是 graphify 與 AI 助理整合的關鍵。它會在你的助理對應組態目錄寫入:
- skill 檔(如
.claude/skills/graphify/SKILL.md):教助理「先跑graphify query再讀原始碼」 - hook / 規則(如
.claude/settings.json的 PreToolUse hook、.cursor/rules/graphify.mdc、.codex/hooks.json):自動攔截搜尋行為,nudge 助理先用圖譜
支援 20+ 平台:Claude Code、Cursor、Codex、Gemini CLI、GitHub Copilot CLI、Kilo Code、Aider、OpenClaw、Factory Droid、Trae、Hermes、Kimi Code、Amp、Antigravity、Kiro、Pi、Devin、CodeBuddy、OpenCode 等。
基本用法
全平台通用
# 對 Claude Code 註冊(寫到 ~/.claude/)
graphify claude install
# 對當前專案註冊(寫到 .claude/)— 可 commit 到 repo,團隊共享
graphify claude install --project
# 同時指定平台 + project scope
graphify codex install --project
任選目標平台
| 指令 | 對應平台 | 寫入位置 |
|---|---|---|
graphify claude install |
Claude Code | CLAUDE.md + PreToolUse hook |
graphify codebuddy install |
CodeBuddy | CODEBUDDY.md + PreToolUse hook |
graphify codex install |
Codex CLI | AGENTS.md + .codex/hooks.json PreToolUse hook |
graphify gemini install |
Gemini CLI | GEMINI.md + BeforeTool hook |
graphify opencode install |
OpenCode | AGENTS.md + tool.execute.before plugin |
graphify cursor install |
Cursor | .cursor/rules/graphify.mdc (alwaysApply: true) |
graphify kilo install |
Kilo Code | ~/.config/kilo/skills/graphify/SKILL.md + ~/.config/kilo/command/graphify.md + .kilo plugin |
graphify copilot install |
GitHub Copilot CLI | copilot skill file |
graphify vscode install |
VS Code Copilot Chat | .vscode/... |
graphify aider install |
Aider | AGENTS.md |
graphify claw install |
OpenClaw | AGENTS.md |
graphify droid install |
Factory Droid | AGENTS.md |
graphify trae install / trae-cn install |
Trae / Trae CN | AGENTS.md |
graphify hermes install |
Hermes | AGENTS.md + ~/.hermes/skills/ |
graphify amp install |
Amp | amp skill file |
graphify agents install |
cross-framework(alias: graphify skills install) |
~/.agents/skills/ + AGENTS.md |
graphify kiro install |
Kiro IDE/CLI | .kiro/skills/ + .kiro/steering/graphify.md |
graphify pi install |
Pi coding agent | pi skill file |
graphify devin install |
Devin CLI | skill file + .windsurf/rules/graphify.md |
graphify antigravity install |
Google Antigravity | .agents/rules + .agents/workflows |
graphify kimi install(或 graphify install --platform kimi) |
Kimi Code | Kimi Code 組態目錄 |
機制差異:Hook 平台 vs 規則平台
| 模式 | 平台 | 行為 |
|---|---|---|
| Hook(主動攔截) | Claude Code、Gemini CLI、Codex、CodeBuddy、Kilo | 在 search-style tool call(或 Read/Glob)之前 hook 觸發,nudge 助理先 graphify query |
| 規則(被動教學) | Cursor、Aider、OpenCode、Copilot CLI 等 | 持續性規則檔,每次對話都納入提示 |
兩種機制目的相同:讓助理優先查圖譜,而不是 grep / read 原始檔。
Claude Code 的 strict 模式(v0.9.19+)
預設 install 是軟性 nudge:「建議先 graphify query」是 advisory context,model 可無視。
加上 --strict 變成硬性 deny:
graphify claude install --project --strict
效果:
- session 中第一次 raw 原始碼 Read 時,hook 回
permissionDecision: "deny"把這次 Read 擋下,redirect 到graphify query - 下一個 tool call(同個檔案)自動放行,助理永遠不會卡死
- 跑過任何
graphify query / explain / path會刷新「recently oriented」戳記,暫停阻塞 - 一次 session 最多阻塞一次
⚠️ strict 只對 Claude Code 有效。其他平台無 hook deny 機制,仍是軟性 nudge。
runtime 切換(不需重新安裝):
export GRAPHIFY_HOOK_STRICT=1 # 啟用硬性
export GRAPHIFY_HOOK_STRICT=0 # 停用(軟性 nudge)
反安裝
# 從所有平台移除
graphify uninstall
# 連帶刪除 graphify-out/
graphify uninstall --purge
# 只移除某平台的 project-scoped 註冊
graphify uninstall --project --platform codex
範例:在 Cursor 把 graphify 設成 always-on
cd ~/projects/my-app
graphify cursor install --project
產出:
.cursor/rules/graphify.mdc設alwaysApply: true- 每次開對話 Cursor 自動納入規則,不需 hook
內部連結與外部參考
- 官方 README「Make your assistant always use the graph」有全部 20+ 平台與 strict 模式
- 上一章:graphify prs 指令詳解