Codebase-Memory Guidance
Source: .agents/references/coding-standard/codebase-memory-guidance.md
Content
Codebase-Memory Guidance
Use codebase-memory MCP as the default discovery and impact-analysis layer for this repository.
Start a task
- Call
list_projectsand select the project whoseroot_pathexactly matches the current worktree. - If no exact match exists, call
index_repositoryfor the current worktree. Usemoderatefor normal feature/review work so semantic and similarity edges are available; usefastonly for a narrowly scoped lookup. Do not persist a graph artifact unless the task explicitly requires one. - Call
index_statusbefore relying on the project. Do not reuse an index from another worktree. - For broad or unfamiliar work, call
get_architectureonce before symbol-level searches.
Route each question to the right tool
| Need | Tool | Practice |
|---|---|---|
| Find symbols, routes, classes, functions, or concepts | search_graph | Prefer natural-language query; use name/qualified-name patterns for exact searches. Check has_more and paginate or narrow the query. |
| Find callers, callees, dependencies, or data flow | trace_path | Choose inbound/outbound/both deliberately; include tests when validating coverage or regressions. |
| Read a specific symbol | get_code_snippet | First resolve the exact qualified name with search_graph; include neighbors only when needed. |
| Ask multi-hop or aggregate structural questions | query_graph | Call get_graph_schema first when node/edge names are uncertain; bound broad queries with LIMIT. |
| Understand major modules and seams | get_architecture | Use for feature boundaries, work ownership, and unfamiliar domains. |
| Find source literals, test patterns, or graph-excluded code | search_code | Scope with path_filter/file_pattern; compare returned totals with the limit. |
| Review changed-code impact | detect_changes plus graph traces | Use the diff as the changed-file source of truth, then trace central changed symbols to consumers and tests. |
Read and verify
- Open the live source around every selected symbol before planning or editing.
- Use graph evidence to identify reusable code, page/service ownership, hidden consumers, and relevant tests.
- After substantial code changes, refresh the exact worktree index before final impact analysis when the graph no longer represents the live source.
- Treat tests, type checks, lint, runtime behavior, Apifox, Figma, and feature requirements as their own sources of truth. Graph results do not waive those checks.
Fallbacks
Use rg/find directly for Markdown, JSON/config values, shell scripts, generated files, exact error text,
or paths excluded from the index. Fall back for code only when MCP results are empty, truncated beyond a
useful scope, stale, or unavailable. Note what was attempted and why the fallback was needed.
Worktrees and subagents
- Resolve or index each worker's exact worktree separately.
- Include the selected project/root and required graph queries in delegated task prompts.
- Re-index the integration worktree before final cross-task impact review when integrated source differs from the pre-implementation graph.