# name_functions

> **Tool `tools/llm/name_functions.py`** (program, Models). Suggest a name, a signature and a summary for every unnamed function.

Run it with `./gameframe run name_functions ARGS` or `python3 tools/llm/name_functions.py`. [Source on GitHub](https://github.com/tanepiper/game-frame/blob/main/tools/llm/name_functions.py).

## Its own help

This is the help text in the tool itself, as `./gameframe tool name_functions` prints it.

```text
Suggest a name, a signature and a summary for every unnamed function.

Usage:
  name_functions.py prepare [--export DIR] [--binary NAME] [--min-size N] [--max N] [--all]
  name_functions.py submit  [--binary NAME] [--model ID] [--size N]
  name_functions.py status  [--binary NAME]
  name_functions.py fetch   [--binary NAME]
  name_functions.py cancel  [--binary NAME]

  prepare   picks the functions and writes one request each to
            analysis/llm/names/<binary>/requests.jsonl, then prints how many and their size.
            Nothing is sent. Read the count before you submit.
  submit    sends them as batches of --size requests each to APIs with batch support. With a
            compatible local or OpenAI API, it runs requests synchronously and saves results
            beside them. Small hosted batches end sooner and can be fetched one by one
  status    prints batch progress or the local synchronous results
  fetch     writes the answers of every batch that has ended to
            analysis/llm/names/<binary>/suggested.tsv: address, name, confidence
            (low/medium/high), signature, summary, evidence. Run it again as more batches end
  cancel    cancels hosted batches that have not ended; local requests run synchronously

  --export    the Ghidra export (default: analysis/export in the project)
  --binary    the binary in the export (default: the only one, or the first .exe)
  --min-size  skip functions smaller than N bytes (default 16)
  --max       send at most N functions, the largest first (default 2000)
  --all       include functions that already have a name (to check the names)
  --model     the model (default: selected provider profile; GAMEFRAME_MODEL overrides one run)
  --size      requests per hosted batch (default 200; ignored by synchronous local APIs)

Each request holds the function's pseudocode, the names of its callers and callees, and the
strings it uses. Functions named in labels/names.tsv are skipped.

The suggestions are guesses from pseudocode, so they stay in analysis/ (ignored by git).
Confirm a suggestion as re-trace does before you copy it to labels/names.tsv, and label it
*inferred* until you have.

What it does not do: spend control. --max limits the number of requests. Set provider spend
limits for hosted APIs. Submitting model requests requires a typed confirmation; status, fetch
and cancel do not run inference. It never writes labels/ and never applies names in Ghidra.
```
