Maintaining forked repositories is tedious. Upstream authors keep shipping changes, and every sync risks merge conflicts. You either:
- Forget to sync β your fork falls behind, missing bug fixes and features
- Resolve conflicts manually β reading
<<<<<<<markers for hours - Give up and re-fork β losing your local modifications
ForkSync solves this. It automatically syncs your forks and uses AI coding agents (Claude Code, OpenCode, Codex) to resolve merge conflicts β so you never have to touch conflict markers again.
| Feature | Description |
|---|---|
| Auto Sync | Periodically fetches and merges upstream changes (configurable interval) |
| AI Conflict Resolution | Delegates merge conflicts to AI agents with git-aware prompts |
| Workflow-guided UI | Step-by-step workflow: fetch β merge β detect conflicts β agent resolve β review β commit |
| Live Agent Terminal | Real-time streaming view of agent output (stdout, tool calls, errors) during resolution |
| Desktop App | Polished Electron GUI β dashboard, workflow steps, settings |
| CLI | Full-featured command-line tool for terminal workflows |
| Directory Scanner | Recursively scans any directory to discover and batch-add fork repos |
| Sync History | SQLite-backed history with filters, AI-generated summaries, and cleanup |
| System Notifications | Desktop native alerts on sync success, conflicts, or errors |
| IDE Integration | Open repos directly in VSCode, Cursor, or Trae |
| Post-sync Commands | Execute custom scripts after a successful sync (e.g. pip install, npm build) |
| i18n | Multi-language interface (Chinese / English) |
| Multiple Agents | Switch between Claude Code and OpenCode freely |
Grab the latest release for your platform:
| Platform | Format | Link |
|---|---|---|
| macOS | .dmg |
Releases |
| Linux | .AppImage |
Releases |
| Windows | .exe (NSIS) |
Releases |
git clone https://github.com/loongxjin/forksync.git
cd forksync
# Full build (Go engine + Electron app)
make build
# Output: app/dist/cd engine && go build -o forksync . && ./forksync --helpmkdir -p ~/.forksyncEdit ~/.forksync/config.yaml:
github:
token: "ghp_your_token_here"Token is optional but recommended β it enables automatic upstream detection via GitHub API.
# Add a single repo
forksync add ~/projects/my-fork
# Scan a directory to batch-discover fork repos
forksync scan ~/projects# Sync all repos
forksync sync --all
# Sync a specific repo
forksync sync my-fork
# Start background sync service (every 30 min)
forksync serve# Resolve conflicts using AI (interactive)
forksync resolve my-fork
# Use a specific agent, auto-commit
forksync resolve my-fork --agent opencode --no-confirm
# Accept / reject a resolution
forksync resolve my-fork --accept
forksync resolve my-fork --rejectcd app && npm install && npm run devThis is the core feature that sets ForkSync apart. When a sync produces merge conflicts, ForkSync can automatically delegate resolution to an AI coding agent:
βββββββββββββββ conflict βββββββββββββββββ resolve ββββββββββββββββββ
β Upstream β βββββββββββββββΆ β ForkSync β βββββββββββββΆβ AI Agent β
β Change β β detects β β (Claude / β
βββββββββββββββ β conflict β β OpenCode) β
βββββββββββββββββ βββββββββ¬βββββββββ
β resolved
βΌ
βββββββββββββββββ ββββββββββββββββββ
β ForkSync β βββββββββββββ Verify & β
β commits β commit β Stage β
βββββββββββββββββ ββββββββββββββββββ
Supported Agents:
| Agent | Binary | Auto-detected |
|---|---|---|
| Claude Code | claude |
β |
| OpenCode | opencode |
β |
| Codex | codex |
β |
Agents are auto-discovered via PATH. Set a preferred agent in config:
agent:
preferred: "claude"Conflict resolution strategies:
| Strategy | Config key | Behavior |
|---|---|---|
| Auto-resolve with agent | conflict_strategy: agent_resolve |
Agent resolves conflicts automatically |
| Manual resolve | conflict_strategy: manual |
Pause at workflow β user chooses to resolve with agent or manually |
| Preserve local | resolve_strategy: preserve_ours |
Agent told to keep local changes, accept upstream non-conflicting |
| Preserve upstream | resolve_strategy: preserve_theirs |
Agent told to prefer upstream changes |
| Balanced | resolve_strategy: balanced |
Agent told to smart-merge preserving both sides |
Confirmation modes:
| Config | Behavior |
|---|---|
confirm_before_commit: true |
After agent resolves, wait for user review and accept/reject |
confirm_before_commit: false |
Auto-commit immediately after agent resolves |
Post-sync Commands:
Run custom scripts after each successful sync:
forksync post-sync add my-repo --name "install" --cmd "pip install -e ."
forksync post-sync list my-repo
forksync post-sync remove my-repo --id <cmd-id>Built with Electron + React + TypeScript + Tailwind CSS + shadcn/ui.
| Section | Description |
|---|---|
| Dashboard | Overview: repo statuses, recent sync activity |
| Repo List | Expandable repo cards with workflow steps or detail panel |
| Workflow Steps | Step-by-step progress: fetch β merge β check conflicts β resolve strategy β agent resolve β accept β commit |
| Agent Terminal | Real-time streaming view of agent output during resolution |
| AI Summary | After resolution, agent's git-history-aware summary in workflow |
| Diff Viewer | Side-by-side diff preview when reviewing changes |
| History | Sync timeline with filters, AI-generated summaries, and cleanup |
| Settings | General, agent config, post-sync commands, IDE preferences |
Architecture:
βββββββββββββββββββββββββββββββββββββ
β Electron UI (React) β
β Dashboard Β· Repos Β· Workflow β
β Agent Terminal Β· History β
βββββββββββββββββ¬ββββββββββββββββββββ
β IPC (contextBridge)
βββββββββββββββββΌββββββββββββββββββββ
β EngineClient (TypeScript) β
β Spawns Go binary, parses JSON β
βββββββββββββββββ¬ββββββββββββββββββββ
β --json / --stream flag
βββββββββββββββββΌββββββββββββββββββββ
β Go CLI Engine (Cobra) β
β add Β· sync Β· resolve Β· serve β
β agent Β· config Β· history β
β workflow Β· post-sync Β· summarize β
βββββββββββββββββββββββββββββββββββββ
All commands support --json for structured output.
# Repository management
forksync add <path> [--upstream <url>] # Add repo
forksync remove <name> # Remove from tracking
forksync scan <directory> # Batch-discover fork repos
# Sync
forksync sync [--all | <name>] # Sync repos
forksync serve [--interval 15m] # Background sync service
forksync status # Show all repo statuses
# AI conflict resolution
forksync resolve <name> [--agent claude] [--no-confirm] [--accept] [--reject]
forksync resolve <name> --stream # Stream agent output as NDJSON (Electron)
# Workflow management
forksync workflow continue <name> --action {accept|reject|abort|resolve_with_agent|retry_commit|continue_manual}
# Post-sync commands
forksync post-sync list <name>
forksync post-sync add <name> --name <name> --cmd <command>
forksync post-sync remove <name> --id <cmd-id>
# AI summarization
forksync summarize <name> [--retry] # Generate AI summary for last sync
# Agent management
forksync agent list # Detect installed agents
forksync agent sessions # List active sessions
forksync agent cleanup # Remove expired sessions
forksync agent reset <name> # Remove session for specific repo
# Configuration
forksync config get # Show all config
forksync config set <key> <value> # Set config value
forksync config keys # List available keys
# History
forksync history [--limit 20] [--cleanup [--keep-days 30]]Location: ~/.forksync/config.yaml
sync:
default_interval: "30m"
sync_on_startup: true
auto_launch: false
auto_summary: true
summary_agent: "claude"
summary_language: "zh" # zh / en
summary_timeout: "3m"
agent:
preferred: "claude"
priority: [claude, opencode, codex]
timeout: "10m"
conflict_strategy: "agent_resolve" # agent_resolve / manual
resolve_strategy: "preserve_ours" # preserve_ours / preserve_theirs / balanced
confirm_before_commit: true
session_ttl: "24h"
github:
token: ""
notification:
enabled: true
proxy:
enabled: false
url: ""Data files:
| Path | Purpose |
|---|---|
~/.forksync/config.yaml |
User configuration |
~/.forksync/repos.json |
Managed repository list |
~/.forksync/sessions/<id>.json |
Agent session records |
~/.forksync/agent-logs/<repo>/ |
Agent stream log files (NDJSON) |
~/.forksync/db/sync_history.db |
SQLite sync history |
~/.forksync/logs/sync-*.log |
Daily-rotated log files |
forksync/
βββ engine/ # Go CLI engine
β βββ cmd/ # Cobra commands (sync, resolve, workflow, agent, etc.)
β βββ internal/
β β βββ agent/ # AI agent adapters (Claude, OpenCode, Codex)
β β β βββ session/ # Session lifecycle management
β β βββ config/ # Viper-based YAML config
β β βββ conflict/ # Merge conflict detection
β β βββ git/ # Git operations (native + CLI)
β β βββ history/ # SQLite sync history store
β β βββ logger/ # File logger with daily rotation
β β βββ notify/ # Desktop system notifications
β β βββ repo/ # Repository JSON store (thread-safe)
β β βββ scheduler/ # Background sync scheduler
β β βββ summarizer/ # AI-powered sync commit summarizer
β β βββ sync/ # Core sync pipeline
β βββ pkg/types/ # Shared types
β
βββ app/ # Electron desktop app
β βββ src/main/ # Electron main process + EngineClient
β βββ src/preload/ # Context bridge (window.api)
β βββ src/renderer/ # React UI (pages, components, contexts)
β
βββ build/ # Build scripts
βββ docs/ # Documentation
cd engine && go test ./... -v146 tests across 15 test files β covering sync pipeline, agent adapters, session management, git operations, conflict detection, config, history, and more.
See Development Guide for setup instructions and architecture details.
