一键导入
atcode
Advanced code exploration using AtCode knowledge graph with qualified_name-based workflow. Use for cross-file analysis, call tracing, and semantic search.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Advanced code exploration using AtCode knowledge graph with qualified_name-based workflow. Use for cross-file analysis, call tracing, and semantic search.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | atcode |
| description | Advanced code exploration using AtCode knowledge graph with qualified_name-based workflow. Use for cross-file analysis, call tracing, and semantic search. |
| version | 2.6.0 |
| author | zijing team |
AtCode provides advanced code exploration through a knowledge graph. It complements Claude Code's native file reading capabilities.
ALL AtCode tools use qualified_name to identify code elements.
Format: project_name.module.path.ClassName.method_name
Examples:
vllm.worker.worker.execute_modelvllm.attention.PagedAttention.forwardvllm.modeling_models.llama_llm_LlamaForCausalLMKey Rules:
find_nodes() to get the qualified_nameset_project()check_health()
# Returns: database status, config, project context
# If database error → ensure Memgraph is running
list_repos()
# Returns: ["AtCode", "vllm", "EasyR1", "verl", ...]
# These are the EXACT names to use with set_project()
# Use the EXACT name from list_repos()
set_project(project_name="vllm")
Important: Use the exact name returned by list_repos(). Projects may or may not have suffixes depending on how they were built.
# Search by name (single keyword recommended)
find_nodes("attention")
# Returns list with qualified_name:
# [{"qualified_name": "vllm.attention.PagedAttention.forward", ...}, ...]
# Get source code
get_code_snippet(qualified_name="vllm.attention.PagedAttention.forward")
# Trace calls
find_calls(qualified_name="vllm.attention.PagedAttention.forward",
direction="incoming")
# Complete analysis (source + callers + dependencies in ONE call)
explore_code(identifier="vllm.attention.PagedAttention.forward")
┌─────────────────────────────────────────────────────────────┐
│ 1. list_repos() → discover available projects │
│ ↓ │
│ 2. set_project("exact_name") → set context │
│ ↓ │
│ 3. find_nodes("keyword") → get qualified_name │
│ ↓ │
│ 4. Use qualified_name with: │
│ - get_code_snippet(qualified_name="...") │
│ - find_calls(qualified_name="...", direction="...") │
│ - explore_code(identifier="...") │
│ - find_class_hierarchy(class_qualified_name="...") │
│ - trace_dependencies(start_qualified_name="...") │
└─────────────────────────────────────────────────────────────┘
| Use AtCode MCP for: | Use Claude Code Native for: |
|---|---|
| Cross-file relationship analysis | Reading a single file |
| Call tracing ("who calls this") | Simple "show me this function" |
| Large-scale discovery (100+ files) | Small projects, simple questions |
| Class hierarchy analysis | Single class inspection |
| Dependency chain tracing | Direct imports only |
find_nodes - Find Code by NameSTART HERE - Search for functions, classes, methods.
Syntax:
"attention" (RECOMMENDED)"flash|attn""get_*_config"Returns: List of nodes with qualified_name that you use with other tools.
find_nodes("main")
# Returns: [{"qualified_name": "project.main", ...}, ...]
find_nodes("cache|config")
# Returns multiple results with qualified_names
find_calls - Trace Call RelationshipsAtCode superpower - trace who calls what.
Requires: qualified_name from find_nodes()
# What calls this function?
find_calls(
qualified_name="vllm.worker.worker.execute_model",
direction="incoming"
)
# What does this function call?
find_calls(
qualified_name="vllm.worker.worker.execute_model",
direction="outgoing",
depth=2
)
Response Structure:
{
"success": true,
"results": [
{
"qualified_name": "vllm.engine.run",
"name": "run",
"type": ["Function"],
"path": "vllm/engine.py"
}
],
"count": 1,
"summary": "Found 1 function(s) that call..."
}
explore_code - Complete ContextGet source + callers + dependencies in ONE call.
explore_code(identifier="vllm.worker.worker.execute_model")
Returns:
find_class_hierarchy - Class Inheritance AnalysisFind parent classes and child classes of a class.
find_class_hierarchy(class_qualified_name="vllm.attention.PagedAttention")
Response Structure:
{
"success": true,
"results": [{
"class_name": "vllm.attention.PagedAttention",
"parents": ["vllm.attention.BaseAttention"],
"children": ["vllm.attention.FlashAttention"]
}],
"summary": "Found inheritance hierarchy..."
}
Use Cases:
trace_dependencies - Dependency Chain AnalysisTrace paths between code elements and detect circular dependencies.
# Find path from A to B
trace_dependencies(
start_qualified_name="vllm.main",
end_qualified_name="vllm.database.connect",
max_depth=5
)
# Find all reachable from A (without end target)
trace_dependencies(
start_qualified_name="vllm.main",
max_depth=3
)
Response Structure:
{
"chain": [
{"from": "vllm.main", "to": "vllm.engine.run", "type": "CALLS"},
{"from": "vllm.engine.run", "to": "vllm.database.connect", "type": "CALLS"}
],
"depth": 2,
"total_elements": 3,
"has_circular": false,
"circular_paths": [],
"summary": "Found path from vllm.main to vllm.database.connect..."
}
Use Cases:
get_code_snippet - Get Source Codeget_code_snippet(qualified_name="vllm.attention.PagedAttention.forward")
Response Structure:
{
"found": true,
"qualified_name": "vllm.attention.PagedAttention.forward",
"file_path": "vllm/attention.py",
"line_start": 100,
"line_end": 150,
"source_code": "def forward(self, ...):\n ...",
"docstring": "Forward pass documentation..."
}
get_children - Navigate StructureGet children of any node type.
Special identifier values:
"." - Current project from set_project()Identifier types:
"auto" - Auto-detect (recommended)"project" - By project name"folder" - By file path"file" - By file path or qualified_name"class" - By qualified_name# Project structure
get_children(identifier=".", identifier_type="auto", depth=2)
# Class methods
get_children(identifier="vllm.modeling_models.LlamaModel",
identifier_type="class")
# File contents
get_children(identifier="src/models/llama.py", identifier_type="file")
build_graph - Build Knowledge Graphbuild_graph(project_path="/path/to/project", project_name="myproject")
# Creates graph named: "myproject_claude" (auto-adds _claude suffix)
# Returns a job_id → use get_job_status(job_id="...") to track progress
refresh_graph - Update After Changesrefresh_graph(project_name="myproject")
# Uses exact name, or tries with "_claude" suffix if not found
clean_graph - Remove Graphclean_graph(project_name="myproject")
# Uses exact name, or tries with "_claude" suffix if not found
# 1. Find it
find_nodes("calculate_attention")
# 2. Get comprehensive analysis
explore_code(identifier="vllm.attention.calculate_attention")
# 1. Find the function
find_nodes("deprecated_function")
# 2. Find all callers
find_calls(
qualified_name="vllm.utils.deprecated_function",
direction="incoming",
depth=3
)
# 3. Check each caller before refactoring
get_code_snippet(qualified_name="...")
# 1. Check existing graphs
list_repos()
# 2. Build if needed
build_graph(project_path=".", project_name="myproject")
# Creates: "myproject_claude"
# 3. Set context (use exact name from list_repos)
set_project(project_name="myproject_claude")
# 4. Explore structure
get_children(identifier=".", depth=2)
# 5. Find entry points
find_nodes("main|cli|start")
# 1. Check system health
check_health()
# Shows: database status, config, project context
# 2. If database error → ensure Memgraph is running
# 3. If project not set → call set_project()
# 4. If no projects → build_graph() first
# 1. Find the class
find_nodes("BaseAttention")
# 2. Get inheritance hierarchy
find_class_hierarchy(class_qualified_name="vllm.attention.BaseAttention")
# 3. Explore specific child classes
get_code_snippet(qualified_name="vllm.attention.FlashAttention")
# 1. Find suspicious function
find_nodes("process_request")
# 2. Trace dependencies and detect cycles
trace_dependencies(
start_qualified_name="vllm.engine.process_request",
max_depth=10
)
# Check has_circular and circular_paths in response
| Error | Cause | Solution |
|---|---|---|
| "No project context" | set_project() not called | Call set_project(project_name="...") first |
| "Cannot connect to Memgraph" | Database not running | Run docker ps | grep memgraph to check |
| "Code not found" | Invalid qualified_name | Use find_nodes() first to get valid names |
| "Project not found" | Wrong project name | Use list_repos() to see available names |
# 1. Always start with health check if errors occur
result = check_health()
# 2. Check database status
if result["database"]["status"] == "error":
# Start Memgraph: docker compose -f docker/compose.yaml up -d memgraph
pass
# 3. Check project context
if result["project_context"]["status"] == "not_set":
# List available projects and set context
list_repos()
set_project(project_name="...")
find_nodes() - Get qualified_name first"flops" not "flops calculation"| for variants - "torch|cuda" not "torch cuda"explore_code for deep dives - One call vs manylist_repos() first - Avoid rebuilding existing graphscheck_health() on errors - Diagnose connection issuesfind_class_hierarchy for OOP analysis - Understand inheritancetrace_dependencies for impact analysis - Before refactoringskip_embeddings=True for faster updates if semantic search not neededSearch results often include test files. Use path patterns to focus on main code:
# Instead of searching broadly
find_nodes("generate") # Returns 50+ results including tests
# Use more specific keywords with module context
find_nodes("entrypoints.*generate") # Focuses on entrypoints module
find_nodes("LLM.generate") # Searches for class method pattern
"project.engine.generate" vs "generate""worker*execute" matches worker-related execute functionsnode_type="Code" excludes File/Folder nodesfind_calls() and trace_dependencies() may return empty results for some functions:
Causes:
getattr(), decorators, or metaclasses may not be capturedWorkaround:
# If find_calls returns empty, try explore_code for more context
explore_code(identifier="project.module.function")
# Or use get_code_snippet and manually trace
get_code_snippet(qualified_name="project.module.function")
The code_snippet field in explore_code() results may be null if:
Workaround:
# Use get_code_snippet directly for reliable source retrieval
result = explore_code(identifier="project.module.function")
if result.get("code_snippet") is None:
# Fallback to get_code_snippet
get_code_snippet(qualified_name="project.module.function")
The source_code field may be empty even when metadata (path, line numbers) is correct:
Workaround:
# Verify file path and read manually if needed
result = get_code_snippet(qualified_name="...")
if not result.get("source_code"):
# Use the returned file_path and line numbers to read directly
print(f"File: {result['file_path']}, lines {result['line_start']}-{result['line_end']}")
get_children(identifier="path/to/file.py", identifier_type="file") may return empty:
Workaround:
# Use find_nodes to search for classes/functions in specific files
find_nodes("filename.ClassName")
Some graphs may have duplicate entries like:
project.module.functionproject.project.module.functionBest Practice: Always copy the exact qualified_name from find_nodes() results.
| Tool | Input | Returns | Use When |
|---|---|---|---|
check_health | - | System status | Diagnosing errors |
list_repos | - | Project names | Discover available graphs |
set_project | project_name | Success | Set context for queries |
find_nodes | query | qualified_name list | Find code by name |
find_calls | qualified_name | Callers/Callees | Trace relationships |
explore_code | qualified_name | Full context | Deep analysis |
get_code_snippet | qualified_name | Source code | Get implementation |
get_children | identifier | Child nodes | Navigate structure |
find_class_hierarchy | class_qualified_name | Parents/Children | Class inheritance |
trace_dependencies | start_qualified_name | Dependency chain | Path finding, cycles |
build_graph | project_path | Job ID | Create new graph |
refresh_graph | project_name | Job ID | Update graph |
clean_graph | project_name | Success | Remove graph |
start_sync | project_name, repo_path | Status | Start real-time monitoring |
stop_sync | project_name | Status | Stop monitoring |
sync_now | project_name | Statistics | One-shot update |
get_sync_status | project_name | Status | Check sync state |
start_sync - Enable File WatchingStart continuous monitoring for code changes.
start_sync(
project_name="myproject",
repo_path="/path/to/project",
skip_embeddings=False,
subdirs="backend,frontend" # Optional: monitor only these directories
)
Response Structure:
{
"success": true,
"project_name": "myproject",
"status": "started",
"message": "Sync started for 'myproject'"
}
sync_now - One-time UpdateUpdate the graph without continuous monitoring.
sync_now(project_name="myproject")
Response Structure:
{
"success": true,
"project_name": "myproject",
"added": 5,
"modified": 3,
"deleted": 1,
"duration_ms": 1500
}
stop_sync - Disable Monitoringstop_sync(project_name="myproject")
get_sync_status - Check Statusget_sync_status(project_name="myproject")
Response Structure:
{
"success": true,
"project_name": "myproject",
"is_watching": true,
"is_processing": false,
"pending_changes": 0,
"latest_result": {
"added": 2,
"modified": 1,
"deleted": 0
}
}
# 1. Start monitoring during development
start_sync(project_name="myproject", repo_path="/path/to/project")
# 2. Check status periodically
get_sync_status(project_name="myproject")
# 3. Stop when done
stop_sync(project_name="myproject")
# For quick updates without continuous monitoring
sync_now(project_name="myproject")