Skip to content

Deepen with an LLM ​

The deepen phase of kontext init is normally driven by the agent you work with. The autopilot runs the same tasks through any LLM you configure as an adapter with an llm op, useful for a first pass over a large repository.

sh
kontext adapters add llm-claude              # or llm-codex, llm-ollama, or your own
kontext init --deepen --llm llm-claude --jobs 3 --max 20
text
[5/5] deepen   … 1/47 done, running up to 20 task(s) with 'llm-claude' (3 at a time)
  [1/20] mod:libs-schemas ✓ (32.0s)
  [2/20] mod:apps-runner ✓ (41.3s)
  …
      deepen   partial ✓ 20 · ✗ 0 · progress 21/47
OptionDefaultMeaning
--llminit.llmadapter to use
--jobs2tasks in parallel
--max50tasks in this run

Set a default in config to drop --llm:

toml
[init]
llm = "llm-claude"

What the model receives ​

Each task as an agent would see it, plus inlined sources (up to init.task_inline_chars, 24000 characters): the module's docs and key files, or git show --stat of the commits in a decision cluster. Secret files are never attached and attached text is redacted. The model must answer with one JSON object, the same shape as ctx_init_submit:

json
{
  "summary": "One line: what the module is for",
  "overview": "5–15 lines of Markdown",
  "decisions": [{ "title": "…", "decision": "…", "context": "…", "alternatives": "…", "consequences": "…", "paths": ["…"], "commits": ["abc1234"] }],
  "learnings": [{ "title": "…", "body": "…", "paths": ["…"] }]
}

Prose or code fences around the JSON are tolerated. Failed tasks are reported and stay pending.

The answer is the result: the model is told not to call tools, and the presets keep kontext's own MCP server out of the call (-c mcp_servers.kontext.enabled=false for Codex, --strict-mcp-config for Claude Code). With kontext connected to your client, the model could otherwise record the task itself through ctx_init_submit and again through its answer. While a run is going, ctx_init_submit from any other process refuses the run's tasks, and a resubmitted task replaces its own earlier entries instead of adding copies.

Models ​

PresetRunsVariable
llm-claudeclaude -p --strict-mcp-config --tools "" --no-session-persistence --system-prompt … --model <model> --effort <effort>, with ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN droppedmodel (default sonnet; claude-opus-5-5 for Opus, haiku is cheaper), effort (low … max, default high)
llm-codexcodex exec --sandbox read-only --ephemeral -c mcp_servers.kontext.enabled=false, last message from a file–
llm-ollamaPOST /api/generate on $OLLAMA_HOSTmodel (default qwen2.5-coder:14b)
sh
kontext adapters add llm-claude --force --var model=claude-opus-5-5 --var effort=high

Presets are copied into your config when added; after an upgrade, refresh them with --force (and your --vars).

llm-claude runs on the subscription of the account claude is logged into. API keys in the environment are dropped for these calls, so nothing is billed to an API account. It gives the model no tools, no MCP servers and a short system prompt: a task then costs a tenth of what Claude Code's full prompt would add to it, which matters for a subscription's usage limits. The calls are not saved as Claude Code sessions, so they do not show up in claude --resume or kontext distill.

Quality ​

  • Review the diff before committing: the autopilot writes into the working tree only.
  • Run a few tasks first (--max 3) and read them; adjust init.task_max_files or init.task_inline_chars if summaries are shallow.
  • Decision tasks are the ones to check most carefully: they infer intent from commit messages.
  • Mixing is fine: let the autopilot summarize modules and have your agent do the dec: tasks with full tool access.

Released under the MIT or Apache-2.0 license.