Skip to content
Loom Docs
Esc
↑↓navigate↵open⌘Jpreview
Product
View as Markdown
On this page

Answer repository questions without a local checkout

Give triage agents, design assistants and team chatbots access to indexed repositories. Retrieve code citations and check answer scope, freshness and completeness.

An AI agent can answer questions about a Git repository without cloning it onto the machine that runs the agent. Loom indexes the repository on the server and returns source ranges from the branch the caller can read. A triage bot can find where a retry is handled, a design assistant can look up callers, and a team chatbot can answer questions with file and line citations.

Try a question from a machine without the repository

First add and index the repository. Give the bot a Loom identity with viewer access to the intended code namespace. Have the application choose the namespace from the caller’s authorized repositories. The Git credential used to build the index grants no access to the chatbot’s users. Repository access rules

From any client that can reach Loom, replace the organization, namespace and question with those of your indexed repository:

curl --fail-with-body -sS "$LOOM_BASE_URL/v1/code.ask" \
  -H "Authorization: Bearer $LOOM_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{
    "org": "example",
    "namespace": "code-example",
    "question": "Where is the cache retry delay calculated?",
    "synthesize": false,
    "no_cache": true,
    "rerank": "none"
  }'

This returns retrieved citations with path, start_line and end_line. The answer field is empty because the request skips synthesis and cached drafts. rerank: "none" skips reranking. Retrieval can still use the deployment’s embedding provider. The corresponding MCP tool is loom_code_ask.

To let Loom draft the answer, use a configured server model and set synthesize: true:

curl --fail-with-body -X POST "$LOOM_BASE_URL/v1/code.ask" \
  -H "Authorization: Bearer $LOOM_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"org":"example","namespace":"code-example","question":"Where are incoming requests authorized?","synthesize":true}'

To confirm that the model actually drafted an answer, follow the code.ask probe in diagnose silent model or provider failures. It covers the trace span to look for, the 409 READS_LLM_FREE refusal, and the spend caps that skip synthesis while retrieval still answers.

A grounded answer returns answer. Its citations contain indexed file ranges, so an answer based only on pull-request or issue history can have no file citations. Use code.search to retrieve the underlying history record rather than treating an empty citations list as an abstention. Without no_cache: true, a matching cached synthesized answer can still be returned. The code operation reference gives the full contract.

To verify a citation, open its file and line range in the repository browser at the result’s as_of.commit. Check that those lines support the claim. If the result has no recorded commit or you cannot read those lines, report the citation as unchecked.

For more context around a cited function, try passing path:start_line as name to code.symbol with include_body: true. For example, use name: "src/cache.py:42". Use the same organization and code namespace. If a returned definition covers the cited line in that file, inspect its body. Comparing the commit for the definition’s index tier in code.index_status with the result’s as_of.commit is a consistency check.

Use as_of when available to check the indexed branch and commit behind the result. Check abstain, partial and their reasons before displaying an answer. To test the integration, start with a question whose source you can verify, then ask one the repository cannot answer and check that the client surfaces the abstention or missing evidence. Use a separate identity without repository access to check that it cannot retrieve those citations. Index freshness

Serve triage agents, design assistants and team chatbots

Assistant Evidence to request Result to check
Triage agent code.search for the symptom, then code.symbol and code.callers for the relevant definition Cited implementation and callers that explain the reported path
Design assistant code.impact for a proposed symbol change and linked team decisions Affected definitions, test mappings and lessons with their freshness state
Team chatbot code.ask for an answer, or code.search for the application’s own reader Supporting file ranges or history records, or an explicit abstention

When a chatbot replies in a shared channel, every evidence source must be readable by both the questioner and every reader of the reply. That includes repositories, linked trackers, and any memory namespaces available to code.ask synthesis. File citations do not show which tracker facts or memories the synthesizer saw. If the host cannot verify the scope of all synthesis inputs, retrieve only from explicitly authorized sources and synthesize in the host using only that evidence. If the host cannot confirm that every reader may see those authorized sources, reply privately with separate authorization or abstain. See audience-scoped retrieval for the host-side pattern.

Check language and compiler-tier support and returned truncation or lower-bound metadata. An empty caller list does not prove there are no runtime callers, and an impact test mapping does not mean a test ran. Use the SDK intent table to expose bounded lookups to a model, and evaluate on your own repository before relying on its answers.

Calibrate the embedding model

After indexing, run code.calibrate as an administrator for the indexed namespace. Repeat calibration after changing the embedding model and rebuilding its vectors:

curl --fail-with-body -X POST "$LOOM_BASE_URL/v1/code.calibrate" \
  -H "Authorization: Bearer $LOOM_ADMIN_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"org":"example","namespace":"code-example"}'

Similarity scales differ between embedding models. A threshold that admits useful evidence for one model can admit unrelated evidence for another. Check representative questions and questions the repository cannot answer; do not copy a threshold from another deployment. code.search reports calibration_explanation and its abstention reason. See index operations for indexing and calibration, and debugging for retrieval diagnostics.

Configure mixed source and documentation retrieval

The defaults apply a 0.25 multiplier to prose, use the flat chunk-kind prior, and allow synthesis to write up to 900 tokens. The output cap limits cost and answer length. A response that reaches the cap discloses incomplete synthesis.

For a mixed source and documentation workload, compare the defaults with this explicit settings file configuration:

version: 1
settings:
  code_search_prose_penalty: 1.0
  code_search_kind_prior: structural
  llm_max_tokens_overrides: '{"code_answer_synth":4000}'

code_search_kind_prior accepts structural, flat, default, functions_first, or off. The structural option boosts the kind named by a question, such as a class, without a fixed preference for functions over documentation. flat and default apply fixed kind weights. functions_first applies the weights of flat and ranks a question long enough to be an issue body functions first. A kind_prior request overrides the deployment setting through HTTP or an SDK; it remains hidden from the compact MCP tool schema. A model using MCP therefore receives the deployment setting without a source patch.

For a source-only workload, a code_search_prose_penalty below 1.0 can demote prose. Measure that choice against both source and documentation questions.

A repository that keeps generated API clients or specifications beside the code that serves them can rank the generated copy of a request model above its source. A code_search_generated_penalty below 1.0 ranks those files lower without removing them from search; a question about tests leaves mocks where they rank. The built-in path shapes always apply while the penalty is on, so name the trees they miss:

version: 1
settings:
  code_search_generated_penalty: 0.25
  code_search_generated_globs: "clients/**,**/openapi.json,**/openapi.yaml"

The entry’s exclude globs remove such trees from the index instead. Set LOOM_CODE_ASK_LLM_MODEL to choose a synthesis model supported by the configured provider. The default follows the deployment model; these retrieval settings do not select a paid provider. All settings are listed in the configuration reference.

Check answer completeness and provider availability

code.ask exposes separate signals:

Field Meaning
citations Indexed source ranges supplied as evidence for the answer.
retrieval_confidence Confidence in retrieval, not a grade of the answer.
coverage The synthesizer’s full, partial, or none self-assessment; empty when not assessed, including cached answers. This is not verified correctness.
partial A retrieval or provider limit prevented a complete response.
partial_reason, note The missing retrieval leg, deadline, or synthesis limitation.
abstain, abstain_reason No grounded answer is returned and why.

A failed embedding provider can leave lexical evidence available. Search and answers disclose that limitation rather than presenting lexical-only results as healthy hybrid retrieval. A deliberate lexical-only search is not a provider failure. Provider failures also appear in health diagnostics; successful provider requests clear the failure state.

Synthesis keeps the provider-bounded response without a second character cut. An output-token limit sets partial; filtering or a provider refusal abstains. Failed synthesis returns abstain: true, abstain_reason: "synthesis_unavailable" and coverage: "none" with the available citations. Answers from failed retrieval legs or interrupted synthesis are not stored in the answer cache, including as negative answers. Fix provider credentials or limits and make a fresh request; no cache purge is needed for those failed responses.

Finding the expected file is a retrieval result. Producing a complete, correct answer is a separate result. Keep both measures when evaluating a repository assistant.

Using retrieval inside a coding agent

An existing checkout already provides local files and tools. Loom can add remote cross-file relationships, cited retrieval and shared lessons that are not present in that checkout. Whether these reduce work or improve answers depends on the task and index coverage. Use local tools for uncommitted files and insufficient or unsupported indexed results; check the indexed commit before treating evidence as current.

A connected MCP server does not establish that a coding agent uses these results. To check discovery, calls and evidence use, see diagnose agents that never call the tools.

For issue-resolution comparisons, follow the paired evaluation and the benchmark methodology.

Last updated on

Was this page helpful?