A VS Code custom Chat Agent rivaling Claude Code, built on 6 MCP Servers + VS Code built-in tools. Covers file operations, Git, code analysis, persistent memory, code review, auto-refactoring & structural diff, and web access. A total of 48 tools that fully replicate Claude Code's core capabilities and surpass it in the code review dimension.
What makes Claude Code powerful is that it's not just a chat window — it's an autonomous programming Agent with a complete toolchain. It can read code, edit code, search code, run commands, manage Git, and remember context, forming a closed-loop development workflow.
Code Hacker's design goal: Replicate this closed-loop capability within VS Code Copilot Chat.
Core ideas:
- Separation of Concerns — Split Claude Code's capabilities into 6 independent MCP Servers, each doing one thing
- Composition over Inheritance — Assemble multiple servers into a complete Agent via chatmode files
- Leverage Built-in Capabilities — Reuse VS Code's built-in
fetchfor web access instead of reinventing the wheel - Security Sandbox — Each server has independent security policies (path checks, command blocklists, file whitelists)
- Surpass, Not Imitate — Code review and structural diff are capabilities Claude Code lacks, based on AST-level analysis and the ydiff algorithm
┌───────────────────────────────────────────────────────────────────────────┐
│ VS Code Copilot Chat │
│ ┌──────────────────────┐ │
│ │ Mode Selector │ │
│ │ → "Code Hacker" │ │
│ └──────────┬───────────┘ │
│ │ │
│ ┌──────────▼───────────┐ │
│ │ code-hacker │ │
│ │ .chatmode.md │ ← System prompt │
│ │ │ ← Tool bindings │
│ │ tools: │ ← Behavior rules │
│ │ filesystem-command/*│ │
│ │ git-tools/* │ │
│ │ code-intel/* │ │
│ │ memory-store/* │ │
│ │ code-review/* │ │
│ │ code-refactor/* │ │
│ │ fetch │ │
│ └──────────┬───────────┘ │
│ │ │
│ ┌──────────────────┼──────────────────┐ │
│ │ MCP Protocol (SSE) │ │
│ │ │ │
│ ┌─────────────▼─────────────┐ ┌────────────▼──────────────┐ │
│ │ filesystem.py :8001 │ │ git_tools.py :8002 │ │
│ │ (12 tools) │ │ (11 tools) │ │
│ │ │ │ │ │
│ │ • read/write/edit │ │ • status/diff/log │ │
│ │ • find/search │ │ • add/commit │ │
│ │ • execute_command │ │ • branch/checkout │ │
│ │ • directory ops │ │ • stash/blame │ │
│ └───────────────────────────┘ └───────────────────────────┘ │
│ │
│ ┌───────────────────────────┐ ┌───────────────────────────┐ │
│ │ code_intel.py :8003 │ │ memory_store.py :8004 │ │
│ │ (5 tools) │ │ (7 tools) │ │
│ │ │ │ │ │
│ │ • AST analysis │ │ • save/get/search │ │
│ │ • Symbol extraction │ │ • list/delete │ │
│ │ • Project overview │ │ • scratchpad │ ┌────────┐│
│ │ • Reference search │ │ │ │ fetch ││
│ │ • Dependency graph │ │ ┌───────────────┐ │ │(built- ││
│ └───────────────────────────┘ │ │.agent-memory/ │ │ │ in) ││
│ │ │ *.json │ │ │ ││
│ │ └───────────────┘ │ │Web ││
│ ┌───────────────────────────┐ └───────────────────────────┘ │fetch ││
│ │ code_review.py :8005 │ Code Review (8 tools) │API call││
│ │ │ └────────┘│
│ │ • review_project/file │ │
│ │ • review_function │ │
│ │ • health_score │ │
│ │ • find_long/complex │ │
│ │ • suggest_reorg │ │
│ │ • review_diff_text │ │
│ └───────────────────────────┘ │
│ │
│ ┌───────────────────────────┐ │
│ │ code_refactor.py :8006 │ Auto Refactor + Structural Diff (4 tools)│
│ │ │ │
│ │ • auto_refactor │ ┌─────────────────────────────┐ │
│ │ • ydiff_files │ │ lib/ │ │
│ │ • ydiff_commit │ │ ├── refactor_auto.py │ │
│ │ • ydiff_git_changes │ │ └── ydiff_python.py │ │
│ │ │ │ (self-contained, no │ │
│ └───────────────────────────┘ │ external deps) │ │
│ └─────────────────────────────┘ │
└───────────────────────────────────────────────────────────────────────────┘
| Server | File | Tools | Responsibility | Design Principle |
|---|---|---|---|---|
| filesystem-command | filesystem.py |
12 | File CRUD, precise editing, file search, command execution | The Agent's "hands" — foundation for all file operations. edit_file replicates Claude Code's Edit tool |
| git-tools | git_tools.py |
11 | Complete Git workflow | Dedicated tools are safer than generic commands. LLM calls structured functions without memorizing git syntax |
| code-intel | code_intel.py |
5 | Code understanding & analysis | AST parsing compensates for LLM weaknesses. project_overview generates a full project panorama in one call |
| memory-store | memory_store.py |
7 | Cross-session persistent memory | Structured JSON storage + categories/tags/search. scratchpad for complex reasoning |
| code-review | code_review.py |
8 | Code quality review | Unique capability — Claude Code doesn't have this. Self-contained AST analysis engine, quantifies code quality, locates hotspots, generates reorganization suggestions |
| code-refactor | code_refactor.py |
4 | Auto refactoring + structural diff | Unique capability — Auto-splits long functions/large files. ydiff AST-level diff generates interactive HTML reports |
Scenario A: Code Modification
User: "Change all print statements to logging in the project"
① project_overview(".") → Understand project structure
② search_files_ag("print(", "py") → Locate all print statements
③ read_file_lines("app.py", 10, 25) → Confirm context
④ edit_file("app.py", old, new) → Precise replacement
⑤ git_diff() → Verify changes
⑥ memory_save(...) → Remember progress
Scenario B: AI Code Review (Code Hacker Exclusive)
User: "Review this project's code quality"
① health_score("/path/to/project") → Quick score: 72/100 (B)
② review_project("/path/to/project") → Full scan: 5 critical + 12 medium
③ find_complex_functions(...) → Locate TOP 5 complex functions
④ review_function("app.py", "process_data") → Deep analysis + refactoring suggestions
⑤ auto_refactor(..., apply=False) → Preview auto-refactoring plan
⑥ auto_refactor(..., apply=True) → Execute refactoring
⑦ ydiff_commit(".", "HEAD") → Generate structural diff HTML report
Scenario C: Review AI-Generated Code
User: "Review this AI-generated code for me"
① review_diff_text(old_code, new_code) → Compare old/new code structural changes
→ Added 3 functions, removed 1, modified 2
→ ⚠ process_all: complexity 8→15↑, exceeds threshold
→ ⚠ handle_request: too long (62 lines)
② review_function(...) → Deep analysis of problematic functions
③ edit_file(...) → Fix issues
┌─────────────────────────────────────────┐
│ Security Layer (independent per │
│ server) │
├─────────────────────────────────────────┤
│ │
│ filesystem.py: │
│ ├─ Path safety check (blocks .. traversal) │
│ ├─ File type whitelist (text files only) │
│ ├─ File size limit (10MB) │
│ ├─ Command blocklist (rm/format/dd/...) │
│ └─ Command timeout (30s) │
│ │
│ git_tools.py: │
│ ├─ All operations via git subcommands│
│ ├─ No force push / reset --hard │
│ └─ Command timeout (30s) │
│ │
│ code_intel.py: │
│ ├─ Read-only operations │
│ └─ Search result limits (prevent OOM)│
│ │
│ memory_store.py: │
│ ├─ Data isolation (.agent-memory/) │
│ └─ JSON format, auditable │
│ │
│ code_review.py: │
│ └─ All tools are read-only │
│ │
│ code_refactor.py: │
│ ├─ auto_refactor defaults to preview │
│ ├─ .bak backup before refactoring │
│ └─ ydiff only generates HTML reports │
│ │
└─────────────────────────────────────────┘
| Capability | Claude Code | Code Hacker | Winner |
|---|---|---|---|
| File Reading | Read — supports line numbers, PDF, images |
read_file + read_file_lines |
Claude Code (multimodal) |
| File Writing | Write — create or overwrite |
write_file + append_file |
Tie |
| Precise Editing | Edit — old→new replacement |
edit_file — same pattern |
Tie |
| File Search | Glob — ripgrep |
find_files — pathlib.rglob |
Claude Code (faster) |
| Content Search | Grep — ripgrep |
search_files_ag — Silver Searcher |
Tie |
| Command Execution | Bash — full shell, background |
execute_command — security sandbox |
Claude Code (more powerful) / Code Hacker (safer) |
| Git Operations | Bash + git commands |
11 dedicated git tools | Code Hacker |
| Code Analysis | LLM reading | AST parsing + symbol extraction | Code Hacker |
| Project Understanding | Agent multi-round exploration |
project_overview one-call |
Code Hacker |
| Dependency Analysis | None | dependency_graph |
Code Hacker |
| Persistent Memory | Markdown filesystem | Structured JSON + categories/tags | Code Hacker |
| Web Access | WebFetch + WebSearch |
fetch (VS Code built-in) |
Claude Code (search) |
| Code Review | No dedicated tools | review_project/file/function + health_score |
Code Hacker Exclusive |
| Auto Refactoring | None | auto_refactor — auto-split functions/files |
Code Hacker Exclusive |
| Structural Diff | None (line-level diff only) | ydiff_files/commit/git_changes — AST-level |
Code Hacker Exclusive |
| Change Review | None | review_diff_text — quantify old/new code differences |
Code Hacker Exclusive |
| HTML Reports | None | generate_report — visual quality reports |
Code Hacker Exclusive |
| Sub-agents | Agent parallel spawning |
None | Claude Code |
| Images/PDF | Supported | Not supported | Claude Code |
| Notebook | NotebookEdit |
Not supported | Claude Code |
Code Hacker Exclusive/Superior (9 items):
- Code Review:
review_project/file/functionquantifies code quality — Claude Code has nothing comparable - Auto Refactoring:
auto_refactorauto-splits long functions and large files, with preview + execute modes - Structural Diff:
ydiff_files/commitAST-based diff that understands code moves/renames — Claude Code only has line-level diff - Change Review:
review_diff_textcompares old/new code structural changes, quantifies complexity direction - Health Score:
health_scoreone-click project scoring 0-100 - Git Operations: 11 structured tools vs. hand-written git commands
- Code Analysis: Precise AST parsing vs. LLM reading/guessing
- Project Overview: Single call vs. multi-round exploration
- Memory System: Structured JSON vs. Markdown files
Claude Code Superior (5 items):
- Command Execution: Full Bash shell + pipes + background processes
- Sub-agents: Parallel exploration agent spawning
- Multimodal: Image + PDF reading
- Web Search: Search engine retrieval
- Notebook Editing
Claude Code Core Capability Coverage:
File Operations ████████████████████ 100% (Read/Write/Edit/Glob/Grep)
Git Operations ████████████████████ 100% (even finer-grained)
Command Exec ██████████████░░░░░░ 70% (missing background, pipes)
Code Analysis ████████████████████ 100%+ (AST parsing surpasses)
Persistent Mem ████████████████████ 100%+ (structured storage surpasses)
Code Review ████████████████████ ∞% (Claude Code lacks this)
Structural Diff ████████████████████ ∞% (Claude Code lacks this)
Auto Refactor ████████████████████ ∞% (Claude Code lacks this)
Web Access ██████████████░░░░░░ 70% (missing search engine)
Sub-agents ░░░░░░░░░░░░░░░░░░░░ 0% (VS Code doesn't support)
Multimodal ░░░░░░░░░░░░░░░░░░░░ 0% (MCP limitation)
Notebook ░░░░░░░░░░░░░░░░░░░░ 0% (can be extended later)
─────────────────────────────────────────
Shared capability coverage ~75%
Unique capabilities +3 dimensions surpassing Claude Code
.
├── filesystem.py # MCP 1: File read/write, edit, search, command exec (12 tools)
├── git_tools.py # MCP 2: Full Git operations (11 tools)
├── code_intel.py # MCP 3: AST analysis, symbol extraction, dependency graph (5 tools)
├── memory_store.py # MCP 4: Persistent memory + scratchpad (7 tools)
├── code_review.py # MCP 5: Code quality review (8 tools)
├── code_refactor.py # MCP 6: Auto refactoring + structural diff (4 tools)
├── lib/
│ ├── __init__.py
│ ├── ydiff_python.py # AST structural diff engine
│ └── refactor_auto.py # Auto-refactoring engine (function/file splitting)
├── code-hacker.chatmode.md # Agent definition (system prompt + tool bindings)
├── .vscode/
│ └── mcp.json # MCP server registration (reference; actual config in user settings)
└── README.md
- VS Code 1.99+
- GitHub Copilot Chat extension
- Python 3.10+
- Git
pip install mcpOptional (recommended): Install The Silver Searcher for faster code search:
# macOS
brew install the_silver_searcher
# Ubuntu/Debian
sudo apt install silversearcher-ag
# Termux
pkg install the_silver_searcherYou can also set the AG_PATH environment variable to specify a custom path to the ag binary.
All MCP servers use SSE (Server-Sent Events) transport. Start each server individually:
python filesystem.py # Port 8001
python git_tools.py # Port 8002
python code_intel.py # Port 8003
python memory_store.py # Port 8004
python code_review.py # Port 8005
python code_refactor.py # Port 8006Open settings.json (Ctrl+Shift+P → Preferences: Open User Settings (JSON)) and add the following:
{
"mcp": {
"servers": {
"filesystem-command": {
"type": "sse",
"url": "http://localhost:8001/sse"
},
"git-tools": {
"type": "sse",
"url": "http://localhost:8002/sse"
},
"code-intel": {
"type": "sse",
"url": "http://localhost:8003/sse"
},
"memory-store": {
"type": "sse",
"url": "http://localhost:8004/sse"
},
"code-review": {
"type": "sse",
"url": "http://localhost:8005/sse"
},
"code-refactor": {
"type": "sse",
"url": "http://localhost:8006/sse"
}
}
}
}After adding the configuration, VS Code's status bar will show MCP server status. Ensure all 6 servers are shown as connected.
If not connected, check:
- All 6 server processes are running
- Ports 8001-8006 are not occupied by other processes
mcppackage is installed (pip install mcp)
Place code-hacker.chatmode.md in the project root directory you want to use it in.
Key configuration — the
toolsfield must use theserver-name/*wildcard format:tools: ["filesystem-command/*", "git-tools/*", "code-intel/*", "memory-store/*", "code-review/*", "code-refactor/*", "fetch"]
fetchis a VS Code built-in tool and requires no additional configuration.
- Open the project containing
code-hacker.chatmode.mdin VS Code - Open the Copilot Chat panel (
Ctrl+Shift+I) - Select Code Hacker in the mode selector at the top
- Start chatting
Troubleshooting: If Code Hacker doesn't appear in the mode selector:
- Confirm VS Code >= 1.99
- Confirm
.chatmode.mdfile is in the workspace root- Restart VS Code
| Tool | Description |
|---|---|
read_file |
Read file content, supports utf-8/gbk/gb2312 encodings |
read_file_lines |
Read specific line range, suitable for large files |
write_file |
Write to file |
append_file |
Append content to file |
edit_file |
Precise string replacement (pass old_string → new_string) |
find_files |
Glob pattern recursive file search |
search_files_ag |
Regex file content search (similar to ripgrep) |
list_directory |
List directory contents |
get_file_info |
File details (size, timestamps, permissions) |
create_directory |
Recursively create directories |
get_current_directory |
Get working directory |
execute_command |
Execute system commands (dangerous commands blocked) |
| Tool | Description |
|---|---|
git_status |
Working tree status |
git_diff |
View changes (supports staged) |
git_log |
Commit history |
git_show |
View commit content or file at specific revision |
git_branch |
List branches |
git_create_branch |
Create new branch |
git_checkout |
Switch branches/restore files |
git_add |
Stage files |
git_commit |
Commit |
git_stash |
Stash management (push/pop/list) |
git_blame |
Line-by-line change attribution |
| Tool | Description |
|---|---|
analyze_python_file |
Python AST deep analysis (classes, functions, imports, docstrings) |
extract_symbols |
Extract symbol definitions (Python/JS/TS/Java/Go/Rust) |
project_overview |
Project panorama (directory tree, language distribution, entry points, config) |
find_references |
Cross-file symbol reference search |
dependency_graph |
File import/imported-by relationship analysis |
| Tool | Description |
|---|---|
memory_save |
Save memory (supports categories and tags) |
memory_get |
Retrieve specific memory |
memory_search |
Search memories (by keyword/category/tag) |
memory_list |
List all memories |
memory_delete |
Delete memory |
scratchpad_write/read/append |
Temporary scratchpad (for complex reasoning) |
| Tool | Description |
|---|---|
review_project |
Scan entire project: health score + issue list + reorganization suggestions |
review_file |
Single file analysis, functions ranked by complexity |
review_function |
Deep analysis of a specific function with concrete refactoring suggestions |
health_score |
Quick project health score (0-100) |
find_long_functions |
Longest functions ranking |
find_complex_functions |
Highest complexity functions ranking |
suggest_reorg |
File reorganization suggestions (by naming patterns and class distribution) |
review_diff_text |
Compare old/new code strings, analyze change impact |
| Tool | Description |
|---|---|
auto_refactor |
Auto refactoring: split long functions and large files (preview/execute) |
ydiff_files |
Structural AST-level diff: compare two Python files |
ydiff_commit |
Git commit structural diff, multi-file HTML report |
ydiff_git_changes |
Compare structural changes between any two git refs |
| Tool | Description |
|---|---|
fetch |
Fetch web page/API content |
You: Analyze this project's architecture
→ project_overview → find_files → analyze_python_file → output analysis report
You: Change all print statements to logging
→ search_files_ag to locate → read_file_lines to confirm context → edit_file to replace each
You: Who introduced this bug?
→ git_blame → git_show → locate the commit and author that introduced the bug
You: Remember: this project's API should use the /api/v2 prefix
→ memory_save to persist, auto-recalled in next session
You: Look up FastAPI middleware docs
→ fetch to retrieve documentation content and summarize
Edit ALLOWED_EXTENSIONS in filesystem.py.
Edit BLOCKED_COMMANDS in filesystem.py.
Edit the system prompt in code-hacker.chatmode.md.
- Create a new
.pyfile usingFastMCPto define tools - Run it with SSE transport on an available port
- Register the server URL in VS Code
settings.json - Add
"new-server-name/*"to thetoolsfield incode-hacker.chatmode.md
MIT