# Asking the store

`tkt ask "why is the reaction count missing?"`: an answer from the whole store, with citations, then its sources.

Three LLM calls: the LLM writes search terms from the question; it picks up to 40 sources from the index lines (`[id] title, description`) of the best 200 `tkt search` hits; it answers from the picked items and their graph neighbours, and gets nothing else. A citation must name an item of the prompt; any other is dropped and counted (`dropped`).

- The LLM is the usual chain: `--llm-cmd`, `AITODO_LLM_CMD`, `--llm-provider`, `llmProvider`, else the project's server LLM when it is on and you have the `llm` grant. Without an LLM (`--no-llm`, or none set up) you get the search's ranked source list.
- The pick can run on a model of its own: on the server `AITODO_SERVER_LLM_PICK_MODEL` (default `claude-sonnet-5-5`), on an own endpoint `llmPickModel` / `AITODO_LLM_PICK_MODEL` (default: the endpoint's model); a local LLM command picks its own model.
- Read-only. The output says which place got what (the question, the index lines, the items), and warns when an item it sends holds text that looks like a key or a password.
- The answer comes from the cache while the question and the store stay the same; `--refresh` asks again.

## Details

- Store text is data, never instructions: each call frames it with a random delimiter, the instructions before it, the question after. The answer's text loses its images and HTML; a link is shown as text.
- The source list (40 items): the picks first, then the rest of the shortlist, expanded along the graph as in `tkt search`. When the LLM picks no source there is no answer call: the store does not hold the answer.
- When a provider fails you get the source list with the error; such a run is never cached. The cache key: the project, the providers, the question and the store's state (`.aitodo/cache/llm/ask/`); `AITODO_LLM_CACHE=0` turns it off.
- Context (`tkt ui`'s ask panel asks this way): `--about ID` adds an item's text and its direct graph neighbours to the answer, next to the picks, citable; `--list-item ID` the items of a list (id and title, at most 100); `--previous-question`, `--previous-answer` (its first 600 characters go on) and `--previous-cited` a follow-up's previous turn. All of it is data blocks of the answer prompt; the search terms and the pick calls never get it. A follow-up is never cached.

- `tkt ask`: `--json`, `--llm/--no-llm`, `--llm-cmd`, `--llm-provider`, `--embed-provider`, `--refresh`, `--about`, `--list-item`, `--previous-question`, `--previous-answer`, `--previous-cited`. `--json`: `{question, answer, citations[{key, ref, anchor, kind, id, title}], conflicts, notFound, sources[{key, ref, anchor, kind, id, title, status, why, picked, sent, cited}], shortlist, terms, dropped{terms, picks, citations, images}, llm{provider, pickProvider, place, placeLabel, note, cache, generatedAt, calls, costUsd, error}, egress[{step, to, place, placeLabel, items, chars}], embedding, secretItems, setupHint, context{about, page, neighbours, earlier, list{given, sent, cut}, previous}}`.

## Commands on this page

- [`tkt ask`](/en/docs/reference/commands/workflow.md#tkt-ask): Ask the whole store a question: an answer with citations, then its sources

## Related

- Config key: [`llmPickModel`](/en/docs/reference/config.md#llmPickModel): The model of tkt ask's pick step on llmProvider: endpoint (unset: llmModel)
- Env var: [`AITODO_LLM_PICK_MODEL`](/en/docs/reference/env.md#AITODO_LLM_PICK_MODEL): The model of tkt ask's pick step on llmProvider: endpoint; beats llmPickModel (unset: the endpoint's model)
- Env var: [`AITODO_SERVER_LLM_PICK_MODEL`](/en/docs/reference/env.md#AITODO_SERVER_LLM_PICK_MODEL): The model of tkt ask's pick step on the server LLM (an openai provider: its own model)
