Skip to main content

Codebase Memory First

Use codebase-memory MCP as the primary source for code discovery, dependency tracing, impact analysis, and architecture orientation

Source: .agents/rules/codebase-memory-first.mdc

Metadata

  • name: codebase-memory-first
  • alwaysApply: true

Content

Codebase Memory First

For code discovery, follow .agents/references/coding-standard/codebase-memory-guidance.md.

  • Resolve the indexed project by exact current-worktree root_path. Run index_repository before code discovery when that worktree is not indexed.
  • Use search_graph first for symbols, routes, modules, and natural-language code discovery.
  • Use trace_path for callers, callees, dependency paths, and impact analysis.
  • Use get_code_snippet only after search_graph returns the exact qualified name.
  • Use query_graph for complex structural questions and get_architecture for broad orientation.
  • Use search_code for source literals or test patterns when graph symbol search is insufficient.
  • Fall back to rg/find for non-code files, config values, generated/excluded paths, or when MCP results are insufficient. Record the fallback reason in implementation or review notes.
  • Read the current source file before editing. The graph accelerates discovery but does not replace live source, tests, API documentation, or product requirements.