Skip to main content

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

  1. Call list_projects and select the project whose root_path exactly matches the current worktree.
  2. If no exact match exists, call index_repository for the current worktree. Use moderate for normal feature/review work so semantic and similarity edges are available; use fast only for a narrowly scoped lookup. Do not persist a graph artifact unless the task explicitly requires one.
  3. Call index_status before relying on the project. Do not reuse an index from another worktree.
  4. For broad or unfamiliar work, call get_architecture once before symbol-level searches.

Route each question to the right tool

NeedToolPractice
Find symbols, routes, classes, functions, or conceptssearch_graphPrefer 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 flowtrace_pathChoose inbound/outbound/both deliberately; include tests when validating coverage or regressions.
Read a specific symbolget_code_snippetFirst resolve the exact qualified name with search_graph; include neighbors only when needed.
Ask multi-hop or aggregate structural questionsquery_graphCall get_graph_schema first when node/edge names are uncertain; bound broad queries with LIMIT.
Understand major modules and seamsget_architectureUse for feature boundaries, work ownership, and unfamiliar domains.
Find source literals, test patterns, or graph-excluded codesearch_codeScope with path_filter/file_pattern; compare returned totals with the limit.
Review changed-code impactdetect_changes plus graph tracesUse 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.