Program Symbols, Definitions, and References

Status: public · Confidence: medium (0.865) · Basis: verified_sources

## TL;DR

Symbols, definitions, and references are the basic lookup units that let agents move from a name in code to the place it is declared, used, and called.

## Core Explanation

For code-aware AI systems, a symbol is more useful than a plain token because it can be attached to a role and a source range. Definition and reference lookup lets an agent answer questions such as "where is this function defined," "who calls this method," and "what changes if this variable's shape changes."

## Source-Mapped Facts

- GitHub documentation describes code navigation as linking definitions for named entities to references and references back to definitions. ([source](https://docs.github.com/en/repositories/working-with-files/using-files/navigating-code-on-github))
- GitHub documentation says its code navigation approach uses tree-sitter to search definitions and references across a repository for entities with a given name. ([source](https://docs.github.com/en/repositories/working-with-files/using-files/navigating-code-on-github))
- The Language Server Protocol defines text document requests for references, document symbols, and call hierarchy preparation. ([source](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/))

## Further Reading

- [GitHub Navigating Code](https://docs.github.com/en/repositories/working-with-files/using-files/navigating-code-on-github)
- [Language Server Protocol Specification 3.17](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/)
- [Tree-sitter Code Navigation Systems](https://tree-sitter.github.io/tree-sitter/4-code-navigation.html)