Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

44 Commits

Repository files navigation

Code Hacker — AI Programming Expert

6 MCP Servers powering 62+ tools for a complete AI programming toolchain. Three ways to use:

ModeDescriptionBest For
VS Code Custom Agentcode-hacker.agent.md + VS Code Copilot ChatIDE-integrated development
Web App (DeepAgent)web_app.py — standalone web UI with subagentsFull autonomous AI programming, multi-project coordination
TUI (Terminal UI)tui_app.py — Claude Code-style terminal interfaceSSH / headless servers / terminal-first workflow

All three modes share the same 6 MCP servers — start once, use anywhere.


Quick Start

One-Click Install (VS Code Custom Agent + MCP Servers)

macOS / Linux:

bash install.sh # Full install: deps + VS Code config + start servers
bash install.sh --no-vscode # Skip VS Code configuration
bash install.sh --servers-only # Only start MCP servers

Windows (PowerShell):

.\install.ps1 # Full install: deps + VS Code config + start servers
.\install.ps1 -NoVSCode # Skip VS Code configuration
.\install.ps1 -ServersOnly # Only start MCP servers

The installer will:

  1. Check prerequisites (Python 3.11+, uv/pip, Git)
  2. Install all Python dependencies
  3. Install GitHub Copilot extensions in VS Code
  4. Register MCP servers in VS Code user settings
  5. Start all 6 MCP servers
  6. Run health check to verify everything works

Manual Server Management

bash start_servers.sh # Start all 6 servers (ports 8001-8005, 8007)
bash start_servers.sh status # Check server status
bash start_servers.sh stop # Stop all servers
bash start_servers.sh restart # Restart all servers

Windows: .\stop_servers.ps1 (stop) / .\stop_servers.ps1 -Status (status)

2a. Use with VS Code (Custom Agent)

See VS Code Setup below — register servers in settings.json, place .agent.md in your project.

2b. Use with Web App (DeepAgent — Complete AI Programming Tool)

# Install dependencies
uv sync
# Start the web interface (requires OPENROUTER_API_KEY)
OPENROUTER_API_KEY=your-key uv run python web_app.py
# Open http://localhost:8000

2c. Use with TUI (Claude Code-style Terminal Interface)

# Start the TUI (requires OPENROUTER_API_KEY)
OPENROUTER_API_KEY=your-key uv run python tui_app.py

The TUI provides a Claude Code-style terminal experience — interactive prompt, streaming Markdown output with syntax highlighting, real-time tool call display (⏵ Read✓ Read), command history (↑/↓), and slash commands (/help, /clear, /status, /quit). Built on Rich + prompt_toolkit, no extra dependencies required.

The web app (and TUI) is a complete AI programming tool built on deepagents (create_deep_agent):

  • 62+ MCP tools from all 6 servers, unified into a single autonomous agent
  • 4 specialized subagents: Git Archaeologist, Code Scanner, Code Reviewer, Workspace Coordinator
  • Persistent memory via FilesystemBackend + MemoryMiddleware
  • Task planning via TodoListMiddleware
  • Hacker-style terminal UI — cyberpunk green-on-black aesthetic with real-time tool execution streaming
┌─────────────────────────────────────────────────────────────────────────┐
│ web_app.py (DeepAgent) │
│ │
│ ┌───────────────────────────────────────────────────────────────────┐ │
│ │ create_deep_agent( │ │
│ │ model = claude-sonnet-4-5 (via OpenRouter) │ │
│ │ tools = 62 tools from 6 MCP servers │ │
│ │ subagents = [git_archaeologist, code_scanner, │ │
│ │ code_reviewer, workspace_coordinator] │ │
│ │ memory = ["./AGENTS.md"] │ │
│ │ backend = FilesystemBackend │ │
│ │ middleware = [TodoList, Memory, Summarization, PatchToolCalls] │ │
│ │ ) │ │
│ └──────────────┬────────────────────────────────────────────────────┘ │
│ │ MCP Protocol (streamable-http) │
│ ┌──────────────▼────────────────────────────────────────────────────┐ │
│ │ filesystem:8001 git:8002 intel:8003 memory:8004 │ │
│ │ review:8005 multi-project:8007 │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ FastAPI + WebSocket → Hacker Terminal UI (http://localhost:8000) │
└─────────────────────────────────────────────────────────────────────────┘

3. Run Integration Tests (LLM-powered)

# Requires MCP servers running + OPENROUTER_API_KEY
NO_PROXY=localhost,127.0.0.1 uv run pytest tests/test_scenarios.py -v -s
# Run a single scenario
NO_PROXY=localhost,127.0.0.1 uv run pytest tests/test_scenarios.py::test_ydiff_commit_review -v -s

13 real scenarios covering: ydiff commit review, project health score, git history investigation, Python AST analysis, cross-file search, dependency graph, workspace registration, memory save/recall, Jenkinsfile pipeline generation, complex function detection, git blame, QA experience recording, project overview.

# Unit tests for auto_refactor two-phase commit (no MCP servers needed)
uv run pytest tests/test_refactor_commit.py -v

Tests cover: _git_commit helper, two-phase commit separation (#not-need-review / #need-review), auto_commit=False mode, commit tag format, git log --grep filtering.


Architecture

Design Philosophy

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 and surpass this closed-loop capability — usable both within VS Code Copilot Chat and as a standalone DeepAgent web app.

Core ideas:

  1. Separation of Concerns — Split Claude Code's capabilities into 6 independent MCP Servers, each doing one thing
  2. Composition over Inheritance — Assemble multiple servers into a complete Agent via agent files or DeepAgent
  3. Three Frontends, One Backend — VS Code, web_app.py, and tui_app.py share the same 6 MCP servers
  4. Security Sandbox — Each server has independent security policies (path checks, command blocklists, file whitelists)
  5. Surpass, Not Imitate — Code review and structural diff are capabilities Claude Code lacks, based on AST-level analysis and the ydiff algorithm
  6. Multi-Project First — Real development involves multiple repos (frontend+backend, app+library, service+pipeline). The workspace system treats multi-repo as a first-class concept
  7. Two-Phase Commit — AI code changes are split into mechanical commits (#not-need-review) and logic commits, so human reviewers can skip identity transformations and focus on real changes

System Architecture Diagram

┌─────────────────────────────────────────────────────────────────────────────┐
│ Three Frontends, One Backend │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────────────┐ │
│ │ VS Code Copilot │ │ web_app.py │ │ tui_app.py │ │
│ │ Chat │ │ (DeepAgent) │ │ (Claude Code-style TUI) │ │
│ │ │ │ │ │ │ │
│ │ .agent.md │ │ FastAPI+WS │ │ Rich + prompt_toolkit │ │
│ │ tools: │ │ create_deep_agent│ │ create_deep_agent │ │
│ │ filesystem-*/* │ │ 4 subagents │ │ 4 subagents │ │
│ │ git-tools/* │ │ Hacker Web UI │ │ Terminal streaming │ │
│ │ code-intel/* │ │ │ │ ⏵ Read → ✓ Read │ │
│ │ memory-store/* │ │ http://localhost │ │ Markdown rendering │ │
│ │ code-review/* │ │ :8000 │ │ Command history ↑↓ │ │
│ │ multi-project/* │ │ │ │ /help /clear /status │ │
│ └────────┬─────────┘ └────────┬─────────┘ └────────────┬─────────────┘ │
│ │ │ │ │
│ └──────────────────────┼──────────────────────────┘ │
│ │ │
│ ┌──────────────────▼─────────────────────┐ │
│ │ 6 MCP Servers (streamable-http) │ │
│ │ bash start_servers.sh │ │
│ └──────────────────┬─────────────────────┘ │
│ │ │
│ ┌───────────────────────────────▼───────────────────────────────────────┐ │
│ │ │ │
│ │ filesystem.py :8001 (12 tools) │ git_tools.py :8002 (11 tools) │ │
│ │ read/write/edit/find/search │ status/diff/log/blame/branch │ │
│ │ execute_command │ add/commit/stash/checkout │ │
│ │ │ │ │
│ │ code_intel.py :8003 (5 tools) │ memory_store.py :8004 (11 t.) │ │
│ │ AST analysis, symbols │ save/get/search/scratchpad │ │
│ │ project_overview, dep graph │ qa_experience_* │ │
│ │ │ │ │
│ │ code_review.py :8005 (11 tools) │ multi_project.py :8007 (15 t.) │ │
│ │ review_project/file/function │ workspace_add/search/edit/commit │ │
│ │ health_score, find_complex │ cross-repo coordination │ │
│ │ ydiff_files/commit/changes │ │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘

MCP Server Responsibilities

ServerFileToolsResponsibilityDesign Principle
filesystem-commandfilesystem.py12File CRUD, precise editing, file search, command executionThe Agent's "hands" — foundation for all file operations. edit_file replicates Claude Code's Edit tool
git-toolsgit_tools.py11Complete Git workflowDedicated tools are safer than generic commands. LLM calls structured functions without memorizing git syntax
code-intelcode_intel.py5Code understanding & analysisAST parsing compensates for LLM weaknesses. project_overview generates a full project panorama in one call
memory-storememory_store.py7Cross-session persistent memoryStructured JSON storage + categories/tags/search. scratchpad for complex reasoning
code-reviewcode_review.py11Code quality review + structural diff (includes ydiff tools)Unique capability — Claude Code doesn't have this. Self-contained AST analysis engine, quantifies code quality, locates hotspots, generates reorganization suggestions. Also includes ydiff AST-level diff for interactive HTML reports
multi-projectmulti_project.py15Multi-project workspace: cross-repo search, edit, git, coordinated commitUnique capability — Claude Code can only work in one directory. This enables Jenkinsfile+library, frontend+backend, microservice coordination

Data Flow: Typical Scenarios

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
⑤ ydiff_commit(".", "HEAD") → Generate structural diff HTML report

Scenario C: Multi-Project Coordinated Edit (Code Hacker Exclusive)

User: "The buildHelper function in the shared library changed, update Jenkinsfile too"
① workspace_add("/repos/shared-lib", alias="lib", role="library")
② workspace_add("/repos/my-app", alias="app", role="infra")
③ workspace_find_dependencies("buildHelper") → Trace all references across repos
④ workspace_read_file("lib", "src/helper.py") → Read library source
⑤ workspace_edit_file("lib", "src/helper.py", ...) → Edit library code
⑥ workspace_edit_file("app", "Jenkinsfile", ...) → Update pipeline accordingly
⑦ workspace_git_status() → Verify all changes across repos
⑧ workspace_commit("lib,app", "feat: update buildHelper signature and pipeline")

Scenario D: 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

Two-Phase Commit: Reviewer-Friendly AI Changes

A core principle across all three frontends: when AI makes code changes, separate mechanical changes from logic changes into distinct commits.

┌─────────────────────────────────────────────────────────────────┐
│ AI makes changes → split into two commits │
│ │
│ Commit 1: "refactor: move to handlers.py #not-need-review" │
│ ├─ Move functions/classes between files │
│ ├─ Rename variables (pure rename) │
│ ├─ Reformat, reorder imports │
│ └─ Identity transformation — behavior unchanged │
│ │
│ Commit 2: "feat: add retry logic to handler" │
│ ├─ Add/modify business logic │
│ ├─ Change function behavior │
│ └─ Bug fixes, new features │
│ │
│ Human reviewer: │
│ git log --grep="#not-need-review" --invert-grep ← 只看这些 │
└─────────────────────────────────────────────────────────────────┘

Like math: first do the identity transformation (shape-shifting), then apply the real function. The #not-need-review commits are provably equivalent — reviewer can skip them. The remaining commits are where the real logic lives.

This applies to:

  • All AI code modifications via VS Code agent, web app, or TUI — the system prompt instructs the AI to follow this pattern

Security Architecture

┌─────────────────────────────────────────┐
│ 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 │
│ │
│ multi_project.py: │
│ ├─ File type whitelist (same policy) │
│ ├─ Command blocklist (rm/format/dd) │
│ ├─ Command timeout (30s) │
│ └─ Workspace config in .agent-memory │
│ │
└─────────────────────────────────────────┘

Comparison with Claude Code

Feature-by-Feature Comparison

CapabilityClaude CodeCode HackerWinner
File ReadingRead — supports line numbers, PDF, imagesread_file + read_file_linesClaude Code (multimodal)
File WritingWrite — create or overwritewrite_file + append_fileTie
Precise EditingEdit — old→new replacementedit_file — same patternTie
File SearchGlob — ripgrepfind_files — pathlib.rglobClaude Code (faster)
Content SearchGrep — ripgrepsearch_files_ag — Silver SearcherTie
Command ExecutionBash — full shell, backgroundexecute_command — security sandboxClaude Code (more powerful) / Code Hacker (safer)
Git OperationsBash + git commands11 dedicated git toolsCode Hacker
Code AnalysisLLM readingAST parsing + symbol extractionCode Hacker
Project UnderstandingAgent multi-round explorationproject_overview one-callCode Hacker
Dependency AnalysisNonedependency_graphCode Hacker
Persistent MemoryMarkdown filesystemStructured JSON + categories/tagsCode Hacker
Web AccessWebFetch + WebSearchfetch (VS Code built-in)Claude Code (search)
Code ReviewNo dedicated toolsreview_project/file/function + health_scoreCode Hacker Exclusive
Structural DiffNone (line-level diff only)ydiff_files/commit/git_changes — AST-level (in code-review server)Code Hacker Exclusive
Change ReviewNonereview_diff_text — quantify old/new code differencesCode Hacker Exclusive
Multi-Project WorkspaceSingle directory onlyworkspace_* — 15 tools for cross-repo search, edit, git, coordinated commitCode Hacker Exclusive
HTML ReportsNonegenerate_report — visual quality reportsCode Hacker Exclusive
Sub-agentsAgent parallel spawning4 DeepAgent subagents (web_app.py)Tie
Images/PDFSupportedNot supportedClaude Code
NotebookNotebookEditNot supportedClaude Code

Advantage Summary

Code Hacker Exclusive/Superior (9 items):

  • Code Review: review_project/file/function quantifies code quality — Claude Code has nothing comparable
  • Structural Diff: ydiff_files/commit AST-based diff that understands code moves/renames (now in code-review server) — Claude Code only has line-level diff
  • Change Review: review_diff_text compares old/new code structural changes, quantifies complexity direction
  • Multi-Project Workspace: workspace_* 15 tools for cross-repo search, edit, git, coordinated commit — Claude Code is locked to a single directory
  • Health Score: health_score one-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 (4 items):

  • Command Execution: Full Bash shell + pipes + background processes
  • Multimodal: Image + PDF reading
  • Web Search: Search engine retrieval
  • Notebook Editing

Coverage

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)
Multi-Project ████████████████████ ∞% (Claude Code lacks this)
Web Access ██████████████░░░░░░ 70% (missing search engine)
Sub-agents ████████████████████ 100% (4 subagents in web_app.py)
Multimodal ░░░░░░░░░░░░░░░░░░░░ 0% (MCP limitation)
Notebook ░░░░░░░░░░░░░░░░░░░░ 0% (can be extended later)
─────────────────────────────────────────
Shared capability coverage ~85%
Unique capabilities +3 dimensions surpassing Claude Code

Project Files

.
├── start_servers.sh # Start/stop/status/restart all 6 MCP servers
├── web_app.py # DeepAgent web interface (FastAPI + WebSocket)
├── tui_app.py # Claude Code-style TUI (Rich + prompt_toolkit)
├── subagents.yaml # 4 subagent definitions for DeepAgent
├── static/
│ └── index.html # Hacker-style terminal UI
├── 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 + QA experience (11 tools)
├── code_review.py # MCP 5: Code quality review + structural diff / ydiff (11 tools)
├── multi_project.py # MCP 6: Multi-project workspace — cross-repo ops (15 tools)
├── lib/
│ ├── __init__.py
│ ├── ydiff_python.py # AST structural diff engine
│ └── refactor_auto.py # Auto-refactoring engine (function/file splitting)
├── tests/
│ ├── conftest.py # LLM test fixtures (DeepAgent session, run_agent_query)
│ ├── test_scenarios.py # 13 real code hack scenarios (LLM-powered pytest)
│ └── test_refactor_commit.py # Unit tests: two-phase commit strategy (#not-need-review / #need-review)
├── code-hacker.agent.md # VS Code agent definition (system prompt + tool bindings)
├── .vscode/
│ └── mcp.json # MCP server registration (reference; actual config in user settings)
├── pyproject.toml # Dependencies (deepagents, langchain, mcp, fastapi, ...)
└── README.md

Prerequisites

  • Python 3.11+
  • Git
  • uv (recommended) or pip

For VS Code mode:

  • VS Code 1.99+
  • GitHub Copilot Chat extension

For Web App / TUI mode:

  • OPENROUTER_API_KEY (or OPENAI_API_KEY)
# Install dependencies
uv sync # recommended# or: pip install mcp deepagents langchain langchain-openai langchain-mcp-adapters langgraph fastapi uvicorn

Optional (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_searcher

You can also set the AG_PATH environment variable to specify a custom path to the ag binary.

Installation & Configuration

Step 1: Start MCP Servers

All 6 MCP servers use streamable-http transport. Start them all at once with:

bash start_servers.sh # Start all 6 servers
bash start_servers.sh status # Check which servers are running
bash start_servers.sh stop # Stop all servers
bash start_servers.sh restart # Restart all servers

Or start 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 multi_project.py # Port 8007

Note: If you have a local HTTP proxy (e.g., on port 7890), set NO_PROXY=localhost,127.0.0.1 before starting clients to avoid 502 errors.

Once servers are running, you can use them with any combination of VS Code, Web App, and TUI — all three can run simultaneously.

Step 2 (VS Code): Register MCP Servers

Open settings.json (Ctrl+Shift+PPreferences: Open User Settings (JSON)) and add the following:

{
"mcp": {
"servers": {
"filesystem-command": {
"type": "sse",
"url": "http://localhost:8001/mcp"
},
"git-tools": {
"type": "sse",
"url": "http://localhost:8002/mcp"
},
"code-intel": {
"type": "sse",
"url": "http://localhost:8003/mcp"
},
"memory-store": {
"type": "sse",
"url": "http://localhost:8004/mcp"
},
"code-review": {
"type": "sse",
"url": "http://localhost:8005/mcp"
},
"multi-project": {
"type": "sse",
"url": "http://localhost:8007/mcp"
}
}
}
}

Step 3 (VS Code): Verify MCP Connection

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 (bash start_servers.sh status)
  • Ports 8001-8005, 8007 are not occupied by other processes

Step 4 (VS Code): Place Agent File

Place code-hacker.agent.md in the project root directory you want to use it in.

Key configuration — the tools field must use the server-name/* wildcard format:

tools: ["filesystem-command/*", "git-tools/*", "code-intel/*", "memory-store/*", "code-review/*", "multi-project/*", "fetch"]

fetch is a VS Code built-in tool and requires no additional configuration.

Step 5 (VS Code): Start Using

  1. Open the project containing code-hacker.agent.md in VS Code
  2. Open the Copilot Chat panel (Ctrl+Shift+I)
  3. Select Code Hacker in the mode selector at the top
  4. Start chatting

Troubleshooting: If Code Hacker doesn't appear in the mode selector:

  • Confirm VS Code >= 1.99
  • Confirm .agent.md file is in the workspace root
  • Restart VS Code

Step 2 (Web App): Start DeepAgent Web Interface

# Set your API keyexport OPENROUTER_API_KEY=your-key
# Optional: customize modelsexport LLM_MODEL=anthropic/claude-sonnet-4-5-20250514 # main agentexport LLM_SUBAGENT_MODEL=anthropic/claude-haiku-4-5-20251001 # subagents (cheaper)export LLM_BASE_URL=https://openrouter.ai/api/v1
# Start the web app
uv run python web_app.py
# Open http://localhost:8000

The web app connects to all 6 MCP servers, loads 62+ tools, creates a DeepAgent with 4 subagents, and serves a WebSocket-based chat UI with real-time tool execution streaming.

Step 2 (TUI): Start Claude Code-style Terminal Interface

# Set your API keyexport OPENROUTER_API_KEY=your-key
# Start the TUI
uv run python tui_app.py

The TUI provides the same DeepAgent backend as the web app but with a terminal-native interface:

  • Streaming output with Rich Markdown rendering and syntax highlighting
  • Tool call display in Claude Code style: ⏵ Read file.py✓ Read
  • Command history with ↑/↓ arrow keys
  • Slash commands: /help, /clear, /status, /quit
  • Interrupt support: Ctrl+C to cancel current operation

Ideal for SSH sessions, headless servers, or developers who prefer staying in the terminal.

Full Tool List

filesystem-command (12 tools)

ToolDescription
read_fileRead file content, supports utf-8/gbk/gb2312 encodings
read_file_linesRead specific line range, suitable for large files
write_fileWrite to file
append_fileAppend content to file
edit_filePrecise string replacement (pass old_string → new_string)
find_filesGlob pattern recursive file search
search_files_agRegex file content search (similar to ripgrep)
list_directoryList directory contents
get_file_infoFile details (size, timestamps, permissions)
create_directoryRecursively create directories
get_current_directoryGet working directory
execute_commandExecute system commands (dangerous commands blocked)

git-tools (11 tools)

ToolDescription
git_statusWorking tree status
git_diffView changes (supports staged)
git_logCommit history
git_showView commit content or file at specific revision
git_branchList branches
git_create_branchCreate new branch
git_checkoutSwitch branches/restore files
git_addStage files
git_commitCommit
git_stashStash management (push/pop/list)
git_blameLine-by-line change attribution

code-intel (5 tools)

ToolDescription
analyze_python_filePython AST deep analysis (classes, functions, imports, docstrings)
extract_symbolsExtract symbol definitions (Python/JS/TS/Java/Go/Rust)
project_overviewProject panorama (directory tree, language distribution, entry points, config)
find_referencesCross-file symbol reference search
dependency_graphFile import/imported-by relationship analysis

memory-store (7 tools)

ToolDescription
memory_saveSave memory (supports categories and tags)
memory_getRetrieve specific memory
memory_searchSearch memories (by keyword/category/tag)
memory_listList all memories
memory_deleteDelete memory
scratchpad_write/read/appendTemporary scratchpad (for complex reasoning)

code-review (11 tools)

ToolDescription
review_projectScan entire project: health score + issue list + reorganization suggestions
review_fileSingle file analysis, functions ranked by complexity
review_functionDeep analysis of a specific function with concrete refactoring suggestions
health_scoreQuick project health score (0-100)
find_long_functionsLongest functions ranking
find_complex_functionsHighest complexity functions ranking
suggest_reorgFile reorganization suggestions (by naming patterns and class distribution)
review_diff_textCompare old/new code strings, analyze change impact
ydiff_filesStructural AST-level diff: compare two Python files
ydiff_commitGit commit structural diff, multi-file HTML report
ydiff_git_changesCompare structural changes between any two git refs

multi-project (15 tools)

ToolDescription
workspace_addRegister a project into the workspace (with alias, role, description)
workspace_removeRemove a project from the workspace
workspace_listList all projects with live git status
workspace_overviewHigh-level overview of all projects (languages, configs, structure)
workspace_searchRegex/text search across all workspace projects
workspace_find_filesGlob pattern file search across all projects
workspace_find_dependenciesTrace a symbol across all projects (cross-repo impact analysis)
workspace_read_fileRead a file from any project by alias
workspace_edit_filePrecise string replacement in any project
workspace_write_fileWrite/create a file in any project
workspace_git_statusBird's-eye git status across all repos
workspace_git_diffDiff summary across all repos
workspace_git_logRecent commits across all repos
workspace_commitCoordinated commit with same message across multiple repos
workspace_execExecute a shell command in the context of any project

VS Code Built-in

ToolDescription
fetchFetch web page/API content

Usage Examples

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
You: Register my frontend and backend repos, then search for all API endpoints
→ workspace_add × 2 → workspace_search("@app.route\|@router") across both repos
You: The shared library's buildHelper changed, update the Jenkinsfile too
→ workspace_find_dependencies("buildHelper") → workspace_edit_file × 2 → workspace_commit
You: Show me what's changed across all my projects
→ workspace_git_status → workspace_git_diff

Customization & Extension

Add File Type Whitelist

Edit ALLOWED_EXTENSIONS in filesystem.py.

Modify Command Blocklist

Edit BLOCKED_COMMANDS in filesystem.py.

Adjust Agent Behavior

Edit the system prompt in code-hacker.agent.md.

Add New MCP Server

  1. Create a new .py file using FastMCP to define tools
  2. Run it with SSE transport on an available port
  3. Register the server URL in VS Code settings.json
  4. Add "new-server-name/*" to the tools field in code-hacker.agent.md

License

MIT

About

Code Hacker - VS Code Custom Agent + Web + TUI

Topics

Resources

Stars

53 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages