Skip to main content

Why instructions matter

Connecting the CodeAlive MCP server gives an agent new tools — it does not change the agent’s habits. Coding agents ship with built-in exploration tools (Cursor’s codebase_search, Claude Code’s Grep/Glob, Codex’s shell search), and their planners reach for those first. Without an explicit instruction, an agent will happily run local grep over one checkout while a fully indexed, cross-repository semantic engine sits unused. The fix is a short instruction file in the agent’s native format. This page covers the patterns that reliably work and where to put them for each agent.
Working with 1C:Enterprise (BSL) codebases? Read the dedicated page — CodeAlive & 1С — first: the word “metadata” means something different in 1C, and agent instructions need to account for it.

Where instructions live

AgentInstruction fileNotes
Claude CodeCLAUDE.md (repo root or ~/.claude/CLAUDE.md)Also reads AGENTS.md. See Claude Code setup
Codex (CLI / App / IDE)AGENTS.md (repo root) + ~/.codex/AGENTS.md (global)See Codex setup
Cursor.cursor/rules/*.mdcLegacy .cursorrules is deprecated. See Cursor setup
Cline.cline/rules.mdSee Cline setup
Most other agentsAGENTS.md (repo root)AGENTS.md has become a de-facto cross-agent standard
Because Claude Code, Codex, Cursor’s CLI, and many others all read a repo-root AGENTS.md, one well-written file covers most of your team regardless of which agent each person uses.

Patterns that work

Observations from CodeAlive’s own production prompt and from how other MCP vendors instruct agents converge on a few rules:

1. Imperative plus a trigger condition

State when to use the tool, not just that it exists.
A passive mention (“CodeAlive provides semantic search”) does not change behaviour; a conditional imperative does.

2. Name the built-in tool you are overriding

Agents fall back to their native tools unless the instruction names them explicitly. This is the single most important pattern — and the most commonly missed one:
Generic phrasing (“prefer CodeAlive for search”) loses to the planner’s habit; naming the competing tool wins.

3. Sequence the tools

Tell the agent what a good exploration looks like as an ordered path, so it doesn’t stop at the first tool:

4. Teach the query grammar in one line each

The two most common failure modes are keyword-style semantic queries and question-style grep queries. One line each prevents both:

5. Keep always-on context small

Instruction files are injected into every request. Keep the CodeAlive section to 10–15 lines; move anything longer into on-demand mechanisms (Cursor’s Agent Requested rules, Claude Code skills). A bloated always-on rule gets skimmed by the model and taxes every prompt.

Universal snippet

This block works verbatim in AGENTS.md, CLAUDE.md, and .cline/rules.md, and as the body of a Cursor .mdc rule:
AGENTS.md / CLAUDE.md — CodeAlive section
The last bullet matters: an instruction that bans local tools outright degrades editing tasks. Scope the preference to exploration of indexed code, and leave the working tree to the agent’s native tools.

Per-agent specifics

Claude Code

CLAUDE.md routing rules and the search subagent pattern

Cursor

Rule types, and beating the built-in codebase_search

Codex

AGENTS.md placement and a complete example
Two agent-specific facts worth knowing even before opening those pages:
  • Cursor’s built-in codebase_search cannot be disabled in the default Agent mode. The working approach is a precedence rule that names it — see the Cursor page.
  • Codex reads the MCP server’s own instructions field at initialization, and the CodeAlive server ships tool-choice guidance there. AGENTS.md still helps: server instructions describe the tools, while AGENTS.md sets project-level precedence over built-ins.

Verify it works

After adding instructions, test with a question that used to trigger built-in search:
Watch the agent’s tool calls: the first exploration call should be CodeAlive semantic_search (visible in the agent’s tool log), not a local grep. If the agent still reaches for built-ins, strengthen pattern #2 — name the specific tool it used and forbid it for exploration questions.

Build a Code Research Agent

Full example prompt for your own agent on the Tool API

CodeAlive & 1С

1C:Enterprise specifics — the “metadata” dichotomy

MCP Overview

Tool list and connection options

Tips & Tricks

More agent-specific tips