[{"data":1,"prerenderedAt":366},["ShallowReactive",2],{"doc-\u002Fen\u002Fdocs\u002Fguides\u002Fcode-graph":3,"doc-surround-\u002Fen\u002Fdocs\u002Fguides\u002Fcode-graph":263,"doc-nav-en":272},{"id":4,"title":5,"body":6,"description":253,"extension":254,"meta":255,"navigation":256,"order":257,"path":258,"section":259,"seo":260,"stem":261,"__hash__":262},"docs_en\u002Fen\u002Fdocs\u002F02.guides\u002F08.code-graph.md","Semantic Code Graph",{"type":7,"value":8,"toc":246},"minimark",[9,13,22,27,30,58,65,115,118,122,125,179,182,185,188,192,205,219,229,232],[10,11,5],"h1",{"id":12},"semantic-code-graph",[14,15,16,17,21],"p",{},"The Semantic Code Graph builds a ",[18,19,20],"strong",{},"relationship layer"," on top of the symbol index (SymbolIndex), supplemented by local vector retrieval, so AI understands cross-file call relationships and module dependencies before planning and rewriting. When a project grows to hundreds of files and the context window alone can no longer show the full picture, the code graph becomes the AI's \"global view\".",[23,24,26],"h2",{"id":25},"index-building","Index Building",[14,28,29],{},"Indexes are built and queried per project root, isolated between projects. The kernel builds two kinds of indexes for each project:",[31,32,33,52],"ul",{},[34,35,36,39,40,43,44,47,48,51],"li",{},[18,37,38],{},"Symbol relationship index",": parses symbols in the code and their relationships, covering three relation types — ",[18,41,42],{},"Calls",", ",[18,45,46],{},"Implements",", and ",[18,49,50],{},"DependsOn",". Every relationship record contains a source symbol, a target symbol, and a relation type.",[34,53,54,57],{},[18,55,56],{},"Vector index",": encodes code snippets into vectors using a local embedding model (L2 normalization enabled by default), and retrieves semantically similar code by cosine similarity. Every vector record carries its source file and a text preview, so results can be located to a specific file directly.",[14,59,60,61,64],{},"The embedding model runs ",[18,62,63],{},"entirely locally"," — indexing and retrieval complete without your code ever leaving the machine:",[66,67,68,84],"table",{},[69,70,71],"thead",{},[72,73,74,78,81],"tr",{},[75,76,77],"th",{},"Model",[75,79,80],{},"Dimensions",[75,82,83],{},"Use case",[85,86,87,102],"tbody",{},[72,88,89,96,99],{},[90,91,92],"td",{},[93,94,95],"code",{},"static-code-embed",[90,97,98],{},"256",[90,100,101],{},"Code snippets (normalization enabled by default)",[72,103,104,109,112],{},[90,105,106],{},[93,107,108],{},"static-bert-tiny",[90,110,111],{},"128",[90,113,114],{},"General text",[14,116,117],{},"The two scenarios use different dimensions, fixed at index creation time; retrieval is ranked by cosine distance — smaller means more similar.",[23,119,121],{"id":120},"cross-file-reference-queries","Cross-File Reference Queries",[14,123,124],{},"All queries are bounded by the project root and initiated by symbol name:",[66,126,127,137],{},[69,128,129],{},[72,130,131,134],{},[75,132,133],{},"Query",[75,135,136],{},"Description",[85,138,139,147,155,163,171],{},[72,140,141,144],{},[90,142,143],{},"Callers",[90,145,146],{},"Who calls this symbol",[72,148,149,152],{},[90,150,151],{},"Callees",[90,153,154],{},"Who this symbol calls",[72,156,157,160],{},[90,158,159],{},"Implementations",[90,161,162],{},"All implementations of an interface \u002F trait",[72,164,165,168],{},[90,166,167],{},"Module dependencies",[90,169,170],{},"Which downstreams a module depends on",[72,172,173,176],{},[90,174,175],{},"Relationship subgraph",[90,177,178],{},"The relationship network expanding layer by layer around a symbol to depth N",[14,180,181],{},"The two index types work together: vector retrieval handles fuzzy \"semantically related\" lookup, while the relationship graph handles precise tracking along \"definite reference chains\". Subgraph queries start from a central symbol and expand depth-first toward both callers and callees — commonly used to assess the blast radius of a change.",[14,183,184],{},"The relationship layer is the core deliverable of Semantic Code Graph Phase 1: the symbol index first extracts functions, types, and modules, then three kinds of relationship edges are built on top of it. All queries are read-only and never modify project code. Query implementation borrows the symbol index directly for read-only access; subgraph expansion deduplicates visited nodes, so even cyclic calls cannot cause an infinite loop.",[14,186,187],{},"The graph is built in sync with LSP integration, providing a unified foundation for upcoming diagnostics, navigation, and completion capabilities.",[23,189,191],{"id":190},"working-with-rush","Working with RUSH",[14,193,194,195,200,201,204],{},"During the planning stage, the Planner of a ",[196,197,199],"a",{"href":198},"\u002Fen\u002Fdocs\u002Fguides\u002Frush","RUSH Deep Task"," queries the code graph to assess the blast radius of a change and outputs an ",[18,202,203],{},"affected-file list"," plus potential risks — this is the foundation that lets RUSH safely execute cross-file refactoring. Every subtask in the plan carries dependencies and a risk level, which determine the execution order. Typical scenarios:",[31,206,207,210,213,216],{},[34,208,209],{},"Before renaming a function called in many places, confirm all its callers first.",[34,211,212],{},"Before changing a module's interface, list every downstream that depends on it.",[34,214,215],{},"Assess the blast radius of a change: take a two-layer relationship subgraph around the target symbol.",[34,217,218],{},"When getting familiar with an unfamiliar codebase, expand the relationship subgraph layer by layer from an entry symbol.",[220,221,223],"callout",{"type":222},"tip",[14,224,225,228],{},[18,226,227],{},"Tip for large projects",": for cross-repo work or a large project being used for the first time, let index building finish before launching a RUSH task — planning quality improves significantly.",[14,230,231],{},"The graph's query interfaces are also exposed through the kernel API. Related docs:",[31,233,234,239],{},[34,235,236,238],{},[196,237,199],{"href":198},": the graph's biggest consumer.",[34,240,241,245],{},[196,242,244],{"href":243},"\u002Fen\u002Fdocs\u002Freference\u002Fkernel-api","Kernel API",": the HTTP form of the query interfaces.",{"title":247,"searchDepth":248,"depth":248,"links":249},"",2,[250,251,252],{"id":25,"depth":248,"text":26},{"id":120,"depth":248,"text":121},{"id":190,"depth":248,"text":191},"Build a symbol relationship graph and local vector index for your project, enabling cross-file call queries so AI understands the whole codebase","md",{},true,8,"\u002Fen\u002Fdocs\u002Fguides\u002Fcode-graph","Feature Guides",{"title":5,"description":253},"en\u002Fdocs\u002F02.guides\u002F08.code-graph","sm9SH8kCbDhUuJjQQ76cAyqoTYqfB5Ak1cWvyOzv1ao",[264,268],{"title":265,"path":266,"stem":267,"children":-1},"FIM Code Completion","\u002Fen\u002Fdocs\u002Fguides\u002Ffim-completion","en\u002Fdocs\u002F02.guides\u002F07.fim-completion",{"title":269,"path":270,"stem":271,"children":-1},"MCP Tools & Marketplace","\u002Fen\u002Fdocs\u002Fguides\u002Fmcp","en\u002Fdocs\u002F02.guides\u002F09.mcp",[273],{"title":274,"path":275,"stem":276,"children":277,"page":304},"En","\u002Fen","en",[278],{"title":279,"path":280,"stem":281,"children":282,"page":304},"Docs","\u002Fen\u002Fdocs","en\u002Fdocs",[283,305,326,343],{"title":284,"path":285,"stem":286,"children":287,"page":304},"Getting Started","\u002Fen\u002Fdocs\u002Fgetting-started","en\u002Fdocs\u002F01.getting-started",[288,292,296,300],{"title":289,"path":290,"stem":291},"Installation & Download","\u002Fen\u002Fdocs\u002Fgetting-started\u002Finstallation","en\u002Fdocs\u002F01.getting-started\u002F01.installation",{"title":293,"path":294,"stem":295},"Register & Sign In","\u002Fen\u002Fdocs\u002Fgetting-started\u002Fregister-login","en\u002Fdocs\u002F01.getting-started\u002F02.register-login",{"title":297,"path":298,"stem":299},"First-Time Setup","\u002Fen\u002Fdocs\u002Fgetting-started\u002Ffirst-setup","en\u002Fdocs\u002F01.getting-started\u002F03.first-setup",{"title":301,"path":302,"stem":303},"Migrate from VS Code","\u002Fen\u002Fdocs\u002Fgetting-started\u002Fmigrate-from-vscode","en\u002Fdocs\u002F01.getting-started\u002F04.migrate-from-vscode",false,{"title":259,"path":306,"stem":307,"children":308,"page":304},"\u002Fen\u002Fdocs\u002Fguides","en\u002Fdocs\u002F02.guides",[309,313,315,316,317,318,322],{"title":310,"path":311,"stem":312},"AI Chat & Inline Edit","\u002Fen\u002Fdocs\u002Fguides\u002Fai-chat","en\u002Fdocs\u002F02.guides\u002F05.ai-chat",{"title":199,"path":198,"stem":314},"en\u002Fdocs\u002F02.guides\u002F06.rush",{"title":265,"path":266,"stem":267},{"title":5,"path":258,"stem":261},{"title":269,"path":270,"stem":271},{"title":319,"path":320,"stem":321},"Debugging & DAP","\u002Fen\u002Fdocs\u002Fguides\u002Fdebugging","en\u002Fdocs\u002F02.guides\u002F10.debugging",{"title":323,"path":324,"stem":325},"Integrated Terminal","\u002Fen\u002Fdocs\u002Fguides\u002Fterminal","en\u002Fdocs\u002F02.guides\u002F11.terminal",{"title":327,"path":328,"stem":329,"children":330,"page":304},"Models & Billing","\u002Fen\u002Fdocs\u002Fmodels-billing","en\u002Fdocs\u002F03.models-billing",[331,335,339],{"title":332,"path":333,"stem":334},"Models","\u002Fen\u002Fdocs\u002Fmodels-billing\u002Fmodels","en\u002Fdocs\u002F03.models-billing\u002F12.models",{"title":336,"path":337,"stem":338},"Plans & Credits","\u002Fen\u002Fdocs\u002Fmodels-billing\u002Fplans-quota","en\u002Fdocs\u002F03.models-billing\u002F13.plans-quota",{"title":340,"path":341,"stem":342},"BYOK (Bring Your Own Key)","\u002Fen\u002Fdocs\u002Fmodels-billing\u002Fbyok","en\u002Fdocs\u002F03.models-billing\u002F14.byok",{"title":344,"path":345,"stem":346,"children":347,"page":304},"Reference & FAQ","\u002Fen\u002Fdocs\u002Freference","en\u002Fdocs\u002F04.reference",[348,352,356,358,362],{"title":349,"path":350,"stem":351},"Keyboard Shortcuts","\u002Fen\u002Fdocs\u002Freference\u002Fshortcuts","en\u002Fdocs\u002F04.reference\u002F15.shortcuts",{"title":353,"path":354,"stem":355},"Configuration","\u002Fen\u002Fdocs\u002Freference\u002Fconfiguration","en\u002Fdocs\u002F04.reference\u002F16.configuration",{"title":244,"path":243,"stem":357},"en\u002Fdocs\u002F04.reference\u002F17.kernel-api",{"title":359,"path":360,"stem":361},"FAQ","\u002Fen\u002Fdocs\u002Freference\u002Ffaq","en\u002Fdocs\u002F04.reference\u002F18.faq",{"title":363,"path":364,"stem":365},"Cloud REST API","\u002Fen\u002Fdocs\u002Freference\u002Fcloud-api","en\u002Fdocs\u002F04.reference\u002F19.cloud-api",1788542300514]