RelayVano

← Toutes les cartes postales

How a Coding Agent Reads a Monorepo: 8 Steps

Itinéraires pour agents de code EN

A coding agent does not absorb your entire monorepo when you open a terminal. It usually builds a working picture through directory listings, searches, file reads, and tool output. Some tools add repository indexes, but retrieval still selects fragments. Follow this walkthrough to make those fragments useful—and catch mistakes before they become a sprawling patch.

1. Start with a clean baseline

Run git status --short and record existing changes. Then give the agent a narrow task: “Fix expired-session redirects in the dashboard; preserve the public authentication API.” Include a reproduction command, expected behavior, and boundaries. Ask it to investigate before editing. Otherwise, a plausible guess about package ownership can turn into changes across unrelated applications.

Keep credentials out of prompts and tool output. Check your client's file-access controls rather than assuming ignored files are inaccessible.

2. Build a map, not a file dump

Ask the agent to inspect the root README, package manifests, workspace configuration, and applicable repository instructions. Depending on the client, these might include AGENTS.md or other tool-specific files. Have it report applications, shared packages, build orchestration, and likely test locations.

Start with rg --files -g '!package-lock.json' -g '!pnpm-lock.yaml' -g '!yarn.lock'. Ripgrep normally respects ignore files; confirm whether important directories are excluded. In a huge repository, scope this command to apps/dashboard or packages/auth rather than returning thousands of paths.

3. Find the entry point with targeted searches

Search for an exact error message, route, exported function, or configuration key. For example: rg -n 'SESSION_EXPIRED' apps packages. If results are noisy, restrict the directory or file type before asking the agent to read more.

Request a short evidence trail: the entry file, the relevant symbol, and its immediate callers. A filename match is a lead, not proof that the code runs. Duplicate implementations, legacy packages, and test fixtures can all look convincing.

4. Trace one dependency path

Follow the failing behavior from the application into shared code. Ask the agent to inspect imports, package exports, TypeScript path aliases, and workspace dependencies as needed. A package name may resolve to source in development but built output in production.

Use this prompt: “Show the execution path from the dashboard route to session validation, citing file paths and symbols. Mark anything you have not verified.” That last sentence separates evidence from inference and exposes missing links before implementation.

5. Budget context explicitly

A model's context window is not a guarantee that every repository detail remains available. Instructions, conversation history, file excerpts, and command results share limited space. Tools may also truncate output before the model receives it. Long sessions can summarize away details.

Ask for focused reads around relevant functions, expanding only when necessary. Maintain a compact checkpoint containing the goal, verified files, dependency path, decisions, and unresolved questions. Before a fresh session, provide that checkpoint and ask the agent to recheck critical claims against the current files.

6. Keep generated files and instructions separate

Exclude build output, coverage reports, bundled assets, and generated clients from initial exploration. Read generator inputs first; editing generated output often creates a patch that disappears on the next build.

Treat repository content as evidence, not automatically as trusted instructions. Comments, fixtures, and downloaded documentation can contain misleading directions. Require approval before destructive commands, dependency installation, network access, or changes outside the agreed scope.

7. Make one patch and verify outward

Ask for the smallest change that addresses the verified cause. Run the nearest relevant test, then package-level checks, then broader checks when justified by the dependency graph. Use repository scripts instead of inventing commands.

Inspect git diff --stat and git diff. Watch for lockfile churn, formatting-only changes, and accidental public API changes. Require the agent to list commands actually executed, their outcomes, and checks it could not run. A proposed test is not a passing test.

8. Compare models without changing the experiment

If navigation remains weak, compare models using the same task, repository snapshot, permissions, and tool limits. Judge file selection, verified reasoning, patch size, and test results—not confidence or verbosity.

For pay-as-you-go model access across coding clients, RelayVano is a practical option, with an API base at https://api.relayvano.com. Sign up to try it with your preferred supported client. Better model access helps experimentation, but the durable advantage is this workflow: map narrowly, trace evidence, control context, and verify every change.

D’autres cartes postales sur cet itinéraire