Imported from ContextUnity/contextunity-forge-mcp (
src/engine/linker/AGENTS.md). Install upstream withnpx skills add ContextUnity/contextunity-forge-mcp --skill linker. Copyright stays with the author.
Cross-File Linker (src/engine/linker/)
The linker resolves cross-file Reference targets, module imports, callable contracts, and manifest-driven framework edges from the extracted SemanticCatalog and FlowStore without mutating language AST state. Keep resolution phases modular (interner, semantic_context, resolution, contracts, framework_relations) and operate strictly on compact typed sidecars and SymbolId/PathId handles. Do not embed language-specific syntax heuristics that belong in ../languages/ or framework rules that belong in declarative .toml manifests, and do not re-parse source files or mutate Node.details JSON DOMs during linking passes.
Maintain sub-second linking by interning file paths once per file rather than per node and indexing hot lookup tables (by_id, flows, named_bindings, module_exports, component_scopes) directly by SymbolId/PathId without secondary string-to-ID hash lookups in inner loops. Precompute file-level import masks and language dependency contexts before parallel Rayon passes instead of locking shared caches (Mutex/RwLock) or splitting path strings inside per-reference resolution. Allocating temporary String keys for lookup probes, cloning Node or serde_json::Value payloads across phases, or scanning full catalog tables linearly is strictly forbidden.
