A technical deep dive into our analysis engine.

How Context Nexus Works

Context Nexus is an in-editor AI co-pilot for Unreal Engine 5. It builds a structured model of your project—across C++ and Blueprints—so the AI can answer architectural questions accurately and efficiently.

1) Global Analysis (Deep Scan)

We parse your C++ target (headers + sources) and all Blueprint assets to produce a project knowledge graph: types, functions, variables, call sites, event flows, and cross-references between C++ and Blueprints.

C++: Clang AST (Planned/Rolling Out)

We generate compile_commands.json and run a sidecar helper with Clang AST for compiler-grade parsing. We extract classes, functions (with bodies), UFUNCTION/UPROPERTY, parameters, templates, inheritance, UE macros, RPC qualifiers, and symbol references.

Blueprint: Blueprint Bridge (Shipping)

We traverse Blueprint graphs (nodes, pins, edges) programmatically. Ubergraph resolution follows event stubs (BeginPlay, ReceiveTick, RPC events) to real execution paths and emits a compact IR that preserves logic and dependencies.

2) Targeted Context (Selective Send)

You choose the precise files, functions, variables, or graphs relevant to your question. We build a minimal Targeted Context from the graph and send only that to your chosen AI provider—lower token cost, higher precision.

3) Answering Architectural Questions

Examples:

  • “If I change AMyActor::Tick, which Blueprints break?”
  • “Show everything that writes to PlayerHealth.”
  • “Which BP calls end up invoking StartMatch() on the GameMode?”

Under the hood, we traverse the merged C++/BP graph (calls, read/write, event, override, delegate bind, and more) to assemble the most relevant slice.


Why AST Beats Regex for AI Copilots in Unreal

TL;DR: Regex matches text; an AST understands code. With Unreal’s macro-heavy, template-rich C++, AST makes answers cheaper and more accurate.

1) Unreal C++ Isn’t Regular

Macros (UCLASS, UFUNCTION), templates (TArray, TMap), and RPC qualifiers trip up text scanning. AST parses what the compiler accepts.

2) Ground-Truth Symbols

AST yields exact declarations/definitions and real cross-TU references—no guesswork.

3) Token Budgets Love Precision

AST → precise dependencies → minimal context payload → lower cost, better answers.

4) Safety & Isolation

The AST runs in a sidecar process. Parse errors can’t crash the editor and produce actionable diagnostics.

5) Better Cross-Language Answers

AST (C++) + Blueprint Bridge (BP) = unified, typed graph for architecture-level questions.

Implementation Sketch

  1. Generate compile_commands.json from UBT.
  2. Launch the sidecar with Clang libs.
  3. Parse TUs → emit JSON (symbols, relations, references).
  4. Merge with Blueprint Bridge output → unified graph.
  5. Build Targeted Context for the user’s query → send to the AI.

How Context Nexus Links Blueprints to C++

Unreal games rarely live in only one world. Gameplay flows through Blueprint graphs and C++ APIs, macros, and reflected properties. Context Nexus builds a unified knowledge graph so the AI can reason across both—accurately.

1) Blueprint Bridge (Graph Truth)

  • Traverses Event, Function, and Macro graphs (nodes, pins, edges).
  • Ubergraph Resolution follows stubs like BeginPlay, ReceiveTick, and RPC events to the actual execution path.
  • Normalizes control flow (branches, delays, timelines) to a compact IR the AI can reason about.

2) C++ Model (Compiler-Grade Truth)

  • Parses headers & sources (planned/rolling out) via a Clang AST sidecar using your compile_commands.json.
  • Extracts classes/structs, UFUNCTION/UPROPERTY metadata, overrides/inheritance, and call/reference sites.
  • Handles UE macros, templates, RPC qualifiers, and build flags robustly.

3) The Bridge: Cross-Language Edges

  • Maps Blueprint nodes like Call Function to target C++ symbols (by name + signature + reflection data).
  • Creates edges for call, read/write, event, delegate bind, and cast.
  • Result: one graph where the AI can answer “If I change this C++ function, which BPs break?” or “Where does PlayerHealth get written?”

Why this beats regex

Regex matches text; AST and graph traversal understand code. That’s the difference between good guesses and grounded answers—with smaller payloads and lower token costs.

    C++ (AST) ─────┐
                   ├──► Unified Knowledge Graph ─► Targeted Context ─► AI Answer
    Blueprints ────┘