AI layers
Where the embedding and the LLM can run, what leaves the machine, and how to turn them on.
AI layers: where the model runs#
Two layers can use an AI model: the embedding of tkt search (items close in meaning join the hits of the words) and the LLM of --summary, tkt suggest and tkt plan from-docs. Each can run in three places, and each says what leaves which boundary:
- this machine: the local model (
aitodo[embed]) or a local LLM command; nothing leaves the machine (but the defaultclaude -pcommand sends the text to Anthropic on your own account); - own infrastructure: a company server or the company's cloud (a company Ollama, a company endpoint behind the tkt server); the text stays inside the company;
- tkt server: the project's server embedding and LLM; the text leaves the company's boundary.
With nothing set, tkt search embeds nothing and asks no server: store text goes to the tkt server only when a setting says so (tkt config set embedProvider server; it needs tkt project llm enable on the project and the llm grant on your token). tkt ai doctor checks whether the server can embed and, if it can, suggests that. The LLM commands use the project's server LLM by default when it is on and you have the llm grant. Nothing has to be installed.
tkt ai doctor: first a short summary per layer: the provider, the setting that chose it, where the text goes and, when the provider in use fails, the failure with its fix. Then this machine (OS, RAM, GPU, as facts: a local model is an optional extra) and a check of each provider: only the chosen one can befail, the others areavailableornot set up, with the fix as a hint. The steps for every option come with--all, without it only a failing layer's.--livesends one fixed text to the providers in use.tkt search --embed-provider local|server|off;--llm-provider local|server|offon the LLM commands.- Every
tkt searchthat embedded says where the text went (--json:embedding).
Details7 items
- Settings, highest first: the flag;
AITODO_EMBED_PROVIDER/AITODO_LLM_PROVIDER(andAITODO_LLM_CMD); the userconfig.yamlnext tocredentials.yaml(AITODO_CONFIG_DIR,~/.config/aitodo/,%APPDATA%\aitodo: yours, never committed); the store config (tkt config set embedProvider local,embedModel,llmProvider: the team's, committed); the default. A bad value:ERR_AI_CONFIG_INVALIDnaming the env var (exit 2) or the file. - Fallback:
localmissing (aitodo[embed]not installed) or failing means no embedding (never the server instead), with a notice on stderr;ERR_EMBED_PROVIDERsays why.serverwithout a pin or a token exits 2 (tkt project register,tkt login); a server that refuses or is out of reach (AI off, no grant, a cap,ERR_LLM_UPSTREAM,--offline) is skipped with a notice. A search never fails on the embedding. - Secrets: both files hold only which provider and which model. Keys live in env vars or the OS keychain:
tkt config setrefuses one (ERR_AI_SECRET_IN_CONFIG), andtkt ai doctorwarns about a key-like entry in either file (it names the key, never the value). A search that sends text that looks like a key or token past this machine warns with the count. - Cache: the vectors are kept in
.aitodo/cache/search/embeddings.dbby project, model and text; another model embeds again, never mixes. - Server-hosted store:
tkt searchruns on the server and uses only the project's server embedding (the run's grant); the user and store settings do not apply,--embed-provider offdoes. - Own endpoint (OpenAI-compatible: vLLM, Ollama, Azure OpenAI):
tkt config set embedProvider endpointwithembedUrlandembedModel, for the LLMllmProvider: endpointwithllmUrlandllmModel(orAITODO_EMBED_URL,AITODO_LLM_URL,AITODO_LLM_MODEL); the key only inAITODO_EMBED_KEYandAITODO_LLM_KEY. A loopback URL is this machine, any other own infrastructure. A missing URL or model exits 2; the answer is checked against its schema, with one retry. - Endpoints outside this machine need https (
ERR_AI_ENDPOINT_INSECURE); plain http only to localhost, and no password in the URL.
Local LLM with Ollama#
tkt ships a wrapper that makes a running Ollama the LLM command: it sends the prompt with the answer's schema to Ollama's /api/chat and prints the JSON. tkt ai doctor prints the exact line, with the Python that runs tkt:
ollama pull qwen3.5:9b-q4_K_M, then AITODO_LLM_CMD='<python> -m aitodo.client.ollama_llm {schema}'.
- Use the GGUF tag (
qwen3.5:9b-q4_K_M): on Apple Silicon the plain tag runs the MLX build, whose Homebrew package lacks structured output. OLLAMA_HOST_URL(defaulthttp://127.0.0.1:11434): this machine, or a company Ollama server over https (own infrastructure);OLLAMA_MODEL,OLLAMA_NUM_CTX(Ollama's own context is small for a long prompt),OLLAMA_STATS_FILE(one line of counts and times per call; never text).- Keep Ollama on
127.0.0.1: its API has no authentication. A shared company server needs a proxy with authentication in front. - A local model is fine for the answer step; picking from a long list needs a strong model (
tkt ai doctorsays what was measured).