| name | build-graph |
| description | Build or update the code review knowledge graph. Run this first to initialize, or let hooks keep it updated automatically. |
| argument-hint | [full] |
Build Graph
Build or incrementally update the persistent code knowledge graph for this repository.
Installed Search Mode
This packaged skill is mode-neutral. dagayn install rewrites this section with
the selected embedding mode so graph builds refresh the right retrieval indexes.
Steps
-
Check graph status by calling the list_graph_stats_tool MCP tool.
- If the graph has never been built (last_updated is null), proceed with a full build.
- If the graph exists, proceed with an incremental update.
-
Build the graph by calling the build_or_update_graph_tool MCP tool:
- For first-time graph setup:
build_or_update_graph_tool(full_rebuild=True, local_embedding="none")
- For routine updates:
build_or_update_graph_tool(local_embedding="none")
- Do not run embedding-enabled full rebuilds as a routine verification step.
When the MCP server was started with
--local-embedding, omitting
local_embedding may inherit that mode and trigger a large embedding
refresh. Pass local_embedding="bge-m3" only when the task explicitly requires
embedding quality or hybrid-search freshness, and state that reason first.
-
Verify by calling list_graph_stats_tool again and report the results:
- Number of files parsed
- Number of nodes and edges created
- Languages detected
- Any errors encountered
When to Use
- First time setting up the graph for a repository
- After major refactoring or branch switches
- If the graph seems stale or out of sync
- Before semantic search evaluation, wiki generation, or cross-repo comparison
- The graph auto-updates via hooks on edit/commit, so manual builds are rarely needed
Notes
- The graph is stored as a SQLite database (
.dagayn/graph.db) in the repo root
- Binary files, generated files, and patterns in
.dagaynignore are skipped
- Supported languages evolve with the parser registry; check
README.md
"Supported languages and file types" rather than relying on this skill as the
authoritative language list.
CLI Fallback
Use MCP tools first. If the current MCP server profile does not expose a tool,
run the same implementation through the CLI without restarting the agent:
dagayn tool list_graph_stats_tool
dagayn tool build_or_update_graph_tool --arg full_rebuild=true
dagayn tool run_postprocess_tool --arg fts=true
Efficiency Rules
- Use incremental
build_or_update_graph_tool() unless the graph is empty,
branch state changed heavily, or new files are missing from graph queries.
- For parser, flow, documentation-edge, or review verification, keep
local_embedding="none" so hooks and local embedding refresh do not turn a
graph check into an expensive embedding rebuild.
- Use
postprocess="minimal" while iterating; run full postprocess only when
flow/community freshness matters.
- Report node, edge, file, language, and error counts instead of reading the
graph database or generated artifacts directly.