Synapse is a bridge that lets VS Code Copilot orchestrate Claude Code through MCP (Model Context Protocol).
- Copilot handles planning, review, and decision points.
- Claude Code executes coding tasks in isolated git worktrees.
- Synapse captures results (status, diff, test output) and returns them to Copilot.
- MCP-native task orchestration for Copilot
- Isolated per-task git worktree execution
- Parallel task dispatch support
- Structured task lifecycle and JSON persistence
- Built-in verification hook (run tests + return review report)
- Python 3.11+
- Poetry
- Git
- Claude Code CLI (
claudecommand available in PATH) - VS Code with Copilot and MCP support
git clone https://github.com/pengkangzhen/synapse.git
cd synapse
poetry installgit rev-parse --is-inside-work-treeIf this fails, run:
git init
git add .
git commit -m "chore: initialize repository"Default config is in .synapse/config.yaml.
Important fields:
claude_cli_path: path toclaudebase_branch: usuallymainmax_concurrent_tasks: max parallel Claude runstest_command: command used byverify_task
poetry run python -m synapse.mcpIn VS Code, .vscode/mcp.json can auto-register this server for Copilot.
- Brainstorm and define a task.
- Call
plan_taskto register it. - Confirm and call
dispatch_task. - Poll with
get_task_statusuntil completed. - Review with
get_task_result. - Validate with
verify_task. - Confirm and finish with
merge_task.
If Synapse is already installed in a central location (for example: ~/tools/synapse),
you can reuse it from any other repository.
- The target project is a git repository
- VS Code + Copilot with MCP support is available
claudeCLI is installed and authenticated
Create .vscode/mcp.json in the target project:
{
"servers": {
"synapse": {
"type": "stdio",
"command": "poetry",
"args": ["run", "python", "-m", "synapse.mcp"],
"cwd": "/Users/yourname/tools/synapse",
"env": {
"SYNAPSE_CONFIG": "${workspaceFolder}/.synapse/config.yaml"
}
}
}
}Notes:
cwdshould point to your Synapse installation rootSYNAPSE_CONFIGshould point to the current project config
Create .synapse/config.yaml in the target project:
claude_cli_path: "claude"
base_branch: "main"
max_concurrent_tasks: 3
default_timeout_seconds: 600
test_command: "poetry run pytest -v"Adjust test_command to match your stack (for example npm test, pnpm test, etc.).
Run command palette action: Developer: Reload Window.
plan_taskdispatch_task(after human confirmation)get_task_status(poll)get_task_resultverify_taskmerge_task(after human confirmation)
Use this checklist when task execution fails or hangs.
claudecommand is available:claude --version- target project is inside a git worktree:
git rev-parse --is-inside-work-tree .vscode/mcp.jsonexists and points to correctcwd.synapse/config.yamlexists in the current project
- Error:
unknown option '--directory'
- Cause: incompatible Claude CLI flag usage
- Fix: use latest Synapse code (no
--directoryflag)
- Error:
When using --print, --output-format=stream-json requires --verbose
- Cause: newer Claude CLI requires
--verbosefor stream-json mode - Fix: use Synapse version that adds
--verboseto executor command
- Task appears stuck in
executing
- Check
get_task_statusrepeatedly foris_process_running - If process is gone, call
get_task_resultto see final reconciliation message - If needed, call
cancel_taskand dispatch again
- Repeated model/API retries (429 rate limit)
- Cause: provider rate limiting
- Fix: retry later, reduce parallel tasks, or lower request frequency
cancel_task(task_id="...")for stuck tasks- Run
Developer: Reload Window - Re-run from
plan_task
get_task_resulthas expected diff/summaryverify_taskreturns report with expected test status- acceptance criteria reviewed manually in Copilot chat
flowchart LR
U[User in VS Code] --> C[Copilot Chat]
C -->|plan_task / dispatch_task| M[Synapse MCP Server]
M -->|create worktree + run| CC[Claude Code CLI]
CC -->|code changes| W[(Task Worktree)]
W -->|diff + status + logs| M
M -->|get_task_status / get_task_result / verify_task| C
C -->|review + human confirmation| G[merge_task]
G --> R[(main branch)]
planned -> dispatched -> executing -> completed -> verified -> merged
\-> failed
planned/executing -> cancelled
src/synapse/
claude/ # Claude prompt builder and executor
config/ # settings loader
core/ # task model, store, worktree, verifier
mcp/ # MCP server and entrypoint
- For parallel tasks, prefer non-overlapping
files_to_modify. - Use absolute paths for
claude_cli_pathif worktree-relative execution causes path issues. - Runtime artifacts are stored under
.synapse/tasksand.synapse/worktrees.