一键导入
dr-codebase-memory
Graph-based code intelligence for using dr analyzer subcommands to understand codebase structure, discover elements, and verify model alignment
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Graph-based code intelligence for using dr analyzer subcommands to understand codebase structure, discover elements, and verify model alignment
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Expert knowledge for Data Store Layer modeling in Documentation Robotics
Expert knowledge for Application Layer modeling in Documentation Robotics
Expert knowledge for Motivation Layer modeling in Documentation Robotics
Expert knowledge for Business Layer modeling in Documentation Robotics
Expert knowledge for Security Layer modeling in Documentation Robotics
Expert knowledge for Application Layer modeling in Documentation Robotics
| name | dr_codebase_memory |
| description | Graph-based code intelligence for using dr analyzer subcommands to understand codebase structure, discover elements, and verify model alignment |
| triggers | ["what endpoints exist","endpoints","what calls","call graph","is the model complete","what services exist","analyzer","codebase memory","reindex","freshness","code structure","extract workflows","code changes verification"] |
| version | 0.1.3 |
Scope: CLI version 0.1.3
Purpose: Teaches agents when and how to use dr analyzer subcommands for graph-based code intelligence rather than running grep+Read loops to understand codebase structure.
This skill activates when:
The dr analyzer surface provides ten subcommands for codebase discovery and verification. Each has a specific purpose and confidence level:
dr analyzer discoverPurpose: Scan for installed analyzers and select the active analyzer.
What it does:
--reselect flagConfidence: Medium — Use to bootstrap analyzer selection before other commands
Example:
dr analyzer discover
dr analyzer discover --reselect # Force new selection
Use when:
dr analyzer statusPurpose: Probe analyzer state and project index freshness before any other query.
What it does:
Confidence: Medium — Use to make graceful degradation decisions (see protocol below)
Example:
dr analyzer status
Output indicates:
dr analyzer index firstdr analyzer indexPurpose: Index the project codebase with the active analyzer.
What it does:
Confidence: Medium — Indexing takes time; offer only if user has explicit freshness concerns
Example:
dr analyzer index
Use when:
status shows index is stale or missingdr analyzer endpointsPurpose: List all API endpoints discovered in the indexed project.
What it does:
Confidence: HIGH — This is authoritative ground truth. Endpoints in code = endpoints that exist.
Example:
dr analyzer endpoints
Trust this for:
dr analyzer servicesPurpose: Query for services/components in the indexed project.
What it does:
Confidence: MEDIUM-to-LOW — Treat as a checklist, not ground truth. Code organization ≠ intended architecture.
Example:
dr analyzer services
Trust this for:
When uncertain:
dr analyzer datastoresPurpose: Identify database schemas and data storage patterns inferred from code.
What it does:
Confidence: LOW — Treat as "consider this", not definitive. Inferred schemas may be incomplete, stale, or speculative.
Example:
dr analyzer datastores
Trust this for:
When uncertain:
dr analyzer callers <qualified-name>Purpose: Analyze incoming call relationships for a function/method.
What it does:
Confidence: Medium — Accurate for explicit calls; may miss dynamic/reflection-based calls
Example:
dr analyzer callers "auth.service.validateToken"
Trust this for:
dr analyzer callees <qualified-name>Purpose: Analyze outgoing call relationships for a function/method.
What it does:
Confidence: Medium — Accurate for explicit calls; may miss dynamic/reflection-based calls
Example:
dr analyzer callees "api.handler.createOrder"
Trust this for:
dr analyzer query <cypher>Purpose: Execute custom graph queries against the indexed codebase.
What it does:
Confidence: HIGH for graph structure, but requires Cypher knowledge — Use when standard commands don't fit
Example:
dr analyzer query "MATCH (fn:Function) WHERE fn.name CONTAINS 'payment' RETURN fn.fqn, fn.description"
Trust this for:
When to use:
endpoints, services, callers, callees) don't meet your needsBefore using:
get_graph_schema MCP tool first to understand available node/edge typesdr analyzer verifyPurpose: Verify that code-discovered routes align with model endpoints and validate against active changeset.
What it does:
Confidence: HIGH for diffs, MEDIUM for absolute alignment — Shows what changed; absolute alignment depends on model accuracy
Example:
dr analyzer verify --json
Output includes:
{
"generated_at": "2026-04-21T15:30:45.123Z",
"project_root": "/path/to/project",
"analyzer": "codebase-memory-mcp",
"analyzer_indexed_at": "2026-04-21T15:20:00.000Z",
"changeset_context": {
"active_changeset": "feat-payments",
"verified_against": "changeset_view"
},
"layers_verified": ["api"],
"buckets": {
"matched": [...],
"in_graph_only": [...],
"in_model_only": [...],
"ignored": [...]
},
"summary": {
"matched_count": 45,
"gap_count": 2,
"drift_count": 1,
"ignored_count": 0,
"total_graph_entries": 47,
"total_model_entries": 46
}
}
Trust this for:
changeset_context)When reporting results to user:
changeset_context fields (active_changeset and verified_against) to indicate which model version was comparedin_graph_only (suspected gaps), "model-only" for in_model_only (possible drift)| Command | Confidence | Use As | Caveats |
|---|---|---|---|
discover | Medium | Bootstrap analyzer selection | Only used once per session |
status | Medium | Decision gate (is analyzer available?) | Only probes; doesn't query codebase |
index | Medium | Refresh command (accept if user asks) | Takes time; only offer if freshness concerns |
endpoints | HIGH | Authoritative ground truth | Complete and accurate (code is source truth) |
services | Medium-Low | Checklist, starting point for discovery | Inferred; may not match intended architecture |
datastores | LOW | Consider as a lead, verify manually | Inferred schemas may be incomplete/stale |
callers | Medium | Reverse dependency analysis | Misses dynamic calls (callbacks, reflection) |
callees | Medium | Forward dependency analysis | Misses dynamic calls (callbacks, reflection) |
query | HIGH | Custom graph traversal | Requires Cypher knowledge and graph schema |
verify | HIGH | Gap/drift detection, freshness check | High confidence on diffs; quotes changeset context |
Do NOT activate this skill when:
dr analyzer status shows "no analyzer active" → Fall back to code inspection (see Graceful Degradation below)Summary: Analyzer excels at structural questions (what exists, how are things connected). Use traditional tools for content questions (what does this do, is it correct).
The analyzer may not be installed or indexed. Handle with four-tier degradation:
Condition: dr analyzer status shows analyzer installed and index is current (fresh).
Action: Use all ten commands freely. User gets authoritative answers.
Condition: dr analyzer status shows analyzer installed and indexed, but index is stale.
Action:
dr analyzer index to get current data?"dr analyzer index and proceed with full commandsNote: Stale data may miss recent code changes but is more accurate than no index at all.
Condition: dr analyzer status shows analyzer installed but index is missing.
Action:
dr analyzer index?"Condition: dr analyzer status shows no analyzer active.
Action:
dr analyzer discover if interested."Why this protocol:
For use cases not covered by dr analyzer subcommands, the codebase-memory MCP provides lower-level graph access:
mcp__codebase-memory-mcp__get_graph_schema — Retrieve graph schema (structure, node types, edge types)mcp__codebase-memory-mcp__query_graph — Execute custom Cypher query against the codebase graphmcp__codebase-memory-mcp__query_graph_with_llm — Execute Cypher with LLM assistanceAlways run get_graph_schema first before any custom Cypher query. This tells you:
Example:
# 1. Get schema first
mcp__codebase-memory-mcp__get_graph_schema
# 2. Write custom Cypher query
mcp__codebase-memory-mcp__query_graph
MATCH (fn:Function) WHERE fn.name CONTAINS "payment"
RETURN fn.fqn, fn.description
When to use MCP over dr analyzer:
When a user has an active changeset, dr analyzer verify reports against the active changeset view — i.e., the model as it would exist after applying the staged changes.
When summarizing verify output to the user:
changeset_context field from the verify JSON responseExample:
User: "Is the API model fresh?"
Assistant: Let me verify...
dr analyzer verify --json
Result (in JSON):
{
"changeset_context": {
"active_changeset": "feat-payments",
"verified_against": "changeset_view"
},
"buckets": {
"matched": [...],
"in_graph_only": [{ "id": "route-1", "http_method": "POST", "http_path": "/api/v1/payments/refund", "source_file": "src/routes.ts", "source_symbol": "refundPayment" }],
"in_model_only": [],
"ignored": []
},
"summary": {
"matched_count": 45,
"gap_count": 1,
"drift_count": 0,
"ignored_count": 0,
"total_graph_entries": 46,
"total_model_entries": 45
}
}
Response to user:
"Verified against changeset feat-payments. Found 1 graph-only entry: POST /api/v1/payments/refund is in code but not in the changeset yet. All 45 existing endpoints match. Would you like me to add the missing endpoint to the changeset?"
Activation Triggers:
dr analyzer endpointsdr analyzer verifydr analyzer services (+ user confirmation)dr analyzer datastores (verify manually)dr analyzer callers|callees <fqn>Confidence Levels:
endpoints, verify (graph-only/model-only detection), query (custom traversal)discover, status, index, callers, callees, services (checklist only)datastores (consider, verify manually)Fallback When Analyzer Unavailable:
dr analyzer discover to install analyzer support"With Changesets:
changeset_context.active_changeset and changeset_context.verified_against from verify output