The Agent SDK gives us a "mini Claude" that can:
- Read files, run bash commands, search codebases
- Use custom MCP tools we define
- Maintain conversation context across interactions
- Spawn subagents for parallel work
We don't bolt Claude onto a git UI. We build a git UI that Claude inhabits.
┌─────────────────────────────────────────┐
│ Electron Main Process │
│ ┌─────────────────────────────────────┐ │
│ │ Agent SDK Instance │ │
│ │ - Git MCP Tools │ │
│ │ - UI Control MCP Tools │ │
│ │ - Session Management │ │
│ └─────────────────────────────────────┘ │
│ ↕ │
│ ┌─────────────────────────────────────┐ │
│ │ Electron Renderer (React) │ │
│ │ - Commit Graph Visualization │ │
│ │ - Diff Viewer │ │
│ │ - Claude Response Display │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────┘
Pros: Mature ecosystem, easy packaging, familiar dev experience Cons: Heavy (Chromium), slower startup, memory hog
┌─────────────────────────────────────────┐
│ Tauri Backend (Rust) │
│ ┌─────────────────────────────────────┐ │
│ │ Node.js Sidecar (Agent SDK) │ │
│ │ - Git MCP Tools │ │
│ │ - UI Control via IPC │ │
│ └─────────────────────────────────────┘ │
│ ↕ │
│ ┌─────────────────────────────────────┐ │
│ │ WebView (React/Solid) │ │
│ │ - Commit Graph (native rendering?) │ │
│ │ - Modern, fast UI │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────┘
Pros: Tiny binary (~10MB vs ~150MB), fast, native feel Cons: More complex architecture (Rust + Node sidecar), newer ecosystem
- Native performance for graph rendering
- Agent SDK runs as separate process
- Most complex to build, best UX
This is actually the hardest part. GitKraken's graph is their moat.
Options for graph rendering:
-
Canvas/WebGL - What GitKraken likely uses
- Smooth zooming/panning
- Can handle huge repos
- Complex to build well
-
SVG - Simpler
- Easier to make interactive
- Performance ceiling with large repos
- Libraries exist (D3, etc.)
-
React Flow / xyflow - Modern option
- Built for node-based UIs
- Might need adaptation for git DAG
- Good interactivity out of box
-
Existing Libraries:
git-graphnpm packagereact-git-graph- Most are basic, might need heavy customization
Recommendation: Start with SVG/D3 for MVP, plan for Canvas/WebGL for scale.
This is where GitClawd becomes special. Claude gets custom tools:
// Git State Tools
tool("GetRepoStatus", "Get full repo state", ...)
tool("GetCommitHistory", "Get commits with filters", ...)
tool("GetBranchList", "List all branches", ...)
tool("GetFileDiff", "Get diff for file/commit", ...)
tool("GetMergeConflicts", "List current conflicts", ...)
// Git Action Tools
tool("StageFiles", "Stage files for commit", ...)
tool("CreateCommit", "Create a commit", ...)
tool("CreateBranch", "Create new branch", ...)
tool("CheckoutBranch", "Switch branches", ...)
tool("MergeBranch", "Merge branch into current", ...)
tool("RebaseBranch", "Rebase branch", ...)
tool("CherryPick", "Cherry-pick commits", ...)
tool("ResolveConflict", "Resolve a merge conflict", ...)
// UI Control Tools
tool("HighlightCommit", "Highlight commit in graph", ...)
tool("ShowDiff", "Display diff in viewer", ...)
tool("FocusBranch", "Pan/zoom to branch", ...)
tool("ShowNotification", "Display message to user", ...)
tool("RequestConfirmation", "Ask user yes/no", ...)The magic: Claude doesn't just run git commands blindly. It can:
- Query the visual state ("what commit is selected?")
- Update the visual state ("highlight these commits")
- Ask for confirmation through the UI
- Show its work visually as it operates
What does Claude "see" at any moment?
interface GitClawdContext {
// Currently open repo
repoPath: string;
currentBranch: string;
// UI State
selectedCommits: string[]; // SHAs
selectedFiles: string[];
visibleCommitRange: [string, string]; // What's on screen
activeDiff: DiffState | null;
// Repo State
stagedFiles: string[];
modifiedFiles: string[];
untrackedFiles: string[];
stashList: StashEntry[];
// Merge State
isMerging: boolean;
isRebasing: boolean;
conflicts: ConflictInfo[];
}This context gets injected into Claude's system prompt or available via tools.
User clicks commit → Claude sees it → Claude offers contextual actions "This commit touched 5 files in /auth. Want me to explain the changes?"
User types "squash last 3 commits" → Claude runs the operation → UI updates
Claude notices you've been on a branch for 50 commits behind main "Your branch is significantly behind. Want me to show what's changed in main?"
Merge conflict appears → Claude immediately analyzes "I can see the conflict. Upstream changed the function signature, you added a parameter. Here's my suggested resolution: [show merged code]"
-
Electron vs Tauri?
- Electron: Faster to ship, heavier
- Tauri: Better UX, more complex setup
-
Graph Library?
- Build custom with D3/Canvas?
- Use existing library?
- Start simple, optimize later?
-
Pricing Model?
- Users bring their own API key?
- GitClawd subscription includes API costs?
- Freemium (basic git free, Claude features paid)?
-
MVP Scope?
- Single repo only?
- Which git operations first?
- How much Claude integration initially?
- Commit graph visualization (SVG/D3)
- Branch labels and colors
- Click to select commit
- Basic diff viewer
- Works with local repos
- Agent SDK embedded
- Basic MCP tools (status, log, diff)
- Chat interface
- Context awareness (knows selected commit)
- Stage/unstage files (via Claude or UI)
- Commit (with Claude-generated messages)
- Branch create/switch/delete
- Merge with conflict resolution
- Rebase (interactive via Claude)
- Cherry-pick
- Stash management
- Remote operations (push/pull/fetch)
- PR integration (GitHub/GitLab)
- Location:
/spikes/graph/ - Tech: Plain HTML + Canvas
- Result: Works. Renders commits, branches, shows fork/merge structure, click-to-select works.
- Verified: Visual comparison with
git log --graphmatches. - Next: Need scrolling/panning for large repos, better merge commit handling.
- Location:
/spikes/agent-sdk/ - Tech: Node.js +
@anthropic-ai/claude-agent-sdk - Result: Works. Claude uses custom MCP tools correctly.
- Verified: Ran query, Claude used
mcp__git-tools__GetGitLog(not Bash). - Cost: ~$0.02 per simple query.
Claude can do everything with Bash. But custom MCP tools give us:
- UI integration - Tools can update the UI, highlight commits. Bash can't.
- Structured data - Tools return JSON. Bash returns text to parse.
- Safety - We control exactly what operations exist.
- Context awareness - Tools can read UI state ("what's selected?").
Decision: Use both. Custom MCP tools for UI-integrated operations, Bash available for edge cases.
- Decision: Electron or Tauri?
- Scaffold: Basic desktop app with graph + agent
- Iterate: Add git operations one by one