Skip to content

Tech Stack

aig is built as a three-layer architecture: a Rust core engine for performance, a TypeScript orchestration layer for LLM integration, and React-based interfaces.

INFO

Full technical decision document: TECH_STACK.md on GitHub

Architecture

┌─────────────────────────────────────────┐
│              User (CLI/TUI)             │
├─────────────────────────────────────────┤
│         Rust Core Engine (aig)          │
│  ┌──────────┐ ┌──────────┐ ┌────────┐  │
│  │  CLI     │ │ Storage  │ │  Git   │  │
│  │ (clap)   │ │ (SQLite) │ │(git2)  │  │
│  └──────────┘ └──────────┘ └────────┘  │
│  ┌──────────────────────────────────┐   │
│  │  Tree-sitter (semantic diff)    │   │
│  └──────────────────────────────────┘   │
├───────────── NDJSON IPC ────────────────┤
│      TypeScript Orchestration           │
│  ┌──────────┐ ┌──────────────────────┐  │
│  │ LLM SDK  │ │ Conversation Mgmt   │  │
│  │(Anthropic)│ │ (intent inference)  │  │
│  └──────────┘ └──────────────────────┘  │
└─────────────────────────────────────────┘

Core Technologies

ComponentTechnologyWhy
CLI & core engineRustFast, single binary, no runtime deps, cross-platform
CLI parsingclap (derive)Mature, self-documenting
AST parsingtree-sitter100+ languages, incremental parsing, battle-tested
Semantic diffCustom (GumTree-style)AST-level change detection across language grammars
StorageSQLite (rusqlite)Embedded, zero-config, complex queries for intent graph
Blob storeContent-addressable (SHA-256)Deduplication, git-compatible approach
Git interoplibgit2 (git2-rs)Programmatic git access, no shell-out
LLM integrationTypeScript + Anthropic SDKBest SDK ecosystem, streaming support
IPCNDJSON over stdin/stdoutSimple, debuggable, low overhead
SerializationMessagePackCompact, schema-less, fast
File watchingnotify (v8)Cross-platform fs events (inotify/FSEvents/ReadDirectoryChanges)
Async runtimeTokioFile watching, IPC, future network ops

Project Structure

ai-git/
├── crates/
│   ├── aig-core/           # Rust: CLI binary, storage, git interop
│   │   └── src/
│   │       ├── main.rs      # CLI entry point (clap) — 12 commands
│   │       ├── db.rs        # SQLite database layer
│   │       ├── storage.rs   # Content-addressable blob store
│   │       ├── session.rs   # Session management
│   │       ├── checkpoint.rs# Checkpoint creation + semantic change recording
│   │       ├── intent.rs    # Intent CRUD
│   │       ├── git_interop.rs # git2 integration
│   │       ├── diff.rs      # Line-based diff + git working tree
│   │       ├── import.rs    # Git history import + clustering + IPC
│   │       ├── capture.rs   # Claude Code conversation capture
│   │       └── watch.rs     # File system watching + auto-checkpoint
│   └── aig-treesitter/      # Rust: multi-language semantic diff
│       └── src/lib.rs       # Tree-sitter parsing + AST comparison
├── packages/
│   ├── aig-llm/             # TypeScript: LLM integration
│   │   └── src/
│   │       ├── providers/   # Anthropic SDK, provider abstraction
│   │       ├── ipc.ts       # NDJSON IPC server
│   │       └── import.ts    # Commit clustering + LLM inference
│   └── aig-tui/             # TypeScript: Terminal UI (phase 2)
├── docs/                    # VitePress documentation site
├── Cargo.toml               # Rust workspace
├── package.json             # pnpm root
└── pnpm-workspace.yaml      # Workspace config

Build & Development

bash
# Rust
cargo build              # Build the aig binary
cargo test               # Run all tests
cargo run -- --help      # Run the CLI

# TypeScript
pnpm install             # Install dependencies
pnpm build               # Build all packages

# Docs
cd docs && pnpm dev      # Local dev server

Supported Platforms

Built and tested on Linux, macOS, and Windows. Cross-compilation via Cargo + GitHub Actions matrix builds.

Semantic Diff: Supported Languages

LanguageTree-sitter GrammarDefinition Types Tracked
TypeScript/JStree-sitter-typescriptfunctions, classes, interfaces, type aliases, methods
Pythontree-sitter-pythonfunctions, classes
Rusttree-sitter-rustfunctions, structs, enums, impls, traits, types
Gotree-sitter-gofunctions, methods, types
Javatree-sitter-javaclasses, interfaces, methods, constructors, enums
C#tree-sitter-c-sharpclasses, interfaces, methods, structs, enums, constructors
C++tree-sitter-cppfunctions, classes, structs, enums, templates
Rubytree-sitter-rubymethods, classes, modules
PHPtree-sitter-phpfunctions, methods, classes, interfaces, traits, enums
Kotlintree-sitter-kotlin-ngfunctions, classes, objects
Swifttree-sitter-swiftfunctions, classes, protocols, type aliases

Other languages fall back gracefully to line-based diffing.

Released under the MIT License.