Skip to main content
The Git backend is a comprehensive Rust module providing repository analysis, commit tracking, and attribution data. This backend powers the transparency layer that makes AI work visible to humans.

Architecture

The git operations module consists of approximately 4,142 lines of Rust code organized into 18 sections, serving as the foundation for work transparency.
+===============================================================================+
|                                                                               |
|  GIT BACKEND ARCHITECTURE                                                     |
|                                                                               |
+===============================================================================+
|                                                                               |
|                          FRONTEND (TypeScript)                                |
|                                 |                                             |
|                                 | invoke() / emit()                           |
|                                 v                                             |
|  +=========================================================================+  |
|  |                                                                         |  |
|  |     ANALYTICS & VISUALIZATION LAYER                                     |  |
|  |     ================================================                    |  |
|  |                                                                         |  |
|  |     Author timelines  |  Stash details    |  Project summary            |  |
|  |     Branch topology   |  Timeline views   |  Commit graphs              |  |
|  |                                                                         |  |
|  |     PURPOSE: Rich data extraction for transparency visualization        |  |
|  |                                                                         |  |
|  +=========================================================================+  |
|                                 |                                             |
|                                 | Internal function calls                     |
|                                 v                                             |
|  +=========================================================================+  |
|  |                                                                         |  |
|  |     ADVANCED FEATURES LAYER                                             |  |
|  |     ================================================                    |  |
|  |                                                                         |  |
|  |     Commit details  |  Blame tracking   |  Push/pull operations         |  |
|  |     GitHub CLI      |  Commit graphs    |  Search & filtering           |  |
|  |                                                                         |  |
|  |     PURPOSE: Complex operations and external integrations               |  |
|  |                                                                         |  |
|  +=========================================================================+  |
|                                 |                                             |
|                                 | Internal helper calls                       |
|                                 v                                             |
|  +=========================================================================+  |
|  |                                                                         |  |
|  |     FOUNDATION LAYER                                                    |  |
|  |     ================================================                    |  |
|  |                                                                         |  |
|  |     Status & Diff   |  Stage/Unstage   |  Commit operations            |  |
|  |     Branch mgmt     |  Worktree ops    |  Stash operations             |  |
|  |                                                                         |  |
|  |     PURPOSE: Basic git operations and type definitions                  |  |
|  |                                                                         |  |
|  +=========================================================================+  |
|                                 |                                             |
|                                 | git2 crate / git CLI                        |
|                                 v                                             |
|                          GIT REPOSITORY                                       |
|                                                                               |
+===============================================================================+

Core Functions

The backend exposes 47 Tauri commands for frontend access, organized by functionality:

Status & Diff Operations

  • Repository status tracking
  • File change detection
  • Staged/unstaged classification
  • Diff generation with line-level detail

Commit Operations

  • Commit history retrieval
  • Commit detail extraction
  • Author attribution
  • Graph visualization coordinates

Branch Management

  • Branch listing and grouping
  • Branch creation and switching
  • Branch relationship topology
  • Evolution tracking

Attribution Tracking

  • Line-level blame information
  • Author timeline generation
  • Collaboration event tracking
  • Contribution statistics

Transparency Data Flow

+===============================================================================+
|                                                                               |
|  TRANSPARENCY ENGINE                                                          |
|                                                                               |
+===============================================================================+
|                                                                               |
|                         GIT REPOSITORY                                        |
|                              |                                                |
|                              | (commits, branches, history)                   |
|                              v                                                |
|                     +------------------+                                      |
|                     |                  |                                      |
|                     |   Git Backend    |                                      |
|                     |   (Rust)         |                                      |
|                     |                  |                                      |
|                     +--------+---------+                                      |
|                              |                                                |
|           +------------------+------------------+                             |
|           |                  |                  |                             |
|           v                  v                  v                             |
|   +--------------+   +---------------+   +---------------+                    |
|   |              |   |               |   |               |                    |
|   |     WHO      |   |     WHAT      |   |   WHEN/HOW   |                    |
|   |   changed    |   |   changed     |   |   changed    |                    |
|   |              |   |               |   |               |                    |
|   +--------------+   +---------------+   +---------------+                    |
|           |                  |                  |                             |
|           |                  |                  |                             |
|   Blame tracking     Diff parsing      Timeline data                          |
|   Author stats       Change detail     Graph coords                           |
|                                                                               |
+===============================================================================+

Technology Stack

The backend utilizes:
  • git2: Native Rust git library for local operations
  • Tauri IPC: Frontend-backend communication
  • serde: JSON serialization for data transfer
  • chrono: Time formatting and manipulation
  • git CLI: External operations requiring credentials

API Selection Strategy

+===============================================================================+
|                                                                               |
|  API SELECTION DECISION MATRIX                                                |
|                                                                               |
+===============================================================================+
|                                                                               |
|  OPERATION              | git2     | CLI      | REASON                       |
|  ------------------------|----------|----------|------------------------------|
|  Open repository        | YES      | -        | Efficient                    |
|  Read status            | YES      | -        | Fast, structured             |
|  Read diff              | YES      | -        | Structured parsing           |
|  Read log               | YES      | -        | Revwalk API                  |
|  Commit                 | YES      | -        | Atomic operation             |
|  Stage/Unstage          | YES      | -        | Index manipulation           |
|  Branch operations      | YES      | -        | Local operations             |
|  Push/Pull              | -        | YES      | Credential handling          |
|  Blame                  | PARTIAL  | YES      | Porcelain format better      |
|  Worktree add/remove    | -        | YES      | git2 API limited             |
|  GitHub operations      | -        | YES (gh) | External integration         |
|                                                                               |
+===============================================================================+

Performance Optimizations

Batch API

Single call retrieves all repository data:
  • Status (staged, unstaged, untracked files)
  • Branches (local and remote)
  • Commits (last N commits)
  • Worktrees (all worktrees)
  • Stashes (all stashes)
Result: 5x reduction in IPC overhead

Parsed Diff

Rust backend pre-processes diff data with line type classification, eliminating frontend parsing overhead. Result: 5-10x improvement on large diffs

Time Formatting

Relative time formatting moved from JavaScript to Rust, reducing frontend computation.

THE CENTER

This backend enables transparency by extracting git data and making AI work visible. Without it, the Human-AI feedback loop would be blind, incomprehensible, and broken.