Skip to main content

Module handle

Module handle 

Source
Expand description

Stable cross-turn symbol handles: path#name@Lline.

A handle is a compact, copy-pasteable identifier for a symbol that an agent can reuse across turns without re-discovering it: the project-relative file path, the (possibly qualified) symbol name, and the 1-based start line, e.g. src/lib.rs#Config::load@L22.

Two delimiters carry the structure:

  • # separates path from name — file paths never contain #, so the first # is an unambiguous split point even for trait-impl names that embed :: (src/x.rs#std::fmt::Display::fmt@L9).
  • @L<digits> is an optional line suffix, parsed only when it is a real @L<number> tail, so the rare symbol name containing @ still round-trips.

The line is a hint, not an identity: crate::core::graph_provider resolves a handle by (path, name) first and treats @Lline as a tiebreak, so a handle keeps resolving after the symbol drifts to a new line — strictly more robust than a brittle line-only reference.

Determinism (#498): emitting a handle is a pure function of (path, name, line), so any output carrying handles stays byte-stable across identical re-reads and provider prompt caching still applies.

Structs§

SymbolHandle
A parsed symbol handle. line is None when the source string omitted the @LN suffix; resolution then falls back to (path, name) only.

Constants§

USAGE_HINT
One-line, self-describing usage hint (GL#580) for outputs that list located symbols (outline, signatures/map, call-graph). Rather than repeat a full handle on every line — the file/name/line are already shown — these outputs carry this single hint telling the agent that each name @Lstart is addressable as a stable handle. Matches the codebase’s ↳ … hint style and is a constant, so it stays deterministic (#498).

Functions§

emit
Emit a handle string from parts without constructing a SymbolHandle. The hot path for renderers that already hold (path, name, line).
looks_like_handle
Whether s looks like a handle (carries a non-empty path#name core). Lets a tool accept either a bare symbol name or a handle in the same argument.