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’scodebase_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
| Agent | Instruction file | Notes |
|---|---|---|
| Claude Code | CLAUDE.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/*.mdc | Legacy .cursorrules is deprecated. See Cursor setup |
| Cline | .cline/rules.md | See Cline setup |
| Most other agents | AGENTS.md (repo root) | AGENTS.md has become a de-facto cross-agent standard |
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.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: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 inAGENTS.md, CLAUDE.md, and .cline/rules.md, and as the body of a Cursor .mdc rule:
AGENTS.md / CLAUDE.md — CodeAlive section
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
- Cursor’s built-in
codebase_searchcannot 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
instructionsfield at initialization, and the CodeAlive server ships tool-choice guidance there.AGENTS.mdstill helps: server instructions describe the tools, whileAGENTS.mdsets project-level precedence over built-ins.
Verify it works
After adding instructions, test with a question that used to trigger built-in search: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.
Related resources
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