# Locate and stamps

Turn a line, a name or a diff into a symbol, and find out later whether its code changed.

> Web page: https://enola.tech/docs/locate
> All pages: https://enola.tech/llms.txt

## Key your records to code, not to lines

Review comments, incident notes and agent memory usually point at `file:line`. A line moves whenever something above it changes. `enola locate` turns that place into a symbol with a stable id and a version of its code, and later tells you what became of it.

For the same thing as a skill for your agent's notes, see [Memory](https://enola.tech/docs/skill-memory.md).

## Turn a line, a name or a diff into symbols

Map source to symbols:

```shell
enola locate src/app.ts:120
enola locate --names nodeFor,Graph.nodeFor --json
git diff | enola locate --json --diff -
```

A location is `file:line` or `file:start-end`. Each resolves to the innermost symbol holding it: its fact `id`, the same as in `facts.jsonl`, and its `body_hash`, the version of its code. F# and VB.NET have no spans, so they get the nearest declaration above, and the result says so.

Agents get the same lookup through the `locate` MCP tool.

## What to keep with a record

| Field | Why |
| --- | --- |
| `id` | Which symbol. The only required field. |
| `body_hash` | Which version of its code |
| `name`, `symbol_kind` | Finds the symbol again after a move |
| `repo` | Keeps copies in other repositories apart |
| `inner_hash` | Tells a changed signature from a changed body |
| `decl_hash` | When present, which of several declarations sharing an id |
| `cited_hash`, `cited_lines` | For a record about specific lines |

## Ask what became of it

Pass the stored fields back as JSONL, one stamp per line:

Check stamps:

```shell
enola locate --json --stamps findings.jsonl
```

| Status | Meaning | What to do |
| --- | --- | --- |
| current | Same symbol, same code | Keep the record |
| rewritten | Same symbol, changed code | Check it again |
| moved | Same code, in another file or package | Store the new id |
| present | Same symbol, but a version is missing on one side | Treat it as unverified |
| gone | Not found; similar symbols may be listed | Look before dropping it |
| ambiguous | More than one symbol fits | Show the candidates and pick none |

`rewritten` is a reason to check, not to delete. With cited lines stored, the result also says whether those lines are still in the symbol. Counting the records that share an `id` shows which code keeps coming up, whatever words each record used.

## Choose the graph to answer from

| Option | Answers against |
| --- | --- |
| none | The working tree, taking a snapshot when the one on disk is stale |
| `--at` | A revision recorded in the [history](https://enola.tech/docs/history.md) |
| `--facts` | A stored snapshot, with no working tree |

Before a fix, and without the source:

```shell
enola locate --at abc123~1 --side old --diff fix.diff
enola locate --facts .enola src/app.ts:120
```

A service can use `--facts` to resolve against exactly the graph it loaded. Without the source, there is no check of cited lines.

Every field is in [schema/locate.md](https://github.com/enola-labs/enola/blob/main/docs/schema/locate.md). How fast line references go stale is measured in [Keeping AI Coding Agent Memory Relevant](https://enola.tech/blog/agent-memory-needs-a-code-reference).
