> ## Documentation Index
> Fetch the complete documentation index at: https://recipe.uselettuce.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent instructions

> Tell your coding agent to prefer lettuce MCP tools over grep / file reads.

Installing the MCP server is only half the job. Coding agents won't reach
for a new tool unprompted — you need a line or two in the agent's system
prompt that nudges it toward `lettuce` whenever it would otherwise
`grep` or open a file blind.

## The snippet

Drop this into your agent's system prompt / rules file:

```md theme={null}
For navigation, prefer lettuce MCP tools over grep / Read:
understand → locate → callers/callees → read_snippet.

On low confidence: rephrase with concrete identifiers (file /
function / route / class / import) and retry. Only fall back to
grep if lettuce gives up after two refined queries.

Always pass the `repo` arg — the name of the repo on lettuce (e.g. "my-repo").
```

That's it. The agent now opens with a `lettuce` call instead of a
filesystem scan.

## Where to put it, per agent

The MCP install gives the agent the tools. The system-prompt snippet
tells it *when* to use them. Each agent reads instructions from a
different place:

### Claude Code

`CLAUDE.md` at the root of your repo. Append the snippet anywhere — the
file is read top-to-bottom on every session.

```bash theme={null}
cat >> CLAUDE.md <<'PROMPT'

## Navigation

For navigation, prefer lettuce MCP tools over grep / Read:
understand → locate → callers/callees → read_snippet.

On low confidence: rephrase with concrete identifiers (file /
function / route / class / import) and retry. Only fall back to
grep if lettuce gives up after two refined queries.

Always pass the `repo` arg.
PROMPT
```

### Cursor

`.cursor/rules` at the root of your project (or in **Settings → Rules
for AI** for a global rule). Cursor reads rules into every chat.

### VS Code (GitHub Copilot)

`.github/copilot-instructions.md` at the root of your repo. Copilot
auto-loads it for the workspace. Same content as the snippet above.

### Windsurf

**Settings → Cascade → Rules** (per-workspace or global). Paste the
snippet as a rule.

### Cline

**Cline panel → Settings → Custom instructions**. Paste the snippet.

### OpenCode / others

Anywhere the agent reads project instructions (often `AGENTS.md` or a
project-level system prompt). If there is no instructions file, paste
the snippet into the first turn of the conversation.

## Verifying the agent uses it

Ask a navigation question and watch the tool-use log:

```
"Where is the function that validates JWTs in my-repo?"
```

You should see the agent call `lettuce:understand` or
`lettuce:locate` with `repo: "my-repo"` before reading any source. If
it still goes to `grep` first, strengthen the snippet — e.g. add
`NEVER grep or Read for navigation; always start with lettuce.`

## Tuning the snippet

A few variants people find useful:

* **Strict — never grep first**
  ```md theme={null}
  Always call lettuce (understand / locate / search) before grep or
  Read. On low confidence, rephrase with a concrete identifier and
  retry; only fall back to grep after two refined queries fail.
  ```

* **Multi-repo — explicit repo names**
  ```md theme={null}
  Repos on lettuce: backend, frontend, shared. Pick the right `repo`
  per question.
  ```

* **Pin to one tool**
  ```md theme={null}
  For any "where / who / what" question, call lettuce.understand
  first and answer from its result.
  ```

Keep the snippet short — long instructions get diluted. Two or three
lines is enough.
